Is there ever a good time to use int32 instead of sint32 in Google Protocol Buffers?

I’m not familiar with Google Protocol Buffers, but my interpretation of the documentation is: use uint32 if the value cannot be negative use sint32 if the value is pretty much as likely to be negative as not (for some fuzzy definition of “as likely to be”) use int32 if the value could be negative, but … Read more

Objective C Boolean Array

Yep, that’s exactly what it is: the NS* containers can only store objective-C objects, not primitive types. You should be able to accomplish what you want by wrapping it up in an NSNumber: [updated_users replaceObjectAtIndex:index withObject:[NSNumber numberWithBool:YES]] or by using @(YES) which wraps a BOOL in an NSNumber [updated_users replaceObjectAtIndex:index withObject:@(YES)]] You can then pull … Read more

One-byte bool. Why?

Why does a bool require one byte to store true or false where just one bit is enough Because every object in C++ must be individually addressable* (that is, you must be able to have a pointer to it). You cannot address an individual bit (at least not on conventional hardware). How much safer is … Read more

How do I draw lines using XNA?

When working with XNA, everything (even 2d primitives) have to be expressed in a way that a 3d card can understand, which means that a line is just a set of vertices. MSDN has a pretty good walkthrough here: http://msdn.microsoft.com/en-us/library/bb196414.aspx#ID2EEF You’ll find that it takes more code to render a primitive line than it would … Read more

Integer.class vs int.class

Integer.class is, as you say, a reference to the Class object for the Integer type. int.class is, similarity, a reference to the Class object for the int type. You’re right that this doesn’t sound right; the primitives all have a Class object as a special case. It’s useful for reflection, if you want to tell … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)