Alieniloquent


YAGNI: byte-order conversion

August 29th, 2006

So I have this project, and it compiles for the Mac on both PPC and i386 architectures. Naturally, I have unit tests for this project.

One of the things that I’ve had to write for this is a simple SOCKS5 implementation (because of issues with Apple’s implementation). As part of this I had to do some manipulation of a port number and get the high and low bytes.

I’ve done this sort of thing before. That’s what htons and friends are for. So naturally, I went ahead and put this in where I thought it mattered and went on my merry way. On my ppc powerbook, my tests all passed.

Yesterday, when I ran the unit tests on my intel mac for the first time, I discovered that a test failed. It was failing because of some byte-order problem. After troubleshooting it, I narrowed it down to the htons calls. It turns out I did not need them.

See the thing is, on a ppc, things are already in network byte-order so htons does absolutely nothing. However, on i386 host byte-order is different from network byte-order. So the reason it worked on ppc was that it was essentially as if I hadn’t done it.

It turns out that the particular thing I was doing didn’t need the conversion to work correctly. I removed it, and everything worked peachy on both machines.

Linker warning: -bind_at_load

August 29th, 2006

Apple has had Intel machines for about a year. When they came out with the new architecture, they came up with the idea of a universal binary. It is a binary that will run natively on either the PPC or Intel architectures. None of the apps I work on have been compiled as universal binaries until today.

I just got my iMac yesterday, and it’s beautiful. The most interesting thing about it, though, is that it is an Intel machine. So naturally, when I got my projects all set up on it, I finally had to bite the bullet and make things work cross-platform.

That meant I had to recompile some frameworks to be universal binaries themselves. I also had to twiddle some build options. It was all well documented, and easy enough. But then I ran into a weird error that I couldn’t figure out:

/usr/bin/ld: warning suggest use of -bind_at_load, as lazy binding may result in errors or different symbols being used
symbol _atan2f used from dynamic library
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libSystem.dylib(floating.o) not from earlier dynamic library /usr/lib/libmx.A.dylib(single module)

After much searching, I finally found an article, and it explained what I needed to do. All I had to do was add -lSystem to my linking flags.

Now all I have to do is fix my one byte-order issue, and the program is all better.

Advertisements

August 25th, 2006

Erica has been doing this sort of thing for a while, but I haven’t been into my site enough to really care.  Now that I’m doing more with my site, I decided it was time to get on the bandwagon.  I’ve added some advertisements over on the far right column, and I’ll see how I feel about it in a month or two.  I’ll probably add some Amazon items and maybe other stuff too.

Project Goals

August 24th, 2006

Erica posted her creative goals, and I figured I’d do the same.

  • I’m working on a Mac app that will interface with Google Calendar and iCal to help schedule free time. It’ll be ideal for students who want to plan their homework or freelance workers who need to break up their day. Erica’s going to be cutting her Cocoa teeth on this project with me, but I’m doing most of the backend work.
  • There are a couple of Ruby on Rails projects I’d like to play with.
  • I think it is high time I revisit OCFit and get more done there.
  • I want to post more frequently and with some sort of theme. I think it’ll be largely programming focused.
  • I would like to find more speaking engagements.

So those are a few things that I’m looking at doing aside from work and school this semester.

Cocoa + Google = Yay!

August 23rd, 2006

So, I’m going to be writing an app to interface with Google Calendar, so I need to learn how to speak the Google Data APIs. The first part of this is being able to authenticate using their client login protocol.

I figured I’d throw together a simple little Cocoa app that just has text inputs for all the things that need to be sent and then I could do that.  I figured once I had the code written, I could extract it out into a class that I could use in my real app.

I spent 30 minutes remembering how to throw the GUI together (I’m a bit rusty).

I spent an hour or so understanding the NSURL API and figuring out how to url encode in Cocoa (it turns out there isn’t anything in the Foundation classes).

I spent another fifteen minutes not understanding why it told me my authentication was bad, despite it being correct, and then realizing I wasn’t actually sending my authentication information (or any part of the request).  It only took five minutes to fix it.

I now get a successful response back from Google when I log in using my little login testing application.  How cool is that?

New design

August 23rd, 2006

Well, it only took me one night. I’ll probably be tweaking for weeks now, but I got the main thrust of theming done.

I really have to compliment the Wordpress guys. Setting up a theme for their system can be as easy or as difficult as the particular designer wants. Their theme system is definitely the way to go for live blog redesigns, though: I could switch back to the other theme with a couple of mouse clicks. Very easy.

Let me know what you think of the design.

Pardon the mess

August 22nd, 2006

For those who actually read my site at my site, please pardon my mess.  I’m redesigning my site, and I have much less regard for how it looks than some, so I’m just going to piddle with it live.

On the up side, if you’re the kind that obsessively refreshes my blog, you can see how I design web pages.

Completely Recovered

August 22nd, 2006

Between my trash folder and cached copies of my pages on Google, I was able to recover all of the content I had deleted. I took advantage of this opportunity to redesign the site.

I made a new design, and I like this one much better anyway. So, it all ended well in the end.

Oops

August 21st, 2006

So I’m in my web directory, doing some stuff, and I notice the twiddle backup files that Emacs leaves when I edit remotely. They bug me. So I did the following command to remove them.

find . -name *.~?~ -print -o -exec rm {} \;

Some of you probably think that’s just greek. But others are cringing just as I did when I saw it remove all of the files in my directory. Sooooo, the other parts of the site are broken until tonight when I can fix them.

A Million Lines, Eighteen Months

August 16th, 2006

I just got back to the office after giving a talk to the Omaha SPIN group. It was a report on the experiences we’ve had and the lessons we’ve learned at my current employer over a year and a half of using agile methods.

If you’d like to look at my slides, they’re here.

Layout, design, graphics, photography and text all © 2005-2007 Samuel Tesla unless otherwise noted.

Portions of the site layout use Yahoo! YUI Reset, Fonts & Grids.