Search Results

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

Page 163/364 | < Previous Page | 159 160 161 162 163 164 165 166 167 168 169 170  | Next Page >

  • Cross platform millisecond timer lasting more than 49 days?

    - by Cetra
    Hey guys, I'm going to be developing a small dedicated server in C/C++ that will require uptime of forever. I've been looking into some time functions as millisecond timing is required for calculations. I have 2 problems that I'm facing: Using a 32bit integer to store the number of milliseconds since the operation began will wrap around at about the 49 days mark resetting to zero. There doesn't seem to be any standard system calls for getting elapsed milliseconds that are platform independant What should I do to resolve both these issues?

    Read the article

  • Where are the function literals c++?

    - by academicRobot
    First of all, maybe literals is not the right term for this concept, but its the closest I could think of (not literals in the sense of functions as first class citizens). The idea is that when you make a conventional function call, it compiles to something like this: callq <immediate address> But if you make a function call using a function pointer, it compiles to something like this: mov <memory location>,%rax callq *%rax Which is all well and good. However, what if I'm writing a template library that requires a callback of some sort with a specified argument list and the user of the library is expected to know what function they want to call at compile time? Then I would like to write my template to accept a function literal as a template parameter. So, similar to template <int int_literal> struct my_template {...};` I'd like to write template <func_literal_t func_literal> struct my_template {...}; and have calls to func_literal within my_template compile to callq <immediate address>. Is there a facility in C++ for this, or a work around to achieve the same effect? If not, why not (e.g. some cataclysmic side effects)? How about C++0x or another language? Solutions that are not portable are fine. Solutions that include the use of member function pointers would be ideal. I'm not particularly interested in being told "You are a <socially unacceptable term for a person of low IQ>, just use function pointers/functors." This is a curiosity based question, and it seems that it might be useful in some (albeit limited) applications. It seems like this should be possible since function names are just placeholders for a (relative) memory address, so why not allow more liberal use (e.g. aliasing) of this placeholder. p.s. I use function pointers and functions objects all the the time and they are great. But this post got me thinking about the don't pay for what you don't use principle in relation to function calls, and it seems like forcing the use of function pointers or similar facility when the function is known at compile time is a violation of this principle, though a small one.

    Read the article

  • looking for a javascript engine

    - by c0f33.alex
    i'm looking for a js engine to that I can (easily) expose C/C++ functions, classes etc. The API should allow changing exposed values from within C++ (by storing some kind of pointer or reference to an object inside js or so...). I've considered using google's v8 but I'm new to it and don't know whether it will satisfy my requirements. Can someone tell me whether I should stick to v8 or try something else?

    Read the article

  • 'goto' usage

    - by Landon
    I've long been under the impression that 'goto' should never be used if possible. While perusing libavcodec (which is written in C) the other day, I noticed multiple uses of it. Is it ever advantageous to use 'goto' in a language that supports loops and functions? If so, why?

    Read the article

  • Converting a selected date from a datetimepicker into my query, along with subtracting a day

    - by MyHeadHurts
    I am currently using this to get yesterdays date, however i need to do something similar where the user will use a javascript datetimepicker in my asp.net page and i will then use the date they select instead of just yesterdays date Declare @dayselection int set @dayselection = CONVERT(int,DateAdd(year, @YearToGet - Year(getdate() + 1), DateAdd(day, DateDiff(day, 1, @dayToGet), 1) , DateAdd(month, DateDiff(month, 0, @monthToGet), 0) ) but it isnt working i keep getting syntax errors I want the day and year functions to stay the same i just need help with the month part. I need to convert the selected date into an int

    Read the article

  • What does (void**) mean in C?

    - by numerical25
    I would look this up, but honestly I wouldn't know where to start because I don't know what it is called. I've seen variables passed to functions like this: myFunction((void**)&variable); Which confuses the heck out of me cause all of those look familiar to me; I've just never seen them put together like that before. What does it mean? I am a newb so the less jargon, the better, thanks!

    Read the article

  • mySQL query: How to insert with UNION?

    - by Industrial
    Hi everybody, I am kind of new to mySQL:s union functions, at least when doing inserts with them. I have gotten the following to work based upon a example found on the net: INSERT INTO tableOne(a, b) SELECT a, $var FROM tableOne WHERE b = $var2 UNION ALL SELECT $var,$var Ok, nothing strange about that. But what happens when I want to insert a third value into the database that has nothing to do with the logic of the Select being done? Like : INSERT INTO tableOne(a, b, c ) How could that be done?

    Read the article

  • Standard library function in R for finding the mode?

    - by Nick
    In statistical language R, mean() and median() are standard functions which do what you'd expect. mode() tells you the internal storage mode of the R object, not the value that occurs the most in its argument. But surely there is a standard library function that implements mode for a vector (or list).

    Read the article

  • Howto obtain Per-Interface statistics on windows

    - by Canacourse
    I am trying to find the most used Network card on windows 200 or XP. I planned to obtain the number of packets sent trough each NIC to determine the main NIC. I thought IP Helper might give me this information but also it looks like the functions in IP helper only give stats for all interfaces. I know this can be done. Any ideas? Many Thanks...

    Read the article

  • What can you do in C without "std" includes? Are they part of "C," or just libraries?

    - by Chris Cooper
    I apologize if this is a subjective or repeated question. It's sort of awkward to search for, so I wasn't sure what terms to include. What I'd like to know is what the basic foundation tools/functions are in C when you don't include standard libraries like stdio and stdlib. What could I do if there's no printf(), fopen(), etc? Also, are those libraries technically part of the "C" language, or are they just very useful and effectively essential libraries?

    Read the article

  • Removing last part of string divided by a colon

    - by Harry Beasant
    I have a string that looks a little like this, world:region:bash It divides folder names, so i can create a path for FTP functions. However, i need at some points to be able to remove the last part of the string, so, for example I have this world:region:bash I need to get this world:region The script wont be able to know what the folder names are, so some how it needs to be able to remove the string after the last colon.

    Read the article

  • Classes. Whats the point?

    - by Ben Shelock
    I'm fairly new to OOP in PHP, I've made a couple of basic scripts but nothing impressive. All I've really taken from it is that it would probably be easier just make a collection of functions and include them. The structure of classes seems to just confuse what was otherwise a simple process. And in collating everything into a class it doesn't really add any functionality. So I'm clearly missing something. Could someone explain what functionality is added by creating classes

    Read the article

  • Is a Multi-DAL Approach the way to go here?

    - by Krisc
    Working on the data access / model layer in this little MVC2 project and trying to think things out to future projects. I have a database with some basic tables and I have classes in the model layer that represent them. I obviously need something to connect the two. The easiest is to provide some sort of 'provider' that can run operations on the database and return objects. But this is for a website that would potentially be used "a lot" (I know, very general) so I want to cache results from the data layer and keep the cache updated as new data is generated. This question deals with how best to approach this problem of dual DALS. One that returns cached data when possible and goes to the data layer when there is a cache miss. But more importantly, how to integrate the core provider (thing that goes into database) with the caching layer so that it too can rely on cached objects rather than creating new ones. Right now I have the following interfaces: IDataProvider is used to reach the database. It doesn't concern itself with the meaning of the objects it produces, but simply the way to produce them. interface IDataProvider{ // Select, Update, Create, et cetera access IEnumerable<Entry> GetEntries(); Entry GetEntryById(int id); } IDataManager is a layer that sits on top of the IDataProvider layer and manages the cache interface IDataManager : IDataProvider{ void ClearCache(); } Note that in practice the IDataManager implementation will have useful helper functions to add objects to their related cache stores. (In the future I may define other functions on the interface) I guess what I am looking for is the best way to approach a loop back from the IDataProvider implementations so that they can access the cache. Or a different approach entirely may be in order? I am not very interested in 3rd party products at the moment as I am interested in the design of these things much more than this specific implementation. Edit: I realize the title may be a bit misleading. I apologize for that... not sure what to call this question.

    Read the article

  • TextMate can show definition of a function easily?

    - by Jian Lin
    I am using TextMate on a Ruby on Rails project and wonder if you can put the mouse on link_to, and then press a key and it will show the definition of link_to, or does this for any other helper functions? Or, click open a box and type in a function name and it will show you the definition?

    Read the article

  • Getting an array back from php using $.ajax

    - by Wurlitzer
    A php script is giving this array (which has been passed through json_encode()) [{name:"a1",path:"b1"},{name:"a2",path:"b2"}] I use the following function to retrieve the array to jquery: $.ajax({ type: "POST", url: "functions.php", data: "action=" + something, cache: false, success: function(response) { alert(response); } }); The problem is I get the array back as a string: (new String("[{name:"a1",path:"b1"},{name:"a2",path:"b2"}}]")) How can I get it to be a javascript array? Help would be much appreciated.

    Read the article

  • [PHP] How to pass array as multiple parameters to function?

    - by vbklv
    I have a parameters array: $params[1] = 'param1'; $params[2] = 'param2'; $params[3] = 'param3'; ... $params[N] = 'paramN'; I have a caller to various functions: $method->$function( $params ); How can I parse the $params array, so multiple (and unlimited) parameters can be passed to any function: $method->$function( $param[1], $param[2], ..., $param[N] );

    Read the article

  • viewing files in python?

    - by Galilsnap
    I am creating a sort of "Command line" in Python. I already added a few functions, such as changing login/password, executing, etc., But is it possible to browse files in the directory that the main file is in with a command/module, or will I have to make the module myself and use the import command? Same thing with changing directories to view, too.

    Read the article

  • What are the elements of a team development suite?

    - by mhempey
    For small-to-large teams developing software together, what tools are used to form a comprehensive team development framework? Specifically, I'm looking for a comprehensive list of all the individual functions involved (e.g. source control, bug management, testing tools, project management), not specific product recommendations. I'm also not restricting the list to a particular methodology (e.g. Scrum).

    Read the article

< Previous Page | 159 160 161 162 163 164 165 166 167 168 169 170  | Next Page >