Dread Pirate PJ's House of Hacks and Tricks » gadgets http://www.pjtrix.com/blawg Sat, 23 Aug 2014 19:46:15 +0000 en-US hourly 1 https://wordpress.org/?v=4.2.29 iPhone Development on Windows & Linux with open source tools http/blawg/2009/07/21/iphone-development-on-windows-linux-with-open-source-tools/ http/blawg/2009/07/21/iphone-development-on-windows-linux-with-open-source-tools/#comments Tue, 21 Jul 2009 19:10:57 +0000 http/blawg?p=168 Continue reading ]]> Yesterday I presented at OSCON 2009. I spoke about how to use Eclipse and the iPhone-dev team’s GCC cross-compiler to develop for iPhone on Windows & Linux. I also spoke about XMLVM, an open source project that lets you develop in Java for Android and deploy on iPhone or Palm WebOS.

You can download the slides and program examples here.

To get started with open source iPhone development, you can download the open source toolchain for Linux or for Windows/Cygwin.

Note: To use the toolchain, you need to obtain the iPhone OS headers, frameworks and libraries. You can jailbreak your device and extract the frameworks and libraries using SSH, or you can decrypt the firmware and extract the framework and libraries from the decrypted disk image. The binaries you need are /System/Library/Frameworks and /usr/lib .

You can download the headers from the iPhone-dev team’s Subversion repository with svn co http://iphone-dev.googlecode.com/svn/branches/include-1.2-sdk

To use the iPhone-dev team’s headers, you need headers for Mac OS X 10.4 SDK. Then you type this at the command line:

cd /path/to/iphone-dev/svn/branches/include-1.2-sdk
./configure --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk

sudo bash install-headers.sh

Or you can extract them from the official iPhone SDK. :-)

Once you get the binaries and headers, move them to /usr/local/iphone-sysroot/ . The headers go in /usr/local/iphone-sysroot/usr/include/ , frameworks go in /usr/local/iphone-sysroot/System/Library/Frameworks/ , and libraries in /usr/local/iphone-sysroot/usr/lib/ .

Then to compile and link, set CFLAGS and LDFLAGS like below :

export CFLAGS=-I/usr/local/lib/gcc/arm-apple-darwin9/4.2.1/include \
-isysroot /usr/local/iphone-sysroot

export LDFLAGS=-framework CoreFoundation -framework Foundation \
-framework UIKit -lobjc -bind_at_load -isysroot /usr/local/iphone-sysroot

Then use these compile and linker commands :

/usr/local/bin/arm-apple-darwin9-gcc -c $(CFLAGS) main.c HelloWorld.m

/usr/local/bin/arm-apple-darwin9-gcc $(LDFLAGS) HelloWorld.o main.o \
-o HelloWorld

The easiest way to set this up for each project is in a makefile. Look in the HelloWorld example in the zip file with the slides for an example.

]]>
http/blawg/2009/07/21/iphone-development-on-windows-linux-with-open-source-tools/feed/ 13
My first book is finally a go! Woo hoo! http/blawg/2009/06/04/my-first-book-is-finally-a-go-woo-hoo/ http/blawg/2009/06/04/my-first-book-is-finally-a-go-woo-hoo/#comments Fri, 05 Jun 2009 02:04:43 +0000 http/blawg?p=135 Continue reading ]]> From February to April, I was working evenings and weekends fulfilling a dream I’ve had for many decades: writing a book about a subject I really care about: game development. On June 22 2009, Apress is publishing a book I collaborated on as lead author and tech reviewer : iPhone Games Projects.

Book cover

