Sunday, December 12, 2010

Lesson 15: Making a New File Type

Depending on what kind of projects you write, you may have to create a new file type from time to time, such as a document type for the next Word-killing word processor. While not difficult, making one needs a bit of knowledge from different places in the OS and the API. In our final lesson which focuses on the Storage Kit, we will learn about MIME types, how to show the OS how to automatically identify files of your new type, and more.

Programming with Haiku, Lesson 15

Monday, November 29, 2010

Coding Progress

With as crazy busy as my teaching schedule is keeping me this year, it's challenging to find coding time on the weekends and nearly impossible during the week, but with Thanksgiving Break giving me a 5-day weekend, I managed to get another lesson posted and do some serious hacking. The target this time? PDesigner. It hasn't received much attention in quite a while, but it has been a learning experience from its infancy. It's yet another visual GUI designer, but it bears almost no resemblance to anything coming out of Redmond -- or anywhere else, for that matter.

PDesigner is quite different from anything that people might have seen back in the heyday of BeOS because, unlike them, the internal architecture is extremely general. An entire object system had to be created to wrap around each of the control classes available in Haiku. This object system is what sets PDesigner apart from the rest: the project that you are creating manipulates the control objects while they are running -- the GUI is live as you work on it.This might sound like a cool feature that doesn't have much use, but it makes possible something else: scripting from any language. PDesigner's object interface is string-based, so it's pretty easy to write bindings to the object system for any language you can think of. Last summer a group of students from the University of Auckland created a Python interface to PDesigner's object system.

I spent quite a lot of time over the long weekend getting out bugs and expanding its capabilities, such as good support for methods and working around some of the lack of flexibility inherent to the C++ language. Bolting methods onto an object is really easy now. A program of this size is definitely not something that'll be finished next week, but it will open up new possibilities. Here's a screenshot just for your enjoyment. TTFN :-)

Friday, November 26, 2010

Lesson 14: I Node What You Did Last Summer

A holiday treat! In this lesson we continue to work our way through the Storage Kit, learning about one of the lesser-known features of the Haiku API: node monitoring. For those new to Haiku, it notifies programs of changes to the filesystem, such as changes in a name, etc. If you're looking to turn a good Haiku app into a fine one, this is one way to do it.

Programming with Haiku, Lesson 14

Wednesday, November 17, 2010

Lucky Lesson 13: Queries

I'm not talking about databases, either. In this lesson, we examine one of the most distinctive features Haiku has: the query. We get a good, long look into the murky depths that are the query's official syntax, Reverse Polish Notation, and a few other weird and wonderful tricks. Enjoy!

Programming with Haiku, Lesson 13

Not Off the Radar Yet

I can't even put into words how busy I've been the last few weeks. My last post was a little more than 3 weeks ago, but it has felt like an eternity. This past month or so I've had to deal with three separate incidents of a sick child and spending a week keeping the house running while the other half was busy being ill, as well. Not the least bit fun. School has been crazy busy with more than I care to enumerate here. It's been a lot, needless to say -- makes me wish for times that were much easier to find a few spare moments. I haven't given up and I haven't gone anywhere, but at least all two of you out there know what I've been up to. :-)

Tuesday, October 26, 2010

Lesson...12? All About Attributes

You might think that I took a short vacation, but I've just been buried in Real Life. You might also be wondering about where lessons 6-11 went. They'll be published later, but you're not missing anything, as they are edits of the last several lessons from Learning to Program with Haiku with an experienced developer in mind. If you've worked with the previous series, there isn't anything in 6-11 that you haven't seen before -- they're more to make the Programming with Haiku series complete on its own. This lesson is all about attributes -- what they are, how they can be useful, and how they are manipulated from code.

Programming with Haiku, Lesson 12

Thursday, September 30, 2010

Programming with Haiku Lessons 3-5: C++ Triple Play

In an attempt to move on and get on to just the Haiku API, here are the final three lessons on C++. Lesson 3 introduces C++ file streams, formatting and printing using C++ streams, and lightly touches on exceptions. Lesson 4 takes a break from actual coding and spends time on a critical development tool: source control -- what it is, how it is used, and why it is used. Lesson 5 ties together all of the C++ concepts covered in this series with a project. I hope you enjoy them.



Thursday, September 23, 2010

Klutzo Strikes Again

As is typical for a geek of my athletic ability, I'm a near-total klutz. It's not uncommon for me to bang some part of my body on something each day. Last night I managed to do a real doozy: a computer bit me on the foot. Hard. It wasn't even mine, either. I'd brought home 3 different machines from school, 2 of which were left lying around for parts and the third was good except for a dead hard drive... or so I thought. The CD drive needed replacing, too.

The machine is a Gateway E series mini desktop which has a tool-free case -- fold up the top and pop off the front bezel and you can remove the CD drive and the hard drive. I foolishly left the thing sitting on the floor beside my computer desk, sans front bezel. Unfortunately, I kicked the thing and one of the plastic edges in the front put a nice slice into the outer side of my foot near my pinky toe. Ouch. A new low in clumsiness-related injuries in my life. On the upside, I can put a sign on it when I take it back to school: "CAUTION: this computer bytes. Use at your own risk." Yeesh.

Programming with Haiku, Lesson 2

I had an unexpected day off from school today, so I took advantage of the time in getting a bunch of writing done. The result? Lesson 2 is available for your reading pleasure. In this lesson, we go on a fast and furious flight through the rest of the Standard Template Library.

Programming with Haiku, Lesson 2

Monday, September 13, 2010

Ohio LinuxFest 2010: Didn't Disappoint

This weekend was my second year at the Ohio LinuxFest at the Greater Columbus Convention Center in downtown Columbus, OH. I arrived at the convention center at about 7:15am. Unlike last year, there was hardly anyone there outside of the OLF staff doing checkin and a few vendors. Joe Prostko was already there, having stayed at a hotel nearby the night before. It was good to see him again. We started talked for a bit and then started getting the table set up. I made sure that we had enough supplies for the table and each of us had brought a demo machine. Joe brought an MSI Wind netbook which was running a nightly build and I brought my Dell Latitude D620 running an almost-stock Alpha 2. Both machines proved to be valuable for demoing different aspects of Haiku that day. Soon enough we started seeing some traffic.

