Questions

Using Python's os.path, how do I go up one directory?

I recently upgrade Django from v1.3.1 to v1.4. In my old `settings.py` I have ``` TEMPLATE_DIRS = ( os.path.join(os.path.dirname( __file__ ), 'templates').replace('\\', '/'), # Put strings ...

7 Jan at 01:9

PostgreSQL DISTINCT ON with different ORDER BY

I want to run this query: ``` SELECT DISTINCT ON (address_id) purchases.address_id, purchases.* FROM purchases WHERE purchases.product_id = 1 ORDER BY purchases.purchased_at DESC ``` But I get this...

Error "Import Error: No module named numpy" on Windows

I have a very similar question to [this question](https://stackoverflow.com/questions/1517129/python-how-do-i-install-scipy-on-64-bit-windows), but I am still one step behind. I have only one version ...

22 Aug at 15:4

Convert a JavaScript string in dot notation into an object reference

Given a JavaScript object, ``` var obj = { a: { b: '1', c: '2' } } ``` and a string ``` "a.b" ``` how can I convert the string to dot notation so I can go ``` var val = obj.a.b ``` If the string wa...

22 Aug at 15:26

With CSS, use "..." for overflowed block of multi-lines

with ``` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; ``` "..." will be shown in the end of the line if overflowed. However, this will be shown only in one line. But I would like...

20 Feb at 12:56

ActionBar text color

how can I change the text color of the ActionBar? I've inherited the Holo Light Theme, I'm able to change the background of the ActionBar but I don't find out what is the attribute to tweak to change ...

How to capture UIView to UIImage without loss of quality on retina display

My code works fine for normal devices but creates blurry images on retina devices. Does anybody know a solution for my issue? ``` + (UIImage *) imageWithView:(UIView *)view { UIGraphicsBeginImag...

Implode an array with JavaScript?

Can I implode an array in jQuery like in PHP?

4 Sep at 11:16

How to make EditText not editable through XML in Android?

Can anyone tell me how to make an `EditText` not editable via XML? I tried setting `android:editable` to `false`, but 1. it is deprecated; and 2. it didn't work.

12 Feb at 23:47

Why doesn't Git ignore my specified file?

I added the following line to `.gitignore`: ``` sites/default/settings.php ``` but when I type `git status` it shows the file as unstaged file. What's the problem? All other patterns work well.

27 Oct at 14:57

How can I pad an int with leading zeros when using cout << operator?

I want `cout` to output an int with leading zeros, so the value `1` would be printed as `001` and the value `25` printed as `025`. How can I do this?

5 Apr at 02:41

What happens when a duplicate key is put into a HashMap?

If I pass the same key multiple times to `HashMap`’s `put` method, what happens to the original value? And what if even the value repeats? I didn’t find any documentation on this. Case 1: Overwritten...

9 Jan at 10:29

How do malloc() and free() work?

I want to know how `malloc` and `free` work. ``` int main() { unsigned char *p = (unsigned char*)malloc(4*sizeof(unsigned char)); memset(p,0,4); strcpy((char*)p,"abcdabcd"); // **delibera...

13 Apr at 02:42

Cannot simply use PostgreSQL table name ("relation does not exist")

I'm trying to run the following PHP script to do a simple database query: ``` $db_host = "localhost"; $db_name = "showfinder"; $username = "user"; $password = "password"; $dbconn = pg_connect("host=$...

21 Feb at 06:56

Under what conditions is a JSESSIONID created?

When / what are the conditions when a `JSESSIONID` is created? Is it per a domain? For instance, if I have a Tomcat app server, and I deploy multiple web applications, will a different `JSESSIONID` b...

9 May at 13:55

Combining two expressions (Expression<Func<T, bool>>)

I have two expressions of type `Expression<Func<T, bool>>` and I want to take to OR, AND or NOT of these and get a new expression of the same type ``` Expression<Func<T, bool>> expr1; Expression<Func...

27 Jun at 01:4

Why would someone use WHERE 1=1 AND <conditions> in a SQL clause?

Why would someone use `WHERE 1=1 AND <conditions>` in a SQL clause (Either SQL obtained through concatenated strings, either view definition) I've seen somewhere that this would be used to protect ag...

17 Nov at 02:38

Stop and Start a service via batch or cmd file?

How can I script a bat or cmd to stop and start a service reliably with error checking (or let me know that it wasn't successful for whatever reason)?

23 Apr at 19:49

Biggest differences of Thrift vs Protocol Buffers?

What are the biggest pros and cons of [Apache Thrift](http://incubator.apache.org/thrift/) vs [Google's Protocol Buffers](http://code.google.com/apis/protocolbuffers/)?

React Native: How to select the next TextInput after pressing the "next" keyboard button?

I defined two TextInput fields as follows: ``` <TextInput style = {styles.titleInput} returnKeyType = {"next"} autoFocus = {true} placeholder = "Title" /> <TextInput style = {styles.d...

23 Sep at 20:17

Git push error pre-receive hook declined

I have run gitlabhq rails server on virtual machine, following 1-6 steps from this tutorial [https://github.com/gitlabhq/gitlab-recipes/blob/master/install/centos/README.md](https://github.com/gitlabh...

18 Feb at 12:37

Laravel Migration Change to Make a Column Nullable

I created a migration with unsigned `user_id`. How can I edit `user_id` in a new migration to also make it `nullable()`? ``` Schema::create('throttle', function(Blueprint $table) { $table->increm...

Scala: join an iterable of strings

How do I "join" an iterable of strings by another string in Scala? ``` val thestrings = Array("a","b","c") val joined = ??? println(joined) ``` I want this code to output `a,b,c` (join the elements...

23 Mar at 17:50

Issue with adding common code as git submodule: "already exists in the index"

I want to add some git submodules. I've received two projects sharing some common code. The shared code was just copied into the two projects. I created a separate git repo for the common code and rem...

29 Dec at 00:51

Recursive file search using PowerShell

I am searching for a file in all the folders. `Copyforbuild.bat` is available in many places, and I would like to search recursively. ``` $File = "V:\Myfolder\**\*.CopyForbuild.bat" ``` How can I ...

15 Dec at 20:14