#12 Refactoring User Name Part 3

In the final part of this series you will see how to refactor your tests. Keeping tests clean is important because it will make testing easier to do in the future.

#12 Refactoring User Name Part 3

In the final part of this series you will see how to refactor your tests. Keeping tests clean is important because it will make testing easier to do in the future.

Michael Buffington and Stikkit – Ruby on Rails Podcast

The serial entrepreneur
talks about his latest startup.
Also mentioned:

Michael Buffington and Stikkit – Ruby on Rails Podcast

The serial entrepreneur
talks about his latest startup.
Also mentioned:

RailsLogVisualizer meets Apollo.

20070328RailsLogVisualizerLogo.gifIt’s not complete yet, but for the curious out there, here is a first and “ruff” version of the RailsLogVisualizer as a pure Apollo application. The previous version was an OSX application that was embedding a Ruby http server that was used to load the Rails log files, as a Flex application didn’t provide a mean to load files directly. Here comes Apollo and lifts that restriction. So I thought…let’s try to rewrite the file loading in Actionscript. Well this is my first attempt, during the port I broke a couple of features that will need more attention in the future. Also I haven’t tried to load any file bigger than 40Mb. And I haven’t implemeted the incremental loading of large files that I had with the Ruby version. Also the keyboard navigation isn’t working…so just use the mouse for now. That’s the next thing I’ll need to fix. Let me know what you find at daniel@onrails.org or just add some comments on this entry.

Things that broke during the port:

  • Hourly breakdown of daily request.
  • Breakdown ofHttp methods (Get, post, delete, head).

Things I’ll need to add next:

  • Improve progress indicator during file load and data parsing.
  • Refactor interaction to allow keyboard support (basically rewrite using Cairngorm).
  • Improve the File Browser.
  • Support for RESTFull controllers (detect method parameters (i.e. ?method=put)).
  • Add chart of action over time.

How to install:

1) If you haven’t yet downloaded the Apollo Runtime, get it here: Apollo runtime (8Mb).

2) Download the Rails Log Visualizer:
RailsLogVisualizer0.4.air (480Kb) (right click and ‘Download Linked File’). On a side note don’t click directly as the mime type on this server for .air files is not yet set. For more info see Mike Chambers entry on the subject.

3) Follow the installation steps that Apollo provides. It’s a little strange at first as they have a custom installer.

#11 Refactoring User Name Part 2

Testing and refactoring go hand in hand. Refactoring is all about improving code without changing its behavior. Testing is all about making sure you don’t change the behavior while you are improving the code.

#11 Refactoring User Name Part 2

Testing and refactoring go hand in hand. Refactoring is all about improving code without changing its behavior. Testing is all about making sure you don’t change the behavior while you are improving the code.

#10 Refactoring User Name Part 1

Learn how to clean up your code through refactoring. This episode will show you how to move code from the view into the model to remove duplication and simplify the view.

#10 Refactoring User Name Part 1

Learn how to clean up your code through refactoring. This episode will show you how to move code from the view into the model to remove duplication and simplify the view.

Apple TV on my TV

I picked up my Apple TV today from Fedex since I wasn’t expecting the delivery a day early.  It is quite a good looking device, both physically and what it puts on the screen.  The little remote might bother me a little as I’ve come to expect more from remotes since I got my Logitech Harmony remote.  I wonder if Apple has included discrete codes in the device, so I can setup a macro on my remote that will turn on my receiver and start shuffling through my music.  I don’t want to have to turn on my TV every time I want to listen to music.

Anyway, time to play with it will have to wait since the Sweet 16 is on.

Update: Well, 2 things I was hoping to do with the Apple TV don’t seem possible.  I wanted to be able to control my music playing on the Apple TV from my laptop from anywhere in the house.  The 2 ways I was thinking that would work would be by having it show up as remote speakers in iTunes for playing my local iTunes stuff, a la AirTunes, or by actually selecting the media that are on the Apple TV from the iTunes devices interface.  Neither of these work.  Is this a deal-breaker for me?  I’m not sure yet, but playing music through my stereo without the TV on was one of the things I was expecting from the Apple TV.