Most of the day itself was spent at the Haiku table talking to convention-goers. I even spoke with some people who I recognized from last year. Unlike last year, my laptop only KDLed once. Wanting to see what the sessions that were offered were like, I spent a little time in the Ubuntu on ARM session, which was quite technical but reasonably interesting. It gave me a clue about what to expect if I were going to speak at a session. I'm pretty sure that I'm going to give a session next year on Haiku. Mike Summers had managed to come, albeit later than last year. He rolled in about 3pm, but it was good to see him again. He might've been late, but his presence was felt, becoming the resident "chick magnet." All of us were surprised by that one. ;-)

The people that come to OLF are always really interesting to talk to and, being fellow open source fanatics, quite receptive to Haiku as an operating system. Many of them are intrigued by Haiku's boot times, feature set in combination with its hardware requirements, lack of an X server, and its unique features like queries and the extensive use of attributes. Joe had the Stack and Tile decorator running on his netbook and everyone who saw that were really impressed, myself included. Only those people who were familiar with BeOS or Haiku were not suprised by the number of movies playing simultaneously without dropping frames. My favorite demo was running 3 videos on one workspace, switching to another workspace to start a lengthy project build with Paladin, and switching back to show how responsive Haiku was even with the CPU maxed out. We've got a great OS here.

Some of the main questions that I ended fielding were about stability, where people could try out Haiku, and what Haiku offered in the way of an office suite. It would seem that right now, according to the conference goers, that having OpenOffice.org or KOffice or something is quite important. Perhaps someone might be willing to step up and finish the work on Gobe's Productive suite given this thought.

It was a great conference and I'm looking forward to the next one!

Update: A couple of photos taken while we were there.

Mike Summers and I, defending our table from the hordes
Joe smiles while I continue to blather on.























Tuesday, September 7, 2010

A New Series of Lessons: Programming with Haiku

Since I started publishing my Learning to Program with Haiku lesson series back in January, I have, on many occasions, seen comments asking for lessons aimed at current codemonkeys who want to break into development for Haiku. Here begins a new series of programming lessons aimed at people who already have a basic grasp on C++: Programming with Haiku.

The direction of the series is pretty straightforward. First, we'll be spending some time (i.e. the first unit) delving into some less-commonly-used features of C++ which show up in Haiku from time to time. This is partly to bring up to speed those who are picking up the series after finishing the first one, but also to examine ways that features like containers from the Standard Template Library can be effectively used in combination with the Haiku API. There's even a quick primer on source control thrown in for good measure -- something which any developer should at least understand, if not use religiously. Following the first unit we will dig into the API. Depending on how things work out, there may or may not also be a crash course on GUI programming in there before diving into the kits themselves. Some of the lessons will deal directly with getting to know a particular kit. Others will examine important topics or the "Haiku way" of getting a task done. They should provide a good working knowledge of Haiku development methods that can easily be expanded into more advanced usage.

While I have a basic outline for the series, it's very general and I'm not exactly sure how long the series will run. It certainly will be quite a while, though. A word of warning: my school schedule is completely insane from the start and I will not be publishing largely on a weekly basis like the first series. Instead, I'll be posting them when I am able. I really like writing these things, so they'll happen, but it may take some time.   Now, without further adieu, Lesson 1, which starts by looking at templates and some of the containers in the Standard Template Library.

Programming with Haiku, Lesson 1

Monday, September 6, 2010

Learning to Program with Haiku Color e-Book Available

My first book on learning how to write programs using the Haiku operating system is now available as a color e-book. Until now, it has been available in print and for download, but only in black and white. Unfortunately, this lacks the syntax highlighting for the code that the original programming lessons had, but it was initially necessary because color printing costs at Lulu.com are exorbitant in my opinion and publishing the book in color would have made it prohibitively expensive. E-books have none of these limitations, so without further adieu, it can now be downloaded $10 from its own page on Lulu.com. The original black and white version is still available for those who would prefer it.


Saturday, September 4, 2010

Another Serving of News Soup

Aside from the new Stack and Tile decorator that Clemens Zeidler just made public, there isn't much going on this weekend in the Haiku community. I figured I'd pass along some minor news from the last couple of weeks.

Next weekend I'll be heading off to the Greater Columbus Convention Center to help host a Haiku table at the Ohio Linux Fest, armed with Alpha 2 CDs, flyers, a demo machine, and a bunch of other stuff. I'm looking forward to the time. It was a busy, but fantastic time last year.

A couple of weeks ago a news post was made to HaikuZone about my book. As part of a collaboration effort with Jorge Mare (a.k.a Koki) and some notable Japanese developers in the Haiku community, Learning to Program With Haiku is going to have a special Japanese edition published. There is also some discussion of a Spanish translation, too, and Haiku contributor Kurain is in the process of translating my programming lessons into Chinese. I'm flattered to see some of these opportunities arise -- when I was writing the first few I never thought these would be as well-received as they have been.

As if it weren't already easy to install -- at least if you ask me, anyway -- Paladin is also on its way to becoming an optional package thanks to the effort of developer Scott McCreary (scottmc). The neat part is that -- at least at the moment -- it's possible to build the current 1.3 release or build straight from the sources in Paladin's Mercurial repository on Sourceforge. Pretty slick, if you ask me, and props to Scott for pioneering the effort!

Since the 1.3 release, I've been working on a self-extracting packaging system. It's similar in many ways to the packages used in Zeta 1.2 and 1.5, but creating them can be done using PSfx, a graphical program which closely follows the interface of the PackageBuilder tool which comes with the BeOS 5 Development Tools archive. These packages can also be created from the command line, and this ability is one of the main motivations behind the system. The system is still under development, but it's showing promise. I can't wait for it to be ready, if for no other reason than to make the next Paladin release go from sources to release package in one command, which would be really sweet.

