Questions

How do I get the directory where a Bash script is located from within the script itself?

How do I get the path of the directory in which a [Bash](http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29) script is located, that script? I want to use a Bash script as a launcher for another appl...

24 Jul at 23:51

How do I declare an array in Python?

How do I declare an array in [Python](http://en.wikipedia.org/wiki/Python_%28programming_language%29)?

23 Aug at 07:15

Java string to date conversion

What is the best way to convert a `String` in the format 'January 2, 2010' to a `Date` in Java? Ultimately, I want to break out the month, the day, and the year as integers so that I can use ``` Dat...

25 Jun at 13:53

JavaScript check if variable exists (is defined/initialized)

Which method of checking if a variable has been initialized is better/correct? (Assuming the variable could hold anything (string, int, object, function, etc.)) ``` if (elem) { // or !elem ``` or ```...

How can I pass arguments to a batch file?

I need to pass an ID and a password to a batch file at the time of running rather than hardcoding them into the file. Here's what the command line looks like: ``` test.cmd admin P@55w0rd > test-log....

30 Jan at 10:3

Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server

This should be dead simple, but I get it to work for the life of me. I'm just trying to connect remotely to my MySQL server. - Connecting as:``` mysql -u root -h localhost -p ``` - works fine, but tr...

28 Jun at 15:52

How can I display a JavaScript object?

How do I display the content of a JavaScript object in a string format like when we `alert` a variable? The same formatted way I want to display an object.

How to style a checkbox using CSS

I am trying to style a checkbox using the following: ``` <input type="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;" /> ``` But the style is not applied. The checkbox s...

17 Jul at 15:35

Convert a Unix timestamp to time in JavaScript

I am storing time in a MySQL database as a Unix timestamp and that gets sent to some JavaScript code. How would I get just the time out of it? For example, in `HH/MM/SS` format.

25 May at 04:43

How to open a Bootstrap modal window using jQuery?

I'm using Twitter Bootstrap modal window functionality. When someone clicks submit on my form, I want to show the modal window upon clicking the "submit button" in the form. ``` <form id="myform" cla...

31 Oct at 21:37

How do I get time of a Python program's execution?

I have a command line program in Python that takes a while to finish. I want to know the exact time it takes to finish running. I've looked at the `timeit` module, but it seems it's only for small sn...

8 Jun at 19:42

Installing specific package version with pip

I am trying to install version 1.2.2 of `MySQL_python`, using a fresh virtualenv created with the `--no-site-packages` option. The current version shown in PyPi is [1.2.3](http://pypi.python.org/pypi/...

3 Apr at 19:58

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

Find object by id in an array of JavaScript objects

I've got an array: ``` myArray = [{'id':'73','foo':'bar'},{'id':'45','foo':'bar'}, etc.] ``` I'm unable to change the structure of the array. I'm being passed an id of `45`, and I want to get `'bar...

Get selected text from a drop-down list (select box) using jQuery

How can I get the selected text (not the selected value) from a in jQuery?

How do I chop/slice/trim off last character in string using Javascript?

I have a string, `12345.00`, and I would like it to return `12345.0`. I have looked at `trim`, but it looks like it is only trimming whitespace and `slice` which I don't see how this would work. Any ...

13 Oct at 15:32

Center a column using Twitter Bootstrap 3

How do I center a div of one column size within the container (12 columns) in [Twitter Bootstrap 3](https://en.wikipedia.org/wiki/Bootstrap_%28front-end_framework%29)? ``` .centered { background-col...

How can I do a line break (line continuation) in Python?

Given: ``` e = 'a' + 'b' + 'c' + 'd' ``` How do I write the above in two lines? ``` e = 'a' + 'b' + 'c' + 'd' ```

9 Apr at 08:53

How do I correctly clone a JavaScript object?

I have an object `x`. I'd like to copy it as object `y`, such that changes to `y` do not modify `x`. I realized that copying objects derived from built-in JavaScript objects will result in extra, unwa...

30 Apr at 19:52

Python error "ImportError: No module named"

Python is installed in a local directory. My directory tree looks like this: ``` (local directory)/site-packages/toolkit/interface.py ``` My code is in here: ``` (local directory)/site-packages...

15 Aug at 19:50

Send HTTP POST request in .NET

How can I make an HTTP [POST](https://en.wikipedia.org/wiki/POST_%28HTTP%29) request and send data in the body?

Transitions on the CSS display property

I'm currently designing a CSS 'mega dropdown' menu - basically a regular CSS-only dropdown menu, but one that contains different types of content. At the moment, , i.e., you can't do any sort of tran...

26 Nov at 07:17

How to kill a process running on particular port in Linux?

I tried to close the tomcat using `./shutdown.sh` from tomcat `/bin` directory. But found that the server was not closed properly. And thus I was unable to restartMy tomcat is running on port `8080`. ...

10 Aug at 10:55

Generate random number between two numbers in JavaScript

Is there a way to generate a in a with JavaScript ? : a specified range from were the random number could be either .

30 Apr at 08:13

View the change history of a file using Git versioning

How do I view the history of an individual file with complete details of what has changed? `git log -- [filename]` shows me the commit history of a file, but how do I see the file content that changed...

10 Jul at 21:49