"kill" will only kill one screen window. To "kill" the complete session, use quit. Example $ screen -X -S [session # you want to kill] quit For dead sessions use: $ screen -wipe You can kill a detached session which is not responding within the screen session by doing the following. Type screen -list to identify the detached screen session. ~$ screen -list There … [Read more...]
In the shell, what does ” 2>&1 ” mean?
File descriptor 1 is the standard output (stdout). File descriptor 2 is the standard error (stderr). Here is one way to remember this construct (although it is not entirely accurate): at first, 2>1 may look like a good way to redirect stderr to stdout. However, it will actually be interpreted as "redirect stderr to a file named 1". & indicates that what follows and precedes is … [Read more...]
What is the best way to iterate over a dictionary? [closed]
foreach(KeyValuePair entry in myDictionary) { // do something with entry.Value or entry.Key } If you are trying to use a generic Dictionary in C# like you would use an associative array in another language: foreach(var item in myDictionary) { foo(item.Key); bar(item.Value); } Or, if you only need to iterate over the collection of keys, use foreach(var item in … [Read more...]
Is there a printf converter to print in binary format?
Hacky but works for me: #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" #define BYTE_TO_BINARY(byte) (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0') printf("Leading text … [Read more...]
What are the differences between a HashMap and a Hashtable in Java?
There are several differences between HashMap and Hashtable in Java: Hashtable is synchronized, whereas HashMap is not. This makes HashMap better for non-threaded applications, as unsynchronized Objects typically perform better than synchronized ones. Hashtable does not allow null keys or values. HashMap allows one null key and any number of null values. One of HashMap's … [Read more...]
Getting a UnhandledPromiseRejectionWarning when testing using mocha/chai
The issue is caused by this: .catch((error) => { assert.isNotOk(error,'Promise error'); done(); }); If the assertion fails, it will throw an error. This error will cause done() never to get called, because the code errored out before it. That's what causes the timeout. The "Unhandled promise rejection" is also caused by the failed assertion, because if an error is thrown … [Read more...]
pygame.error: video system not initialized
You haven't called pygame.init() anywhere. See the basic Intro tutorial, or the specific Import and Initialize tutorial, which explains: Before you can do much with pygame, you will need to initialize it. The most common way to do this is just make one call. pygame.init() This will attempt to initialize all the pygame modules for you. Not all pygame modules need to be … [Read more...]
PHP & MySQL: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given [duplicate]
$dbc is returning false. Your query has an error in it: SELECT users.*, profile.* --You do not join with profile anywhere. FROM users INNER JOIN contact_info ON contact_info.user_id = users.user_id WHERE users.user_id=3"); The fix for this in … [Read more...]
Getting “net::ERR_BLOCKED_BY_CLIENT” error on some AJAX calls
AdBlockers usually have some rules, i.e. they match the URIs against some type of expression (sometimes they also match the DOM against expressions, not that this matters in this case). Having rules and expressions that just operate on a tiny bit of text (the URI) is prone to create some false-positives... Besides instructing your users to disable their extensions (at least on … [Read more...]
invalid conversion from ‘const char*’ to ‘char*’
Well, data.str().c_str() yields a char const* but your function Printfunc() wants to have char*s. Based on the name, it doesn't change the arguments but merely prints them and/or uses them to name a file, in which case you should probably fix your declaration to be void Printfunc(int a, char const* loc, char const* stream) The alternative might be to turn the char const* into … [Read more...]