School's back in now, and instead of primarily performing custodial duties like I've had the last couple of years, I'm back to doing what I love most: teaching music. I very much have a full load, so coding is pretty much limited to the weekends, but I'll be working on stuff like this packaging system as I'm able. Best wishes to all of you in whatever you do. :)

Friday, August 27, 2010

Tip: Add / Set Resources Easily

For those unaware, Haiku applications have certain information stored in resources. This includes the version, short and long descriptions, and a duplicate of the signature specified in the application object's constructor. You can easily set this information quickly by adding an .rdef file, which is a text-format resource file.

To quickly create and edit this information, add a new file by pressing Alt+N or choosing Add New File from the menu and enter the name of the .rdef file, such as Resources.rdef. Double click the file's entry and when it opens, you will be greeted with a text file where you can fill in the information for your application with a minimum of fuss.

Editing .rdefs not to your liking? Make a Resources.rsrc file instead, right-click on it, and choose "Edit Program Settings" to do the same thing with the FileTypes app. Either way, simple and fast. That's the way we like it. ;-)

Wednesday, August 18, 2010

Introducing Paladin Tips, Symbol Finder

Paladin has grown quite a lot since its inception. In fact, it has a lot more features than BeIDE now. I worked extensively with the venerable tool when I was reverse engineering the .proj file format. Having gotten accustomed to Paladin, BeIDE seems kind of sparse. Some of Paladin's features aren't necessarily as obvious as others, so from time to time, I'll be posting tips on making your use of the IDE better, faster, and more convenient. What better way to work more effectively than from the author himself. :)

The Symbol Finder tool was introduced in version 1.3. It's a search engine for libraries. Did you ever have a time when you were receiving linker errors for a symbol that was missing, but you couldn't figure out which library it was in? Symbol Finder to the rescue. It's kept in the Tools menu, but it's also a separate application, too. Once started, enter the name of the symbol and hit Enter and it will search all of the libraries in the system library folders for it. Any hits will pop up in the search results.

Sunday, August 15, 2010

Haiku Alpha 2-based Paladin Build Available

After yesterday's release fiasco, I quickly reinstalled Haiku using the alpha 2 branch in the source tree and while the version number hasn't changed, the Paladin 1.3 packages available via the links in my previous release post will work on alpha 2. My apologies for any inconvenience this oversight has caused. We now return to our regularly scheduled program. ;-)

Saturday, August 14, 2010

Building Paladin from the Source: Not Necessarily a Bad Idea

It never dawned on me that people might want to install Alpha 2 and continue to use it. Personally, I can't fathom not using a nightly. I'm big on stability, but considering that Haiku is very much in an alpha state, I expect problems. Some revisions are better than others. Right now, one of my machines is running r38082, which is a nice, reasonably stable build, but it apparently has some symbols that Alpha 2 lacks. Looks like I'll be putting out an Alpha2 build tomorrow. ;-)

Using development builds of Paladin are not normally what you might expect of a development build for other projects. I don't use release builds of Paladin -- I use the bleeding edge. If something breaks, I un-break it because otherwise I can do any further Paladin development. Using a development build of Paladin also tends to have newer features and fixes than can be found in the releases.

If you want to continue to run Alpha 2, that's fine. I'll be posting an Alpha 2 build soon. Here's how to build Paladin from source. You'll need Mercurial installed to do so.

From the Terminal run these commands:

hg clone http://paladin.hg.sourceforge.net:8000/hgroot/paladin/paladin
cd paladin
buildsuite.sh

This will actually build Paladin, PalEdit, and parts of the as-yet-unreleased packaging system and create a package on your Desktop. Open it and it will install Paladin on your system. If you want to use ccache or fastdep, copy them from the Paladin install folder to /boot/common/bin. The bug causing them to be installed in the wrong place is the reason why the packaging system isn't officially released yet.

Release Day: Paladin 1.3 is Out!

It is my pleasure to announce the next version of Paladin, now available from Haikuware and DarkWyrm's Library. Although it has only been about four months since 1.2.1, a lot of work has gone into this release. Probably the single most noteworthy feature in this release is source control integration. Although it is just at a basic level at the moment, commits, diffs, and other common tasks are either a keypress or a couple of clicks away. Subversion and Mercurial are supported with Git support in development. BeIDE projects can now be imported. ccache has been updated to 3.0.1 and now dependency checking can be done with fastdep -- much faster than gcc's dependency checker. Some (accidentally) broken features, such as Run in Debugger and the Program Settings item for resource files have been fixed. Projects in the Start Window can be opened from the list using Alt + a number key, so Alt+1 opens the first project in the Recent Projects list -- this little feature has made a big difference in my own ease-of-use while using Paladin.

Some features didn't make this release, which I'm kind of bummed about, but I'd much rather get a stable release out now than a buggy one or a stable one 6+ months from now when I sort-of have time during the school year. The release doesn't use the new packaging system because I just couldn't get it stable enough in time, but Paladin 1.4 should use the new system. I can't wait for that because with it I can literally build the entire Paladin suite from source and package it with one command using a shell script -- truly One Command to Rule Them All.

As always, bug reports are genuinely appreciated. Enjoy!

Update: The binaries require at least Haiku r38082 because of some of the bugfixes that Paladin depends on.

Sunday, August 8, 2010

Crunch Time with Surprises

It almost sounds like I'm eating Lucky Charms, but it's true. 1.5 weeks until school starts and already I'm getting my mind into that mode. I've gone into testing mode for Paladin so that, hopefully, it will be ready to ship by the time that school time hits. I've found a few weird things, but there's just a lot of stuff to test and use day-to-day. I had plenty of chance to break things in this weekend. How?

