Archive for the ‘programming’ Category.

text editors I have known

I write code for a living. Primarily PHP, but increasingly HTML, CSS, XML, JSON, Objective-C/Cocoa, Processing, and Arduino code. Over the last 8 years, I’ve been going back and forth using several editors. It seems kind of silly to think that I could have used 5 or 6 different programs to edit text, but there are good reasons why. So here’s an incomplete list of things that caused me to use, stop using, and maybe restart using these GUI programs:

  • BBEdit
this is by far the program I’ve used the most. It’s the only program I trust to open a 100 Megabyte text file. I’ve been lucky to have my company pick up the latest version of BBEdit pretty much immediately after it’s released, so I’m particularly excited by the version 9 features. Code completion is nice. It seems to be pretty good about knowing about PHP. It doesn’t automatically close tags for you, but it does seem helpful. Another great feature new in this version is being able to drop a folder onto the BBEdit icon, and it will give you a file browser in a sidebar, and let you edit documents, tab free, directly from the file browser. Like every other modern text editor, it has clippings, or snippets, which is helpful. It’s search really is the best I’ve ever used. It’s just really nice. It saves search and replace actions for easy callback. It uses Grep. It’s nice. I would be nice if you could choose other syntaxes, grep certainly seems powerful enough. Mostly it would be nice to get some interactive experience using other regex modes. Not a deal breaker, I get my work done when I use BBEdit. There are so many great features in BBEdit, it’s hard to condense it down to one paragraph. As of version 9 and these new features, this application is back in my application dock. 

  • TextMate
Textmate popped up a few years ago and was a stark contrast to BBEdit at the time. It’s major features that are different from BBEdit would be tab-commands, where you predefine snippets or commands and assign them to a key combination. Then when you’re editing text, you can type things like snippet-[tab] and whatever you defined as “snippet” will be replaced. It’s very powerful and can be very, very helpful. It has support for lots and lots of languages, and I’m sure there are a ton of features that I don’t know about. For PHP, i haven’t found it to be spectacularly helpful. As I’ve gotten into using SVN, I’ve noticed that TextMate creates a hidden .filename for *every* file it comes into contact with. So along with not being extraordinarily helpful with code completion with PHP and creating lots of not-invisible files, I’ve taken this off my application dock for now.

  • Coda
Coda is kind of a lighter-weight text editing tool whose main focus is to reduce the number of tools required to do web development. It’s major feature is having text editing, CSS editing, web browser for code preview, terminal functionality, FTP connectivity through Transmit, and a slightly weird technical reference… all mashed into one application. It has some nice features… Really nice, in fact, for a budding programmer looking to learn or troubleshoot html/php/css code. I used this app to cement my understanding of how CSS works because of how easily you can roundtrip from editing to preview, in fact, on the same screen in the same window with screen splitting. Pretty nice. My particular job doesn’t require me to do this much, so while I admire the product immensely, I do not have this in my day-to-day set of tools. I am using it as a teaching tool, though, because I feel like it’s aimed directly at being fast and useful for learning CSS. 

  • Komodo Edit
This app is a recent entrant to my toolbox, and I have to say that I’m *really* impressed. Komodo Edit is the “free” version of Komodo’s larger suite of development products, but I’m finding it to be very full-featured. What I love about this program is how extremely PHP aware it is, and how it helps me keep my tags closed. I find writing code in this program to be very easy, easy to read, easy to understand what’s going on where, and generally kind of awesome. There are a few things that aren’t quite as awesome as I would like, such as: It would really prefer you start a new project for everything. You can open individual files without doing this, but if you want to drop into a folder to edit more than one file, you gotta start a project. It’s not so annoying that it’s preventing me from seeing the awesome PHP code editing power it has, but I would love this app more if I could skip the project files and just edit files from a folder browser like every other text editor in this list. Also, I find the search and replace to be kind of annoying because it requires you to check a “replace” checkbox every time you bring up the search field. Even if you were just there and want to tweak your search or replace criteria. When I’m starting whole new projects, I’m trying to use Komodo Edit, but lately when I’m editing preexisting projects, I’ll drop them on BBEdit.

  • Processing/Arduino IDEs
I’m only putting these in this list because they have two features that i wish I had in other text editors: keyboard-shortcut code cleanup and reformatting, and a “prepare for discourse” function where it creates a snippet of HTML that’s ready to post to a blog or discussion board. Super nice. Otherwise, these IDEs are kind of painfully minimal. But I put up with them because of what they produce. :) Which is awesome.

  • XCode
Xcode is hands-down the best text editor I’ve ever used for objective-c and cocoa. It has *The Best* code completion niceties I’ve ever seen, and should be the absolute envy of every other text editor on this list. Hear that, everyone? Emulate the code completion functionality that XCode has. Sadly, XCode seems to want to actively not be useful for PHP. I’ve long held the idea that XCode would be a *killer* IDE for PHP if it only knew about its syntax. It’s unbeatable for Obj-C and Cocoa, and possibly for other languages, but I only use it for Mac OS X and iPhone development. Since all of these things are text based, I end up wishing I had some of the features from XCode in *any* of the tools I use for PHP… but oh well. :) 


