input() error - NameError: name '...' is not defined
I am getting an error when I try to run this simple script: ``` input_variable = input("Enter your name: ") print("your name is" + input_variable) ``` Let's say I type in "dude", the error I am getti...
- Modified
- 23 Nov at 05:44
SELECT INTO a table variable in T-SQL
Got a complex SELECT query, from which I would like to insert all rows into a table variable, but T-SQL doesn't allow it. > Along the same lines, you cannot use a table variable with SELECT INTO or I...
- Modified
- 5 Jan at 09:9
I get exception when using Thread.sleep(x) or wait()
I have tried to delay - or put to sleep - my Java program, but an error occurs. I'm unable to use `Thread.sleep(x)` or `wait()`. The same error message appears: > unreported exception java.lang.Int...
How can I print a circular structure in a JSON-like format?
I have a big object I want to convert to JSON and send. However it has circular structure, so if I try to use `JSON.stringify()` I'll get: > TypeError: Converting circular structure to JSON or > TypeE...
- Modified
- 14 Feb at 17:45
For..In loops in JavaScript - key value pairs
I was wondering if there's a way to do something like a PHP `foreach` loop in JavaScript. The functionality I'm looking for is something like this PHP Snippet: ``` foreach($data as $key => $value) { ...
- Modified
- 22 Feb at 13:29
INSERT statement conflicted with the FOREIGN KEY constraint - SQL Server
I am getting the following error. Could you please help me? > Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Sup_Item_Sup_Item_Cat". The conf...
- Modified
- 28 Mar at 12:12
How can I save an activity state using the save instance state?
I've been working on the Android SDK platform, and it is a little unclear how to save an application's state. So given this minor re-tooling of the 'Hello, Android' example: ``` package com.android.he...
- Modified
- 13 Sep at 14:18
Command to collapse all sections of code?
In Visual Studio, is there a command to collapse/expand all the sections of code in a file?
- Modified
- 3 Jan at 06:36
No appenders could be found for logger(log4j)?
I have put log4j to my buildpath, but I get the following message when I run my application: ``` log4j:WARN No appenders could be found for logger (dao.hsqlmanager). log4j:WARN Please initialize the ...
How to use StringIO in Python3?
I am using Python 3.2.1 and I can't import the `StringIO` module. I use `io.StringIO` and it works, but I can't use it with `numpy`'s `genfromtxt` like this: ``` x="1 3\n 4.5 8" numpy.genfro...
- Modified
- 30 Nov at 13:11
"for line in..." results in UnicodeDecodeError: 'utf-8' codec can't decode byte
Here is my code, ``` for line in open('u.item'): # Read each line ``` Whenever I run this code it gives the following error: > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 289...
- Modified
- 30 Jan at 16:27
Changing git commit message after push (given that no one pulled from remote)
I have made a git commit and subsequent push. I would like to change the commit message. If I understand correctly, this is not advisable because someone might have pulled from the remote repository b...
What is git tag, How to create tags & How to checkout git remote tag(s)
when I checkout remote git tag use command like this: ``` git checkout -b local_branch_name origin/remote_tag_name ``` I got error like this: > error: pathspec `origin/remote_tag_name` did not match ...
- Modified
- 28 Jun at 16:12
How do I create a new line in Javascript?
``` var i; for(i=10; i>=0; i= i-1){ var s; for(s=0; s<i; s = s+1){ document.write("*"); } //i want this to print a new line /document.write(?); } ``` I am printing a pyramid of s...
- Modified
- 18 May at 15:2
How to list files in windows using command prompt (cmd). I've tried using ' ls ' as in Linux but it shows an error?
When I tried to use list `ls` on a Windows command prompt, the system doesn't recognize it. I already added `C:\Windows\System32` in the path.
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'
I want to begin writing queries in MySQL. `show grants` shows: ``` +--------------------------------------+ | Grants for @localhost | +--------------------------------------+ | GRANT ...
- Modified
- 20 Oct at 21:43
How do I read and parse an XML file in C#?
How do I read and parse an XML file in C#?
How do I escape curly-brace ({}) characters in a string while using .format (or an f-string)?
Non-working example: ``` print(" \{ Hello \} {0} ".format(42)) ``` Desired output: ``` {Hello} 42 ```
- Modified
- 22 Jan at 04:25
How to check a string for specific characters?
How can I check if a string has several specific characters in it using Python 2? For example, given the following string: > The criminals stole $1,000,000 in jewels. How do I detect if it has doll...
How to delete a cookie?
Is my function of creating a cookie correct? How do I delete the cookie at the beginning of my program? is there a simple coding? ``` function createCookie(name,value,days) ``` ``` function setCo...
- Modified
- 6 Jul at 02:25
Trim string in JavaScript
How do I remove all whitespace from the start and end of the string?
- Modified
- 13 Jun at 01:47
How to replace a string in multiple files in linux command line
I need to replace a string in a lot of files in a folder, with only `ssh` access to the server. How can I do this?
Install a Windows service using a Windows command prompt?
I want to install a Windows service using a Windows command prompt (not the Visual Studio command prompt). How do I do this?
- Modified
- 1 Feb at 15:23
Simple Pivot Table to Count Unique Values
This seems like a simple Pivot Table to learn with. I would like to do a count of unique values for a particular value I'm grouping on. For instance, I have this: ``` ABC 123 ABC 123 ABC 123 ...
- Modified
- 7 Mar at 04:49
Set transparent background of an imageview on Android
I am using a web view in which I am adding an image view. How can I set the background of this image view to transparent? I have tried this: ``` mImageview.setBackgroundResource(R.color.trans); ``` ...
- Modified
- 28 Apr at 21:26