Twitter Weekly Updates for 2009-06-28

June 28th, 2009
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati

Twitter Weekly Updates for 2009-06-21

June 21st, 2009
  • At the Farnsworth House. http://tinyurl.com/nrsnpk #
  • Flight. Late. MDW->BOS. #
  • @emmawelles did you try poking a paper clip into the hole? in reply to emmawelles #
  • I think you gotta pry open the flap, then it is like a normal dvd drive with a little hole in the front. #
  • @emmawelles thats what you get for using a dvd. totally 1.0 of you. in reply to emmawelles #
  • So US websites aren’t supposed to allow people in sanctioned countries to use them but the state dept is in favor of twitter in Iran. #
  • Maybe a good way to spread democracy (assuming that is a good idea) would be to blanket countries with free Wifi (WiMax or something) #
  • I’m at Bukowski’s (50 Dalton St) . #
  • I’m at Addis Red Sea (1755 Massachusetts) . #
  • I’m at People’s Republik (878 Massachusetts Ave) . #
  • I just became the mayor of People’s Republik on @foursquare! #
  • I’m at Crazy dough’s (1124 boylston st) . #
  • I just unlocked the “Crunked” badge on @foursquare. Go me! #
  • I totally hope this CL ad is for real: http://boston.craigslist.org/sob/zip/1230996318.html #
  • The Ms Pacman game at Kings has a high score of 240k. Someone in my hood has some serious ghost chomping abilities. My score tonight: 165k #
  • I’m at TC’s Lounge (1 Haviland St, at Massachusetts Ave, Boston) . #
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati

Twitter Weekly Updates for 2009-06-14

June 14th, 2009
  • I released my Actionscript port of JZLib. It lets you decompress zip files in AS3 without Adler-32 checksums in them: http://bit.ly/two5x #
  • TV sucks in the summer. I need more content. #
  • The TSA found a pack of 20 box cutter blades in my carry on. Oops. #
  • Flight. BOS->MDW #
  • @emceeangus Sarah says she wishes she was there this weekend. #
  • I’m at The Art Institute of Chicago Museum (111 South Michigan Avenue, Adams, Chicago) . http://bit.ly/vrmur #
  • I just unlocked the “Newbie” badge on @foursquare. Go me! http://bit.ly/18IGQN #
  • I’m at Rainbo Club (1150 N Damen Ave) . http://bit.ly/riIgU #
  • @johnmarkhawley I just now saw your tweet about pv3d unip. I have no idea about it. I’m sort of new to as3, but I’ll look at it next week. #
  • @gillianbowling aww. It’s a cute little bar with a tiny stage and jazz playing. You would like it. Very David Lynch. Miss u too. #
  • I’m at Piece (1927 W. North Ave, at Damen and North, Chicago) . http://bit.ly/Dypqv #
  • @johnmarkhawley Just checked nochump zip. it does infact overlap my code with respects to inflate/deflate code but mine has more of zlib… in reply to johnmarkhawley #
  • @johnmarkhawley how much having more of zlib is useful, I’m not sure. ah well, good learning experience. in reply to johnmarkhawley #
  • Chicago is neat. On the train home we saw a man in a tuxedo knitting. #
  • I’m at Papaspiros. #
  • I’m at Small Bar (2956 N Albany Ave, at Wellington, Chicago) . http://bit.ly/KTZfd #
  • @saint9 you know I was about two blocks away from you last night. weeeeird. in reply to saint9 #
  • Having fun in Chicago. Saw the symphony and blues festival at the park. Went to the Art Institute and saw the lake. Met some great people. #
  • In yorksville. Rain turned into a great day for a wedding. Weddings where you don’t know anyone are always interesting. #
  • IL has stars in the sky. Our hotel has live cage match fighting. #
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati

AS3 port of JZLib

June 8th, 2009

Last month I was working on a project that used FZip to decompress some zip files in flash.

One tricky thing about FZip is that when running in Flash Player it requires your zip files to have an adler32 checksum for each file in order to work. This is normally fixed with a work around python script provided with FZip.

The python script is easy and all, but why not figure out how to do it in pure AS3 with more standard zip files?

The checksum is needed because AS3’s ByteArray only supports ZLib when running in Flash Player. In AIR it supports deflate which is what zip files use by default. I would be really curious to hear from Adobe why they chose not to support deflate since you need deflate for Zlib to work anyway.

I decided to implement inflate in as3 but I didn’t want to do it with new code so I looked for FOSS projects to port. JZlib was a good choice because Java is similar to AS3 and it didn’t rely on any external system calls.

This port supports everything in JZlib so you can use it for any inflate or deflate operations you might need.

To use with FZip

