Questions

How to see docker image contents

I did a docker pull and can list the image that's downloaded. I want to see the contents of this image. Did a search on the net but no straight answer.

2 Oct at 10:39

How can bcrypt have built-in salts?

Coda Hale's article ["How To Safely Store a Password"](http://codahale.com/how-to-safely-store-a-password/) claims that: > bcrypt has salts built-in to prevent rainbow table attacks. He cites [this pa...

20 Jun at 09:12

Split string with multiple delimiters in Python

I found some answers online, but I have no experience with regular expressions, which I believe is what is needed here. I have a string that needs to be split by either a ';' or ', ' That is, it has ...

31 Dec at 05:54

Dynamic LINQ OrderBy on IEnumerable<T> / IQueryable<T>

I found an example in the [VS2008 Examples](http://msdn2.microsoft.com/en-us/bb330936.aspx) for Dynamic LINQ that allows you to use a SQL-like string (e.g. `OrderBy("Name, Age DESC"))` for ordering. U...

How to display request headers with command line curl

Command line curl can display response header by using `-D` option, but I want to see what request header it is sending. How can I do that?

10 Feb at 20:52

How do I get my program to sleep for 50 milliseconds?

How do I get my Python program to sleep for 50 milliseconds?

10 Mar at 19:18

How to "pretty" format JSON output in Ruby on Rails

I would like my JSON output in Ruby on Rails to be "pretty" or nicely formatted. Right now, I call `to_json` and my JSON is all on one line. At times this can be difficult to see if there is a prob...

2 Mar at 03:16

Asking the user for input until they give a valid response

I am writing a program that accepts user input. ``` #note: Python 2.7 users should use `raw_input`, the equivalent of 3.X's `input` age = int(input("Please enter your age: ")) if age >= 18: print...

22 May at 19:18

*.h or *.hpp for your class definitions

I've always used a `*.h` file for my class definitions, but after reading some boost library code, I realised they all use `*.hpp`. I've always had an aversion to that file extension, I think mainly b...

20 Jul at 19:20

How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops

How can I use regular expressions in Excel and take advantage of Excel's powerful grid-like setup for data manipulation? - - - - --- I understand Regex is not ideal for many situations ([To use...

24 May at 15:1

Can I add jars to Maven 2 build classpath without installing them?

Maven 2 is driving me crazy during the experimentation / quick and dirty mock-up phase of development. I have a `pom.xml` file that defines the dependencies for the web-app framework I want to use, an...

4 May at 09:34

Difference between object and class in Scala

I'm just going over some Scala tutorials on the Internet and have noticed in some examples an object is declared at the start of the example. What is the difference between `class` and `object` in Sc...

19 May at 08:48

How do I prepend to a short python list?

`list.append()` appends to the end of a list. [This explains](http://mail.python.org/pipermail/tutor/2005-March/036803.html) that `list.prepend()` does not exist due to performance concerns for large...

17 Jul at 08:1

How to find if an array contains a specific string in JavaScript/jQuery?

Can someone tell me how to detect if `"specialword"` appears in an array? Example: ``` categories: [ "specialword" "word1" "word2" ] ```

8 Nov at 15:36

How can I clear or empty a StringBuilder?

I'm using a [StringBuilder](http://download.oracle.com/javase/1.5.0/docs/api/java/lang/StringBuilder.html) in a loop and every x iterations I want to empty it and start with an empty `StringBuilder`, ...

8 Feb at 01:15

Find duplicate records in MySQL

I want to pull out duplicate records in a MySQL Database. This can be done with: ``` SELECT address, count(id) as cnt FROM list GROUP BY address HAVING cnt > 1 ``` Which results in: ``` 100 MAIN ...

12 May at 18:24

How to determine CPU and memory consumption from inside a process

I once had the task of determining the following performance parameters from inside a running application: - - - --- - - - --- - - The code had to run on Windows and Linux. Even though this seems...

5 Jul at 11:49

Writing to output window of Visual Studio

I am trying to write a message to the output window for debugging purposes. I searched for a function like Java's `system.out.println("")`. I tried `Debug.Write`, `Console.Write`, and `Trace.Write`. I...

What is an idiomatic way of representing enums in Go?

I'm trying to represent a simplified chromosome, which consists of N bases, each of which can only be one of `{A, C, T, G}`. I'd like to formalize the constraints with an enum, but I'm wondering what...

20 Jan at 17:23

How do I get cURL to not show the progress bar?

I'm trying to use cURL in a script and get it to show the progress bar. I've tried the `-s`, `-silent`, `-S`, and `-quiet` options, but none of them work. Here's a typical command I've tried: ```...

22 Dec at 03:50

Show a number to two decimal places

What's the correct way to round a PHP string to two decimal places? ``` $number = "520"; // It's a string from a database $formatted_number = round_to_2dp($number); echo $formatted_number; ``` Th...

How do I append one string to another in Python?

How do I efficiently append one string to another? Are there any faster alternatives to: ``` var1 = "foo" var2 = "bar" var3 = var1 + var2 ``` --- [How to concatenate (join) items in a list to a si...

16 Jan at 08:18

How to append to a file in Node?

I am trying to a string to a log file. However writeFile will erase the content each time before writing the string. ``` fs.writeFile('log.txt', 'Hello Node', function (err) { if (err) throw err; ...

8 Jul at 18:6

Updating address bar with new URL without hash or reloading the page

I either dreamt about chrome (dev channel) implementing a way to update the address bar via javascript (the path, not domain) without reloading the page or they really have done this. However, I can'...

23 May at 12:26

Why is Java Vector (and Stack) class considered obsolete or deprecated?

Why is Java Vector considered a legacy class, obsolete or deprecated? Isn't its use valid when working with concurrency? And if I don't want to manually synchronize objects and just want to use a th...

16 May at 00:28