Flex/AIR: DynamicEvent

Applies to: Adobe Flex & AIR

A DynamicEvent is a type of custom event in Flex that is easier and quicker to set up than the full-blown approach. By applying the latter method, you normally go through the following steps:

  1. Define a subclass from flash.events.Event
  2. Make the event available to other ActionScript (through addEventListenter()) components or MXML components (using the [Event] metatag)
  3. Dispatch the event, using dispatchEvent()

Full documentation on custom events can be found in Adobe’s LiveDocs, here.

Generally one uses the above approach when you need to pass arguments to the code that’s targeted by the event. When you don’t require this, however, you can opt for the DynamicEvent. It’s not necessary to go through the whole rigamarole of subclassing; all you need is a name for the event, like so:

var yourEvent:DynamicEvent = new DynamicEvent("yourEventName", true);
dispatchEvent(yourEvent);

The second argument set to true means the event will bubble.

AS3: How to set focus to an empty textfield

Applicable to: Adobe ActionScript 3, Adobe Flex, Adobe AIR

This simple operation isn’t very obvious in ActionScript 3. The TextInput element has a boolean property called focusEnabled, but this doesn’t seem to do anything (it’s probably meant for other purposes, didn’t take the time to check).

The way achieve this is two-fold:

stage.focus = yourTextField;
yourTextField.setSelection(0,0);

If your textfield contains text and you wish to place the caret to the end, you would probably go about it like so:

stage.focus = yourTextField;
yourTextField.setSelection(0, yourTextField.length);

Makes sense now you know about it, huh?

Windows 7: Deleting, 3 hours remaining

Okay, I just had to post this:

Deleting, 3 hours remaining

Yes. Seriously. How is this possible? I’m just deleting some folders on my NAS…

Help: “The network bridge on device /dev/vmnet0 is not running”

This error message occurs sometimes in VMWare Fusion on the Mac when using a certain networking setting. This setting, in particular, is the “bridge” function. “Bridge”, as opposed to “NAT”, means the Virtual Machine gets its own IP-address on your local area network. The “NAT” (Network Address Translation) option, however, makes your Mac act like a router behind which the VM resides. This makes the VM inaccessible to the outside LAN, but it still has access to the outer LAN or Internet.

Bridging for VMs is nice because this is a way you can set up a VM to act as a server – serving printers, web resources, media and files. But sometimes, VMWare Fusion behaves awry, throwing up the dreaded exception:

“The network bridge on device /dev/vmnet0 is not running”

This will cause the VM to be disconnected from the network. There’s no real indication what causes this. Neither does it allude to how to fix it. “Just a Blog” provides a solution:

  1. Close the ailing VM
  2. Open the “Terminal” from Applications/Utilities
  3. Type:
    cd /Library/Application\ Support/VMWare\ Fusion/
  4. Type:
    sudo boot.sh –restart
  5. You may get a message warning you of the perils of sudo. Proceed.
  6. Re-open the VM and make sure network bridging is re-enabled through the Fusion’s “Settings” interface.

You should now be able to access the network through the respective VM. It may occur that this error crops up again. It seems to me that it happens arbitrarily. I wonder why Fusion can’t execute this command by itself, either.

I hope this helped :-) .

How To: Install Windows 7 from external USB disk or USB key

How to install Windows 7 from a USB key or external hard drive? There are a few commands you need to master with the built-in command-line tool called ‘diskpart’. A step-by-step guide.

As I documented the process of preparing an external USB drive to install Mac OS X 10.6 Snow Leopard, it’s only right for me to do the same for its counterpart Windows 7. It turns out doing this for the latter is much simpler than for the former. It should only take a few minutes to prepare the disk, plus the time your computer needs to copy the contents of the Windows 7 install disc or image.

Installing any operating system from a flash or hard drive has the advantage of being faster, because optical discs can only spin so fast – or rather, so slow as the spindle allows.

Here’s how.

Ingredients

What you’ll need to get this super-spiffy install medium:

  • A Windows 7 RC or RTM/GA (Home Premium, Professional, Ultimate) install disc or image
  • A working Windows XP/Vista/7 computer to perform the preparations
  • A 4GB or bigger USB key or external hard drive

