Sacramento, CA

Rain 56° | 43°

Seattle, WA

Sunny 58° | 40°

Buk Life

Archive for December, 2007

27 December 2007

Straighten quotes in textmate

One thing I missed from BBedit was straightening quotes. Just found these great commands that do the same thing.

2 One thing I missed from BBedit was straightening quotes. Just found these great commands that do the same thing. Robert Reinhard,CTO

December 27th, 2007 at 03:41 PM
Posted By: Robert Reinhard in Development

18 December 2007

Custom components in AS3 = dead

I’m pretty sure that making custom components in AS3 is worthless now. It was already kinda shaky in flash 8 and the documentation lacking. Check out this example of where I’m running up against a wall:


package {

	//imports
	import flash.display.*;
	import flash.events.*;

	//class
	public class Module extends Sprite {

		//component property
		[Inspectable] public var label:String;

		//constructor
		public function Module() {
			trace(label);
			addEventListener(MouseEvent.ON_CLICK, clicked);
		}

		//click event
		private function clicked(e:MouseEvent) {
			trace(label);
		}
	}
}

In this example, you create a simple sprite (the shape of which isn’t set here) that has a label property that you should be able to edit in the authoring environment. After adding it as a component in the library and editing the “label” field in the component inspector, publish. The first trace, in the constructor, will output null. It’s not set yet. But once you click on it you see the label you’ve given it. So, it is storing the input from the component inspector. However, flash AS3 doesn’t seem to provide a “creationComplete” event like Flex does. So you can’t tell at what point your properties were set.

6 December 2007

MySQl vol.2

Here’s some more mysql odds and ends I’ve been picking up:

  • MySIAM and no deletes: If you never delete rows from a mysiam table, mysql won’t lock the whole table when you do inserts. In other words, people can run selects on the table while an insert is happening. I’m build this application right now with a column name is_deleted that I set to “1″ where I would have deleted the row. Then all my SELECTS have to have a “is_deleted=’0′” in the WHERE. I wonder if complicating my WHERE actually adds more time than not deleting saves…
  • Joins: According to the High Performance MySQL book I’m reading, choosing the order to join table is “one of MySQL’s weakest skills.” Figuring out best to do the join can take longer than running the SELECT. Thus, I’m taking from this: keep JOINs to a minimum.
  • SQL_CALC_FOUND_ROWS: Apparently using FOUND_ROWS() can be slower than running a second, non LIMIT-ed SELECT when you are trying to find how many total rows match your query.
Tags:

1 December 2007

Gmail IMAP – Not there yet

I was excited when Greg told me that Gmail had added IMAP support. I tried it out the other week and have since switched back to my old ways*. I had two main problems with it:

  1. I make extensive use of flagging in Mail.app and I use smart mailboxes that only show flagged items. When you flag something in a Gmail IMAP account, it flags it in 3 of the folders it creates: Inbox, Archive, and Starred. Because Mail.app treats each message in each folder uniquely, instead of seeing them as aliases of the same message, when I flag something it appears in my smart mailbox as 3 items. Lame.
  2. Your spam mailbox in Gmail gets treated as any old folder in Mail.app. Thus, my 5000+ unread spam emails appear as 5000 unread messages. I’m obsessive about getting my new mail icons down to 0, so it was a thorn in my side to see my spam treated this way.

With both of these issues, I could have “fixed” them in Mail.app if only it had better rules. I wish you could mark messages as read of apply rules to specific folders of an IMAP account or make combinations of AND and OR. Anyway, no Gmail IMAP for me yet.

*My “old way” is to have gmail forward all mail to a AOL free webmail account I setup for this purpose. They run IMAP as well. Then I have mail.app check the AOL mail, but use the Gmail SMTP for sending. Works pretty good. One note if you want to set this up yourself: it seems to me that AOL mail accounts you setup on their own only keep like 500 messages. But if you create an AIM account and then use it’s mail, there appears to be no restrictions. This is a theory I’ve formed based on my own experience, haven’t seen anything official about it.