Questions

Why is __dirname not defined in node REPL?

From the node manual I see that I can get the directory of a file with `__dirname`, but from the REPL this seems to be undefined. Is this a misunderstanding on my side or where is the error? ``` $ no...

25 Aug at 10:39

Difference between natural join and inner join

What is the difference between a natural join and an inner join?

1 Jul at 19:2

How to automatically convert strongly typed enum into int?

``` #include <iostream> struct a { enum LOCAL_A { A1, A2 }; }; enum class b { B1, B2 }; int foo(int input) { return input; } int main(void) { std::cout << foo(a::A1) << std::endl; std::cout <...

25 Jun at 21:14

Repeat a task with a time delay?

I have a variable in my code say it is "status". I want to display some text in the application depending on this variable value. This has to be done with a specific time delay. It's like, - Check...

15 Oct at 09:55

Performing Inserts and Updates with Dapper

I am interested in using Dapper - but from what I can tell it only supports Query and Execute. I do not see that Dapper includes a way of Inserting and Updating objects. Given that our project (most...

10 May at 23:54

What is the difference between MacVim and regular Vim?

I'm reasonably new to OS X, but I'm familiar with Vim from using it in various *nix systems. I've seen many people recommend running MacVim over Vim in the terminal. Can anyone tell me what difference...

26 Apr at 23:49

Execute bash script from URL

Say I have a file at the URL `http://mywebsite.example/myscript.txt` that contains a script: ``` #!/bin/bash echo "Hello, world!" read -p "What is your name? " name echo "Hello, ${name}!" ``` And I'd...

23 Jun at 19:50

What is the opposite of evt.preventDefault();

Once I've fired an `evt.preventDefault()`, how can I resume default actions again?

31 Oct at 13:1

How to get all columns' names for all the tables in MySQL?

Is there a fast way of getting all column names from all tables in `MySQL`, without having to list all the tables?

CSS selector based on element text?

Is there a way to select an element in css based on element text? ie: ``` li[text=*foo] <li>foo</li> <li>bar</li> ``` That probably doesn't work. Edit: Also only need to support Chrome.

31 Jan at 07:10

Add a CSS class to <%= f.submit %>

My question is easy: ``` <%= f.submit %> ``` Where does the class declaration go? I'm getting errors on multiple attempts.

15 Mar at 18:0

Get item in the list in Scala?

How in the world do you get just an element at index from the List in scala? I tried `get(i)`, and `[i]` - nothing works. Googling only returns how to "find" an element in the list. But I already kn...

17 Feb at 03:55

The apk must be signed with the same certificates as the previous version

I had uploaded my app to Google Play (back when it was called Android Market) some time ago. Today I updated the app, but I had deleted the previous keystore and created a new one. When uploading, it...

10 Oct at 11:56

ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

Why am I getting this database error when I update a table? > ERROR at line 1: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

6 Aug at 12:24

How to Update Multiple Array Elements in mongodb

I have a Mongo document which holds an array of elements. I'd like to reset the `.handled` attribute of all objects in the array where `.profile` = XX. The document is in the following form: ``` {...

23 Apr at 05:38

How to run multiple Python versions on Windows

I had two versions of Python installed on my machine (versions 2.6 and 2.5). I want to run 2.6 for one project and 2.5 for another. How can I specify which I want to use? I am working on Windows XP...

29 Aug at 13:11

setting multiple column using one update

How to set multiple columns of a table using update query in mysql?

8 Sep at 11:59

Split a string by a delimiter in python

How to split this string where `__` is the delimiter ``` MATCHES__STRING ``` To get an output of `['MATCHES', 'STRING']`? --- [How do I split a string into a list of words?](https://stackoverflow....

22 Jan at 11:43

Password masking console application

I tried the following code... ``` string pass = ""; Console.Write("Enter your password: "); ConsoleKeyInfo key; do { key = Console.ReadKey(true); // Backspace Should Not Work if (key.K...

Apply CSS styles to an element depending on its child elements

Is it possible to define a CSS style for an element, that is only applied if the matching element contains a specific element (as the direct child item)? I think this is best explained using an examp...

18 Dec at 07:19

Handling exceptions from Java ExecutorService tasks

I'm trying to use Java's `ThreadPoolExecutor` class to run a large number of heavy weight tasks with a fixed number of threads. Each of the tasks has many places during which it may fail due to except...

How do you stretch an image to fill a <div> while keeping the image's aspect-ratio?

I need to make this image stretch to the maximum size possible without overflowing it's `<div>` or skewing the image. I can't predict the aspect-ratio of the image, so there's no way to know whethe...

20 Sep at 04:58

Convert List<DerivedClass> to List<BaseClass>

While we can inherit from base class/interface, why can't we declare a `List<>` using same class/interface? ``` interface A { } class B : A { } class C : B { } class Test { static void Main...

Format decimal for percentage values?

What I want is something like this: ``` String.Format("Value: {0:%%}.", 0.8526) ``` Where %% is that format provider or whatever I am looking for. Should result: `Value: %85.26.`. I basically need...

Textarea that can do syntax highlighting on the fly?

I am storing a number of HTML blocks inside a CMS for reasons of easier maintenance. They are represented by `<textarea>`s. Does anybody know a JavaScript Widget of some sort that can do syntax highl...