Preparing the disk

  1. Pop the external disk into a vacant USB-port.
  2. Open a Command Prompt window, either by hitting the Windows key in Vista/7 and typing cmd or selecting Run… from the start menu in Windows XP and typing cmd.
  3. Then, in the black box, type diskpart – if you’re using Vista or up you’ll be prompted with a UAC window to which you must consent. XP users will be brought to diskpart right away, unless you’re using a Limited Account (if so, switch to an Administrator privileged account or do a Run As…)
    Diskpart intro screen
  4. We need to find out which index the USB device is at, so we’re sure we’re preparing the correct disk (and not, say, your C: drive). Enter list disk. In my case, my USB key is located at position 1. Check which number yours it at before you copy-paste the following commands!
    DiskPart: List Disk operation
  5. To tell DiskPart we want to start preparing disk 1, enter select disk 1.
  6. Type clean.
  7. Now we’re going to repartition the drive into one primary partition, so type create partition primary.
  8. To make the partition we just created the active one, simply enter active into the box.
  9. Then, we’ll want to format the active partition as FAT32. This is done by typing and entering format fs=fat32 quick. The quick keyword will wipe the file table instead of wiping the disk sector by sector, which takes a lot longer. If you’re concerned with the wiped data being completely gone, omit ‘quick’.
  10. Finally, type assign so the drive gets a letter in Windows Explorer for easy access.

Copying the files over

You now have a clean, ready to be copied to, disk. What follows is extremely simple:

  1. Insert your Windows 7 installer disc into the tray or mount the installer image with a tool like DaemonTools.
  2. Open the disc’s/image’s contents by browsing to it using Explorer.
  3. Select all files and folders (CTRL+A or ‘Organize > Select All’).
  4. Copy the files using the right-click menu or hitting CTRL+C.
  5. Paste everything onto the root of the prepared USB drive.

Your USB drive is now bootable

Restart your computer and make sure you boot from USB. The installation procedure will continue as it would from a disc, only faster. Happy installing.

How To: Install Mac OS X 10.6 Snow Leopard from external USB disk

How to upgrade to or clean install Mac OS X 10.6 Snow Leopard from an external USB or FireWire drive? It’s easier than it sounds. A step by step guide.

Optical discs are so 2000! Whether you got the disc at retail or acquired it through dubious sources like The Pirate Bay (which I don’t condone), you can re-partition an old iPod or external hard drive and use it to install OS X. Installing an OS from USB/FireWire is remarkably faster than its disc-based variant. It’s also not so prone to scratches and dirt, a problem many disc owners face daily.

Required Ingredients

To get this speedy install medium baked and ready, you’ll need:

  • Mac OS X 10.6 Snow Leopard install DVD or ISO
  • External USB/FireWire drive or old iPod
  • A working Mac computer to partition the above drive

Convert OS X 10.6 Install DVD to DMG

If you purchased the Snow Leopard disc – like most – you may want to convert it to a disk image for back-up purposes. This step is not required, so you may skip over it if you want.

  1. Launch “Disk Utility”
  2. Select the Snow Leopard DVD in the side pane
  3. Select “New Image” from the top
    diskutil1
  4. Give the DMG a name to save it somewhere
  5. Click OK

Partition external drive

There are a few things you need to pay attention to for your Mac to be able to boot from your external drive. You can achieve this by – once more – using the Disk Utility described above.

  1. If not already open, launch “Disk Utility”
  2. Select the external drive you want to use, not one of the underlying partitions
  3. Select the “Partition”-tab
  4. If you still want to use the disk for other storage purposes, you should create 2 partitions. The first one will be around 10GB and will allow for installing Mac OS X 10.6.
    diskutil2
  5. Select the first partition (in my case called “BOOT”) and click the “Options…“-button.
  6. Select “GUID Partition Table“. This is the only type of partition table that Intel Macs can boot from. If you format the other partition as FAT it will still be usable on Windows or Linux.
  7. Make sure that the first partition is formatted as “Mac OS Extended (Journaled)”.
  8. Then, still having the first partition selected, click the “Restore”-tab at the top.
    diskutil3
  9. Go select your install image (or select the physical DVD) and drag the destination partition from the left pane to the destination text field.
  10. Click restore.

