native

java修饰符详解

ε祈祈猫儿з 提交于 2020-01-13 11:46:49
Java语言定义了public、protected、private、abstract、static和final这6常用修饰 词外还定义了5个不太常用的修饰词,下面是对这11个Java修饰词的介绍: 1.public 使用对象:类、接口、成员 介绍:无论它所处在的包定义在哪,该类(接口、成员)都是可访问的 2.private 使用对象:成员 介绍:成员只可以在定义它的类中被访问 3.static 使用对象:类、方法、字段、初始化函数 介绍:成名为static的内部类是一个顶级类,它和包含类的成员是不相关的。静态方法 是类方法, 是被指向到所属的类而不是类的实例。静态字段是类字段,无论该字段所在的类创建了 多少实例,该字 段只存在一个实例被指向到所属的类而不是类的实例。初始化函数是在装载类时执行 的,而不是在创建 实例时执行的。 4.final 使用对象:类、方法、字段、变量 介绍:被定义成final的类不允许出现子类,不能被覆盖(不应用于动态查询),字段值 不允许被 修改。 5.abstract 使用对象:类、接口、方法 介绍:类中包括没有实现的方法,不能被实例化。如果是一个abstract方法,则方法体 为空,该方 法的实现在子类中被定义,并且包含一个abstract方法的类必须是一个abstract类 6.protected 使用对象:成员 介绍:成员只能在定义它的包中被访问

How to P/Invoke to a native dll from Metro?

别来无恙 提交于 2020-01-13 09:36:26
问题 I've got a library consisting of two parts - One .net assembly that P/Invokes to a native 3rd party dll. In desktop mode this works just fine: However, when referencing the assembly from a Metro style app and running it, it throws a System.DllNotFoundException on the P/Invoke complaining that "Unable to load DLL 'library': The specified module could not be found." The native dll does not do anything special but only creates out-going TCP/IP connections to a server. The system cannot know this

Hook windows logon/logoff events

Deadly 提交于 2020-01-13 07:22:08
问题 I am having a service which would be running at SYSTEM level. Now, i want to track the logged on user in it. Earlier i was trying to get the logged in user name from GetUserName api but in my case it returns "SYSTEM" every time. Is there anyway to get logged on username in my case? or is there any hook that i can install so that i may get which user logged on? P.S: I am mainly working in Delphi 2007 but these question are specific to the Win32 API. 回答1: I am unfamiliar with Delphi's

Compiling java source code to native exe

此生再无相见时 提交于 2020-01-13 05:11:24
问题 Is it possible to compile java source code into native exe like C++? Like C++ all headers files are included during compilation, all java library files that are required should be attached in that exe, and this exe should not be a bytecode but native exe instead and run without jvm. So all I want to know is something like.. if I can replace all C++ syntax with Java syntax and compile to an exe file like one created by C++ compiler which run directly. Note: I am not talking about packers that

Compiling java source code to native exe

痞子三分冷 提交于 2020-01-13 05:11:05
问题 Is it possible to compile java source code into native exe like C++? Like C++ all headers files are included during compilation, all java library files that are required should be attached in that exe, and this exe should not be a bytecode but native exe instead and run without jvm. So all I want to know is something like.. if I can replace all C++ syntax with Java syntax and compile to an exe file like one created by C++ compiler which run directly. Note: I am not talking about packers that

How would a DOM-less,statically typed, ahead-of-time-compiled javascript code compare to native code performance-wise?

放肆的年华 提交于 2020-01-13 03:59:10
问题 The traditional answer to "why is Javascript slower than native code?" is: "Because it's interpreted". The problem with this claim is that interpretation is not a quality of the language itself. As a matter of fact, nowadays most Javascript code is being JITed, still, this isn't even close to native speed. What if we remove the interpretation factor from the equation and make Javascript AOT compiled? Will it then match the performance of native code? If yes, why isn't this widely done over

Native code calling JS in Android webapps

穿精又带淫゛_ 提交于 2020-01-11 17:03:53
问题 I am writing an Android "web" app (I will not upload the APP to the web, but set the HTML+JS inside the application resources). That means, the GUI will be HTML5, and I will use another "native" thread to read from the microphone and hopefully send the "parsed text" to the HTML5/JS code. Is this possible? In the Android code, I see how can I call native code from JS (and I want the opposite). http://developer.android.com/guide/webapps/webview.html 回答1: Yes, Android rocks at this actually. I'm

JavaScript Object (JSON) to URL String Format

与世无争的帅哥 提交于 2020-01-10 12:38:31
问题 I've got a JSON object that looks something like { "version" : "22", "who: : "234234234234" } And I need it in a string ready to be sent as a raw http body request. So i need it to look like version=22&who=234324324324 But It needs to work, for an infinite number of paramaters, at the moment I've got app.jsonToRaw = function(object) { var str = ""; for (var index in object) str = str + index + "=" + object[index] + "&"; return str.substring(0, str.length - 1); }; However there must be a

Conversion in .net: Native Utf-8 <-> Managed String

半城伤御伤魂 提交于 2020-01-10 10:17:49
问题 I created those two methods to convert Native utf-8 strings (char*) into managed string and vice versa. The following code does the job: public IntPtr NativeUtf8FromString(string managedString) { byte[] buffer = Encoding.UTF8.GetBytes(managedString); // not null terminated Array.Resize(ref buffer, buffer.Length + 1); buffer[buffer.Length - 1] = 0; // terminating 0 IntPtr nativeUtf8 = Marshal.AllocHGlobal(buffer.Length); Marshal.Copy(buffer, 0, nativeUtf8, buffer.Length); return nativeUtf8; }

Conversion in .net: Native Utf-8 <-> Managed String

倖福魔咒の 提交于 2020-01-10 10:17:08
问题 I created those two methods to convert Native utf-8 strings (char*) into managed string and vice versa. The following code does the job: public IntPtr NativeUtf8FromString(string managedString) { byte[] buffer = Encoding.UTF8.GetBytes(managedString); // not null terminated Array.Resize(ref buffer, buffer.Length + 1); buffer[buffer.Length - 1] = 0; // terminating 0 IntPtr nativeUtf8 = Marshal.AllocHGlobal(buffer.Length); Marshal.Copy(buffer, 0, nativeUtf8, buffer.Length); return nativeUtf8; }