I used this library in FZip so it no longer requires that zip files be converted before use. It is tested to be working with the OSX cli zip command. It doesn’t work with OSX finder zip compression because of another issue.

In FZipFile.as:

protected function parseContent(data:IDataInput):void {
	if(_compressionMethod === COMPRESSION_DEFLATED && !_encrypted) {
		if(HAS_INFLATE) {
			// Adobe Air supports inflate decompression.
			// If we got here, this is an Air application
			// and we can decompress without using the Adler32 hack
			// so we just write out the raw deflate compressed file
			data.readBytes(_content, 0, _sizeCompressed);
		} else if(_hasAdler32) {
			// Add zlib header
			// CMF (compression method and info)
			_content.writeByte(0x78);
			// FLG (compression level, preset dict, checkbits)
			var flg:uint = (~_deflateSpeedOption << 6) & 0xc0;
			flg += 31 - (((0x78 << 8) | flg) % 31);
			_content.writeByte(flg);
			// Add raw deflate-compressed file
			data.readBytes(_content, 2, _sizeCompressed);
			// Add adler32 checksum
			_content.position = _content.length;
			_content.writeUnsignedInt(_adler32);
		} else {
			data.readBytes(_content, 0, _sizeCompressed);
 
			//throw new Error("Adler32 checksum not found.");
		}
		isCompressed = true;
	} else if(_compressionMethod == COMPRESSION_NONE) {
		data.readBytes(_content, 0, _sizeCompressed);
		isCompressed = false;
	} else {
		throw new Error("Compression method " + _compressionMethod + " is not supported.");
	}
	_content.position = 0;
}
 
protected function uncompress():void {
	if(isCompressed && _content.length > 0) {
		_content.position = 0;
		if(HAS_INFLATE) {
			_content.uncompress.apply(_content, ["deflate"]);
		} else if(_hasAdler32) {
			_content.uncompress();
		} else {
			var uncompr:ByteArray = new ByteArray();
			var d_stream:ZStream=new ZStream();
			d_stream.next_in = _content;
			d_stream.next_in_index = 0;
			d_stream.next_out = uncompr;
			d_stream.next_out_index = 0;
			
			var err:int = d_stream.inflateInitWithNoWrap(true);
			while(d_stream.total_out != 1 && d_stream.total_in < _content.length && i<=_content.length*4) {
				d_stream.avail_in=d_stream.avail_out=10;
			
				err=d_stream.inflate(JZlib.Z_NO_FLUSH);
				if(err == JZlib.Z_STREAM_END) {
					System.println("decompress success:" + this.filename);
					break;
				} else if (err == JZlib.Z_STREAM_ERROR) {
					System.println("stream error:" + this.filename + " " + d_stream.msg);
					break;
				} else if (err == JZlib.Z_DATA_ERROR) {
					System.println("data error:" + this.filename + " " + d_stream.msg);
					break;
				//} else {
				//	System.println("status:" + this.filename + " " + err);
				}				
			}
			err=d_stream.inflateEnd();
 
			_content = uncompr;			
		}
		_content.position = 0;
		isCompressed = false;
	}
}

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati

Twitter Weekly Updates for 2009-06-07

June 7th, 2009
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati

Twitter Weekly Updates for 2009-05-31

May 31st, 2009
  • I’m at haru. #
  • HAPPY BIRTHDAY @gillianbowling ! #
  • zlib in AS3 now passing my compress / decompress functional test. I’m going to bed. #
  • The Subway at the Mass Ave T-Station removed their bullet proof glass. #gentrification #
  • I’m at Mantra (52 Temple Place) . #
  • I’m at Pho Republique (1415 Washington St, at Dartmouth, Boston) . #
  • I’m at Glass Slipper (15 Lagrange St) . #
  • Edmund wins for best twitter profile pic: http://bit.ly/Dbjuy #
  • Hey twitter, if my URLs fit into my 140, stop making them tiny! #fuckshorturls #
  • I’m at The Liberty Hotel. #
  • I’m at Bar Lola (160 Commonwealth Avenue, at Dartmouth, Boston) . #
  • I’m at Liberty Hotel. #
  • I’m at Rattlesnake Bar (384 Boylston St, Arlington & Berkeley, Boston) . #
  • I’m at Little Stevie’s New York Pizza (900 Boylston St, at Mass Ave., Boston) . #
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati

Fonts on the web - Part 1

May 31st, 2009

I’ve been reading and hearing a lot of rumbling lately from designers lately desperately looking for a better way to add fonts to their web design.

I feel that there is a lot of confusion in the design and web developer community as to what the issues are with font embedding or linking and when there isn’t confusion I often find myself on the opposite side of the debate and end up at a impasse with whoever I am talking with. In the past month I have found myself in this position more than once in person.

Last week I was posting a response on MildFuzz (link) and I realized that just debating the technical merits of the problem and proposed solutions isn’t going to get me anywhere. I set out to write a blog post to express my positions and beliefs and explain the technical problems to people but as I was writing I realized that there is just too much to dump into a single blog post.

My goal here is to write a long multi-part post that frames the technical issues, talks about proposed solutions, touches on the debates going on in the community, and offers my thoughts on a solution to the problem. This first post will just be an introduction.

first. About me:
I have been working as a professional web and application developer for 11 years now. Before that I did some type design and released several commercial and free fonts over at GrilledCheese.com. While the site may appear very very stale, I have been working for months now updating all of my typefaces and preparing them for a re-release. (Cleaning up glyphs that are over 10 years old and converting to OpenType is quite a chore, not to mention the 10 or so unfinished works I never released). I am most likely going to release most of my typefaces as Creative Commons licensed works or some hybrid commercial entity that I will talk about in a later article. Since I am now a professional programmer and not a designer I tend to look at things from more of a technical perspective and that will probably come through in this writing.

here is an outline of the posts I am working on

  • A brief history of type and fonts
  • The type industry compared to other creative works
  • Type on the web - methods and controversy
  • My proposed solution
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati

It’s better with windows

May 28th, 2009

Microsoft and Asus just launched a new site called It’s Better with Windows (link).

It's better with Windows

It's familiar
The basic premise of the site is that Windows is familiar and Linux is different and scary.

The marketing premise sounds reasonable but I think the problems with Microsoft is that they actually believe it. They believe that consumers would rather have something familiar than have something better.

I’m not saying Linux on a netbook is better than Windows. I am saying though that I think this “familiar” argument is what caused Microsoft to be totally blindsided in the mobile space in the past few years.

“It’s familiar” was their primary selling point for why you should buy Windows Mobile and not Palm. Palm fell flat on it’s face a few years later, but not because all the users were finally convinced that the Microsoft UI paradigm was superior. As MS tends to do, once they because the dominant player in the space, they completely stopped trying to improve their product.

Microsoft: People aren’t as loyal to the start menu as you think. The lower cost the device the more true this is.

When Apple and then Google came around with their mobile offerings, they had a UI that was totally unfamiliar to everyone, but substantially better. Now Microsoft is caught playing catch up. They are just now coming to grips with the fact that the Windows Start Menu and tiny icons isn’t how people want to interact with their phone or PDA.

Microsoft should be making a custom version of windows with a netbook centric UI that takes advantage of the small screen and stop trying to cram windows into everything. It is only a matter of time before Apple and Google release netbooks and leave them wondering why people aren’t yearning for a start menu and taskbar.

It's familiar
Another side note, the secondary argument they are making, is that “Windows has better device support than any other platform” is just absurd. Anyone that has plugged in an older or a newer printer or scanner into a Windows computer knows that more often than not the computer doesn’t know what the hell to do with it. At this point, OSX tends to recognize way more devices and know exactly what to do with them way better than Windows.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati

Twitter Weekly Updates for 2009-05-24

May 24th, 2009
  • I’m at Bukowski’s (50 Dalton St) . #
  • 24 really is adopting the Trailer Park Boys season end. Just make sure all the main characters are in jail or laid up for oh, about a summer #
  • @mildfuzz posted on your blog but I think it got marked as spam. Your suggestion doesn’t in any way solve the problem of cufon piracy. in reply to mildfuzz #
  • In Taunton. watching joe vs the volcano. #
  • All this news about terrorists with C4 & stinger missles, but fakes sold by the FBI. why didn’t we just sell fake Nukes or Death rays? #
  • Why the f does cloning a SIM card have to take four hours. I’m pretty sure Jason Bourne did this in like 5 seconds. #
  • Reading the Embedded OpenType spec, the DRM implementation is next to useless. #
  • @mikebodge I would have asked about Robocop. but I guess tuna ribs are pretty important too. in reply to mikebodge #
  • I so want to go get a beer but I feel like I should keep drinking water. #
  • heading to bed. lets hope little kitten head decides to not bite me all night. #
  • I’m at Falafel King. #
  • Firebug totally slows down firefox on osx. why do people keep using this thing? #
  • @emmawelles I would argue that motor oil is not drinkable. in reply to emmawelles #
  • I’m at Rattlesnake Bar (384 Boylston St, Arlington & Berkeley, Boston) . #
  • I’m at tiger lily. #
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati

Moving from Tomcat 6 to Jboss AS5 - notes

May 18th, 2009

I’m moving a bunch of single WAR sites from Tomcat 6 to Jboss AS5. Here are the configuration steps that need to be taken.

