HotCat.org

2010/09/02

AppleScript + ImageMagick == find iPhoto pictures that are similar

Filed under: Apple — claud9999 @ 16:16

Below is a useful script for taking all photos selected and comparing them to all other photos for similarity. Note that it only compares pictures with very similar dimensions (off by 5 pixels at most) and uses the thumbnails for faster image processing. Was a good lesson in how to do things with AppleScript, I think I’m far more capable after writing this.

set ImageMagickHome to “/Users/cknight/ImageMagick-6.6.3″
tell application “iPhoto”
set curPhotos to selection
if (count of curPhotos) ≤ 1 then
display alert “You need to select the photos you want me to process.”
else
set similarityLimit to text returned of (display dialog “Enter similarity limit (0-65,536, similar pictures have low similarity metrics), and click GO” buttons {“GO”} default answer “10000″ default button 1)
repeat while length of curPhotos > 0
set thisPhoto to item 1 in curPhotos
repeat with thatPhoto in rest of curPhotos
set thisWidth to width of thisPhoto
set thisHeight to height of thisPhoto
set thatWidth to width of thatPhoto
set thatHeight to height of thatPhoto
if thisWidth < thatWidth + 5 and thisWidth > thatWidth – 5 and thisHeight < thatHeight + 5 and thisHeight > thatHeight – 5 then
set diffstr to (do shell script “DYLD_LIBRARY_PATH=’” & ImageMagickHome & “/lib’&& export DYLD_LIBRARY_PATH && ” & ImageMagickHome & “/bin/compare -dissimilarity-threshold 1 -metric mae ‘” & thumbnail path of thisPhoto & “‘ ‘” & thumbnail path of thatPhoto & “‘ /dev/null 2>&1 | cut -f 1 -d ‘ ‘”) as text
set diff to diffstr as number
if diff < similarityLimit then
set comment of thisPhoto to comment of thisPhoto & ” duplicate of ” & name of thatPhoto
set comment of thatPhoto to comment of thatPhoto & ” duplicate of ” & name of thisPhoto
– set keywords of thisPhoto to keywords of thisPhoto & {“duplicate”}
–display alert “this: ” & image filename of thisPhoto & ” and that: ” & image filename of thatPhoto
end if
end if

end repeat
set curPhotos to rest of curPhotos
end repeat
display alert “All done!”
end if
end tell

2009/02/26

D&D 4E AJAX Character Sheet

Filed under: Gaming,Technology — claud9999 @ 08:20

I present to you my Javascript/AJAX character sheet for 4E. It’s Creative Commons licensed (BY-NC-SA), so feel free to krib it and use it for your own purposes, just no commercial use and you must share mods under the same license.

Is it obvious how to get to the menu? I didn’t want the menu to interfere with printing, so I made it show/hide.

It’s AJAX in that it supports storing/retrieving character sheets from a DAV server (any server that supports PUT and GET.) Even if you don’t have access to a DAV server, you can use the export and import capability to copy/paste the XML to your favorite desktop XML editor (notepad, stickies, etc.) We’re going to try storing/retrieving via a SVN server for automatic character revision control, too. I’m also thinking of adding an internal revision log, I find it helpful to review how a character was generated (how did you get that 19 CHA?)

So far I’ve been focusing on UI and underpinning, this sheet has absolutely no smarts to it. I am hopeful folks will add smarts to it; particularly I would love to hook it into the same dataset that Char Tool uses, so that we can share data entry duties.

I have no idea if this char sheet violates some sort of D&D licensing. I doubt it does, as it has no smarts to it, but one never knows.

Why did I create this char sheet, when there are good options out there? I wanted something cross-platform (ok, I’ve only tested this in Firefox, although it seems reasonable on the iPhone ;) and something that looked like a real character sheet, with power cards (I insist on using power cards in playing 4E, it makes decision-making so much more straightforward. Looking for thoughts on how to simulate the “order the power cards by usefulness in this situation, and put aside useless and used power cards” in this sheet.)

I hope you find this sheet useful, interesting, and helpful. I ended up rolling all of the Javascript on my own, I really wasn’t fond of the iframe solutions for WYSIWYG editing and most everything was fairly easy to code.

Some interesting coding solutions, though:

* editablecontent is a godsend, ‘nuf said.

* power cards auto-size their fonts to fit inside the box–this was tricky, but involved turning off the fixed size, inspecting the bounding rect, shrinking the font if the bounding rect was too large, repeat. Slick!

* ensuring that power cards print reasonably was tricky, why, pray tell, isn’t there a “force page break here” capability? The whole “page-break-before”/”page-break-after” CSS is crazy and semi-broken in Firefox.

