Unresolved reference issue in PyCharm
I have a directory structure ``` ├── simulate.py ├── src │ ├── networkAlgorithm.py │ ├── ... ``` And I can access the network module with `sys.path.insert()`. ``` import sys import os.path...
How to make a DIV visible and invisible with JavaScript?
Can you do something like ``` function showDiv() { [DIV].visible = true; //or something } ```
- Modified
- 7 Jan at 22:46
A generic error occurred in GDI+, JPEG Image to MemoryStream
This seems to be a bit of an infamous error all over the web. So much so that I have been unable to find an answer to my problem as my scenario doesn't fit. An exception gets thrown when I save the im...
What's the difference between TRUNCATE and DELETE in SQL
What's the difference between `TRUNCATE` and `DELETE` in SQL? If your answer is platform specific, please indicate that.
Get element inside element by class and ID - JavaScript
Alright, I've dabbled in JavaScript before, but the most useful thing I've written is a CSS style-switcher. So I'm somewhat new to this. Let's say I have HTML code like this: ``` <div id="foo"> <d...
- Modified
- 16 Aug at 02:54
Using :before CSS pseudo element to add image to modal
I have a CSS class `Modal` which is absolutely positioned, z-indexed above it's parent, and nicely positioned with JQuery. I want to add a caret image (^) to the top of the modal box and was looking ...
- Modified
- 12 Jul at 17:46
JavaScript: Object Rename Key
Is there a clever (i.e. optimized) way to rename a key in a javascript object? A non-optimized way would be: ``` o[ new_key ] = o[ old_key ]; delete o[ old_key ]; ```
- Modified
- 28 Jul at 16:23
How to recursively delete an entire directory with PowerShell 2.0?
What is the simplest way to forcefully delete a directory and all its subdirectories in PowerShell? I am using PowerShell V2 in Windows 7. I have learned from several sources that the most obvious co...
- Modified
- 8 Dec at 20:22
Get loop count inside a for-loop
This `for` loop iterates over all elements in a list: ``` for item in my_list: print item ``` Is there a way to know within the loop how many times I've been looping so far? For instance, I want ...
How to write a SQL DELETE statement with a SELECT statement in the WHERE clause?
Database: Sybase Advantage 11 On my quest to normalize data, I am trying to delete the results I get from this `SELECT` statement: ``` SELECT tableA.entitynum FROM tableA q INNER JOIN tableB u on (u...
- Modified
- 3 May at 03:55
Function overloading in Javascript - Best practices
What is the best way(s) to fake function overloading in Javascript? I know it is not possible to overload functions in Javascript as in other languages. If I needed a function with two uses `foo(x)...
- Modified
- 2 Jul at 07:47
Getting DOM element value using pure JavaScript
Is there any between these solutions? Solution 1: ``` function doSomething(id, value) { console.log(value); //... } ``` ``` <input id="theId" value="test" onclick="doSomething(this.id, this.val...
- Modified
- 16 Apr at 19:5
Downloading a file from spring controllers
I have a requirement where I need to download a PDF from the website. The PDF needs to be generated within the code, which I thought would be a combination of freemarker and a PDF generation framework...
- Modified
- 13 May at 22:4
Counting null and non-null values in a single query
I have a table ``` create table us ( a number ); ``` Now I have data like: ``` a 1 2 3 4 null null null 8 9 ``` Now I need a single query to count null not null values in column a
- Modified
- 13 Aug at 13:28
Push multiple elements to array
I'm trying to push multiple elements as one array, but getting an error: ``` > a = [] [] > a.push.apply(null, [1,2]) TypeError: Array.prototype.push called on null or undefined ``` I'm trying to do s...
- Modified
- 23 Mar at 07:33
Quickly create a large file on a Linux system
How can I create a large file on a Linux ([Red Hat Linux](http://en.wikipedia.org/wiki/Red_Hat_Linux)) system? [dd](http://en.wikipedia.org/wiki/Dd_%28Unix%29) will do the job, but reading from `/de...
- Modified
- 8 Sep at 20:55
How to get the size of a string in Python?
For example, I get a string: ``` str = "please answer my question" ``` I want to write it to a file. But I need to know the size of the string before writing the string to the file. What function ...
- Modified
- 21 Jan at 19:35
Convert char to int in C#
I have a char in c#: ``` char foo = '2'; ``` Now I want to get the 2 into an int. I find that Convert.ToInt32 returns the actual decimal value of the char and not the number 2. The following will...
jQuery: Wait/Delay 1 second without executing code
I can't get the `.delay` method working in jQuery: ``` $.delay(3000); // not working $(queue).delay(3000); // not working ``` I'm using a while loop to wait until an uncontrolled changing value is ...
- Modified
- 17 Jan at 14:29
Showing Difference between two datetime values in hours
I am retrieving two date time values from the database. Once the value is retrieved, I need the difference between the two values. For that, I create a timespan variable to store the difference of the...
- Modified
- 20 Jan at 14:28
How to detect when an @Input() value changes in Angular?
I have a parent component (), a child component () and an ApiService. I have most of this working fine i.e. each component can access the json api and get its relevant data via observables. Currentl...
- Modified
- 23 Sep at 11:23
How do I send a JSON string in a POST request in Go
I tried working with Apiary and made a universal template to send JSON to mock server and have this code: ``` package main import ( "encoding/json" "fmt" "github.com/jmcvetta/napping" ...
How to format date in angularjs
I want to format date as `mm/dd/yyyy`. I tried the following and none of it works for me. Can anyone help me with this? reference: [ui-date](https://github.com/angular-ui/ui-date) ``` <input ui-date...
- Modified
- 16 Mar at 12:42
Best way to format integer as string with leading zeros?
I need to add leading zeros to integer to make a string with defined quantity of digits ($cnt). What the best way to translate this simple function from PHP to Python: ``` function add_nulls($int, $c...
- Modified
- 9 Apr at 11:58
How can I print bold text in Python?
E.g: ``` print "hello" ``` What should I do to make the text "hello" bold?