FightSkillz.com - Life, Code, & Idiocy

Software

Length is Semi-Reserved

Monday, November 30th, 2009

I'm writing a Flex/AIR app that grabs stuff from a database and displays it in an mx.controls.list. Interacting with it you can switch the list mode, which changes the visibility of certain controls in the itemRenderer. There are currently 20 items in the dataProvider, about 8 are displayed at any given time. I noticed that switching modes - and by doing so waiting for validateList() to run, took incrementally larger amounts of time for each of the first 3 items that were in view. So if you scrolled down one item and switched modes it was a bit faster, and if you scrolled past the first 3 switching modes became instant as it should be.

After looking over the same possibly relevant lines of code several times, reading up in detail of how the validateList() cycle works and getting into the nitty gritty of list classes I realized the problem was on the database side. I had a column named length. At first I thought there was an issue where I'd set the column type as a floating point number and maybe actionscript was having a time converting it or dealing with it in an object - there's no actual reason why I thought this, but the performance issue was not noticeable if the floating point number was smaller than 10,000.

Fortunately after only a few hours time wasted I, the spaz writing this, realized that the length column was being interpreted in actionscript as the length(ie: number of children/values) of the object. So say length was set to 100,000, for every item in the list it would have to create and analyze 999,992 blank values - creating space in memory for each one, along with the 8 actual values pulled from the database.

Furthermore when I referenced the item.length value while technically the value pulled from the database, was really the number of children in the object. The small robots that live inside my computer and make it work must have though I was bananas.

I'd like this to be my formal application for the prestigious Leader of the Idiots, but since I'm obviously not equipped with the basic skill set to do anything(read: dressing oneself, remembering reserved names) I'll rely on some kind soul reading this to file the application for me and submit it to the proper authorities.. thanks.

P2P in Adobe Air 2.0 and Flash 10.1

Sunday, November 29th, 2009

Adobe is literally making it possible for me to create what I want, and cosmically in sync with where I am on the road to creating those things. I feel indebted - as I should, to the tool creators. The future will be a crazy cross platform interconnected kinda world. It's a great era to live in, and be a part of.

Google Chrome OS

Thursday, November 19th, 2009

In Google's words, more videos after the jump.

(more...)

New Features in Adobe Air 2.0 – Beta Available Now

Tuesday, November 17th, 2009

The Adobe Air 2.0 beta is available for download now. Air 2.0 is a huge advancement and brings tons of impactfull new features. Most notably you can now write fully native apps, that use fully native installers and communicate and launch native apps. Hugely improved performance. Work with sound like never before. Sockets, and HTML5.

Download the AIR 2.0 Beta.

The Flash 10.1 prerelease is also available for download.

This is from the Adobe Labs.

