Posts in Category "protip"

Flex4 Dotted “Line”

Quickly, I wanted to share some code around creating the elusive ‘dotted line’ in Flex4.

The end goal is a divider made up of 1px dots, like this:
dotted line example

My solutions isn’t a true line, in that you can’t you can’t draw it on a diagonal. However, if you need a 1px horizontal divider, here you go. This is simply a Rect with a bitmap fill, using a dot as the bitmap. The bitmap is actually 1 pixel by 2 pixels, with the right pixel colored (#808080) and the left transparent, as such:

example of the dot png

Here’s the code that would draw your “line”:

<s:Rect width="500" height="1">
<s:BitmapFill source="@Embed('/assets/images/dot.png')" fillMode="repeat"/>

That’s about it. You can download the dot PNG here. Or, just make your own in Fireworks.

Tomcat and OSX – oh joy

I’ve been fiddling around getting Tomcat running on OSX 10.6, which is trivial if you do things right, but here are som potential snags. This might be documented all over the place, but I’m making a note here for myself. I think I’ve installed Tomcat on about 50 machines over the years, so I enjoyed some nice flashbacks as I sorted this out.

First: download Tomcat. derp.

Second: check the md5 hash using ‘ $ md5 <zipfile> | grep -v <expected hash>‘. Or, don’t check it. Probably not a ton of people hacking a keystroke logger into Tomcat. I think checking the hash is fun.

Third: extract the archive. derp de der! Folks recommend /Libraray/Tomcat/Home/ as a final resting place. If you don’t have execute permission on the extracted directory, make it so. I like 'chmod a+x' instead of '777', but whatever works. If you don’t do this, you’ll get complaints about permissions, or that ‘’ is missing, or even worse ‘BASEDIR environment variable is not defined correctly’.

Fourth: run Tomcat. der derp der derr!!! Here’s where things can go a little crazy. You don’t have to set $CATALINA_HOME as a environment variable. You don’t even have to set $JAVA_HOME, which should be /Library/Java/Home. There is a and script in the /bin directory of the Tomcat install (ie /Library/Tomcat/Home/bin). I prefer to make my own wrapper for these scripts, named tomcatStart and tomcatStop, and put them in my ~/bin folder, which is in my path. That way I don’t have to type the whole path to the Tomcat scripts, and it’s a little more explicit as to what I’m starting up or shutting down. Alternately, you could just call Tomcat’s script, with either start or stop as an argument.

Be aware that calling an executable script directly, eg '$scriptname' is different than calling it using the source operator in bash, eg '$. scriptname‘. Using the source or ‘.’ operator causes the shell to run the script directly, instead of using a subshell. This will cause an error, because the $0 argument will become ‘-bash‘, instead of the path of the script.

Fun Fact: you might have (depending on your download method) the HFS+ bit set which ‘quarantines’ files from the internet. You will see an ‘@’ in the extended list attribues, ‘-rw-r--r--@‘ <--- like that. That means you have the quarantine plague. It won't keep the files from starting up, but you might get a warning message if you try to open the files with a visual editor. The remedy? Run 'xattr -d -r *' to clean this up.