I spent Friday night in a daze, just playing around with unzip, curious if there is a way to create self-extracting zip files in Haiku and Linux. It turns out that it is. Literally it is just a matter of tacking on a zipfile to the end of an stub program which more or less runs unzip on itself. This led to a realization that hit me like a lightning bolt while I lay in bed early yesterday morning. For a while I've had code that I wrote for a packaging system for BeOS / Zeta / Haiku sitting on my hard drive, collecting proverbial dust because I couldn't figure out the best way to store the files. It was a large percentage of the way to completion, too. This connection put me into coding overdrive yesterday and I spent a generous amount of time on it tonight, too. The result? PSfx. Of course, this isn't news if you subscribe to the checkin RSS feed for Paladin. Natch.

PSfx is a package building app which works very much like the PackageBuilder app which is bundled in the BeOS 5 Development Tools. The difference is that, when finished, it will work *much* better than PackageBuilder and won't require any extra tools. The new format uses ZIP compression leading to smaller file sizes than the equivalent for SoftwareValet packages. Like Paladin, it has a scripting-friendly command line interface, perfect for integrating into other build systems or hacking together a quick shell script to automate the building and packaging of a project. The build scripts that it uses are a similar format to the Paladin project files, which makes them friendly toward source control and also easy to read and write even with just a regular text editor. Also, even though the executables will run only on certain OSes, it will be possible to build, say, a Haiku GCC4 package from my Zeta install.

All of this is not to say that it's finished, however. While the install engine and command-line interface are mostly finished, the GUI still needs more work. There are some bugs I need to fix and some other miscellaneous stuff needs done. While PSfx certainly won't be ready for the Paladin 1.3 release, Paladin's next release, in theory, will use this new install system. While these self-extracting packages probably won't be as elegant a solution as what the other Haiku developers will be coming up with at the proper time, it sure beats waiting a few more years for decent software distribution tools.

Wednesday, July 28, 2010

More Fixes and Features for Paladin

I spent a great deal of time today doing more hacking on Paladin, a trend I've had the last week or so when I wasn't working on getting my book out the door. The Code Library feature, for now, has been withdrawn until I can get it working well, which it just doesn't right now -- everything works the right way except for synchronization, which is the entire point behind the feature. The code for it is still there, but it won't be enabled for the next release. I fixed several really annoying bugs, including workarounds for two bugs in Haiku which took a lot of effort to find but were trivial to work around once found. One of them is project files being mistakenly identified as plain text files.

Source control is the star feature for the next release. I intend to make it about as easy as possible to integrate source control into a developer's workflow as possible. It took me a long time to really "get it," but now that I do, I want others to have an easy time using it without having to learn command line syntax until they're ready to do so. The only thing that I currently have on the to-do list before the release is to polish and test the different ways that source control is used. Once that's done, I'll be putting out a release. I really love this project -- the rewards are incredibly satisfying. :)

Thursday, July 22, 2010

Learning to Program With Haiku Now Available in Book Format

The book is finally done! Getting through the proof copy took *so* much longer than I ever expected. Luckily, right now I'm out of town with a lot more time on my hands, so I had a lot more time to be able to sit down and get through it. It has been published through Lulu.com so that a great deal more of the profit from the book goes to me instead of the pockets of a book retailer. Here is the link to the book and e-book.

Learning to Program with Haiku at Lulu.com

The regular price is $25 USD, but as part of the launch of the book, it is on sale for 15% off the regular price through August 15 when you use the coupon code BEACHREAD305 at Lulu. It will also be available through online book retailers like Amazon.com, Barnes and Noble, and others, but it will be a couple of months before it appears on those sites.

If you've been a fan of the lessons and want to show appreciation or to have a copy of it on your desk while you work your way through, now you have a chance to have a high quality copy, and if you've been sitting on the fence about it, read a lesson or two and then decide for yourself. Enjoy!

Thursday, July 15, 2010

Paladin: No More CVS, Either

I wish that when I started the project for Paladin over at Sourceforge that I had been able to choose Subversion for source control using the client for Zeta. Because of an outdated client, I was forced to use CVS. While CVS is (barely) adequate for legacy work, anyone who knows the importance of source control knows better than to use it when far better tools exist. Subversion is CVS done right, but it certainly isn't perfect, either.

Distributed source control tools are the current fashion, it seems, and rightly so. After a lengthy discussion of Mercurial vs git which to choose over Subversion, I decided to do some looking into both of them. It's another one of those Coke vs Pepsi, KDE vs GNOME kind of controversies. Long story short: I haven't looked into git very much, but I've learned enough about Mercurial to say that I like it a lot.

Just a few moments ago I checked in the current development snapshot to Paladin's new Mercurial tree. It's official: I'm no longer using Zeta for development. I am still supporting source compatibility for the platform, but now my focus for Paladin is solely Haiku. This change in perspective will bring in some features not possible for R5 or Zeta.

One new feature for Paladin 1.3 is integrated source control on a basic level. The inspiration comes from The Joel Test: 12 Steps to Better Code. One of the steps is using source control -- yes, even CVS. In all the years that I've been flinging C++, I never used source control locally. I didn't see the point in doing so locally and didn't think all that much about source control to begin with. I didn't want to put in the effort to learn more, either. Lazy developer, I know. git and Mercurial make it foolish to not use it. It's a different workflow, but only slightly.

Paladin's integrated source control will be simple and about as unobtrusive as possible. It creates a repository when you make a new project. Click a menu item or press a shortcut on the keyboard, type in the check in message, and it will check in your work locally. Click another menu item and it will push your changes to another repository somewhere. It's about as painless as it can get. Mess something up? Revert to the last known good revision. You will be able to even choose from Mercurial, git, and Subversion for your work. Only the basics will be covered in 1.3 to avoid pushing the release off too much. Gotta get back to hacking. TTFN

Saturday, July 10, 2010

No More Hangs for Paladin

Those of us who run Haiku under a multicore machine can finally breathe a sigh of relief. For about as long as I can remember -- probably as long as it's had multithreaded builds -- Paladin has suffered from problems with locking up under Haiku. There never was a problem with it when I was developing Paladin from within R5 or Zeta, though.