* pop-up editing toolbar was a bit tricky, I wanted it to disappear when the div lost focus, but guess what, clicking on the toolbar “blurred” the div before it got the click to the toolbar, making it disappear before the click was executed. I found an elegant solution, set a timer and a flag, if the toolbar gets clicked, clear the flag (and return focus to the div). If the flag is still set when the timer elapsed, hide the toolbar.

2008/08/22

KI6STN

Filed under: Technology,Uncategorized — claud9999 @ 06:59

So some kind folks at Ames offered up free amateur radio license training, and I’d been meaning to get my license for years. Hurrah, I am now a licensed “technician”, able to broadcast over VHF and UHF frequencies. I have reached the pinnacle of nerd-dom! (In reality, I wanted to get my license for situations where a cell phone lacks coverage, or for emergency use in a disaster.)

2008/06/08

01SJ 2008 – amazing

High ‘n’ Low Rider

So I lucked out and attended the 01SJ in 2006, which was such a cool event that I hoped it would return as promised. Sure enough, it did, and this one was different but just as amazing. Fewer events, but the SubZero street fair and a bit more focus on local artists was much appreciated. I attended almost all of the events I wanted to (missed the DJ Spooky event and the Target Day in the Park events on Saturday due to a conflict) over the period of a number of days.

 

Wednesday – Opening ceremonies; this was the only opportunity I had to see the “High ‘n’ Low Rider” sculpture (a scissor lift with a hydraulic platform on top that danced and spun by remote control) and I’m glad I saw it. Apparently, they were running on battery power so they had to somewhat limit movement, but still it was an impressive piece of machinery-art. Wish I could have seen more, I don’t know if they ran it after the opening ceremony. I really appreciated the anodized metal, chrome, and automotive paint used to detail the piece. Next up was a walk over to the city hall rotunda, to see the place lit up via projection from the inside (as opposed to the lighting from outside at the ’06 event) with animated computer-generated tentacles growing slowly from the first floor to the second. Last was the “Portal, Wormhole, Flythrough” projection sculpture, which alas looked more impressive during construction. The concept was to show tunnel fly-thru’s from various computer games and movies and whatnot, but many were low-resolution or not even oriented correctly, breaking any sense of illusion.

 

Thursday – Movie night for me, I spent the night watching movies starting with the shorts at the “Future Films” exhibition (only caught 30m or so.) After that, at 6pm began the playing of Cory Archangel‘s “Untitled Translation Exercise”, wherein he had some Indian actors (?) re-dub Dazed and Confused with little/no emotion. I haven’t actually seen the original movie, but it was still enjoyable and amusing to see re-dubbed by folks who probably have little idea what they’re saying. (Sorry, this could be taken the wrong way, I see it more as a view of how what we take for granted in American culture is Ameri-centric and how it loses meaning when seen from other cultural viewpoints.)

SpectropiaThis was followed by “Spectropia” by Tony Dove and R. Luke DuBois–an “interactive film performance” where the two film makers used computer workstations with IR motion sensing to do things like control the pacing and editing of the film during playback, plus typing on the computer to control speech/video synthesis characters that interact with the audience. Nice ideas, a bit rough on the execution.

 

Saving the best for last, “Late Fragment” was not only an amazing film(s?) but a surprising amount of work to develop three films with storylines that cross at “hubs” and where the viewer (using a DVD player) can follow one character’s story or switch to another. The switching was fairly seamless and felt like we were watching a professionally-edited movie with a heart-wrenching trio of storylines. Only minus was not being presented with an example of how the story would play out with different choices. Still, I’m going to pick this DVD up, it’s a landmark piece of work along the lines of TimeCode. Excellent chat with one of the directors after made it worth sticking around for, wish I could have asked more questions. Wonderful Q&A.

 

Genevieve GrievesFriday – Left work early, visited the San Jose Museum of Art for their exhibitions (Superlight, Robots, and some post-minimalist exhibition). Superlight had some very interesting pieces, namely Shih Chieh Huang‘s “Twilight Zone” sculptures — animated fantastic creatures fabricated from the fetishistic computer parts from the casemod subculture, sculptures hanging from the ceiling that blink, make noises, and inflate and deflate plastic bladders (made from plastic bags used in packing, I believe). Completely mesmerizing. Also particularly of note was Genevieve Grieves‘ “Picturing Shih Chieh Huangthe Old People”, which were HDTV’s turned sideways and arranged side-by-side, playing slow video loops of classic scenes being set as if they were turn-of-the-century photos of frontier folk and Native Americans in their staged b/w photos common in that era. (A-la David F. Barry‘s highly-staged 19th century portraiture, which I happened to see at the Museum of the Rockies in March, how coincidental!)

 

