Questions Tagged with #Windows live id

Filter output in logcat by tagname

I'm trying to filter logcat output from a real device (not an emulator) by tag name but I get all the messages which is quite a spam. I just want to read messages from browser which should be somethin..

POST data in JSON format

I have some data that I need to convert to JSON format and then POST it with a JavaScript function. <body onload="javascript:document.myform.submit()"> <form action="https://www.test.net/Ser..

Good MapReduce examples

I couldn't think of any good examples other than the "how to count words in a long text with MapReduce" task. I found this wasn't the best example to give others an impression of how powerful this too..

SQL command to display history of queries

I would like to display my executed sql command history in my MYSQL Query Browser. What is the sql statement for displaying history?..

What do <o:p> elements do anyway?

I've been running into some (standard) issues with Microsoft Office injecting its nasty markup into some html after forwarding an email via Outlook. I'm interested to know: Is there a resource that..

Constantly print Subprocess output while process is running

To launch programs from my Python-scripts, I'm using the following method: def execute(command): process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ..

Switch statement for string matching in JavaScript

How do I write a swtich for the following conditional? If the url contains "foo", then settings.base_url is "bar". The following is achieving the effect required but I've a feeling this would be mor..

This action could not be completed. Try Again (-22421)

I am trying to upload an Apple TV App to the App Store for testing purposes, but I got the issue: This Action could not be completed. Try Again (-22421) as in the below image: So what can I do?..

How to maximize a plt.show() window using Python

Just for curiosity I would like to know how to do this in the code below. I have been searching for an answer but is useless. import numpy as np import matplotlib.pyplot as plt data=np.random.exponen..

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I am trying to open a program for the first time on Windows XP Pro that uses PostgreSQL 9. I'm getting an error message that says : A problem was encountered while trying to log into or create the..

How do you know a variable type in java?

Let's say I declare a variable: String a = "test"; And I want to know what type it is, i.e., the output should be java.lang.String How do I do this?..

Group query results by month and year in postgresql

I have the following database table on a Postgres server: id date Product Sales 1245 01/04/2013 Toys 1000 1245 01/04/2013 Toys 2000 1231 01/02/2013 Bicycle..

Update a local branch with the changes from a tracked remote branch

I have a local branch named 'my_local_branch', which tracks a remote branch origin/my_remote_branch. Now, the remote branch has been updated, and I am on the 'my_local_branch' and want to pull in tho..

Get name of current script in Python

I'm trying to get the name of the Python script that is currently running. I have a script called foo.py and I'd like to do something like this in order to get the script name: print Scriptname ..

Creating a URL in the controller .NET MVC

I need to be able to construct a link in the Action on the controller to send an email. What is best practice to do this? I don't want to construct it myself in case my routes change. Should I have ..

How to get row number in dataframe in Pandas?

How can I get the number of the row in a dataframe that contains a certain value in a certain column using Pandas? For example, I have the following dataframe: ClientID LastName 0 34 ..

How can I display a messagebox in ASP.NET?

