Search Results

Search found 15353 results on 615 pages for 'native methods'.

Page 3/615 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • object / class methods serialized as well?

    - by Mat90
    I know that data members are saved to disk but I was wondering whether object's/class' methods are saved in binary format as well? Because I found some contradictionary info, for example: Ivor Horton: "Class objects contain function members as well as data members, and all the members, both data and functions, have access specifiers; therefore, to record objects in an external file, the information written to the file must contain complete specifications of all the class structures involved." and: Are methods also serialized along with the data members in .NET? Thus: are method's assembly instructions (opcodes and operands) stored to disk as well? Just like a precompiled LIB or DLL? During the DOS ages I used assembly so now and then. As far as I remember from Delphi and the following site (answer by dan04): Are methods also serialized along with the data members in .NET? sizeof(<OBJECT or CLASS>) will give the size of all data members together (no methods/procedures). Also a nice C example is given there with data and members declared in one class/struct but at runtime these methods are separate procedures acting on a struct of data. However, I think that later class/object implementations like Pascal's VMT may be different in memory.

    Read the article

  • Turning .NET executable into native executable

    - by lmsasu
    Hello all, Is there any approach to convert an application developed in .NET into a native executable (sources are included)? Installing the whole framework (up to .NET Framework 3.5 SP1) takes a lot of time - not always the computers are updated from the internet. Is it possible to call NGen in order to produce independent executables? Thanks

    Read the article

  • Building DLL via Maven with mojo-native

    - by graham.reeds
    I can build a simple dll consisting of a source file, a header file and a definition but now I am progressing beyond a simple toy dll and working towards something more complex. The DLL I am trying to compile has 2 source files, 2 headers and the dreaded stdafx pair. To compile normally you would use /Yc to compile the pch and /Yu to use it. How do you specify that with in the constraints of mojo-native's compiler options?

    Read the article

  • Building a DLL via Maven with mojo-native

    - by graham.reeds
    I can build a simple dll consisting of a source file, a header file and a definition but now I am progressing beyond a simple toy dll and working towards something more real (ie: more complex). The DLL I am trying to compile has 2 source files, 2 headers and the dreaded stdafx pair. To compile normally you would use /Yc for the pch and /Yu to use it. How do you specify that with in the constraints of mojo-native's compiler options?

    Read the article

  • Native SQL - How to set the schema and database names

    - by icelobber
    Im using Native SQL from ABAP language. The query to get data is something like this SELECT COUNT(ROWID) FROM <SCHEMANAME>.<TABLENAME>;@<DATABASENAME> INTO :localvariable I want to somehow set the schemaname and database name as default so that i do not need to use them in the SELECTs later. Then i can only use the table name in the SELECT. thanks !!

    Read the article

  • JNI problem when calling a native library that loads another native library

    - by TheEnemyOfQuality
    I've got a bit of an odd problem. I have a project in C++ that's basically a wrapper for a third party DLL like this: MyLibrary --loads DLL_A ----loads DLL_B I load DLL_A with LoadLibrary(), wrap several of its functions and generate my own DLL. I've tested this in a C++ project and a C# project. Both do everything they're supposed to do: load DLL_A, make a couple of function calls, and indirectly load DLL_B. The problem is when I build a DLL for java and make the calls through JNI. Everything runs like it should (no java.lang.UnsatisfiedLinkError), but when it comes time for DLL_A to load DLL_B it doesn't work. From debugging, the loading of DLL_B happens on a function call in DLL_A that takes a callback. When called from Java, this function call seems to fail (the function pointer is fine and the actual call goes off without a hitch), and I get an odd pop-up window saying DLL_B failed to load, and my program is left waiting for a callback that never happens. I can explicitly load DLL_B just fine (both from Java and from C++) and I've checked every possible path, path variable, and tried placing the dlls everywhere to see if it could be looking somewhere funny. I'm pretty sure it's not a path problem. Ultimately I don't know how DLL_A is loading DLL_B and I can't figure out why everything works fine in C++ and C#, but not in Java. I'm absolutely flummoxed. It could still be something specific to my setup (although I've looked as hard as I can look), but I'm throwing this scenario out there to see if anyone has run into a similar problem. -Dave

    Read the article

  • Java native methods issues with SUN JVM (jdk1.5.0_14) and multi-core CPU’s

    - by Mattias Arnersten
    We are hosting an application on SUN JVM that handles a lot of XML parsing using Jaxb. The application is parsing the XML fine using JRockit 5 but when using the SUN JVM the JVM spends a majority of it’s time on native methods such as java-lang.System.arraycopy, java.lang.String.intern and java.lang.ClassLoader.getPackage. The CPU load is approx. 60% higher when using SUN JVM compared with JRockit. Even stranger is that when we only run the application server using one core (in WMWare) the problem disappears. Has anyone experienced the same behavior? Mattias Arnersten

    Read the article

  • Load only some columns with Hibernate native SQL queries

    - by Alessandro Dionisi
    I have a table on the database and I want to load only some columns from the result set. I defined a native sql query in the hbm file: <sql-query name="query"> <return alias="r" class="RawData"/> <![CDATA[ SELECT DESCRIPTION as {r.description} FROM RAWD_RAWDATAS r WHERE r.RAWDATA_ID=? ]]> </sql-query> This query however fails with error: could not read column value from result set: RAWDATA1_14_0_; Invalid column name SQL Error: 17006, SQLState: null, because Hibernate tries to load all fields from the result set. I found also a bug in Hibernate JIRA (http://opensource.atlassian.com/projects/hibernate/browse/HHH-3035). Anyone knows how to accomplish this task with a workaround?

    Read the article

  • simulate what native object is not exist

    - by Naitro
    Here is the situation: I have checking on existing class like: ('Promise' in window) // true/false` And I wanna force return false or true on it, can I do it? Yes, I can check it by some other way, like ` window.Promise = undefined; window.Promise === undefined; Or something like this, but can I somehow delete this object or simulate something for 'in' operator? I check specification and v8 code, there is 'in' operator just call 'HasProperty' operator, which realization on c++.. I know 'hack' with faking toString/valueOf methods: obj = { toString: function(){ return 'myName'; } }, obj2 = {}; obj2[obj] = 1; // Object {myName: 1} May be I can use it in some way? But, as I send string 'Promise' I can't just fake it like this way.. may be exist some way to fake 'HasProperty'?

    Read the article

  • Protected and Private methods

    - by cabaret
    I'm reading through Beginning Ruby and I'm stuck at the part about private and protected methods. This is a newbie question, I know. I searched through SO for a bit but I couldn't manage to find a clear and newbie-friendly explanation of the difference between private and protected methods. The book gives two examples, the first one for private methods: class Person def initialize(name) set_name(name) end def name @first_name + ' ' + @last_name end private def set_name(name) first_name, last_name = name.split(/\s+/) set_first_name(first_name) set_last_name(last_name) end def set_first_name(name) @first_name = name end def set_last_name(name) @last_name = name end end In this case, if I try p = Person.new("Fred Bloggs") p.set_last_name("Smith") It will tell me that I can't use the set_last_name method, because it's private. All good till there. However, in the other example, they define an age method as protected and when I do fred = Person.new(34) chris = Person.new(25) puts chris.age_difference_with(fred) puts chris.age It gives an error: :20: protected method 'age' called for #<Person:0x1e5f28 @age=25> (NoMethodError) I honestly fail to see the difference between the private and protected methods, it sounds the same to me. Could someone provide me with a clear explanation so I'll never get confused about this again? I'll provide the code for the second example if necessary.

    Read the article

  • Running a Java program with a .dll from Adobe AIR's native process

    - by Donny
    I would like to be able to operate a scanner from my AIR application. Since there's no support for this natively, I'm trying to use the NativeProcess class to start a jar file that can run the scanner. The Java code is using the JTwain library to operate the scanner. The Java application runs fine by itself, and the AIR application can start and communicate with the Java application. The problem seems to be that any time I attempt to use a function from JTwain (which relies on the JTwain.dll), the application dies IF AIR STARTED IT. I'm not sure if there's some limit about referencing dll files from the native process or what. I've included my code below Java code- while(true) { try { System.out.println("Start"); text = in.readLine(); Source source = SourceManager.instance().getCurrentSource(); System.out.println("Java says: "+ text); } catch (IOException e) { System.err.println("Exception while reading the input. " + e); } catch (Exception e) { System.out.println("Other exception occured: " + e.toString()); } finally { } } } Air application- import mx.events.FlexEvent; private var nativeProcess:NativeProcess; private var npInfo:NativeProcessStartupInfo; private var processBuffer:ByteArray; private var bLength:int = 0; protected function windowedapplication1_applicationCompleteHandler(event:FlexEvent):void { var arg:Vector.<String> = new Vector.<String>; arg.push("-jar"); arg.push(File.applicationDirectory.resolvePath("Hello2.jar").nativePath); processBuffer = new ByteArray; npInfo = new NativeProcessStartupInfo; npInfo.executable = new File("C:/Program Files/Java/jre6/bin/javaw.exe"); npInfo.arguments = arg; nativeProcess = new NativeProcess; nativeProcess.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onStandardOutputData); nativeProcess.start(npInfo); } private function onStandardOutputData(e:ProgressEvent):void { tArea.text += nativeProcess.standardOutput.readUTFBytes(nativeProcess.standardOutput.bytesAvailable); } protected function button1_clickHandler(event:MouseEvent):void { tArea.text += 'AIR app: '+tInput.text + '\n'; nativeProcess.standardInput.writeMultiByte(tInput.text + "\n", 'utf-8'); tInput.text = ''; } protected function windowedapplication1_closeHandler(event:Event):void { nativeProcess.closeInput(); } ]]> </fx:Script> <s:Button label="Send" x="221" y="11" click="button1_clickHandler(event)"/> <s:TextInput id="tInput" x="10" y="10" width="203"/> <s:TextArea id="tArea" x="10" width="282" height="88" top="40"/> I would love some explanation about why this is dying. I've done enough testing that I know absolutely that the line that kills it is the SourceManager.instance().getCurrentSource(). I would love any suggestions. Thanks.

    Read the article

  • Action -methods vs public methods in PHP frameworks

    - by Tower
    There are plenty of PHP frameworks out there as many of you know, and I am interested in your thoughts on this: Zend Framework has so-called action controllers that must contain at least one action method, a method whose name ends in "Action". For example: public function indexAction() {} The word "Action" is important, without it you can't access the method directly via the URI. However, in some other frameworks like Kohana you have public and private methods, where public methods are accessible and private are not. So my question is which do you think is a better approach? From a secure point of view I would vote Zend's approach, but I am interested in knowing what others think.

    Read the article

  • Collect all extension methods to generic class in another generic class

    - by Hun1Ahpu
    I'd like to create a lot of extension methods for some generic class, e.g. for public class SimpleLinkedList<T> where T:IComparable And I've started creating methods like this: public static class LinkedListExtensions { public static T[] ToArray<T>(this SimpleLinkedList<T> simpleLinkedList) where T:IComparable { //// code } } But when I tried to make LinkedListExtensions class generic like this: public static class LinkedListExtensions<T> where T:IComparable { public static T[] ToArray(this SimpleLinkedList<T> simpleLinkedList) { ////code } } I get "Extension methods can only be declared in non-generic, non-nested static class". And I'm trying to guess where this restriction came from and have no ideas.

    Read the article

  • To static or not to static

    - by Idsa
    I really like to use static methods (especially for helpers classes). But as static methods are not stubbable, eventually they are a bad practice, aren't they? So I have to choose between static methods usage convenience and testability. Is there any compromise?

    Read the article

  • Parsing C#, finding methods and putting try/catch to all methods

    - by erdogany
    I know it sounds weird but I am required to put a wrapping try catch block to every method to catch all exceptions. We have thousands of methods and I need to do it in an automated way. What do you suggest? I am planning to parse all cs files and detect methods and insert a try catch block with an application. Can you suggest me any parser that I can easily use? or anything that will help me... every method has its unique number like 5006 public static LogEntry Authenticate(....) { LogEntry logEntry = null; try { .... return logEntry; } catch (CompanyException) { throw; } catch (Exception ex) { logEntry = new LogEntry( "5006", RC.GetString("5006"), EventLogEntryType.Error, LogEntryCategory.Foo); throw new CompanyException(logEntry, ex); } } I created this for this; http://thinkoutofthenet.com/index.php/2009/01/12/batch-code-method-manipulation/

    Read the article

  • Refering to javascript instance methods with a pound/hash sign

    - by Josh
    This question is similar to http://stackoverflow.com/questions/736120/why-are-methods-in-ruby-documentation-preceded-by-a-pound-sign I understand why in Ruby instance methods are proceeded with a pound sign, helping to differentiate talking about SomeClass#someMethod from SomeObject.someMethod and allowing rdoc to work. And I understand that the authors of PrototypeJS admire Ruby (with good reason) and so they use the hash mark convention in their documentation. My question is: is this a standard practice amongst JavaScript developers or is it just Prototype developers who do this? Asked another way, is it proepr for me to refer to instance methods in comments/documentation as SomeClass#someMethod? Or should my documentation refer to `SomeClass.someMethod?

    Read the article

  • Code optimization - Unused methods

    - by Yochai Timmer
    How can I tell if a method will never be used ? I know that for dll files and libraries you can't really know if someone else (another project) will ever use the code. In general I assume that anything public might be used somewhere else. But what about private methods ? Is it safe to assume that if I don't see an explicit call to that method, it won't be used ? I assume that for private methods it's easier to decide. But is it safe to decide it ONLY for private methods ?

    Read the article

  • Marshalling to a native library in C#

    - by Daniel Baulig
    I'm having trouble calling functions of a native library from within managed C# code. I am developing for the 3.5 compact framework (Windows Mobile 6.x) just in case this would make any difference. I am working with the waveIn* functions from coredll.dll (these are in winmm.dll in regular Windows I believe). This is what I came up with: // namespace winmm; class winmm [StructLayout(LayoutKind.Sequential)] public struct WAVEFORMAT { public ushort wFormatTag; public ushort nChannels; public uint nSamplesPerSec; public uint nAvgBytesPerSec; public ushort nBlockAlign; public ushort wBitsPerSample; public ushort cbSize; } [StructLayout(LayoutKind.Sequential)] public struct WAVEHDR { public IntPtr lpData; public uint dwBufferLength; public uint dwBytesRecorded; public IntPtr dwUser; public uint dwFlags; public uint dwLoops; public IntPtr lpNext; public IntPtr reserved; } public delegate void AudioRecordingDelegate(IntPtr deviceHandle, uint message, IntPtr instance, ref WAVEHDR wavehdr, IntPtr reserved2); [DllImport("coredll.dll")] public static extern int waveInAddBuffer(IntPtr hWaveIn, ref WAVEHDR lpWaveHdr, uint cWaveHdrSize); [DllImport("coredll.dll")] public static extern int waveInPrepareHeader(IntPtr hWaveIn, ref WAVEHDR lpWaveHdr, uint Size); [DllImport("coredll.dll")] public static extern int waveInStart(IntPtr hWaveIn); // some other class private WinMM.WinMM.AudioRecordingDelegate waveIn; private IntPtr handle; private uint bufferLength; private void setupBuffer() { byte[] buffer = new byte[bufferLength]; GCHandle bufferPin = GCHandle.Alloc(buffer, GCHandleType.Pinned); WinMM.WinMM.WAVEHDR hdr = new WinMM.WinMM.WAVEHDR(); hdr.lpData = bufferPin.AddrOfPinnedObject(); hdr.dwBufferLength = this.bufferLength; hdr.dwFlags = 0; int i = WinMM.WinMM.waveInPrepareHeader(this.handle, ref hdr, Convert.ToUInt32(Marshal.SizeOf(hdr))); if (i != WinMM.WinMM.MMSYSERR_NOERROR) { this.Text = "Error: waveInPrepare"; return; } i = WinMM.WinMM.waveInAddBuffer(this.handle, ref hdr, Convert.ToUInt32(Marshal.SizeOf(hdr))); if (i != WinMM.WinMM.MMSYSERR_NOERROR) { this.Text = "Error: waveInAddrBuffer"; return; } } private void setupWaveIn() { WinMM.WinMM.WAVEFORMAT format = new WinMM.WinMM.WAVEFORMAT(); format.wFormatTag = WinMM.WinMM.WAVE_FORMAT_PCM; format.nChannels = 1; format.nSamplesPerSec = 8000; format.wBitsPerSample = 8; format.nBlockAlign = Convert.ToUInt16(format.nChannels * format.wBitsPerSample); format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign; this.bufferLength = format.nAvgBytesPerSec; format.cbSize = 0; int i = WinMM.WinMM.waveInOpen(out this.handle, WinMM.WinMM.WAVE_MAPPER, ref format, Marshal.GetFunctionPointerForDelegate(waveIn), 0, WinMM.WinMM.CALLBACK_FUNCTION); if (i != WinMM.WinMM.MMSYSERR_NOERROR) { this.Text = "Error: waveInOpen"; return; } setupBuffer(); WinMM.WinMM.waveInStart(this.handle); } I read alot about marshalling the last few days, nevertheless I do not get this code working. When my callback function is called (waveIn) when the buffer is full, the hdr structure passed back in wavehdr is obviously corrupted. Here is an examlpe of how the structure looks like at that point: - wavehdr {WinMM.WinMM.WAVEHDR} WinMM.WinMM.WAVEHDR dwBufferLength 0x19904c00 uint dwBytesRecorded 0x0000fa00 uint dwFlags 0x00000003 uint dwLoops 0x1990f6a4 uint + dwUser 0x00000000 System.IntPtr + lpData 0x00000000 System.IntPtr + lpNext 0x00000000 System.IntPtr + reserved 0x7c07c9a0 System.IntPtr This obiously is not what I expected to get passed. I am clearly concerned about the order of the fields in the view. I do not know if Visual Studio .NET cares about actual memory order when displaying the record in the "local"-view, but they are obviously not displayed in the order I speciefied in the struct. Then theres no data pointer and the bufferLength field is far to high. Interestingly the bytesRecorded field is exactly 64000 - bufferLength and bytesRecorded I'd expect both to be 64000 though. I do not know what exactly is going wrong, maybe someone can help me out on this. I'm an absolute noob to managed code programming and marshalling so please don't be too harsh to me for all the stupid things I've propably done. Oh here's the C code definition for WAVEHDR which I found here, I believe I might have done something wrong in the C# struct definition: /* wave data block header */ typedef struct wavehdr_tag { LPSTR lpData; /* pointer to locked data buffer */ DWORD dwBufferLength; /* length of data buffer */ DWORD dwBytesRecorded; /* used for input only */ DWORD_PTR dwUser; /* for client's use */ DWORD dwFlags; /* assorted flags (see defines) */ DWORD dwLoops; /* loop control counter */ struct wavehdr_tag FAR *lpNext; /* reserved for driver */ DWORD_PTR reserved; /* reserved for driver */ } WAVEHDR, *PWAVEHDR, NEAR *NPWAVEHDR, FAR *LPWAVEHDR; If you are used to work with all those low level tools like pointer-arithmetic, casts, etc starting writing managed code is a pain in the ass. It's like trying to learn how to swim with your hands tied on your back. Some things I tried (to no effect): .NET compact framework does not seem to support the Pack = 2^x directive in [StructLayout]. I tried [StructLayout(LayoutKind.Explicit)] and used 4 bytes and 8 bytes alignment. 4 bytes alignmentgave me the same result as the above code and 8 bytes alignment only made things worse - but that's what I expected. Interestingly if I move the code from setupBuffer into the setupWaveIn and do not declare the GCHandle in the context of the class but in a local context of setupWaveIn the struct returned by the callback function does not seem to be corrupted. I am not sure however why this is the case and how I can use this knowledge to fix my code. I'd really appreciate any good links on marshalling, calling unmanaged code from C#, etc. Then I'd be very happy if someone could point out my mistakes. What am I doing wrong? Why do I not get what I'd expect.

    Read the article

  • EPM 11.1.2 - In WebLogic Server, Enable Native IO Performance Pack

    - by Ahmed Awan
    Performance can be improved by enabling native IO in production mode. WebLogic Server benchmarks show major performance improvements when native performance packs are used on machines that host Oracle WebLogic Server instances. Important Note:  Always enable native I/O, if available, and check for errors at startup to make sure it is being initialed properly. Tip: The use of NATIVE performance packs are enabled by default in the configuration shipped with your distribution. You can use the Administration Console to verify that performance packs are enabled by clicking on each managed server and click on Tuning tab.

    Read the article

  • Google I/O 2012 - Native Client LIVE

    Google I/O 2012 - Native Client LIVE Colton McAnlis, Noel Allen In this talk, we will be porting an application to Native Client in 60 minutes, LIVE; showing the power of what Native Client can provide for traditional C++ developers looking to move to the web. In the porting process we'll cover specific tasks that a developer would need to perform during a port, and how to to address them with new tools and technologies including debugging integration with Visual Studio and a set of newly added utility libraries to the SDK. Attendees to this session will walk away with a clear understanding of what's required to port their applications to Native Client so that they can start their own projects For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 16 0 ratings Time: 48:21 More in Science & Technology

    Read the article

  • Implementing a "state-machine" logic for methods required by an object in C++

    - by user827992
    What I have: 1 hypothetical object/class + other classes and related methods that gives me functionality. What I want: linking this object to 0 to N methods in realtime on request when an event is triggered Each event is related to a single method or a class, so a single event does not necessarily mean "connect this 1 method only" but can also mean "connect all the methods from that class or a group of methods" Avoiding linked lists because I have to browse the entire list to know what methods are linked, because this does not ensure me that the linked methods are kept in a particular order (let's say an alphabetic order by their names or classes), and also because this involve a massive amount of pointers usage. Example: I have an object Employee Jon, Jon acquires knowledge and forgets things pretty easily, so his skills may vary during a period of time, I'm responsible for what Jon can add or remove from his CV, how can I implement this logic?

    Read the article

  • Introducing the Native Client SDK

    Introducing the Native Client SDK Henry Bridge, product manager for Native Client introduces the developer preview of Native Client's sdk. For more information go to code.google.com From: GoogleDevelopers Views: 5 0 ratings Time: 05:00 More in Science & Technology

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >