runtime

Advice on how to catch “attempt to insert nil object” from a device needed

扶醉桌前 提交于 2020-01-01 15:11:10
问题 Here is a situation: Hockeyapp and testflight every now and then complain about me "attempting to insert nil object" in mutable dictionaries/arrays. I know the right thing is to check for nil all the time, and I do when it makes sense.. Our testers can not catch those crashes, but AppStore users obviously can. My guess is that sometimes server returns NSNulls when it should not. So not to insert checks for nil everywhere in the huge project my idea was to create a separate target for the

Advice on how to catch “attempt to insert nil object” from a device needed

拜拜、爱过 提交于 2020-01-01 15:11:06
问题 Here is a situation: Hockeyapp and testflight every now and then complain about me "attempting to insert nil object" in mutable dictionaries/arrays. I know the right thing is to check for nil all the time, and I do when it makes sense.. Our testers can not catch those crashes, but AppStore users obviously can. My guess is that sometimes server returns NSNulls when it should not. So not to insert checks for nil everywhere in the huge project my idea was to create a separate target for the

Java - Run Excel using runtime.getRuntime().exec

大兔子大兔子 提交于 2020-01-01 15:03:35
问题 try { Runtime.getRuntime().exec("excel C:\\file.xls"); } catch (IOException ex) { System.out.println(ex); } Doesn't work. I have to put the full path of excel.exe in order to work. How can I make it generic (For any Excel Folders/Versions)? When I run the same line from OS with Windows Run (Start --> Run) it works. Is there a code in Java to simulate Windows' Run command? 回答1: Why don't you try with the Desktop class (api doc here) introduced in JDK6 that has the method public void open(File

Java 9 ServiceLoader runtime module loading and replacement

不羁岁月 提交于 2020-01-01 10:53:28
问题 I just read about Java 9 module system and I'd like to ask about ServiceLoader. Is there any way how to add service implementation when the application is already started? How about removing some service implementation? Use case: I will have some application that calculates something. The calculation algorithm will be defined in some service(Java 9 module). Are there any steps that can be done to replace this algorithm without stopping the application? When will I replace the jars is it just

Java 9 ServiceLoader runtime module loading and replacement

不打扰是莪最后的温柔 提交于 2020-01-01 10:51:14
问题 I just read about Java 9 module system and I'd like to ask about ServiceLoader. Is there any way how to add service implementation when the application is already started? How about removing some service implementation? Use case: I will have some application that calculates something. The calculation algorithm will be defined in some service(Java 9 module). Are there any steps that can be done to replace this algorithm without stopping the application? When will I replace the jars is it just

Correct way to distribute VC++ runtime files

久未见 提交于 2020-01-01 09:21:29
问题 I have an MFC application which I am trying to package for deployment. It seems to depend on the files 'msvcr90.dll', 'msvcp90.dll' and 'mfc90.dll'. What is the correct way to distribute these files? I can't use merge modules as my installer doesn't support them. I know I can run VCRedist_x86.exe, but I don't want to do this for various reasons. As far as I can see my only alternative is to install the files as Private Side-by-Side assemblies. Is this correct? According to http://msdn

How to change language at runtime without layout troubles

孤街醉人 提交于 2020-01-01 08:37:11
问题 I have a winforms application that the users must be able to change the language at runtime. To generalize the switch and avoid having to hard code control names I tried the following extension: internal static void SetLanguage(this Form form, CultureInfo lang) { ComponentResourceManager resources = new ComponentResourceManager(form.GetType()); ApplyResourceToControl(resources, form, lang); resources.ApplyResources(form, "$this", lang); } private static void ApplyResourceToControl

Generating Enums Dynamically

主宰稳场 提交于 2020-01-01 08:03:13
问题 Let's say I have a file whose format is basic XML, like so: <?xml version="1.0"?> <enum-set> <enum> <name>SomeEnum</name> <values> <value> <name>SOMEVALUE</name> <displayText>This is some value</displayText> </value> ... more values ... </values> </enum> ... more enums ... </enum-set> and I wanted to turn SomeEnum into something like this at runtime: public enum SomeEnum implements HasDisplayText { SOMEVALUE("This is some value"), ... more values ...; private String displayText; SomeEnum

How do I create a function at runtime in Objective-C

末鹿安然 提交于 2020-01-01 07:08:11
问题 So it's late here, and my google skills seem to be failing me. I've found some great responses on SO before (time and time again), I thought you guys could help. I have a neural network I'm trying to run in native objective-c. It works, but it's too slow. These networks are not recurrent. Each network I run about 20,000 times ( 128x80 times, or around that). The problem is these networks really just boil down to math functions (each network is a 4 dimensional function, taking x,y,dist(x,y)

Allocating memory for 2d matrix using 1 malloc call

帅比萌擦擦* 提交于 2020-01-01 03:45:06
问题 We can allocate memory for 2d matrix using 1 malloc call as int (*a)[5]; int i,j; a=malloc(sizeof(int*) * 5); //allocating 5 pointers and each pointer points to an array of 5 ints How can we free this memory allocated successfully? Using free(a) gives run-time error Using for(i=0;i<5;i++) free(a[i]); free(a); This also gives run-time error 回答1: Edit: THE WHOLE STORY. Previously I ignored THREE other ways to allocate 2d arrays. Dynamic 2d array method 1: This one works if you know the the