New Features in AIR 2

  • Open documents with the user's default application
    You can open document files in the application the user has set up as the default opening application. Launching executables or script files is not permitted unless the application is packaged in a native installer. See File.openWithDefaultApplication() and Opening files with the default system application.
  • Microphone data access
    You can access the sound data from a microphone directly for recording or other processing. See Microphone.sampleData and Capturing microphone sound data.
  • Mass storage device detection
    You can now detect when a mass storage device, such as a USB drive or a camera, has been connected to the user's computer. See StorageVolumeInfo.
  • Updated WebKit version
    • WebKit in AIR is based on the version shipped with Safari 4.0.3
    • Support for JavaScript profiling
    • SquirrelFish Extreme JavaScript engine resulting in 50% faster performance using SunSpider tests
    • CSS3 Module support (2D transformations, transitions, animations, gradients, zoom and WebKit CSS selectors, etc.).
    • Styling scrollbars via CSS
    • Latest Canvas enhancements.
  • Global Error Handling
    Global error handling lets you handle all uncaught errors (both synchronous errors and asynchronous error events) in one place in your code. See UncaughtErrorEvent.
  • New networking support
  • Packaging an AIR application in a native installer
    You can package an AIR application in a native install program instead of an AIR file. Applications packaged and installed using a native installer have access to platform-specific features such as the Native Process API. See Packaging an AIR application in a native installer.
  • Native process API
    You can launch and communicate with native processes. Applications that use this API must be installed using a native installer. See NativeProcess and Communicating with native processes in AIR and the following quick start articles: (For HTML developers) Interacting with a native process, (For Flex developers) Interacting with a native process, and (For Flash developers) Interacting with a native process.
  • Database transaction savepoints
    You can commit or roll back multiple database changes as a single transaction. See SQLConnection.setSavePoint().
  • Screen reader support (Windows only)
    Users can use screen reader software with AIR applications. See Accessibility.
  • Printing enhancements
    • Vector printing is now supported on the Mac.
    • PrintJobOptions.printMethod allows you to control whether vector or bitmap printing is performed. You can also let the runtime choose the best method (using an internal heuristic based on analyzing the content to be printed). See PrintJobOptions.printMethod.
  • Idle time-out settings for URL requests
    You can override the default idle time-out setting for URL requests. See idleTimeout.
  • Improved IPv6 support
    IPv6 format addresses can now be used with all APIs that accept an IP string as input.
  • Increased maximum size of NativeWindow
    The maximum size of a NativeWindow has been increased to 4095x4095 pixels (from 2880x2880 pixels). See NativeWindow.bounds.
  • File promises (Win/Mac only)
    You can now allow users to drag a file that has not been created yet out of an AIR application and provide the data for that function after the file promise has been dropped. For example, you could provide a list of files available on a remote server. When the user drops an item from that list onto their desktop, you can download the data and write it to the dropped file. See URLFilePromise and Dropping file promises.
  • Multi-touch events
    You can listen for multi-touch and gesture events on computers that have multi-touch hardware and operating system support. See TouchEvent.
  • IME API and IME text input enhancement
    Input Method Editors (IMEs) can be used with any InteractiveObject, not just TextField objects. This allows you to support IME input when using the Flash Text Engine or the Adobe Text Layout Framework, for example. See IME.
  • Native runtime install packages for Linux
    Native install packages are now provided for the rpm and debian package managers.

HTTPS/SSL/TLS Security Exploit Found – Affects Everyone

Friday, November 6th, 2009

A flaw was discovered in the tls renegotiation process where a 'man in the middle' could take over the connection in a number of ways and perform a number of exploits. Transferring login, credit card, and other important info using https:// is no longer considered secure. The 'man in the middle' could be bumming off your local wireless network, anywhere in between you and your ISP, your ISP and the destination, or on the destinations network. Secure Certificates from the likes of VeriSign can no longer be fully trusted until they find a fix, at which point you'll need to update all your software - browsers, email clients, twitter apps, smart phone firmware, as all the software manufacturers implement and roll out the new(not yet figured out or released) protocol.

Luckily the vast majority of internet users are stupid and this won't affect activity on the internet a bit, even people that are reading or writing this post will still log into their email accounts and go about their online life relying on sheer improbability of them being exploited by this massive(read: catastrophic) security hole. Once again it's stupidity and recklessness that will keep the world turning cause as we all know if you stop and think about anything too long you'll just give up and go live in the forest like we were originally supposed to.

If you're interested in a more technical description go here.

If you're a programmer and you contribute to or write software which implements tls please disable renegotiation a.s.a.p. and push the update to all your users until a new version of the protocol is released.

via Ars Technica

Extra Google Wave Invite

Wednesday, October 14th, 2009

I got my Wave invite from Google yesterday. It's really awesome. They start you off with 8 invites and I ended up with 1 spare, so I figured I'd pass it on to one of my readers. Ideally I'd want it to be someone I could collaborate with on something - assuming most people that read this ridiculous blog are programmers/designers but my plate is pretty full at the moment and I've got just under 470 hours left until I have to launch the EDO Beta (a possibly very stupid and public commitment I made to myself 30 hours ago, hence the timer on the side of the blog).

I don't want anything for the invite - it would be against Google's TOS anyway, but I do have an extra one that's just sitting there. So I guess tell me in the comment section why you really want Wave and I'll post sometime this weekend announcing the lucky literate.

Note: there's an appropriate place to fill in your email address and/or website so I can contact you. So you don't need to post that info in the actual comment or make it public. I'll probably be responding to comments as well.

