Why BBEdit?
I spend a lot of time in the terminal, but I spend an equal amount of time in my text editor. My main requirements for a text editor is that it be equally fast and powerful, but not try to do much more than just be a text editor. I have my terminal a quick command-tab away, so its very easy to jump back and forth, I don’t need a terminal built into my text editor. I also need my text editor to be completely accurate. What I see has to be what is written to the file, no “hidden syntax”. That’s why I prefer BBEdit. BBEdit has powerful text editing features, but it’s not overwhelming. It’s not trying to be your entire operating system.
Jekyll Bookmarklet
I have a handful of Automator scripts I’ve created to make maintaining this site with Jekyll just a little easier. The first script let’s me highlight some text on a web page and click a bookmarklet (or, more likely, hit the command+3 key combo), and the script creates a newly formatted Jekyll post with the highlighted text in markdown quoted syntax, and opens it in my default Markdown editor.
Personal Rules for Cocoa Happiness
- Understand every line of code written in my apps
- Use frameworks sparingly (see rule 1).
- Do not copy and paste code (see rule 1).
- Add lots of comments so I remember what I was doing at any given time.
- Manage memory as I go, don’t wait until I’m nearly finished and then go and “clean it up”.
- Draw out the application on paper before writing a single line of code.
- Search Apple’s documentation, CocoaDev mailing list archives, Google, and anything else I can think of before asking for help.
- When programming, quit Mail, Twitter, NetNewsWire, and IM. Turn on some non-distracting music in iTunes.
- Get a cup of coffee.
- Remember, “This is hard, you are not stupid.”
Ping from Cocoa
One of the features of Servers.app is that it pings the host and shows a little indicator for it’s status: green is good, red is dead. Getting that little feature in here was not quite as easy as I thought it would be. After searching the Apple documentation for what seemed like years, I stumbled across SimplePing. It was perfect, exactly what I was looking for. I dropped the two source code files into into my project, read through the documentation commented out in the header file and added the code to call SimplePing. It worked, and everything seemed fine. Except that it kept working, even when I knew for certain that the host did not exist.
So, I started digging through the source code for SimplePing.c, and found that instead of calling a standard error message, it called perror, which, according to the documentation, doesn’t return a value. This is fine if you want to log the ping results, but I wanted to ping the server and make a decision based on code. So, I changed a couple of lines of code from this:
if (error == 0) //was able to wait for reply successfully (whether we got a reply or not)
{
if (gotResponse == 1)
{
{numberPacketsReceived = numberPacketsReceived + 1;}
}
}
to this:
if (error == 0) //was able to wait for reply successfully (whether we got a reply or not)
{
if (gotResponse == 1)
{
{numberPacketsReceived = numberPacketsReceived + 1;}
} else {
error = 1;
}
}
Simply adding an extra else statement in there to return an error code gave my application something to work with. Now, from my application controller I can call SimplePing like this:
int systemUp;
systemUp = SimplePing(cString, 2, 2, 1);
After that, I can make decisions based on the value of the systemUp int. Now, it’s entirely possible that I’m doing this wrong, all I can say is that it works for me now, and it didn’t before.
DiggBar This
I’ve put a lot of work into this site. I’ve put thought into how I want the URLs to look, how the layout should feel, and since the site has my name on it, I wanted it to be good. I created a custom theme for the site which will purposefully only work here, and I’ve even done a bit of personal “branding” I suppose with the jb{ logo.
So, when I saw that Digg had decided to take a page out of 1999’s web play book and start framing sites inside of their DiggBar, I was more than a little annoyed. There may be only six people who read this site on a regular basis (Thanks guys!), but this site is entirely mine. The DiggBar removes the URL from the site you are reading and adds it’s own custom shortened URL, making it hard to bookmark, or really even remember where you are.
Cocoa
Last summer I decided to dive into programming and give it everything I’ve got. For months, I would get up at 5 and pour through the Hillgass book, every page, every challenge. I’d revisit it at night, after the kids were in bed, and code till I couldn’t stay awake any more. I finished the book, and started coding my first real application. It was then that I found out how very little reading one book gave you. Hillegass says he gives you 80%, I’m thinking it’s more like 50%, tops. I reached out to the Cocoa Dev mailing list for help, and eventually even went to a CocoaHeads meeting with the local chapter. Meeting some “real” developers, I despaired. There was far, far too much that I didn’t know, I felt that it would take me an entire lifetime to learn what I needed to know. I gave up, wrote Goodbye Cocoa, and focused on something else.
Goodbye Cocoa
Some times, things come easy to me. I’d like to think that I’m somewhat blessed in that way, especially when it comes to various forms of technology. Back in the Navy, I found I had a knack for telecommunications, and I found that I could grasp the flow of the circuits through various media easily. I nurtured this technological edge, and turned it into a career as a systems administrator. It meant lots of long nights and many mistakes along the way, but it was fun, I enjoyed it. Like I said, some things come easy… but some things just don’t. For example, I have no mental capacity for sports. I enjoy playing every now and again, but I can’t keep track of who’s who and what’s what in this professional team or that college team. It just doesn’t come easy to me.