How to Safely Force Shutdown of Mac

How to Safely Force Shutdown of Mac

What I wantI'm developing a little app to force me to only work at certain times of day - I need something to force me to stop working in the evenings so I can be more effective in the day.The option within OS X to shut down my machine at a

check if a program is installed

check if a program is installed

I'm writing a function that uses pandoc in R through the command line. How can I use R to check if pandoc installed (I also assume it would have to be on the path which may be an issue for windows users)? 1:This suggestion is based enti

Delphi XE4 Indy compatibility issue between TBytes and TidBytes

Delphi XE4 Indy compatibility issue between TBytes and TidBytes

Today I try to compile my XE3 project in XE4. First problem that I face is with Indy's FTCPClient.Socket.ReadBytes() method.Before it was accepting TBytes type, now it insists on TidBytes.Definitions:TIdBytes = array of Byte;TBytes, Im not

Python “import” scope

Python “import” scope

I am dealing with some python code automatically generated for me. I want to avoid manually editing these python files & hence this question/issue:foo.py:def foo(): print "foo"boo.py:def boo(): foo.foo() # bar.py:import fooimport boode

Growable data structure in MATLAB

Growable data structure in MATLAB

I need to create a queue in matlab that holds structs which are very large. I don't know how large this queue will get. Matlab doesn't have linked lists, and I'm worried that repeated allocation and copying is really going to slow down this

Runnable jar with jvm args

Runnable jar with jvm args

I was trying to create a runnable jar file using Eclipse.The problem is that the vm parameters I have added to the run configuration in the Eclipse were not saved in any way.I know I can create a batch file that will run the jar with the ne

c# multiple inheritance

c# multiple inheritance

I would like to achieve this in C#(Pseudocode)class A;class B : A;class C : A, B;...A ac = (A)c;...B bc = (B)c;Is this possible? 1:You do not need multiple inheritance in this particular case: If class C inherits only from B, any instanc

Line continuation of strings in Fortran

Line continuation of strings in Fortran

I just started using gfortran 4.7.2 in Fedora 17. When I tried to use the following a test code, I am not getting output: PROGRAM test_ampersand IMPLICIT NONE PRINT *, 'I am a new learner of' & 'fortran' END PROGRAM test_amp

How can I call a 32-bit DLL from 64-bit code?

How can I call a 32-bit DLL from 64-bit code?

I have some 32-bit DLLs that don't have matched 64-bit DLLs. How can I invoke these DLLs from a 64-bit application written in Delphi XE2? 1:No, you cannot directly do this. A 64 bit process can only execute 64 bit code, and a 32 bit pro

Are /regex/ Literals always RegExp Objects?

Are /regex/ Literals always RegExp Objects?

Basically, my question is about how Javascript handles regex literals.Contrasting with number, string and boolean where literals are primitive data types and corresponding Number, String and Boolean objects exist with seamless type conversi

python: convert numerical data in pandas dataframe to floats in the presence of strings

python: convert numerical data in pandas dataframe to floats in the presence of strings

I've got a pandas dataframe with a column 'cap'. This column mostly consists of floats but has a few strings in it, for instance at index 2.df = cap0 5.21 na2 2.23 7.64 7.55 3.0...I import my data from a csv file like s

C printf using %d and %f

C printf using %d and %f

I was working on this program and I noticed that using %f for a double and %d for a float gives me something completely different. Anybody knows why this happens?int main (){ float a = 1F; double b = 1; printf("float =%d\ndouble= %f", a, b)

How to dispose objects having asynchronous methods called?

How to dispose objects having asynchronous methods called?

I have this object PreloadClient which implements IDisposable, I want to dispose it, but after the asynchronous methods finish their call... which is not happening private void Preload(SlideHandler slide) { using(PreloadClient

Failed to resolve target intent service, Error while delivering the message: ServiceIntent not found

Failed to resolve target intent service, Error while delivering the message: ServiceIntent not found

I try to make gcm work.When our server sends a push notification I got these two errors in my app's log: E/GcmReceiver(8049): Failed to resolve target intent service, skipping classname enforcement E/GcmReceiver(8049): Error while deliver

Phonegap camera android kills cordova

Phonegap camera android kills cordova

I'm working on several Phonegap projects. In some of them I'm using the camera functions.I'm puzzling with this issue (from the Phonegap documentation): Android Quirks Android uses intents to launch the camera activity on the device to

Why do integers not conform to the AnyObject protocol?

Why do integers not conform to the AnyObject protocol?

Why can I have an [AnyObject] array and put a bunch of different sized types in it ...var a = [AnyObject]()a.append(Int(1))a.append(Float64(3.14))a.append(Bool(true))... except for Int32 and Int64 ....a.append(Int32(1)) // err: type 'Int32'

Bundler - load multiple Gemfiles

Bundler - load multiple Gemfiles

Just curious if there is an easy way to load more than one Gemfile from a Ruby application.If you're (quite sensibly) wondering why I would do such a crazy thing...The situation is that I have one master server (that has its own requirement

Are Python 2.5 .pyc files compatible with Python 2.6 .pyc files?

Are Python 2.5 .pyc files compatible with Python 2.6 .pyc files?

A while ago I had to upgrade some servers from Python 2.4 to Python 2.5. I found that .pyc files created under Python 2.4 would crash when Python 2.5 tried to run them.Will this happen again when I upgrade from 2.5 to 2.6?EDIT: Here is a bi

Multiple return types php 7

Multiple return types php 7

I have some methods that can return one of two return types - (I'm using a framework utilizing MCV so refactoring these few functions in particular is not appealing)Is it possible to declare the return type returning one or the other and fa

Will not closing a stringwriter cause a leak?

Will not closing a stringwriter cause a leak?

I realize that in java the GC will eventually cleanup objects, but I'm asking if it is bad practice to not close your string writer, currently I am doing this: private static String processTemplate(final Template template, final Map root) {

What does the following Oracle error mean: invalid column index

What does the following Oracle error mean: invalid column index

I got the following error while testing some code: SQLException: Invalid column indexWhat exactly does that mean? Is there an online document explaining what all the Oracle error codes and statements? 1:If that's a SQLException thrown

count characters, words and lines in file

count characters, words and lines in file

This should count number of lines, words and characters into file.But it doesn't work. From output it shows only 0.Code: public static void main(String[] args) throws IOException { int ch; boolean prev = true; //counters

Android: sample to show WebView with scrolling

Android: sample to show WebView with scrolling

This should be pretty basic, I just can't find out how. I have a webView that shows a page to is too long to show all at once. Right now, it shows the scroll bar, but it doesn't really scroll. It just kinda wiggles a little bit just enou

.NET autogenerated web-service client: How do I avoid requesting schemas from w3.org?

.NET autogenerated web-service client: How do I avoid requesting schemas from w3.org?

I have a .NET web-service client that has been autogenerated from a wsdl-file using the wsdl.exe tool.When I first instantiate the generated class, it begins to request a bunch of documents from w3.org and others. The first one being http:/

Deserializing JSON to non-static nested classes using Gson

Deserializing JSON to non-static nested classes using Gson

According to this Gson can deserialize to inner classes. I have the next fragment of JSON string: ..."coordinates": { "coordinates": [106.80552006,-6.22016938], "type": "Point",}...I'm using the next class:public class Tweet { publ