Search Results

Search found 2069 results on 83 pages for 'anonymous delegates'.

Page 31/83 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • NSUndoManager grouping problem?

    - by anonymous
    I'm working on a barebones drawing app. I'm attempting to implement undo/redo capability, so I tell the view's undoManager to save the current image before updating the display. This works perfectly (yes, I understand that redrawing/saving the entire view is not incredibly efficient, but to solve this problem before attempting to optimize the code). However, as expected, when I 'undo' or 'redo', only the minute change is reflected. My goal is to have the whole finger stroke undone/redone. To do that, I told the undoManager to [beginUndoGrouping] in the [touchesBegan] method, and to [endUndoGrouping] in [touchesEnded]. That works for a bit, but after drawing a few strokes, the app crashes, and gdb exits with exc_bad_access. I'm very grateful for any insight you can give me. - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { mouseDragged = YES; currentPoint = [[touches anyObject] locationInView:self]; UIGraphicsBeginImageContext(drawingImageView.bounds.size); [drawingImageView.image drawInRect:drawingImageView.bounds]; CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetLineCap(ctx, kCGLineCapRound); CGContextSetLineWidth(ctx, drawingWidth); [drawingColor setStroke]; CGContextBeginPath(ctx); CGContextMoveToPoint(ctx, previousPoint.x, previousPoint.y); CGContextAddLineToPoint(ctx, currentPoint.x, currentPoint.y); CGContextStrokePath(ctx); [self.undoManager registerUndoWithTarget:drawingImageView selector:@selector(setImage:) object:drawingImageView.image]; drawingImageView.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); previousPoint = currentPoint; }

    Read the article

  • What is the new name of Microsoft.Data.Entity.Ctp?

    - by Anonymous Coward
    Hello Everyone I'm playing around with Entity Framework 4 and code only. The tutorial I'm following is using the Beta-Version of Visual Studio 2010 and is referring to Microsoft.Data.Entity.Ctp. Since I'm working with the final release of Visual Studio the name of the dll must have changed. Can somebody tell me how its name is now? Cheers, AC

    Read the article

  • C#: IComparable implementation private

    - by Anonymous Coward
    Hello I'm new to C# so this might be a really dump question: I implemented IComparable in my class and want to test it with NUnit. But the CompareTo-Method is marked as private and thus not accessible from the test. What's the reason for this and how can I fix this? The IComparable: public class PersonHistoryItem : DateEntity,IComparable { ... int IComparable.CompareTo(object obj) { PersonHistoryItem phi = (PersonHistoryItem)obj; return this.StartDate.CompareTo(phi.StartDate); } } The test: [TestMethod] public void TestPersonHistoryItem() { DateTime startDate = new DateTime(2001, 2, 2); DateTime endDate = new DateTime(2010, 2, 2); PersonHistoryItem phi1 = new PersonHistoryItem(startDate,endDate); PersonHistoryItem phi2 = new PersonHistoryItem(startDate, endDate); Assert.IsTrue(phi1.CompareTo(phi2)==0); }

    Read the article

  • C question: Padding bits in unsigned integers and bitwise operations (C89)

    - by Anonymous Question Guy
    I have a lot of code that performs bitwise operations on unsigned integers. I wrote my code with the assumption that those operations were on integers of fixed width without any padding bits. For example an array of 32 bit unsigned integers of which all 32 bits available for each integer. I'm looking to make my code more portable and I'm focused on making sure I'm C89 compliant (in this case). One of the issues that I've come across is possible padded integers. Take this extreme example, taken from the GMP manual: However on Cray vector systems it may be noted that short and int are always stored in 8 bytes (and with sizeof indicating that) but use only 32 or 46 bits. The nails feature can account for this, by passing for instance 8*sizeof(int)-INT_BIT. I've also read about this type of padding in other places. I actually read of a post on SO last night (forgive me, I don't have the link and I'm going to cite something similar from memory) where if you have, say, a double with 60 usable bits the other 4 could be used for padding and those padding bits could serve some internal purpose so they cannot be modified. So let's say for example my code is compiled on a platform where an unsigned int type is sized at 4 bytes, each byte being 8 bits, however the most significant 2 bits are padding bits. Would UINT_MAX in that case be 0x3FFFFFFF (1073741823) ? #include <stdio.h> #include <stdlib.h> /* padding bits represented by underscores */ int main( int argc, char **argv ) { unsigned int a = 0x2AAAAAAA; /* __101010101010101010101010101010 */ unsigned int b = 0x15555555; /* __010101010101010101010101010101 */ unsigned int c = a ^ b; /* ?? __111111111111111111111111111111 */ unsigned int d = c << 5; /* ?? __111111111111111111111111100000 */ unsigned int e = d >> 5; /* ?? __000001111111111111111111111111 */ printf( "a: %X\nb: %X\nc: %X\nd: %X\ne: %X\n", a, b, c, d, e ); return 0; } is it safe to XOR two integers with padding bits? wouldn't I XOR whatever the padding bits are? I can't find this behavior covered in C89. furthermore is the c var guaranteed to be 0x3FFFFFFF or if for example the two padding bits were both on in a or b would c be 0xFFFFFFFF ? same question with d and e. am i manipulating the padding bits by shifting? I would expect to see this below, assuming 32 bits with the 2 most significant bits used for padding, but I want to know if something like this is guaranteed: a: 2AAAAAAA b: 15555555 c: 3FFFFFFF d: 3FFFFFE0 e: 01FFFFFF Also are padding bits always the most significant bits or could they be the least significant bits? Thanks guys EDIT 12/19/2010 5PM EST: Christoph has answered my question. Thanks! I had also asked (above) whether padding bits are always the most significant bits. This is cited in the rationale for the C99 standard, and the answer is no. I am playing it safe and assuming the same for C89. Here is specifically what the C99 rationale says for §6.2.6.2 (Representation of Integer Types): Padding bits are user-accessible in an unsigned integer type. For example, suppose a machine uses a pair of 16-bit shorts (each with its own sign bit) to make up a 32-bit int and the sign bit of the lower short is ignored when used in this 32-bit int. Then, as a 32-bit signed int, there is a padding bit (in the middle of the 32 bits) that is ignored in determining the value of the 32-bit signed int. But, if this 32-bit item is treated as a 32-bit unsigned int, then that padding bit is visible to the user’s program. The C committee was told that there is a machine that works this way, and that is one reason that padding bits were added to C99. Footnotes 44 and 45 mention that parity bits might be padding bits. The committee does not know of any machines with user-accessible parity bits within an integer. Therefore, the committee is not aware of any machines that treat parity bits as padding bits. EDIT 12/28/2010 3PM EST: I found an interesting discussion on comp.lang.c from a few months ago. Bitwise Operator Effects on Padding Bits (VelocityReviews reader) Bitwise Operator Effects on Padding Bits (Google Groups alternate link) One point made by Dietmar which I found interesting: Let's note that padding bits are not necessary for the existence of trap representations; combinations of value bits which do not represent a value of the object type would also do.

    Read the article

  • How do I change the color settings in emacs23 running in a terminal emulator?

    - by Anonymous
    I use xterm and set its appearance in ~/.Xdefaults: XTerm*background: paleTurquoise XTerm*foreground: black I also use emacs, but set its appearance differently in ~/.emacs: (set-background-color "black") (set-foreground-color "yellow") I usually run emacs within the terminal emulator with emacs -nw, rather than creating a separate X window. For some reason, this doesn't work properly for emacs23; instead, emacs retains the pale turquoise background of my xterm window. Looking at what's new in emacs23, I noted that: ** When running in a new enough xterm (newer than version 242), Emacs asks xterm what the background color is and it sets up faces accordingly for a dark background if needed (the current default is to consider the background light). So it's a feature, not a bug? Anyway, is there some way that I can I tell emacs23 to ignore the xterm background settings when running in console mode, and use the settings in ~/.emacs instead? I'll also note that: It works fine in emacs23 running in a separate X window (without the -nw option). It worked fine in emacs22; and I'm not really sure whether I need to use emacs23... Running M-x set-background-color within emacs23 -nw has no effect. It's not just xterm: the same problem exists with $TERM=cygwin, for example.

    Read the article

  • Using jquery append() in <head> (in a function/class)

    - by Anonymous
    I want to use the append() function from inside the <head>, in a function to be specific, like so: function custom_img(src_img) { $("div").append("<img src='"+src_img+"'>"); } var myimg = new custom_img("test.jpg"); This is a quick example that I just wrote out. I want my function to make a new image like that every time I create a new object like this. Obviously this doesn't work, since the append() requires to be in the body (I've tried this). How would I do this?

    Read the article

  • How to implement Template Inheritance (like Django?) in PHP5

    - by anonymous coward
    Is there an existing good example, or how should one approach creating a basic Template system (thinking MVC) that supports "Template Inheritance" in PHP5? For an example of what I define as Template Inheritance, refer to the Django (a Python framework for web development) Templates documentation: http://docs.djangoproject.com/en/dev/topics/templates/#id1 I especially like the idea of PHP itself being the "template language", though it's not necessarily a requirement. If listing existing solutions that implement "Template Inheritance", please try to form answers as individual systems, for the benefit of 'popular vote'.

    Read the article

  • Is there any way to monitor the number of CAS stackwalks that are occurring?

    - by Anonymous
    I'm working with a time sensitive desktop application that uses p/invoke extensively, and I want to make sure that the code is not wasting a lot of time on CAS stackwalks. I have used the SuppressUnmanagedCodeSecurity attribute where I think it is necessary, but I might have missed a few places. Does anyone know if there is a way to monitor the number of CAS stackwalks that are occurring, and better yet pinpoint the source of the security demands?

    Read the article

  • Advice on improving programming skills, learning capabilities?

    - by anonymous-coward1234
    Hi all, After 2,5 years of professional Java programing, I still have problems that make my job difficult and, more importantly - more times that I would like to admit - not enjoyable. I would like to ask for advice by more experienced people on ways that would help me overcome them. These are the problems I have: I do not absorb new knowledge easily. Even when I understand something, after a couple of days I easily forget even basic stuff. Other co-workers, even with the same working experience, when reading new technologies put things easily into "context", and are able to compare in "real time| similar technologies they already have used. I always try to address all the issues to whatever I am doing at one go, which results in me trying to resolve too many problems at the same time, losing completely control. I find it difficult to make my mind on a single problem that I should address first, and even when I do, and find myself throwing away code that I wrote because I started addressing the wrong issue first. As far as architecture and data modeling is concerned, I have difficulty making decisions on what objects must be created, with what hierarchy, interfaces, abstraction etc. I imagine that - to a certain degree - these things come with experience. But after 2,5 years of Java programming, I would expect myself to have come much farther that I have come, both in terms of absorption and experience. Is there a way to improve my learning speed? Any books, methods, advice is welcome.

    Read the article

  • iphone tableview multilevel

    - by Anonymous
    Hi, I 'm a iphone programming newbie. I m trying to implement an app with multi-level tableviews. The idea is if someone selects something on the first screen say then a new view opens(tableview) car make> list of models Honda > Acura, S2000,accord ... My challenge is to show the list of models in a new tableview & secondly change the size of hte list depending on the car selected. I have programmed so that when i select 'Honda' a new tableview opens. How do i populate data for the second table?? Any suggestions on how to proceed? thanks

    Read the article

  • BitBlting multiple images to buffer

    - by Anonymous
    So I've made a class which draws a transparant image to a buffer. the buffer is a HDC which has been used blackness on. What I am trying to do is draw three images to this buffer. Which means I am using this function three times. After that's done, I output it to the screen (using SRCCOPYing the buffer). But what I get to see is just the third image and blackness. void draw_buffer(HDC buffer, int draw_x, int draw_y) { BitBlt(this-main, draw_x, draw_y, this-img_width, this-img_height, this-image, this-mask_x, this-mask_y, SRCAND); BitBlt(this-main, draw_x, draw_y, this-img_width, this-img_height, this-image, this-img_x, this-img_y, SRCPAINT); BitBlt(buffer, 0, 0, 800, 600, this-main, 0, 0, SRCCOPY); } At initiation, this-main becomes this: this->main = CreateCompatibleDC(GetDC(0)); this->bitmap = CreateCompatibleBitmap(GetDC(0),800,600); SelectObject(this->main, this->bitmap); What is wrong with my code?

    Read the article

  • URL Slugs: Redirects or 404s?

    - by anonymous coward
    Some sites, like here at SO, allow 'bogus' slugs in the URL. Before implementing URL slugs on my site, I have a question of 'best practices'... Given a structure like example.com/123/article-slug-here/, if my site allows bogus slugs by querying on the ID - Should I ... just do a redirect to the appropriate/canonical URL (verifying the slug, and redirecting in case of a mismatch)? -or- return a 404, since technically example.com/123/this-article-s-u-x doesn't exist?

    Read the article

  • How do I change the color settings in emacs23 running in a terminal console?

    - by Anonymous
    I use xterm and set its appearance in ~/.Xdefaults: XTerm*background: paleTurquoise XTerm*foreground: black I also use emacs, but set its appearance differently in ~/.emacs: (set-background-color "black") (set-foreground-color "yellow") I usually run emacs within the terminal console with emacs -nw, rather than creating a separate X window. For some reason, this doesn't work properly for emacs23; instead, emacs retains the pale turquoise background of my xterm window. Looking at what's new in emacs23, I noted that: ** When running in a new enough xterm (newer than version 242), Emacs asks xterm what the background color is and it sets up faces accordingly for a dark background if needed (the current default is to consider the background light). So it's a feature, not a bug? Anyway, is there some way that I can I tell emacs23 to ignore the xterm background settings when running in console mode, and use the settings in ~/.emacs instead? I'll also note that: Running M-x set-background-color within emacs23 -nw has no effect. It works fine in emacs23 running in a separate X window (without the -nw option). It worked fine in emacs22; and I'm not really sure whether I need to use emacs23... It's not just xterm: the same problem exists with $TERM=cygwin, for example.

    Read the article

  • Update one-to-many EntityKey using Foreign Key

    - by User.Anonymous
    To use by the easiest way Entity Framework, I use partial class to add Foreign Key on most important Entities Model. For example, I have an Entity "CONTACT" which have "TITLE", "FUNCTION" and others. When I update a CONTACT, with this code, Foreign Key are automatically updated : public int? TitId { get { if (this.TITLE_TIT != null) return TITLE_TIT.TIT_ID; return new Nullable<int>(); } set { this.TITLE_TITReference.EntityKey = new System.Data.EntityKey("Entities.TITLE_TIT", "TIT_ID", value); } } But I have a join with ACTIVITY, that can have many CONTACT, and I don't know how to update EntityKey on setters. public IEnumerable<EntityKeyMember> ActId { get { List<EntityKeyMember> lst = new List<EntityKeyMember>(); if (this.ACT_CON2 != null) { foreach (ACT_CON2 id in this.ACT_CON2.ToList()) { EntityKeyMember key = new EntityKeyMember(id.CON_ID.ToString(),id.ACT_ID); lst.Add(key); } } return lst; } set { this.ACT_CON2.EntityKey = new System.Data.EntityKey("Entities.ACT_CON2", value); } } How set many EntityKey ? Thank you.

    Read the article

  • What should I use for a Perl script's shebang line?

    - by Anonymous
    Which of these is better or faster to use as the shebang line for a Perl script? #! perl #! perl.exe #! fullpath/perl(/perl.exe) #! partialpath/perl(/perl.exe) And, when using #!perl, when it works on a particular system, how do I find out in the script which perl interpreter I'm using so I can put that one into the shebang line? And, if using a /path/path/perl, are "*" or "..." allowed to be used for the folders?

    Read the article

  • Jquery UI modal dialogs

    - by Anonymous user
    Hi All. I have a problem with Jquery UI modal dialogs. I have modal dialog (dialogA), which can create another modal dialog (dialogB). After the second creation and closure of the dialogB the overlay of dialogA disappear. Here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head><link type="text/css" rel="Stylesheet" href="ui-lightness/jquery-ui-1.8.custom.css" /> <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript" src="jquery-ui-1.8.custom.min.js"></script> <script type="text/javascript"> function createDialog(dialogId) { $('#' + dialogId).dialog({ autoOpen: true, modal: true, buttons: { 'close': function() { $(this).dialog('close'); }, 'create': function() { var newDialogId = dialogId + '1'; $('body').append('<div id="' + newDialogId + '">' + newDialogId + '</div>'); createDialog(newDialogId); } }, close: function() { $(this).dialog('destroy'); $(this).remove(); } }); } $(document).ready(function() { $('#button1').click(function() { var dialogId = 'dialog'; $('body').append('<div id="' + dialogId + '">' + dialogId + '</div>'); createDialog(dialogId); }); }); </script> </head> <body> <button id="button1">Create dialog</button> </body> </html> Thanks

    Read the article

  • iphone using 2 tableview

    - by Anonymous
    Hi, I 'm a iphone programming newbie. I m trying to implement an app with multi-level tableviews. The idea is if someone selects something on the first screen say then a new view opens(tableview) car make> list of models Honda > Acura, S2000,accord ... My challenge is to show the list of models in a new tableview & secondly change the size of hte list depending on the car selected. I have programmed so that when i select 'Honda' a new tableview opens. How do i populate data for the second table?? Any suggestions on how to proceed? thanks

    Read the article

  • postgresql: Fast way to update the latest inserted row

    - by Anonymous
    What is the best way to modify the latest added row without using a temporary table. E.g. the table structure is id | text | date My current approach would be an insert with the postgresql specific command "returning id" so that I can update the table afterwards with update myTable set date='2013-11-11' where id = lastRow However I have the feeling that postgresql is not simply using the last row but is iterating through millions of entries until "id = lastRow" is found. How can i directly access the last added row?

    Read the article

  • Entity Framework: Generating database from classes

    - by Anonymous Coward
    Hi Everyone Is it possible to create the database from the classes with entity framework 4.0? I found many tutorials on how to do it the other way round. But since we have already implemented and tested all classes of the domain we'd like to avoid changing them to much. If I used the wrong keywords in Google I'd appreciate you could post a link. Cheers, CA

    Read the article

  • iphone tableview & webservice

    - by Anonymous
    Hi, I have a tableview, when the user selects a row i call a webservice depending on which row is selected. my problem is i can connect to the webservice but i dont get any response from the webservice. I used soap client to test if webservice is working correctly or not. //rootviewcontroller.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {.... //call to webservice [self connectToWebService]; } On debugging i found that my code does not go to any of the following methods -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *) response{} -(void) connection:(NSURLConnection *) connection didReceiveData:(NSData *) data {} -(void) connection:(NSURLConnection *) connection didFailWithError:(NSError *) error{} -(void) connectionDidFinishLoading:(NSURLConnection *) connection {} any suggestions where am i going wrong??? thanks

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >