Questions

Simple way to calculate median with MySQL

What's the simplest (and hopefully not too slow) way to calculate the median with MySQL? I've used `AVG(x)` for finding the mean, but I'm having a hard time finding a simple way of calculating the med...

11 Mar at 16:22

How to get last 7 days data from current datetime to last 7 days in sql server

Hi I am loading table A data from sql server to mysql using pentaho when loading data i need to get only last 7 days data from sql server A table to mysql In sql server createddate column data type is...

How to extract closed caption transcript from YouTube video?

Is it possible to extract the closed caption transcript from YouTube videos? We have over 200 webcasts on YouTube and each is at least one hour long. YouTube has closed caption for all videos but it ...

11 Jun at 10:45

How to UPSERT (MERGE, INSERT ... ON DUPLICATE UPDATE) in PostgreSQL?

A very frequently asked question here is how to do an upsert, which is what MySQL calls `INSERT ... ON DUPLICATE UPDATE` and the standard supports as part of the `MERGE` operation. Given that Postgre...

How to read numbers from file in Python?

I'd like to read numbers from file into two dimensional array. File contents: - - For example: ``` 4 3 1 2 3 4 2 3 4 5 6 7 8 9 ```

21 Sep at 19:15

What is the difference between Builder Design pattern and Factory Design pattern?

What is the difference between the Builder design pattern and the Factory design pattern? Which one is more advantageous and why ? How do I represent my findings as a graph if I want to test and c...

How to including variables within strings?

So, we all should know that you can include variables into strings by doing: ``` String string = "A string " + aVariable; ``` Is there a way to do it like: ``` String string = "A string {aVariable}";...

How to stretch children to fill cross-axis?

I have a left-right flexbox: ``` .wrapper { display: flex; flex-direction: row; align-items: stretch; width: 100%; height: 70vh; min-height: 325px; max-height:570px; } .wrapper>.left ...

11 Jul at 04:53

How to add List<> to a List<> in asp.net

Is there a short way to add List<> to List<> instead of looping in result and add new result one by one? ``` var list = GetViolations(VehicleID); var list2 = GetViolations(VehicleID2); list.Add(list...

19 Feb at 15:32

How to state in requirements.txt a direct github source

I've installed a library using the command ``` pip install git+git://github.com/mozilla/elasticutils.git ``` which installs it directly from a Github repository. This works fine and I want to have t...

21 Dec at 18:37

Excel: last character/string match in a string

Is there an efficient way to identify the last character/string match in a string using base functions? I.e. not the last character/string the string, but the position of a character/string's la...

17 Jun at 22:22

Changing ImageView source

I have an `ImageView` with a source image set in the xml using the following syntax: ``` <ImageView android:id="@+id/articleImg" style="@style/articleImgSmall_2" android:src="@draw...

26 Jun at 15:39

Why should text files end with a newline?

I assume everyone here is familiar with the adage that all text files should end with a newline. I've known of this "rule" for years but I've always wondered — why?

12 Nov at 19:49

How to make an HTTP get request with parameters

Is it possible to pass parameters with an `HTTP` get request? If so, how should I then do it? I have found an `HTTP` post requst ([link](http://msdn.microsoft.com/en-us/library/debx8sh9.aspx)). In tha...

30 Dec at 00:50

SQL Server 2008: How to query all databases sizes?

I have MS SQL 2008 R2, 500 databases. What is the most efficient, easiest and 'modern' way to query all databases sizes. The output should have columns: - - -

node.js: read a text file into an array. (Each line an item in the array.)

I would like to read a very, very large file into a JavaScript array in node.js. So, if the file is like this: ``` first line two three ... ... ``` I would have the array: ``` ['first line','tw...

5 Dec at 02:54

How to set the maximum memory usage for JVM?

I want to limit the maximum memory used by the JVM. Note, this is not just the heap, I want to limit the total memory used by this process.

The difference between the Runnable and Callable interfaces in Java

What is the difference between using the `Runnable` and `Callable` interfaces when designing a concurrent thread in Java, why would you choose one over the other?

How to get past the login page with Wget?

I am trying to use [Wget](http://en.wikipedia.org/wiki/Wget) to download a page, but I cannot get past the login screen. How do I send the username/password using post data on the login page and then...

28 May at 19:23

How do I copy the contents of one stream to another?

What is the best way to copy the contents of one stream to another? Is there a standard utility method for this?

26 Sep at 17:12

Creating an Array from a Range in VBA

I'm having a seemingly basic problem but can't find any resources addressing it. Simply put, I just want to load the contents of a Range of cells (all one column) into an Array. I am able to accompl...

7 Jun at 21:40

What happens when using mutual or circular (cyclic) imports?

In Python, what happens when two modules attempt to `import` each other? More generally, what happens if multiple modules attempt to `import` in a cycle? --- [What can I do about "ImportError: Cann...

Search all of Git history for a string

I have a code base which I want to push to GitHub as open source. In this Git-controlled source tree, I have certain configuration files which contain passwords. I made sure not to track this file and...

25 Nov at 17:46

Unable to establish SSL connection, how do I fix my SSL cert?

I'm trying to `wget` to my own box, and it can't be an internal address in the wget (so says another developer). When I wget, I get this: ``` wget http://example.com --2013-03-01 15:03:30-- http://...

26 Jan at 16:19

VBA code to set date format for a specific column as "yyyy-mm-dd"

I have a macro which I specify the date (in mm/dd/yyyy) in a textbox and I want to set this value for column A in yyyy-mm-dd format. I have the following code: ``` Sheets("Sheet1").Range("A2", "A500...

1 Apr at 13:40