Over the last couple of days, I've been doing some serious development on Paladin from within Haiku and one product of said hacking has been Haiku bug #6288. I've been working pretty closely with Ingo Weinhold on the problem and he was very kind in teaching me a few system-level tricks along the way, particularly with the kernel debugger. The result? Revision 37460 patches the problem. Considering that several bugs that Paladin development has exposed are still open AFAIK, I'm really thankful for Ingo patching this one -- I wouldn't have had a clue where to begin.

All of this effort I've been putting into Paladin this week has resulted in some new features and bugfixes. Running a project in the debugger now works again following a patch to both Terminal and Paladin, for example. I'm going to finish one major feature, see if I can fix problems in the code library, and start going into the test phase for a new release. I haven't a clue when that release will be, but, worst case, it should be here by the time I have to go back to school next month, barring major problems -- hopefully much, much sooner. Until next time. :)

Thursday, July 8, 2010

Not Worried About Haiku's Future

Operating systems are funny things. They take FOREVER to develop, for example, and I don't just mean Haiku. Look at the development time for Vista. It took a multi-billion dollar corporation for than five years to write the upgrades for XP.

There's also a chicken-and-egg problem that fledgeling OSes have: how to get an OS without applications and how to get applications without an OS. Luckily for Haiku, a lot of that problem has been mitigated by BeOS' startup history. The QT4 port just saw a 4.7 release. I'm really thankful for the efforts of those guys. Other people like Michael de Vincius Oliviera and the HaikuPorts team have been hacking away at porting stuff from other platforms. While they certainly don't have all of the BeOS goodness of a native app, at least we have some of these apps and games. KOffice takes a team of dedicated developers that is IIRC larger than our OS team alone. We're really starting to get a lot of useful apps.

Stability has always been my sticking point for coding under Haiku, but at least in my experience of late, Haiku's been pretty stable, all things considered. I'm typing this from a GCC4 hybrid build that I installed from sources. So far Paladin hasn't been plagued by deadlocks like it has been in the past, which has led me to believe that it was never Paladin's problem in the first place, but the jury's still out on that one. I'm even working on more features that will only work under Haiku and fixes for the platform, like using rsync to properly synchronize modules for the code library. In the last couple of days I worked with a couple guys on the team to nail down a bug in Terminal which was preventing Paladin from running applications in the debugger. After patching both Paladin and Terminal, it works beautifully now.

Feature-wise, Haiku is even now doing an admirable job of playing catch-up. People in the past have mentioned that R2 would be the release where Haiku would implement all the features that BeOS was missing that all the other OSes have, but more and more I don't think it'll take that long. OpenGL stuff might, but the Google Summer of Code has been good for that. There have been other people who couldn't wait that long for stuff like WiFi, so even now that partially works. Simple amazing, if you ask me. Then again, even though it's been slow, Haiku's progress from the outset has been that way, too.

Wednesday, June 30, 2010

The Book is *This* *Close*

After about a week of what felt like futzing around with my book, Learning to Program with Haiku is just about published. I ordered the proof copy this morning, so in about a week I'll have a hard copy of my work, and barring major problems, it will be available for the general public, both in dead tree format and as an e-book. I'm really excited!

Friday, June 25, 2010

More PalEdit Progress

For those who didn't know, I've been finally getting around to cleaning up PalEdit, Paladin's text editor. It is based on Pe and in its current publicly-available state, isn't all that different from Pe. I'm in the process of fixing that. On the surface Pe is a great all-purpose text editor. I'm not that fond of it personally just because I only write code in C++ under Zeta and Haiku with rare stints into Python land under Ubuntu.

When I started working on Paladin, I needed a text editor to go with it, and Pe won over Scintilla for quickly getting things going. Since that time, I haven't really done much with it aside from some integration with Paladin's build system -- that is until now.

The actual code for Pe is a mess. I've mentioned multiple times my disdain and loathing of the resource system that it uses and the tool that compiles them, rez. Rez is hard to use because the errors it generates are not at all helpful and it merely compiles C-like text file into regular resource files. Very few of the extensions are actually useful, and with Paladin being specifically a C/C++ environment, all the extra languages used are unneeded. Internally, the archictecture also needs cleaned up, especially the code that handles the syntax highlighting for the different languages.

Rather than rewrite the thing, which is foolish, I've been doing some major refactoring of the code. The result at this point is a stripped down editor with syntax highlighting that is one quarter the size of the current PalEdit executable. It still needs quite a bit of work to be feature complete and there are bugs still left to squash, but when finished, it will be much easier to add stuff on, to maintain, and to also embed into other applications. It will be possible to finally integrate the editor into the rest of Paladin, whether or not I do it remains to be seen, though.

Tuesday, June 22, 2010

Lesson 23: Polish and Packaging Our Project

This lesson finishes up the project that the last two have been about: HaikuFortune, a program which randomly chooses and displays a fortune in a window. It's not a very complicated one, but it exemplifies a reasonably well-coded real-world project. Although it was code complete as of the end of Lesson 22, it was not finished, missing icons and other resources. This concludes the project with adding resources, a basic discussion on source code licensing, and packaging a program for Haiku.


This also concludes the Learning to Program With Haiku lesson series. It's been a good run. Rest assured, though, that this is not the last lesson on Haiku programming that I will write. This series has been intended to turn a motivated power user into a developer using Haiku. It's been a lot of fun and many people have encouraged me with their kind words regarding it.

Later this summer I will start another yet-to-be-named series which will continue where Learning to Program With Haiku is leaving off and introduce novice and intermediate developers to real coding specifically for Haiku and its nuances, such as multithreaded programming, add-on coding, queries and attributes, Tracker and more.

In the mean time, I am working on revising the lessons into a complete book available for a reasonable price in dead tree and possibly e-book format. These PDF lessons will continue to be freely available and redistributable. More details to come soon.

Monday, June 14, 2010

Lesson 22: Designing a GUI