Technorati Tags: , , , , , ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

West Valley College Cocoa class fall 2008

The cocoa programming class at West Valley College has returned. Sign up now.

http://westvalley.edu/documents/catalog/2008-2009_WVC_Catalog.pdf

“Page 62″

CIS 37.6 COCOA APPLICATION
PROGRAMMING
3 units
Co requisite: CIS 97.1A
Acceptable for credit: California State University
Programming Apple OS applications in Cocoa is
explored in this course. Using an object-oriented
paradigm, Cocoa builds graphical-user-interface
applications to run within the Apple Macintosh
operating system. Cocoa relies upon object-ori-
ented concepts: Objects, Classes, Methods, and
Messages as well as the collection of classes
called Frameworks. Students in this class begin
their work on simple applications and, by adding
features and re
inements create more advanced
applications. Credit/No Credit Option

The specific class you want to search for is:

CIS*37.6*63169

There’s probably a lab course you will be compelled to sign up for. Last semester it was:

CIS*97.1A*67759

I don’t know if that last part of the course is correct because I can’t register quite yet. If you took the class already, you may need to have Pat Fenton intervene on your behalf with admissions (like me)… Hope to see you there!

Technorati Tags: , , , ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

RSS feed parsing with PHP

Did I mention SimplePie yet? http://simplepie.org/ Holy cow, if you’ve ever used Magpie RSS, and are looking for a more robust solution, check out SimplePie. It’s a great PHP library that parses RSS or Atom.

Technorati Tags: , , , ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Hacking Santa Snaps

Cocoa Duel had a great holiday themed coding competition. One of the entries was Santa Snaps. Santa Snaps lets you take your camera’s input and overlay some holiday themed graphics like a santa hat or reindeer antlers. We all had a fun time at our house playing around with it before xmas, but I started thinking about how cool this would be for our upcoming “Party 2-007″ james bond themed party. I’m very grateful that John Casasanta decided to upload the source for Santa Snaps because even a newbie obj-c hacker like myself had a fairly easy time of locating the things I needed to in order to change the graphics to more bond-appropriate ones. You can too, check it out:

download the source here: http://macheist.com/SantaSnaps/SantaSnapsProject.zip, unzip it, and open it up in Xcode.

Finderscreensnapz002

This one.. “SantaSnaps.xcodeproj”. If you have Xcode, you should be able to just double click the file.
Locate “Controller.m” in the classes folder as illustrated below….

Xcodescreensnapz009-1

See that there on line 26? @”santa hat”, @”santa glasses”, @”santa beard”, etc? This is the line you’re going to be changing.

Now, It doesn’t really matter how you generate your PNG files with their alpha channel in tact, as long as you do. I used to work for Adobe, so I use Photoshop. Take one of your photos that you took with SantaSnaps and open it up in whatever image editor you’re using. This will give you the frame size to use as well as a good indication as to where to place whatever new graphics you’re going to be placing. Then place your graphic where it should go, turn off the background layer, and save the file as a PNG file.
Photoshopscreensnapz001StevewithagrillPhotoshopscreensnapz003


Back to Xcode. In controller.m, on line 26, change the name of the first item @”Santa Hat” to @”whatever your file name was”. Drag your new PNG file into the “Resources” folder inside of the santasnaps xcode window. I’ve illustrated several changes that all happen the same way. Change each item in the “NSArray arrayWithObjects” list, and drag the actual graphic file into the resources folder. The order corresponds to the button order in the interface, so… keep that in mind.

Xcodescreensnapz008-1

At this point you could hit that “Build and Go” button and when you hit the santa hat icon in the application, your new graphic should show up.

Stevejaws2

This is the majority of the hard part. The other part is to edit the nib file, which in my opinion is much easier to do than digging through code. To replace the existing buttons with ones that match your new graphics, you’ll need two states for each new button you want to change. The selected state and the unselected state.
unselected
Grill Unselected


selected
Grill Selected

Find SantaSnaps.nib either in the project folder in Xcode or the finder and double click on it. It’ll look something like this:
Interface-Builderscreensnap

Drag your two button graphics, one at a time, into the nib file’s graphics tab. It’ll say something like “you want to add this to santasnaps project, yeah?” Yeah, you do. See below for “grill_selected” and “grill_unselected” :
Interface Builderscreensnapz004

and then drag and drop your unselected state graphic to the corresponding button you want to change, as seen in the upper left corner of this graphic:
Interface-Builderscreensna2

The last bit is to bring up the inspector palette and change the alt-icon state to the other graphic’s name. See below:
Interface-Buildersc3

see above… Icon: grill_unselected
alt. Icon: (change from “Santa Hat Button Pressed” to:) grill_selected

