Archive for the ‘Software’ Category

XMC now on github

Sunday, November 29th, 2009

In an effort to get all my projects out in to the wild, I’ve pushed the XMC project out to github to mirror CSH’s local git repository server.

For those of you who don’t know what XMC is: Xen Management Console. About a year ago I began setting up a Xen “cluster” for CSH to use. With about 10 physical machines we needed a way to manage Xen and the VMs on them. We set up the hardware to be as dumb as possible by having them all PXE boot a nicely modified version of Gentoo that myself and Dan W. put together. These machines keep no state and have read-only root filesystems. Storage is on another system and shared via AoE (ATA over Ethernet) and a custom python server I wrote to manage the A0E exports. DNS/DHCP and are handled by another machine which is CSH’s central DNS/DHCP system as not to replicate services.

XMC allows for some fun things like drag and drop live migrations, basic load balancing when booting new VMs, and basic access permissions to allow users to boot/reboot/shutdown their own VMs.

The project was my first large scale working with Xen and python, so the code isn’t the prettiest you’ve ever seen. I hacked a lot of thing to “just work” and never had time to clean most of it up. Since I was concerned with making it work quickly I wrote some of the worst Javascript I have in a long time. I did use my jscore library, though, so that makes me a little happier.

At the moment the project is pretty dead and barely running due to hardware failures this past summer. Also, since I’ve moved on from school there seems to be some enterprising new CSH members who want to replace the system (hardware and all). Because of this I figure this project is probably dead, but maybe it’ll come in handy to someone, somewhere.

XMC on github

MailWrangler Source Code on github

Thursday, November 12th, 2009

I’ve received a number of requests for the source code of MailWrangler over the past year. Recently I finally spent the time to prepare and post it to github. Sadly I was unable to actually import it from SVN due to the repository being corrupted and not having a complete backup. I simply imported my most recent checkout of the code in to git, and pushed that. Not my first choice, but it works.

I’ve licensed MailWrangler under the Apache 2.0 License. It’s a little more restrictive of a license than my other projects, but it is also much more “popular” of a project than my others. I have no idea if anyone will really care — but hey, maybe someone will. I don’t have much intention to personally do much with the project going forward (a big part of me just letting it out in to the wild). I’m more than willing to accept patches and merge forks back in to the project and keep the code on github up to date from others. I suppose it could be a decent alternative gmail “client” for those of us with developer licenses.

The thing to note about the current state of the code is that it doesn’t really work. I wrote it for the first SDK released by Apple and never updated it. An update at some point broke some parts of it, namely being able to add an account. If anyone fixes it I’ll be glad to patch up my copy of it for others.

Enjoy.

http://github.com/adinardi/mailwrangler

A DHCP Server in PHP, why not?

Wednesday, September 9th, 2009

Over this past long Labor Day weekend I decided to attempt something just plain silly: write a DHCP server in PHP. You may be asking yourself what would ever make me think doing such a thing in PHP would be a good idea? I’ll tell you: why not? Also, when it comes to languages which run on a server — well PHP is the best I’ve got. I know enough Python, C/C++, Ruby, Java, Obj-C, blah, blah to be dangerous — but PHP and Javascript are my tried and true loves. So I figured why not. And then the question of why a DHCP server? There was an idea on Computer Science House last year to do a project to write a DHCP server which better fits the way we want to use our network (and the project never really went anywhere). I wanted to see if in a weekend I could do more then they did in weeks / months.

The objective for the weekend was to get a server which could accept, decode, process and respond to DHCP requests on the network. My first goal wasn’t to build a robust server — really it was to learn something new and see if it could be reasonably done. After pretty much two days of solid work (Saturday and Sunday) I had a working server. It assigns the same IP to every machine that requests an IP — but I was able to get a PHP program to handle sockets and UDP packet parsing to read and write DHCP packets correctly. That was arguably the hard part. The rest is just standard application logic.

The code is available on GitHub here: http://github.com/adinardi/phpdhcp.