Usability is one of my pet topics. Although less so now that in years past, it is all-too-often ignored or not given enough priority. This lesson scratches the surface from a developer's point of view. I'm no usability expert, but I do know a thing or two. This lesson is a must-read for any budding developer, and by the end of it, we will have a good real-world program to show off which is just shy of being ready for a release.

Project Sources: 22HaikuFortune.zip

Friday, June 11, 2010

Lesson 21: Reading and Writing Files

This lesson continues with delving into the Storage Kit, reading and writing files. We also start writing code for the final project of the Learning to Program With Haiku series which will be developed over the course of several lessons.


Sunday, June 6, 2010

Count Me Flattered

I just won Haikuware's 17th along with Pier Luigi Fiorini for my work on Paladin and all of the programming lessons that I've been publishing. My Haiku golf shirt came yesterday and it looks really nice. I didn't start either one to achieve any recognition, but it's really nice to be appreciated. Thanks everyone!

Tuesday, June 1, 2010

Lesson 20: All About Storage

Moving on from exploring the Interface Kit, we turn our attention to the Storage Kit in this lesson. We take a look at the kit from a broad perspective and also begin using some of its many of the classes. We take a break from writing GUI applications and, instead, write a console directory-listing program using C++.

Source Code: 20ListDir.zip

Tuesday, May 25, 2010

Lesson 19: Resources and Pictures

Ten years ago when I first started to learn to write code using BeOS, I had a lot of questions that I couldn't any documentation to give me the answers. Luckily, there was the Be Code Talk mailing list and kindhearted members of the community, like David Sowsy (Animaxo, Vesa Accepted). Resources are one of those things that eluded me. Eventually I figured them out, but Lesson 19 lays some of it out in plain conversation.

Sources: 19Emo.zip

Monday, May 24, 2010

PalEdit's All in Pieces

All over my floor.... or something like that. I spent most of the weekend ripping apart and putting back together pieces of PalEdit in a separate folder -- code that hasn't made it into the tree yet. Yesterday afternoon I had successfully refactored the code for the text editing view. It's possible to type and delete text, but that's about it -- even little things like the arrow keys don't work yet. Syntax highlighting is disabled for the moment, too. That's OK, though. Those features will get their turn, too. The big accomplishment is that I'm pretty sure that the hardest part is over: reducing dependencies until all I have left is a BView which I can type code into. This will enable all sorts of nice things like the possibility of a tabbed interface, properly-implemented split views, and more. I'm getting a better handle on how most of the code works, too, so I *might* be able to implement my #1 most wanted feature: code completion. We'll see. :)

Wednesday, May 19, 2010

Lesson 18: Working With Lists... and Other News

We're starting to get closer to the end of this Learning to Program series. After toying with menus and interface colors in the last lesson, we apply some of the concepts used with menus to get the hang of using list boxes and discover along the way a few bizarre sports that really exist. Games people play. Sheesh.


In other news, I've been running a little slower with the lessons as the school year winds down -- 12 school days and counting as of today! It's a little tougher to get the time and motivation to write when time's tight and Valve released Portal for free. Sometimes it's a tough choice. ;-) I've also been spending time -- mostly on the weekends -- doing some serious hacking on PalEdit. The more I work with it, the more I discover that it's like going to the Olive Garden: high-quality spaghetti. I managed to rip out all of the rez resources (yay!) and strip it down to pretty much bare metal.

Right now I'm in the process of refactoring the sources so that source code editing is encapsulated into a single BView. This has helped immensely with my understanding of how to write a text editor. It will also enable tighter integration of the editor with Paladin's project management and hopefully enable me to figure out how to implement code completion, the one sorely-missing feature on my personal hit list. I guess we'll see.

Monday, May 10, 2010

Lesson 17: What's on the Menu?

After an unintended wait, Lesson 17 is finally out. We are back to learning about hacking on the Haiku GUI after taking a short C++ language break. Today's topic? Menus. Also in this lesson is some expansion of what we know about messaging and BViews.

Sunday, May 2, 2010

Happy Reunions

It's been official for about a week or so now, but I haven't had any time to do anything with it. I've rejoined Haiku. My life is a lot different from when I left, and people were glad to have me back. It's kind of strange how there's often a disconnect between people who don't live far apart, but never get to see each other for whatever reason. This is very much like that. No matter.

My first act was to patch a crash when clicking on the leaf menu when the Deskbar was stretched across the width of the screen -- "Start Menu" mode. Axel made a bigger patch based on it, so I'm happy. Now I'm going to see if I can get the system colors that are tweakable via Appearance to actually make color changes across the system. It's actually the fault of the controls in the Interface Kit, not Appearance, so we'll see what happens on that one. Should be interesting. :)

It's good to be back.

Monday, April 26, 2010

Lesson 16: Locked and Overloaded

It's strange how a week goes by so quickly now, but it's good motivation to keep writing! This lesson takes a break from hacking the Haiku API to learn a few C++ language concepts needed to continue progress as an aspiring developer. Function overloading and operator overloading are examined in detail. Enjoy! Learning to Program With Haiku, Lesson 16.

Tuesday, April 20, 2010

Lesson 15: The Haiku API at 10,000 Feet

Having written our first program, Lesson 15 delves further into what writing basic applications are all about, looking at the API and its organization and focusing on an essential: messaging. Also included in this lesson are the finished sources for those who don't want to mess around with typing the project out.

Lesson 15 Project Sources: ClickMe.zip

Tuesday, April 13, 2010

Sunday, April 4, 2010

Paladin 1.2.0 Released!

It's been more than a little while since the last release, but I'd say that it's been worth it. Beyond the usual round of bugfixes, it's about as stable as 1.1, which is a great thing for BeOS and Zeta users, and a bit of a bummer for Haiku users -- there is a known bug which hangs Haiku on what seems to be multicore machines when running a build that I haven't nailed down yet. It's a tough one, but rest assured that I'm working on it.