If you're into music you might also want to check out Ear-Drum.org, a project I've been working on for a while now.. getting ready to launch a private beta of that and will be giving out invites for that too, visit the site for more info.

Let Postfix send mail through your Gmail Account – Snow Leopard

Monday, October 12th, 2009

First of all GRRRRRR!!

Second, this has been one of those things I randomly get sucked into between projects where I'll spend 5 hours on Google trying to figure it out and getting tiny fragments of info but never actually solving the issue. This is the worst! What the hell am I talking about? Say you use MAMP or whatever as a local testing server. You write some PHP and you need to use the mail() function. You test your new email function to your personal gmail account. Ok so you try it and it doesn't work, or even worse it works a couple times and then never again.  So you go to Applications->Utilities and fire up the Console application. You're shocked to see that there's a message in there saying something about Gmail not accepting mail from your IP address because it's registered as a residential thingy and apparently a lot of spammers use their personal computers to send spam.

So you say no no there must be some mistake I'm a programmer, not a spammer, I'm just trying to test out my new app. But you quickly realize you're talking to a computer, pleading, and well it doesn't care. typical. After, you cry and try piece together a coherent step by step set of instructions to route all mail sent from your computer through your Gmail account - so it would be from you, and all go through. here's what you do.

note that $ is used to show a new terminal command, you don't actually type it in:

Open Terminal - found in Applications->Utilities and type in:

$ sudo nano /etc/postfix/relay_password

You'll now be editing a new file called relay_password in the nano Terminal editor, type in the following substituting your login info - it should work with google apps accounts as well:

smtp.gmail.com example@yourdomain.com:yourpassword

Press ctrl+o on your keyboard followed by Enter to save the file, then press ctrl+x to exit the editor.

Now type in:

$ sudo postmap /etc/postfix/relay_password

That should tell Postfix to use the relay file you just created. Gmail uses a secure connection so you need to head over to Verisign and download some root certificates. Go to the following url fill out your info and download the .zip file:

https://www.verisign.com/support/roots.html.

Now type in the following commands one after another. In the second command it wants the roots.zip you just downloaded, you can just drag the zip file onto the Terminal window and it will fill in it's location, don't do that for the 4th command though. Also note you may have some certificates already on your system, so after the second last command you may be prompted to replace existing certificates, type N so it doesn't replace the ones you have:

$ sudo mkdir /etc/postfix/certs
$ sudo cp roots.zip /etc/postfix/certs
$ cd /etc/postfix/certs/
$ sudo unzip -j roots.zip
$ sudo openssl x509 -inform der -in thawte\ Primary\ Root\ CA\ -\ G2_ECC.cer -out thawte\ Primary\ Root\ CA\ -\ G2_ECC.pem
$ sudo c_rehash /etc/postfix/certs

Now type in:

$ sudo nano /etc/postfix/main.cf

Go to the end of the document, you can delete the MAMP stuff, also note that if you have MAMP Pro and you edit postfix settings from there it'll fuck up what we're doing here. So remember this going into the future and don't do that.

Paste in the following at the end of the document - note: use the keyboard to get around the document, but use the mouse to right click and paste:

relayhost = smtp.gmail.com:587
# auth
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_password
smtp_sasl_security_options = noanonymous

# tls
smtp_tls_security_level = may
smtp_tls_CApath = /etc/postfix/certs
smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache
smtp_tls_session_cache_timeout = 3600s
smtp_tls_loglevel = 1
tls_random_source = dev:/dev/urandom

Save it like we did before by pressing ctrl+o, then Enter, then ctrl+x.

Now type in:

$ sudo nano /etc/postfix/master.cf

You're now editing master.cf, this is a different file to main.cf we just pasted stuff into. There should be a table in here, find the line in the table that looks something like this:

#tlsmgr    fifo  -       -       n       -       1       tlsmgr

Make it look like this - note the comment is removed and fifo should be unix:

tlsmgr    unix  -       -       n       -       1       tlsmgr

Save it like the other times pressing ctrl+o, then Enter, then ctrl+x.

