How to get correct timestamp in C#
I would like to get valid timestamp in my application so I wrote: ``` public static String GetTimestamp(DateTime value) { return value.ToString("yyyyMMddHHmmssffff"); } // ...later on in the cod...
Convert java.util.Date to java.time.LocalDate
What is the best way to convert a `java.util.Date` object to the new JDK 8/JSR-310 `java.time.LocalDate`? ``` Date input = new Date(); LocalDate date = ??? ```
RegEx: Grabbing values between quotation marks
I have a value like this: ``` "Foo Bar" "Another Value" something else ``` What regex will return the values enclosed in the quotation marks (e.g. `Foo Bar` and `Another Value`)?
- Modified
- 15 Mar at 17:32
How can I transform string to UTF-8 in C#?
I have a string that I receive from a third party app and I would like to display it correctly in any language using C# on my Windows Surface. Due to incorrect encoding, a piece of my string looks l...
- Modified
- 23 May at 12:34
Get selected option text with JavaScript
I have a dropdown list like this: ``` <select id="box1"> <option value="98">dog</option> <option value="7122">cat</option> <option value="142">bird</option> </select> ``` How can I get the actual o...
- Modified
- 10 Jun at 11:0
Show Image View from file path?
I need to show an image by using the file name only, not from the resource id. ``` ImageView imgView = new ImageView(this); imgView.setBackgroundResource(R.drawable.img1); ``` I have the image img1...
- Modified
- 5 Dec at 16:44
Expansion of variables inside single quotes in a command in Bash
I want to run a command from a which has single quotes and some other commands inside the single quotes and a variable. e.g. `repo forall -c '....$variable'` In this format, `$` is escaped and the ...
If statement for strings in python?
I am a total beginner and have been looking at [http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements](http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements) but I ca...
- Modified
- 20 Jul at 13:44
Pandas DataFrame: replace all values in a column, based on condition
I have a simple DataFrame like the following: | | Team | First Season | Total Games | | | ---- | ------------ | ----------- | | 0 | Dallas Cowboys | 1960 | 894 | | 1 | Chicago Bears | 1920 | 135...
How to print the array?
``` int main() { int my array[3][3] = 10, 23, 42, 1, 654, 0, 40652, 22, 0 }; printf("%d\n", my_array[3][3]); return 0; } ``` I am not able to get the array to prin...
- Modified
- 15 Mar at 20:30
How to Get the Current URL Inside @if Statement (Blade) in Laravel 4?
I am using Laravel 4. I would like to access the current URL inside an `@if` condition in a view using the Laravel's Blade templating engine but I don't know how to do it. I know that it can be done ...
- Modified
- 18 Nov at 00:46
How can I center a div within another div?
I suppose that the `#container` will be centered within `#main_content`. However, it is not. Why isn't this working, and how can I fix it? ``` #main_content { top: 160px; left: 160px; width: 800...
How to change screen resolution of Raspberry Pi
I am using 7" TFT LCD Display with the Raspberry pi, can anyone tell how i can change the screen resolution of Raspberry Pi and what should be the resolution for the 7" TFT LCD Display.
- Modified
- 6 Apr at 07:39
How to check date of last change in stored procedure or function in SQL server
I need to check when function was changed last time. I know how to check creation date (it is in function properties window in SQL Server Management Studio). I found that in SQL Server 2000 it wasn't ...
- Modified
- 23 May at 12:26
AngularJS ng-style with a conditional expression
I am handling my issue like this: ``` ng-style="{ width: getTheValue() }" ``` But to avoid having this function on the controller side, I would much prefer to do something like this: ``` ng-style=...
- Modified
- 19 Jun at 02:39
How to store Node.js deployment settings/configuration files?
I have been working on a few Node apps, and I've been looking for a good pattern of storing deployment-related settings. In the Django world (where I come from), the common practise would be to have a...
- Modified
- 3 May at 12:9
Timeout on a function call
I'm calling a function in Python which I know may stall and force me to restart the script. How do I call the function or what do I wrap it in so that if it takes longer than 5 seconds the script ca...
- Modified
- 23 May at 20:52
How should I write a Windows path in a Python string literal?
What is the best way to represent a Windows directory, for example `"C:\meshes\as"`? I have been trying to modify a script but it never works because I can't seem to get the directory right, I assume ...
- Modified
- 13 Jan at 08:24
Measure execution time for a Java method
How do I calculate the time taken for the execution of a method in Java?
- Modified
- 5 Jan at 19:46
How do I get textual contents from BLOB in Oracle SQL
I am trying to see from an SQL console what is inside an Oracle BLOB. I know it contains a somewhat large body of text and I want to just see the text, but the following query only indicates that the...
Convert file: Uri to File in Android
What is the easiest way to convert from an [android.net.Uri](https://developer.android.com/reference/android/net/Uri) object which holds a `file:` type to a [java.io.File](https://developer.android.co...
Full examples of using pySerial package
Can someone please show me a full python sample code that uses , i have the package and am wondering how to send the AT commands and read them back!
Convert object array to hash map, indexed by an attribute value of the Object
# Use Case The use case is to convert an array of objects into a hash map based on string or function provided to evaluate and use as the key in the hash map and value as an object itself. A common...
- Modified
- 1 Oct at 04:51
How to select unique records by SQL
When I perform `SELECT * FROM table` I got results like below: ``` 1 item1 data1 2 item1 data2 3 item2 data3 4 item3 data4 ``` As you can see, there are dup records from column2 (item1 are dupped). S...
Convert generic List/Enumerable to DataTable?
I have few methods that returns different Generic Lists. Exists in .net any class static method or whatever to convert any list into a datatable? The only thing that i can imagine is use Reflection ...