Let’s just say that we have lots of old backup tapes, a chair, a willing office-mate, a camera, a flash (with grid), and too much time on a Friday afternoon.
Oh yeah, and don’t forget the duct tape. Never forget the duct tape!
]]>Go ahead, make me an offer, punk.
UPDATE: My new camera has arrived, so I have put my Nikon D50 Outfit up for sale too. Also, I forgot I had a set of triggers for flashes that I don’t require anymore.
I recently took up the challenge from John Gruber and Dan Benjamin to port John’s TitleCase.pl Perl script to an equivalent Ruby version. It seemed to me that converting someone’s script to another language would be a fun experiment to help learn any language. I was right.
I set up a git repository at GitHub.
I decided to write an extension to the String class in Ruby, as that would allow you to use this String#titlecase method anywhere and you could therefore write a standard input processing script trivially with this library included via a gem. Writing the extension also gave me a great excuse to learn more about RSpec, a nice Ruby testing library. I wrote the tests in RSpec, but I admit my tests were a quick hack to get them working at 3 in the morning, not good spec tests. Maybe someday I will convert them into real sentences of intent, as they should be. Either way, it was fun to try out Test Driven Development, and using the autotest function of the ZenTest gem to watch the tests start to pass as the script came along.
So after a few hours of learning about RSpec, ZenTest, all the tests from Gruber pass, even the one he lists as not working with his script. I took a different approach in how to process the titles, so there are not as many gotchas to fix up after processing either.
If you find it useful, let me know. And of course, fork the repo and send back some more test examples and any bugs you find.
P.S. Daniel also converted my Ruby version to PHP. We are going to use it at BitLeap for various things. He had also said about seeing about making a WordPress plugin out of it. So, I will prod Daniel to see if he will setup a public repository for it.
]]>Update: And BitLeap has decided to do a free contest: Whoever comes closest to guessing the number of caps that make up the tower by February 1st, gets a $50 gift card to either Amazon, Starbucks, Apple or Barnes & Noble. Very cool, I wish I could enter.
]]>My goal with Reggy from the beginning was to be simple and not look like junk. There are many other regular expression testers out there. If you like them, use them. I happen to think many of them look like dirt. Reggy may not be gorgeous, but it’s certainly not dirt either.
The first implementation of coloring was actually by a volunteer (Justin Bakse) who was nice enough to pass the code back to me to look over. It was a good start for sure. But it used an implementation that I just don’t want — for simplicity’s sake: you pick X amount of colors, then for each match the code picks one of the colors, then the next and so on, repeating. This is visually distinctive if you pick a bunch of crazy colors, but I am still thinking that picking 10 colors in the preferences is not the Mac experience I want to provide for people.
My implementation looks like this:
// Add new color to matched ranges
bool countUp = YES;
float r,g,b,a;
[[NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:@”match_color”]] getRed:&r green:&g blue:&b alpha:&a];
for ( unsigned int i = 0; i < [matchedRanges count]; i++ )
{
NSRange thisRange = NSRangeFromString([matchedRanges objectAtIndex:i]);
// Generate new color from base color
if ( i > 0 && [[NSUserDefaults standardUserDefaults] boolForKey:@”color_submatches”] )
{
if ( r > 0.8 || g > 0.8 || b > 0.8 ) countUp = NO;
if ( r < 0.0 || g < 0.0 || b < 0.0 ) countUp = YES;
if ( countUp ) { r += 0.2; g += 0.2; b += 0.2; } else { r -= 0.2; g -= 0.2; b -= 0.2; }
}
[[testingStringField textStorage] addAttribute:NSForegroundColorAttributeName value:[NSColor colorWithCalibratedRed:r green:g blue:b alpha:a] range:thisRange];
}
Pretty simple I think. Get the color components of the match string color preference (r, g, b, a). Then for every match other than the first match, increment each RGB component by 20% (this is a 0 to 1 scale) or decrement depending on the component values. I came out with 0.8 as a maximum value by just testing a bunch of different match colors and found 0.8 to be around the acceptable range of readability against a white background for most colors. The increment or decrement step value of 0.2 was another value I just played around with until there was a good balance between having each color step look different, yet still provide a small enough value so as to allow as many steps as possible between 0 and 1.
If anyone has a more elegant solution, please propose it. I am not a genius, I just know what I like. And I don’t like having to pick a bunch of colors. I like the simplicity of using one color with differing brightness as it still seems that the user has control over the coloring, but maybe I could go for a color generation scheme that is based on color theories like complements or triads. Or maybe I am the only one that is this picky?
]]>Thanks should go to Steve Huff at the Harvard-MIT Data Center for requesting the startup clipboard preferences. It was a great idea that, along with the menu items to quickly paste into the fields, many people will be happy to see.
So anyways, Leopard’s icon size is big, and I mean big:
![]()
I had to redraw the icon this morning because the clipping icon I was using was swiped from Tiger. I figured it would probably be proper of me to not steal the clipping icon.
I am really excited to get onto developing a Leopard-only 2.0 version. I am starting to read through the new documentation now. Let me just say thank you to Apple for making developing stuff like Reggy fun and easy.
]]>Those who use the newest of Adobe’s Creative Suites on old hardware (a 1Ghz PowerBook G4 for me) can sympathize I am sure.
My laptop is getting old, yes I know. But Adobe, your updater application slows my computer down more than Photoshop and Illustrator do! Now, I am kind of used to slow these days, so I normally wouldn’t complain too much if it weren’t for the craziness I witnessed this afternoon after rebooting from the latest system updates from Apple.
I was never happy with Adobe Updater, so I normally tell it to go away when it does come up. Given that, I had an update to install — Acrobat 8.1 Update. Fine, I just restarted, so I’ll let it go through before I start back on my work.
Maybe not a good idea.
Waiting about 10-15 minutes…
Woops, I see a dialog that says “Wait For App Shutdown Title” — “Please click OK when other apps have stopped” with both Cancel and OK buttons. What? Wait a moment, wait for what app to stop? The updater? Because that’s the only app really running in the Dock. Confused, I click OK.
It returns. I click OK, again… I see a pattern emerging here.
After a few bouts of click madness just for fun, I click Cancel. I have no idea what that means. The dialog doesn’t read well obviously. Cancel could mean destroy the computer immediately for all I know.
But then it works. Five minutes later, I am greeted with this screen:
8.1.0.Utterly slow, confusing and just plain bad Adobe, for-shame.
UPDATE: Looks like Gus Mueller loves the updater too. Thanks for the links Daniel.
]]>Enjoy
]]>So, now we have an appcast for you to follow on the new Reggy website. Did some last minute tweaks to make me happy and now it is up on the servers, so go get it!
I hope you like the update. As always, feel free to file bug reports and feature requests on the issue tracker.
I plan on posting a bit of what I see for the future of Reggy soon for those who may be interested.
]]>I needed a site to host some things on to do Sparkle integration, so I went ahead and purchased the domain name to host with.
At some point I hope to do a real website with feeds and such, but for now it gives some information and links to places where Reggy can be seen and/or downloaded.
One of the real benefits of having this site is that hopefully you will be able to check just one place for updates to Reggy in the future.
]]>