How do I get the time difference between two DateTime objects using C#?
How do I get the time difference between two `DateTime` objects using C#?
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication
> The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state. What is this error all about, and how would I go abou...
How to convert an integer to a string in any base?
Python allows easy creation of an integer from a string of a given base via ``` int(str, base). ``` I want to perform the inverse: , i.e. I want some function `int2base(num, base)`, such that: `...
Powershell script to see currently logged in users (domain and machine) + status (active, idle, away)
I am searching for a simple command to see logged on users on server. I know this one : ``` Get-WmiObject -Class win32_computersystem ``` but this will not provide me the info I need. It returns : ...
- Modified
- 22 Apr at 12:37
Why do some functions have underscores "__" before and after the function name?
This "underscoring" seems to occur a lot, and I was wondering if this was a requirement in the Python language, or merely a matter of convention? Also, could someone name and explain which functions ...
- Modified
- 21 Mar at 10:33
Get the value of a dropdown in jQuery
I have a drop down that has an 'ID, Name' Pair. Example Jon Miller Jim Smith Jen Morsin Jon MIller has ID of 101 Jim Smith has ID of 102 Jen Morsin has ID of 103 When I do the followng: ``` var a...
- Modified
- 23 Oct at 16:18
Postgresql tables exists, but getting "relation does not exist" when querying
I have a postgresql db with a number of tables. If I query: ``` SELECT column_name FROM information_schema.columns WHERE table_name="my_table"; ``` I will get a list of the columns returned properl...
- Modified
- 25 Apr at 01:36
Angular JS break ForEach
I have an angular foreach loop and i want to break from loop if i match a value. The following code does not work. ``` angular.forEach([0,1,2], function(count){ if(count == 1){ break; } }); `...
- Modified
- 12 Dec at 16:16
replace String with another in java
What function can replace a string with another string? Example #1: What will replace `"HelloBrother"` with `"Brother"`? Example #2: What will replace `"JAVAISBEST"` with `"BEST"`?
Add days Oracle SQL
``` SELECT ORDER_NUM, CUSTOMER_NUM, CUSTOMER_NAME, ADD_DAYS (ORDER_DATE, 20) FROM CUSTOMER, ORDERS; ``` Oracle Express says ADD_DAYS invalid? Any ideas what Am I doing wrong?
OR condition in Regex
Let's say I have ``` 1 ABC Street 1 A ABC Street ``` With `\d`, it matches (what I expect), with `\d \w`, it matches (expected). When I combine the patterns together `\d|\d \w`, it matches only t...
- Modified
- 21 Nov at 13:13
Use of 'const' for function parameters
How far do you go with `const`? Do you just make functions `const` when necessary or do you go the whole hog and use it everywhere? For example, imagine a simple mutator that takes a single boolean ...
'pip' is not recognized
I tried to install `PySide` but I got error from the powershell as follows: ``` pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the s...
- Modified
- 7 Jan at 03:15
Failed to find 'ANDROID_HOME' environment variable
I am trying to build an ionic-android project and i have android sdk installed. [](https://i.stack.imgur.com/Bmoa3.png) The name of my project is myApp.I have successfully added android platform to...
- Modified
- 24 Mar at 10:36
SQL join: selecting the last records in a one-to-many relationship
Suppose I have a table of customers and a table of purchases. Each purchase belongs to one customer. I want to get a list of all customers along with their last purchase in one `SELECT` statement. Wha...
- Modified
- 14 Dec at 17:47
How do I run all Python unit tests in a directory?
I have a directory that contains my Python unit tests. Each unit test module is of the form . I am attempting to make a file called that will, you guessed it, run all files in the aforementioned test...
- Modified
- 5 Jan at 00:40
Two Decimal places using c#
``` decimal Debitvalue = 1156.547m; decimal DEBITAMT = Convert.ToDecimal(string.Format("{0:0.00}", Debitvalue)); ``` I have to get only two decimal places but by using this code I am getting 1156.54...
- Modified
- 5 Feb at 19:43
Command-line svn for Windows?
Is there a command-line based version of `svn` for Windows? I know I can get TortoiseSVN, but that just doesn't work for me.
- Modified
- 18 Aug at 11:27
Regular expression search replace in Sublime Text 2
I'm looking to do search replace with regular expressions in Sublime Text 2. The [documentation on this](http://docs.sublimetext.info/en/latest/search_and_replace/search_and_replace_overview.html#regu...
- Modified
- 25 May at 15:33
IOPub data rate exceeded in Jupyter notebook (when viewing image)
I want to view an image in Jupyter notebook. It's a 9.9MB .png file. ``` from IPython.display import Image Image(filename='path_to_image/image.png') ``` I get the below error: ``` IOPub data rate ...
- Modified
- 1 Nov at 01:44
CSS table td width - fixed, not flexible
I have a table and I want to set a fixed width of 30px on the td's. the problem is that when the text in the td is too long, the td is stretched out wider than 30px. `Overflow:hidden` doesn't work eit...
- Modified
- 22 Jan at 22:31
Get the short Git version hash
Is there a cleaner way to get the short version hash of `HEAD` from Git? I want to see the same output as I get from: ``` git log -n 1 | head -n 1 | sed -e 's/^commit //' | head -c 8 ``` --- I...
- Modified
- 1 Apr at 08:9
Encode HTML entities in JavaScript
I am working in a CMS which allows users to enter content. The problem is that when they add symbols `®` , it may not display well in all browsers. I would like to set up a list of symbols that must b...
- Modified
- 30 Mar at 20:10
CSS center content inside div
I need to center html content inside a div class="partners" (top div with 2 images). As you can see from the image below (it floats left instead of center of the div): ![enter image description here]...