Well-written Tomcat Installation Note

This is by far one of the most well-written easy-to-follow installation/configuration notes that covers multiple platforms.


Fixing IP Conflict issue in Windows when using iPhone/iPad as hotspot


Lately my Windows machine starts complaining IP conflict when I use my iPhone or iPad as mobile hotspot, but after I disabled the IPv6 in the particular connection, the problem goes away.  Thanks Doug.

To disable IPv6

  • Go to Control Panel -> Network and Sharing Center
  • Click on “Change adapter settings” on the left
  • Look for the connection that is relevant to the iPhone connection, double click on it
  • Click Properties
  • Uncheck the item “Internet Protocol Version 6 (TCP/IPv6)
  • OK all the way out, and enjoy the IP conflict free environment again.

Mass Rename Files in Mac

for i in *.yourfiles; do mv "$i" "`echo $i | sed 's/old/new/g'`"; done 

To make the above script more usable, for create a little script in ~/bin named rename, in the script, use the following:

#!/usr/bin/env zsh
for i in $@; do mv $i `echo "$i" | sed $SUBSEXPR`; done

Then in the future, rename files with the following usage:

rename 's/old/new/' *.files

Inspired from: http://superuser.com/questions/152627/renaming-many-files-in-mac-os-x-batch-processing

Illustrator Time Saver Tip: Paste Remembers Layers

I always love organizing my Illustrator design with layers and symbols, with the right hierarchy of layering, I can easily move or transform any groups of art.  One thing keeps baffling me is that every time I copy and paste layers of art, Illustrator would flatten all the layers.  This is like removing all the folders and shelves which help neatly partition the papers.

It was not until today I came to realized that Illustrator does provide an option to retain the layers, the option is named “Paste Remembers Layers”.  It can be activated through clicking on the option menu of the Layer panel.

I wonder if Adobe has any reason not turning this option on by default, but in case anyone from Adobe cares, please … this saves time and lives.


Update:  There is one major drawback of the “Paste Remembers Layers” option – any paste executed would be pasted as top-level layer.  In other words, if one wishes to paste a set of layers inside another layer, one would have to paste and then move the newly-pasted top-level layers into the desired layer.  Rats.


Greyed out files in Mac OS/X

I have long been baffled by a particular external hard drive of mine which consist a few random files which are greyed out.  I cannot see any abnormality via File Info in Mac or Windows, and most Google search returned solutions that don’t work at all.  Worst of all, if I try to “hack” it by moving the file to another location, I end up losing the file entirely!

Finally, a little digging in “Terminal” using ls -la command, I discovered those greyed out files having an attribute of -rwxrwxrwx@, ah ha, the “@” might be all the culprit.  Eventually I found out that stands for extended properties.  And to view the extended properties, I just need to use xattr -l filename command.  In my case, the greyed out files all have this weird com.apple.FinderInfo attribute.  To remove that attribute, I run xattr -d com.apple.FinderInfo filename, and the file is back to normal!

Infographics and Visualization for people who “give a damn” from Good

Good.is, not to be confused with other “Good”, has collected a lot of good infographics over time. Some of them are interactive with a data backend, but more are pre-drawn visualizations. No matter how they are technically or artistically prepared, lots of inspirations can be drawn from them as they tell a better story than just a pie chart or d3js chart alone.


Robotlegs, Mediator and PopupManager

Recently I have shifted my framework of preference from Cairngorm to Robotlegs. Cairngorm has been my choice of framework mainly because it has a large user-base support, so I can point developers to learn the framework on their own. Cairngorm has its limitation, and the one gives me the most heartburn is singleton model, which makes the code difficult to write unit test for.

Just a few hours of reading this awesome book ActionScript Developer’s guide to Robotlegs, I am sold. Within a short time, I am able to rewire up a Cairngorm-based applications into Robotleg’s fashion. Mediator in Robotlegs is an awesome designer. Without Mediator, my control’s container would have to know how to pass data and events back and forth. It gets cumbersome when there are layers of containers. Mediator mapping relies on listening the control’s ADDED_TO_STAGE event, then maps the control to the mediator class. However, the event listening is done on the context root of the Robotleg’s configuration. In a Flex application, typically the context root is set to the Application itself like the following


		<context:TabletApplicationContext contextView="{this}" />


This works great in most cases because all the controls are usually added to the display tree of the Application, therefore the context is able to capture the control added event. However, when a control is introduced by PopupManager or Callout component, the control is not added to the application but application’s parent, therefore the event is not captured by the context.

There has been discussions and samples to work around this problem. The solutions most discussed would use “Command” to perform the Popup instead of the component itself. This gives me a heartburn because Command is NOT supposed to interfere with UI implementation.

The Solution
Since the cause of the issue is the context is not able see the popup added simply because the popup is added outside the contextView, my solution is to find out what that “outsider” is. A quick dig around of PopupManager’s implementation I found out it uses application’s systemManager as the place to add the popup control. So I quickly implemented the solution below:

	<context:TabletApplicationContext contextView="{DisplayObjectContainer(this.systemManager)}" />

But it does not work as somehow the context is not instantiated. That’s when the contextView is assigned, the systemManager is not added to the stage and the application is not ready. That’s not too obvious, but we can always delay the contextView assignment until the application’s creationComplete event is fired. So I modify my application as follows:

<s:Application creationComplete="initContext();" 

		<context:TabletApplicationContext id="context" />

			private function initContext():void
				//Use systemManager as contextView so popups instantiated by PopupManager would be wired up properly
				var contextView:DisplayObjectContainer = systemManager as DisplayObjectContainer;
				context.contextView = contextView;


Since then, the mediator is happily working with the popup control ever after!

Robotlegs 2
I read in the forum posts that the upcoming Robotlegs 2 is supposed to alleviated this pain. I will follow up with a post once I get RL2 and popup working with my new application.


Get every new post delivered to your Inbox.

Join 390 other followers