Questions

Display current time in 12 hour format with AM/PM

Currently the time displayed as However The current code is as below ``` private static final int FOR_HOURS = 3600000; private static final int FOR_MIN = 60000; public String getTime(final Model...

5 Mar at 05:17

Create a table without a header in Markdown

Is it possible to create a table without a header in Markdown? The HTML would look like this: ``` <table> <tr> <td>Key 1</td> <td>Value 1</td> </tr> <tr> <td>Key 2</td> <td>Value 2</...

1 Sep at 12:32

Git copy file preserving history

I have a somewhat confusing question in Git. Lets say, I have a file `dir1/A.txt` committed and git preserves a history of commits Now I need to copy the file into `dir2/A.txt` (not move, but copy). I...

1 Aug at 08:4

Dependent DLL is not getting copied to the build output folder in Visual Studio

I have a visual studio solution. I have many projects in the solution. There is one main project which acts as the start up and uses other projects. There is one project say "ProjectX". Its reference ...

What is the best way to implement a "timer"?

What is the best way to implement a timer? A code sample would be great! For this question, "best" is defined as most reliable (least number of misfires) and precise. If I specify an interval of 15 se...

23 May at 10:31

How can I stop the browser back button using JavaScript?

I am doing an online quiz application in PHP. I want to restrict the user from going back in an exam. I have tried the following script, but it stops my timer. What should I do? The timer is stored in...

14 Dec at 22:53

How to properly seed random number generator

I am trying to generate a random string in Go and here is the code I have written so far: ``` package main import ( "bytes" "fmt" "math/rand" "time" ) func main() { fmt.Println(...

21 Nov at 08:48

Jackson - Deserialize using generic class

I have a json string, which I should deSerialize to the following class ``` class Data <T> { int found; Class<T> hits } ``` How do I do it? This is the usual way ``` mapper.readValue(jsonS...

14 Feb at 20:57

Force LF eol in git repo and working copy

I have a git repository hosted on github. Many of the files were initially developed on Windows, and I wasn't too careful about line endings. When I performed the initial commit, I also didn't have an...

2 Apr at 13:2

sed fails with "unknown option to `s'" error

I'm trying to use ``` sed -i -e "s/.*seb.*/ \"$ftp_login_template\"/" $ftp_dir ``` however I get this error: ``` sed: -e expression #1, char 34: unknown option to `s' ``` I don't understand ...

8 Jul at 17:30

Prompt for user input in PowerShell

I want to prompt the user for a series of inputs, including a password and a filename. I have an example of using `host.ui.prompt`, which seems sensible, but I can't understand the return. Is there ...

9 Mar at 19:29

SSL handshake alert: unrecognized_name error since upgrade to Java 1.7.0

I upgraded from Java 1.6 to Java 1.7 today. Since then an error occur when I try to establish a connection to my webserver over SSL: ``` javax.net.ssl.SSLProtocolException: handshake alert: unrecogn...

17 Jan at 14:17

How to get elements with multiple classes

Say I have this: ``` <div class="class1 class2"></div> ``` How do I select this `div` element? ``` document.getElementsByClassName('class1')[0].getElementsByClassName('class2')[0] ``` That does ...

18 Jul at 05:15

Is there a way to call a stored procedure with Dapper?

I am very impressed with the results of [Dapper Micro ORM](https://github.com/StackExchange/dapper-dot-net) for stackoverflow.com. I am considering it for my new project and but I have one concern abo...

12 Jun at 06:19

Storing images in SQL Server?

I have made a small demo site and on it I am storing images within a image column on the sql server. A few questions I have are... - Is this a bad idea? - Will it affect performance on my site when i...

30 Dec at 06:30

Format Float to n decimal places

I need to format a float to "n"decimal places. was trying to BigDecimal, but the return value is not correct... ``` public static float Redondear(float pNumero, int pCantidadDecimales) { // the ...

Remove an onclick listener

I have an object where the text cycles and displays status messages. When the messages change, I want the click event of the object to change to take you to the activity that the message is relating ...

4 Mar at 14:57

Rendering a template variable as HTML

I use the 'messages' interface to pass messages to user like this: ``` request.user.message_set.create(message=message) ``` I would like to include html in my `{{ message }}` variable and render it...

3 Oct at 17:11

How to include another XHTML in XHTML using JSF 2.0 Facelets?

What is the most correct way to include another XHTML page in an XHTML page? I have been trying different ways, none of them are working.

13 Apr at 11:53

Remove trailing zeros

I have some fields returned by a collection as ``` 2.4200 2.0044 2.0000 ``` I want results like ``` 2.42 2.0044 2 ``` I tried with `String.Format`, but it returns `2.0000` and setting it to `N0`...

20 Aug at 10:46

Converting NSString to NSDate (and back again)

How would I convert an `NSString` like "" (meaning 1st February 2010) into an `NSDate`? And how could I turn the `NSDate` back into a string?

16 Mar at 13:11

Pointer arithmetic for void pointer in C

When a pointer to a particular type (say `int`, `char`, `float`, ..) is incremented, its value is increased by the size of that data type. If a `void` pointer which points to data of size `x` is incre...

26 Apr at 18:21

Is there a CSS selector by class prefix?

I want to apply a CSS rule to any element whose one of the classes matches specified prefix. E.g. I want a rule that will apply to div that has class that starts with `status-` (A and C, but not B in...

22 Jun at 01:9

Creating stored procedure in SQLite

Is it somehow possible to create a stored procedure when using SQLite?

19 Feb at 11:59

How can I time a code segment for testing performance with Pythons timeit?

I've a python script which works just as it should, but I need to write the execution time. I've googled that I should use [timeit](https://docs.python.org/2/library/timeit.html) but I can't seem to g...

12 Mar at 21:46