Questions

bash: shortest way to get n-th column of output

Let's say that during your workday you repeatedly encounter the following form of columnized output from some command in bash (in my case from executing `svn st` in my Rails working directory): ``` ?...

6 Sep at 06:18

Rolling or sliding window iterator?

I need a rolling window (aka sliding window) iterable over a sequence/iterator/generator. (Default Python iteration could be considered a special case, where the window length is 1.) I'm currently u...

9 Jan at 02:50

Can I nest a <button> element inside an <a> using HTML5?

I am doing the following: ``` <a href="www.stackoverflow.com"> <button disabled="disabled" >ABC</button> </a> ``` This works good but I get a HTML5 validation error that says "Element 'button' ...

18 Jun at 04:43

ERROR:'keytool' is not recognized as an internal or external command, operable program or batch file

When I use the command: ``` C:\>keytool -list -alias androiddebugkey -keystore .android\debug.keystore -storepass android -keypass android ``` I get this error: > 'keytool' ...

22 Mar at 01:36

Pythonic way to find maximum value and its index in a list?

If I want the maximum value in a list, I can just write `max(List)`, but what if I also need the index of the maximum value? I can write something like this: ``` maximum=0 for i,value in enumerate(L...

21 Dec at 08:58

Update Row if it Exists Else Insert Logic with Entity Framework

What is the most efficient way to implement logic using Entity Framework? Or are there any patterns for this?

30 Jul at 18:25

Android Eclipse - Could not find *.apk

I know this question has been asked before and I have seen a plethora of solutions out there, yet none seem to work for me. I was able to build my apk without issues until this error started cropping...

24 Jan at 03:4

Github: Can I see the number of downloads for a repo?

In Github, is there a way I can see the number of downloads for a repo?

11 Jan at 12:54

Converting string "true" / "false" to boolean value

I have a JavaScript string containing `"true"` or `"false"`. How may I convert it to boolean without using the `eval` function?

7 Sep at 13:1

Case-Insensitive List Search

I have a list `testList` that contains a bunch of strings. I would like to add a new string into the `testList` only if it doesn't already exist in the list. Therefore, I need to do a case-insensitive...

16 Oct at 00:46

Best way to store date/time in mongodb

I've seen using strings, integer timestamps and mongo datetime objects.

10 Feb at 10:54

How to Reload ReCaptcha using JavaScript?

I have a signup form with AJAX so that I want to refresh Recaptcha image anytime an error is occured (i.e. username already in use). I am looking for a code compatible with ReCaptcha to reload it usi...

30 Jul at 12:21

Convert list to dictionary using linq and not worrying about duplicates

I have a list of Person objects. I want to convert to a Dictionary where the key is the first and last name (concatenated) and the value is the Person object. The issue is that I have some duplicated...

27 Sep at 14:55

Set TextView text from html-formatted string resource in XML

I have some fixed strings inside my `strings.xml`, something like: ``` <resources> <string name="somestring"> <B>Title</B><BR/> Content </string> </resources> ``` and in my ...

23 May at 11:47

Under what circumstances is an SqlConnection automatically enlisted in an ambient TransactionScope Transaction?

What does it mean for an SqlConnection to be "enlisted" in a transaction? Does it simply mean that commands I execute on the connection will participate in the transaction? If so, under what circums...

Difference between HashSet and HashMap?

Apart from the fact that `HashSet` does not allow duplicate values, what is the difference between `HashMap` and `HashSet`? I mean implementation wise? It's a little bit vague because both use to st...

3 Nov at 05:21

How to use find command to find all files with extensions from list?

I need to find all image files from directory (gif, png, jpg, jpeg). ``` find /path/to/ -name "*.jpg" > log ``` How to modify this string to find not only .jpg files?

24 Oct at 10:7

jQuery.parseJSON throws “Invalid JSON” error due to escaped single quote in JSON

I’m making requests to my server using `jQuery.post()` and my server is returning JSON objects (like `{ "var": "value", ... }`). However, if any of the values contains a single quote (properly escaped...

13 Aug at 07:57

Changing Locale within the app itself

My users can change the Locale within the app (they may want to keep their phone settings in English but read the content of my app in French, Dutch or any other language ...) Why is this working per...

18 Mar at 09:1

What is a callback?

What's a callback and how is it implemented in C#?

26 Jan at 14:0

maximum value of int

Is there any code to find the maximum value of integer (accordingly to the compiler) in C/C++ like `Integer.MaxValue` function in java?

26 Nov at 15:13

How to read first N lines of a file?

We have a large raw data file that we would like to trim to a specified size. How would I go about getting the first N lines of a text file in python? Will the OS being used have any effect on the imp...

15 May at 14:31

Operator overloading in Java

Please can you tell me if it is possible to overload operators in Java? If it is used anywhere in Java could you please tell me about it.

6 Nov at 14:36

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

21 Mar at 03:48

C# int to byte[]

I need to convert an `int` to a `byte[]` one way of doing it is to use `BitConverter.GetBytes()`. But im unsure if that matches the following specification: > An XDR signed integer is a 32-bit datum...

20 Feb at 13:53