Questions

Where should I put <script> tags in HTML markup?

When embedding JavaScript in an HTML document, where is the proper place to put the `<script>` tags and included JavaScript? I seem to recall that you are not supposed to place these in the `<head>` s...

16 Dec at 14:19

Is there a reason for C#'s reuse of the variable in a foreach?

When using lambda expressions or anonymous methods in C#, we have to be wary of the pitfall. For example: ``` foreach (var s in strings) { query = query.Where(i => i.Prop == s); // access to modi...

Can I delete a git commit but keep the changes?

In one of my development branches, I made some changes to my codebase. Before I was able to complete the features I was working on, I had to switch my current branch to master to demo some features. B...

18 Jun at 22:14

How to grep (search) committed code in the Git history

I have deleted a file or some code in a file sometime in the past. Can I grep in the content (not in the commit messages)? A very poor solution is to grep the log: ``` git log -p | grep <pattern> ``...

29 Oct at 09:38

Type Checking: typeof, GetType, or is?

I've seen many people use the following code: ``` Type t = obj1.GetType(); if (t == typeof(int)) // Some code here ``` But I know you could also do this: ``` if (obj1.GetType() == typeof(int)) ...

25 Nov at 14:20

Sass Variable in CSS calc() function

I'm trying to use the `calc()` function in a Sass stylesheet, but I'm having some issues. Here's my code: ``` $body_padding: 50px body padding-top: $body_padding height: calc(100% - $body_pad...

23 Aug at 00:4

What is the difference between Promises and Observables?

What is the difference between `Promise` and `Observable` in Angular? An example on each would be helpful in understanding both the cases. In what scenario can we use each case?

Git push requires username and password

I cloned a Git repository from my GitHub account to my PC. I want to work with both my PC and laptop, but with one GitHub account. When I try to push to or pull from GitHub using my PC, it requires ...

What does enctype='multipart/form-data' mean?

What does `enctype='multipart/form-data'` mean in an HTML form and when should we use it?

How to prettyprint a JSON file?

How do I pretty-print a JSON file in Python?

10 Apr at 10:24

Calling the base constructor in C#

If I inherit from a base class and want to pass something from the constructor of the inherited class to the constructor of the base class, how do I do that? For example, if I inherit from the Except...

26 Feb at 21:1

Insert results of a stored procedure into a temporary table

How do I do a `SELECT * INTO [temp table] FROM [stored procedure]`? Not `FROM [Table]` and without defining `[temp table]`? `Select` all data from `BusinessLine` into `tmpBusLine` works fine. ``` se...

How can I check if a string is a valid number?

I'm hoping there's something in the same conceptual space as the old VB6 `IsNumeric()` function?

24 Nov at 13:18

How to redirect one HTML page to another on load

Is it possible to set up a basic HTML page to redirect to another page on load?

25 Jan at 14:57

How to check if a string "StartsWith" another string?

How would I write the equivalent of C#'s [String.StartsWith](http://msdn.microsoft.com/en-us/library/baketfxw.aspx) in JavaScript? ``` var haystack = 'hello world'; var needle = 'he'; haystack.start...

8 Sep at 20:54

How to loop through a plain JavaScript object with the objects as members

How can I loop through all members in a JavaScript object, including values that are objects? For example, how could I loop through this (accessing the "your_name" and "your_message" for each)? ``` va...

19 Jul at 11:36

How to undo "git commit --amend" done instead of "git commit"

I accidentally amended my previous commit. The commit should have been separate to keep history of the changes I made to a particular file. Is there a way to undo that last commit? If I do something ...

16 Mar at 13:48

How can I make a UITextField move up when the keyboard is present - on starting to edit?

With the iOS SDK: I have a `UIView` with `UITextField`s that bring up a keyboard. I need it to be able to: 1. Allow scrolling of the contents of the UIScrollView to see the other text fields once the...

Multiple "order by" in LINQ

I have two tables, `movies` and `categories`, and I want to get an ordered list by first and then by . The movie table has three columns . The category table has two columns . I tried something like ...

2 Jul at 07:56

What's the canonical way to check for type in Python?

How do I check if an object is of a given type, or if it inherits from a given type? How do I check if the object `o` is of type `str`? --- `input``'1'`[How do I check if a string represents a numb...

11 Sep at 04:18

How does Facebook disable the browser's integrated Developer Tools?

So apparently because of the recent scams, the developer tools is exploited by people to post spam and even used to "hack" accounts. Facebook has blocked the developer tools, and I can't even use the ...

What is an undefined reference/unresolved external symbol error and how do I fix it?

What are undefined reference/unresolved external symbol errors? What are common causes and how to fix/prevent them?

How do I check if an object has a specific property in JavaScript?

How do I check if an object has a specific property in JavaScript? Consider: ``` x = {'key': 1}; if ( x.hasOwnProperty('key') ) { //Do this } ``` Is that the best way to do it?

29 Sep at 23:33

How do I get the row count of a Pandas DataFrame?

How do I get the number of rows of a pandas dataframe `df`?

28 Mar at 11:49

HTTP status code for update and delete?

What status code should I set for `UPDATE` (`PUT`) and `DELETE` (e.g. product successfully updated)?

21 Jun at 20:30