Update 2: So far I’ve mainly been using it for listening to music and it sounds fine, I just shut the TV off once the music starts. I don’t think it sounds better than my Archos Recorder v1 from 2002 running Rockbox through S/PDIF, but the UI is nicer looking. The only video I’ve watched so far was from The Merlin Show in hi-res, and it looked ok, better than SD but not as good as HD. I was able to hook up my Harmony remote to work reasonably well, but still discrete codes for playlists or something would make things better. These instructions helped get things setup with the remote. The slide shows are nice and look great, I think they are my wife’s favorite feature so far.

#9 Filtering Sensitive Logs

Are you accepting sensitive user data? Passwords, credit card numbers, etc. By default, Rails stores all submitted parameters in plain text in the logs. This episode will show you how to filter this sensitive input so it doesn’t show up in the log file.

#9 Filtering Sensitive Logs

Are you accepting sensitive user data? Passwords, credit card numbers, etc. By default, Rails stores all submitted parameters in plain text in the logs. This episode will show you how to filter this sensitive input so it doesn’t show up in the log file.

Searchcoders.com – the fastest way to search the Flexcoders group.

Tom and Robert just announced that Searchcoders.com went live. I had the chance to have met Tom and Robert at the 360flex conference and they gave me access to the beta of searchcoders.com. I have used google, the yahoo groups and several other means before to search through all the messages of the flexcoders group, and searchcoders.com just works the best for me. This group just has so much great content and is the fastest way to solve many of the issues you may
encounter once you start pushing what Flex has to offer. Thank to the community of sharing all this info and thanks to Searchcoders to make it more valuable and more accessible.

#8 Layouts and content_for

If you want to change something in the layout on a per-template basis, content_for is your answer! This allows templates to specify view code that can be placed anywhere in a layout.

#8 Layouts and content_for

If you want to change something in the layout on a per-template basis, content_for is your answer! This allows templates to specify view code that can be placed anywhere in a layout.

#7 All About Layouts

Everything you wanted to know about layouts: global layouts, controller layouts, shared layouts, dynamic layouts and action layouts. Yes, there really are that many ways to specify a layout.

#7 All About Layouts

Everything you wanted to know about layouts: global layouts, controller layouts, shared layouts, dynamic layouts and action layouts. Yes, there really are that many ways to specify a layout.

Dan Webb – Ruby on Rails Podcast

The stylishly sneakered leading proponent of unobtrusive Javascript gives advice about Rails freelancing and standards-based website development.
Also mentioned:

Dan Webb – Ruby on Rails Podcast

The stylishly sneakered leading proponent of unobtrusive Javascript gives advice about Rails freelancing and standards-based website development.
Also mentioned:

Best way to reset a form using Cairngorm?

I just implemented some code that doesn’t feel quite right, but works and would like your input on the matter. A Payment Entry form will be used by the user several times in the life of a Flex application to enter different type of payments. So every time the user wants to pay, the form needs to cleared. I can see these different ways:

  1. Ask the form to clear all it’s fields

  2. Bind the fields to a model, and reset the model with the default fields values

  3. Create a new instance of the form.

It’s a rather complex form with multiple steps (tabs) and the user can quit the form at any moment. So option 1 and 2 needs to reset not only the fields but also the state of each component used on the form. Therefore I opted for approach three which goes as follows:

The view contains following code that replaces the form with a new instance:

public function clearPaymentInformation():void {
var index:Number = content.getChildIndex(enterPaymentView);
content.removeChild(enterPaymentView);
enterPaymentView = new EnterPaymentInformation()
content.addChildAt(enterPaymentView, index);
}

Now we have a PayInvoiceCommand that needs to invoke this function. That’s where what doesn’t feel right as the command has to know the view. With the newer version of Cairngorm the command gets information using a delegate, then updates the model. The view is bound to the model. But the command shouldn’t have to know the view. But for option 3 I didn’t find another way around. So I use an adapted version of the ViewLocator (as my view are not ViewHelpers) to which I register the view upon creation. Then in the command I use

WebComponentsViewLocator.getInstance().getView(“paymentView”).clearPaymentInformation();
model.paymentViewState = WebComponentsModelLocator.PAYMENT_VIEW_STATE_ENTER_PAYMENT;

Is there anyone out there that uses the same approach. If no, thats maybe a good answer that I am on the wrong track. Maybe I should issue an event from the command and have the view listen to the event. This would decouple both, but still doesn’t feel quite right. Maybe I just had a too long day. So any insight is welcome on how you deal with “reseting” forms in your Cairgorm applications. Thanks in advance.

Time for MotorStorm!