Questions

How do I import an SQL file using the command line in MySQL?

I have a `.sql` file with an export from `phpMyAdmin`. I want to import it into a different server using the command line. I have a [Windows Server 2008](http://en.wikipedia.org/wiki/Windows_Server_2...

14 Nov at 19:27

How do I check if a string contains a specific word?

Consider: ``` $a = 'How are you?'; if ($a contains 'are') echo 'true'; ``` Suppose I have the code above, what is the correct way to write the statement `if ($a contains 'are')`?

How do I determine whether an array contains a particular value in Java?

I have a `String[]` with values like so: ``` public static final String[] VALUES = new String[] {"AB","BC","CD","AE"}; ``` Given `String s`, is there a good way of testing whether `VALUES` contains...

5 Jan at 09:6

Set a default parameter value for a JavaScript function

I would like a JavaScript function to have optional arguments which I set a default on, which get used if the value isn't defined (and ignored if the value is passed). In Ruby you can do it like this:...

How to make a div 100% height of the browser window

I have a layout with two columns - a left `div` and a right `div`. The right `div` has a grey `background-color`, and I need it to expand vertically depending on the height of the user's browser windo...

17 Jan at 18:58

How do I call one constructor from another in Java?

Is it possible to call a constructor from another (within the same class, not from a subclass)? If yes how? And what could be the best way to call another constructor (if there are several ways to do ...

12 Nov at 20:16

How can I determine if a variable is 'undefined' or 'null'?

How do I determine if variable is `undefined` or `null`? My code is as follows: ``` var EmpName = $("div#esd-names div#name").attr('class'); if(EmpName == 'undefined'){ // DO SOMETHING }; ``` ``...

How do you display code snippets in MS Word preserving format and syntax highlighting?

Does anyone know a way to display code in Microsoft Word documents that preserves coloring and formatting? Preferably, the method would also be unobtrusive and easy to update. I have tried to include...

29 Nov at 07:17

How do I get a substring of a string in Python?

I want to get a new string from the third character to the end of the string, e.g. `myString[2:end]`. If omitting the second part means 'to the end', and if you omit the first part, does it start from...

16 Dec at 02:7

What is the difference between `margin` and `padding` in CSS?

What is the difference between `margin` and `padding` in CSS? In what kind of situations: - - `margin`- `padding`

15 Dec at 12:20

Deep cloning objects

I want to do something like: ``` MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone(); ``` And then make changes to the new object that are not reflected in ...

10 Jan at 05:19

How to change the output color of echo in Linux

I am trying to print a text in the terminal using echo command. I want to print the text in a red color. How can I do that?

What is the difference between CMD and ENTRYPOINT in a Dockerfile?

In Dockerfiles there are two commands that look similar to me: `CMD` and `ENTRYPOINT`. But I guess that there is a (subtle?) difference between them - otherwise it would not make any sense to have two...

26 Jul at 23:56

How to list only the names of files that changed between two commits

I have a bunch of commits in the repository. I want to see a list of files changed between two commits - from to . What command should I use?

26 Aug at 16:55

How do I "git clone" a repo, including its submodules?

How do I clone a git repository so that it also clones its submodules? Running `git clone $REPO_URL` merely creates empty submodule directories.

17 Jul at 00:43

How do I get the hash for the current commit in Git?

How do I get the hash of the current commit in Git?

25 Jul at 02:45

How do I show the changes which have been staged?

I staged a few changes to be committed. How do I see the diffs of all files which are staged for the next commit? Is there a handy one-liner for this? [git status](http://git-scm.com/docs/git-status) ...

25 Jul at 02:23

What are the differences between .gitignore and .gitkeep?

What are the differences between `.gitignore` and `.gitkeep`? Are they the same thing with a different name, or do they both serve a different function? I don't seem to be able to find much documenta...

6 Oct at 14:6

Disable/enable an input with jQuery?

``` $input.disabled = true; ``` or ``` $input.disabled = "disabled"; ``` Which is the standard way? And, conversely, how do you enable a disabled input?

Catch multiple exceptions at once?

It is discouraged to simply catch `System.Exception`. Instead, only the "known" exceptions should be caught. Now, this sometimes leads to unnecessary repetitive code, for example: ``` try { WebId ...

26 Feb at 08:5

What is reflection and why is it useful?

What is reflection, and why is it useful? I'm particularly interested in Java, but I assume the principles are the same in any language.

27 Nov at 07:51

How do I delete all Git branches which have been merged?

How do I delete branches which have already been merged? Can I delete them all at once, instead of deleting each branch one-by-one?

How do I revert all local changes in Git managed project to previous state?

I ran `git status` which told me everything was up to date and there were no local changes. Then I made several consecutive changes and realized I wanted to throw everything away and get back to my or...

17 Jul at 00:42

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?

What's the difference between @Component, @Repository & @Service annotations in Spring?

Can [@Component](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Component.html), [@Repository](https://docs.spring.io/spring-framework/docs/current/jav...

17 Feb at 13:10