Once ready, make sure you have backups handy (if you use Time Machine you’re set to go), plug in your disk. You can then start the installation from the desktop or reboot and hold down the Option/Alt key at startup to select your drive.

Installation will work as it would when running from the DVD. Only faster. If you created a DMG, you’ll also have a backup in case you lose the install disc (or it gets broken).

Weekend: Apple yanked ZFS from Snow Leopard, enemy of TV industry, SSD goes mainstream & more

Tech news roundup up for August 29 through August 30, 2009. As weekends are less news-laden than weekdays, the following stories are mostly in-depth editorials about a certain subject. During the weekend it’s time to sit down with a good long article and engross. This weekend’s highlights:

  • Solid-State Drives Go Mainstream #
  • Woofer: This Twitter look-alike requires 1,400 characters #
  • Using ‘Free’ to Turn a Profit #
  • Hey, PC, Who Taught You to Fight Back? #
  • Is Apple the Enemy of the TV Industry? Microsoft Thinks So #
  • Apple kicks ZFS in the butt #

Solid-State Drives Go Mainstream

While prices for SSDs are still significantly high when compared to conventional spinning hard drives, mainstream consumers are starting to see the benefit of this new technology. As more and more manufacturers and models are available on the market, computer vendors are starting to incorporate them into lower-end computers as well. Because SSDs are currently still limited in storage space (up to 256GB, .5TB & 1TB are available but are prohibitively expensive), more and more people are turning to them as complimentary storage. SSDs can easily contain the operating system and applications, while other data can be stored on normal HDDs. Because SSDs are inherently faster, this workflow would evidently speed up your computer. ComputerWorld elaborates.

This Twitter look-alike requires 1,400 characters

I generally ignore Twitter “news” because it is cumbersome and totally useless – in my mind, but this one’s too funny. Woofer, an astoundingly accurate Twitter-lookalike actually requires you to update your status with at least 1,400 characters, as opposed to Twitter’s maximum of 140 characters. Woofer advises its users to be eloquent, to use adverbs and never to abbreviate. Via CNET News.

Using ‘Free’ to Turn a Profit

This editorial article from NYTimes gets together with Evernote and discusses its – and many other web businesses’ – revenue model. True to the web’s nature, Evernote is free for everyone to use. But how does the company make money? NYTimes finds out.

Hey, PC, Who Taught You to Fight Back?

Again from the NYTimes, this article describes Microsoft and Apple’s ad-fighting history in light of both companies’ latest television commercials. While Apple has always been big on advertising, it seems Microsoft has been making renewed commitments with its latest efforts – and is getting some results from it, too. From NYTimes.

Is Apple the Enemy of the TV Industry? Microsoft Thinks So

Microsoft’s Director of Consumer and Online in the UK has expressed his concerns with the Television Industry’s future if it doesn’t take initiatives to move its repertoire to the web and keep its content out of the hands of a single online entity – read: Apple. According to the said Director, the industry should be wary of what he called an “iTunes moment”, referring to the music industry and Apple’s hold on it with iTunes. The same could become true with TV, Microsoft warns. Via Mashable.

Apple kicks ZFS in the butt

In other Apple news, it turns out Apple completely yanked the promised ZFS functionality from its latest OS, Mac OS X 10.6 Snow Leopard. ZFS is Sun’s open source, highly reliable and modern file system that would make its entree into the consumer operating system market for the first time with Snow Leopard – as announced two years ago by Apple itself. With every developer release of OS X 10.6 traces of ZFS became vaguer and the final release completely erases any trace of it – silently. Microsoft was harshly called out for yanking WinFS from Windows Vista, but is anyone paying any attention when Apple pulls the same stunt? ZDNet blog post.

Tech News Roundup

