Twitter Weekly Updates for 2010-03-07

March 7th, 2010
  • Watching Olympic Hockey. http://stevex.net/bigtweet/ (Last time I'll mention it, I promise). #
  • @travelmop I was just thinking the #BellTV HD signal looked a little fuzzier than usual. Maybe the stadium is just foggy. in reply to travelmop #
  • Are there as many Bell ads on the Rogers coverage of the Olympics? Seems like every 2nd ad is a Bell ad. #
  • Those Olympic gold medals look like they're made of paper. #
  • Updated BigTweet for the closing ceremonies (removed keyword 'hockey'). Wow that was an awesome game. #olympics http://stevex.net/bigtweet #
  • Half the audience is wearing antlers and the other half are behind welding masks. Bizarre. #olympics #
  • @travelmop Well, this is something, isn't it? The twitter chatter has been hilarious. Best comment: It's like a giant airport gift shop. in reply to travelmop #
  • Avril doing Girlfriend? That's more bizarre than the giant beavers. #olympics And apparently NBC cut away for something else. #
  • The MacHeist nanoBundle 2 is worth the $20 just for RipIt. http://www.macheist.com/ #
  • Windows 7 just told me I may be a victim of software counterfeiting. Using a licensed copy. I don't feel like a victim... #
  • @travelmop I like the way the Mac OS does it. The OS comes with a $2000 dongle. in reply to travelmop #
  • Hah, McDonalds is giving away free coffee meanwhile Tim Hortons is doing Roll Up the Rim. Which would you rather have? #

Blogging from MacJournal

March 3rd, 2010

I’ve been using Ecto as my blogging tool for some time now, but the current MacHeist bundle included MacJournal so I’m giving it a shot.

One feature I really like in any blogging tool is the ability to paste in an image and have it be included without having to save somewhere on disk first. Let’s see how that works.

PastedGraphic.tiff

If you’re reading this, and you see a completely unrelated photo above, then it all worked.

Twitter Weekly Updates for 2010-02-28

February 28th, 2010

Twitter Weekly Updates for 2010-02-21

February 21st, 2010

Twitter Weekly Updates for 2010-02-14

February 14th, 2010
  • Learning PureMVC. Sometimes all this layering just seems like paperwork. But the app I'm starting is big enough I know I'll need it. #
  • Hmm, the Apple store is down. All I get when I go there are huge iPad ads. New hardware today? #
  • I'm learning a lot about draft inducers, pressure switches, vacuum lines and furnace repair in general. The bad news? It's cold in here. #
  • @Avicdar Isn't that a Lightroom feature? in reply to Avicdar #
  • I give up. I'm not fixing my furnace. I have to reset it about once a day but I'm going to live with it and replace it in the fall. #
  • Seems the problem now is the gas valve. ~$500 to fix. #
  • The Facebook app for iPhone doesn't let you filter out apps. My entire feed is app notifications. Not very social. #
  • @anotherlab I can't even act on Farmville notifications on the iPhone, since it's a Flash-based game. So why notify me? in reply to anotherlab #
  • Facebook Chat through XMPP. Very cool. But no SSL? Not cool. #
  • If you already organized your Facebook friends in groups, iChat shows your online contacts in those groups. #
  • Bell is brave to enable new Internet-enabled PVR functionality on the first day of the Olympics. "Login Error". And a bit foolish. #
  • Bell TV support people can't help with a website problem. Is online PVR control a website problem or a TV problem? They're not sure. #
  • Set up a laptop by the TV and watch Olympic commentary from Twitter: http://stevex.net/bigtweet #

Flex Application Frameworks and Singletons

February 12th, 2010

I've been looking at a number of Flex frameworks lately, and common patterns used in Flex application development. One thing that surprises me is how often I've been encountering singletons.

The Singleton pattern allows a class to enforce that there is only ever one instance of the class, and usually gives you an easy way to access it. Typically it looks like this:

