Friday, July 30, 2010

Blocks in Objective C (Update)

Soo as it turns out! The blocks, only work with the arm compiler! Which means you can't even compile the code for your simulator unless you get a 3rd party non-apple GCC compiler. So I think everyone would agree only two words come to mind when updating to a third party compiler.. "F**K THAT!"

On the bright side, I found that there is a foreach loop! Go figure its a mix of C# and Java.

So in java its:
for ( Object obj : objectList) {

in C# its:
foreach ( Object obj in objectList) {

in Objective-C its:
for( Object obj in objectList ) {
[obj doStuff];

Way to fail apple.. way to fail.

Monday, July 19, 2010

iPhone Dev

It's been a while since I wrote anything, so I feel compelled to write a little after reading my friend's blog. I'm not as eloquent as other people, but its fun to try :)

So lately I've been working with the iPhone SDK pretty exclusively when it comes to at home programming. I've found a lot of interesting classes, and I've ever so slowly been re-creating my XNA font engine and refactoring all my code to be nice and neat. When I first started with objective-c it was a nightmare. Everything is so different and ugly, but slowly I'm getting used to it. I already found delegates and function pointer equivalents which is great cuz it really makes some patterns much easier to implement.

None the less, development goes slowly, I worked out a pretty functional level generating algorithm which is great because its a step closer to the end goal. I let some people try my game at dinner today but they all agreed "A game you can't lose at isn't all that fun". So I'm starting to reconsider the whole "Never die" mentality I was going to go with for this game. Perhaps some burning lava pits and sharks are in order... Everyone loves sharks... or pandas... hmm. Something to think about =)

In the mean time, lets talk a little bit about those Objective-C function pointers. They are called Blocks. In the example below I will do Strategy Pattern using a function pointer block. Blocks are sadly are extremely over complicated (as is everything in Objective-C), so to make life easier it's recommended to use typedefs:

typedef void(^BasicBlock)(id);
Breaking down that syntax:

typdef --ReturnType--(^--BlockName--)(--Params--);

Then where you want to use your method you do something like:

-(void) Iterate:(BasicBlock) theStratYouWishToUse;

Then in the definition we need to actually do something with that function like call it:

-(void) Iterate:(BasicBlock) theStratYouWishToUse 
NSEnumerator * enumerator = [ spriteList objectEnumerator ];
id obj;

while ( obj = [enumerator nextObject] )


So that takes care of defining it, and calling it, but how do we create the block to pass it into our object? Remember, we have to worry about garabage collection and all that good jazz, but Apple's SDK has some stuff for that =)

BasicBlock myBlock = [[^ (id obj)
[obj doSomethingAwesome];

} copy] autorelease];

The copy and autorelease are methods that apple added, onto the block, the block syntax is:
BlockType blockObjectName = [[^--paramList-- { stuff... } copy] autorelease];

After that, you just pass ur block around like it was an object:

[SpriteList Iterate: blockObjectName ];

Thats basically it, if you had a return type, you'd just return it at the end of ur method, and you're all set =)

Anyway, there's my tech for the day, hopefully that helps someone out there one day =)

Tuesday, June 22, 2010

VP8, H.264

So after reading

I've come to the conclusion that VP8, isn't all that and the bag of chips that Google seems to make it out to be. I compiled the SDK and tried using it, but no matter what I do, I can't get past the extremely annoying Quality Popping that the author talks about. I noticed it immediately, and it wasn't until reading his analysis that I realized what he's talking about.

From a patent free point of view... The author seems to know a lot about the h.264 codec and seems to be quite capable of code analysis, from his observations, he seems to feel that VP8 is very similar to h.264 from a conceptual point of view, minus the fact that they took out the features that make h.264 so good. This makes me feel like the only way that google can improve the quality is to be more like h.264 which suggests that it will be closer to patent infringement! But if they leave it as is, its just not good enough, and STILL likely to get sued for patent infringement!

Soo I think Theora is still a good alternative... It sucks SOO bad that no one will even care to sue it even if it does mildly infringe patents, and it at very least doesn't suffer from that incredibly annoying quality popping artifact!

In short... I almost feel like Google is using VP8 to incite a patent war and possibly get the news out there that software patents are evil. Maybe VP8 can be a weapon to help bring down the endless struggle between developer and patent lawyer and patent land mines. If we destory software patents, h.264 becomes what it should be.. free for anyone to implement their own way. The idea that the IDEA of a good video encoder/decoder is something someone can be sued for even if they coded it themselves in a dark room w/ no internet and no other references... Its just stupid. Now if someone took the code and copied it exactly... ya.. they should get sued ( thats copyright ).

Sunday, March 29, 2009

HP TX 1000 Series Laptops with Nvidia 6150 and ITunes Videos in Quicktime

I downloaded a movie from Itunes recently and no matter what I did, the movies refused to play back on my HP TX 1215NR laptop. It would start playing but then Quicktime would crash with some kind of BEX event error.  Right before the crash the movie would get pixelated and distorted and then crash.  At first I suspected it was the NVidia 6150 video drivers which are custom made for HP and promise "HARDWARE H.264 playback".  

Because of the ANNOYING DRM apple puts on the movie, I could not even try playing it back in anything other than Quicktime, so I thought maybe its just the Quicktime Player having a hard time with it. 

I looked for a solution for months, but finally after searching some forums I ran across this solution, and it wasn't the video driver, it was the SATA HD driver!
  1. Right click "Computer" and select properties.
  2. Open IDE ATA/ATAPI Controllers.
  3. Loctate the NVidia controllers.
  4. Right click it and select Update Driver.
  5. Click "Browse my computer for driver software".
  6. Click "Let me pick from a list of device drivers on my computer".
  7. Ensure that "Show compatible hardware" is checked.
  8. Select  "Standard Dual Channel PCI IDE Controller".
  9. Open "System Devices".
  10. Select one by one each of the NVidia Items, and repeat the above.
  11. This time Select "Standard PCI Ram Controller".
  12. When you are done, you will have 2 nVidia controllers left that don't have standard components. Thats ok.
  13. Restart.
After you restart your laptop should be able to play the content w/ no problems!  However, my laptop was just plain not able to keep up with the HD movies, but the normal res movies ran fantastic after this.


Source:  Apple Forums

Saturday, March 28, 2009

Lord of the Rings Online Welcome Back Weekend


So this weekend since Lord Of The Rings was free for anyone who played once before, I decided I'd jump back in and see if things had changed much. Last time I played I tried a Minstril? And I didn't really have any fun at all.

This time around I wanted to try the RuneKeeper, but since they only restored my account to its old state, I don't get the Moria stuff, so I went with the Hunter. It seems that just like World Of Warcraft, the hunter is overpowered. It's almost impossible to die, and everything is one shotted. No pet though.

My first minute in the game, I walk up to right click on the Introduction NPC in RivenDell, and of course I misclick, which causes my incredible range to shoot an arrow at a swarm of bees in the distance. Being completely lost in how to control my character, and seemingly missing every swing I'm fighting a killer swarm of level 2 bees on the steps next to the intro NPC who is supposed to help me start the game. She's just standing there watching me be swarmed by a killer batch of bees...

Eventually I got the bees down and started the quest lines. I figured I'd practice on the target dummies a bit, and figured out how to use the hunter. After that it was all about one shotting everything, bugs, insects, flies, slugs, rats, goblins, etc. With the extra XP this weekend I was level 5 within minutes. I finished the Introduction quests and set out to Celondim after a brief run thru a cave which seemed to transport me many many miles in a few seconds for no particular reason I seem to be now on an epic quest to get back to where I started?

While in Celondim I picked up cooking, which seemed to be an assinine profession that is very over complicated for the sake of trying to be real. Make some pie crusts, which I can then use to make Mushroom pie, I can buy all the ingredients which makes leveling the profession easy, and I get a SET number of skill points which is nice! Unlike wow's Random point generation for every item made. But I couldn't buy the mushrooms.. You would think that should be the easiest thing to buy, but its just not there!! And why do I have to equip my cookware?

By the end of the night I got to level 10, and now things seem to be getting harder, I die when overpowered by 2 or more mobs at one time. I am completely flat broke after learning how to wear better armor.

Overall, my impressions are that they are trying to be like WoW where ever they can, but then at the same time they are trying to put in way too much realism. The graphics feel very real, which makes it very hard to notice what is a tree, and what is an enemy!! Oh and don't bother using DX10, there is Z - fighting EVERYWHERE, the sky stops working for some reason as well. The profressions are so overcomplicated for no good reason other than to be annoying I guess.

On top of that I've become very used to my mods and addons for WoW, like Carbonite or Quest Helper, which make playing wow a lot easier, I always know where to go. And it feels like I'm using a Google Map for everything. I don't have to stop and read the quest only to find that the directions were completely incorrect. "Go NorthWest of Celondim", which lead me to a dead end, so it turned out to be North-NorthWest. But you had to actually go really far north first because there is a pointless hill placed going directly northwest which prevents you from getting anywhere. I mean why can't the quest giver take a moment to draw a little arrow on my map?! Age of Conan does this just fine! "Excuse me miss, I have a map here, do you think you could draw where exactly these evil insects are?" "Oh no I can't, ink hasn't been invented yet" "Oh its okay, use my blood, I'm a hunter afterall."

And with all this realism, why the hell am I suddenly ALLOWED to jump off cliffs w/ no penality other than being forced to walk super slow for 1 minute? I mean its nice, since dieing in WoW from falling off a cliff on accident is annoying, but it doesn't fit with the rest of their attempts at realism!!

So all in all, its a fun game, but they've still got a lot of changes to make to make it as fun as WoW. Good attempt though!! They definately put a lot of heart into the art and the design.

Tuesday, July 8, 2008

Awesome /. quote

As a recovering coder (I've been code free for 12 years) I can tell you that once a coder is addicted to a particular language changing languages is the equivalent of cutting off one of your limbs. Withdrawal symptoms can be severe and disruptive including the shakes, paranoia, and a condition that strikingly resembles turrets syndrome. There have been coders in recent years that appear to be able to switch languages with relative ease but studies on these coders have not been conducted and it is suspected that they could go off in a fit of rage at any moment and should be approached with extreme trepidation.

Wednesday, March 26, 2008

Software Patents

Since there is some really stupid minor patent reform thing going on. I found this quote to be pretty much where I stand on the matter:

John Carmack (id Software) - 2005
"In the majority of cases in software, patents [affect] independent invention. Get a dozen sharp programmers together, give them all a hard problem to work on, and a bunch of them will come up with solutions that would probably be patentable, and be similar enough that the first programmer to file the patent could sue the others for patent infringement. Why should society reward that? ... The programmer that filed the patent didn't work any harder because a patent might be available, solving the problem was his job and he had to do it anyway. ... Yes, it is a legal tool that may help you against your competitors, but I'll have no part of it. It's basically mugging someone."


Friday, February 15, 2008

Top 10 List of things I hate about java.

1. No good IDE support
2. Nested classes are mis-named (public static class???)
3. No Operater Overloading
4. Swing (Speaks for itself)
5. No way to create a value type
6. JNI - Hard to use, annoying, and difficult to marshal.
7. NIO buffers - You cannot ever force memory collection, they seem to leak very easily. Tend to lead to:
8. Java out of memory errors (All too common) - Even on production servers!
9. Fonts - You can never get an accurate metric (Its always off by a few pixels)
10. JVM Garbage Collection - Go ahead and try to garbage collect a Built up JTree... It won't happen.

11. You can't even do math with the Box'ed versions of Integer, Double, Float, etc.
12. You cannot do a non-virtual call, its always virtual.
13. Generics are just auto casts.

This list was requested by
By the way, these weakness's are some of c#'s strengths in my opinion.

I swear I'll try to get some useful posts soon! Got to talk about fonts and stuff still.

Monday, November 26, 2007

Little known Java Features

I just found this out myself...
On windows, should your class path ever exceed 32,768 characters... you can't run your application anymore!!

Don't ask why I know this. Just rest assured, class paths suck.

Monday, November 5, 2007

Unrelated again

Dennis: For a second i was like "whoa chuck norris has his own brand of power generators... kick ass"

I'd buy it...

Friday, June 29, 2007

More Java

I'm not a fan of java, I too often find myself doing this:

I promise to I will get back to pointful blogs soon! Just venting java issues :)