Time-saving features are the highlight in this release. It is possible to create and/or utilize templates of common application types, such as an app with a main window and a menu bar. An Import Project feature in the Start window makes quick work of making a Paladin project from existing sources. The compiler cache ccache can be used in Zeta and Haiku to speed up builds. There are rare build issues for the Zeta version, so it is not enabled by default for stability's sake, but most people will want the speed gains. A regular expression tester has been added to the Tools menu to save a few gray hairs from testing regular expressions in applications.

I've still got some tricks up my sleeve, so don't be surprised by a 1.2.1 or even a 1.3 release by the end of summer. I can think of a few more features that would make my workflow even easier, so I'm pretty sure they'd be of benefit for everyone. Until then, happy coding!

Paladin 1.2.1
Paladin 1.2.0 Sources

Update: As it turns out, PalEdit 1.2.0 crashed under Haiku GCC4 hybrid builds and had some icon issues, so 1.2.1 is out and the link updated accordingly. The sources haven't changed, however. :-)

Saturday, April 3, 2010

Lesson 13: Programming With Class(es)

Today we'll be diving headlong into the murky depths of C++ programming: classes and inheritance -- struct's with fancy tricks aplenty. It's also our last lesson before writing our first windowed Haiku program, so get ready and study well. Enjoy! Learning to Program With Haiku, Lesson 13.

Sunday, March 28, 2010

Lesson 12: OOPs, I Did It Again!

This would be the only time I will capitalize on a really bad Britney Spears reference. I promise. ;-) This lesson introduces us to the wonderful world of C++ and Object Oriented Programming. It's not terribly code-heavy, so this might be a good time to look over past lessons to make sure you understand concepts pretty well -- it only gets bigger from here. :-) Learning to Program with Haiku, Lesson 12.

Sunday, March 21, 2010

Fast Access to All of the Lessons

I've put up a page on my old website, redesigned and now renamed DarkWyrm's Library, which has one-click access to all of the programming lessons that I've written. If you've missed one, this would be the place to look, saving a lot of hunting on this blog or the one over at the Haiku website. This is also a good place to find all of the apps that I've written. I've also got links posted here for when this post is buried by others so that you don't even have to bookmark them. Gee, how kind of me. ;-)

Saturday, March 20, 2010

Lesson 11: More Data Structures and Types

This time around, we will be examining some important kinds of data structures and ways to create custom data types, a critical stepping stone in getting to understanding the Haiku API. This is the last C / C++ lesson -- the rest will be C++ only. A couple more lessons and we'll finally be ready to write GUI programs for Haiku! Enjoy! Learning to Program with Haiku, Lesson 11.

Friday, March 12, 2010

Lesson 10: More Pointers and the Command Line

Here it is: Learning to Program with Haiku, Lesson 10. Now we're starting to tie up loose ends before moving on to just C++. In this lesson, we learn more about pointers and kinda-sorta pointers called references, and we examine the basics of getting information from the command line. Also included are the answers to the review questions for Unit 2.

Thursday, March 11, 2010

Changing OSes: Harder Than You Think

I have had experience in a wide variety of operating systems over the years -- every version of Window$ except 2.0 and NT 3.5, DOS 3.0 - 6.0, Linux distributions, MacOS 7.5.3 - OS X, BeOS R5 through Haiku, and even a little QNX. It dawned on me yesterday that this actually colors my perspective significantly. As proponents of alternative operating systems, we need to be aware of how hard it is to change your primary OS.

Think for a moment about what using Windows is like: always being on alert for viruses, perpetual security updates, going to the Geek Squad or a friend / relative for fixes, Microsoft Office, buying a PC loaded with bloatware, Photoshop and other can't-live-without-it apps and so on. It's a way of life, and an inferior one at that, but that realization comes only if you are made aware of better options. Let me repeat part of that: it's a way of life, as in a culture. Not that I've done it myself, but I know enough to know that changing your primary OS is very much like moving to another country.

Consider the differences in what you know about the United States, England, and Australia. Last time I knew, there weren't too many koalas climbing trees in Willesden Green, for example. I'm not even going to comment on the "Chocolate Thunder from Down Under" server at Outback steakhouses here in the States -- I've never had it -- but I do know what it is that Australians call a thunderbox, and the only thing it has in common with chocolate is the color. Eeew. Riding a lift is something I might expect a construction worker to do, as in driving a forklift, but that's not what it means across the pond. They all speak the same language, but there is a lot of difference even though there is a lot of common ground beyond language.


Imagine for a moment moving from your home country to another one which speaks the same language that you do, but one you've never visited before. Which would be more difficult: packing everything and leaving on the next plane out of town or spending time there and planning your trip, possibly having a house in both places for a while? Without a doubt, the harder option would be the first one, but sometimes we, who have successfully done that in a computing context, mention it without hardly a second thought -- "Just use Linux (or a Mac, or whatever). It's easy!" That's like saying to my neighbor who has lived her entire life in the town I live in to move to Australia without any regard to all, if any, of the implications that this entails.


Changing your primary operating system is something that takes time, effort, and patience. The change requires willingness to put in effort to learn something new, even through the problems and inconveniences that will arise. Total beginners actually have an easier time than people who "don't know much about computers" but they still require a lot of help. Keep in mind that truly helping people requires an investment of your life into theirs.

Friday, March 5, 2010

Whole Lotta Lessons Goin' On

There have been quite a few comments on people being excited about when these start addressing the Haiku API, so I'm going to speed things up a bit. I originally planned on calling this week a Buy One, Get One Free week, but that won't fit now. I had planned on publishing review questions after Lesson #5, but I must have forgotten to upload them, so I'm making them available along with Lessons 8 and 9 and the questions for review after Lesson 9 has been completed. Here they are in order. Enjoy!

Friday, February 26, 2010

Lesson 7: Losing My Memory