There are chapters by :

  1. Olivier Hennessy & Clayton Kane, of Posimotion, developers of Bikini Hunt and Apache Lander
  2. Joachim Bondo, of Cocoa Stuff; developer of Deep Green, a beautiful chess game for iPhone
  3. Richard Zito & Matthew Aitken, of Swipe Interactive, developers of QuickDraw and Pole2Pole
  4. Aaron Fothergill, of Strange Flavour, developer of Flick Sport Fishing, one of the top 20 best selling apps on the App Store
  5. Brian Greenstone, of Pangea Software, developer of Enigmo and Cro-Mag Rally, two of the top 5 best selling apps on the App Store
  6. Mike Kasprzak, of Sykhronics Entertainment; his game Smiles was one of the finalists for Best Mobile Game on the IGF Mobile 2009 competition
  7. Mike Lee, co-founder of Tapulous, now at Apple, lead developer of Tap Tap Revenge, the most downloaded game on the history of the App Store
  8. And a bonus free chapter by Jamie Gotch, of Subatomic Studios, developers of Fieldrunners, winner of Best Mobile Game on the IGF Mobile 2009 competition

As tech reviewer for the book, I checked everyone’s writing for technical accuracy. That was really a great experience. I learned a lot and had fun running everyone’s sample code and checking their tips and tricks for myself.

I also wrote one chapter for the book, on how to implement RESTful web services for high score leaderboards and achievements on iPhone. There’s code in the chapter for a simple Rails web service, and native code for the iPhone as well. It’s a rather deep look at the subject.

I also collaborated with Jamie Gotch on a bonus free chapter. In the chapter we discussed getting started with programming for iPhone, a few tips and tricks, and the A* path finding algorithm. I also developed a Puyo clone and explained the most important parts of the code.

Full source code for the Puyo game will be provided. There is also source code for 3 other sample apps. All the sample code will be made available the same day as the book release at the book’s support page and at apress.com

This was a very neat experience for me. I’ve wanted to have my name on a computer book, and I’ve enjoyed programming games in my spare time, since before I was a teenager (more than 30 years ago, yo! Where has time gone?)

The iPhone gives me, and everyone with the interest, a chance to develop games for others, in a very cool platform with lots of traction. This book, coupled with Beginning iPhone Development, can give you the tools to reach for the stars with your own creations! Enjoy!

]]>
http/blawg/2009/06/04/my-first-book-is-finally-a-go-woo-hoo/feed/ 5
Obligatory WordPress upgrade post #10101010 and other rumblings at Chez PJ http/blawg/2008/11/28/obligatory-wordpress-upgrade-post-10101010-and-other-rumblings-at-chez-pj/ http/blawg/2008/11/28/obligatory-wordpress-upgrade-post-10101010-and-other-rumblings-at-chez-pj/#comments Sat, 29 Nov 2008 03:24:53 +0000 http/blawg?p=122 Continue reading ]]> So today I updated WordPress to 2.6.5. And like every other time, it was a cinch, all over and done in less than five minutes. Thanks, WordPress guys!

In other news, I have been geeking out with both the iPhone SDK and the Android SDK, and I believe I have a little something special going here. I hope to have it ready for release, on both platforms, sometime in January. Development continues.

I will need beta testers soon. Any T-Mobile G1 users interested in helping out, you can email me at dreadpiratepj [at] gmail [dot] com

Speaking of Android, I started playing with it now that the source code to the whole thing has been released. I managed to get Android booting on a Palm TX, but it still needs a lot of work. It boots, but it doesn’t do crap once it boots. :-)

I get all the way to the “Press the MENU key to unlock” screen, but none of the keys do anything. Neither does touching the screen. It’s an issue with the Linux kernel drivers and device configuration. It just wasn’t made to run on a Palm TX without proper tweaking of the source. I just don’t know what the proper tweaking is.

I need to look in my bag of loot for a Palm serial cable (I’m sure I have one somewhere) and hopefully I can get a serial console from which to poke around inside Android.

I do have Android running successfully on my Sprint Touch (my parents, my sister and I have a family plan on Sprint.) Credit for that goes to Dr. Martin Johnson in New Zeland. I just use his release on my phone (before you ask, no, his release doesn’t work on the Palm TX. It’s the first thing I tried. :-)

]]>
http/blawg/2008/11/28/obligatory-wordpress-upgrade-post-10101010-and-other-rumblings-at-chez-pj/feed/ 0
Can You Hear The Wind Blow http/blawg/2008/10/24/can-you-hear-the-wind-blow/ http/blawg/2008/10/24/can-you-hear-the-wind-blow/#comments Sat, 25 Oct 2008 00:08:21 +0000 http/blawg?p=97 Continue reading ]]>

