| Unix is Easy | |
| by Jon on Tuesday, May 1, 2007 | file under: Technology |
You just need to know what to tell it. |
|
|
|
| Nokia N800 | |
| by Jon on Wednesday, April 25, 2007 | file under: Technology |
![]() A few weeks ago I purchased a Nokia N800 from a floundering Comp USA in the Phoenix Metro area (from my vantage point, it appears that all CompUSAs in Phoenix Metro are closing). I always liked the idea of the Nokia 770 when it came out, and the N800 seemed to be enough of an upgrade for me to consider it very compelling... compelling enough to take the leap. I was looking for several things:
Let me expand on those three things. Currently, Kortney and I have a nearly 4 year old TiBook that's still kickin' it hardcore. Its a great laptop, with a nice rugged, metal frame, beautiful display, and it still has enough power for what we do day to day. My only complaint is that when I'm carrying two big text books for class, it adds quite a bit of weight to my bag. Plus, when I take it, that leaves Kortney without a Mac (but with a dual-screen Linux box!), and without the computer configured for her most efficient use. I wanted a device which would allow me to leave the laptop at home when I went down to school, but wouldn't require me to a) carry a full size notebook computer with me, and b) give up any of the functionality of a "real" computer. I also wanted a small device because I thought it would help me keep track of all the stuff I need to do for school and at home. Kortney and I both keep everything in iCal and subscribe to each other's calendars. I have a laundry list of to dos and all my contacts arranged (many with pictures), in Address Book. I wanted something that would let me take those repositories with me, and allow me to edit them remotely, and sync back up when I got home. My phone can already do that (sans to dos), but adding a calendar entry with a numeric keypad is an exercise in frustration. Finally, I wanted something that would allow me to get on the internet. A device that would allow me to When the Palm TX was released, I thought that was the device that was going to do all those things for me, but it had one problem: it came with an aging version of Palm OS that I probably wouldn't be able to update when Palm decided they couldn't milk that cow any longer. When the 770 was released that replaced the TX as the device of interest, and when the N800 came out this past winter, I was ready to pull the trigger (well, the device release, and the fact that CompUSA had slashed the price). So, does it live up what I was looking for? With the addition of a Bluetooth keyboard, I think the N800 would work great as a short range laptop replacement. It already has a fairly large application library thanks to the 770. The screen is bright and crisp, for a Unix-geek, all of the standard utilities are there, and for a non-Unix geek you can get most everything you need, including word processors (AbiWord) and spreadsheet programs (Gnumeric). I'm a bigger KDE fan then Gnome, so its unfortunate that the majority of applications are Gnome ports, but there are several people who have full KDE stacks running on their N800's, so that may be a possibility down the line. As a PDA, the N800 has some room to grow. If you are just using the N800 to keep track of appointments, contacts, and tasks, or if you are using Linux as your primary desktop, the GPE PIM suite will probably work for you. However, if you are looking for something that will sync with iSync and all of the Apple apps like I am, the N800 is like a little island. I have had success pushing calendars to to the device, but in a read only capacity, and have had no success getting modifications back from the device. Like most open source apps there is also a divide in how things should be done. The N800 comes with an address book repository which other pre-installed apps use, but third party apps all seem to use their own contact database, providing no way to sync between them. I know the GPE PIM suite was developed tangentially to the Nokia Internet Tablets, but when they were ported, they should have used the Nokia address book. There way may have been infinitely better, but as a user, I don't care, I just want everything to use the same data. If anyone does work on creating an iSync plugin for the N800, I'm guessing they'll also have to choose a collection of applications to support. Which means it may not support the programs I'm using on the N800. As a PDA, the N800 may be useful to some, but has a way to go before it will be useful for me. Fortunately, as an internet appliance it excels. I can get on the internet practically anywhere I get phone service (using my phone as a Bluetooth modem). My home screen has the weather forecast for the next 5 days and the latest RSS feed entries. I can stream internet radio to the device, including BBC. YouTube videos are shaky, but watchable. And the Opera browser is fantastic. I am surprised Nokia went with Opera when they have been using WebKit on their Symbian phones, but really, Opera does a great job. The N800 still has a long way to go, but is a relatively young platform. The package manager is great at keeping apps up to date, but it seems that essentially every app has its own repository. Coming from a Gentoo, FreeBSD/MacPorts background, its really nice being able to install any application from a single repository. The device also seems to have an identity crisis when it comes to being operated by stylus or fingers. Many of the buttons are much to small to accurately hit with even my tiny fingers, but there are other facilities that literally enlarge to facilitate thumb navigation. I would like to see finger navigation expanded in future releases of the platform software. Overall, the N800 is a fun little device with a lot of potential. I have a fear that in June, however, any of its merits will be overshadowed by the iPhone. I've read that usability is high on Nokia's list for its next software release, but they are up against the kings of usability. On the open source front, developers need to start thinking like Apple: open source is a great foundation, usability is the ultimate goal. |
|
|
|
| On Web Scaling | |
| by Jon on Tuesday, April 24, 2007 | file under: Technology |
|
At the beginning of the year I was doing a lot of web scaling work, which wasn't dissimilar to the web scaling work I had been doing about a year prior to that. There's a general problem that every semi-successful web developer is going to have to face at some point during their career: a small fraction of web users want your content, but, there is a gigantic number of web users. The app I'm working on at the moment gets around 50,000 requests per server during peak traffic hours (including static and dynamic content). Its currently spread across multiple servers with a hardware load balancer in front of it. When I came back to this project (I had moved to other things and this project had certain upcoming opportunities that interested me) all of the servers in the cluster were pegged, with a load equal to the number of CPUs in the system. (For the non-Unix guys and gals, your load average shouldn't get above the number of processors you have in your system. For most systems that would be 1.0, but servers are generally higher then that.) I combed through the app looking for bottle necks, and was able to significantly reduce the load on the servers by just specific ways the app was written. No hardware was changed to drop the load significantly. With a few changes, one server in this cluster could now handle all of the traffic (of course, for redundancy reasons, there are multiple servers). So how can we go from take an app from snail to a cheetah? Lets find out. A few more details, this project was written in PHP, which can scale very well, if you don't bog it down. Many of the techniques, however, are applicable to any app.
Those are just a handful of pointers which have served me well over the past few years. These all might seem basic to you, but a large amount of professionally written code I come across never takes performance or salability into account. The general excuse is that it works for the amount of traffic at the moment. One day you'll get popular though. You'll get posted to Digg or Slashdot, and you'll be happy your code scales. Either that, or you'll be trying to put up a static page which apologizes that your content has gone missing. |
|
|
|
Automate iSync with launchd
|
|
| by Jon on Friday, March 2, 2007 | file under: Technology |
Back in July, I wrote about scripting iSync so it would automatically sync my phone every night via a cron job. The solution wasn't perfect, but it worked pretty well. Since then I've become fond of Launchd. I've written LaunchDaemons to keep run my nightly backups and keep Darwin Ports in sync. While reading the Launchd entry in Wikipedia yesterday, I came across this section on LaunchAgents:
Let me back up a little bit. While my AppleScript + That's where LaunchAgents come in. LaunchAgents have the ability to run a task at a given time or given event, can be run as a specific user, and can run tasks which require a user interface. Bingo! I've modified the script slightly since the last time I posted it, so here it is again. The major change is now the script uses iSync's return status as an exit code instead of just returning the value.
Again, I saved this to Instead of scheduling this with cron, lets create a LaunchAgent for
I'll quickly highlight the various fields in the plist. Take that plist, modify it to your liking (or use Lingon to create one for you) and save it to
Now run it to make sure it works:
If everything worked correctly, iSync should pop open, sync whatever it is you want to sync, and quit iSync. Now that the job is loaded, it should run at the interval you assigned. That's just the tip of the Update: I've received a few emails mentioning whitespace issues when copying and pasting the above AppleScript, so I've uploaded a binary here. |
|
|
|
| PHP 5 Type Hinting | |
| by Jon on Tuesday, February 20, 2007 | file under: Technology |
|
Since PHP 5.1, developers have been able to add "type hints" to function and method declarations. This is a huge boon for OO development in PHP, and promotes use of defined objects instead of hashes, arrays, and invariants as well as helps find errors which may otherwise go unnoticed. In the past, a variable of any type was able to be passed to a PHP function. Say you wanted to pass a database connection object into a function, you might declare something like this:
That's a relatively simple function. But wait, what if
That's safer; the function above ensures we're getting an We want all the safety of the above code, with the benefit of allowing subclasses to be accepted as well. We can get that by a slight modification to the original method:
All that was added was the What do you mean we no longer have to worry? To be frank, you're program will end with a fatal error if this function is called with an incorrect data type. That might sound like it sucks at first, but it means that your program will die quicker, meaning you can find bugs quicker. It also means the stack trace you get will include the line of code which called the type hinted function, not some line in the middle of the function which provides no hints to what called it with the incorrect type to begin with. What happens if we call
That's great! We die early so bugs show themselves sooner, we declare parameter types, so callers know exactly what they should be passing in, and we save quite a bit of manual error checking required to make our methods safe. This also allows you to define and use classes like C structs (a class which contains only public members) for passing data to methods and functions in place of arrays and hashes, which is so commonly done in PHP. Creating and passing a struct to a type hinted function or method ensures that you know exactly what fields and methods are available to you. You also don't have to worry about misspelled string hash keys. You can let the interpreter do all that work for to ensure you're accessing valid fields and methods. Are there any drawbacks? Unfortunately, the only native type that PHP allows hinting for is This is also a feature of PHP 5.1 or later and is not compatible with earlier versions of PHP. This could potentially make you're apps less portable. There are also many hosting providers still running PHP 4, which has no support for type hinting at all. Finally, there is no facility for hinting return types, meaning even if you know you're input to a function is good, you don't necessarily know the output is as well. If you are running PHP 5.1 or later, type hinting can be a great way to find an eliminate bugs, before they bite you. It can also allow simpler and safer functions and methods that are also self describing. If you have no backwards compatibility requirements, you might want to give type hinting a shot! |
|
|
|
| I'm a Big Fan of C++ | |
| by Jon on Monday, January 22, 2007 | file under: Technology |
|
When you read Digg, you're bound to find nonsense, and I try not to bite, but sometimes you get irked. An article written by Jeff Atwood appeared on Digg over the weekend which links to a two part interview with the designer and original implementor of C++, Bjarne Stroustrup. I have long defending C++ as a great programming language, especially to Java programmers who seem to only appreciate the flexibility of C++ when the features, which they previously derided, are added to Java. In Jeff's post he has a big block quote from Bjarne and then proceeds to blast C++ on two points which are aren't really valid. His first, C++ is fast but unforgiving, is only that people don't have any more brain capacity but computers have quite a bit more computing capacity, so lets waste some of that computing capacity to save the poor programmers. I was thinking aloud this weekend why my current computer is seventy-two times faster then the computer I cut my teeth on, but doesn't 'feel' any faster. His second point is that C++ is designed to be extremely flexible. Wait, that sounds like a benefit, not a drawback? He then goes on to say that it can be used to write operating system kernels and device drivers. He might not realize it, but everything in the KDE stack is C++. I don't know of any websites that are built in C++, but I don't believe it would be as dangerous as he presupposes because of the great data structures included in the Standard Template Library. Buffer overflows? Who's using C++ offers features that most other OO languages don't: access to pointers and the ability to manage memory, among other things. I'm astounded when I read or hear people thinking these are disadvantages. If you don't want to deal with memory management or pointers, pass objects by value or reference and allocate all of your objects on the stack (i.e. don't use the For some reason I allow myself to become uptight when Java programmers celebrate a recently added feature of Java, when it has been long since available in C++. A relatively recent example (the past few years), has been "generics", which we called templates in C++ before generics were available in .Net or Java. Meanwhile, Java developers sit by while useful features like first class functions and operator overloading (if Sun can do it, why can't I?) escape the grasp of Java programmers everywhere. I often read that C++ is difficult to learn and use, but must be missing something. I've written projects large and small in C++. I've always thought it was a very natural extension to C, which isn't a very difficult language to learn in the first place. Best quote from the interview:
This is one of the most telling statements in the article: and unfortunately its all to true. I'm sure most Java programmers would feel right at home developing in C++ and if they sprinkled in a few "delete" keywords at the end of their methods and learned about destructors, not only would they have portable code (just a recompile away), but code which is much faster than their Java counterpart. I've given many programming languages a shot ? Java, Objective-C, Ruby, PHP, C++, C, C#, Perl, JavaScript, and Bash are the ones I can think of off the top of my head &emdash; and C++ remains one of the most elegant. The one's I've stuck with are the ones I found compelling: C because its universal, fast, and familiar; C++ because it provides the power of OOP to an already great language; Ruby because I like the syntax, style, and rapid pace of development; PHP because its a ubiquitous and fast web development language; Objective-C because its a defacto standard on Mac OS X, my platform of choice; and JavaScript because its the defacto standard for client-side web development. I've left behind Java, Perl, C#, and Bash because I have no compelling reason to use them. Anything I can write in Perl or Bash I can write in Ruby, which I'll find much more enjoyable and find easier to read if I need to come back to it later. And personally, I have no need that Java fills (except, perhaps a paycheck!). If I want something fast and compiled, I'll write it in C/C++. If I need to write something quickly, I'll do it in Ruby! I'm sure other languages work great for other people, but I'll stick with C++ while keeping my feelers out for anything better (D is intriguing, but I still don't see any compelling |
|
|
|
| iPhone in the Times | |
| by Jon on Wednesday, January 10, 2007 | file under: Technology |
|
The New York Times has a great article which highlights what I like about Apple the most: their dedication to detail, their commitment to things that work like you'd expect them, and their discipline in not releasing anything which doesn't meet their extremely high standards. Oh yeah, the article mentions the iPhone, too. I just hope there is a way to get one without a Cingular contract. It seem to be the mobile device I have been looking for (and it just happens to be a great phone as well!). |
|
|
|
| Automated Blog Tagging | |
| by Jon on Monday, January 1, 2007 | file under: Technology |
|
In the middle of december, I finished my first "real" semester of graduate classes at ASU. One of the more interesting projects I completed was a method of assigning multiple classes to blog posts, using a modified version of Ben Kamens' Bayesian Tournament Algorithm, which itself is an expanded version of the standard two class Bayesian spam algorithm described by Paul Graham. Kamens expanded on Graham's algorithm by moving it beyond a two class problem. With the Bayesian Tournament algorithm, instead of only classifying things as something or not something (typically spam or not spam), one of several categories might be chosen. For example, you might train it to sort your email into work, family, and spam. That's all well and good, but tagging is catching on like wild fire, and typically a piece of media is given one or more tags. I couldn't really find anything having to do with classifying things with more than one category, so I thought I'd give it a whirl, and the results seemed to be largely successful. To go along with the project, I created a "blog editor" which was a mocked up and simplified version of where you might enter a blog post, which was hooked up to a classifier I wrote which was trained posts from the The Unofficial Apple Weblog. Here's a screencast showing how the editor classifies your post as you type. The screencast doesn't have any audio, so here's some commentary. It first shows a shot of a post from TUAW along with its tags (Software, Cool tools, Productivity, Internet Tools). It then pans over to my editor, showing how it classifies as you type, with an author entering the text of the post shown previously. In the end, the classifier chooses Internet Tools, Productivity, Cool Tools, Analysis/Opinion, and Software as the tags for the post, pretty close to the tags chosen by the original author! For the record, this post was not in my training set, and those tags were completely chosen by my classifier. The paper was rushed, but gives an overview of the implementation for anyone interested. It was a lot of fun building a working classifier. |
|
|
|
grep Colors
|
|
| by Jon on Tuesday, October 10, 2006 | file under: Technology |
|
I've posted a few times about adding color to console apps in OS X, so I thought I'd post another tidbit I found this past week. The GNU version of To get this functionality every time you use grep, you can make an alias:
and put that in your ~/.bash_profile, or if you are an admin on your system, in /etc/profile. run To set the color, add:
to the same file you added the alias to, replacing Happy computing! |
|
|
|
| On Dropping "Power" | |
| by Jon on Friday, August 18, 2006 | file under: Technology |
|
Or: Why Dropping "Power" Doesn't Have Anything to do with PowerPC. With the coming of the Intel chips, we see the going of the "Power" prefix across Apple's product lineup. Gone are the PowerBook, and the PowerMac. Say, "Hello!" to the MacBook Pro and the Mac Pro (both with capital descriptors by the way, unlike the Mac mini, iPod shuffle). Over at Daring Fireball, John Gruber has been pondering aloud in reference to the name change, "But then why not the Xserve, too?" Why keep Xserve around, when there's no "Mac" in the name. Why is the iMac alone in having a prefix? Back in January, Steve Jobs said they were changing the name of the PowerBook line to MacBook Pro, because they wanted to get Mac in the name of each of their Macintosh products. I think that was a red herring. I think the real reason is Jobs' need to have ownership of the entire Apple product line, to have his fingers in every piece of Apple's "insanely great" product lineup. As Low End Mac (Via the Linked List) points out, there were 20 PowerBook models before the introduction of the PowerPC. So the "Power" in PowerBook was a descriptor of its abilities, not of its hardware. It also wasn't a product name that was coined while Jobs was at Apple. The PowerBook was released in 1991, six years after Jobs departure from Apple. A similar tale goes for PowerMac. The first Power Macintosh did have a PowerPC processor, but was also introduced well after Jobs had "left". This would explain why Xserve wasn't changed to MacServe or something similar. It's a Jobs Era name. iMac, again is Jobs era. In fact, with the move to the Mac Pro, every Apple product has been named while Jobs was at Apple, from Macintosh in 1985 to the Mac Pros in 2006. Any Apple product which was created during Steve Jobs absence has been dropped, or renamed. So, while there are many who claim the Newton was the best PDA, don't expect a new Apple Newton, it didn't have Steve Jobs' blessing. I'm not saying Apple won't release another PDA, it just won't be called a Newton. With the names all tied up, I think Steve Jobs is also ready to give some responsibility back to some of the other senior officials at Apple. Jobs didn't command the entire WWDC keynote like in recent years, instead handing off to several different presenters over the 90 minute presentation. In the years since Jobs return to Apple, I think it was important for both Apple and Job's own pride to show people how he was planning on turning Apple around. And that's what he did. Apple has made a significant recovery from the mid-90s, and Steve Jobs has put his mark on each and every product to show that he is person most responsible. Now that he has dusted off some of the last bits of evidence of the old regime, he probably feels comfortable giving a little more power to the people he's groomed over the years. And besides the awkward pronunciation of MacBook (doesn't quite roll off the tongue like PowerBook), I don't think anyone is disappointed with the moves Apple has made in the last 9 years. Of course, this is all speculation on my part. If Steve Jobs really is cleaning out the last remnants of the Sculley, Spindler, and Amelio years, I wonder if the QuickTime team is ready for a name change? Alternate Ending: What if Apple would have gone with Bicycle instead of keeping the Macintosh name. Would we be seeing Bike Pro coming and PowerBike on its way out? |
|
|
|
Newer Posts
|
Page 3 of 26 |
Older Posts
|




Newer Posts