What’s the plan for the future? I’m thinking of at least wrapping up the packet parsing class and have that available as a library for people to use. I don’t think it’s worth my time to finish the rest of the server. Being that I’ve already graduated and this is a critical service — there’s a good chance I won’t have the time to support it when they need it. As such it probably isn’t the best idea to actually put it in to production use there. Of course, if there are people interested in seeing this project completed — by all means let me know. I had planned on making the DHCP server part have a plug in system of changing the storage system backing the server so that it could run off a database and do things that the normal ISC DHCP server can’t be configured to do. When there’s no strict config (just an API that calls your storage system and asks for the info for some MAC address)  you can make your system return whatever IP / config that makes sense for you.

CSH was interested in a system where you could have statically and dynamically assigned IPs in the same pool. We’re running out of IPs so if we can have static assignments and dynamic mixed you can conserve space by not having to segment the network arbitrarily.

I think I need to get back to doing crazy things with javascript. Did you know there’s an implementation of the javascript runtime in javascript? Yeah.

Development on a Mac: Textmate + bundles

Thursday, July 30th, 2009

With the start of my new job I finally got a Mac to use at work. I’ve been using one at home for going on two years, so it’s nice to finally use an OS I like at work. With this comes the need to use a good editor for development.

At home I’ve used an array of IDEs and editors, never finding one I’ve really liked besides the old standard of VIM. I’ve used VIM for much of my development for years, so I’m pretty proficient. At the same time, it just doesn’t fit in well with OS X. I’ve used Textmate a bit before, but never really for long or on a large project. That was about to change.

Most of the developers at the company use Eclipse. I personally find it slow and buggy — and so do some of the other developers. I decided to download Textmate and give it a good, solid roll. I quickly got up to speed on the shortcuts and was able to get things done without cursing at my editor constantly. There were, though, shortcomings from the setup the other developers had come up with over time for Eclipse. Myself and another new developer put together a nice array of additional bundles to Textmate which made it complete for us to get our work done, at Mac speed.

  • Synchronize remote directory [rsync+ssh]
    • Forget trying to keep track of files you’ve edited to upload or using a separate sftp app for your project. This bundle allows you to set up a remote location to push files changes and full project synchronization to. It uses rsync and ssh so you’re looking at needing a remote unix machine with both set up and functional. Also, it uses SSH keys since I don’t believe it has a way to request a ssh password.
  • TM-Ctags (I’ve forked a fork and upgraded it a bit)
    • This will enable you to search for class, function, and other definitions in your project. When you update from source control or add code you need to update the index. Once that’s done you can search based on current text under the cursor, arbitrary search, or even code completion based on the indexed code.
  • Ack in Project
    • The built in find in project in Textmate is slow. This bundle uses ack to search much faster and also display results in a more reasonable fashion. It’s not perfect, but it is an improvement. I have some thoughts on upgrades I might make in the coming weeks.

That’s the short list for the moment. We’re finding new bundles to add all the time to make things better. Also, we’ve got a list of features we’d like to have and I’m doing what I can do find / upgrade / create bundles and plugins which fit our needs. Over time I’ll update this list with new additions.

Another GitHub project: CSH’s Drink Machine code

Saturday, April 18th, 2009

So the ecosystem is now complete. Until now we had CSH’s Drink code partially online. I’ve corrected this by moving from SVN to GitHub what I believe is the last bit of Drink’s code, the Java software running on the TINI boards in the machines themselves. For reference here’s all the GitHub projects:

TINI Hardware Code: http://github.com/adinardi/csh-drink-tini
Drink Server:  http://github.com/danw/drink
Touchscreens: http://github.com/adinardi/csh-drink-touchscreens
Old Javascript Touchscreens: http://github.com/adinardi/csh-js-touchscreen

I think that covers it. The TINI code and the Touchscreens are licensed MIT, and the server is GPL at the moment due to libraries being used. Documentation is kinda light, which will possibly change as I get time once classes end. Someone needs to make sure someone else can maintain this stuff once we’re gone, right?