That’s it! Easy! :) Save the nib file and re-[build-and-go] from Xcode. Once you get the first one working, you’ll get into a regular rhythm for the other 8. Good luck! This is all I know, I don’t know anything else, I can’t help you any further. :)

Technorati Tags:

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

the love/hate relationship with sourceforge

Now, I love sourceforge, but it’s becoming my opinion that having actual files associated with a project should be a requirement for starting a project on sourceforge.

Technorati Tags:

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

xcode: tab through arguments for autocompleted calls

when in xcode, you can start typing just about anything and hit escape or f5 to get it to give you a list of suggested things to automatically complete what you started typing.

Xcodescreensnapz001

Once you select one of the items in the list, hit control-/ to go forward, control-shift-/ to go backwards through the list of arguments… handy!

Xcodescreensnapz002
Xcodescreensnapz003
Xcodescreensnapz004
Xcodescreensnapz005

Technorati Tags: , ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

MySQL : “how many records per day?”

I just figured out a cool MySQL trick. I’ve been stupidly doing a very large loop through each month and possible day of the month to query my table for a run-rate per day… as in, “how many records were recorded for each day the data has been accepting data?”… No more large number of queries to get this data, just one:

SELECT DISTINCT(date(your_date_field_name)) AS thedate, count( * ) AS count
FROM your_table_name
GROUP BY thedate
ORDER BY thedate ASC

Results look like this:

2006-10-02	25
2006-10-03	12
2006-10-04	31
2006-10-05	131
2006-10-06	31
2006-10-07	130
2006-10-08	102

which is perfect.

Technorati Tags:

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Atom Bank Shot

Atom Bank Shot:

  1. I installed the experimental Atom Publishing Protocol Server in in my local WordPress test install.
  2. Posted a entry using curl to talk to WordPress.
  3. Used hAtom2Atom.xsl to grab the embedded hAtom from the Sandbox themed blog.
  4. Read the posted entry in NetNewsWire.

Round trip.

My colleague Bill is making progress publishing to WordPress with the Atom protocol. Deeje, meet Bill.

Technorati Tags: ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

ternary operator

Something about ternary operators feels like cheating, but, I guess since it’s not just a weird syntactical anomaly with PHP, I should learn to love it. Ah, heuristic learning…

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

A ‘click’ Moment ?

My Colleague Bill says:

A ‘Click’ Moment :
Alex Iskold, who I’ll quote in full from the µFormats list:

I am fairly new to microformats. My initial reaction was why not describe the page data in XML first, then use XML to describe the presentation and then use XSLT to produce the actual HTML page.

I then realized that this approach does not solve a problem. In fact it misses the point of microformats, which is to embed the meta-data with the data, to make the data ’self-describing’ and to eliminate the need for additional query and parsing.

Using RDF does not bring anything new to the solution, in fact there maybe a lot of solutions to the format problem. For that reason the format that we choose should be as short as possible, so that we do not make the documents super verbose.

I spent, and sadly feel like I wasted, a couple of months trying to figure out how to bend microformat/structured blogging to meet the needs of archival fine art cataloging for my artwork. I was using an existing XML schema defined by a consortium, so it wasn’t like I was trying to poorly define my own data structure..

Part of the problem was the “why don’t you run your idea past us so we can tell you how it can be more like something someone else has already done” mentality… (it’s right there in their manifesto: “if you’re thinking of defining a new microformat: don’t.”) , another part was the newness and sparsely defined workflow of the structured blogging plugin for wordpress, and admittedly part of it was my lack of understanding of how XML works in conjunction of how microformats and structured blogging works. I got the feeling that it shouldn’t actually be me that has to bend to the will of system, but the other way around. In order for structured blogging and microformats to work, the system needs to bend to me. Otherwise, I just don’t see the benefit over being able to let my publishing package of choice interchange with other systems with RSS… try as you might to convince me, if it ain’t easy to use, it ain’t going to be in use.

Oh well.. maybe some day it will make sense again.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Steve Cooley at the Chabot Science and Space Center

I’ll be here on friday, May 26th… the Lunar Lounge Express on the invitation of Chachi Jones to demo the new visuals that I’ve been hammering on in Processing … this will be my first public performance in about 7 years. I’m getting psyched about it. I hope you can come out and see the show.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

3d pixels from realtime video

Hey, this is a video of the code I wrote in processing to take realtime video and create 3d boxes with a height equalling the pixel’s brightness.

I originally had this posted on my blog, but then I had a server failure, so this is being reposted to try to unbreak the links people made to this page. :)

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

who loves you?

Picture 3

I LOVE ETSY!! They just have so many freaking cool features!!! This is a realtime graph of all the people who have marked me as a favorite…. how cool is that?!

Technorati Tags:

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Help out WordPress

Professionally, what am I?

I guess it depends on who you ask. To a designer or marketer, I’m a programmer. If you ask an application developer, I’m a “scripter”. If you ask some web technologist, I’m a programmer, and graphics people get lumped in with scripters. What? Wait, what scripts are people doing that aren’t programming anymore?

Technorati Tags: ,

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter