Archive for category projects
cool python tricks
Man I love Python. I came up with a neat trick yesterday that also couldn’t be done in any static language. Needless to say, I’m pretty pleased with myself. This trick isn’t slow or hard to understand, and actually makes a lot of my code very simple, and avoids a lot of boilerplate that I would have had to write in another language
I needed a way to given a basic color to a class, and then have easy access to various tints of that color for painting different aspects of an object. The tints are based on HSV, not RGB, but all the callers need to deal with RGB.
The solution: wrap the property() descriptor with my own descriptor.
Read the rest of this entry »
ActionScript scoping
I recently ran into this crazy ActionScript scoping issue, that drove me so crazy I decided it needed a post. ActionScript is an ECMAScript language so learning it has been very fun. I’m able to use all my JS knowledge and then extend it to a much richer language.
Read the rest of this entry »
OpenJade and Cygwin
I’ve spent more time with OpenSP/OpenJade trying to get everything working under Cygwin, and I think I’ve finally got it.
Here’s what I had to change:
- OpenSP 1.5.1
- Edit config.h.in, and comment out
#define SP_HAVE_LOCALE
OpenSP will work with this turned on, but OpenJade will break. Better to just disable locale support in OpenSP and let OpenJade figure it out later. - Run
configure --with-included-gettext
Cygwin’s gettext support is lacking bindtextdomain or something. - Ditch the
#pragma
s Cygwin doesn’t support #pragma interface and #pragma implementation, and it results in undefined symbols during linking. This is in a lot of the source files, you’ll probably want to write a perl or awk script to take care of it.
- Edit config.h.in, and comment out
- OpenJade 1.3.2
- Edit grove/Node.h, and change the
#ifdef SP_WCHAR_T_USHORT
to#ifdef SP_WCHAR_T_USHORT_
OpenJade defines it’sChar
type as aUnsigned32
. This is apparently incompatible with grove’s definition ofGroveChar
as awchar_t
. Cant’ we all just get along? - Edit msggen.pl, and add a second
chop;
– gotta love window’s CRLF linefeed sequence, and the way it confuses perl.
- Edit grove/Node.h, and change the
At this point, I know I can run the openjade.exe binary. I haven’t really fiddled with it any more, but I have an article I want to format as HTML.. so that’s next.
The ultimate IDE
I’ve been working at Macromedia for a month or two now, and I’ve learned to appreciate the coolness of Flash and ActionScript. People may whine and complain that its not open, that its proprietary, that it duplicates some web functionality, but when it comes down to it, its just damn fun. I’m hoping to put together some interacitve flash tutorials on Mozilla architecture, but that’s a subject for another day.
What I’ve been thinking about lately is the way that Macromedia has put together this slick authoring environment to allow people to develop for Flash. The latest version, “Flash MX 2004″ is an IDE that combines UI/animation design (similar to the old Visual Basic tool) with a programming environment. What’s especially interesting is that they’ve integrated the compiler, the editor, and the help system all into one space.
Read the rest of this entry »
One more gallery trick
oh yeah, I forgot that I had also added another thing for gallery integration.
I found this neat hack which includes a php file that outputs javascript to display a link. I tweaked the script to look like this:
.. echo "document.write('<a href="" . makeAlbumUrl($gallery->album->fields["name"]) . "">" . $gallery->album->getThumbnailTag($gallery->album->getHighlight() ) . "</a>');"; ..
getThumbnailTag is cool because it its the complete <img>
tag to display the particular thumbnail. It wouldn’t be hard to make that a random number to display a random thumbnail.
so now I can also say thumbnail=yes
and it will display a thumbnail from the gallery specified by the gallery
keyword.
Adding gallery support
For another secret website I’m making for a certain future trip, I needed a way to easily link to a photo gallery (created with the awesome Gallery Project software) in a blog post.
That was pretty easy. I just added
<MTKeyValues source="[MTEntryKeywords]"> <MTIfKeyExists key="gallery"> <div class="blog-entry-gallery"> <a href="/gallery/<$MTKeyValue key="gallery"$>">gallery</a> </div> </MTIfKeyExists> </MTKeyValues>
And now in my keywords field, I can just say “gallery=foo” and it will automatically add a link in the blog entry.
Creating a private category
Today I hacked on MovableType to accomplish two things:
- A private category that I could post without worrying that my stuff goes public
- Sane URLs instead of those annoying date fields