Assuming this is your tomcat config file:
%TOMCAT_HOME%/conf/server.xml:

<Host appBase="/home/wirelust/wirelust.com" autoDeploy="false"
     debug="0" deployXML="true" liveDeploy="true"
     name="domainname.com"
     unpackWARs="true">
 
    <Alias>www.wirelust.com</Alias>
 
     <Context cachingAllowed="true" cookies="true" crossContext="true" debug="0"
             displayName="wirelust" docBase="." path="" privileged="false"
             reloadable="true" swallowOutput="false" useNaming="true">
             <Resource auth="SERVLET" name="wirelustDatasource" scope="Shareable" type="javax.sql.DataSource"
                     username="username"
                     password="password"
                     driverClassName="net.sourceforge.jtds.jdbc.Driver"
                     url="jdbc:jtds:sqlserver://sql.wirelust.com/database"
                     removeAbandoned="true"
                     removeAbandonedTimeout="30"
                     logAbandoned="true"
             />
     </Context>
</Host>

Becomes the embedded tomcat config file:
%JBOSS_HOME%/server/default/deploy/jbossweb.sar/server.xml

<Host appBase="/home/wirelust/deploy/wirelust.com.war" autoDeploy="false"
     debug="0" deployXML="true" liveDeploy="true"
     name="domainname.com"
     unpackWARs="true">
 
    <Alias>www.wirelust.com</Alias>
</Host>

Notice that the appBase is now in a folder called “deploy”. You have to add this deploy folder to the config file:
%JBOSS_HOME%/server/default/conf/bootstrap/profile.xml

<bean name="BootstrapProfileFactory" class="org.jboss.system.server.profileservice.repository.StaticProfileFactory">
    <property name="bootstrapURI">${jboss.server.home.url}conf/jboss-service.xml</property>
    <property name="deployersURI">${jboss.server.home.url}deployers</property>
    <property name="applicationURIs">
        <list elementClass="java.net.URI">
            <value>${jboss.server.home.url}deploy</value>
 
            <value>file:/home/wirelust/deploy</value>
        </list>
    </property>
    <property name="attachmentStoreRoot">${jboss.server.data.dir}/attachments</property>
    <property name="profileFactory"><inject bean="ProfileFactory" /></property>
</bean>

Make sure your exploded directory ends in .war or jboss won’t see it.

Then in that new deploy directory, create a datasource file, in this case called “wirelust-ds.xml” with these contents:

<?xml version="1.0" encoding="UTF-8"?>
 
<!DOCTYPE datasources
    PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
    "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
<datasources>
    <local-tx-datasource>
        <jndi-name>wirelustDatasource</jndi-name>
        <connection-url>jdbc:jtds:sqlserver://sql.wirelust.com/wirelust</connection-url>
        <use-java-context>false</use-java-context>
        <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
        <user-name>username</user-name>
        <password>password</password>
 
        <Pool.LogAbandoned>false</Pool.LogAbandoned>
        <Pool.RemoveAbandoned>false</Pool.RemoveAbandoned>
        <Pool.RemoveAbandonedTimeout>50000</Pool.RemoveAbandonedTimeout>
   </local-tx-datasource>
</datasources>

In order to bind to the correct virtual host, you have to create a new file in your exploded WEB-INF directory called jboss-web.xml with these contents:

<!DOCTYPE jboss-web PUBLIC
    "-//JBoss//DTD Web Application 4.2//EN"
    "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
 
<jboss-web>  
    <context-root>/</context-root>  
    <virtual-host>wirelust.com</virtual-host>
</jboss-web>

Then the last change you have to make is how you are looking up your datasource in the application.
If you have code like this in your tomcat application it will fail because your jndi is not bound to java:comp/env:

Context ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("wirelustDatasource");
con = ds.getConnection();

This of course can be fixed with some further configuration and resource-ref settings but I couldn’t get that to work so I just changed the code to work either way:

Context ctx = null;
Context envCtx = null;
DataSource ds = null;
Connection con = null;
 
try {
	ctx = new InitialContext();
} catch (NamingException e) {
	e.printStackTrace();
}
 
if (ctx != null) {
	try {
		// look for the datasource in the tomcat location
		envCtx = (Context) ctx.lookup("java:comp/env");
		ds = (DataSource)envCtx.lookup("wirelustDatasource");
	} catch (javax.naming.NameNotFoundException nnfe) {
		try {
			// look for it in the jboss location
			ds = (DataSource)ctx.lookup(wirelustDatasource);
		} catch (Exception e) {
			e.printStackTrace();
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
 
// open the connection
if (ds != null) {
	try {
		con = ds.getConnection();
	} catch (Exception e) {
		e.printStackTrace();
	}
}

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati