Questions Tagged with #Bloomberg

For programming questions related to the Bloomberg API, which provides financial news and data services.

Bloomberg BDH function with ISIN

I have to download historical end of day data for a huge list of stocks. I found on the bloomberg excel add-in the function BDH that is very useful. That is what I need but there is an issue: my stock..

Bloomberg Open API

Bloomberg Open API announced recently - is it just the Bloomberg SDK which had been (limitedly) exposed to public for quite a while? My understanding is that Bloomberg SDK is possible to use only on ..

Linux bash: Multiple variable assignment

Does exist in linux bash something similar to the following code in PHP: list($var1, $var2, $var3) = function_that_returns_a_three_element_array() ; i.e. you assign in one sentence a corresponding ..

How to get text in QlineEdit when QpushButton is pressed in a string?

I am trying to implement a function. My code is given below. I want to get the text in lineedit with objectname 'host' in a string say 'shost' when the user clicks the pushbutton with name 'connect'...

What does Python's socket.recv() return for non-blocking sockets if no data is received until a timeout occurs?

Basically, I've read in several places that socket.recv() will return whatever it can read, or an empty string signalling that the other side has shut down (the official docs don't even mention what ..

Password must have at least one non-alpha character

I need a regular expression for a password. The password has to contain at least 8 characters. At least one character must be a number or a special character (not a letter). [StringLength(100, ErrorM..

convert UIImage to NSData

I am using this code in my app which will help me to send a image. However, I have an image view with an image. I have no file in appbundle but have the image in my side. How can I change the below c..

How to get height of entire document with JavaScript?

Some documents I can't get the height of the document (to position something absolutely at the very bottom). Additionally, a padding-bottom on seems to do nothing on these pages, but do on the pages ..

How do I edit $PATH (.bash_profile) on OSX?

I am trying to edit an entry to PATH, as I did something wrong. I am using Mac OS X 10.10.3 I have tried: > touch ~/.bash_profile; open ~/.bash_profile But the file editor opens with nothin..

How do you reverse a string in place in JavaScript?

How do you reverse a string in place (or in-place) in JavaScript when it is passed to a function with a return statement, without using built-in functions (.reverse(), .charAt() etc.)?..

Pointer to class data member "::*"

I came across this strange code snippet which compiles fine: class Car { public: int speed; }; int main() { int Car::*pSpeed = &Car::speed; return 0; } Why does C++ have this p..

How to select the rows with maximum values in each group with dplyr?

I would like to select a row with maximum value in each group with dplyr. Firstly I generate some random data to show my question set.seed(1) df <- expand.grid(list(A = 1:5, B = 1:5, C = 1:5)) df..

How can I make a button have a rounded border in Swift?

I'm building an app using swift in the latest version of Xcode 6, and would like to know how I can modify my button so that it can have a rounded border that I could adjust myself if needed. Once that..

Error while inserting date - Incorrect date value:

I have a column called today and the type is DATE. When I try to add the date in the format '07-25-2012' I get the following error: Unable to run query:Incorrect date value: '07-25-2012' for colu..

How to search in a List of Java object

I have a List of object and the list is very big. The object is class Sample { String value1; String value2; String value3; String value4; String value5; } Now I have to searc..

C# list.Orderby descending

I would like to receive a list sorted by 'Product.Name' in descending order. Similar to the function below which sorts the list in ascending order, just in reverse, is this possible? var newList = ..


I am running an example of ejb using JBoss5 Container. I am using an example from here(Part one). In the example I deployed bean in JBoss and an application in Tomcat(to acces the bean from JBoss). I..

How do I trim whitespace?

Is there a Python function that will trim whitespace (spaces and tabs) from a string? Example: \t example string\t ? example string..

Add space between HTML elements only using CSS

I have several same HTML elements going one after another: <span>1</span> <span>2</span> <span>3</span> I'm looking for the best way of adding space BETWEEN the ..

Renaming branches remotely in Git

If there is a repository that I only have git:// access to (and would usually just push+pull), is there a way to rename branches in that repository in the same way that I would do locally with git bra..

Dynamic array in C#

Is there any method for creating a dynamic array in C#? ..

Maven compile with multiple src directories

Is there a way to compile multiple java source directories in a single maven project? ..

How to identify unused CSS definitions from multiple CSS files in a project

A bunch of CSS files were pulled in and now I'm trying to clean things up a bit. How can I efficiently identify unused CSS definitions in a whole project?..

Decode Hex String in Python 3

In Python 2, converting the hexadecimal form of a string into the corresponding unicode was straightforward: comments.decode("hex") where the variable 'comments' is a part of a line in a file (the ..

How do I use sudo to redirect output to a location I don't have permission to write to?

I've been given sudo access on one of our development RedHat linux boxes, and I seem to find myself quite often needing to redirect output to a location I don't normally have write access to. The tro..

How to find which git branch I am on when my disk is mounted on other server

Our git repo is on a Linux server; I can be on the master branch or create a new branch that I can go inside and use. Our git repo disk is mounted on AIX box to build (I can see git directory in the ..

How to check if a string "StartsWith" another string?

How would I write the equivalent of C#'s String.StartsWith in JavaScript? var haystack = 'hello world'; var needle = 'he'; haystack.startsWith(needle) == true Note: This is an old question, and as..

The type java.lang.CharSequence cannot be resolved in package declaration

I get 2 classes in package P. Interface class A and its implementation class B. In the file with class B I get the following error: The type java.lang.CharSequence cannot be resolved. It is indirectl..

Echoing the last command run in Bash?

I am trying to echo the last command run inside a bash script. I found a way to do it with some history,tail,head,sed which works fine when commands represent a specific line in my script from a parse..

What are the possible values of the Hibernate configuration and what do they do

I really want to know more about the update, export and the values that could be given to I need to know when to use the update and when not? And what is the alternative? These..

Unable to connect to SQL Server instance remotely

I’m trying to access the SQL Server instance on my VPS from SQL Server Management Studio on my local machine. It’s not working (the error I’m getting is: A network-related or instance-specif..

Display only 10 characters of a long string?

How do I get a long text string (like a querystring) to display a maximum of 10 characters, using JQuery? Sorry guys I'm a novice at JavaScript & JQuery :S Any help would be greatly appreciated...

Javascript "Not a Constructor" Exception while creating objects

I am defining an object like this: function Project(Attributes, ProjectWidth, ProjectHeight) { this.ProjectHeight = ProjectHeight; this.ProjectWidth = ProjectWidth; this.ProjectScale = th..

How to get a list of MySQL views?

I'm looking for a way to list all views in a database. Initially I found and tried an answer on the MySQL forums: SELECT table_name FROM information_schema.views WHERE information_schema.views.table..

json_encode is returning NULL?

For some reason the item "description" returns NULL with the following code: <?php include('db.php'); $result = mysql_query('SELECT * FROM `staff` ORDER BY `id` DESC LIMIT 2') or die(mysql_error(..

WordPress Get the Page ID outside the loop

I want to get the page ID before starting the loop in WordPress. I am using $page = get_query_var('page_id'); Apparently, it returns nothing. I just want to check a page for its ID and add a clas..

MessageBodyWriter not found for media type=application/json

I am facing issues while consuming JAX-RS services as JSON. Below I have added my code. This is my service class: //Sets the path to base URL + /hello @Path("/hello") @Consumes(MediaType.APPLICATI..

NumPy array is not JSON serializable

After creating a NumPy array, and saving it as a Django context variable, I receive the following error when loading the webpage: array([ 0, 239, 479, 717, 952, 1192, 1432, 1667], dtype=int64) ..

Laravel use same form for create and edit

Am quite new to Laravel and I have to create a form for create and a form for edit. In my form I have quite some jquery ajax posts. Am wondering whether Laravel does provide for an easy way for me to ..

clear cache of browser by command line

I am working in media domain. I need to check every change in all leading browsers i.e. IE, Firefox, Chrome, Safari and Opera. To clear cache, every time i need to use Ctrl + Shift + del. Is there a..

How can I change the Y-axis figures into percentages in a barplot?

How can we change y axis to percent like the figure? I can change y axis range but I can't make it to percent. ..

ToggleButton in C# WinForms

Is it possible to create a toggle button in C# WinForms? I know that you can use a CheckBox control and set it's Appearance property to "Button", but it doesn't look right. I want it to appear sunken,..

C++ Array Of Pointers

In C++ if I want an array of pointers so that I may have them point to different objects at a latter stage what does the syntax look like. EDIT I need to clarify what I am trying to do I guess. I ha..

How do I convert a numpy array to (and display) an image?

I have created an array thusly: import numpy as np data = np.zeros( (512,512,3), dtype=np.uint8) data[256,256] = [255,0,0] What I want this to do is display a single red dot in the center of a 512x..

constant pointer vs pointer on a constant value

What is the difference between the following declarations? char * const a; const char * a; In order to understand the difference I wrote this small program: #include <stdio.h> #include <s..

How to append contents of multiple files into one file

I want to copy the contents of five files to one file as is. I tried doing it using cp for each file. But that overwrites the contents copied from the previous file. I also tried paste -d "\n" 1.txt..

How to make a UILabel clickable?

I would like to make a UILabel clickable. I have tried this, but it doesn't work: class DetailViewController: UIViewController { @IBOutlet weak var tripDetails: UILabel! override func view..

What does the keyword Set actually do in VBA?

Hopefully an easy question, but I'd quite like a technical answer to this! What's the difference between: i = 4 and Set i = 4 in VBA? I know that the latter will throw an error, but I don't ful..

Plotting time in Python with Matplotlib

I have an array of timestamps in the format (HH:MM:SS.mmmmmm) and another array of floating point numbers, each corresponding to a value in the timestamp array. Can I plot time on the x axis and the ..

How to find a min/max with Ruby

I want to use min(5,10), or Math.max(4,7). Are there functions to this effect in Ruby?..

what does -zxvf mean in tar -zxvf <filename>?

I have seen on many websites commands like this what does the "-zxvf" or the similar commands stand for? tar -zxvf <filename> tar xvf <filename> ..

How to extract elements from a list using indices in Python?

If you have a list in python, and want to extract elements at indices 1, 2 and 5 into a new list, how would you do this? This is how I did it, but I'm not very satisfied: >>> a [10, 11, 12,..

how to evenly distribute elements in a div next to each other?

This is meant for a menu. For example I have a div element with 3 spans in it, all of which have some margin, max-width and float (left or right). It is positioned starting from the left side and goes..

What is the cleanest way to ssh and run multiple commands in Bash?

I already have an ssh agent set up, and I can run commands on an external server in Bash script doing stuff like: ssh blah_server "ls; pwd;" Now, what I'd really like to do is run a lot of ..

Why should we include ttf, eot, woff, svg,... in a font-face

In CSS3 font-face, there are multiple font types included like ttf, eot, woff, svg and cff. Why should we use all of these types? If they are special to different browsers, why is the number of them..

Jenkins: Cannot define variable in pipeline stage

I'm trying to create a declarative Jenkins pipeline script but having issues with simple variable declaration. Here is my script: pipeline { agent none stages { stage("first") { ..

How to change dot size in gnuplot

How to change point size and shape and color in gnuplot. plot "./points.dat" using 1:2 title with dots I am using above command to plot graph ,but it shows very small size points. I tried to use c..

Merging two images in C#/.NET

Simple idea: I have two images that I want to merge, one is 500x500 that is transparent in the middle the other one is 150x150. Basic idea is this: Create an empty canvas that is 500x500, position th..

The relationship could not be changed because one or more of the foreign-key properties is non-nullable

I am getting this error when I GetById() on an entity and then set the collection of child entities to my new list which comes from the MVC view. The operation failed: The relationship could not..

Remove Fragment Page from ViewPager in Android

I'm trying to dynamically add and remove Fragments from a ViewPager, adding works without any problems, but removing doesn't work as expected. Everytime I want to remove the current item, the last on..

Add class to <html> with Javascript?

How do you add a class to the <html> root element using Javascript?..

How can I pass a parameter to a Java Thread?

Can anyone suggest to me how I can pass a parameter to a thread? Also, how does it work for anonymous classes?..

Sending E-mail using C#

I need to send email via my C# app. I come from a VB 6 background and had a lot of bad experiences with the MAPI control. First of all, MAPI did not support HTML emails and second, all the emails wer..

When does System.getProperty("") return "c:\temp"

Just curious as to when System.getProperty("") returns "c:\temp". According to the Java Docs- The default temporary-file directory is specified by the system property ..

IsNumeric function in c#

I know it's possible to check whether the value of a text box or variable is numeric using try/catch statements, but IsNumeric is so much simpler. One of my current projects requires recovering value..

How to empty a redis database?

I've been playing with redis (and add some fun with it) during the last fews days and I'd like to know if there is a way to empty the db (remove the sets, the existing key....) easily. During my tests..

Is there a way to take the first 1000 rows of a Spark Dataframe?

I am using the randomSplitfunction to get a small amount of a dataframe to use in dev purposes and I end up just taking the first df that is returned by this function. val df_subset = data.randomSpli..

What is your single most favorite command-line trick using Bash?

We all know how to use <ctrl>-R to reverse search through history, but did you know you can use <ctrl>-S to forward search if you set stty stop ""? Also, have you ever tried running bind ..

mongodb group values by multiple fields

For example, I have these documents: { "addr": "address1", "book": "book1" }, { "addr": "address2", "book": "book1" }, { "addr": "address1", "book": "book5" }, { "addr": "address3", "..

How to install Android Studio on Ubuntu?

I have to install Android Studio on Ubuntu and I have used this link to download Android Studio. Is there any easy way to install Studio on Ubuntu?..

php convert datetime to UTC

I am in need of an easy way to convert a date time stamp to UTC (from whatever timezone the server is in) HOPEFULLY without using any libraries...

JavaScript calculate the day of the year (1 - 366)

How do I use JavaScript to calculate the day of the year, from 1 - 366? For example: January 3 should be 3. February 1 should be 32. ..

Open source face recognition for Android

Using Android, what are the open-source option for face recognition...

How to enter a formula into a cell using VBA?

I am trying to enter a formula into a cell which contains variable called var1a? The code that I have is: Worksheets("EmployeeCosts").Range("B" & var1a).Formula = ""SUM(H5:H""& var1a) B..

Expected initializer before function name

#include <iostream> #include <string> using namespace std; struct sotrudnik { string name; string speciality; string razread; int zarplata; } sotrudnik create(string n,s..

Web.Config Debug/Release

I know that web.config in Visual Studio 2010 provides the ability to switch from databases from Debug mode to Release mode. Here is my Web.Release.config: <?xml version="1.0"?> <!-- For m..

Reload a DIV without reloading the whole page

I have a Div Tag that has a php include to fill that div with information what I want to do is make it so that the page is called every 15s so it can update the information there without having to rel..

What is the "double tilde" (~~) operator in JavaScript?

I'm seeing this in some code, and I have no idea what it does: var jdn = function(y, m, d) { var tmp = (m <= 2 ? -1 : 0); return ~~((1461 * (y + 4800 + tmp)) / 4) + ~~((367 * (m - 2 ..

VBA - If a cell in column A is not blank the column B equals

I'm looking for some code that will look at Column A and as long as the cell in Column A is not blank, then the corresponding cell in Column B will equal a specific value. So if Cell A1 <> "" then..

Spring Data JPA map the native query result to Non-Entity POJO

I have a Spring Data repository method with a native query @Query(value = "SELECT g.*, gm.* FROM group g LEFT JOIN group_members gm ON g.group_id = gm.group_id and gm.user_id = :userId WHERE g.group_..

How do I turn off the mysql password validation?

It seems that I may have inadvertently loaded the password validation plugin in MySQL 5.7. This plugin seems to force all passwords to comply to certain rules. I would like to turn this off. I've tr..

Getting the last element of a split string array

I need to get the last element of a split array with multiple separators. The separators are commas and space. If there are no separators it should return the original string. If the string is "how,a..

Why doesn't the height of a container element increase if it contains floated elements?

I would like to ask how height and float work. I have an outer div and an inner div that has content in it. Its height may vary depending on the content of the inner div but it seems that my inner div..

self.tableView.reloadData() not working in Swift

I'm attempting to learn Swift & the basics of iOS dev at the same time, so bear with me. I've got a TableViewController that is firstly parsing a local JSON file and rendering it's very simple dat..

Can we instantiate an abstract class directly?

I have read we can only instantiate an abstract class by inheriting it, but we cannot instantiate it directly. However, I saw we can create an object with the type of an abstract class by calling a me..

How can I get the SQL of a PreparedStatement?

I have a general Java method with the following method signature: private static ResultSet runSQLResultSet(String sql, Object... queryParams) It opens a connection, builds a PreparedStatement using..

What programming language does facebook use?

I don't know much about programming languages, but am interested in a career with facebook, so I was wondering if someone could tell me what programming language facebook uses. Also, do any other soc..

Equivalent function for DATEADD() in Oracle

I have to get a date that is 6 months from the system date in Oracle. And I have to get it by running an open-query from SQL. DATEADD(MONTH,-6, GETDATE()) function serves the purpose in SQL. Does the..

:: (double colon) operator in Java 8

I was exploring the Java 8 source and found this particular part of code very surprising: //defined in @Override public final OptionalInt reduce(IntBinaryOperator op) { return ev..

Angular2 handling http response

I just have a question regarding structuring and handling responses from http requests within a service. I am using Angular2.alpha46 Typescript ( Just started testing it out- which I love... Ps.. Than..

How can I calculate the difference between two ArrayLists?

I have two ArrayLists. ArrayList A contains: ['2009-05-18','2009-05-19','2009-05-21'] ArrayList B contains: ['2009-05-18','2009-05-18','2009-05-19','2009-05-19','2009-05-20','2009-05-21','2009-05..

Python Pylab scatter plot error bars (the error on each point is unique)

I am attempting a scatter plot of 2 arrays for which I have a third array containing the absolute error (error in y direction) on each point. I want the error bars to between (point a - error on a) an..

How do I change button size in Python?

I am doing a simple project in school and I need to make six different buttons to click on. The buttons must have different sizes, but I can't find how do do it. I have made the button by using: def ..

Array.sort() doesn't sort numbers correctly

In Chrome 14, and Firefox 5 (haven't tested other browsers), the following code doesn't sort the numbers correctly: <script> a = new Array(); a.push(10); a.push(60); a.push(20); a.push(30); a.p..

ASP.NET MVC razor: conditional attribute in HTML

Code below doesn't seems clean. Any suggestion to improve the code? <li @if(ViewData["pagename"].ToString()=="Business details"){ <text>class="active" </text> } > <a @if..

How can I get the current directory name in Javascript?

I'm trying to get the current directory of the file in Javascript so I can use that to trigger a different jquery function for each section of my site. if (current_directory) = "example" { var active..

Extract MSI from EXE

I want to extract the MSI of an EXE setup to publish over a network. For example, using Universal Extractor, but it doesn't work for Java Runtime Environment...

How do I make a div full screen?

I am using Flot to graph some of my data and I was thinking it would be great to make this graph appear fullscreen (occupy full space on the monitor) upon clicking on a button. Currently, my div is as..

MYSQL into outfile "access denied" - but my user has "ALL" access.. and the folder is CHMOD 777

Any ideas? SELECT * INTO OUTFILE '/home/myacnt/docs/mysqlCSVtest.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '*' LINES TERMINATED BY '\n' FROM tbl_property WHERE managerGroupID = {$manager..

How to get "wc -l" to print just the number of lines without file name?

wc -l file.txt outputs number of lines and file name. I need just the number itself (not the file name). I can do this wc -l file.txt | awk '{print $1}' But maybe there is a better way? ..

How can I time a code segment for testing performance with Pythons timeit?

I've a python script which works just as it should, but I need to write the execution time. I've googled that I should use timeit but I can't seem to get it to work. My Python script looks like this:..

How do I install Python packages in Google's Colab?

In a project, I have e.g. two different packages, How can I use the to install these two packages in the Google's Colab, so that I can import the packages?..

Fixed page header overlaps in-page anchors

If I have a non-scrolling header in an HTML page, fixed to the top, having a defined height: Is there a way to use the URL anchor (the #fragment part) to have the browser scroll to a certain point in ..

PostgreSQL query to list all table names?

Is there any query available to list all tables in my Postgres DB. I tried out one query like: SELECT table_name FROM information_schema.tables WHERE table_schema='public' B..

What are the file limits in Git (number and size)?

Does anyone know what are the Git limits for number of files and size of files?..

What does "'') " mean in Flask

I am reading the Flask documentation. I was told that with''), I could make the server publicly available. What does it mean ? How can I visit the server in another computer (j..

rails + MySQL on OSX: Library not loaded: libmysqlclient.18.dylib

I'm just starting out with Ruby (and rails). I did the setup according to gems, using rvm. I have everything working well with sqlite..

How can I echo the whole content of a .html file in PHP?

Is there a way I can echo the whole content of a .html file in PHP? For example, I have some sample.html file, and I want to echo that filename, so its content should be displayed...

Leading zeros for Int in Swift

I'd like to convert an Int in Swift to a String with leading zeros. For example consider this code: for myInt in 1 ... 3 { print("\(myInt)") } Currently the result of it is: 1 2 3 But I want..

Conversion failed when converting from a character string to uniqueidentifier - Two GUIDs

I don't understand why I can't insert this. I can't spot the problem. The error message is Conversion failed when converting from a character string to uniqueidentifier. The GUIDs are the ones that I..

How can I find all the subsets of a set, with exactly n elements?

I am writing a program in Python, and I realized that a problem I need to solve requires me, given a set S with n elements (|S|=n), to test a function on all possible subsets of a certain order m (i.e..

How to initialize a list with constructor?

I have a type: public class Human { public int Id { get; set; } public string Address { get; set; } public string Name { get; set; } public List<ContactNumber> ContactNumbers {..

How to get the type of a variable in MATLAB?

Does MATLAB have a function/operator that indicates the type of a variable (similar to the typeof operator in JavaScript)?..

Maven 3 warnings about build.plugins.plugin.version

Since I updated to Maven 3 I get the following warning messages at each build : How can I get rid of these warnings? [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encounter..

The origin server did not find a current representation for the target resource or is not willing to disclose that one exists

web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="" xmlns="" xsi:schemaLocation="http:/..

Import Maven dependencies in IntelliJ IDEA

I have a small question about IntelliJ IDEA 11. I just imported a project from subversion - its a maven project. But I have a problem in maven library dependencies so that I can't include all maven de..

What is the difference between `let` and `var` in swift?

What is the difference between let and var in Apple's Swift language? In my understanding, it is a compiled language but it does not check the type at compile time. It makes me confused. How does the..

How do you completely remove the button border in wpf?

I'm trying to create a button that has an image in it and no border - just like the Firefox toolbar buttons before you hover over them and see the full button. I've tried setting the BorderBrush to T..

Scala how can I count the number of occurrences in a list

val list = List(1,2,4,2,4,7,3,2,4) I want to implement it like this: list.count(2) (returns 3)...

Android Spinner: Get the selected item change event

How can you set the event listener for a Spinner when the selected item changes? Basically what I am trying to do is something similar to this: spinner1.onSelectionChange = handleSelectionChange; v..

Namenode not getting started

I was using Hadoop in a pseudo-distributed mode and everything was working fine. But then I had to restart my computer because of some reason. And now when I am trying to start Namenode and Datanode I..

Android get Current UTC time

What is the function to get the current UTC time. I have tried with System.getCurrentTime but i get the current date and time of the device. Thanks..

Change div width live with jQuery

Is it possible to change a div's width live with jQuery? And if it is, how? What I want is to change its width depending on the browser's window width in real time, so if/when the user changes the br..

To check if string contains particular word

So how do you check if a string has a particular word in it? So this is my code: a.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { ..

newline in <td title="">

Possible Duplicate: How can I use a carriage return in a HTML tooltip? I'd like to know if it's possible to force a newline to show in the tooltip when using title property of a TD. somethi..

CSS background opacity with rgba not working in IE 8

I am using this CSS for background opacity of a <div>: background: rgba(255, 255, 255, 0.3); It’s working fine in Firefox, but not in IE 8. How do I make it work?..

Jquery, checking if a value exists in array or not

I believe this question will be fairly easy for the ones who played around with java script / jquery. var arr = new Array(); $.map(arr, function() { if ( == productID) { this.price = prod..

How can I data bind a list of strings to a ListBox in WPF/WP7?

I am trying to bind a list of string values to a listbox so that their values are listed line by line. Right now I use this: <ListBox Margin="20" ItemsSource="{Binding Path=PersonNames}"> &..

Bash foreach loop

I have an input (let's say a file). On each line there is a file name. How can I read this file and display the content for each one...

How do I remove repeated elements from ArrayList?

I have an ArrayList<String>, and I want to remove repeated strings from it. How can I do this?..

How to use classes from .jar files?

I read the Java tutorials on Sun for JAR files, but I still can't find a solution for my problem. I need to use a class from a jar file called jtwitter.jar, I downloaded the file, and tried executing ..

Adding default parameter value with type hint in Python

If I have a function like this: def foo(name, opts={}): pass And I want to add type hints to the parameters, how do I do it? The way I assumed gives me a syntax error: def foo(name: str, opts={}..

Tree data structure in C#

I was looking for a tree or graph data structure in C# but I guess there isn't one provided. An Extensive Examination of Data Structures Using C# 2.0 explains a bit about why. Is there a convenient l..

Powershell script to see currently logged in users (domain and machine) + status (active, idle, away)

I am searching for a simple command to see logged on users on server. I know this one : Get-WmiObject -Class win32_computersystem but this will not provide me the info I need. It returns : domain M..

PHP code to convert a MySQL query to CSV

What is the most efficient way to convert a MySQL query to CSV in PHP please? It would be best to avoid temp files as this reduces portability (dir paths and setting file-system permissions required)..

Modal width (increase)

I want a modal to be 80% or so of a screen width. modal-lg isn't large enough. This: .modal .modal-dialog { width: 80%; } Doesn't work with Bootstrap 4...

Eloquent ORM laravel 5 Get Array of ids

I'm using Eloquent ORM laravel 5.1, i want to return an array of ids greater than 0, My model called test. I have tried : $test=test::select('id')->where('id' ,'>' ,0)->get()->toarray();..

Check empty string in Swift?

In Objective C, one could do the following to check for strings: if ([myString isEqualToString:@""]) { NSLog(@"myString IS empty!"); } else { NSLog(@"myString IS NOT empty, it is: %@", myStri..

Should you commit .gitignore into the Git repos?

Do you think it is a good practice to commit .gitignore into a Git repo? Some people don't like it, but I think it is good as you can track the file's history. Isn't it?..

How to Load an Assembly to AppDomain with all references recursively?

I want to load to a new AppDomain some assembly which has a complex references tree (MyDll.dll -> Microsoft.Office.Interop.Excel.dll -> Microsoft.Vbe.Interop.dll -> Office.dll -> stdole.dll) As far a..

ORA-01747: invalid user.table.column, table.column, or column specification

Get the above error when the execute immediate is called in a loop Update CustomersPriceGroups set 1AO00=:disc Where cuno=:cuno Parameters: disc=66 cuno=000974 Update CustomersPriceGroups set..

ImportError: No module named PyQt4.QtCore

I've reïnstalled my ssh server, so I also need to reïnstall my Python packages. I did that, but I still get the error: ImportError: No module named PyQt4.QtCore I've already successfully install..

Margin-Top not working for span element?

Can someone tell me what I coded wrong? Everything is working, the only thing is that there is no margin at the top. HTML: <div id="contact_us"> <!-- BEGIN CONTACT US --> <span clas..

How can I programmatically check whether a keyboard is present in iOS app?

I need to check the condition of keyboard visibility in my iOS app. Pseudocode: if(keyboardIsPresentOnWindow) { //Do action 1 } else if (keyboardIsNotPresentOnWindow) { //Do action 2 } How..

How to check if String value is Boolean type in Java?

I did a little search on this but couldn't find anything useful. The point being that if String value is either "true" or "false" the return value should be true. In every other value it should be fa..

Each for object?

I have object in JavaScript: var object = someobject; Object { aaa=true, bbb=true, ccc=true } How can I use each for this? object.each(function(index, value)) { console.log(value); } No..

How to sort in mongoose?

I find no doc for the sort modifier. The only insight is in the unit tests: spec.lib.query.js#L12 writer.limit(5).sort(['test', 1]).group('name') But it doesn't work for me: Post.find().sort(['upd..

Mac OS X - EnvironmentError: mysql_config not found

First off, yeah, I've already seen this: pip install mysql-python fails with EnvironmentError: mysql_config not found The problem I am trying to use Django on a Google App Engine project. However,..

How to uninstall jupyter

I have been trying to uninstall jupyter I have tried the following commands pip uninstall jupyter pip3 uninstall jupyter and rm -rf /Users/$user/Library/Jupyter/* Even after running all these..

How do I debug Node.js applications?

How do I debug a Node.js server application? Right now I'm mostly using alert debugging with print statements like this: sys.puts(sys.inspect(someVariable)); There must be a better way to debug. I..

How to get files in a relative path in C#

If I have an executable called app.exe which is what I am coding in C#, how would I get files from a folder loaded in the same directory as the app.exe, using relative paths? This throws an illegal c..

php check if array contains all array values from another array

$all = array ( 0 => 307, 1 => 157, 2 => 234, 3 => 200, 4 => 322, 5 => 324 ); $search_this = array ( 0 => 200, 1 => 234 ); I would like to find..

Javascript change Div style

I want that part 1 onclick div style changes and part 2 again on click it comes back to normal. I tried doing so but I failed to achieve the part 2 results. Following is the Javascript code functio..

Android SQLite SELECT Query

I have taken String value from a EditText and set it inside SELECT QUERY after WHERE condition As TextView tv = (TextView) findViewById(; EditTextet2 et = (EditText) findViewById(

'System.OutOfMemoryException' was thrown when there is still plenty of memory free

This is my code: int size = 100000000; double sizeInMegabytes = (size * 8.0) / 1024.0 / 1024.0; //762 mb double[] randomNumbers = new double[size]; Exception: Exception of type 'System.OutOfMemoryE..

What is the difference between class and instance methods?

What's the difference between a class method and an instance method? Are instance methods the accessors (getters and setters) while class methods are pretty much everything else?..

How to check if a socket is connected/disconnected in C#?

How can you check if a network socket (System.Net.Sockets.Socket) is still connected if the other host doesn't send you a packet when it disconnects (e.g. because it disconnected ungracefully)?..

Create thumbnail image

I want to display thumbnail image in a gridview from file location. How to generate that of .jpeg file? I am using C# language with

What are the Ruby modes and options?

Ruby's takes modes and options as arguments. Where do I find a complete list of modes and options?..

Testing whether a value is odd or even

I decided to create simple isEven and isOdd function with a very simple algorithm: function isEven(n) { n = Number(n); return n === 0 || !!(n && !(n%2)); } function isOdd(n) { return i..

How is using "<%=request.getContextPath()%>" better than "../"

I have worked on number of J2EE projects where the view layer is JSP. In most projects, I have seen that we reference external resources i.e. images, javascript, jsp's, css etc. using the contextPath ..

How do you stash an untracked file?

I have changes to a file, plus a new file, and would like to use git stash to put them away while I switch to another task. But git stash by itself stashes only the changes to the existing file; the ..

Creating an empty list in Python

What is the best way to create a new empty list in Python? l = [] or l = list() I am asking this because of two reasons: Technical reasons, as to which is faster. (creating a class causes ove..

How to split a string of space separated numbers into integers?

I have a string "42 0" (for example) and need to get an array of the two integers. Can I do a .split on a space?..

How can I check if a program exists from a Bash script?

How would I validate that a program exists, in a way that will either return an error and exit, or continue with the script? It seems like it should be easy, but it's been stumping me...

Reading a text file in MATLAB line by line

I have a CSV file, I want to read this file and do some pre-calculations on each row to see for example that row is useful for me or not and if yes I save it to a new CSV file. can someone give me an..

How do I tidy up an HTML file's indentation in VI?

How do I fix the indentation of his huge html files which was all messed up? I tried the usual "gg=G command, which is what I use to fix the indentation of code files. However, it didn't seem to wor..

excel plot against a date time x series

Why does Excel ignore the time component of datetime values in a chart. For example, the following data : 10/10/2010 9:30 1 10/10/2010 9:40 2 10/10/2010 9:50 3 10/10/2010 10:00 4 10/10/2010 ..

How to compile C program on command line using MinGW?

What command does one have to enter at the command line in Windows 7 to compile a basic C program? Like I am literally wondering what you type in the command prompt, to compile a .c file. I tried: ..

Bootstrap 3 breakpoints and media queries

On the Bootstrap 3 media queries documentation it says: We use the following media queries in our Less files to create the key breakpoints in our grid system. Extra small devices (phones, les..

Remove white space above and below large text in an inline-block element

Say I have a single span element defined as an inline-block. It's only contents is plain text. When the font size is very large, you can clearly see how the browser adds a little padding above and bel..

Difference between dates in JavaScript

How to find the difference between two dates?..

Inline instantiation of a constant List

I try to do something like this: public const List<String> METRICS = new List<String>() { SourceFile.LOC, SourceFile.MCCABE, SourceFile.NOM, ..

Why does the html input with type "number" allow the letter 'e' to be entered in the field?

I have the following html5 input element: <input type="number"> Why does this input allow for the character 'e' to be entered in the input field? No other alphabet character is able to be ent..

javascript: calculate x% of a number

I am wondering how in javascript if i was given a number (say 10000) and then was given a percentage (say 35.8%) how would I work out how much that is (eg 3580)..

Min/Max-value validators in mvc

Validation using attributes in mvc is really nice. I have been using the [Range(min, max)] validator this far for checking values, like e.g.: [Range(1, 10)] public int SomeNumber { get; set;..

Updating GUI (WPF) using a different thread

Just have a problem here that I have no idea how to fix. I am doing a small project which involves a GUI and serial data. The GUI is being run by the main thread and since the data variables that hold..

KERNELBASE.dll Exception 0xe0434352 offset 0x000000000000a49d

I recently received some system event logs from one of our clients running our application on a virtual machine. I noticed these entries in the log: Description: The process was terminated due to an..

How to convert minutes to hours/minutes and add various time values together using jQuery?

There are a couple parts to this question. I am not opposed to using a jQuery plugin if anyone knows of one that will accomplish what I want done. Q1 - How do I convert minutes into hours and vise ve..

HTML/JavaScript: Simple form validation on submit

I'm trying to validate my form with the easiest way possible, but somehow it is not working and when I click submit it just takes me to the next page without giving the alert message: HTML: <form n..

Create a List of primitive int?

Is there a way to create a list of primitive int or any primitives in java like following? List<int> myList = new ArrayList<int>(); It seems I can do List myList = new ArrayList(); an..

What characters are forbidden in Windows and Linux directory names?

I know that / is illegal in Linux, and the following are illegal in Windows (I think) * . " / \ [ ] : ; | , What else am I missing? I need a comprehensive guide, however, and one that takes into a..

How to paste yanked text into the Vim command line

I'd like to paste yanked text into Vim's command line. Is it possible?..

Is there a way since (iOS 7's release) to get the UDID without using iTunes on a PC/Mac?

I'm developing an app for my company and we're going through the process of slowly letting people into the "beta" by adding their iPads to the company's iOS Dev Center accounts. From there we do an ad..

CSS/HTML: What is the correct way to make text italic?

What is the correct way to make text italic? I have seen the following four approaches: <i>Italic Text</i> <em>Italic Text</em> <span class="italic">Italic Text</sp..

Example of Mockito's argumentCaptor

Can anyone please provide me an example showing how to use the org.mockito.ArgumentCaptor class and how it is different from simple matchers that are provided with mockito. I read the provided mockit..

Bootstrap 3 dropdown select

We are trying re-implement our sign-up form with bootstrap. Our sign up form contains a drop-down list which represents a company type. I have searched extensively online but I do not see any example ..

How to upload, display and save images using node.js and express

I need to upload an image, and display it, as well as save it so that I don't lose it when I refresh the localhost. This needs to be done using an "Upload" button, which prompts for a file-selection. ..

How can I limit the visible options in an HTML <select> dropdown?

How can I limit the number of shown options in an HTML <select> drop down? For example: <select> <option value="1">1</option> <option value="2">2</option..

Check if an array item is set in JS

I've got an array var assoc_pagine = new Array(); assoc_pagine["home"]=0; assoc_pagine["about"]=1; assoc_pagine["work"]=2; I tried if (assoc_pagine[var] != "undefined") { bu..

How do I count occurrence of duplicate items in array

I would like to count the occurrence of each duplicate item in an array and end up with an array of only unique/non duplicate items with their respective occurrences. Here is my code; BUT I don't whe..

Get Absolute Position of element within the window in wpf

I would like to get the absolute position of an element in relation to the window/root element when it is double clicked. The element's relative position within it's parent is all I can seem to get to..

Angular HTML binding

I am writing an Angular application and I have an HTML response I want to display. How do I do that? If I simply use the binding syntax {{myVal}} it encodes all HTML characters (of course). I need ..

MongoDB what are the default user and password?

I am using the same connection string on local and production. When the connection string is mongodb://localhost/mydb What is the username and password? Is it secure to keep it this way?..

Unable to load AWS credentials from the / file on the classpath

Using this code for setting the class path AWSCredentialsProvider credentialsProvider = new ClasspathPropertiesFileCredentialsProvider(); ec2 = new AmazonEC2Client(credentialsProvider); Below is t..

Warning: mysqli_query() expects parameter 1 to be mysqli, resource given

I got this error in my code and I don't know how to solve it my code: <?php session_start(); include_once"connect_to_mysql.php"; $db_host = "localhost"; // Place the username for the MySQL databa..

Add vertical whitespace using Twitter Bootstrap?

What's the best way to add vertical whitespace using Twitter's Bootstrap? For example, let's say that I am creating a landing page and would like a bit (100px) of blank whitespace above and below a ..

sql query with multiple where statements

I am having a rather, for me, complicated mysql query on which I am totally stuck and cannot find any answer for online. Here's my query: SELECT items.* FROM items INNER JOIN items_meta_data WHERE (..

Can local storage ever be considered secure?

I'm required to develop a web application that will function offline for long periods. In order for this to be viable I cannot avoid saving sensitive data (personal data but not the kind of data you w..

How to concatenate string variables in Bash

In PHP, strings are concatenated together as follows: $foo = "Hello"; $foo .= " World"; Here, $foo becomes "Hello World". How is this accomplished in Bash?..

How can I create an Asynchronous function in Javascript?

Check out this code : <a href="#" id="link">Link</a> <span>Moving</span> $('#link').click(function () { console.log("Enter"); $('#link').animate({ width: 200 }, 2000,..

How to kill/stop a long SQL query immediately?

I am using SQL server 2008 and its management studio. I executed a query that yields many rows. I tried to cancel it via the red cancel button, but it has not stopped for the past 10 minutes. It usual..