[cc lang="actionscript"]
// a typical singleton
package org.stevex.myapp.model
{
...

public class DocumentLocator
{
private var _document:Document;

public function getActiveDocument():Document
{
if (_document == null)
{
_document = new Document();
}

return _document;
}
}
[/cc]

There's more to it than that if you want to enforce that there ever only be one instance of Document; see Grant Skinner's article here for some techniques.

Cairngorm's ModelLocator lets you find your model from anywhere. PureMVC's Facade.retrieveProxy() does the same thing.

You may call these singletons. You know what I call them? Global Variables. And in my world, global variables are a bad thing.

Once your application is bigger than a few source files, you need to start thinking long term. Maintenance and reuse. How is the application going to evolve? Often, in ways you didn't expect.

Here's a key design pattern that I recommend. I don't know if it's got a name, which may not make it as cool as calling something a Singleton, but it goes as follows: Always provide context.

By context, I mean that a function should be able to find all the information it needs to do its job from either its arguments or instance members. If it's a static function, this means you have to pass in all the data the function needs to work.

It's the difference between:

[cc lang="actionscript"]
public static function printDocument()
{
var doc:Document = DocumentLocator.getActiveDocument();
... print the document ...
}
[/cc]

and

[cc lang="actionscript"]
public static function printDocument(doc:Document)
{
... print the document ...
}
[/cc]

This is a fairly simplistic example, but you get the point. The first function gets the active document and prints it, and the second function requires the document be passed in.

The former is simpler, because you can call printDocument from anywhere. For example:

[cc lang="xml"]

[/cc]

There, you've got a button and when you click it, it prints the active document. What's wrong with that?

Here are a couple of scenarios where you'd get into trouble.

What happens when you go from editing a single document to allowing the user to have multiple documents open? Okay, so the method is called getActiveDocument(). You can track what document is "active", right?

What makes a document active? UI focus? The last one the user interacted with? This too will work, short term, but eventually lets say that the application needs to fetch some data from a server before printing. The user clicks a button, the request goes out to the server, and while waiting for that to return, the user switches to a new document. Now getActiveDocument will return the new document and print the wrong one.

Instead, you need to pass some context around. So now the view needs to get the document from somewhere to pass it to the printDocument function. Exactly how this would work depends on how your app is architected and what framework you're using, but it's always possible.

Why am I on about this? I've been a C++ developer for a long time, and come from a world of multi-document editors, where these issues are nothing new. Flex started out in a single document world - a web page - but now with AIR it's going to become much more important as multiple document editors start to become the norm. And it's much easier to prepare for up front than to have to revisit your code later.

Technorati Tags:

Twitter Weekly Updates for 2010-02-07

February 7th, 2010
  • I hooked my Google Reader shared items up to Twitter. Let's see how that goes. #
  • You know Mafia Wars (a Facebook) game is big when the 2nd Google hit for "delivery truck" is a Mafia Wars related link. #
  • Build Failed makes me sad. Build Fixed makes me happy. #
  • On Removing Features: Lukas Mathis: “Eventually, you will find yourself in a position where your application conta... http://bit.ly/ax2RF5 #
  • abc.com is streaming video to Canada now .. is that new? #
  • Added recent tweets to my blog sidebar (http://blog.stevex.net). #
  • Diving into the Flash runtime environment these days. Great doc on loading modules and sub-applications: http://tinyurl.com/c8dsn6 #
  • Added mx.utils.ObjectUtil.toString() output to a list and wondered why no scroll bar. It's one line. String.split('\r') and it's an Array. #
  • Very impressed with WordPress's ability to update itself, and install plugins without having to do it from the command line. #
  • The code coloring on my blog looks terrible in Google Reader. Good thing I subscribe to myself or I'd never have known. #
  • I want a pocket size digital camera with built in GPS for geotagging, HD video, and ISO 6400 or higher. Does such a thing exist? #

Flex Component Showing in Flex Builder

February 4th, 2010

I ran into a problem a few days ago with a Flex component that I was building not showing up in Flash Builder when built using our command-line build, but showing up fine when built by the IDE (Flex Builder).

It took me a bit of searching to figure out what the problem was, which means it's worth posting the solution here.

Flex Builder's design view is extensible. New components that you build can show up in the Components panel, and users can drag them onto the design surface. You need to do a few things for this to work.

First, you need a design.xml file in your SWC. This file tells Flex Builder about your component. Here's an example:

[cc lang="xml"]

















[/cc]

I had that right in my SWC, but I was missing two things. The ant script that I was using for my command-line build wasn't including the design.xml file. After adding that, here's what the ant target for the SWC compile looks like:

[cc lang="xml"]















[/cc]

Note the include-file line, which gives the name of the file and then the source path to it.

And the other thing that was missing was the namespace mapping. The compiler.namespaces.namespace argument identifies the namespace for the component (which has to match the namespace from the design.xml) and the manifest to use for the classes in that namespace.

The last piece is the manifest file. Here's what that looks like:

[cc lang="xml"]




[/cc]

With all this set up, dropping the SWC into a Flex project's libs folder will immediately show the MyImage component in the Components panel ready to drag onto the design surface.

Soft Water Soap

February 2nd, 2010

I blogged a while back about soft water, and the slimy feeling that you get from apparently not being able to rinse off soap with soft water.

Let me step back a bit and give you the whole story (and a solution).

A few months ago, we moved into a house just outside the city, which was on well water. We've always lived in the city, and I didn't know anything about hard or soft water. I grew up in Ottawa, where (as I've learned) the water is just a little bit hard.

What's the difference between hard and soft water? Mostly, calcium. Well especially comes right out of the ground without any filtration other than what you've got in your house, but even in the city, depending on the water treatment plant you've got, you may have more calcium in your water than you want.

There are fancy ways of measuring this but I think the best one is, does stuff build up on your dishes in the dishwasher? Do your nice clear dishes, over time, become cloudy? That's what happens to other folks around here that don't have a water softener.

The calcium in the water has some negative effects on the stuff in your house. Soap in general is less effective at cleaning in hard water than soft water, and the calcium builds up on shower heads, in your hot water heater, and anywhere else that water runs through. For these reasons, a water softener is a good idea.

This was all explained to me by a Culligan rep who showed up at my door shortly after we moved in, looking to renew the contract on our water softener. My first response was "Water softener? We don't need that.. you can come take it out" but she launched into this long explanation of the benefits of soft water, and came back with a testing kit to demonstrate how hard our water was (11 grains hard, which is apparently a lot). So we renewed.

A water softener uses some salt and some chemical trickery to remove the calcium from your water. Lots has been written on this process elsewhere so I won't go into it here.

But if you're new to soft water, your first experience with it may be like ours: Hey, why can't I rinse soap off my hands? You get some Ivory soap on your hands to wash them, you rinse under the tap, and your hands just feel slippery. It's like the soap isn't coming off.

The Culligan explanation for this is that it's because your hands are so clean, it's actually your skin rubbing against itself. You've never been so clean!

A quote from a Culligan dealer's website:

In soft water the curd never forms so your true skin feels soft and slick like you can't get the soap off, but the reality is that it HAS been rinsed off and you are just feeling your true skin for the first time perhaps.

And I bought it for a little while, but I was always suspicious. For example, if you get some other sort of greasy substance on your skin, like, well, grease, you can't rinse that off either. Is the grease also making my skin so clean? And toothpaste?

And, when my skin was slippery this way, I could wipe it off with a towel and it would go back to a normal feeling of clean. Maybe the towel was putting enough dirt back onto my skin that it was undoing the super-clean state that washing in soft water had given it? That didn't sound right either.

I spent some time googling, and found a chemical explanation of the process of softening water and from there, an explanation of the effect that has on soap that makes a lot more sense.

The sodium or potassium in soft water makes it much more unfavorable for the sodium stearate to give up its sodium ion so that it can form an insoluble compound and get rinsed away. Instead, the stearate clings to the slightly charged surface of your skin. Essentially, soap would rather stick to you than get rinsed away in soft water.

So what can do you do about it?

Use a synthetic soap! The chemistry that gives you this soapy feeling only applies to "soap".

Soap consists of sodium or potassium salts of fatty acids and is obtained by reacting common oils or fats with a strong alkaline solution (the base, popularly referred to as lye) in a process known as saponification. The fats are hydrolyzed by the base, yielding alkali salts of fatty acids (crude soap) and glycerol.

Synthetic soaps don't have the same chemical makeup.

Synthetic soaps aren't labelled "soap" since they aren't actually soap. If you're looking for a good soft water soap, look for something labelled something like "beauty bar".

I use Ivory soap because my skin is sensitive to something in scented soaps, so after making this discovery, I went looking for a synthetic soap that is also free of additives. And I found the Dove Sensitive Skin Beauty Bar.

A side by side test showed a pretty significant difference between showering with Ivory and showering with Dove.

So, if you're looking for a solution to why your water softener makes your skin seem slippery when you wash it, switch to Dove.

Tablet Thoughts

January 7th, 2010

It seems we're on the verge of a tablet revolution. CES starts today, and there's been a lot of buzz about tablet form factor computers.

Apple and Microsoft have dabbled with tablets before. Microsoft with their Pen Computing and Pen Windows, and Apple with the Newton, and really to a lesser extent, the iPhone.

The big question about a tablet is, does anyone really want one? A few years ago, the answer was pretty clearly "no". But a few things have changed in the last few years that have opened up an opportunity for a tablet form factor computer.

Think about how you use computers at home. If you're reading my blog then you've probably got a laptop. Maybe it's not your main computer, but you've probably got one. And where do you use your laptop? I'm guessing, on the couch.

A lot of computing these days happens on the couch. And what are you doing on the couch? Surfing the web.

Laptop devices are pretty good for this. The keyboard part serves as a base for the screen so you can read without having to hold something. But then again, people have been reading books on the couch for years without much complaint so having to hold something doesn't seem like a problem as long as the thing you're holding is light enough.

Tablet PCs to date have been too heavy, and too hot (with whirring fans) to be comfortable to hold for a long time. That's changed - we can now build tablet PCs that will be light enough and cool enough to treat like a book.

A tablet would be a data consumption device, not a data creation device. It's an e-reader, maybe a TV guide browser for an updated Apple TV, a recipe finder for the kitchen (where a laptop on the counter is just awkward but a tablet on a stand would be perfect), and a web surfing device for the couch.