Daily Archives

Articles indexed Tuesday March 23 2010

Page 13/130 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • how to profile multi threaded c++ app on linux?

    - by anon
    I used to do all my linux profiling with gprof. However, with my multi threaded app, it's output appears to be inconsistent. Now, I dug this up http://sam.zoy.org/writings/programming/gprof.html howver, it's from a long time ago -- and in my gprof output, it appears my gprof is listing functions used by non-main threads. So, my questions are: 1) in 2010, can I easily use gprof to profile multi threaded linux c++ apps? (ubuntu 9.10) 2) what other tools should I look into for profiling? thanks!

    Read the article

  • Need to call original function from detoured function

    - by peachykeen
    I'm using Detours to hook into an executable's message function, but I need to run my own code and then call the original code. From what I've seen in the Detours docs, it definitely sounds like that should happen automatically. The original function prints a message to the screen, but as soon as I attach a detour it starts running my code and stops printing. The original function code is roughly: void CGuiObject::AppendMsgToBuffer(classA, unsigned long, unsigned long, int, classB); My function is: void CGuiObject_AppendMsgToBuffer( [same params, with names] ); I know the memory position the original function resides in, so using: DWORD OrigPos = 0x0040592C; DetourAttach( (void*)OrigPos, CGuiObject_AppendMsgToBuffer); gets me into the function. This code works almost perfectly: my function is called with the proper parameters. However, execution leaves my function and the original code is not called. I've tried jmping back in, but that crashes the program (I'm assuming the code Detours moved to fit the hook is responsible for the crash). Edit: I've managed to fix the first issue, with no returning to program execution. By calling the OrigPos value as a function, I'm able to go to the "trampoline" function and from there on to the original code. However, somewhere along the lines the registers are changing and that is causing the program to crash with a segfault as soon as I get back into the original code.

    Read the article

  • Check for Duplicates in a Database Before Entering Data

    - by gamerzfuse
    Before Entering data into a database, I just want to check that the database doesn't have the same username in the database already. I have the username in SQL set as a key, so it can't be duplicated on that end, but I am looking at finding a more user-friendly error message then "KEY already exists". Is there are simple way to check if the variable value already exists in a row? Thanks!

    Read the article

  • Modifying .rdata unicode strings from windows PE files

    - by sdaa
    I have been looking for a way of modifying static strings stored in Windows .exe files in the .rdata section, however I haven't found a real way to do so yet. The whole thing is too complicated to do by hand (in this case by a HEX editor) and so I wanted to know if you have a solution to do so.

    Read the article

  • What are good alternatives to SQL?

    - by Brendan Long
    I occasionally hear things about how SQL sucks and it's not a good language, but I never really hear much about alternatives to it. So, are other good languages that serve the same purpose (database access) and what makes them better than SQL? Are there any good databases that use this alternative language?

    Read the article

  • SSL configuration

    - by kit
    I am trying to setup the ssl_requirement plugin. For my users controller I would like to require ssl for new and create. When I open users/new the browser redirects to https but I get an unable to connect error message. The application error log says : Filter chain halted as [:ensure_proper_protocol] rendered_or_redirected. I am not sure if I have configured the plugin incorrectly or if I made an error with the nginx configuration.

    Read the article

  • How to use NSURLDownload

    - by marshluca
    - (IBAction)startDownloadingURL:(id)sender { // create the request NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com/index.html"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; // create the connection with the request // and start loading the data NSURLDownload *theDownload=[[NSURLDownload alloc] initWithRequest:theRequest delegate:self]; if (!theDownload) { // inform the user that the download could not be made } } when i run the simulator , i got an error: NSURLDownload undeclared ,first use in this fuction. where can i import the library of NSURLDownload.

    Read the article

  • MS-Excel Negative times

    - by oxinabox.ucc.asn.au
    I'm writing a spreadsheet for a shop manager. What it does is keep track of the number of hours a worker has worked. So you enter times for Monday-Sunday, and then an adjustment - e.g. if they work 40/40/40/32 hours for the month, then you would have an adjustment of -2/-2/-2/+6 to bring the worker to the 38 hour week that he's being paid for. Some (most) weeks may be adjusted for overtime. The spreadsheet then totals the hours. This spreadsheet is supposed to just be a self-calculating version of a paper form. It needs to match the paper form as it has to be substituted for the old form which is given to some other member of the company (pay clerk, I don't know; I'm not rebuilding their whole system, just replacing a form) I'm having trouble entering a negative time in the adj field - the field has a [h]:mm formatting. and when i enter a negative time (e.g. -2:00) it displays an error, saying "incorrectly formatted equation", with the suggestion that if I was entering a string then I should prefix with a apostrophe. How do I overcome this?

    Read the article

  • UITableView with Custom Cell only loads one row of data at a time

    - by Anton
    For my table, I've created a custom cell that has two labels. I also have two arrays with data, that I use to respectively assign each label in the cell. My problem, is that when the table is viewed, only the first row has data, and the rest of the data "sorta" loads when I start scrolling down. By "sorta", only the first row will load at a time. The only time I get to see all the data, is when I scroll to the bottom, then scroll up again. I've used the cellForRowAtIndexPath method to load the data into my cell. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CustomCellIdentifier = @"CustomCellIdentifier"; CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[CustomCell class]]) cell = (CustomCell *)oneObject; } NSUInteger row = [indexPath row]; //I have two tables to fill up, hence the tag if statement if ([tableView tag] == 0) { cell.arriveTimeLabel.text = [homeBoundTimes objectAtIndex:row]; cell.departTimeLabel.text = [homeBoundTimes objectAtIndex:row]; } else if ([tableView tag] == 1) { cell.arriveTimeLabel.text = [workBoundTimes objectAtIndex:row]; cell.departTimeLabel.text = [workBoundTimes objectAtIndex:row]; } return cell; } Is it possible that its only getting called when the top cell is being called?

    Read the article

  • Windows forms application blocks after station lock

    - by Silviu
    We're having a serious issue at work. We've discovered that after the station where the client was running is locked/unlocked the client is blocked. No repaint. So the UI thread is blocked with something. Looking at the callstack of the UI thread (thread 0) using windbg we see that a UserPreferenceChanged event gets raised. It is marshalled through a WindowsFormsSynchronizationContext using it's controlToSend field to the UI. It gets blocked by a call to the marshalling control. The method called is MarshaledInvoke it builds a ThreadMethodEntry entry = new ThreadMethodEntry(caller, method, args, synchronous, executionContext); This entry is supposed to do the magic. The call is a synchronous call and because of that (still in the MarshaledInvoke of the Control class) the wait call is reached: if (!entry.IsCompleted) { this.WaitForWaitHandle(entry.AsyncWaitHandle); } The last thing that i can see on the stack is the WaitOne called on the previously mentioned AsyncWaitHandle. This is very annoying because having just the callstack of the runtime and not one of our methods being invoked we cannot really point to a bug in our code. I might be wrong, but I'm guessing that the marshaling control is not "marshaling" to the ui thread. But another one...i don't really know which one because the other threads are being used by us and are blocked...maybe this is the issue. But none of the other threads are running a message loop. This is very annoying. We had some issues in the past with marshaling controls to the right ui thread. That is because the first form that is constructed is a splash form. Which is not the main form. We used to use the main form to marshal call to the ui thread. But from time to time some calls would go to a non ui thread and some grids would broke with a big red X on them. I fixed this by creating a specific class: public class WindowsFormsSynchronizer { private static readonly WindowsFormsSynchronizationContext = new WindowsFormsSynchronizationContext(); //Methods are following that would build the same interface of the synchronization context. } This class gets build as one of the first objects in the first form being constructed. We've noticed some other strange thing. Looking at the heap there are 7 WindowsFormsSynchronizationContext objects. 6 of these have the same instance of controlToSend, and the other one has some different instance of controlToSend. This last one is the one that should marshal the calls to the UI. I don't have any other idea...maybe some of you guys had this same issue?

    Read the article

  • Shared SQL Server 2008

    - by nazaf
    Hi, I have a Windows Hyper VPS plan with 1024 MB of RAM. After installing SQL Server 2008 Express, my memory usage went up to 75% without running my site yet. I know that SQL Server consumes a lot of memory, so I decided to host my DB on a shared server. Which of the following is more scalable: install my DB on my VPS, or on a shared server ? If the latter, then can you recommend me a good shared server? Thanks.

    Read the article

  • PHP Not Automatically Updating With ?reload=1

    - by user32007
    A friend built a ranking system on his site and I am trying to host in on mine via wordpress and godaddy. It updates for him but when I load it to my site, it works for 6 hours, but as soon as the reload is supposed to occur, it errors and I get a 500 timeout error. His page is at: jeremynoeljohnson .com/yakezieclub My page is currently at http://sweatingthebigstuff.com/yakezieclub but when you ?reload=1 it will give the error. Any idea why this might be happening? Any settings that I might need to change? Here is the top of the index.php file. I'm not sure which part of any of it is messing up. I literally uploaded the same code as him. Here's the reload part: $cachefile = "rankings.html"; $daycachefile = "rankings_history.xml"; $cachetime = (60 * 60) * 6; // every 6 hours, the cache refreshes $daycachetime = (60 * 60) * 24; // every 24 hours, the history will be written to - or whenever the page is requested after 24 hours has passed $writenewdata = false; if (!empty($_GET['reload'])) { if ($_GET['reload']== 1) { $cachetime = 1; } } if (!empty($_GET['reloadhistory'])) { if ($_GET['reloadhistory'] == 1) { $daycachetime = 1; $cachetime = 1; } } if (file_exists($daycachefile) && (time() - $daycachetime < filemtime($daycachefile))) { // Do nothing } else { $writenewdata = true; $cachetime = 1; } // Serve from the cache if it is younger than $cachetime if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) { include($cachefile); echo ""; exit; } ob_start(); // start the output buffer ?

    Read the article

  • SQL Server Installation Checklist

    - by Jonathan Kehayias
    The other night I was asked on Twitter by Todd McDonald (Twitter), for a build list for SQL Server 2005 and 2008.  My initial response was to provide a link to the SQL Server Build List Blog , which documents all of the builds of SQL Server and provides links to the KB articles associated with the builds.  However, this wasn’t what Todd was after, he actually wanted a reference for an installation checklist for SQL Server.  I have a number of these that I use in my job, and they vary...(read more)

    Read the article

  • Is Job Running?

    - by Derek D.
    The following SQL Server script works to determine if a particular job is currently running. This feature is nice to have if you do not want jobs to step over one another. I frequently will use this script as the first step of the job. If it is currently running, then the [...]

    Read the article

  • SQL Server Add Primary Key

    - by Derek D.
    Adding a primary key can be done either after a table is created, or at the same a table is created. It is important to note, that by default a primary key is clustered. This may or may not be the preferred method of creation. For more information on clustered vs non [...]

    Read the article

  • SQL Server Select

    - by Derek D.
    The SQL Server Select statement is the first statement used when returning data. It is the most used and most important statement in the T-SQL language. The Select statement has many different clauses. We will step through each clause further in the tutorial, however now, we will look at Select itself. The following [...]

    Read the article

  • how can I declare a value deep in an object tree using variable properties in javascript

    - by joshs
    I am trying to have a javascript object tree behave like a php associative array in the following way. var key1 = 'a'; var key2 = 'b'; var key3 = 'c'; var obj[key1][key2][key3] = 'd'; However, in javascript I believe you need to define each property/object pair individually, forming deeper leaves. Something like: var obj[key1] = {}; var obj[key1][key2] = {}; ... Is there a way to simplify or shorten this script? Thanks

    Read the article

  • How to get size of bytes?

    - by k80sg
    How do I obtain the number of bytes before allocating the byte size of the array 'handsize' as shown below as the incoming ByteArray data are sent in 3 different sizes. Thanks. BufferedInputStream bais = new BufferedInputStream(requestSocket.getInputStream()); DataInputStream datainput = new DataInputStream(bais); //need to read the number of bytes here before proceeding. byte[] handsize = new byte[bytesize]; datainput.readFully(handsize);

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >