Archive for the 'Uncategorized' Category

BP Oil Spill in Perspective

Govt. Estimate of oil leak quoted in Wall Street Journal 6/9/2010
-------------------------------------------------------------
    642,994,775,000,000,000 gallons of water in the gulf (est).
                  1,800,000 gallons per day of oil leaking into gulf (govt. est).
                         50 days of leaking.
                 90,000,000 total gallons leaked so far (govt. est).
            0.0000000139970 % of the gulf—by volume—ruined so far.

NOAA Estimates of gulf oil leak
-------------------------------
                  4,200,000 gallons of oil per day (NOAA est).
                         50 days of leaking.
                210,000,000 total gallons leaked so far (NOAA est).
            0.0000000326597 % of the gulf—by volume—ruined so far.

Ocean-wide calculations
-----------------------
446,450,767,880,000,000,000 gallons of water in the world (est).
                  1,800,000 gallons per day of oil leaking into gulf (govt. est).
                         50 days of leaking.
                 90,000,000 total gallons leaked so far (govt. est).
            0.0000000000202 % of the world's ocean—by volume—ruined by the gulf leak so far (govt. est).

                  4,200,000 gallons of oil per day (NOAA est).
                         50 days of leaking.
                210,000,000 total gallons leaked so far (NOAA est).
            0.0000000000470 % of the world's ocean ruined by the gulf leak so far (NOAA est).

My personal estimates of how long it will take to stop the gulf oil leak
------------------------------------------------------------------------
                    180,000 Barrels of oil leaking per day.
                  7,560,000 gallons of oil per day (my estimate).
                      1,095 days of leaking (3 years).
              8,278,200,000 total gallons will leak (that's over 8 and a quarter billion).
            0.0000012874444 % of the gulf—by volume—will be ruined (not nearly as small a number as it looks).
            0.0000000018542 % of the world's oceans—by volume—will be ruined.

My reason for doing this.

The Gulf of Mexico oil leak awful, but humans are still pretty small part of the world&emdash;by volume. Not that we aren’t trying our damnedest to be a big part. This just sucks and I have a hard time believing we can do anything about it.

Wear Your Mass Quantities of Code

http://www.headlineshirts.net/mass-quantities-of-code.html

Enabling Scripts for IE 8+ and Firefox, Safari and Non-IE Browsers.

So we had this weird bug, that we were likely the culprit of, but that we didn’t have time to properly find/fix involving SWFAddress, and some JSON and IE 6 & 7. Namely with anything less then IE 8 inclusion of the SWFAddress javascript file was killing the app when we removed it, things worked fine, albeit without deep link or browser history support.

So we needed to have a way for IE8, Firefox, Safari, Chrome (why not even Opera) load SWFAddress, but the rest not, behold:

<!--[if gte IE 8]>-->
<script type="text/javascript" src="js/swfaddress.2.3.js"></script>
<!--<![endif>-->

Clever eh? it’s the extra -->s that do it, so all browers but IE ignore the only the (otherwise standard) conditional code, but still use the script, like we just put a couple of regular old comments up in there. This has only been tested on a few machines so your milage may vary. Lemme know if things workout (or don’t).

Flex Custom Validator Email Confirmation

Pretty simple stuff. This was driving me a bit crazy at the beginning of the day so I decided to just cut and paste my source code hoping this will help someone else out. Basically I just want to create a custom validator that makes sure one field is equal to another in flex. Pretty simple but if you are a noob you will find this task a bit sucky…. Her is the code

Actionscript Custom Validator.

?View Code ACTIONSCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.flextradeshow.classes
{
	import flash.text.TextField;
 
	import mx.controls.TextInput;
	import mx.validators.ValidationResult;
	import mx.validators.Validator;
 
	public class EqualValidator extends Validator
	{
		private var results:Array;
 
		[Bindable]
		public var textbox:TextInput = new TextInput();
 
		public function EqualValidator()
		{
			super();
 
		}
		override protected function doValidation(value:Object):Array
		{
			results = [];
			results = super.doValidation(value);
			if(results.length > 0)
			{
				return results;
			}
			if(value!=textbox.text || !value)
			{
				results.push(new ValidationResult(true,null,"NaN","Not a matching value sorry"));
				return results;
			}
			return results;
		}
	}
}

This is the code you need in your view to use the validator.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?xml version="1.0" encoding="utf-8">
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:tsclasses="com.flextradeshow.classes.*" >
	<mx:StringValidator
		id="nameValidator"
		source="{_iname}"
		property="text"
		minLength="4"
	/>
	<mx:EmailValidator
		id="emailValidator"
		source="{_iemail}"
		property="text"
	/>
	<mx:EmailValidator
		id="emailConfirmationValidator"
		source="{_iconfirmemail}"
		property="text"
	/>
	<tsclasses:EqualValidator id="sameEmailValidator" source="{_iconfirmemail}" textbox="{_iemail}" property="text" />
 
	<mx:Form labelWidth="100" width="302" height="100%" horizontalScrollPolicy="off">
		<mx:FormItem label="Full Name" required="true">
			<mx:TextInput  id="_iname"/>
		</mx:FormItem>
		<mx:FormItem label="Email" required="true">
			<mx:TextInput id="_iemail"/>
		</mx:FormItem>
			<mx:FormItem label="Confirm Email" required="true">
			<mx:TextInput id="_iconfirmemail" />
		</mx:FormItem>
		<mx:FormItem label="Birthday">
			<mx:DateField  id="_ibirthday" />
		</mx:FormItem>
		<mx:Spacer height="15"/>
		<mx:Label text="Free mimoDesk Sample (Choose One)"></mx:Label>
		<mx:Box paddingLeft="110">
			<mx:RadioButtonGroup id="freemimodesk"/>
			<mx:RadioButton label="Star Wars" groupName="freemimodesk" selected="true"/>
			<mx:RadioButton label="Tokidoki" groupName="freemimodesk"/>
			<mx:RadioButton label="Original Core Series" groupName="freemimodesk"/>
			<mx:RadioButton label="Not Interested" groupName="freemimodesk"/>
		</mx:Box>
		<mx:Spacer height="15"/>
		<mx:Label text="Subscribe to any of the following Newsletters"></mx:Label>
		<mx:Box paddingLeft="110">
			<mx:CheckBox label="Consumer" selected="true"/>
			<mx:CheckBox label="Press"/>
			<mx:CheckBox label="Wholesale"/>
		</mx:Box>
		<mx:Box horizontalAlign="right" width="100%">
			<mx:Button label="Subscribe"/>
		</mx:Box>
	</mx:Form>
</mx:Panel>

About

We bring the noise, and the components people want to AS3, flash 9, CS3, JS, Ruby whichever you want to call it. Also some stuff about what we’re working on and fixes to common problems will appear along the way.Don’t stay up all night for nothing.