Chances are better it’ll just get replaced. That TINI code is the oldest stuff here, dating back to 2005. We’ve replaced everything else since then. The server has been written twice since then. Yeah, CSHers get bored.

MailWrangler inquiries and update

Monday, March 9th, 2009

So lately I’ve been getting contacted a lot about MailWrangler. I have no idea why all of a sudden there’s renewed interest from users and journalists. I haven’t had time to respond to most people, sadly, but I’ll address some things here for everyone.

First off, chances are good I’ll never release MailWrangler. Originally the app was supposed to be my little entrance into iPhone development. I needed something simple to get acquainted with design, development, and distribution of iPhone apps. It was basically my “Hello, World” app. Of course, as the story goes, Apple rejected my app after taking way too long to review. By this point I’m already getting ready to head back to school where my time was only going to get harder to put into an app.

I’m not really mad at Apple, nor do I want to really make this a big deal. Its their App Store and they can make any rules they want. We knew the iPhone was a pretty closed system when we bought them and developers knew the App Store was going to be a pretty controlled place. We can’t say we didn’t see this coming; it’s Apple.

So where does that leave me? I don’t have much motivation to update MailWrangler to the latest SDK version (right now it compiles but won’t run… something changed) so I can’t even resubmit it. The app was just a little thing I threw together in a weekend, nothing big or special. Although I think it would be useful to have, even I don’t need it more than once every so often — the built-in mail app works well enough for my needs. Also, because of my issues with the App Store, it’s hard to put in effort on something that could just be rejected again. There’s plenty of stories out there and more all the time of people continuing to be rejected or ignored by Apple’s review process. It just isn’t worth my time to keep dealing with it.

Short story? I probably won’t be getting around to doing anything with MailWrangler again for a while. While I bet there’s a good chance I could get it approved eventually, it just isn’t worth my time right now (I’d rather spend it finishing out school so I can graduate in May, and enjoying those last months of college). And although I could release it via Cydia or other similar system — there’s a significantly smaller audience and I would still need to update the app to even work. Then there’s support and maintenance. Again, for me right now it isn’t worth it.

I think I’ll stick to web applications.

GitHub, JSCore & Touchscreens

Thursday, January 22nd, 2009

So a couple of weeks ago I decided to finally get some of my code out to the world. I’ve recently gotten pretty excited about using git for version control. Of course, GitHub is *awesome* so I posted my code there. You can take a look at: github.com/adinardi.

Two of my projects are available under the MIT license. First is the javascript library I’ve been working on for a while. It’s pretty basic, but includes all the good stuff like event handling, async requests, basic table generation & management, and a js bootstrapper. I plan on doing work on it here and there. The conventions I use in it are a bit of a mix of things I’ve done in the past and on first look can be pretty strange. I’d like to do an article on it at some point and why I did what I did with it.

The other project is the previous incarnation of the CSH touchscreen software. We were running opera 8 on some old touchscreens and this javascript was running on them. It’s not really useful to anyone except in an academic sense. I wrote most of it in about two nights or so in the Spring of 2008. I’d like to think it has a *decent* design and implementation. It isn’t some of my best work, but definitely ranks up there. It uses the JSCore library.

Now I just need to go back through more of my code I have around and get some more out there. I’ve worked on a lot of things — little of which most people can see. That’s what happens when you do a lot of work for companies — most people will never see it, and I’ll never see it again. *sigh*

MailWrangler and the Apple App Store

Saturday, September 20th, 2008

So in July I wrote a small iPhone app called MailWrangler. Basically this app enabled a user to add their GMail accounts (standard and Google Apps For Your Domain) which they could load and switch between them quickly. It embedded Webkit in to the app and logged you in to the accounts automagically. Normally to check multiple Gmail accounts in mobile Safari you would have to log in and out of all of the accounts, typing the username and password for each. Using just the Apple Mail application you aren’t able to see threaded views, your google contacts, archive (quickly), star, etc without going through the hassles that are present when using Gmail’s IMAP on the iPhone. There’s a similar app for the Mac desktop called MailPlane.

I submitted my application on July 17th. On August 29th I finally heard back from Apple:

… Your application duplicates the functionality of the built-in iPhone application Mail without providing sufficient differentiation or added functionality, which will lead to user confusion. …

This is an interesting claim since although handing email, my app is simply directly loading and showing Gmail inside of an application. How you can confuse Gmail with Mail.app I’m not sure.

There was another issue:

… There is also no way to edit an account once it has been added. …

I agree that this should work. Currently you have to delete and re-add the account. You don’t lose anything since all the account info stores is a username and password. I felt for a first release this would be fine (how often do you change your gmail password?). The number of apps with this specific issue and other issues that apps have which are in the store, mine seems to be on par or ahead of the game. If you’re going to have rules about this, enforce them across the board. The number of shitty apps in the store is off the charts and yet mine that actually works is getting blocked.

What did I pay to be able to do again? Oh right, deal with Apple’s messy bureaucracy. I guess I should just write another flashlight or glowstick application to actually get published. That’s the only apps Apple seems to want in the store.

LifeSync, Finally

Wednesday, June 25th, 2008

After a lot of reflection while looking at the ocean I decided to release LifeSync for free starting today. I realized much of the reason it wasn’t out yet was the need for a “perfect” 1.0 release version and setting up all the licensing and billing stuff. It is simply too much for only having a few hours here and there to do work on it. Releasing it free means a) it’s not perfect and since you’re not paying that’s a little bit more acceptable, and b) I’ll have more time to fix issues rather than deal with licensing and billing issues.

It really comes down to the fact that I can’t take people’s money without having a really great product. I think LifeSync does the job well (I use it constantly for my own calendars) but it isn’t the best. But for a FREE product — I think it is a great value.

So spread the word, there’s a FREE OS X Google Calendar & Apple’s iCal synchronizer available. You can get your copy at http://lifesync.thetr.net. If you think it’s worth it, feel free to donate something to me via the Donate button on the LifeSync pages!

Objective-C messages, checkboxes and booleans

Thursday, January 24th, 2008

So in the past week or two I’ve started a new project using Objective-C and Cocoa for OS X. If you want a good set of frustrations, here it is. Honestly.

It is hard, I mean really hard, to break out of the C++ style programming mindset. It really is automatic that when I think I need to call “doSomething” on “magicObject” to type: magicObject.doSometing(blah).
Instead I now need to type: [magicObject doSomething:blah].
It isn’t hard or overly complex — it is simply different. It isn’t how years of C++ style programming have trained my brain. And they’re not function calls, they’re messages. You send a message to an object and hope to God it does something meaningful with it.

And then there’s booleans. For whatever reason they strayed from TRUE and FALSE and opted for YES and NO. I can agree that most of the time thinking of things in YES and NO can make more sense — but it is once again hard to break habits. Of course figuring out that it is YES/NO was a pain enough. I should really find a few more good guides before continuing (and then I’ll need the patience to actually read them…).

And finally a checkbox in a Cocoa table view component. Nothing really complex about it by itself but once you layer on the fact that the checkbox itself uses NSOnState/NSOffState constants which map to integers. But the table view gives you an id (dynamically typed) object when something changes. I was consistently crashing my app when I attempted to use this value as just an integer. Reading whatever documentation I could led me nowhere. I finally found some random items on the internet that finally led me to try:
if ([anObject intValue] == NSOnState) {
Well that works. How the hell should I know to ask the parameter anObject for intValue. Honestly — if there’s a document somewhere in the Apple Developer docs that would have hinted at that I’d like to know — that way I know what to look for next time.

Returning the value for the checkbox when the table view asks for it was equally frustrating. I figured I’d just return NSOnState/NSOffState. Haha! No. You need to return an object so I had to figure out what it wanted and how to cast it. Finally:
value = [NSNumber numberWithInt:NSOnState];
Not exactly what I figured. Creating an NSNumber object and seeding it with NSOnState.

As with any new language and technology there’s a lot of things that people used to it assume and outsiders struggle to figure out. I’m hoping to overcome the struggling soon. Until then, expect a few more posts outlining my struggles.