C++ Loop through Map
I want to iterate through each element in the `map<string, int>` without knowing any of its string-int values or keys. What I have so far: ``` void output(map<string, int> table) { map<string...
- Modified
- 6 Sep at 20:38
Tar a directory, but don't store full absolute paths in the archive
I have the following command in the part of a backup shell script: ``` tar -cjf site1.bz2 /var/www/site1/ ``` When I list the contents of the archive, I get: ``` tar -tf site1.bz2 var/www/site1/st...
Why do I get AttributeError: 'NoneType' object has no attribute 'something'?
I keep getting an error that says ``` AttributeError: 'NoneType' object has no attribute 'something' ``` The code I have is too long to post here. What general scenarios would cause this `Attribute...
- Modified
- 9 May at 20:21
Sample random rows in dataframe
I am struggling to find the appropriate function that would return a specified number of rows picked up randomly without replacement from a data frame in R language? Can anyone help me out?
IIS AppPoolIdentity and file system write access permissions
Here's an issue with IIS 7.5 and ASP.NET that I've been researching and getting nowhere with. Any help would be greatly appreciated. My question is: using ASP.NET in IIS 7.5, how does IIS and/or the ...
- Modified
- 10 Apr at 17:11
How can I import a database with MySQL from terminal?
How can I import a database with mysql from terminal? I cannot find the exact syntax.
How to get the insert ID in JDBC?
I want to `INSERT` a record in a database (which is Microsoft SQL Server in my case) using JDBC in Java. At the same time, I want to obtain the insert ID. How can I achieve this using JDBC API?
How do I remove lines between ListViews on Android?
I'm using two `ListView`s like this: ``` <ListView android:id="@+id/ListView" android:text="@string/Website" android:layout_height="30px" android:layout_width="150px" android:scrollbar...
- Modified
- 20 Jan at 12:27
What does the M stand for in C# Decimal literal notation?
In order to work with decimal data types, I have to do this with variable initialization: ``` decimal aValue = 50.0M; ``` What does the M part stand for?
How can I include a YAML file inside another?
So I have two YAML files, "A" and "B" and I want the contents of A to be inserted inside B, either spliced into the existing data structure, like an array, or as a child of an element, like the value ...
- Modified
- 2 Oct at 18:29
Echo tab characters in bash script
How do I echo one or more tab characters using a bash script? When I run this code ``` res=' 'x # res = "\t\tx" echo '['$res']' # expect [\t\tx] ``` I get this ``` res=[ x] # that is [<space...
How to create a <style> tag with Javascript?
I'm looking for a way to insert a `<style>` tag into an HTML page with JavaScript. The best way I found so far: ``` var divNode = document.createElement("div"); divNode.innerHTML = "<br><style>h1 { ...
- Modified
- 2 Jan at 10:40
In .NET, which loop runs faster, 'for' or 'foreach'?
In C#/VB.NET/.NET, which loop runs faster, `for` or `foreach`? Ever since I read that a `for` loop works faster than a `foreach` loop a [long time ago](https://learn.microsoft.com/previous-versions/d...
- Modified
- 22 Feb at 00:1
Vim 80 column layout concerns
The way I do 80-column indication in Vim seems incorrect:`set columns=80`. At times I also `set textwidth`, but I want to be able to see and anticipate line overflow with the `set columns` alternativ...
- Modified
- 26 Nov at 04:10
How do you perform wireless debugging in Xcode 9 with iOS 11, Apple TV 4K, etc?
Wireless debugging was recently added as a feature in Xcode 9, iOS 11, and tvOS 11. Apple TV 4K doesn't have a USB port, so it requires wireless debugging. How do you perform this wireless debugging i...
SQL Server - inner join when updating
I have the below query which does not work. What am I doing wrong? Is this even possible? ``` UPDATE ProductReviews AS R INNER JOIN products AS P ON R.pid = P.id SET R.status = '0' WHER...
- Modified
- 6 Mar at 17:11
Getting an element from a Set
Why doesn't `Set` provide an operation to get an element that equals another element? ``` Set<Foo> set = ...; ... Foo foo = new Foo(1, 2, 3); Foo bar = set.get(foo); // get the Foo element from the...
- Modified
- 24 Feb at 19:46
Why does datetime.datetime.utcnow() not contain timezone information?
``` datetime.datetime.utcnow() ``` Why does this `datetime` not have any timezone info given that it is explicitly a UTC `datetime`? I would expect that this would contain `tzinfo`.
Detect all changes to a <input type="text"> (immediately) using JQuery
There are many ways the value of a `<input type="text">` can change, including: - - - - I want my JavaScript function to be called (with the current input value) any time it changes. And I want it...
- Modified
- 9 Apr at 04:50
Difference between Big-O and Little-O Notation
What is the difference between notation `O(n)` and notation `o(n)`?
- Modified
- 30 Jan at 13:47
Predefined type 'System.ValueTuple´2´ is not defined or imported
I've installed Visual Studio 15 Preview 3 and tried to use the new tuple feature ``` static void Main(string[] args) { var x = DoSomething(); Console.WriteLine(x.x); } static (int x, int y) ...
- Modified
- 8 Mar at 20:28
Vagrant stuck connection timeout retrying
My vagrant was working perfectly fine last night. I've just turned the PC on, hit `vagrant up`, and this is what I get: ``` ==> default: Clearing any previously set network interfaces... ==> default:...
- Modified
- 27 Aug at 14:57
Change project name on Android Studio
I want to change the name of my project and module. But if I try to rename them Android Studio notify me some errors... e.g. I want to change the name from "MyApplication" to "AndroidApp" as shown in ...
- Modified
- 2 Dec at 05:11
How to update gradle in android studio?
I installed Android Studio 0.1.9. Today I got and update to version 0.2 and of course I updated. After the installation I restarted Android Studio but now I get this message: > Project is using an o...
- Modified
- 15 Jul at 07:37
How to map and remove nil values in Ruby
I have a `map` which either changes a value or sets it to nil. I then want to remove the nil entries from the list. The list doesn't need to be kept. This is what I currently have: ``` # A simple ex...
- Modified
- 15 Dec at 21:50