DateTime of next 3am occurrence

DateTime of next 3am occurrence

I'm sure this is very easy, but I've got a sudden mental block.I'm trying to get a DateTime object for the next occurence of 3am. For example, if DateTime.Now is 16/july/2009 : 12:04pm - the next occurance of 3am would be 17/july/2009 : 03:

getting number of visible nodes in PySpark

getting number of visible nodes in PySpark

I'm running some operations in PySpark, and recently increased the number of nodes in my configuration (which is on Amazon EMR). However, even though I tripled the number of nodes (from 4 to 12), performance seems not to have changed. As

Undo a git pull

Undo a git pull

The questions I've seen for undoing a git pull a slightly different to mine. This is what I've done:There is a project in directory A (not a repo). I initialized a repository in it, added the files, but did not commit anything. Then I pulle

std::array with aggregate initialization on g++ generates huge code

std::array with aggregate initialization on g++ generates huge code

On g++ 4.9.2 and 5.3.1, this code takes several seconds to compile and produces a 52,776 byte executable:#include #include int main(){ constexpr std::size_t size = 4096; struct S { float f; S() : f(0.0f) {} }; s

Rails - Calling CoffeeScript from JavaScript

Rails - Calling CoffeeScript from JavaScript

I'm using Rails 3.1 with CoffeeScript and have run into a snag. How do I call a function from a .js.erb file that is located in a .js.coffee file?Say the function in .js.coffee is the following:myName = -> "Bob"I would think I could just

iOS Objective-C How to get 2 decimal rounded float value?

iOS Objective-C How to get 2 decimal rounded float value?

I have afloat a = 1412.244019;and I need a to be rounded to the nearest second decimal like 1412.24000000. I understand that if i want to present a with only two decimals i use %.2f, but that is NOT the case. I need the new a for mathematic

Distributing (and updating) an enterprise Android application that is to be used in-house only [clos

Distributing (and updating) an enterprise Android application that is to be used in-house only [clos

I'm building an Android application for an enterprise customer that will be used in-house (and not sold). Though we have additional auth measures, I'd rather not deploy the application on the marketplace.I was just wondering if anybody had

Character with encoding UTF8 has no equivalent in WIN1252

Character with encoding UTF8 has no equivalent in WIN1252

I am getting the following exception:Caused by: org.postgresql.util.PSQLException: ERROR: character 0xefbfbd of encoding "UTF8" has no equivalent in "WIN1252"Is there a way to eradicate such characters, either via SQL or programmatically? (

How can I do string concatenation, or string replacement in YAML?

How can I do string concatenation, or string replacement in YAML?

I have this:user_dir: /home/useruser_pics: /home/user/picsHow could I use the user_dir for user_pics? If I have to specify other properties like this, it would not be very DRY. 1:You can use a repeated node, like this:user_dir: &user_hom

Difference between Service and Broadcast receivers in android

Difference between Service and Broadcast receivers in android

I want to know the difference between services and broadcast receivers, can anyone point out an example that can be observed on android mobile devices.Thanks 1:Service: If you want to do something in background , this will be running alw

Phpstorm Git file colors

Phpstorm Git file colors

My PhpStorm is coloring changed files when Project is under Git . Where can I change color? Dark blue is not good readable.Thanks 1:File status colors can be changed at Settings | Editor | Colors & Fonts | File Status 2:To be more spe

Java out.println() how is this possible?

Java out.println() how is this possible?

I've seen some code such as:out.println("print something");I tried import java.lang.System;but it's not working. How do you use out.println() ? 1:static imports do the trick:import static java.lang.System.out;or alternatively import ever

Pointer / Array syntax (char **p, *p[n]) in C/C++

Pointer / Array syntax (char **p, *p[n]) in C/C++

For pointers, I'm getting confused with declarations and function parameters on when to use char ** or char * or *array[n], etc. Like if a function takes a (*array[n]) parameter, do I pass it a **type? I try using the Right-Left rule and

water effect in cocos2d

water effect in cocos2d

I'd like to have a water effect on a background layer in my app. The effect doesn't need to react to touch or anything - it just needs to wave an image a little bit.CCWaves3D seem ok, but leave have nasty black artifacts around the edges wh

How to use iPhone Camera as Bar Code Scanner?

How to use iPhone Camera as Bar Code Scanner?

How can I use the iPhone camera to scan bar codes? I have gone through many of the links but I'm not able to figure out a proper way to implement this. 1:I have used the ZBar SDK successfully in a few projects, and it is quite easy to g

subclass.prototype = new superclass() vs. subclass = new superclass()

subclass.prototype = new superclass() vs. subclass = new superclass()

I've been instantiating subclasses in javascript usingobject = new class ()but I notice some people instantiate usingobject.prototype = new class ()Question: What's the difference? To me it seems like the latter is respecting the inheritanc

Multi-core usage, threads, thread-pools

Multi-core usage, threads, thread-pools

I have some questions about multi-threaded programming and multi-core usage.In particular I'm wondering how the operating system and/or framework (this is .NET) deals with cores that are heavily used.Here's my questions regarding threads:Wh

Microphone access in Python

Microphone access in Python

Can I access a users microphone in Python?Sorry I forgot not everyone is a mind reader:Windows at minimum XP but Vista support would be VERY good. 1:Best way to go about it would be to use the ctypes library and use WinMM from that. mix

How to install .NET 4.5 with a WiX bundle?

How to install .NET 4.5 with a WiX bundle?

I need to include Microsoft .NET 4.5 as a prerequisite with my installation bundle, and I want it as automatic as possible. However, .NET should not be removed when unistalling. I think I have read just about everything on how to use Detect

Android simulate fast swipe

Android simulate fast swipe

I am doing a generic automation script.I need to send complex swipe events to the android screen without specifically having access to the focused application(s)Best way I figured so far is to use adb, create a file with sendevent commands,

Best way of storing user settings in MySQL?

Best way of storing user settings in MySQL?

I was just wondering what would be the best way of storing user-specific settings for my web applications? Just preferences users may have. I've thought of two options:Users table - I'll have a table for my users. Creating a column called "

Open Street Map working offline android

Open Street Map working offline android

I am a newbie to Open Street Map. I made some research and found that we can download and store the map into a folder. But i didn't find any tutorial or sample that provides offline Open Street Map. Can someone provide a step by step tutori

“Mem Usage” higher than “VM Size” in WinXP Task Manager

“Mem Usage” higher than “VM Size” in WinXP Task Manager

In my Windows XP Task Manager, some processes display a higher value in the Mem Usage column than the VMSize. My Firefox instance, for example shows 111544 K as mem usage and 100576 K as VMSize. According to the help file of Task Manager Me

What is angle brackets for argument values, and what is it used for?

What is angle brackets for argument values, and what is it used for?

I am used to angle brackets being used to specify a type, as a parameter:vector vecOfInts ;But in rapidjson, there is code like this:document.Parse(json) ;The document.Parse method's signature is:template GenericDocument& Parse(const Ch* st

Resource for learning Java generics? [closed]

Resource for learning Java generics? [closed]

I'm clearly in need of improving my knowledge in this Java field, or I'm doomed to produce "look the same but not exactly" code.I'm already have the bases... but I'm looking for a training / tuturial oriented only to this. Thanks 1:The b