Photo by liferfe.

The mobile software market is becoming very exciting, and I’ve been watching with interest. I’ve been learning iPhone development for the last ten months, first with the jailbreak toolchain, and in the last six months with the official SDK. Likewise, I’ve been dabbling with the Android SDK.

Many people have compared the growth of mobile software in the last year to the amazing growth of the early PC era.

One difference from those years, is that mobile software is already mainstream. The “personal computer” took about 20 years to “catch on,” from the introduction of the Apple I in 1977, to the Windows boom of the mid-90s. In contrast, Apple has sold over 10 million iPhones in the last 11 months alone. There are few consumers that aren’t at least aware of the iPhone’s existence. T-Mobile sold about a million Android-powered G1 phones in only one month of pre-sale orders from existing T-Mobile customers. The device can now be ordered online for new and existing accounts, although demand is expected to be very high, causing possible shortages. They claim they can sell another million G1 phones between now and the end of the year.

Another difference is the barrier to entry. Computers cost thousands of dollars in the 1980s, and were not as easy to use and develop for at the beginning. To be a developer back then, you had to be a computer engineer or someone with previous software development experience on mainframes or minicomputers, which at the time was not as widespread knowledge as in these dime-a-dozen-MCSD days. The barrier to entry was very high, economically and educationally. The barrier to entry for iPhone and Android development is very low, with devices available for less than $200 USD. If you already develop software, be it for the web, intranets, or desktops, you already have most of the skills, and a computer with which to develop. So the cost of development tools and training for these platforms is very low, especially for Android. How come it is lower for Android development, you ask?

To develop for the iPhone App Store, you need to already own a Mac with Leopard 10.5.4. So if you don’t have a Mac, that’s an extra expense. With Android, you can use the computer you already have. To put your application on the iPhone App Store, you need to pay $99 USD + tax to Apple and submit your application and say please and cross your eyes and dot your tease (double pun intended, if perhaps lame.) You can sell Android apps from the trunk of your car at a flea market if you want, but to sell them on the Android Market you need to pay $25 USD, although there is no validation or approval process. For either iPhone or Android, you need to buy a device to test on real hardware and make sure things run well.

Of course, you can always develop iPhone software for the iPhone jailbreak community, using the computer you already own, without having to pay anyone a cent, nor having to seek permission. You will still need a device on which to test on, which brings you up to par with Android in terms of barrier to entry. But then you’d be limiting your market to the 20 to 30 % of iPhone users who jailbreak their device. 200,000 – 300,000 and growing is not a bad number of potential users, though. Many of today’s software giants were founded when PC user numbers were much lower.

Anyhow, I digress. My point is that just like I heard the call of the wild and left full-time employment in a Java consulting shop for freelance web work in Rails nearly three years ago, I hear the winds of change and opportunity roaring by. And I want to get my kite out and test the wind.

As you can see, I’ve researched the market. I’m going to cut back on freelance web projects, to start dedicating time to developing a growing stable of ad-supported and for pay mobile apps, for both iPhone and Android. I can bootstrap this effort and support myself for two years on only a small portion of my savings. I believe there is enough growth in the mobile apps market to make back my investment and grow it a little bit. The monetary barrier to entry is so low, the only risk is time and effort lost if things don’t work out. If that happens, I can always go back to what I did before. But I’m not going to forgive myself if I don’t try this.

There will be other related news soon. :-) Meanwhile, enjoy the breeeeezeeeee. Ha ha!

Song “Can You Hear The Wind Blow”, by Whitesnake

]]>
http/blawg/2008/10/24/can-you-hear-the-wind-blow/feed/ 1
Rush Concert Photos http/blawg/2008/04/12/rush-concert-photos/ http/blawg/2008/04/12/rush-concert-photos/#comments Sat, 12 Apr 2008 20:34:15 +0000 http/blawg/2008/04/12/rush-concert-photos/ Continue reading ]]> On Friday, April 11, 2008, I went to see Rush open their 2008 Snakes and Arrows concert tour at Coliseo de Puerto Rico, San Juan, PR. I had an awesome time with my pals Alejandro, Cesar and Kevin. We were seated about six rows from the stage.