Tech news roundup for August 27,  2009. Yesterday was a slow news day, hence no news roundup for August 26, 2009. Today was also rather slow, to be honest.

  • Google Now Offers Over a Million Free Ebooks in EPUB Format #
  • Microsoft cuts Xbox price by 25 percent #
  • Asustek to launch e-book reader under Eee family #
  • Confirmed: $29 Snow Leopard Installs Whether or Not You’ve Got Leopard #

Google Now Offers Over a Million Free Ebooks in EPUB Format

Google currently offers 1 million books in EPUB format through it’s Google Books portal. Many of these books are in the public domain, so many of them are pretty old. But old books can still be good. Source at Mashable.

Microsoft cuts Xbox price by 25 percent

Microsoft has intensified the price war with Sony by lowering the price of its XBOX360 by approximately 25%. The Elite model will be 100$ US cheaper, with its 299$ US price point. The Arcade remains the same at 249$ US. The middle model, called the Pro, will be discontinued. This leaves the consumer with a simplified choice, says Microsoft. As of now, Microsoft is the only console manufacturer with positive sales. Source at Reuters.

Asustek to launch e-book reader under Eee family

eBook-readers seem to be in vogue lately. Word goes round that Asus, maker of the EeePC, will also be manufacturing an eBook-reader to compete with Amazon and Sony. Source at DigiTimes.

Confirmed: $29 Snow Leopard Installs Whether or Not You’ve Got Leopard

Mac OS X 10.6 Snow Leopard will cost Leopard-users $30, and Tiger users $169, because they are supposed to purchase the Box Set. This includes the new OS, iLife ‘09 and iWork ‘09. It has been confirmed that OS X 10.6 will also install whether or not you’re actually using 10.5. It turns out the so called upgrade disc doesn’t check for prior versions. If you’re still on Tiger, you can skip Leopard all together and save a lot of money, but you’ll be violating Apple’s EULA. Source at Lifehacker.

High Hopes for Office Web Apps

Office 14 Web Word Office14 Web Excel Office14 Web PowerPoint

(click images to enlarge)

With Microsoft Office Web Applications, the productivity suite will have a real web-facing side for the first time. It will be released alongside Office 2010 and will be supported by all major browsers, including Mozilla Firefox, Internet Explorer, Apple Safari and Google Chrome. Anticipations and stakes for this release are high and I personally think it’s going to sweep current online productivity suites like Google Docs right off the table. Yes, I have extreme high hopes for Office Web Apps. And perhaps you should too.

Feature Set

While not much is known about the real specifics of the online Office suite, it is certain that the traditional desktop software applications like Word, Excel, Powerpoint and OneNote will certainly be represented in the online version of Microsoft Office.

Microsoft describes the suite as online siblings for its Office applications. They will be “lightweight versions of the applications from the desktop product”. According to the General Manager of the Office-project, users of the web applications will be able to “view, edit, and collaborate” on Office documents. The web-version of Office will also, most importantly, retain document fidelity to the fullest, allowing a user to view documents in full quality online, make alterations and save it again (online or off) without loss of quality. This is stellar functionality lacking currently in all  online productivity suites.

Google Docs – as a common example – incorporates support for Microsoft Office documents in rather shoddy way. After you upload your files – frankly – they become half-assed HTML variations of the originating document. Microsoft’s solution promises to retain all of the rich formatting, lay-outs, styling, charts, transitions and image quality.

This is obviously a big improvement over any of the current implementations. And it’s one with far-reaching ramifications.

High Hopes

If you have ever sampled an online productivity suite like Google Docs you instantly realize what a step back it actually is from Microsoft Office 2007. It’s slow and feature-impaired. In Google Docs’ case it feels more like a old Office 2003 replica, with the toolbar UI bringing back bad memories with every click. Support for pretty fonts and advanced page layout capabilities are simply neglected. There isn’t anything significant implemented around text styling, nor is the revisioning system in GDocs very much impressive. If we’re honest here, it’s a downright fluke. In my opinion, Google Docs is more reminiscent of an advanced WYSIWYG-editor for blogging purposes, rather than an online word processor. And it’s not even decently apt at producing the aforementioned blog posts, since the HTML it outputs is extremely semantics unfriendly.

