Questions

JQuery - $ is not defined

I have a simple jquery click event ``` <script type="text/javascript"> $(function() { $('#post').click(function() { alert("test"); }); }); </script> ``` and a jqu...

15 Oct at 06:26

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

I'm running a PHP script and continue to receive errors like: > Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php on line 10Notice: Undefined index: my_index C:\wamp\www\myp...

How to create an array containing 1...N

I'm looking for any alternatives to the below for creating a JavaScript array containing 1 through to N where N is only known at runtime. ``` var foo = []; for (var i = 1; i <= N; i++) { foo.push(...

26 May at 08:19

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)

I'm having problems dealing with unicode characters from text fetched from different web pages (on different sites). I am using BeautifulSoup. The problem is that the error is not always reproducibl...

What is __init__.py for?

What is [__init__.py](https://docs.python.org/3/tutorial/modules.html#packages) for in a Python source directory?

How to read a text file into a string variable and strip newlines?

I have a text file that looks like: ``` ABC DEF ``` How can I read the file into a single-line string without newlines, in this case creating a string `'ABCDEF'`? --- [How to read a file without n...

9 Aug at 02:24

Get a list from Pandas DataFrame column headers

I want to get a list of the column headers from a Pandas DataFrame. The DataFrame will come from user input, so I won't know how many columns there will be or what they will be called. For example, i...

22 Oct at 12:15

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 style a <select> dropdown with only CSS?

Is there a CSS-only way to style a `<select>` dropdown? I need to style a `<select>` form as much as humanly possible, without any JavaScript. What are the properties I can use to do so in CSS? This...

How to convert a string to number in TypeScript?

Given a string representation of a number, how can I convert it to `number` type in TypeScript? ``` var numberString: string = "1234"; var numberValue: number = /* what should I do with `numberString...

1 Jun at 21:30

How do I concatenate strings and variables in PowerShell?

Suppose I have the following snippet: ``` $assoc = New-Object PSObject -Property @{ Id = 42 Name = "Slim Shady" Owner = "Eminem" } Write-Host $assoc.Id + " - " + $assoc.Name + " - " ...

27 Jun at 10:36

Which equals operator (== vs ===) should be used in JavaScript comparisons?

I'm using [JSLint](http://en.wikipedia.org/wiki/JSLint) to go through JavaScript, and it's returning many suggestions to replace `==` (two equals signs) with `===` (three equals signs) when doing thin...

How to add a browser tab icon (favicon) for a website?

I've been working on a website and I'd like to add a small icon to the browser tab. How can I do this in HTML and where in the code would I need to place it (e.g. header)? I have a `.png` logo file t...

29 Aug at 08:1

Difference between "git add -A" and "git add ."

What is the difference between [git add [--all | -A]](https://git-scm.com/docs/git-add#Documentation/git-add.txt--A) and [git add .](https://git-scm.com/docs/git-add)?

10 Jul at 22:26

Get the size of the screen, current web page and browser window

How can I get `windowWidth`, `windowHeight`, `pageWidth`, `pageHeight`, `screenWidth`, `screenHeight`, `pageX`, `pageY`, `screenX`, `screenY` which will work in all major browsers? ![screenshot descr...

How do I get list of all tables in a database using TSQL?

What is the best way to get the names of all of the tables in a specific database on SQL Server?

7 Dec at 02:36

Removing duplicates in lists

How can I check if a list has any duplicates and return a new list without duplicates?

How to create a file in Linux from terminal window?

What's the easiest way to create a file in Linux terminal?

How do I recursively grep all directories and subdirectories?

How do I recursively `grep` all directories and subdirectories? ``` find . | xargs grep "texthere" * ```

18 Nov at 20:24

Adding a directory to the PATH environment variable in Windows

I am trying to add `C:\xampp\php` to my system `PATH` environment variable in Windows. I have already added it using the dialog box. But when I type into my console: ``` C:\>path ``` it doesn't show...

Parse (split) a string in C++ using string delimiter (standard C++)

I am parsing a string in C++ using the following: ``` using namespace std; string parsed,input="text to be parsed"; stringstream input_stringstream(input); if (getline(input_stringstream,parsed,' '...

28 Feb at 09:42

How do I comment out a block of tags in XML?

How do I comment out a block of tags in XML? I.e. How can I comment out `<staticText>` and everything inside it, in the code below? ``` <detail> <band height="20"> <staticText> <re...

3 May at 10:41

jQuery disable/enable submit button

I have this HTML: ``` <input type="text" name="textField" /> <input type="submit" value="send" /> ``` How can I do something like this: - - - I tried something like this: ``` $(document).ready(...

9 Jun at 21:23

What is a NullReferenceException, and how do I fix it?

I have some code and when it executes, it throws a `NullReferenceException`, saying: > Object reference not set to an instance of an object. What does this mean, and what can I do to fix this error?...

How can I update NodeJS and NPM to their latest versions?

### I just installed Node.js & NPM (Node Package Manager) I installed NPM for access to additional Modules. After I installed Node.js & NPM I noticed that neither were the latest versions availabl...