I want to show a message box on the successful save of any item. I googled it and tried different solutions, but none of them worked. Here is the code I am using: try { con.Open(); string pas..

How to solve PHP error 'Notice: Array to string conversion in...'

I have a PHP file that tries to echo a $_POST and I get an error, here is the code: echo "<html>"; echo "<body>"; for($i=0; $i<5;$i++){ echo "<input name='C[]' value='$Texting[$..

Java SE 6 vs. JRE 1.6 vs. JDK 1.6 - What do these mean?

I see many different Java terms floating around. I need to install the JDK 1.6. It was my understanding that Java 6 == Java 1.6. However, when I install Java SE 6, I get a JVM that reports as versi..

Official way to ask jQuery wait for all images to load before executing something

In jQuery when you do this: $(function() { alert("DOM is loaded, but images not necessarily all loaded"); }); It waits for the DOM to load and executes your code. If all the images are not loade..

How can I iterate through a string and also know the index (current position)?

Often when iterating through a string (or any enumerable object), we are not only interested in the current value, but also the position (index). To accomplish this by using string::iterator we have t..

In jQuery how can I set "top,left" properties of an element with position values relative to the parent and not the document?

.offset([coordinates]) method set the coordinates of an element but only relative to the document. Then how can I set coordinates of an element but relative to the parent? I found that .position() me..

GCC: array type has incomplete element type

I have declared a struct, and I try to pass an array of those structs (as well as a double array of doubles, and an integer) into a function. I get an "array type has incomplete element type" message ..

How to prevent long words from breaking my div?

Ever since switching from TABLE-layout to DIV-layout, one common problem remains: PROBLEM: you fill your DIV with dynamic text and inevitably there is a super-long word that extends over the edge of ..

Google Maps API v3: Can I setZoom after fitBounds?

I have a set of points I want to plot on an embedded Google Map (API v3). I'd like the bounds to accommodate all points unless the zoom level is too low (i.e., zoomed out too much). My approach has ..

How to set table name in dynamic SQL query?

I want to set table name in a dynamic SQL query. I tried successfully for parameter as following: /* Using sp_executesql */ /* Build and Execute a Transact-SQL String with a single parameter value U..

Create web service proxy in Visual Studio from a WSDL file

My application needs to talk to a web service that hasn't got an online WSDL definition. The developers however supplied me with a WSDL file. With a public WSDL Visual Studio can generate this code f..

Switch statement fallthrough in C#?

Switch statement fallthrough is one of my personal major reasons for loving switch vs. if/else if constructs. An example is in order here: static string NumberToWords(int number) { string[] numbe..

How do you change the server header returned by nginx?

There's an option to hide the version so it will display only nginx, but is there a way to hide that too so it will not show anything or change the header?..

Maven error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

I have installed a latest maven-3.0.4 on Windows 7: The installation details are as follows: Installation Path : C:\apache-maven-3.0.4 Environment Variables are: M2_HOME C:\apache-maven-3.0...

ASP.Net MVC How to pass data from view to controller

I am completely new to ASP.Net and I am sure this is a very basic question I have a View in which there is a link to generate report but to be able to generate report I must ask the user to provide a..

Update index after sorting data-frame

Take the following data-frame: x = np.tile(np.arange(3),3) y = np.repeat(np.arange(3),3) df = pd.DataFrame({"x": x, "y": y}) x y 0 0 0 1 1 0 2 2 0 3 0 1 4 1 1 5 2 1 6 0 2 7 1 2 ..

Switch with if, else if, else, and loops inside case

For the purpose of my question I've only included case 1, but the other cases are the same. Let's say value is currently 1, we go to case 1 and our for loop goes through the array to see if each eleme..

Java Constructor Inheritance

I was wondering why in java constructors are not inherited? You know when you have a class like this: public class Super { public Super(ServiceA serviceA, ServiceB serviceB, ServiceC serviceC){ ..

java.lang.ClassNotFoundException: org.apache.jsp.index_jsp

I have an old struts 1 app that has always been built using Ant, which I'm converting to use Maven instead. The structure of my app is modular, with dependency management in the containing module. The..

What is the difference between \r and \n?

How are \r and \n different? I think it has something to do with Unix vs. Windows vs. Mac, but I'm not sure exactly how they're different, and which to search for/match in regexes...

How do I fix this "TypeError: 'str' object is not callable" error?

I'm creating a basic program that will use a GUI to get a price of an item, then take 10% off of the price if the initial price is less than 10, or take 20% off of the price if the initial price is gr..

Can't build create-react-app project with custom PUBLIC_URL

I'm trying PUBLIC_URL=http://example.com npm run build with a project built using the latest create-react-script. However, the occurrences of %PUBLIC_URL% in public/index.html are replaced with a..

use Lodash to sort array of object by value

I am trying to sort an array by 'name' value (using Lodash). I used the Lodash docs to create the solution below however .orderBy doesn't seem to be having any affect at all. Can anyone shed some ligh..

How to sort List<Integer>?

I have code and I have used list to store data. I want to sort data of it, then is there any way to sort data or shall I have to sort it manually by comparing all data? import java.util.ArrayList; i..

UTF-8 output from PowerShell

I'm trying to use Process.Start with redirected I/O to call PowerShell.exe with a string, and to get the output back, all in UTF-8. But I don't seem to be able to make this work. What I've tried: P..

How to set the min and max height or width of a Frame?

The size of Tkinter windows can be controlled via the following methods: .minsize() .maxsize() .resizable() Are there equivalent ways to control the size of Tkinter or ttk Frames? @Bryan: I change..

Sound effects in JavaScript / HTML5

I'm using HTML5 to program games; the obstacle I've run into now is how to play sound effects. The specific requirements are few in number: Play and mix multiple sounds, Play the same sample multip..

Google Maps JavaScript API RefererNotAllowedMapError

We're trying to develop an geoplacement app for one of our clients, and we want first to test it in out own domain. We have signed for Google Maps JavaScript API, and we have a valid browser key and ..

VBA equivalent to Excel's mod function

Is there a vba equivalent to excel's mod function?..

Where is the php.ini file on a Linux/CentOS PC?

I can't find PHP.ini location on my server. I've checked all Stack Overflow answers but I can't find my php.ini location. I have Linux, Cent OS, zPanel. Last version of PHP. My computer: Linux Mint ..

Server.UrlEncode vs. HttpUtility.UrlEncode

Is there a difference between Server.UrlEncode and HttpUtility.UrlEncode?..

Formatting Phone Numbers in PHP

I am working on an SMS app and need to be able to convert the sender's phone number from +11234567890 to 123-456-7890 so it can be compared to records in a MySQL database. The numbers are stored in ..

AngularJS - Building a dynamic table based on a json

Given a json like this: { "name": "john" "colours": [{"id": 1, "name": "green"},{"id": 2, "name": "blue"}] } and two regular html inputs: <input type="text" name="name" /> <input ty..

Order discrete x scale by frequency/value

I am making a dodged bar chart using ggplot with discrete x scale, the x axis are now arranged in alphabetical order, but I need to rearrange it so that it is ordered by the value of the y-axis (i.e.,..

PHP create key => value pairs within a foreach

I want to create a key-value pairs in an array within a foreach. Here is what I have so far: function createOfferUrlArray($Offer) { $offerArray = array(); foreach ($Offer as $key => $val..

How to convert a char array back to a string?

I have a char array: char[] a = {'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'}; My current solution is to do String b = new String(a); But surely there is a better way of doing this?..

How to find out which package version is loaded in R?

I am in a process of figuring out how to use my university cluster. It has 2 versions of R installed. System wide R 2.11 (Debian 6.0) and R 2.14.2 in non-standard location. I am trying to use MPI to..

HTML Table width in percentage, table rows separated equally

When I create a table in html, a table with a width of 100%, if I want all the cells (tds) to be divided in equal parts, do I have to enter the width % for each cell? Am I "obliged" to do it? E.g.: ..

Are HTTP cookies port specific?

I have two HTTP services running on one machine. I just want to know if they share their cookies or whether the browser distinguishes between the two server sockets...

CSS @media print issues with background-color;

I'm new here at this company and we have a product that uses miles of css. I'm attempting to make a printable stylesheet for our app but I'm having issues with background-color in @media print. @..

How do you determine the size of a file in C?

How can I figure out the size of a file, in bytes? #include <stdio.h> unsigned int fsize(char* file){ //what goes here? } ..

Run git pull over all subdirectories

How can I update multiple git repositories from their shared parent's directory without cd'ing into each repo's root directory? I have the following which are all separate git repositories (not submo..

How to center a View inside of an Android Layout?

I want to put a layout in the center of the screen. ..

GlobalConfiguration.Configure() not present after Web API 2 and .NET 4.5.1 migration

I recently started following this guide to migrate my project to .NET 4.5.1 and Web Api 2. The very first thing MS developer Rick Anderson asks you to do is change: WebApiConfig.Register(GlobalConfi..

Update Angular model after setting input value with jQuery

I have this simple scenario: Input element which value is changed by jQuery's val() method. I am trying to update the angular model with the value that jQuery set. I tried to write a simple direct..

Copy a file list as text from Windows Explorer

Is there a quick way to copy a list of filenames as text into the clipboard from Windows Explorer? I can do it from the command prompt with dir > filenames.txt, but I am looking for something alon..

Converting datetime.date to UTC timestamp in Python

I am dealing with dates in Python and I need to convert them to UTC timestamps to be used inside Javascript. The following code does not work: >>> d = datetime.date(2011,01,01) >>> ..

How to make sql-mode="NO_ENGINE_SUBSTITUTION" permanent in MySQL my.cnf

UPDATE FIXED 1/18/15 After we recently updated to MySQL 5.6.27 (from the Ubuntu repo), this option now works. So this appears to have been a problem with the previous version of MySQL. ORIGINAL QUES..

Curl GET request with json parameter

I am trying to send a "GET" request to a remote REST API from Command Prompt via cURL like this: curl -X GET -H "Content-type: application/json" -H "Accept: application/json" "http://server:5050/a/c..

How to check ASP.NET Version loaded on a system?

How can I check the version of ASP.NET that is installed on my system?..

Does tkinter have a table widget?

I'm learning Python, and I would like to use it to create a simple GUI application, and since Tkinter is already built-in (and very simple to use) I would like to use it to build my application. I wo..

How to loop through a collection that supports IEnumerable?

How to loop through a collection that supports IEnumerable?..

What's the meaning of System.out.println in Java?

Is this static println function in out class from System namespace? namespace System { class out { static println ... } How can I interpret this name? And where in JRE this function is def..

jQuery: Scroll down page a set increment (in pixels) on click?

I'm trying to make a page scroll down 150px from the current position when an element is clicked. So lets say you're roughly halfway scrolled down a page. You click this link, and it will slide you ..

How to get evaluated attributes inside a custom directive

I'm trying to get an evaluated attribute from my custom directive, but I can't find the right way of doing it. I've created this jsFiddle to elaborate. <div ng-controller="MyCtrl"> <inp..

A beginner's guide to SQL database design

Do you know a good source to learn how to design SQL solutions? Beyond the basic language syntax, I'm looking for something to help me understand: What tables to build and how to link them How to d..

How to indent/format a selection of code in Visual Studio Code with Ctrl + Shift + F

I want to indent a specific section of code in Visual Studio Code. I read How do you format code in Visual Studio Code? that gives shortcuts to indent the whole code, but it doesn't work when selecti..

What is a "bundle" in an Android application

What is a bundle in an Android application? When to use it?..

formGroup expects a FormGroup instance

I have an Angular 2 RC4 basic form example on Plunkr that appears to throw the following error (In Chrome DEV console) Here's the plunkr https://plnkr.co/edit/GtPDxw?p=preview Error: browser_adapt..

Disable scrolling when touch moving certain element

I have a page with a section to sketch a drawing in. But the touchmove events, at least the vertical ones, are also scrolling the page (which degrades the sketching experience) when using it on a mob..

Rounding integer division (instead of truncating)

I was curious to know how I can round a number to the nearest whole number. For instance, if I had: int a = 59 / 4; which would be 14.75 if calculated in floating point; how can I store the result ..

Creating temporary files in bash

Are there objectively better ways to create temporary files in bash scripts? I normally just name them whatever comes to my mind, such as tempfile-123, since it will be deleted when the script is ove..

How to pass an array into a SQL Server stored procedure

How to pass an array into a SQL Server stored procedure? For example, I have a list of employees. I want to use this list as a table and join it with another table. But the list of employees should b..

How do I prevent 'git diff' from using a pager?

Is there a command line switch to pass to git diff and other commands that use the less pager by default? I know I can pipe it to cat, but that removes all the syntax highlighting. I know I can set ..

Saving an Excel sheet in a current directory with VBA

I have created a sheet in vba Excel. I would like to save it the current directory, but not in absolute path, then, when this is executed somewhere else, there won't be problem. Can somebody help ?..

Android Studio with Google Play Services

I'm trying to test Google Play Services with the new Android Studio. I have a project with a dependency to the google_play_services.jar. But when I try to Rebuild the project I get the following error..

How to run vbs as administrator from vbs?

Can anyone help me with running vbs from itself but with administrator rights? I need rename computer with Windows 8 via VBScript, but it's possible only if I run my script through administrator ..

Sites not accepting wget user agent header

When I run this command: wget --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" http://yahoo.com ...I get this result (with nothing else in the file)..

How to open a URL in a new Tab using JavaScript or jQuery?

How to open a URL in new tab instead of new window programatically?..

How to style a div to be a responsive square?

I want my div to adapt its height to always equal its width. The width is percental. When the parent's width decreases, the box should decrease by keeping its aspect ratio. How to do this is CSS?..

How to determine whether an object has a given property in JavaScript

How can I determine whether an object x has a defined property y, regardless of the value of x.y? I'm currently using if (typeof(x.y) !== 'undefined') but that seems a bit clunky. Is there a bette..

Regular vs Context Free Grammars

I'm studying for my computing languages test, and there's one idea I'm having problems wrapping my head around. I understood that regular grammars are simpler and cannot contain ambiguity, but can'..

What is SYSNAME data type in SQL Server?

What is the SQL Server SYSNAME data type for? BOL says: The sysname data type is used for table columns, variables, and stored procedure parameters that store object names. but I don't rea..

How to group by week in MySQL?

Oracle's table server offers a built-in function, TRUNC(timestamp,'DY'). This function converts any timestamp to midnight on the previous Sunday. What's the best way to do this in MySQL? Oracle also ..

How do I set the selected item in a comboBox to match my string using C#?

I have a string "test1" and my comboBox contains test1, test2, and test3. How do I set the selected item to "test1"? That is, how do I match my string to one of the comboBox items? I was thinking of ..

Where am I? - Get country

An android mobile actually does know quite well where it is - but is there a way of retrieving the country by something like a country code? No need of knowing the exact GPS position - the country is..

Notify ObservableCollection when Item changes

I found on this link ObservableCollection not noticing when Item in it changes (even with INotifyPropertyChanged) some techniques to notify a Observablecollection that an item has changed. the Trul..

How to save S3 object to a file using boto3

I'm trying to do a "hello world" with new boto3 client for AWS. The use-case I have is fairly simple: get object from S3 and save it to the file. In boto 2.X I would do it like this: import boto ke..

Getting value GET OR POST variable using JavaScript?

How to get value of the get or post variable on page load using JavaScript?..

Invalid application of sizeof to incomplete type with a struct

I have a struct where I put all the information about the players. That's my struct: struct player{ int startingCapital; int currentCapital; int startingPosition; int currentPosition; ..

Compress files while reading data from STDIN

Is it possible to compress (create a compressed archive) data while reading from stdin on Linux?..

Read file line by line in PowerShell

I want to read a file line by line in PowerShell. Specifically, I want to loop through the file, store each line in a variable in the loop, and do some processing on the line. I know the Bash equival..

clear data inside text file in c++

I am programming on C++. In my code I create a text file, write data to the file and reading from the file using stream, after I finish the sequence I desire I wish to clear all the data inside the tx..

read file in classpath

Here is what I want to do and I am wondering if there is any Spring classes that will help with implementing. I don't have to use spring for this particular problem, I'm just implementing it with eve..

How to force keyboard with numbers in mobile website in Android

I have a mobile website and it has some HTML input elements in it, like this: <input type="text" name="txtAccessoryCost" size="6" /> I have embedded the site into a WebView for possible Andro..

Angular: Can't find Promise, Map, Set and Iterator

After installing Angular, the Typescript compiler keep getting some errors about not finding Promise, Map, Set and Iterator. Until now I ignored them but now I need Promise so my code can work. impo..

Android Overriding onBackPressed()

Is it possible to override onBackPressed() for only one activity ? On back button click I want to call a dialog on a specific Activity, but in all other activities i want it to work as it worked bef..

How to get the name of the current method from code

I know you can do this.GetType().FullName To get My.Current.Class But what can I call to get My.Current.Class.CurrentMethod ..

How do I escape ampersands in batch files?

How do I escape ampersands in a batch file (or from the Windows command line) in order to use the start command to open web pages with ampersands in the URL? Double quotes will not work with start;..

How to listen for a WebView finishing loading a URL?

I have a WebView that is loading a page from the Internet. I want to show a ProgressBar until the loading is complete. How do I listen for the completion of page loading of a WebView?..

CodeIgniter removing index.php from url

My current urls look like this [mysite]index.php/[rest of the slug]. I want to strip index.php from these urls. mod_rewrite is enabled on my apache2 server. In config, $config['index_page'] = ''; ..

How to define a preprocessor symbol in Xcode

Is it possible to set a symbol for conditional compilation by setting up properties in an Xcode project? My aim is to to create a symbol that is available to all files, without having to use import/i..

Proper MIME type for OTF fonts

Searching the web, I find heaps of different suggestions for what the proper MIME type for a font is, but I have yet to try any MIME type that rids me of a Chrome warning such as the following: Re..

Add a scrollbar to a <textarea>

I would like to add a scrollbar to a textarea, so that it always appears, even when there is nothing to scroll down to. If there is nothing for it to scroll down to, I would prefer if it could be grey..

Removing rounded corners from a <select> element in Chrome/Webkit

The user-agent stylesheet for Chrome gives a border-radius of 5px to all the corners of a <select> element. I've tried getting rid of this by applying a radius of 0px through my external stylesh..

How to deal with bad_alloc in C++?

There is a method called foo that sometimes returns the following error: terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Abort Is there a way that I can us..

How to not wrap contents of a div?

I've got a fixed-width div with two buttons in it. If the labels of the buttons are too long, they wrap – one button stays on the first line, and the next button follows underneath it instead of..

Any shortcut to initialize all array elements to zero?

In C/C++ I used to do int arr[10] = {0}; ...to initialize all my array elements to 0. Is there a similar shortcut in Java? I want to avoid using the loop, is it possible? int arr[] = new int[10..

How to disable the parent form when a child form is active?

How to disable a parent form when child form is active using c#?..

How to convert date to timestamp in PHP?

How do I get timestamp from e.g. 22-09-2008?..

Object of class stdClass could not be converted to string

I am having a problem with PHP at the moment, I am getting this error, Object of class stdClass could not be converted to string the error occurs when I run this portion of code in my site, functi..

jQuery - Uncaught RangeError: Maximum call stack size exceeded

The following code (see Fiddle here) throws the stack overflow referred to in the question title. I'm trying to get a box shadow to display around a circular image in a pulse effect. Can anyone point ..

Could not find a version that satisfies the requirement <package>

I'm installing several Python packages in Ubuntu 12.04 using the following requirements.txt file: numpy>=1.8.2,<2.0.0 matplotlib>=1.3.1,<2.0.0 scipy>=0.14.0,<1.0.0 astroML>=0.2,&..

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..

What GRANT USAGE ON SCHEMA exactly do?

I'm trying to create for the first time a Postgres database, so this is probably a stupid question. I assigned basic read-only permissions to the db role that must access the database from my php scri..

REST response code for invalid data

What response code should be passed to client in case of following scenarios? Invalid data passed while user registration like wrong email format User name/ Email is already exists I chose 403. I ..

How to add element into ArrayList in HashMap

How to add element into ArrayList in HashMap? HashMap<String, ArrayList<Item>> Items = new HashMap<String, ArrayList<Item>>(); ..

sed fails with "unknown option to `s'" error

I'm trying to use sed -i -e "s/.*seb.*/ \"$ftp_login_template\"/" $ftp_dir however I get this error: sed: -e expression #1, char 34: unknown option to `s' I don't understand why since this w..

How can I get href links from HTML using Python?

import urllib2 website = "WEBSITE" openwebsite = urllib2.urlopen(website) html = getwebsite.read() print html So far so good. But I want only href links from the plain text HTML. How can I solve..

java.util.NoSuchElementException - Scanner reading user input

I'm new to using Java, but I have some previous experience with C#. The issue I'm having comes with reading user input from console. I'm running into the "java.util.NoSuchElementException" error with..

Signed to unsigned conversion in C - is it always safe?

Suppose I have the following C code. unsigned int u = 1234; int i = -5678; unsigned int result = u + i; What implicit conversions are going on here, and is this code safe for all values of u and i..

Simple (I think) Horizontal Line in WPF?

Creating a relatively simple data entry form, and just want to separate certain sections with a horizontal line (not unlike an HR tag in HTML) that stretches the full length of the form. I have tried..

python pandas dataframe columns convert to dict key and value

I have a pandas data frame with multiple columns and I would like to construct a dict from two columns: one as the dict's keys and the other as the dict's values. How can I do that? Dataframe: ..

Fixed header table with horizontal scrollbar and vertical scrollbar on

I have been trying to figure out this problem i have with html/css sticky header + scrollbars. We are creating a program that requires scrollbars to show up once the containersize reaches a certain po..

Writing to CSV with Python adds blank lines

I am trying to write to CSV file but there are blank rows in between. How can I remove the blank rows? import csv b = open('test.csv', 'w') a = csv.writer(b) data = [['Me', 'You'],\ ['293', '..

File path issues in R using Windows ("Hex digits in character string" error)

I run R on Windows, and have a csv file on the Desktop. I load it as follows, x<-read.csv("C:\Users\surfcat\Desktop\2006_dissimilarity.csv",header=TRUE) but the R gives the following error messa..

copy-item With Alternate Credentials

I'm using the CTP of powershell v2. I have a script written that needs to go out to various network shares in our dmz and copy some files. However, the issue I have is that evidently powershell's cmdl..

Why is there no multiple inheritance in Java, but implementing multiple interfaces is allowed?

Java doesn't allow multiple inheritance, but it allows implementing multiple interfaces. Why?..

Initializing a list to a known number of elements in Python

Right now I am using a list, and was expecting something like: verts = list (1000) Should I use array instead?..

Working with time DURATION, not time of day

I'm doing some benchmarking, and I want to use Excel to produce graphs of the results. I've got a simple but annoying problem which is baking my noodle. The problem is that Excel insists that "time" ..

How to set selectedIndex of select element using display text?

How to set selectedIndex of select element using display text as reference? Example: <input id="AnimalToFind" type="text" /> <select id="Animals"> <option value="0">Chicken<..

check if jquery has been loaded, then load it if false

Does anyone know how to check if jquery has been loaded (with javascript) then load it if it hasnt been loaded. something like if(!jQuery) { //load jquery file } ..

The type or namespace name 'Objects' does not exist in the namespace 'System.Data'

I am using entities, C# and SQL Server to create an n-tier app. I am creating some base classes common to all my DAL components. In this base class, i want to handle the connection state of the Object..

Adding Jar files to IntellijIdea classpath

I have created a new Intellij project. But I can't use the third party jars in my project. I have the jars in a directory structure as follows: repository/commons-logging/commons-logging-1.0.4.jar rep..

How to declare an array inside MS SQL Server Stored Procedure?

I need to declare 12 decimal variables, corresponding to each month's year, with a cursor I sum values to this variables, then later I Update some sales information. I don't know if sql server has th..

WCF on IIS8; *.svc handler mapping doesn't work

I'm trying to get a WCF service running in IIS8 on Windows Server 2012 build 8400. When installing the web role the WCF stuff (under 3.51) wasn't to be found like in Windows Server 2008. When installe..

java : non-static variable cannot be referenced from a static context Error

The following code is generating an error on the variable con2 saying "non-static variable con2 cannot be referenced from a static context Error." I Googled for a resolution and they are suggesting t..

How to auto adjust the <div> height according to content in it?

I have a <div> which needs to be auto adjusted according to the content in it. How can I do this? Right now my content is coming out of the <div> The class I have used for the div is as..

Two-dimensional array in Swift

I get so confused about 2D arrays in Swift. Let me describe step by step. And would you please correct me if I am wrong. First of all; declaration of an empty array: class test{ var my2Darr = In..

Running Windows batch file commands asynchronously

Say, if I have foo.exe bar.exe baz.exe How do I run all of them from a batch file asynchronously, i.e. without waiting for the previous program to stop?..

How to make a progress bar

How would one go about making a progress bar in html/css/javascript. I don't really want to use Flash. Something along the lines of what can be found here: http://dustincurtis.com/about.html All I re..

How to access form methods and controls from a class in C#?

I'm working on a C# program, and right now I have one Form and a couple of classes. I would like to be able to access some of the Form controls (such as a TextBox) from my class. When I try to change ..

How to send objects through bundle

I need to pass a reference to the class that does the majority of my processing through a bundle. The problem is it has nothing to do with intents or contexts and has a large amount of non-primitive ..

Simple DateTime sql query

How do I query DateTime database field within a certain range? I am using SQL SERVER 2005 Error code below SELECT * FROM TABLENAME WHERE DateTime >= 12/04/2011 12:00:00 AM AND DateTime ..

How can I convert comma separated string into a List<int>

string tags = "9,3,12,43,2" List<int> TagIds = tags.Split(','); This doesn't work cause the split method returns a string[]..

What design patterns are used in Spring framework?

What design patterns are used in Spring framework?..

How to delete a whole folder and content?

I want the users of my application to be able to delete the DCIM folder (which is located on the SD card and contains subfolders). Is this possible, if so how?..

.gitignore file for java eclipse project

I have java project that uses the Eclipse IDE. The Eclipse workspace is pointing to this directory: /home/srvimgprd/BUSPROJ/code_development/dime/executables/clientcode/java_axis/Eclipse I have pl..

self referential struct definition?

I haven't been writing C for very long, and so I'm not sure about how I should go about doing these sorts of recursive things... I would like each cell to contain another cell, but I get an error alon..

Sorting an Array of int using BubbleSort

Why is my printed out Array not sorted in the below code? public class BubbleSort { public void sortArray(int[] x) {//go through the array and sort from smallest to highest for(int i=1; i&l..

Query comparing dates in SQL

I have a table with dates that all happened in the month November. I wrote this query select id,numbers_from,created_date,amount_numbers,SMS_text from Test_Table where created_date <= '2013-04..

window.close and self.close do not close the window in Chrome

The issue is that when I invoke window.close() or self.close() it doesn't close the window. Now there seems to be a belief that in Chrome you can't close by script any window that is not script create..

How to determine previous page URL in Angular?

Suppose I am currently on the page which has the URL /user/:id . Now from this page I navigate to next page :id/posts. Now Is there a way, so that i can check what is the previous URL, i.e. /user/:id..

Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project

When creating a new Java project in IntelliJ IDEA, the following directories and files are created: ./projectname.iml ./projectname.ipr ./projectname.iws ./src/ I want to configure IntelliJ IDEA to..

jQuery getTime function

is it possible to create a jQuery function so that it gets current date and time? I've been looking around documentation but haven't found anything so far.....

Error during SSL Handshake with remote server

I have Apache2 (listening on 443) and a web app running on Tomcat7 (listening on 8443) on Ubuntu. I set apache2 as reverse proxy so that I access the web app through port 443 instead of 8443. Besides..

ImportError: No module named psycopg2

When installing process of OpenERP 6, I want to generate a config file with this command, cd /home/openerp/openerp-server/bin/ ./openerp-server.py -s --stop-after-init -c /home/openerp/openerp-serve..

What's the best way to get the current URL in Spring MVC?

I'd like to create URLs based on the URL used by the client for the active request. Is there anything smarter than taking the current HttpServletRequest object and it's getParameter...() methods to re..

I'm getting favicon.ico error

I downloaded the Netbeans IDE to code in HTML. I'm new to it. When I run my code, chrome is opening and everything is working just fine. I'm getting some sort of error in the Output - Browser Log. F..

What should every programmer know about security?

I am an IT student and I am now in the 3rd year in university. Until now we've been studing a lot of subjects related to computers in general (programming, algorithms, computer architecture, maths, et..

How to override equals method in Java

I am trying to override equals method in Java. I have a class People which basically has 2 data fields name and age. Now I want to override equals method so that I can check between 2 People objects. ..

Remove directory which is not empty

In my Node application I need to remove a directory which has some files, but fs.rmdir only works on empty directories. How can I do this?..

Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object

I inherited a project and I'm running into a SQL error that I'm not sure how to fix. On an eCommerce site, the code is inserting order shipping info into another database table. Here's the code that i..

NULL value for int in Update statement

Is it possible to set NULL value for int column in update statement? How can I write the update statement in this case?..

How can I remove jenkins completely from linux

I have deleted jenkins all directories from different folders. But still when I access URL it is showing me jenkins login. I want to uninstall jenkins completely. Have tried many commands from intern..

XAMPP Object not found error

I have just installed XAMPP on my machine, and when trying to access sub folders in htdocs I get the following error. Object not found! The requested URL was not found on this server. If you entered ..

Eliminating NAs from a ggplot

Very basic question here as I'm just starting to use R, but I'm trying to create a bar plot of factor counts in ggplot2 and when plotting, get 14 little colored blips representing my actual levels and..

How to check for empty value in Javascript?

I am working on a method of retrieving an array of hidden inputs in my form like so <input type="hidden" value="12:34:00" name="timetemp0"> <input type="hidden" value="14:45:00" name="timete..

Route [login] not defined

Trying to play with Laravel today for the first time. I am getting the following error when I attempt to visit localhost/project/public: InvalidArgumentException Route [login] not defined. app..

In laymans terms, what does 'static' mean in Java?

I have been told several definitions for it, looked on Wikipedia, but as a beginner to Java I'm still not sure what it means. Anybody fluent in Java?..

Removing packages installed with go get

I ran go get package to download a package before learning that I needed to set my GOPATH otherwise that package sullies my root Go install (I would much prefer to keep my Go install clean and separat..

How do I remove carriage returns with Ruby?

I thought this code would work, but the regular expression doesn't ever match the \r\n. I have viewed the data I am reading in a hex editor and verified there really is a hex D and hex A pattern in th..

How to write palindrome in JavaScript

I wonder how to write palindrome in javascript, where I input different words and program shows if word is palindrome or not. For example word noon is palindrome, while bad is not. Thank you in advan..

Code coverage with Mocha

I am using Mocha for testing my NodeJS application. I am not able to figure out how to use its code coverage feature. I tried googling it but did not find any proper tutorial. Please help...

git stash apply version

I have 2 branches: master | design Working in design I did a stash and switched to master, made some adjustments. Switched back to design and did a stash apply only to lose all my changes in the desi..

Query grants for a table in postgres

How can I query all GRANTS granted to an object in postgres? For example I have table "mytable": GRANT SELECT, INSERT ON mytable TO user1 GRANT UPDATE ON mytable TO user2 I need somthing which gi..

performSelector may cause a leak because its selector is unknown

I'm getting the following warning by the ARC compiler: "performSelector may cause a leak because its selector is unknown". Here's what I'm doing: [_controller performSelector:NSSelectorFromString(..

How do I list all remote branches in Git 1.7+?

I've tried git branch -r, but that only lists remote branches that I've tracked locally. How do I find the list of those that I haven't? (It doesn't matter to me whether the command lists all remote b..

How can I correctly format currency using jquery?

I do not need a mask, but I need something that will format currency(in all browsers) and not allow for any letters or special char's to be typed. Thanks for the help Example: Valid: $50.00 ..

How to check if a stored procedure exists before creating it

I have a SQL script that has to be run every time a client executes the "database management" functionality. The script includes creating stored procedures on the client database. Some of these clien..

How to get share counts using graph API

I can get the share count of an URL using PHP SDK and using the deprecated rest API, but didn't find a way to get the share counts of an URL using graph API. Is there any way to find out?..

How to create timer in angular2

I need a timer in Angular 2, which tick after a time interval and do some task (may be call some functions). How to do this with Angular 2?..

Multiple distinct pages in one HTML file

Is there any way to have multiple distinct HTML pages contained within a single HTML file? For example, suppose I have a website with two pages: Page 1 : click here for page 2 and Page 2 : click ..

Automatically size JPanel inside JFrame

I have a JPanel subclass on which I add buttons, labels, tables, etc. To show on screen it I use JFrame: MainPanel mainPanel = new MainPanel(); //JPanel subclass JFrame mainFrame = new JFrame(); mai..

How do I REALLY reset the Visual Studio window layout?

I had a plugin installed in Visual Studio 2008, and it created some extra dockable windows. I have uninstalled it, and I can't get rid of the windows it created - I close them, but they always come b..

How do you extract IP addresses from files using a regex in a linux shell?

How to extract a text part by regexp in linux shell? Lets say, I have a file where in every line is an IP address, but on a different position. What is the simplest way to extract those IP addresses u..

How can I alter a primary key constraint using SQL syntax?

I have a table that is missing a column in its primary key constraint. Instead of editing it through SQL Server, I want to put this in a script to add it as part of our update scripts. What syntax c..

"Operation must use an updateable query" error in MS Access

I am getting an error message: "Operation must use an updateable query" when I try to run my SQL. From my understanding, this happens when joins are used in update/delete queries in MS Access. However..

Android SDK Setup under Windows 7 Pro 64 bit

The short version of my issue at hand, Windows 7 Professional x64 Java JDK 1.6.0_17 x64 Eclipse Galileo w\ADT Plugin installed Android SDKtools r04 Since the Android SDK download now only include..

Execute multiple command lines with the same process using .NET

I'm trying to execute multiple commands without create a new process each time. Basically, I want to start the DOS command shell, switch to the MySQL command shell, and execute a command. Here's how I..

How do I divide so I get a decimal value?

I want to know how to get remainder and quotient in single value in Java. Example: 3/2 I should get value as 1.5. If I use the / operator I get only the quotient. If I user the % operator I ..

Foreign key referencing a 2 columns primary key in SQL Server

This question is pretty much similar to this one, but for SQL Server 2005 : I have 2 tables in my database: --'#' denotes the primary key [Libraries] #ID #Application Name 1 MyApp Tit..

You can't specify target table for update in FROM clause

I have a simple mysql table: CREATE TABLE IF NOT EXISTS `pers` ( `persID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(35) NOT NULL, `gehalt` int(11) NOT NULL, `chefID` int(11) DEFAULT NUL..

matplotlib has no attribute 'pyplot'

I can import matplotlib but when I try to run the following: matplotlib.pyplot(x) I get: Traceback (most recent call last): File "<pyshell#31>", line 1, in <module> matplotli..