Ok, so at this point you can put the following into terminal and see that it works - put your email address in there twice:

printf "Subject: blah" | sendmail -f user@gmail.com user@gmail.com

Postfix is working now. good. You go back to your PHP application and test the mail() function again. If it works then you're done, but if not you panic. You start feeling really hungry. You know that Postfix is working but maybe PHP or Apache haven't gotten the message yet. ok. So you see in Console that sendmail is crashing, you open the crash report in Terminal and it tells you there's an incompatible version of libxml. It wants 10 and you have 9. You begin questioning if any of this is worth it and maybe you should just go sit in front of a tv and forget about doing anything meaningful with the rest of your life.

After almost installing XCode and registering as an apple developer so you can make and install the newest version of libxml, you wonder if maybe MAMP comes with libxml and find that yes it does. So instead of spending 2 hours upgrading the system libxml only to find it doesn't do anything you just upgrade to the latest version of MAMP (1.8 at the time of writing) and it works. What?? it works? really? yup. so what do you do now?

REJOICE! with lunch.

Some of this was scoured from random forums and blogs in the midst of complete frustration and combined into steps that actually work. A chunk however was taken from this post: http://dejan.ranisavljevic.com/2009/05/28/enable-postfix-with-relay-outbound-to-your-gmail-account-on-os-x-leopard/ so check them out.

Adobe Flash 10.1 – New Features

Monday, October 5th, 2009

Flash 10 has 90% penetration now, so it should be a "go" to develop for it if you've been waiting to fold some of the newer features into your applications but need to serve the widest possible audience.

Now on with what's new in Flash 10.1

Global error handling: Sort of a catch all for errors so you can gracefully deal with any uncaught errors.

Microphone access: You'll be able to deal with raw audio data from a microphone input (Something I've personally been waiting for since I began programming on the Flash platform)

User interaction: Multi touch including the ability to write custom touch gestures, and accelerometer access on mobile devices

Text and globalization: Improved  the new text layout engine released in 10.0, and new APIs

Content protection: Media encryption to protect premium video content. Access 2.0

Stream enhancements: It's easier to stream with any server. Useful for mobile devices briefly losing or changing networks won't hamper buffering, and skipping to the middle of a video you won't lose what was just buffered at the beginning of the video.

Live Media: More granular control over p2p communication, using groups to enable more efficient transmission.

Other: Lots of memory enhancements on mobile and desktop. Hardware acceleration for video content - H.264 and AAC. A circular buffer for playing large videos with little memory consumption. Vectors and images get similar gpu and memory improvements. When someone puts 80 youtube videos on one page Flash 10.1 will realize it's running low on memory and replace unloaded ones with a play button.

Read this for a detailed breakdown of new features.

 

Adobe Flash 10.1