There were a couple of guys from the Philadelphia suburbs right next to us. Some guy from Dallas, TX was two rows ahead of us, and was stranded in PR because of the American Airlines fiasco.

The concert was awesome, three hours of great live music. Truly the best live performance I’ve seen in ages. There was a six minute drum solo by Neil Peart, that was just amazing.

I took my iPhone to use as a camera, knowing digital cameras per se were not allowed. I used an iPhone application called Snapture. This great little app is made for “jailbroken” iPhones. That is, iPhones that have been modified to load and run applications not “blessed” by Apple.

You’ll notice that some pictures are blurry/shakey, followed by two steady, clear ones. Snapture has an optional feature where it takes three pictures within a second or so of each other. This helps you steady the phone and get at least one clear shot.

I took 1426 photos. Yeah, that’s right, 1426 photos. I did this by using the 3-consecutive-shots feature of Snapture, pushing the volume button to trigger the photo capture twice per minute or so.

Set 1 of photos is here.

Set 2 of photos is here.

Each ZIP file contains 713 photos and is less than 260MB.

The pictures I’m uploading are totally unprocessed. They’re right off of the iPhone at 1600×1200 resolution.

I started deleting blurry pictures, and pictures where the stage was too dark or too bright and lacking contrast. But there are so many pictures to go through, I eventually decided not to bother.

The last 250+ pictures are in black and white. I think my finger slipped at some point, and I touched one of Snapture’s on-screen controls. Sorry about that!

]]>
http/blawg/2008/04/12/rush-concert-photos/feed/ 3
Continuing the conversation: PS3 Linux & MS XNA http/blawg/2007/01/23/continuing-the-conversation-ps3-linux-ms-xna/ http/blawg/2007/01/23/continuing-the-conversation-ps3-linux-ms-xna/#comments Tue, 23 Jan 2007 18:56:49 +0000 http/blawg/2007/01/23/continuing-the-conversation-ps3-linux-ms-xna/ Continue reading ]]> Mateusz, Lenny, thanks for the comments.

Update: Reader Mateusz points out that there is an effort under way to port the XNA frameworks to other platforms using Mono. It’s great to see what the subversive, creative types come up with all on their own. It would be hilarious if PS3 owners could run XNA games by simply booting Linux. Take that, Redmond! Welcome to our social. LMAO!

My own take is that Sony is taking a laissez-faire approach, a la Franklin D. Roosevelt and the economy: let’s provide the tools, and whatever happens, happens. Let the market take it where it may. (I hope I am not embarrassing Mrs. Freite, my history teacher in high school, by mixing my economic strategies and presidents.)

While that is great, I think they could be a bit more proactive. They could encourage garage game development with the PS3 Linux project, by marketing it as such. A program like the old PSX Net Yaroze, but with PS3s and Linux, could attract some great talent. (See? Sony has been thinking about this garage developer thing for quite a long time.)

IBM and Toshiba see this as another marketing venue for the Power processor line, especially the work on the Cell Engine that they did. Toshiba only promotes Cell within its embedded processor market, not putting an oar in to help with the garage developer thing. IBM is a bit more active, but only within their established promotional circles: developerWorks and alphaWorks. And it is hardly a big push.

Microsoft is, of course, going all out, promoting XNA as a garage developer’s haven, especially generating excitement with the possibility of garage developers selling games on XBox Live Marketplace for both PC and XBox360. In my opinion, MS is doing a better job at pushing their ideas.

It’s like IBM and Sony don’t quite see what it is they have to do, having just provided the tools and sitting back to see what develops. While it’s great they’re not stirring the pot too much, the stew is gonna ruin if there’s no cook minding the stove.

OK, that’s enough analogies for today. Thanks for keeping the conversation going, guys. Comment away, and let’s keep talking. Anyone else have any thoughts to share?