It's hard for me to believe that I've been publishing these mostly-weekly lessons for almost a month and a half. It's been really fun. I hope that those of you reading them have been enjoying reading (and hopefully learning from) them as I have in writing them. This one covers two major topics: memory management and binary math, nothing terribly exciting, but really useful and necessary nonetheless. Learn to Program With Haiku, Lesson 7.

Friday, February 19, 2010

Lesson 6: More Loops and Conditions

Here marks the beginning of the second unit in my series, "Learning to Program With Haiku." Lesson #6 expands on our knowledge of loops and decision-making constructs. Good luck! Learning to Program With Haiku, Lesson 6.

Saturday, February 13, 2010

Paladin Release Delays... a Good Thing??

Normally, you'd consider it a bad thing when a software release has to be pushed back. I was thinking of pushing out that release I mentioned earlier this past afternoon, but it's not going to happen.

I just kind of fell into a coding session this afternoon and this evening and it yielded some great results. I managed to get a well-known Linux tool, ccache, built for Haiku and Zeta and tweaked Paladin to take advantage of it. I did some testing on my P4 3.0 Ghz with hyperthreading (a dual processor machine to Haiku) with a copy of the sources to FtpPositive that I had lying around. The results completely blew my mind.

Build TypeBuild Time
single-threaded, uncached13 seconds
multithreaded, uncached12 seconds
single-threaded, cached~3.5 seconds
multithreaded, cached~2.25 seconds

That's an 80% improvement with build caching! For small projects with only a few files, it doesn't make nearly that big of a difference, though. The bigger the project, the bigger the boost, it would seem.

I also found a few bugs that I managed to squish that were related to a feature that I implemented during the snow days I had earlier this week and discovered another one which needs to be taken care of plus some more general testing before a release can be made. When it's all done, though, this will be a really nice improvement over the last development release and a huge leap over the stable branch.

Friday, February 12, 2010

Programming Lesson 5: Arrays, Strings, and Pointers

It's that time of the week! This is the end of the first unit of lessons... about halfway to writing our first GUI program for Haiku. Some more advanced concepts, especially pointers, are found in this one. Enjoy! Learning to Program with Haiku, Lesson 5

Friday, February 5, 2010

Lesson 4: If, For, And, Not, Or

Hey, that rhymes even! Lesson 4 is now out. Decision-making and repeating instructions are on the agenda for this one, expanding the repetoire of basic skills for writing code. Learning to Program With Haiku, Lesson 4.

Monday, February 1, 2010

New Paladin Release Coming Soon

At least in the last week or so I found the coding motivation that I seemed to have misplaced. I did some hacking on Paladin and was amazed at how easily a couple of features came together. I *finally* managed to make drag-and-drop group reordering work correctly. This has been a feature that I've been personally missing since drag and drop was implemented in the project window. There's even a visual regular expression tester that's been added to the Tools menu.

The feature that's holding things up is the Code Library. The concept? Encourage (and in my case, simplify) code reuse by creating modules of code that, once imported into a project, remain synchronized with the master copy. It's a little like source control, but on a more basic level. It seems simple on the surface, but it's turning out to be more of a challenge than I thought. I personally plan to use it a *lot*, so I'm waiting to get it right before the next release.

Friday, January 29, 2010

Third Lesson and More

Yep, it's that time of the week. Out for study is Learning to Program with Haiku, Lesson 3. Amazingly, I seem to at least temporarily come out of my total lack of coding motivation. I've been doing some Paladin-related hacking. It feels nice to have the desire again. Hopefully it will stay a while. :-)

Thursday, January 21, 2010

Programming Lesson 2 Out

As promised, here is the second lesson in the series. The first lesson was all about taking the first baby steps, such as what a program is and what functions are for. Now we take a look at comments, a little bit about dealing with errors, and 10,000 foot view of how a compiler builds a program. Enjoy! Learning to Program With Haiku, Lesson 2.

Saturday, January 16, 2010

Branching Out

Sometimes I have plenty of useful stuff to say that really isn't appropriate for this particular blog, so I spawned a second blog, DarkWyrm Unabridged. There's even something to read over there now, too. If you ever wanted to know more about me personally, that would be the place to do it. It still needs some work on making look like a regular blog (as opposed to the cookie cutter variety), but it's a start.

Friday, January 15, 2010

Calling All Haiku Developer Wannabes

Have you ever wanted to learn to program for Haiku (or something else) but never had the money or the chance? Has something else gotten in the way? Even though I still don't have any real motivation to work on Paladin or write other code, right now I have plenty of motivation for writing about code.

I'm going to be publishing online programming lessons whenever I have some time. Usually this will be about one per week, but may happen more or less often on occasion, depending on how my spare time runs. These lessons will be available in PDF form under a Creative Commons license that will give me some options should I ever want to publish them in dead tree format.

Considering that I write fairly well and I've been teaching for more than 10 years now, this is quite an opportunity for someone who wants to learn to code. To kick things off, here's the first one. Learning to Program With Haiku, Lesson 1.

Sunday, January 3, 2010

Do BeOS and Zeta Matter Any More?

I just got to thinking the other day (yeah, nasty habit, I know) and I've started to wonder if R5 and Zeta really make a difference any more. BeOS R5, patched or otherwise, is just shy of 10 years old. In the land of Redmond, that's the difference between Windows 98SE and 7. Ouch. Hardware that will run it is increasingly hard-to-find, as well -- unless you run it on a recycled machine, at which point you run into hardware reliability problems at some point.

Although it's only been 2 years since the final release of Zeta, it's also been declared illegal via piracy, so current users are on shaky legal ground at best when using it. It also has a number of compatibility problems with R5 and Haiku, as well. Hardware support has been kind of funny in my experience -- some machines will run it and others not at all. There isn't any binary compatibility with Haiku with anything compiled on Zeta, either, which adds hassle to developers.

Although Haiku has made great strides, it is still buggy, and unless it sees a serious influx of developers in the near future, it will be for quite some time. Should developers even bother with writing code with R5 and/or Zeta in mind? Vote on the poll at the right and let's see who runs what. Maybe that will give a better answer than my own musings. :)