runtime

CameraCaptureTask missing in Window Phone 8.1 runtime???

自作多情 提交于 2019-12-11 09:35:55
问题 How to show camera app and capture when Chooser tab completed. I used CameraCaptureTask in window phone. http://msdn.microsoft.com/en-us/library/windows/apps/hh394006%28v=vs.105%29.aspx. But it missing in window phone 8.1 runtime. 回答1: In Windows Phone 8.1 XAML apps you can use the FileOpenPicker to select am image either from the picture library, or from the camera. Make sure you have added ".jpg" to the picker file types, otherwise the camera button may not show. Here is sample code:

How do I detect, at runtime, that a framework has been loaded?

余生长醉 提交于 2019-12-11 09:26:23
问题 I'm building a static library to distribute to other folks to use in iOS apps, wherein I'd like to take advantage of of frameworks only if they have been included in the app by the users of my library. I've figured out how to compile the library so that it does not itself include any frameworks, but as soon as I try to use it in an app, it fails, because the library references frameworks that don't exist. I'd rather not force my clients to load frameworks they don't need. Weak-linking

what's the runtime equivalent of c# 'bracketed' type cast

﹥>﹥吖頭↗ 提交于 2019-12-11 09:16:44
问题 suppose I have an enum [Flags] public enum E { zero = 0, one = 1 } then I can write E e; object o = 1; e = (E) o; and it will work. BUT if I try to do that at runtime, like (o as IConvertible).ToType(typeof(E), null) it will throw InvalidCastException. So, is there something that I can invoke at runtime, and it will convert from int32 to enum, in the same way as if I wrote a cast as above? 回答1: object o = 1; object z = Enum.ToObject(typeof(E), o); 回答2: How does the variable look like that you

Java: Kill all subprocesses on unix

对着背影说爱祢 提交于 2019-12-11 09:14:19
问题 I got an application written in java which runs on Unix and starts two sub-processes (via Runtime.getRuntime().exec() ) on startup. If the application crashed for some reason, the sub processes won't get killed. Now, I added a shutdown hook which gets fired on every crash, ok so far. But I'd like to send a SIGTERM signal (or at least SIGINT) on UNIX console for every sub process of the application. I should be able to find their process IDs via ps , but I did not make it to extract the PID

add __strong ivar at runtime under ARC

北城余情 提交于 2019-12-11 08:59:38
问题 A normal ivar declared in @interface is __strong default. @interface XLPerson : NSObject { NSString *name; // __strong default } @end Now, I create above class at runtime: Class XLPerson = objc_allocateClassPair([NSObject class], "XLPerson", 0); size_t size = sizeof(NSString*); class_addIvar(XLPerson, "name", size, log2(align), @encode(NSString*))); objc_registerClass(XLPerson); However, the ivar named "name" isn't a __strong ivar. While I using object_setIvar() , the Ivar can't hold the

How to retrieve the modified value of an environment variable (which is modified externally) in a Java program?

梦想与她 提交于 2019-12-11 08:23:44
问题 Is it possible to retrieve the modified value of an environment variable in a Java program? I tried using System.getenv() . But the new value is not reflected in the program. The scenario is this: The program retrieves the value of an environment variable. The value of this variable is changed externally, while the program is still running. (It could be even manual process, like for eg, in Windows, the user changes the value from Advanced tab in My Computer->properties) The program retrieves

How to get the value that is passed to Runtime.getRuntime.exit(value) in a JUnit test case

邮差的信 提交于 2019-12-11 08:13:10
问题 I have to write a Test case in JUnit for a Class lets call it C1 which internally calls Runtime.getRuntime.exit(somevalue) . The class C1 has a main method which accepts some arguments and the creates a CommandLine and then depending on the passed arguments does the specific tasks. Now all tasks after executing call a Runtime.getRuntime.exit(somevalue) . The somevalue defines whether the task was executed successfully (means somevalue is 0) or had errors (means somevalue is 1). In the JUnit

Powershell open window (from Java.Runtime.exec)

风流意气都作罢 提交于 2019-12-11 07:43:04
问题 simple Question: i want to call the powershell with some commands from java. But the Problem is that no Window appears. i want that the window with the Powershell appears. String[] str= { "powershell.exe", "-NoExit", "-Command", "echo", "hallo" } [...] Runtime.getRuntime().exec(str); [...] 回答1: I was able to do it like this: String[] str= { "cmd", "/c", "start", "powershell.exe", "-NoExit", "-Command", "echo", "hallo" }; 来源: https://stackoverflow.com/questions/25530774/powershell-open-window

Will the number of OS threads spawned by go process never decrease?

ぃ、小莉子 提交于 2019-12-11 07:38:30
问题 Consider a golang program running on a system with GOMAXPROCS value 10. Due to blocking system calls, OS spawns 30 more threads resulting in 40 OS threads attached to the process. After all the blocked system calls returns, then will the process still be having 40 OS threads? If yes, then can we conclude that the number of OS threads mapped to a golang process can grow but never comes down? 回答1: Yes, currently threads spawned due to blocked goroutines are not stopped. There's a discussion

Make instance of class in java at runtime

帅比萌擦擦* 提交于 2019-12-11 07:29:15
问题 In my program I generate classes dynamically but when I try: String[] args = {"-d","D:\\path\\build\\classes","-s","D:\\path\\src","http://services.aonaware.com/DictService/DictService.asmx?WSDL"}; WsImport.doMain(args); URL url = new URL("file:D:/path/build/classes/com/aonaware/services/webservices/"); URLClassLoader urlClassLoader = new URLClassLoader(new URL[]{url}); Class service = Class.forName("com.MyClass",true,urlClassLoader ); I recieve java.lang.ClassNotFoundException If I run one