Technorati Tags:
, , , , , , , , , ,

]]>
http/blawg/2007/01/23/continuing-the-conversation-ps3-linux-ms-xna/feed/ 4
What’s the deal with PS3 Linux? Simple: XNA http/blawg/2007/01/22/whats-the-deal-with-ps3-linux-simple-xna/ http/blawg/2007/01/22/whats-the-deal-with-ps3-linux-simple-xna/#comments Mon, 22 Jan 2007 19:34:37 +0000 http/blawg/2007/01/22/whats-the-deal-with-ps3-linux-simple-xna/ Continue reading ]]> Programming high-performance applications on the Cell BE processor, Part 1: An introduction to Linux on the PlayStation 3

The Sony PlayStation 3 (PS3) is the easiest and cheapest way for programmers to get their hands on the new Cell Broadband Engine (Cell BE) processor and take it for a drive. Discover what the fuss is all about, how to install Linux on the PS3, and how to get started developing for the Cell BE processor on the PS3.

Let’s ignore the $600 USD “cheapest” flame bait and concentrate on the business significance of Sony and IBM providing and promoting Linux for the PS3, shall we?

The PS3 is not the first game console officially sanctioned by the manufacturer to run Linux out of the box. For a few years, Sony sold a $99 Linux kit for the PS2, available only through their online store. It was discontinued early last year, and is now only available on eBay.

But why would Sony provide Linux for any of their video game consoles? What do they have to gain? In business, nothing is done “just” for the benefit of the consumer, much less for pure “free as in freedom” idealism. In the end, it all comes down to driving revenue and profits up, which ultimately pleases the shareholders. Cynical, perhaps, but do you really believe a public company as large as Sony does anything if not for the sake of revenue and profits? Any activity that does not somehow help improve those two factors, will not be seen very positively with the shareholders.

But still, what does it mean? How does PS3 Linux translate into revenue and profits for Sony? Let’s examine this some more, in the context of an obscure game console manufacturer with a similar strategy.

In Korea, the GP32 game console may not have run Linux, but the manufacturer provided on its website, a full set of open source programming tools that ran on Windows. Linux and Mac OS X support was added by the GP32 developer community shortly later. This made the GP32 the first off-the-shelf game console where the users were officially encouraged to make games for it. GamePark, the makers of the GP32, followed up nearly four years later with the Linux-powered GP2X, which also had a free, full set of development tools, including most of the source for the device’s implementation of Linux.

The response to the consoles was great, both in its native Korea and around the world. There is a healthy global open source game development community. Code-savvy game geeks from all around the world have taken to the GP32 and GP2X. Instead of dismal failure competing against Nintendo and Sony, GamePark has survived and grown against all odds. The gadget-happy Koreans responded despite fierce competition, and a healthy Korean commercial game developer community has grown to serve the Korean GP32 market. Many of these commercial developers were founded by the proverbial “two guys in a garage,” propelled to creativity by the open community GamePark fostered.

So back to the PS3. Sure, it’s freakishly expensive for just a single threaded, single tasking, web browser, digital photo gallery, photo slideshow player, propietary-format movie player, game console. But with Linux and the Blender Game Kit, OpenGL, SDL, etc., this is a garage game coder’s dream workstation on the cheap, with high-definition accelerated 3D graphics, surround sound, and all kinds of fun wireless tech at the developer’s fingertips. At $600 for a 60 GB model with 512 MB of RAM, it would make a nicer Linux computer than most sub-$1000 Windows PCs out there.

Perhaps a cottage gaming industry will grow out of the PS3 Linux strategy, like the GP32’s in Korea. Which makes this Linux play by Sony the direct competitor to Microsoft’s XNA move. You see, both Sony and Microsoft see independent game developers as the future savior of the game industry.

The big game publishers and developers screwed themselves, just as the MPAA and RIAA did, by making production ever more expensive, formulaic, and insipidly uncreative, and by depending on the quarterly mega-blockbuster to survive. They did this at a time when more people than ever have access to the means of production and distribution of digital creative content.

The goal of Sony’s Linux strategy and of Microsoft’s XNA, is to attract the independent game developers to their respective platforms. Microsoft believes that giving the tools away for “free as in free beer,” while keeping the secret sauce bottled up, is the successful strategy. Sony believes making the tools as open as possible without screwing the pooch is the the best strategy.