Monday, October 5th, 2009
First check out the Open Screen Project. Finally we're about to see Flash playable on a much wider variety of devices including Android based smart phones. With Flash as ubiquitous as open source web technologies html/javascript, it will be the platform that becomes mainstream. The idea "develop once, works everywhere" is key here. It's already free to develop flex applications, since Adobe released the Flex sdk as open source, I can use php with AMF, and they're continuing to open up their protocols and file formats. Being a Flex developer is a good place to be at the moment and 2010 is going to mean the proliferation of Flash across devices. It's already had like 95%+ penetration across browsers to create a uniform web experience, this is just the next logical step. So that's Full flash player on mobile devices. They've "revealed" Flash Player 10.1, the "first consistent runtime release of the Open Screen Project that enables uncompromised Web browsing of expressive applications, content and high definition (HD) videos across devices." Here's the press release:
Close to 50 Open Screen Project Participants Support New Browser Runtime for Multiple Platforms LOS ANGELES — Oct. 5, 2009 — Adobe Systems Incorporated (Nasdaq:ADBE) today unveiled Adobe® Flash® Player 10.1 software for smartphones, smartbooks, netbooks, PCs and other Internet-connected devices, allowing content created using the Adobe Flash Platform to reach users wherever they are. A public developer beta of the browser-based runtime is expected to be available for Windows® Mobile, Palm® webOS and desktop operating systems including Windows, Macintosh and Linux later this year. Public betas for Google® Android™ and Symbian® OS are expected to be available in early 2010. In addition, Adobe and RIM announced a joint collaboration to bring Flash Player to Blackberry® smartphones, and Google joined close to 50 other industry players in the Open Screen Project initiative. Flash Player 10.1 is the first consistent runtime release of the Open Screen Project that enables uncompromised Web browsing of expressive applications, content and high definition (HD) videos across devices. Using the productive Web programming model of the Flash Platform, the browser-based runtime enables millions of designers and developers to reuse code and assets and reduce the cost of creating, testing and deploying content across different operating systems and browsers. Flash Player 10.1 is easily updateable across all supported platforms to ensure rapid adoption of new innovations that move the Web forward. The browser-based runtime leverages the power of the Graphics Processing Unit (GPU) for accelerated video and graphics while conserving battery life and minimizing resource utilization. New mobile-ready features that take advantage of native device capabilities include support for multi-touch, gestures, mobile input models, accelerometer and screen orientation bringing unprecedented creative control and expressiveness to the mobile browsing experience. Flash Player 10.1 will also take advantage of media delivery with HTTP streaming, including integration of content protection powered by Adobe® Flash® Access 2.0. This effort, code-named Zeri, will be an open format based on industry standards and will provide content publishers, distributors and partners the tools they need to utilize HTTP infrastructures for high-quality media delivery in Flash Player 10.1 and Adobe® AIR® 2.0 software. To learn more about Flash Player 10.1 and to see video demos visit Adobe Labs. “With Flash Player moving to new mobile platforms, users will be able to experience virtually all Flash technology based Web content and applications wherever they are,” said David Wadhwani, general manager and vice president, Platform Business Unit at Adobe. “We are excited about the broad collaboration of close to 50 industry leaders in the Open Screen Project and the ongoing collaboration with 19 out of the top 20 handset manufacturers worldwide. It will be great to see first devices ship with full Flash Player in the first half of next year.” "We are excited to join Adobe and other industry leaders in the Open Screen Project," said Sundar Pichai, vice president of Product Management at Google. "This initiative supports our common goal to move the Web forward as a platform and to spur innovation in the industry through technology such as Adobe Flash." “Adobe Flash technology provides a key experience on new Windows phones, enabling people to enjoy rich Flash based games, videos and other interactive Web content on the go,” said Stephanie Ferguson, general manager, Product Management, Microsoft Corp. “We look forward to bringing in the new capabilities of Adobe Flash Player 10.1 to the Windows phone browser when it becomes available.” “Motorola is excited to be one of the first handset manufacturers to ship Android based devices with Flash Player support early next year,” said Christy Wyatt, vice president of software applications and ecosystem at Motorola. “As the No.1 platform for video on the Web, uncompromised browsing of Flash technology based content is essential for a rich mobile experience and something users expect from Motorola today.” “As a longtime partner of Adobe, and more than 400 million Nokia phones shipped with existing Flash technology to date, we are excited to see Flash Player becoming a reality for mobile phones and other mobile devices,” said Purnima Kochikar, vice president, Forum Nokia. “Nokia is excited about full Flash Player coming to devices and we are committed to supporting Flash Player 10.1 on mobile devices in 2010.” via Adobe

Disable Flash Debugger Error Messages

Tuesday, September 1st, 2009

If you have Adobe CS, Flex Builder, Flash Builder or otherwise use the Debugger version of Flash Player you quickly realize that a lot of sites out there don't bother with error handling in their apps and widgets.  This sucks because everywhere you go you get these error messages and all you can do is click them away and contact the developers, who if they cared would have dealt with the errors in the first place.

You can easily disable these error messages and then just re-enable them when you're debugging something. So here's how to do that:

  1. Find or create a file called mm.cfg in the following folder:
    OS X: /Library/Application Support/Macromedia
    Win XP: C:\Documents and Settings\username
    Win Vista: C:\Users\username
    Linux: /home/username
  2. Add the following line to the file and save it:
    SuppressDebuggerExceptionDialogs=1
  3. That's it, to turn debugging back on change that value to 0