AS3 Date Class – correctly parsing to UTC milliseconds

Posted in Software Development on September 29th, 2008 by Russ Tarleton

The other day I was trying to parse a date value via Date.parse(date:String) but I kept getting an odd negative number as a result. I didn’t realize what was going on until I checked what the return type of Date.parse was and saw that it was “Number” instead of “int”. Oops. After changing all my millisecond variables from int to Number, everything worked fine. Apparently int doesn’t allocate enough memory – I should have known this.

Lesson learned: Use variables of type Number when trying to get the UTC milliseconds from Date.parse()

var myDate : Date = new Date();
var myInt : int = Date.parse(myDate);
trace(myInt); // Incorrect: -1333562360
var myNum : Number = Date.parse(myDate);
trace(myNum); // Correct: 1222732117000

Getting rid of jagged fonts in the Flash CS3 ComboBox Component

Posted in Software Development on September 26th, 2008 by Russ Tarleton

I was working with the CS3 ComboBox component yesterday and my fonts inside the component kept looking more jagged than the designer’s comp. After some testing, I found there were a few things I needed to do in order to fix the problem:

  1. Toggle embedFonts to true only after items are added to the combobox.
  2. There are two separate parts of the component where you embed fonts: the main textField and dropdown text fields.
  3. If applying a larger font size to the text format, the dropdown list also needs to have its “rowHeight” increased in order to see the resulting larger font – in my case I was testing at 25pt for a more dramatic test and wasn’t seeing the font at all due to it shifting down.

Here’s the resulting code (stripped out package/class info):

// Remember to Import TextField and ComboBox
import flash.text.TextField;
import fl.controls.ComboBox;

// Setup the Text Format to use Arial, 12pt, Bold, Black
var myTextFormat : TextFormat = new TextFormat();
myTextFormat.font = “Arial“;
myTextFormat.size = 12;
myTextFormat.bold = true;
myTextFormat.color = 0x000000;

// Embed the font in the ComboBox dislpay and dropdown
// Pre-condition: myCB is a ComboBox component on the stage
// and all items have already been added to it

myCB.textField.setStyle(“embedFonts“, true);
myCB.textField.setStyle(“textFormat“, myTextFormat);
myCB.dropdown.setRendererStyle(“embedFonts“, true);
myCB.dropdown.setRendererStyle(“textFormat“, myTextFormat);
myCB.dropdown.rowHeight = 25;

Trent Reznor takes a stab at surveys; pleads, “Do the right thing.”

Posted in Sociology on September 22nd, 2008 by Russ Tarleton

I received an email from Trent Reznor today asking me to fill out a survey!

Here is Trent’s approach to soliciting survey feedback:
1. Asks nicely!
2. Offers his latest video for download after taking the survey.
3. Promises future gift or contest entry, if any. 
 
What I’m wondering is, without an official end user license agreement or terms of use, does Trent’s informal email make it illegal to download his offered video directly from his site? 

from nin
date Sun, Sep 21, 2008 at 7:06 PM
subject Nine Inch Nails survey

Message from Trent:

Hello everyone.

I’d like to thank everyone for a very successful year so far in the world of Nine Inch Nails. I’m enjoying my couple of weeks off between legs of our Lights In The Sky tour and got to thinking… “wouldn’t it be fun to send out a survey to everyone that’s shown interest in NIN?” Well, that’s not exactly how it went, but regardless – here it is. As we’ve moved from the familiar world of record labels and BS into the unknown world of doing everything yourself, we’ve realized it would benefit us and our ability to interact with you if we knew more about what you want, what you like, what you look like naked, etc. I know it’s a pain in the ass but we’d truly appreciate it if you’d take a minute and help us out. As an incentive, everyone who completes the survey will be able to download a video of live performance from this most recent tour (and I know what’s going through your little minds right now: “I’ll just grab this off a torrent site and not have to fill out the survey!!!” and guess what? You will be able to do just that and BEAT THE SYSTEM!!!! NIN=pwn3d!!!)

BUT

What if we were to select some of those that DO complete the survey and provide them with something really cool? I’m not saying we’ll ever get around to it, but if we did maybe something like signed stuff, flying someone to a show somewhere in the world, a magic amulet that makes you invisible, a date with Jeordie White (condoms supplied of course), you know – something cool. See, you’d miss that opportunity AND be a cheater.

Do the right thing – help us out. You’ll feel better.

Thank you and I’ve had too much caffeine this morning,

Trent

Visit here to take the survey:
https://www.questionpro.com/akira/TakeSurvey?id=1049187

Latest Research on Social Network Sites

Posted in Sociology, Software Development on September 3rd, 2008 by Russ Tarleton

The Journal of Computer-Mediated Commuication has released a special themed Issue on “Social Network Sites”
http://jcmc.indiana.edu/vol13/issue1/

Google Chrome

Posted in New Technology on September 3rd, 2008 by Russ Tarleton

Google’s new browser looks pretty amazing.

Check it out their easy-to-read web comic about it:
http://www.google.com/googlebooks/chrome/

Download it here:
http://www.google.com/chrome