Search Results

Search found 9082 results on 364 pages for 'c functions'.

Page 166/364 | < Previous Page | 162 163 164 165 166 167 168 169 170 171 172 173  | Next Page >

  • Fastest way to find the largest power of 10 smaller than x

    - by peoro
    Is there any fast way to find the largest power of 10 smaller than a given number? I'm using this algorithm, at the moment, but something inside myself dies anytime I see it: 10**( int( math.log10(x) ) ) # python pow( 10, (int) log10(x) ) // C I could implement simple log10 and pow functions for my problems with one loop each, but still I'm wondering if there is some bit magic for decimal numbers.

    Read the article

  • How to call Java method from C++

    - by fhucho
    Hi, I am using JNI to call my C++ function from Java. One of the C++ function's arguments is jobject thiz (as far as I know, all JNI native functions have this argument). The function takes quite long to complete and I want to report progress back to the jobject thiz Java object, so that I can show the progress to the user. How can I call jobject's methods from C++?

    Read the article

  • Installer for web application

    - by Xinus
    We have developed a web application which is to be deployed by nontechnical person. Therefor I want to create an installer for it. Installer has functions of installing JVM, Apache Tomcat, and the web application war file depending on whether they are installed or not. Is there any installation suit which I can use to achieve this?

    Read the article

  • Can the current date be inserted into output through XSLT v1.0

    - by Randy
    I have an incoming data stream that is being converted with XSLT v1.0 that incoming data does not contain any date information. what i would like, is a nice way of getting the current date to become part of the resulting output stream. I am aware of the 2.0 current-date() type functions - unfortunately those are not available to this environment... any thoughts/hacks/alternatives? tia

    Read the article

  • Android runs OpenGL ES 1.1 or 1.0?

    - by cjserio
    I'm developing a native app for Android and I'm trying to use functions such as glIsEnabled which appear to be only available in OpenGL ES 1.1. Google's docs claim that NDK 1.6R1 supports OpenGL ES v1.1 but the function call fails with "unimplemented Open GL ES API" and if i do a glGetString(GL_VERSION) it returns "OpenGL ES 1.0 CM" as the version. So if 1.1 is available, what do I have to link against to get it or what else do i need to change to get it?

    Read the article

  • getJSON and variable scope in javascript

    - by nillls
    Hi! In order to make function calls to our back-end php code we've implemented something called an ActionProxy like this: function ActionProxy(action, input, callback){ $.post("ActionProxy.php?method="+action, { data: input}, function(data, textStatus, XMLHttpRequest){ //return data.ResponseWhatever } }); The problem we're having is that using data outside the ActionProxy is impossible due to variable scope limitations (we assume), setting var res = data.ResponseWhatever or return data.ResponseWhatever is pretty futile. How would one handle these responses most appropriately so that functions calling the actionproxy can access the response values?

    Read the article

  • How to implement Chord function using GDIplus?

    - by leo4ever
    Here are the GDI functions Chord() provided by MFC: BOOL Chord( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4 ); BOOL Chord( LPCRECT lpRect, POINT ptStart, POINT ptEnd ); It seems to me that no such method is privided by GDI+ (the Graphics class), so how do I implement my own Chord function (with the exact same prototype) ? By the way, I just don't understand why does MS just don't provide them. Thanks.

    Read the article

  • Determining if Memory Pointer is Valid - C++

    - by Jim Fell
    It has been my observation that if free( ptr ) is called where ptr is not a valid pointer to system-allocated memory, an access violation occurs. Let's say that I call free like this: LPVOID ptr = (LPVOID)0x12345678; free( ptr ); This will most definitely cause an access violation. Is there a way to test that the memory location pointed to by ptr is valid system-allocated memory? It seems to me that the the memory management part of the Windows OS kernel must know what memory has been allocated and what memory remains for allocation. Otherwise, how could it know if enough memory remains to satisfy a given request? (rhetorical) That said, it seems reasonable to conclude that there must be a function (or set of functions) that would allow a user to determine if a pointer is valid system-allocated memory. Perhaps Microsoft has not made these functions public. If Microsoft has not provided such an API, I can only presume that it was for an intentional and specific reason. Would providing such a hook into the system prose a significant threat to system security? Situation Report Although knowing whether a memory pointer is valid could be useful in many scenarios, this is my particular situation: I am writing a driver for a new piece of hardware that is to replace an existing piece of hardware that connects to the PC via USB. My mandate is to write the new driver such that calls to the existing API for the current driver will continue to work in the PC applications in which it is used. Thus the only required changes to existing applications is to load the appropriate driver DLL(s) at startup. The problem here is that the existing driver uses a callback to send received serial messages to the application; a pointer to allocated memory containing the message is passed from the driver to the application via the callback. It is then the responsibility of the application to call another driver API to free the memory by passing back the same pointer from the application to the driver. In this scenario the second API has no way to determine if the application has actually passed back a pointer to valid memory.

    Read the article

  • Is there any difference between var name = function() {} & function name() {} in Javascript?

    - by Fletcher Moore
    Suppose we are inside a function and not in the global namespace. function someGlobalFunction() { var utilFunction1 = function() { } function utilFunction2 () { } utilFunction1(); utilFunction2(); } Are these synonymous? And do these functions completely cease to exist when someGlobalFunction returns? Should I prefer one or the other for readability or some other reason?

    Read the article

  • Hibernate Initial SessionFactory creation failed

    - by user364746
    Hello.. I'm trying to use hibernate to fill my jsf selectonemenu in ApplicationBean (in Liferay). The problem is that I got Initial SessionFactory creation failed problem. Before putting my functions in the applicationbean I was setting them in sessionbean and I got no error. For now the full error Initial SessionFactory creation failed.java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType Thanks

    Read the article

  • Joomla 2.5 - Modify registration form and logic

    - by ice13ill
    Hello I'm new to Joomla and I want to change the way an account is created (in Joomla 2.5): Change the registation form (remove one or two fields) Change the registration logic: I want to add more stuff in the sent email (and a pdf attachment) and also i want to call some other functions (or make extra requests), analyse the result and then return the response to the client. What ways are there?

    Read the article

  • MS Access Import from Text File problems

    - by Gavin O'Brien
    I'm trying to import a text file into an access database. It's not one I've written myself but the spec for the delimited text file is set up properly and the file imports properly using the wizard. When I try to use the import functions of the app itself, the ImportError table tells "Field Truncation" for one of the fields. Any help would be appreciated.

    Read the article

  • NHibernate and MySql Keywords

    - by jalchr
    Why Nibernate HQL can not handle the following query: from Deal D where (D.ApprovalDate + INTERVAL 1 Year) < current_timestamp() < (D.RenewalDate + INTERVAL -1 Year) knowing that INTERVAL and YEAR are keywords in MySQL, so this is kind of mixing Sql within Hql (unless Hql can handle date functions like so and I don't know) . The dialect is MySQLDialect Its perfectly valid to execute this query SELECT '2005-01-01' + INTERVAL 1 Year;

    Read the article

  • Where do I put all these function-like #defines, in C?

    - by Tristan
    I'm working with an embedded system, and I'm ending up with a ton of HW-interfacing #define functions. I want to put all of these into a separate file (for OOP-ness), but I don't know the best way to #include that. Do I just put them all into a .c file, then include that? Seems silly to put these in a .h file.

    Read the article

  • Read vs Find -- Cakephp Usage

    - by Michael
    Hi all, I was reading through a book on CakePhp Application structure, and came across both the read and find functions. I've always only used find -- when would a read be appropriate? Examples appreciated. Thanks!

    Read the article

  • Where can I find documentation for Scala's delayed function calls?

    - by Geo
    I saw a delayed example in David Pollak's "Beginning Scala". I tried to adapt that, by trial and error. Here's what I have: def sayhello() = { println("hello") } def delaying(t: => Unit):Unit = { println("before call") t println("after call") } delaying(sayhello()) How would you delay a function/method that takes parameters? Why can't I use parantheses when I call t? Where can I find more documentation on delaying functions?

    Read the article

  • why do you write tests and what is a unit test and how does it differ other types of testing ?

    - by dfafa
    im curious as to know, why tests are written? why would bother writing it ? why not just compile and run the code or view it in your browser, click around and test out stuff. i mean i can understand, a crawler that checks your web app's functions....but why is tests written, maintained and treated as important as the main feature codes ? is it crucial to always write and use tests ?

    Read the article

  • Run-Time Binding C++

    - by m00st
    I'm reading in my text book about virtual functions in C++ and my book doesn't elaborate on what exactly run-time binding is. It doesn't give me any information as to why I would need run-time binding. Maybe the nice people at SO can provide me with some links or information? Thanks :]

    Read the article

  • Generate set/get methods for a c++ class

    - by Narek
    Is there any tool that generates set and get methods for a class. Just I create classes very frequently and would like to have a tool which for each class-member wil generate following functions: Member_Type getMemberName() const; void setMemberName(const Member_Type & val);

    Read the article

  • Testcase with multitouch on Android?

    - by makke
    The TouchUtils class in the android documentation has functions like drag() [http://developer.android.com/intl/de/reference/android/test/TouchUtils.html#drag(android.test.InstrumentationTestCase,%20float,%20float,%20float,%20float,%20int)], but they do not support multi touch gestures, like a two finger swipe. Looking at the MotionEvent.obtain() methods, there does not seem to be any way of invoking a "virtual" multi touch event from a testcase. Anyone has got it working?

    Read the article

  • How do I create and read non-global variables that aren't destroyed at end of function?

    - by Paul Reilly
    I am attempting to code some plugins to use with MIDI sequencers but have hit a stumbling block. I can't use global-scope variables to store information because multiple instances of the .dll can exist which share memory. How do I create a class (for re-usability purposes in other plugins) containing 2 dimensional array and other variables the content of which is to be shared between functions? If that is possible, how would I read and write the data from the function in the framework where I do the processing?

    Read the article

  • Trying to provide a global logging function

    - by Gekitsuu
    I typically write my scripts with a structure like s #!/usr/bin/python import stuff def do_things(): print "FOO" def main(): do_things() if __name__ == "__main__": main() The problem I have is I'd like to have a logging function that is defined globally and I"m not really sure how to do this. I tried a decorator function but if I define it in main I can't call it from other functions in the script. It seems like something that should be easy to do but not something I have experience with.

    Read the article

< Previous Page | 162 163 164 165 166 167 168 169 170 171 172 173  | Next Page >