Microsoft’s solution, however, could be a game-changer. It will feature the ribbon interface, albeit it less feature-rich, because some functionality simply doesn’t belong in a browser. It will support many of Office’s advanced presentational niceties, though. Couple this to the online storage we’ll be getting with Office Live and true cloud computing starts to show its colors.

Reduced Functionality

I talked about reduced functionality, but don’t let that scare you. The online version of Office will be feature-limited to the degree that the most used functionality will remain present. And since most Office-users only utilize a small percentage of the full suite’s feature-set, I don’t think there will be problems with using Office in its reduced form through Office Web Applications.

To me, this is all very exciting, but I realize I should reserve judgment until I can get my hands on it for some real experience. But what’s a geek to do? I just can’t help myself. Microsoft’s introduction of the ribbon interface to its Office line was big. And so will this be. I sure can’t wait to check it out.

Microsoft’s OneApp, Nokia’s Windows 7 netbook w/ 12hrs of battery life, Opera 10 & more

Tech news roundup for August 25, 2009. I’d like to share some science/astronomy oriented articles with you before we jump to the tech news.

  • Another Little Ice Age? Solar activity and climate change #
  • Extrasolar Planets at Full Tilt #

Now for the tech news:

  • Microsoft’s OneApp targets non-smartphones #
  • Nokia to deliver Windows 7-powered netbook with 12 hours of battery life #
  • Opera 10 Slated For September 1 Launch. Will Anyone Take Notice? #
  • Sony’s new Reader lineup assaults Amazon Kindle #

Another Little Ice Age? Solar activity and climate change

The Sun’s is experiencing a slow return to normal activity after its natural 11-year cycle. The number of sun-spots have decreased, which could indicated a “Little Ice Age” may be impending. The last time this happened was the late 17th century. This time around its effects may not be as chilling due to the vast amount of greenhouse gases now circulating our atmosphere. Source at ArsTechnica.

Extrasolar Planets at Full Tilt

Exoplanets – scientists have recently discovered – don’t generally follow our Solar System’s common circular orbits. Instead, they’re usually tilted more than 30 degrees, causing some of them to actually orbit backwards relative to its parent star. The most tilted planet (7 degrees) in our solar system is Mercury. Interesting insights. Source at Discovery.

Microsoft’s OneApp targets non-smartphones

Microsoft recently launched a mobile application called “OneApp”, which is directed at the non-smartphone market. The application will act as a gateway to web applications and services like Facebook, Twitter, Windows Live Messenger, and more. Because non-smartphones are so low on processing power, OneApp will relay processing and storage to the web. The app itself only takes up 150KB and will even work on the most basic GPRS/EDGE phones. Source at TechRadar.

Nokia to deliver Windows 7-powered netbook with 12 hours of battery life

Yes. Truly. Read the specs at Paul Thurrott’s SuperSite Blog post.

Opera 10 Slated For September 1 Launch. Will Anyone Take Notice?

The cursed underdog of browser-land, Opera, has published the Release Candidate for its upcoming browser Opera 10. Codenamed “Peregrine”, it will offer “an improved user interface, increased web standards support, bug fixes, performance improvements, and new tools for web developers”. As with every release from Opera, I will download it and give it a fair chance. I rarely like what I see, though. So, in those terms, this will be Opera’s tenth chance to convince me. Source at TechCrunch.

Sony’s new Reader lineup assaults Amazon Kindle

Sony Reader TrioSony has refreshed its lineup of eBook readers with a trio of readers, each specialized in a certain type of end user. The first – called “Pocket Edition” – is portable and cheap. The second one – “Touch Edition” – offers a bigger screen with touch capabilities. And the über-reader is called the “Daily Edition”, with a big screen, touch capabilities and 3G & WIFI connectivity. In each case, Sony’s equivalents to the Kindle and Kindle DX are significantly cheaper than Amazon’s offerings. Also, Sony scrambles behind eBook-standard EPUB enabling broader compatibility. It has also partnered with Google. Source at ZDNET.
(click the thumbnail on the right for a closer look)