Now, as an open source fan, I will argue that a truly open community of coders, without central control and oversight, is going to prevail over the “you must please the gatekeeper” culture Microsoft wants to impose with XNA on XBox360.

But let’s not be too idealistic and see this independent game developer thing for what it really is. Just like IBM’s open source moves and Tim O’Reilly’s publishing strategy, both Microsoft’s and Sony’s strategies are all about the alpha geek mind share, and self-interest in the increase in revenue it generates.

But cynical as that may sound, open source is still the better thing. It gives more control to the developer and imposes less order, which leads to greater opportunity for creativity to go where it may. Anything less than an open technology and open community will stave off innovation before it even has a chance to set in.

Technorati Tags:
, , , , , , , , , ,

]]>
http/blawg/2007/01/22/whats-the-deal-with-ps3-linux-simple-xna/feed/ 3
My thoughts on the iPhone http/blawg/2007/01/18/my-thoughts-on-the-iphone/ http/blawg/2007/01/18/my-thoughts-on-the-iphone/#comments Thu, 18 Jan 2007 21:17:45 +0000 http/blawg/2007/01/18/my-thoughts-on-the-iphone/ Continue reading ]]> Let’s cut to the chase: the iPhone is the most innovative communications and media device of the 21st century’s first decade. The other devices and manufacturers don’t even come close. Before the iPhone, you could think the competing devices had evolutionary interfaces, a step up from the previous interface. Now, you can’t help but think them mediocre in comparison to the iPhone. The user interface is the iPhone’s forte, followed by the convergence of widescreen media player, full featured web browser, PIM, and cell phone into one device. Is my opinion clear enough? :-)

All that being said, the iPhone is not ideal, nor flawless. The PIM features are, in my opinion, incomplete. I am referring to the fact that you can’t enter new data into the Notes, Contacts or Calendar apps, except by syncing the device to a Mac running Stickies, iCal and Apple Address Book. I hope Apple starts to see the potential market this has with more PIM features. Maybe they were pressed for release, and cut the features out for now to add them later. We’ll have to wait and see on that.

Apple could also open the device for third party development. According to Apple, it’s just Mac OS X Tiger inside. Perhaps someone will figure out how to hack Safari to download Mac OS X apps on to it. Or at least let us install Dashboard widgets on the thing.

But this being an Apple product whose name begins with I and P, it is a great media player. Strong Bad Emails, Ask A Ninja, and Tiki Bar TV rule! They’re my favorite videoblogs. Evil Genius Chronicles, Coverville, Raven n Blues, and Bandana Blues, are among my favorite podcasts. Since the iPhone is essentially a phone with 8GB video iPod features, we’ll be able to access all our new media on it, with a better interface than anyone has ever produced. I predict Apple will bring the iPhone UI (without the phone features) to the rest of the iPod family within the year. They’ll be stupid not to. MultiTouch rocks!

Of course, the iPhone’s price has to come down for it to be really mainstream. I predict (you heard it here first, folks, LOL) that next year, the 8GB model will be the low end, and a higher capacity (16GB?) model will be the $600 high end.

In order for the iPhone to be really successful and mainstream, it should also be sold unlocked, free of carrier lock-in. Not everyone wants to be Cingular subscriber. The whole carrier lock-in thing is bone headed anyway. It surely has been demonstrated in Europe that expensive carrier-exclusive phones are not necessary to retain customers. And the practice isn’t that effective for that purpose either anyway. Carrier chickenshits, if you ain’t got good service, an expensive locked-in phone won’t help you keep any subscribers you’ve pissed off. They’ll just sell it on eBay and move on.

In conclusion, the iPhone is a great innovative cellphone/media player with some PIM functionality. The crux of its innovation rests on the MultiTouch touchscreen interface and wide screen media playback. It has a few flaws, namely the lack of smartphone PIM features and a closed development model. To really hit it big, it has to come down in price a bit, and be available at more than one carrier in the US. In any case, Apple has essentially raised the bar way up in the user interface front, making the competition look ancient in comparison.

Technorati Tags:
, , , , , ,

]]>
http/blawg/2007/01/18/my-thoughts-on-the-iphone/feed/ 1