Questions

LINQ with groupby and count

This is pretty simple but I'm at a loss: Given this type of data set: ``` UserInfo(name, metric, day, other_metric) ``` and this sample data set: ``` joe 1 01/01/2011 5 jane 0 01/02/2011 9 john 2 01...

28 Oct at 10:10

What is the LD_PRELOAD trick?

I came across a reference to it recently on [proggit](http://www.reddit.com/r/programming/comments/7o8d9/tcmalloca_faster_malloc_than_glibcs_open_sourced/c06wjka) and (as of now) it is not explained. ...

23 May at 11:54

How to check if a folder exists?

I am playing a bit with the new Java 7 IO features. Actually I am trying to retrieve all the XML files in a folder. However this throws an exception when the folder does not exist. How can I check if ...

6 Apr at 05:41

Mockito test a void method throws an exception

I have a method with a `void` return type. It can also throw a number of exceptions so I'd like to test those exceptions being thrown. All attempts have failed with the same reason: > The method when...

26 Aug at 14:40

How to get package name from anywhere?

I am aware of the availability of [Context.getApplicationContext()](http://developer.android.com/reference/android/content/Context.html#getApplicationContext%28%29) and [View.getContext()](http://deve...

30 May at 19:2

Better way to sum a property value in an array

I have something like this: ``` $scope.traveler = [ { description: 'Senior', Amount: 50}, { description: 'Senior', Amount: 50}, { description: 'Adult', Amount: 7...

Calculating Pearson correlation and significance in Python

I am looking for a function that takes as input two lists, and returns the [Pearson correlation](http://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient), and the significance of t...

22 Nov at 07:18

How can I use a conditional expression (expression with if and else) in a list comprehension?

I have a list comprehension that produces list of odd numbers of a given range: ``` [x for x in range(1, 10) if x % 2] ``` That makes a filter that removes the even numbers. Instead, I'd like to use ...

Basic HTTP and Bearer Token Authentication

I am currently developing a REST-API which is HTTP-Basic protected for the development environment. As the real authentication is done via a token, I'm still trying to figure out, how to send two auth...

How to properly overload the << operator for an ostream?

I am writing a small matrix library in C++ for matrix operations. However my compiler complains, where before it did not. This code was left on a shelf for 6 months and in between I upgraded my comput...

How to enable cURL in PHP / XAMPP

How do I enable cURL in PHP? ​​

20 Jun at 14:53

Local file access with JavaScript

Is there local file manipulation that's been done with JavaScript? I'm looking for a solution that can be accomplished with no install footprint like requiring [Adobe AIR](http://en.wikipedia.org/wiki...

12 Aug at 01:42

How to create an infinite loop in Windows batch file?

This is basically what I want in a batch file. I want to be able to re-run "Do Stuff" whenever I press any key to go past the "Pause". ``` while(true){ Do Stuff Pause } ``` Looks like the...

What are all the different ways to create an object in Java?

Had a conversation with a coworker the other day about this. There's the obvious using a constructor, but what are the other ways there?

17 Mar at 07:57

How do I capture response of form.submit

I have the following code: ``` <script type="text/javascript"> function SubmitForm() { form1.submit(); } function ShowResponse() { } </s...

How to convert existing non-empty directory into a Git working directory and push files to a remote repository

1. I have a non-empty directory (eg /etc/something) with files that cannot be renamed, moved, or deleted. 2. I want to check this directory into git in place. 3. I want to be able to push the state o...

10 Sep at 06:46

Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python

I'm learning to use `matplotlib` by studying examples, and a lot of examples seem to include a line like the following before creating a single plot... ``` fig, ax = plt.subplots() ``` Here are som...

20 Aug at 19:45

Can I update a component's props in React.js?

After starting to work with React.js, it seems like `props` are intended to be static (passed in from the parent component), while `state` changes based upon events. However, I noticed in the docs a ...

6 Mar at 14:36

Javascript format date / time

I need to change a date/time from to look like Can this be done using javascript's Date object?

12 Aug at 23:23

Dynamically update values of a chartjs chart

I created an basic bar chart using chartjs and it works fine. Now I want to update the values on a time based interval. My problem is that after I created the chart, I do not know how to update its va...

5 May at 10:2

How to remove close button on the jQuery UI dialog?

How do I remove the close button (the in the top-right corner) on a dialog box created by jQuery UI?

Write to UTF-8 file in Python

I'm really confused with the `codecs.open function`. When I do: ``` file = codecs.open("temp", "w", "utf-8") file.write(codecs.BOM_UTF8) file.close() ``` It gives me the error > UnicodeDecodeError...

How do you run CMD.exe under the Local System Account?

I'm currently running Vista and I would like to manually complete the same operations as my Windows Service. Since the Windows Service is running under the Local System Account, I would like to emulat...

6 Mar at 04:8

How do I extract data from a DataTable?

I have a `DataTable` that is filled in from an SQL query to a local database, but I don't know how to extract data from it. Main method (in test program): ``` static void Main(string[] args) { co...

23 Feb at 10:58

Escaping ampersand character in SQL string

I am trying to query a certain row by name in my sql database and it has an ampersand. I tried to set an escape character and then escape the ampersand, but for some reason this isn't working and I'm ...

28 Nov at 23:18