HomouroborosAlso jumped over to the Discovery meadow to check out “Homouroboros” by Peter Hudson (apparently a big Burning Man sculpturist.) The sculpture is an interactive experience where participants drum on digital drum pads long enough to get the monkeys to rotate around. Looking through the LCD shutter eye holes of cabled masks, that make the rotating monkeys into a zeotrope animation. Amazing work.

 

SubZeroVietnamese food for dinner (uninspired, alas), then on to the SubZero fair. The museums on First were a good way to spend the remaining hours of light while the fair was finishing setup, probably my favorite pieces were at the San Jose Museum of Quilts and Textiles including a video of water-soluble dress designs, a dress made out of videotape where the tape records the making of the dress, and a pair of outfits woven with wires and LED’s and the San Jose Institute for Contemporary Arts which had two amazing portraits by a very talented painter, very large pieces that capture their subjects with great emotion and use of color (actually not part of the 01SJ but nice nonetheless).

 

GRL & MAWThe fair was definitely the highlight of the 01SJ this time around, there was so much to see and do and to take in. Folks were very happy to chat about their art, and I enjoyed watching the works of the graffiti artist Sean Boyles and two of his friends on a side street, along with the antics of the Minneapolis Art on Wheels (MAW) collective projecting on walls and working with the Graffiti Research Lab to make large-scale digital graffiti projections. Music was awesome as well, and the crowd was big but not overwhelming. MAW folks were even kind enough to give me one of their hand-printed flyer, which I will cherish. Nice bunch of folks, who I hope will make their nearly-cross-country journey again in the future to visit us in the Bay Area. (Yuri’s Night Bay Area would make a great forum for their work, as with Boyles!)

 

MAW on top of the TechSaturday – Spent recovering from the busy week, going to a friend’s wedding (Chinese seafood feast!), and a quick visit to the VIP reception on top of the Tech for some photos and taking in the view.

 

Sunday – A bit more taken in of the Museum of Art, some Vietnamese sandwiches (YUM) eaten at the park while watching pre-teen skateboarding and then the California Theater for “Beyond the Score – Classical Music Exposed – The Rite of Spring”. I’ve been a fan of Stravinsky ever since I heard the excerpt of The Rite of Spring on the Fantasia soundtrack, and it’s amazing to listen to the “Stravinsky Conducts Stravinsky” recordings, so I was happy to hear that this was part of the VIP ticket. Apparently, according to the ticket agent, it was never relayed to the Symphony that this deal had been struck but she honored my pass and gave me a seat in the middle of one of the back-most rows, which was a very good spot indeed. Only problem was an San Jose Symphonyoccasional weird positioning of horns when they echoed off a side wall, and a bit of muddyness to the sound, but still quite good for a free (well, sorta free) seat. It was great to hear the history of the composition of the piece, woven with the orchestra playing excerpted passages compared with traditional tunes played on traditional instruments. After the intermission, the whole Rite of Spring was played straight through by the orchestra, a very fine performance, true to the Stravinsky Conducts Stravinsky take, and generally well played and conducted. It was quite surprising to me how loud a full orchestra can play, I can imagine how that must have felt for the first time, when the riots erupted. (I enjoyed the end-note of the symphony so much that I bought my wife and I two tickets for the Russian Piano Competition happening on the 14th of June.)

 

Summary: 01SJ was a stand-out art and cultural event that I am extremely happy to have been to, and I greatly hope they’ll be back in two years. It was a little rough around the edges but I was so happy to have some real culture in my backyard. As a friend mentioned, every other year is a good pace, giving artists and organizers some serious time to get ready for the next one.

2007/12/06

still no EDGE on my iPhone

Filed under: Apple,Rant — claud9999 @ 08:25

Apparently it’s plaguing all GoPhone (prepaid) customers. At what point do I ask for a refund? At what point do lawyers file a class-action suit? At what point will Apple step in and get ATT to get their act together? At what point will I cancel my account, sell my iPhone, and go back to a more reliable data network?

At least I’m not alone, there are at least two other customers complaining on the ATT forums.

Update: Of course, in the evening the network was fixed. Yay! Hopefully no outages when I’m on travel (when I often need the phone data service the most!)

2007/12/03

iPhone network out(r)age

Filed under: Apple,Rant,Technology — claud9999 @ 08:31

Ok, so on Saturday, my EDGE network connectivity was “broke”. Trying to look up something at a friend’s brunch. Steps I took:

  1. Reset, re-install, etc my phone (nuthin’)
  2. Search the net (useless, surprise?)
  3. Call ATT, which redirected me to their prepaid service support line, which was CLOSED for the day. Huh?
  4. Try ATT’s website, which redirected me to their prepaid service web site, complete with expired SSL cert.
  5. Try logging into the above site, only to be told I needed a new PIN, which was sent to my phone via SMS. No PIN.
  6. Try “forget your password?” link, which took me to a password change form which required my old password! Gah?
  7. Call ATT this AM, was told by a nice lady that the network was down. Hooray! I’d rather it be that than a broke phone or constant redirection between ATT & APPL.

2007/11/06

Android (aka Gphone)

Filed under: Rant,Technology — claud9999 @ 06:09

ANDROIDZzzzzzzzzzzz….Gauhwha, oh, something interesting you say? I’m sorry, I fell asleep during the “geek love fest” about how wonderful it would be to have an open platform. Boy howdy, I see so many desktop computers running Linux and using Java for their UI’s. Android all makes so much sense, Google’s going to take over the world!

Ok, sarcasm aside, perhaps Google can use the “bully pulpit” of being #1 (well, #3 largest Bay Area company, but #1 in search) to try to convince the phone market that SymbianOS, Windows Mobile, MacOSX (iPhone edition) and other “closed” operating systems are inferior. But the proof will be in the pudding, or at least the demonstrations of UI’s that are enticing, fool-proofed, and easy to use. Is it just me, or did Google come to this party a bit late?

I guess a demo will be shown next week, and I suspect the buzz will deflate considerably. “Unlike the iPhone, the screen is also time-sensitive: Hold down your finger longer, and the area you’re controlling expands.” Huh? Tap-and-hold…Just ’cause Apple doesn’t use it for their UI, doesn’t mean they can’t…I suspect the iPhone UI will go through significant changes over the next year as the product matures, the dev kit hits the streets (hopefully for free/cheap), and users become increasingly familiar with the phone.

And I hate to say this but the iPhone Safari is the bee’s knees; double-tap to zoom in on an image or text (often a div block) is so amazingly useful, I am speechless.

As for Android, zzzzzzzzzzzzzzzzzzzzzz.

2007/10/08

iPhone “RPG” (more Rogue-like) v0.7

Filed under: Apple,Gaming,Technology — claud9999 @ 10:02

rpghttp://www.hotcat.org/rpg

After many weeks of development on my off-hours, I think the code base is stable enough for people to take a look-see. I need to gin-up some levels for folks to play through, and the todo list is lengthy and grows every time I remove something.

Some general comments, I’ve released it under a Creative Commons license; similar to an Open Source license (most similar to the GNU license) but means the “licensee” cannot make $ off it without negotiating terms with me first.

A big shout-out to the folks who made the Angband graphics freely-available. One thing I’m not good at is graphics. Ok, two things–graphics and UI’s.

I’ve spent most of my time struggling with JavaScript’s anemic “OO” model; inheritance and method overloading is very “iffy”. But then I’d rather have the JavaScript model than the strict model in Java/C++/C# (particularly as I am implementing spells by having the spell interject itself as a “getter” for an attribute; so “light” encapsulates the _getVision method and replaces it for the duration of the spell.)

If you’re interested in helping develop the game, developing add-ons (a level designer would be an easy add-on) or whatnot, drop me a line.

2007/09/21

Tea timer for the iPhone

Filed under: Apple,Gaming — claud9999 @ 14:10

Yixing tea setThe built in timer is nice on the phone, but it lacks something critical: second resolution. For brewing “gongfu-style” tea, timing is a matter of seconds. Here’s my first try, I wish it were an audible alarm and I wish the inputs popped up the number pad not the regular keyboard, but perhaps there is something in Apple’s developer docs that will help. I may need to make a full-fledged app instead, but that’ll probably be later.

http://www.hotcat.org/timer

I’m starting to seriously consider developing a roleplaying game, a-la old-school Ultima (turn-based)…

2007/09/20

another iPhone game – nono

Filed under: Apple,Gaming — claud9999 @ 18:58

You can play my newest game creation at http://www.hotcat.org/nono

I’ve always liked nonogram puzzles; deductive logic puzzles popular recently (thanks to the wonderfully-created Picross DS game). Perfect for touch-screen interfaces, although the touch screen of the iPhone added a particular challenge–it’s often that your touch misses the intended target, particularly with small targets. (Hint for using the keyboard: typing slowly using the “pop-up bubbles” makes for much more accurate typing.)

In order to support this sort of inaccurate UI, the grid cells are fairly large (the smallest, currently, is ~20x20px for a 10×10 grid) and the game does not penalize you for selecting the wrong cells. I think it works out fairly well and is quite playable. Now to create more puzzles for folks to try to solve. I am a bit surprised there are no free libraries of puzzles, and I suppose borrowing someone else’s set of puzzles would be a copyright problem.

I’ve added adsense ads to both games, which was quite easy. Who knows if I’ll ever make any money off ‘em, but it’s fun to see what happens.

Older Posts »

Powered by WordPress