How can I access the contents of an iframe with JavaScript/jQuery?
I would like to manipulate the HTML inside an iframe using jQuery. I thought I'd be able to do this by setting the context of the jQuery function to be the document of the iframe, something like: ``...
- Modified
- 18 Mar at 19:21
How to create a dialog with “Ok” and “Cancel” options
I am going to make a button to take an action and save the data into a database. Once the user clicks on the button, I want a JavaScript alert to offer “yes” and “cancel” options. If the user selects ...
- Modified
- 12 Jan at 17:6
Styling multi-line conditions in 'if' statements?
Sometimes I break long conditions in `if`s onto several lines. The most obvious way to do this is: ``` if (cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do...
- Modified
- 30 May at 17:35
Using boolean values in C
C doesn't have any built-in boolean types. What's the best way to use them in C?
How to get the CUDA version?
Is there any quick command or script to check for the version of CUDA installed? I found the manual of 4.0 under the installation directory but I'm not sure whether it is of the actual installed vers...
- Modified
- 14 Feb at 02:47
module.exports vs exports in Node.js
I've found the following contract in a Node.js module: ``` module.exports = exports = nano = function database_module(cfg) {...} ``` I wonder what's the difference between `module.exports` and `expor...
- Modified
- 24 Jul at 12:33
How to avoid reverse engineering of an APK file
I am developing a for Android, and I want to prevent a hacker from accessing any resources, assets or source code from the [APK](http://en.wikipedia.org/wiki/APK_%28file_format%29) file. If someone c...
- Modified
- 22 Jul at 19:58
git pull fails "unable to resolve reference" "unable to update local ref"
Using git 1.6.4.2, when I tried a `git pull` I get this error: ``` error: unable to resolve reference refs/remotes/origin/LT558-optimize-sql: No such file or directory From git+ssh://remoteserver/~/...
- Modified
- 22 Apr at 17:23
How to convert string representation of list to a list
I was wondering what the simplest way is to convert a string representation of a list like the following to a `list`: ``` x = '[ "A","B","C" , " D"]' ``` Even in cases where the user puts spaces in b...
How to fix "ReferenceError: primordials is not defined" in Node.js
I have installed Node.js modules by 'npm install', and then I tried to do `gulp sass-watch` in a command prompt. After that, I got the below response. ``` [18:18:32] Requiring external module babel-re...
What is "export default" in JavaScript?
File: [SafeString.js](https://github.com/wycats/handlebars.js/blob/583141de7cb61eb70eaa6b33c25f475f3048071b/lib/handlebars/safe-string.js) ``` // Build out our basic SafeString type function SafeStrin...
- Modified
- 3 Oct at 19:28
How to get a file's extension in PHP?
This is a question you can read everywhere on the web with various answers: ``` $ext = end(explode('.', $filename)); $ext = substr(strrchr($filename, '.'), 1); $ext = substr($filename, strrpos($filen...
- Modified
- 22 Feb at 18:28
Detect click outside React component
I'm looking for a way to detect if a click event happened outside of a component, as described in this [article](https://css-tricks.com/dangers-stopping-event-propagation/). jQuery closest() is used t...
- Modified
- 21 Aug at 23:36
How do I print the full NumPy array, without truncation?
When I print a numpy array, I get a truncated representation, but I want the full array. ``` >>> numpy.arange(10000) array([ 0, 1, 2, ..., 9997, 9998, 9999]) >>> numpy.arange(10000).reshape(2...
- Modified
- 29 Jul at 06:37
How do I check that a number is float or integer?
How to find that a number is `float` or `integer`? ``` 1.25 --> float 1 --> integer 0 --> integer 0.25 --> float ```
- Modified
- 25 Jan at 09:33
Should I make HTML Anchors with 'name' or 'id'?
When one wants to refer to some part of a webpage with the "`http://example.com/#foo`" method, should one use ``` <h1><a name="foo"/>Foo Title</h1> ``` or ``` <h1 id="foo">Foo Title</h1> ``` The...
- Modified
- 2 Aug at 14:38
Pass a JavaScript function as parameter
How do I pass a function as a parameter without the function executing in the "parent" function or using `eval()`? (Since I've read that it's insecure.) I have this: ``` addContact(entityId, refresh...
- Modified
- 1 Jun at 23:38
How to convert byte array to string
I created a byte array with two strings. How do I convert a byte array to string? ``` var binWriter = new BinaryWriter(new MemoryStream()); binWriter.Write("value1"); binWriter.Write("value2"); binWr...
- Modified
- 14 Jun at 17:56
How to force cp to overwrite without confirmation
I'm trying to use the `cp` command and force an overwrite. I have tried `cp -rf /foo/* /bar`, but I am still prompted to confirm each overwrite.
- Modified
- 18 Jan at 00:11
How to commit my current changes to a different branch in Git
Sometimes it happens that I make some changes in my working directory, and I realize that these changes should be committed in a branch different to the current one. This usually happens when I want t...
Direct casting vs 'as' operator?
Consider the following code: ``` void Handler(object o, EventArgs e) { // I swear o is a string string s = (string)o; // 1 //-OR- string s = o as string; // 2 // -OR- string s = o.T...
Best Practices for securing a REST API / web service
When designing a REST API or service are there any established best practices for dealing with security (Authentication, Authorization, Identity Management) ? When building a SOAP API you have WS-Sec...
- Modified
- 14 Jul at 22:18
Difference between single and double quotes in Bash
In Bash, what are the differences between single quotes (`''`) and double quotes (`""`)?
- Modified
- 24 May at 14:53
How to read embedded resource text file
How do I read an embedded resource (text file) using `StreamReader` and return it as a string? My current script uses a Windows form and textbox that allows the user to find and replace text in a tex...
- Modified
- 9 Feb at 20:48