Search Results

Search found 638 results on 26 pages for 'breakpoint'.

Page 8/26 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Memory efficient collection class

    - by Joe
    I'm building an array of dictionaries (called keys) in my iphone application to hold the section names and row counts for a tableview. the code looks like this: [self.results removeAllObjects]; [self.keys removeAllObjects]; NSUInteger i,j = 0; NSString *key = [NSString string]; NSString *prevKey = [NSString string]; if ([self.allResults count] > 0) { prevKey = [NSString stringWithString:[[[self.allResults objectAtIndex:0] valueForKey:@"name"] substringToIndex:1]]; for (NSDictionary *theDict in self.allResults) { key = [NSString stringWithString:[[theDict valueForKey:@"name"] substringToIndex:1]]; if (![key isEqualToString:prevKey]) { NSDictionary *newDictionary = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:i],@"count", prevKey,@"section", [NSNumber numberWithInt:j], @"total",nil]; [self.keys addObject:newDictionary]; prevKey = [NSString stringWithString:key]; i = 1; } else { i++; } j++; } NSDictionary *newDictionary = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:i],@"count", prevKey,@"section", [NSNumber numberWithInt:j], @"total",nil]; [self.keys addObject:newDictionary]; } [self.tableview reloadData]; The code works fine first time through but I sometimes have to rebuild the entire table so I redo this code which orks fine on the simulator, but on my device the program bombs when I execute the reloadData line : malloc: *** mmap(size=3772944384) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug malloc: *** mmap(size=3772944384) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug Program received signal: “EXC_BAD_ACCESS”. If I remove the reloadData line the code works on the device. I'm wondering if this is something to do with the way I've built the keys array (ie using autoreleased strings and dictionaries).

    Read the article

  • Qt application crashing immediately without debugging info. How do I track down the problem?

    - by jjacksonRIAB
    I run an Qt app I've built: ./App Segmentation fault I run it with strace: strace ./App execve("./App", ["./App"], [/* 27 vars */]) = 0 --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV +++ Process 868 detached Again, no useful info. I run it with gdb: (gdb) run Starting program: /root/test/App Reading symbols from shared object read from target memory...(no debugging symbols found)...done. Loaded system supplied DSO at 0xffffe000 Program received signal SIGSEGV, Segmentation fault. 0x00000001 in ?? () Again, nothing. I run it with valgrind: ==948== Process terminating with default action of signal 11 (SIGSEGV) ==948== Bad permissions for mapped region at address 0x0 ==948== at 0x1: (within /root/test/App) Even if I put in debugging symbols, it doesn't give any more useful info. ldd shows all libraries being linked properly. Is there any other way I can find out what's wrong? I can't even do standard printf, cout, etc debugging. The executable doesn't even seem to start running at all. I rebuilt with symbols, and tried the suggestion below (gdb) break main Breakpoint 1 at 0x45470 (gdb) run Starting program: /root/test/App Breakpoint 1 at 0x80045470 Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0xffffe000 Program received signal SIGSEGV, Segmentation fault. 0x00000001 in ?? () I checked for static initializers and I don't seem to have any. Yep, I tried printf, cout, etc. It doesn't even make it into the main routine, so I'm looking for problems with static initializers in link libraries, adding them in one-by-one. I'm not getting any stack traces either.

    Read the article

  • Why is Request not available for my PDF request?

    - by Beska
    We're trying to create a .NET aspx page that will have a PDF within it. Doing this by hardcoding it is easy. <object height="1250px" width="100%" type="application/pdf" data="our.pdf"> <param value="our.pdf" name="src" /> <param value="transparent" name="wmode" /> </object> (don't worry too much about the transparent thing...we're doing that for other reasons...but I include it here "just in case".) The problem is when we want to generate the PDF dynamically. Our code to populate the literal on the front end looks like this: ltrPDF.Text = String.Format("<object height=\"1250px\" width=\"100%\" type=\"application/pdf\" data=\"ourPdfGenerator.aspx?var0={0}&var1={1}&var2={2}\">", var0, var1, var2); ltrPDF.Text += String.Format("<param value=\"ourPdfGenerator.aspx?var0={0}&var1={1}&var2={2}\">", var0, var1, var2); ltrPDF.Text += "<param value=\"transparent\" name=\"wmode\"/>"; ltrPDF.Text += "</object>"; Kind of ugly, but it seems like it should work. But it doesn't. When I debug, and put a breakpoint on the first line of ourPdfGenerator.aspx.cs Page_Load method, I reach the breakpoint without any difficulty. However, the first thing we do is try to use Request.QueryString: string var0 = Request.QueryString["var0"]; which immediately throws an HttpException: "Request is not available in this context." I'm not clear on: Why isn't it available? What can I do about it?

    Read the article

  • WSACONNREFUSED when connecting to server

    - by Robert Mason
    I'm currently working on a server. I know that the client side is working (I can connect to www.google.com on port 80, for example), but the server is not functioning correctly. The socket has socket()ed, bind()ed, and listen()ed successfully and is on an accept loop. The only problem is that accept() doesn't seem to work. netstat shows that the server connection is running fine, as it prints the PID of the server process as LISTENING on the correct port. However, accept never returns. Accept just keeps running, and running, and if i try to connect to the port on localhost, i get a 10061 WSACONNREFUSED. I tried looping the connection, and it just keeps refusing connections until i hit ctrl+c. I put a breakpoint directly after the call to accept(), and no matter how many times i try to connect to that port, the breakpoint never fires. Why is accept not accepting connections? Has anyone else had this problem before? Known: [breakpoint0] if ((new_fd = accept(sockint, NULL, NULL)) == -1) { throw netlib::error("Accept Error"); //netlib::error : public std::exception } else { [breakpoint1] code...; } breakpoint0 is reached (and then continued through), no exception is thrown, and breakpoint1 is never reached. The client code is proven to work. Netstat shows that the socket is listening. If it means anything, i'm connecting to 127.0.0.1 on port 5842 (random number). The server is configured to run on 5842, and netstat confirms that the port is correct.

    Read the article

  • object.valid? returns false but object.errors.full_messages is empty

    - by user549563
    Hello I'm confuse about objects that I can't save, simplified model is class Subscription < ActiveRecord::base belongs_to :user, :class_name => "User", :foreign_key => "user_id" has_many :transactions, :class_name => "SubscriptionTransaction" validates_presence_of :first_name, :message => "ne peut être vide" validates_presence_of :last_name, :message => "ne peut être vide" validates_presence_of :card_number, :message => "ne peut être vide" validates_presence_of :card_verification, :message => "ne peut être vide" validates_presence_of :card_type, :message => "ne peut être vide" validates_presence_of :card_expires_on, :message => "ne peut être vide" attr_accessor :card_number, :card_verification validate_on_create :validate_card def validate_card unless credit_card.valid? credit_card.errors.full_messages.each do |message| errors.add_to_base message end end end def credit_card @credit_card ||= ActiveMerchant::Billing::CreditCard.new( :type => card_type, :number => card_number, :verification_value => card_verification, :month => card_expires_on.month, :year => card_expires_on.year, :first_name => first_name, :last_name => last_name ) end end and in my subscription_controller if subscription.save # do something else debugger # means breakpoint where i try subscription.errors.full_messages # do something else end I tried to use ruby-debug for this adding a breakpoint before. And subscription.valid? return false which explains that ActiveRecord doesn't allow the save method. Unfortunately i can't know why the object is invalid. subscription.errors.full_messages # => [] I'm stucked, if you have any idea, thank you.

    Read the article

  • WPF app startup problems

    - by Dave
    My brain is all over the map trying to fully understand Unity right now. So I decided to just dive in and start adding it in a branch to see where it takes me. Surprisingly enough (or maybe not), I am stuck just getting my darn Application to load properly. It seems like the right way to do this is to override OnStartup in App.cs. I've removed my StartupUri from App.xaml so it doesn't create my GUI XAML. My App.cs now looks something like this: public partial class App : Application { private IUnityContainer container { get; set; } protected override void OnStartup(StartupEventArgs e) { container = new UnityContainer(); GUI gui = new GUI(); gui.Show(); } protected override void OnExit(ExitEventArgs e) { container.Dispose(); base.OnExit(e); } } The problem is that nothing happens when I start the app! I put a breakpoint at the container assignment, and it never gets hit. What am I missing? App.xaml is currently set to ApplicationDefinition, but I'd expect this to work because some sample Unity + WPF code I'm looking at (from Codeplex) does the exact same thing, except that it works! I've also started the app by single-stepping, and it eventually hits the first line in App.xaml. When I step into this line, that's when the app just starts "running", but I don't see anything (and my breakpoint isn't hit). If I do the exact same thing in the sample application, stepping into App.xaml puts me right into OnStartup, which is what I'd expect to happen. Argh! Is it a Bad Thing to just put the Unity construction in my GUI's Window_Loaded event handler? Does it really need to be at the App level?

    Read the article

  • Why does the VS2005 debugger not report "base." values properly? (was "Why is this if statement fail

    - by Rawling
    I'm working on an existing class that is two steps derived from System.Windows.Forms.Combo box. The class overrides the Text property thus: public override string Text { get { return this.AccessibilityObject.Value; } set { if (base.Text != value) { base.Text = value; } } } The reason given for that "get" is this MS bug: http://support.microsoft.com/kb/814346 However, I'm more interested in the fact that the "if" doesn't work. There are times where "base.Text != value" is true and yet pressing F10 steps straight to the closing } of the "set" and the Text property is not changed. I've seen this both by just checking values in the debugger, and putting a conditional breakpoint on that only breaks when the "if" statement's predicate is true. How on earth can "if" go wrong? The class between this and ComboBox doesn't touch the Text property. The bug above shouldn't really be affecting anything - it says it's fixed in VS2005. Is the debugger showing different values than the program itself sees? Update I think I've found what is happening here. The debugger is reporting value incorrectly (including evaluating conditional breakpoints incorrectly). To see this, try the following pair of classes: class MyBase { virtual public string Text { get { return "BaseText"; } } } class MyDerived : MyBase { public override string Text { get { string test = base.Text; return "DerivedText"; } } } Put a breakpoint on the last return statement, then run the code and access that property. In my VS2005, hovering over base.Text gives the value "DerivedText", but the variable test has been correctly set to "BaseText". So, new question: why does the debugger not handle base properly, and how can I get it to?

    Read the article

  • Memory fragmentation @ boost::asio ?

    - by Poni
    I'm pretty much stuck with a question I never got an answer for, a question which addresses an extremely important issue; memory fragmentation at boost::asio. Found nothing at the documentation nor here at SO. The functions at boost::asio, for example async_write() & async_read_some() always allocate something. (in my case it's 144 & 96 bytes respectively, in VC9 Debug build). How do I know about it? I connect a client to the "echo server" example provided with this library. I put a breakpoint at "new.cpp" at the code of "operator new(size_t size)". Then I send "123". Breakpoint is hit! Now using the stack trace I can clearly see that the root to the "new" call is coming from the async_write() & async_read_some() calls I make in the function handlers. So memory fragmentation will come sooner or later, thus I can't use ASIO, and I wish I could! Any idea? Any helpful code example?

    Read the article

  • What influences running time of reading a bunch of images?

    - by remi
    I have a program where I read a handful of tiny images (50000 images of size 32x32). I read them using OpenCV imread function, in a program like this: std::vector<std::string> imageList; // is initialized with full path to the 50K images for(string s : imageList) { cv::Mat m = cv::imread(s); } Sometimes, it will read the images in a few seconds. Sometimes, it takes a few minutes to do so. I run this program in GDB, with a breakpoint further away than the loop for reading images so it's not because I'm stuck in a breakpoint. The same "erratic" behaviour happens when I run the program out of GDB. The same "erratic" behaviour happens with program compiled with/without optimisation The same "erratic" behaviour happens while I have or not other programs running in background The images are always at the same place in the hard drive of my machine. I run the program on a Linux Suse distrib, compiled with gcc. So I am wondering what could affect the time of reading the images that much?

    Read the article

  • The Execute SQL Task

    In this article we are going to take you through the Execute SQL Task in SQL Server Integration Services for SQL Server 2005 (although it appies just as well to SQL Server 2008).  We will be covering all the essentials that you will need to know to effectively use this task and make it as flexible as possible. The things we will be looking at are as follows: A tour of the Task. The properties of the Task. After looking at these introductory topics we will then get into some examples. The examples will show different types of usage for the task: Returning a single value from a SQL query with two input parameters. Returning a rowset from a SQL query. Executing a stored procedure and retrieveing a rowset, a return value, an output parameter value and passing in an input parameter. Passing in the SQL Statement from a variable. Passing in the SQL Statement from a file. Tour Of The Task Before we can start to use the Execute SQL Task in our packages we are going to need to locate it in the toolbox. Let's do that now. Whilst in the Control Flow section of the package expand your toolbox and locate the Execute SQL Task. Below is how we found ours. Now drag the task onto the designer. As you can see from the following image we have a validation error appear telling us that no connection manager has been assigned to the task. This can be easily remedied by creating a connection manager. There are certain types of connection manager that are compatable with this task so we cannot just create any connection manager and these are detailed in a few graphics time. Double click on the task itself to take a look at the custom user interface provided to us for this task. The task will open on the general tab as shown below. Take a bit of time to have a look around here as throughout this article we will be revisting this page many times. Whilst on the general tab, drop down the combobox next to the ConnectionType property. In here you will see the types of connection manager which this task will accept. As with SQL Server 2000 DTS, SSIS allows you to output values from this task in a number of formats. Have a look at the combobox next to the Resultset property. The major difference here is the ability to output into XML. If you drop down the combobox next to the SQLSourceType property you will see the ways in which you can pass a SQL Statement into the task itself. We will have examples of each of these later on but certainly when we saw these for the first time we were very excited. Next to the SQLStatement property if you click in the empty box next to it you will see ellipses appear. Click on them and you will see the very basic query editor that becomes available to you. Alternatively after you have specified a connection manager for the task you can click on the Build Query button to bring up a completely different query editor. This is slightly inconsistent. Once you've finished looking around the general tab, move on to the next tab which is the parameter mapping tab. We shall, again, be visiting this tab throughout the article but to give you an initial heads up this is where you define the input, output and return values from your task. Note this is not where you specify the resultset. If however you now move on to the ResultSet tab this is where you define what variable will receive the output from your SQL Statement in whatever form that is. Property Expressions are one of the most amazing things to happen in SSIS and they will not be covered here as they deserve a whole article to themselves. Watch out for this as their usefulness will astound you. For a more detailed discussion of what should be the parameter markers in the SQL Statements on the General tab and how to map them to variables on the Parameter Mapping tab see Working with Parameters and Return Codes in the Execute SQL Task. Task Properties There are two places where you can specify the properties for your task. One is in the task UI itself and the other is in the property pane which will appear if you right click on your task and select Properties from the context menu. We will be doing plenty of property setting in the UI later so let's take a moment to have a look at the property pane. Below is a graphic showing our properties pane. Now we shall take you through all the properties and tell you exactly what they mean. A lot of these properties you will see across all tasks as well as the package because of everything's base structure The Container. BypassPrepare Should the statement be prepared before sending to the connection manager destination (True/False) Connection This is simply the name of the connection manager that the task will use. We can get this from the connection manager tray at the bottom of the package. DelayValidation Really interesting property and it tells the task to not validate until it actually executes. A usage for this may be that you are operating on table yet to be created but at runtime you know the table will be there. Description Very simply the description of your Task. Disable Should the task be enabled or not? You can also set this through a context menu by right clicking on the task itself. DisableEventHandlers As a result of events that happen in the task, should the event handlers for the container fire? ExecValueVariable The variable assigned here will get or set the execution value of the task. Expressions Expressions as we mentioned earlier are a really powerful tool in SSIS and this graphic below shows us a small peek of what you can do. We select a property on the left and assign an expression to the value of that property on the right causing the value to be dynamically changed at runtime. One of the most obvious uses of this is that the property value can be built dynamically from within the package allowing you a great deal of flexibility FailPackageOnFailure If this task fails does the package? FailParentOnFailure If this task fails does the parent container? A task can he hosted inside another container i.e. the For Each Loop Container and this would then be the parent. ForcedExecutionValue This property allows you to hard code an execution value for the task. ForcedExecutionValueType What is the datatype of the ForcedExecutionValue? ForceExecutionResult Force the task to return a certain execution result. This could then be used by the workflow constraints. Possible values are None, Success, Failure and Completion. ForceExecutionValue Should we force the execution result? IsolationLevel This is the transaction isolation level of the task. IsStoredProcedure Certain optimisations are made by the task if it knows that the query is a Stored Procedure invocation. The docs say this will always be false unless the connection is an ADO connection. LocaleID Gets or sets the LocaleID of the container. LoggingMode Should we log for this container and what settings should we use? The value choices are UseParentSetting, Enabled and Disabled. MaximumErrorCount How many times can the task fail before we call it a day? Name Very simply the name of the task. ResultSetType How do you want the results of your query returned? The choices are ResultSetType_None, ResultSetType_SingleRow, ResultSetType_Rowset and ResultSetType_XML. SqlStatementSource Your Query/SQL Statement. SqlStatementSourceType The method of specifying the query. Your choices here are DirectInput, FileConnection and Variables TimeOut How long should the task wait to receive results? TransactionOption How should the task handle being asked to join a transaction? Usage Examples As we move through the examples we will only cover in them what we think you must know and what we think you should see. This means that some of the more elementary steps like setting up variables will be covered in the early examples but skipped and simply referred to in later ones. All these examples used the AventureWorks database that comes with SQL Server 2005. Returning a Single Value, Passing in Two Input Parameters So the first thing we are going to do is add some variables to our package. The graphic below shows us those variables having been defined. Here the CountOfEmployees variable will be used as the output from the query and EndDate and StartDate will be used as input parameters. As you can see all these variables have been scoped to the package. Scoping allows us to have domains for variables. Each container has a scope and remember a package is a container as well. Variable values of the parent container can be seen in child containers but cannot be passed back up to the parent from a child. Our following graphic has had a number of changes made. The first of those changes is that we have created and assigned an OLEDB connection manager to this Task ExecuteSQL Task Connection. The next thing is we have made sure that the SQLSourceType property is set to Direct Input as we will be writing in our statement ourselves. We have also specified that only a single row will be returned from this query. The expressions we typed in was: SELECT COUNT(*) AS CountOfEmployees FROM HumanResources.Employee WHERE (HireDate BETWEEN ? AND ?) Moving on now to the Parameter Mapping tab this is where we are going to tell the task about our input paramaters. We Add them to the window specifying their direction and datatype. A quick word here about the structure of the variable name. As you can see SSIS has preceeded the variable with the word user. This is a default namespace for variables but you can create your own. When defining your variables if you look at the variables window title bar you will see some icons. If you hover over the last one on the right you will see it says "Choose Variable Columns". If you click the button you will see a list of checkbox options and one of them is namespace. after checking this you will see now where you can define your own namespace. The next tab, result set, is where we need to get back the value(s) returned from our statement and assign to a variable which in our case is CountOfEmployees so we can use it later perhaps. Because we are only returning a single value then if you remember from earlier we are allowed to assign a name to the resultset but it must be the name of the column (or alias) from the query. A really cool feature of Business Intelligence Studio being hosted by Visual Studio is that we get breakpoint support for free. In our package we set a Breakpoint so we can break the package and have a look in a watch window at the variable values as they appear to our task and what the variable value of our resultset is after the task has done the assignment. Here's that window now. As you can see the count of employess that matched the data range was 2. Returning a Rowset In this example we are going to return a resultset back to a variable after the task has executed not just a single row single value. There are no input parameters required so the variables window is nice and straight forward. One variable of type object. Here is the statement that will form the soure for our Resultset. select p.ProductNumber, p.name, pc.Name as ProductCategoryNameFROM Production.ProductCategory pcJOIN Production.ProductSubCategory pscON pc.ProductCategoryID = psc.ProductCategoryIDJOIN Production.Product pON psc.ProductSubCategoryID = p.ProductSubCategoryID We need to make sure that we have selected Full result set as the ResultSet as shown below on the task's General tab. Because there are no input parameters we can skip the parameter mapping tab and move straight to the Result Set tab. Here we need to Add our variable defined earlier and map it to the result name of 0 (remember we covered this earlier) Once we run the task we can again set a breakpoint and have a look at the values coming back from the task. In the following graphic you can see the result set returned to us as a COM object. We can do some pretty interesting things with this COM object and in later articles that is exactly what we shall be doing. Return Values, Input/Output Parameters and Returning a Rowset from a Stored Procedure This example is pretty much going to give us a taste of everything. We have already covered in the previous example how to specify the ResultSet to be a Full result set so we will not cover it again here. For this example we are going to need 4 variables. One for the return value, one for the input parameter, one for the output parameter and one for the result set. Here is the statement we want to execute. Note how much cleaner it is than if you wanted to do it using the current version of DTS. In the Parameter Mapping tab we are going to Add our variables and specify their direction and datatypes. In the Result Set tab we can now map our final variable to the rowset returned from the stored procedure. It really is as simple as that and we were amazed at how much easier it is than in DTS 2000. Passing in the SQL Statement from a Variable SSIS as we have mentioned is hugely more flexible than its predecessor and one of the things you will notice when moving around the tasks and the adapters is that a lot of them accept a variable as an input for something they need. The ExecuteSQL task is no different. It will allow us to pass in a string variable as the SQL Statement. This variable value could have been set earlier on from inside the package or it could have been populated from outside using a configuration. The ResultSet property is set to single row and we'll show you why in a second when we look at the variables. Note also the SQLSourceType property. Here's the General Tab again. Looking at the variable we have in this package you can see we have only two. One for the return value from the statement and one which is obviously for the statement itself. Again we need to map the Result name to our variable and this can be a named Result Name (The column name or alias returned by the query) and not 0. The expected result into our variable should be the amount of rows in the Person.Contact table and if we look in the watch window we see that it is.   Passing in the SQL Statement from a File The final example we are going to show is a really interesting one. We are going to pass in the SQL statement to the task by using a file connection manager. The file itself contains the statement to run. The first thing we are going to need to do is create our file connection mananger to point to our file. Click in the connections tray at the bottom of the designer, right click and choose "New File Connection" As you can see in the graphic below we have chosen to use an existing file and have passed in the name as well. Have a look around at the other "Usage Type" values available whilst you are here. Having set that up we can now see in the connection manager tray our file connection manager sitting alongside our OLE-DB connection we have been using for the rest of these examples. Now we can go back to the familiar General Tab to set up how the task will accept our file connection as the source. All the other properties in this task are set up exactly as we have been doing for other examples depending on the options chosen so we will not cover them again here.   We hope you will agree that the Execute SQL Task has changed considerably in this release from its DTS predecessor. It has a lot of options available but once you have configured it a few times you get to learn what needs to go where. We hope you have found this article useful.

    Read the article

  • strange problem when placing UILabels on UITableView and calling reloadData

    - by user262325
    Hello everyone I hope to list all files in a directory to an UITableView atableview There are files in Document directory a.txt b.txt F (folder) c.txt in folder F, there are 2 files M.exe N.exe When I change to folder F, it should display on atableview M.exe N.exe but Result is in F, it displayed b.txt F the codes are shown as below -(void) removeACell:(NSInteger)row; { NSUInteger _lastSection = 0;//[self numberOfSectionsInTableView:atableview]; NSUInteger _lastRow =row;// [atableview numberOfRowsInSection:_lastSection] - 1; NSUInteger _path[2] = {_lastSection, _lastRow}; NSIndexPath *_indexPath = [[NSIndexPath alloc] initWithIndexes:_path length:2]; NSArray *_indexPaths = [[NSArray alloc] initWithObjects:_indexPath, nil]; [_indexPath release]; [atableview deleteRowsAtIndexPaths:_indexPaths withRowAnimation:UITableViewRowAnimationBottom]; [_indexPaths release]; } -(void) reloadDirectory { if([fileArray count]>0) { NSInteger n=fileArray.count; for(int i=n-1;i>=0;i--) { [fileArray removeObjectAtIndex: i]; [self removeACell:i]; } } NSFileManager *manager = [NSFileManager defaultManager]; NSLog(@"*******************" ); NSLog(@"ffff%@",[self appDelegate].gCurrentPath_AppDelegate); for(NSString *path in [manager contentsOfDirectoryAtPath:[self appDelegate].gCurrentPath_AppDelegate error:nil]) { NSDictionary *modData= [manager attributesOfItemAtPath: [appDelegate.gCurrentPath_AppDelegate //directory of files stringByAppendingPathComponent:path ] error:nil ]; NSDate * dateModified=(NSDate *) [modData objectForKey:NSFileModificationDate]; NSNumber *fileSize=[modData objectForKey:NSFileSize] ; if(dateModified) { FileObj *newobj=[[FileObj alloc] init ]; [ newobj seta:1]; NSString *ss=[[NSString alloc] initWithFormat:@"%@",path] ; [newobj setfileName:ss]; NSLog(@"---------------%@",ss); BOOL isDir; [manager fileExistsAtPath:[appDelegate.gCurrentPath_AppDelegate stringByAppendingPathComponent:path ] isDirectory:&isDir]; [newobj setisDirectory: isDir ]; [newobj setfilePath:@"1"]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"EEE MMM dd HH:mm:ss zzz yyyy"]; NSString *stringFromDate =[[NSString alloc] initWithString: [formatter stringFromDate:dateModified]]; [newobj setfileDate:stringFromDate]; [formatter release]; NSString * fileSize1= [[NSString alloc] initWithFormat:@"%d",[fileSize integerValue] ]; [newobj setfileSize: fileSize1]; [ fileArray addObject:newobj]; [newobj release]; }; [atableview reloadData]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSInteger row=[indexPath row]; NSInteger section=[indexPath section]; static NSString *SimpleTableIdentifier1 = @"CellTableIdentifier"; UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier1 ]; int newRow = [indexPath row]; selectIndex=newRow; if(cell==nil) { //**breakpoint AAA here** CGRect cellframe=CGRectMake(0, 0, 300, 60); cell=[[[UITableViewCell alloc] initWithFrame:cellframe reuseIdentifier:SimpleTableIdentifier1] autorelease]; if ([[fileArray objectAtIndex:row] getisDirectory]) { UIImage *image = [UIImage imageNamed:@"folder.png"]; cell.imageView.image = image; } else { UIImage *image = [UIImage imageNamed:@"files.png"]; cell.imageView.image = image; } cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton; ///-------------------------------------------------------- UILabel *b1 =[ [UILabel alloc]init]; b1.frame = CGRectMake(40.9f,8.0f,250.0f,20.0f) ; [b1 setBackgroundColor:[UIColor clearColor]]; [b1 setTag:(row+15000)]; //------------------------------------------------------- UILabel *b2 =[ [UILabel alloc]init]; b2.frame = CGRectMake(40.9f,30.0f,250.0f,13.0f) ; [b2 setBackgroundColor:[UIColor clearColor]]; [b2 setTag:row+16000]; [b2 setFont:[UIFont systemFontOfSize:10.0]]; //------------------------------------------------ UILabel *b3 =[ [UILabel alloc]init]; b3.frame = CGRectMake(40.9f,45.0f,250.0f,13.0f) ; [b3 setBackgroundColor:[UIColor clearColor]]; [b3 setFont:[UIFont systemFontOfSize:10.0]]; [b3 setTag:row+17000]; [cell.contentView addSubview:b1]; [cell.contentView addSubview:b2]; [cell.contentView addSubview:b3]; [b1 release]; [b2 release]; [b3 release]; }; if([fileArray count]>0) //check if fileArray is correct { NSLog(@"___________________" ); for (int i=0;i<[fileArray count];i++) { NSLog(@"->%@",[[fileArray objectAtIndex:i] getfileName] ); } } UILabel *tem1UILabel=(UILabel*)[cell.contentView viewWithTag:row+15000]; NSString *s1=[[NSString alloc] initWithFormat: [[fileArray objectAtIndex:row] getfileName] ]; NSLog(@"--->%@",s1 ); tem1UILabel.text=s1; [s1 release]; UILabel *tem2UILabel=(UILabel*)[cell.contentView viewWithTag:row+16000]; NSString *s2=[[NSString alloc] initWithFormat: [[fileArray objectAtIndex:row] getfileDate] ]; tem2UILabel.text=s2; [s2 release]; UILabel *tem3UILabel=(UILabel*)[cell.contentView viewWithTag:row+17000]; NSString *s3=[[NSString alloc] initWithFormat: [[fileArray objectAtIndex:row] getfileSize]]; tem3UILabel.text=s3; [s3 release]; return cell; } I set the breakpoint at AAA and found that when I loaded folder F, my application did stop at the breakpoint. But I have removed all cells in atableview before call 'reloadData'. I checked the content of fileArray which is the data source of atableview and found that everything is correct except the display on atableview. Welcome any comment. Thanks interdev

    Read the article

  • TDD and WCF behavior

    - by Frederic Hautecoeur
    Some weeks ago I wanted to develop a WCF behavior using TDD. I have lost some time trying to use mocks. After a while i decided to just use a host and a client. I don’t like this approach but so far I haven’t found a good and fast solution to use Unit Test for testing a WCF behavior. To Implement my solution I had to : Create a Dummy Service Definition; Create the Dummy Service Implementation; Create a host; Create a client in my test; Create and Add the behavior; Dummy Service Definition This is just a simple service, composed of an Interface and a simple implementation. The structure is aimed to be easily customizable for my future needs.   Using Clauses : 1: using System.Runtime.Serialization; 2: using System.ServiceModel; 3: using System.ServiceModel.Channels; The DataContract: 1: [DataContract()] 2: public class MyMessage 3: { 4: [DataMember()] 5: public string MessageString; 6: } The request MessageContract: 1: [MessageContract()] 2: public class RequestMessage 3: { 4: [MessageHeader(Name = "MyHeader", Namespace = "http://dummyservice/header", Relay = true)] 5: public string myHeader; 6:  7: [MessageBodyMember()] 8: public MyMessage myRequest; 9: } The response MessageContract: 1: [MessageContract()] 2: public class ResponseMessage 3: { 4: [MessageHeader(Name = "MyHeader", Namespace = "http://dummyservice/header", Relay = true)] 5: public string myHeader; 6:  7: [MessageBodyMember()] 8: public MyMessage myResponse; 9: } The ServiceContract: 1: [ServiceContract(Name="DummyService", Namespace="http://dummyservice",SessionMode=SessionMode.Allowed )] 2: interface IDummyService 3: { 4: [OperationContract(Action="Perform", IsOneWay=false, ProtectionLevel=System.Net.Security.ProtectionLevel.None )] 5: ResponseMessage DoThis(RequestMessage request); 6: } Dummy Service Implementation 1: public class DummyService:IDummyService 2: { 3: #region IDummyService Members 4: public ResponseMessage DoThis(RequestMessage request) 5: { 6: ResponseMessage response = new ResponseMessage(); 7: response.myHeader = "Response"; 8: response.myResponse = new MyMessage(); 9: response.myResponse.MessageString = 10: string.Format("Header:<{0}> and Request was <{1}>", 11: request.myHeader, request.myRequest.MessageString); 12: return response; 13: } 14: #endregion 15: } Host Creation The most simple host implementation using a Named Pipe binding. The GetBinding method will create a binding for the host and can be used to create the same binding for the client. 1: public static class TestHost 2: { 3: 4: internal static string hostUri = "net.pipe://localhost/dummy"; 5:  6: // Create Host method. 7: internal static ServiceHost CreateHost() 8: { 9: ServiceHost host = new ServiceHost(typeof(DummyService)); 10:  11: // Creating Endpoint 12: Uri namedPipeAddress = new Uri(hostUri); 13: host.AddServiceEndpoint(typeof(IDummyService), GetBinding(), namedPipeAddress); 14:  15: return host; 16: } 17:  18: // Binding Creation method. 19: internal static Binding GetBinding() 20: { 21: NamedPipeTransportBindingElement namedPipeTransport = new NamedPipeTransportBindingElement(); 22: TextMessageEncodingBindingElement textEncoding = new TextMessageEncodingBindingElement(); 23:  24: return new CustomBinding(textEncoding, namedPipeTransport); 25: } 26:  27: // Close Method. 28: internal static void Close(ServiceHost host) 29: { 30: if (null != host) 31: { 32: host.Close(); 33: host = null; 34: } 35: } 36: } Checking the service A simple test tool check the plumbing. 1: [TestMethod] 2: public void TestService() 3: { 4: using (ServiceHost host = TestHost.CreateHost()) 5: { 6: host.Open(); 7:  8: using (ChannelFactory<IDummyService> channel = 9: new ChannelFactory<IDummyService>(TestHost.GetBinding() 10: , new EndpointAddress(TestHost.hostUri))) 11: { 12: IDummyService svc = channel.CreateChannel(); 13: try 14: { 15: RequestMessage request = new RequestMessage(); 16: request.myHeader = Guid.NewGuid().ToString(); 17: request.myRequest = new MyMessage(); 18: request.myRequest.MessageString = "I want some beer."; 19:  20: ResponseMessage response = svc.DoThis(request); 21: } 22: catch (Exception ex) 23: { 24: Assert.Fail(ex.Message); 25: } 26: } 27: host.Close(); 28: } 29: } Running the service should show that the client and the host are running fine. So far so good. Adding the Behavior Add a reference to the Behavior project and add the using entry in the test class. We just need to add the behavior to the service host : 1: [TestMethod] 2: public void TestService() 3: { 4: using (ServiceHost host = TestHost.CreateHost()) 5: { 6: host.Description.Behaviors.Add(new MyBehavior()); 7: host.Open();¨ 8: …  If you set a breakpoint in your behavior and run the test in debug mode, you will hit the breakpoint. In this case I used a ServiceBehavior. To add an Endpoint behavior you have to add it to the endpoints. 1: host.Description.Endpoints[0].Behaviors.Add(new MyEndpointBehavior()) To add a contract or an operation behavior a custom attribute should work on the service contract definition. I haven’t tried that yet.   All the code provided in this blog and in the following files are for sample use. Improvements I don’t like to instantiate a client and a service to test my behaviors. But so far I have' not found an easy way to do it. Today I am passing a type of endpoint to the host creator and it creates the right binding type. This allows me to easily switch between bindings at will. I have used the same approach to test Mex Endpoints, another post should come later for this. Enjoy !

    Read the article

  • Remote Debug Windows Azure Cloud Service

    - by Shaun
    Originally posted on: http://geekswithblogs.net/shaunxu/archive/2013/11/02/remote-debug-windows-azure-cloud-service.aspxOn the 22nd of October Microsoft Announced the new Windows Azure SDK 2.2. It introduced a lot of cool features but one of it shocked most, which is the remote debug support for Windows Azure Cloud Service (a.k.a. WACS).   Live Debug is Nightmare for Cloud Application When we are developing against public cloud, debug might be the most difficult task, especially after the application had been deployed. In order to minimize the debug effort, Microsoft provided local emulator for cloud service and storage once the Windows Azure platform was announced. By using local emulator developers could be able run their application on local machine with almost the same behavior as running on Windows Azure, and that could be debug easily and quickly. But when we deployed our application to Azure, we have to use log, diagnostic monitor to debug, which is very low efficient. Visual Studio 2012 introduced a new feature named "anonymous remote debug" which allows any workstation under any user could be able to attach the remote process. This is less secure comparing the authenticated remote debug but much easier and simpler to use. Now in Windows Azure SDK 2.2, we could be able to attach our application from our local machine to Windows Azure, and it's very easy.   How to Use Remote Debugger First, let's create a new Windows Azure Cloud Project in Visual Studio and selected ASP.NET Web Role. Then create an ASP.NET WebForm application. Then right click on the cloud project and select "publish". In the publish dialog we need to make sure the application will be built in debug mode, since .NET assembly cannot be debugged in release mode. I enabled Remote Desktop as I will log into the virtual machine later in this post. It's NOT necessary for remote debug. And selected "advanced settings" tab, make sure we checked "Enable Remote Debugger for all roles". In WACS, a cloud service could be able to have one or more roles and each role could be able to have one or more instances. The remote debugger will be enabled for all roles and all instances if we checked. Currently there's no way for us to specify which role(s) and which instance(s) to enable. Finally click "publish" button. In the windows azure activity window in Visual Studio we can find some information about remote debugger. To attache remote process would be easy. Open the "server explorer" window in Visual Studio and expand "cloud services" node, find the cloud service, role and instance we had just published and wanted to debug, right click on the instance and select "attach debugger". Then after a while (it's based on how fast our Internet connect to Windows Azure Data Center) the Visual Studio will be switched to debug mode. Let's add a breakpoint in the default web page's form load function and refresh the page in browser to see what's happen. We can see that the our application was stopped at the breakpoint. The call stack, watch features are all available to use. Now let's hit F5 to continue the step, then back to the browser we will find the page was rendered successfully.   What Under the Hood Remote debugger is a WACS plugin. When we checked the "enable remote debugger" in the publish dialog, Visual Studio will add two cloud configuration settings in the CSCFG file. Since they were appended when deployment, we cannot find in our project's CSCFG file. But if we opened the publish package we could find as below. At the same time, Visual Studio will generate a certificate and included into the package for remote debugger. If we went to the azure management portal we will find there will a certificate under our application which was created, uploaded by remote debugger plugin. Since I enabled Remote Desktop there will be two certificates in the screenshot below. The other one is for remote debugger. When our application was deployed, windows azure system will open related ports for remote debugger. As below you can see there are two new ports opened on my application. Finally, in our WACS virtual machine, windows azure system will copy the remote debug component based on which version of Visual Studio we are using and start. Our application then can be debugged remotely through the visual studio remote debugger. Below is the task manager on the virtual machine of my WACS application.   Summary In this post I demonstrated one of the feature introduced in Windows Azure SDK 2.2, which is Remote Debugger. It allows us to attach our application from local machine to windows azure virtual machine once it had been deployed. Remote debugger is powerful and easy to use, but it brings more security risk. And since it's only available for debug build this means the performance will be worse than release build. Hence we should only use this feature for staging test and bug fix (publish our beta version to azure staging slot), rather than for production.   Hope this helps, Shaun All documents and related graphics, codes are provided "AS IS" without warranty of any kind. Copyright © Shaun Ziyan Xu. This work is licensed under the Creative Commons License.

    Read the article

  • Does the use of debuggers have an effect on the efficiency of programmers? [closed]

    - by alain.janinm
    Possible Duplicate: Are debugging skills important to become a good programmer? I'm a young Java developer and I make a systematic use of the Netbeans debugger. In fact, I often develop my applications when I debug step by step in order to see immediately if my code works. I feel spending a lot of time programming this way because the use of debugger increase execution time and I often wait for my app to jump from a breakpoint to an other (so much that I've the time to ask this question). I never learned to use a debugger at school, but at work I've been told immediately to use this functionality. I started teaching myself to use it two years ago, and I've never been told any key tips about it. I'd like to know if there are some rules to follow in order to use the debugger efficiently. I'm also wondering if using the debugger is eventually a good practice? Or is it a loss of time and I've to stop now this bad habit?

    Read the article

  • If Expression True in Immediate Window But Code In if Block Never Runs

    - by Julian
    I set a break point in my code in MonoDevelop to break whenever I click on a surface. I then enter the immediate window and test to see if the the if statement will return true in comparing two Vector3's. It does return true. However, when I step over, the code is never run as though the statement evaluated false. Does anyone know how this could be possible? I've attached a screenshot. Here is the picture of my debug window and immediate window. You can see where the immediate window evaluates to true. The second breakpoint is not hit. Here are the details of the two Vector3's I am comparing. Does anyone know why I am experiencing this? It really seems like an anomaly to me :/ Does it have something to do with threading?

    Read the article

  • Internet Explorer 8 developer tools debugging on Windows XP

    - by Suresh Behera
    Although , Microsoft officially not going support Windows XP  but still many healthcare companies preferred to use windows XP internally. They buy windows 7 laptop and convert to Windows XP.This sounds funny but it true. I was trying to use IE’s Developer tools(F12) to debug one of JavaScript issue found that “jscript.dll” has to be registered explicitly    to your machine. even if i have IE8 and javsascript enabled on browser it was not stopping on breakpoint. Solution : register...(read more)

    Read the article

  • Tip #15: How To Debug Unit Tests During Maven Builds

    - by ByronNevins
    It must be really really hard to step through unit tests in a debugger during a maven build.  Right? Wrong! Here is how i do it: 1) Set up these environmental variables: MAVEN_OPTS=-Xmx1024m -Xms256m -XX:MaxPermSize=512mMAVEN_OPTS_DEBUG=-Xmx1024m -Xms256m -XX:MaxPermSize=512m  -Xdebug (no line break here!!)  -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9999MAVEN_OPTS_REG=-Xmx1024m -Xms256m -XX:MaxPermSize=512m 2) create 2 scripts or aliases like so:  maveny.bat: set MAVEN_OPTS=%MAVEN_OPTS_DEBUG% mavenn.bat: set MAVEN_OPTS=%MAVEN_OPTS_REG%    To debug do this: run maveny.bat run mvn install attach your debugger to port 9999 (set breakpoints of course) When maven gets to the unit test phase it will hit your breakpoint and wait for you. When done debugging simply run mavenn.bat Notes If it takes a while to do the build then you don't really need to set the suspend=y flag. If you set the suspend=n flag then you can just leave it -- but only one maven build can run at a time because of the debug port conflict.

    Read the article

  • What are you using the debugger for? [closed]

    - by Peter Gfader
    Some scenarios that I can think of: Reading/Understanding code Understanding the flow (what happens when) Stop program and see where it is up to a. Attach debugger b. Exception -- Debug Discover API Run to breakpoint and verify state The question got closed on SO, so I ask here... http://stackoverflow.com/questions/6462461/what-do-you-use-the-debugger-for What are you using the debugger for? Which scenario did you ran into, that you needed the debugger? Could you have done it differently?

    Read the article

  • Visual Studio 2010 blurry font

    - by John Doe
    I'm using Visual C# 2010 Express (final, not beta or anything) and I'm having an issue with blurry fonts while debugging. The font appears normal everywhere (intellisense, menus, code) but when a breakpoint is reached most of the debugger related text is blurry (Locals, Call Stack, "data tooltips"). Here are screenshots of the normal text and the blurry text while debugging: http://img682.imageshack.us/i/normalh.png/ http://img145.imageshack.us/i/blurry.png/ Is this a known bug or something related to my system? Is there a way to fix it?

    Read the article

  • How to view Session Variables in Visual Studio 2008 Debugger?

    - by davemackey
    Usually using Visual Studio's debugger is a breeze. Scanning through Locals quickly shows the values of variables, etc. However, I'm at a loss how to find out the values contained in session state variables? Can anyone give me a hand? Lets say I put a breakpoint right after: Session("first_name") = "Rob Roy" How do I view the value contained in Session("first_name") from locals?

    Read the article

  • Firebug not breaking on errors

    - by stormdrain
    Hi. I reinstalled Firefox today, because... whatever. I reinstalled firebug, therefully, and now when I try to use it, it's all different. I believe it is the same version I had before. In fact, I even went digging through my trash and replaced the new firebug with the one I removed with the old Firefox. They ended up being the same version (1.5.3). My issue is, when I have an error in my script somewhere, it used to be that if on the script pane of firebug, the script would break on the error, and the script page would go to the offending line, highlighted, and all was right with the world. Now, it logs the error in the console, and that's it. I've spent the better part of the last hour trying to convince myself this isn't worth an ulcer; I am losing the battle, though. I've searched Google, put ads on Craigslist, even thought about becoming a cop. There were some examples on the Firebug dox, but none of them helped. A bunch of old references to a mysterious (break on all errors) option; an option which I think I might have set by accident--there is a little red circle-slash on my pause button (that's what she said), but there the script continues, all on its own. There was a guide somewhere on the firebug pages that spoke of setting the breakpoint next to the error in the console. I, however, don't have this option for some reason. The line of code is there in the console, but no breakpoint button next to it. This, however, would not be ideal even if it worked. I liked it when I could have the script page open, and if there were errors it would jump to that line. I could try to fix it, and re-load the page. If that line was fixed, GREAT, on to the next error on the page -- which would be highlighted and ready. I would like to offer a solicitation of help. Help.

    Read the article

  • gdb : multithreading

    - by Arpit
    Hi Wish to know that I have a program which uses two threads I have put the break point in both the threads. While running the program under gdb I want to switch between the threads and make them run. (thread t1 is active and running and thread t2 hold on the breakpoint I want to stop T1 running and run the T2) Is there any way that I can schedule the threads in gdb. Thanks Arpit

    Read the article

  • Debug using MbUnit/Gallio 3.1

    - by user314096
    When I use the [Debug] button in Gallio, the breakpoints in my unit tests are not hitting. The unit tests are written with MbUnit/Gallio. I am using MbUnit/Gallio version 3.1 build 397 with Visual Studio 2010 Beta 2. The unit tests run to completion in Gallio Icarus, but they run past the breakpoints. I see the symbol tables loading in VS, but it does not stop at the expected breakpoint, so I am unable to debug it.

    Read the article

  • NSString copy not copying?

    - by Scotty Allen
    NSString *myString = @"sample string"; NSString *newString = [NSString stringWithString: myString]; If I set a breakpoint after these two lines, the pointer for myString is the same as the pointer for newString. WTF? Isn't NSString copy supposed to return a pointer to a new object? Or am I missing something fundamental about how copy is supposed to work?

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >