And here’s another video embed test…
Using JQuery to access Vimeo’s Moogaloop Javascript API
It took me quite a bit of time to figure out how to exactly access Vimeo’s Moogaloop Javascript API using JQuery. I thought I’d write it down in case others would run into the same problem. In short: first embed the player as described on the Vimeo page. To be sure that you will be referencing the right object, give the “object” element a unique id, e.g. “player1″.
Once you have done this, you can grab the API handle with the following JQuery statement:
var api = $("#player1 embed").get(0)
You can now call all the functions you like, e.g.:
api.api_play(); api.api_pause();
Hope this saves someone out there some time!
Waiting for JQuery animations to finish in Cucumber/Capybara+Selenium specs
I have been diving deeply into BDD and TDD while coding my new startup in Rails 3. One thing I ran into is that I use quite a bit of Javascript and especially JQuery animations to enhance usability. However, this can quickly become a problem for executing Cucumber scenario’s using Capybara and Selenium. For some scenario’s I simply needed to wait for the JQuery animations to finish before I could continue. With some help of Marek Sebera I found that the solution.
In the specs I include the following line:
... And I wait until all animations have finished ...
And in my web_steps.rb I have the following code behind it:
When /^I wait until all animations have finished$/ do
wait_until do
page.evaluate_script('$(":animated").length') == 0
end
end
Works like a charm!
Web pages (specifically Google Maps) won’t load on Mac OS X
I’ve been really happy with my iMac since I bought it 10 months ago, but one thing has been bothering immensely: the fact that periodically any browser under Mac OS X (Snow Leopard) would stop loading web pages and would just hang forever on trying to load all items on a page. In Google maps this was even happening almost always. And it drove me mad. Especially, since it was hard to find anyone with the same problem, let alone a solution. Until I found this thread. I thought I’d share the solution with you…
What it comes down to is that apparently Mac OS X and “Stateful Package inspection (SPI)” or “Deep Package inspection (DPI)” on my router’s firewall did not play nice together. The simple solution to this was to turn the option “SPI and Anti-DoS firewall protection” off. However, it is a bit of a shame to turn off this enhanced feature entirely. The other option is to change the value of the criterium called “Maximum incomplete TCP/UDP sessions number from same host”. In my case this was set to 10. In the thread mentioned above a value of 20 was proposed. I set it to 30 (just to be sure
) and sure enough: Google Maps worked instantly and very fast! I have yet to verify that the periodic refusals to load webpages have gone away as well, but so far I’m really hopeful!
Kanban, pull and the need for backward story boards
Introduction
Last week I attended a meetup of Agile Holland, which was all about Kanban-style software development. An interesting presentation about the application of Kanban at a large Dutch insurance company got me thinking about the way they interpreted and visualized the concept of “pull” in their story boards. It has lead me to believe that the correct visualization of pull actually requires us to depict our story boards backward.
Kanban
Kanban is a Japanese word that is used in lean manufacturing to represent a signaling card. These are cards that are used in lean production systems, that indicate the need for an item. E.g. a customers buys the last monitor X from a store. The salesman takes the monitor from the stockroom and puts a Kanban in its place. This card is then picked up by the replenisher, who starts the ordering process for a new monitor at the central warehouse. The central warehouse delivers one or more new monitors X and if its own stock runs out, Kanbans are used to signal that and trigger the process to the manufacturer, etc. The whole idea behind this mechanism, is that items are only moved and produced, when there is actual demand for them in the supply chain. This creates a “pull” mechanism, instead of traditional “push” mechanism, which mass production is known for.
Software development and story boards
In software development, traditionally, a lot of features are thought up in the beginning of the process and are pushed in bulk into the software development process. The most extreme form of this is the waterfall software development approach. Luckily, agile principles have lead to much better software development life cycles, like Scrum. In Scrum, story boards, like the one depicted below, are used to track progress of individual items (features or user stories). Items move from left to right when they are being worked on. But there is actually nothing really stopping a Scrum team from moving the items in bulk from left to right, which is often considered to be a “push” mechanism.
I say “often”, because the essence of this post is that it actually isn’t a “push” mechanism. But before I go into that, let me talk a little more about last week’s presentation. They presented an enhanced version of their story board: Kanban-style. The core idea is that you want to limit the team’s freedom to push everything through the process in bulk, but instead focus on creating flow, by limiting the number of items that can be simultaneously in one phase of the process, e.g. like so:
This story board restricts the number of items allowed in the “planned” phase to 6 and in the “in progress” phase to 3. Now, only when one of the three items move from “in progress” to “done”, is a team member allowed to move one of the “planned” items to “in progress” and start working on it. If that means that a team member finds himself stuck because he can’t start working on a new item, he is forced to help other team members to get items to “done”. This focuses the whole team on getting things done.
The visualization problem
The problem I found in last week’s presentation was with the visualization of “pull” in the story board picture (side note: the actual story board presented had a few more phases, but that does not matter for this argument). Here’s the arrow that they drew to show how pull works:
It was argued that a freed up space in one phase on the right side leads to the pull of an item from the phase to its left. This then leads to an overall pull from right to left. But if you go back to the parallel of lean manufacturing, then this is not the actual pull that this at the core of this process. The actual core pull is established by the fact that the development process is only triggered by customer feature requests instead of internal assumptions about what the customer needs. Note that this is also the core idea behind Scrum, and therefore a Scrum story board represents a pull system as much as a Kanban story board.
Now, for almost all readers in the western world, push is most naturally depicted as something moving from left to right. Thus pull feels like it should be originated from the right side of a picture. In that case, the visualization of a pull-based software development process would actually need to look like this:
So for software development professionals in the western world, I would argue that Kanban-style story boards would benefit from a backward visualization, if the characteristic of pull is to be emphasized explicitly.
Mac OS X Home/End keybindings in Terminal
I recently got an extended keyboard for my Mac (running Mac OS X 10.6, Snow Leopard). I just couldn’t do without the home, end, pgup and pgdown keys. It was fairly easy to find how to correctly bind these keys in all apps. But in the bash Terminal window is was not so straight forward. All the posts I could find suggested to open the Terminal>Preferences>Settings>Keyboard and set the the following bindings:
- home \033[1~
- end \033[4~
However, these don’t work in the bash shell. Fortunately, after searching yet a bit more, I found the once that do:
- home \033OH
- end \033OF
Wake up media server on when client resumes from standby
Introduction
A little bit more about my pet project: my media server and client (home theater) pc. One thing I struggled with the last couple of days was how I could wake my media server (running Windows XP) out of its standby sleep when I manually wake up a client pc (running Windows Vista). After all, all media is on the server, so there’s not much use in starting up the client if the server is still in a deep sleep.
Wake on lan
Waking up the server is a rather trivial task. The server motherboard supports “wake on lan”, so all I have to do is send a “wake up” signal to the server’s network card. There are several simple command line programs out there that can send that signal, like the one on Depicus and the one on Matcode. The latter program is the simplest and it works beautifully when you start it directly from your client pc.
Timing it
Now the trick is in timing the “wake on lan” right. There are several programs that allow you to run a program when a machine resumes. MP Standby Handler seemed to fit the bill perfectly. But it didn’t work! Well, it did: the log showed that the “wake on lan” program was executed, but the server did not wake up. So I tried a bunch of other programs I could find, but none of them worked. Aaarrrggghhh!!!
Good old Windows task scheduler
Then I found this post by Pixelated suggesting to use the Windows Task Scheduler. I never really paid attention to the Vista task scheduler, but I found that it is a far more advanced scheduler than the XP one. Pixelated suggested to add a task that would be triggered by a system event that fires when the machine resumes. This is the event with source Microsoft-Windows-Power-Troubleshooter and an event ID of 1. So I tried that. The program ran, but still the server didn’t wake up. I inspected the system event logs and I noticed the tcpip events in the same log at a later time. It then occurred to me: the network isn’t ready right after the resume event! I did have a feeling that might be a problem, so I tried to account for that in my experiments with MP Standby Handler, by adding a 10 second delay to the “wake on lan” execution after the resume event. But from the system logs I found that 10 seconds was too short. It takes my machine 19 seconds to re-establish its network connection. Even with a fixed IP address and a gigabit network. So I added a 25 second delay to the task execution and sure enough: everything worked like a charm. The server would wake up 25 seconds after the client woke up.
Of course, 25 seconds is a bit of an arbitrary broad margin and an awkward construction: will it always take less than 25 seconds for the network to become available? Why not just send the “wake on lan” signal immediately after the network connection is established? Easy enough: all I had to do was change the task trigger to work on a system event from source tcpip with event ID 4201. I tested it and… it didn’t work! Apparently sending the “wake on lan” signal immediately on this event was a tad too soon. Adding a 1 second delay solved it all!
Conclusion
So there you go: you want to wake up a network device when your Vista (and presumable Windows 7) machine resumes from standby? Send a “wake on lan” signal to the device using the task scheduler, where the task is triggered 1 second after the system event from source tcpip with event ID 4201 occurs.
I’m so glad this works now!
So it was time!
Time to migrate my http://thinkarchitecture.blogspot.com to my own domain. What took me so long? Well… the hassle of setting this stuff up, I guess. It’s like those creaking doors at the carpenter’s home.
Anyway, I’m gonna update this slowly in the near future. Meanwhile, feel free to drop me a line or follow me on Twitter @plindelauf.
That’s it! I’m going practical with my mediaserver
I’ve been wanting to get a media- and backup server in place for quite some time now. So I finally decided to buy all components for a low-power, high capacity server: AMD Athlon X2 240, MSI 760GTM-P33, 3x Western Digital Caviar Green 1.5TB data drives, 1x Western Digital Caviar Green 640GB system drives, etc. All that for the following primary needs:
- to store all my media and other backups safely (=redundant)
- to it as a TV server, based on my FloppyDTV DVB-C card (with firewire connection)
Deciding on the setup
Redundant storage
Ok. Problem 1: redundant storage. Well, this cries out for RAID: automatic redundancy, setup once, run forever. RAID-1 would be an option, but it’s a bit of wasted space, if you have RAID-5. And I don’t need blazing fast file access, since the network will always be the bottleneck in my setup. RAID-5 it is then.
Now we have 2 options: hardware of software RAID. The problem with hardware RAID is that the RAID controller is your single-point-of-failure. If that fails, you can say bye bye to your data, no matter how much redundancy you baked in. So software RAID is my tool of choice. Also from a price point of view. And again: I don’t care for the slower disk access.
What runs software RAID? Well, Linux-like systems do through mdadm. Windows Server does too. And you can hack Windows XP to do so, but I’m not to comfortable with using undocument features for this. So Windows Server or Linux it is. Great! On to the next requirement.
TV Server
I’ve been using MediaPortal on Windows of a while on a stand-alone pc. Great software, but not overly stable. This I large contribute to Windows Vista. So the thought of moving over to Linux with XBMC is very compelling. But, granted, MediaPortal has a very easy to setup TV Server, so that is a good option. What is there on the Linux side? In short: MythTV, VDR and TvHeadend. Enough choice. But I decided to try the MediaPortal route first anyway, since that would keep me in the Windows realm and I wasn’t all that proficient in Linux.
Getting going
Experiment 1: Windows Server 2003
So, the MediaPortal route = Windows. Software RAID5 = Server. So the choice was Windows Server. 2003, to be exact, since I still had a license lying around. I installed everything and then the first test: would the Windows XP drivers for my FloppyDTV card work on Windows Server 2003. Answer: no! End of experiment 1.
Experiment 2: Ubuntu
So, experiment 1 killed the Windows route for that moment. On to the next experiment: Ubuntu with –what seemed to me the most mature TV server option- MythTV. So I installed MythBuntu 9.10. Quite smooth. Got RAID5 setup with some trouble, since one of my new drives appeared to be defective. That caused some headaches, but in the end, all ran well. So… the redundant storage part was filled in nicely. Now for the TV server…
I started configuring the MythTV backend and… boy oh boy… exactly 1 channel was working out of the box. Well… it did show up double on my screen. All other channels I got a “partial lock” message and no video whatsoever. Furthermore, the channel switching was terribly slow. It was actually quite clear: MythTV wasn’t going to cut it for me.
So what other options are there? VDR is proclaimed to be a good option. But I challenge you to try to find decent documentation for that! Probably the best source is years worth of forum posts on the German (!) VDR forum. Not my idea of fun. Really: I have better things to do than to guess how to configure all parameters by reading endless forum posts. And then the VDR website only lists VDR 1.6.0, whereas I found that the actual developers were already up to 1.7.9. What’s up? This was simply too painful an experience, and I wasn’t hopeful I was going to be happy with the whole solution if I’d get it running, given the partial integration with XBMC. End of VDR.
Soooo… TVHeadend. What a breeze this app was at first sight. It has an actual decent user interface to configure it. And documentation too! Woohoo! How promising. Well, it’s been three nights now that I have tried to complete the scanning for TV channels. Three nights. And I still don’t have a working set of channels. Three nights. Again: not my idea of fun. And then there’s still the reports in the forum, that this is very promising, but still not really ready as a full TV server solution in combination with XBMC.
This was the point where I started to think: my time’s too valuable. Not anymore. It ends here. If I were 15, I would probably still want to go on for weeks, but I got better things to do. STOP THIS NONSENSE!
Idea 3: MediaPortal TV server in a Windows XP Pro VM on Ubuntu host
No virtual machine supports firewire. Dead-end idea.
Idea 4: Windows Pro XP host with Ubuntu VM
Interesting. Some people seem to have been happy with this construct. The linked post got lead me to find that RAID-5 has some flaws and that choosing a ZFS file system under OpenSolaris (instead of Ubuntu) and going for RAID-Z, would actually be a more robust solution.
But frankly… I don’t know. I probably want to power-up and power-down the server automatically quite a bit to save on the electric bill. And then having a host system decide for a “mission critical” guest system when that would be powering would be a good idea, doesn’t feel right and stable to me. And imagine stuff goes wrong here and the RAID-Z array gets screwed up: then everything is “RAID-Z encoded” and I can never get to my data just by accessing one drive.
And I’d have to dive into OpenSolaris again. And in the configuration tools for RAID-Z. I was already fed up with these experiments after experiment 2, so isn’t this a route that I’m going to regret pretty soon anyway? I got a feeling it is. What remains?
Final idea 5: Windows XP Pro with a soft-backup solution
Ok, so RAID-5, RAID-Z all have their own magic way with the data and if they get screwed up, all data is screwed up. Maybe just a simple mirroring isn’t a terrible idea anyway. Ok, it’s a bit wasteful, but I’d rather spend an extra € 90 on a 1,5TB drive then many more nights of administrative headache.
RAID-1 then seems cool, but I thought I’d read up a bit on the possible problems. And fairly soon, it turns out that RAID-1 can be a nasty sucker too. So forget it.
I still have a license for the SyncBackSE file-backup solution. Why not go for that? Keep it simple! Simply have one explicit data drive and one explicit mirror and have SyncBack do all the copying. I considered the Pro version for its S.M.A.R.T. monitoring facility, but DiskCheckup gives me that for free. Another benefit of a file-based mirroring mechanism, is that I can do this on partition level instead of drive level.
Here’s what I’m now thinking of doing:
- 2 x 1,5TB drives: media and other data, each being a soft mirror of one another
- 1 x 1TB partition on the 1,5TB drive: TimeMachine backup for my iMac. Not mirrored, since the iMac is essentially the mirror (yes, I know, I can loose history, but that’s not too relevant)
- 1 x 0,5TB partition on the 1,5TB drive + 1 x 0,5 TB partition on the 640GB drive: more media and data, each being a soft mirror of one another
This gets me:
- roughly the same storage space as with RAID-5: 3TB
- a non-mirrored TimeMachine backup of my iMac: not an issue
- partitions that I can always access natively, without any RAID-like magic involved
Conclusion
That is it then. I’m getting rid of Ubuntu and stuff tonight. I’m done. Back to Windows and MediaPortal it is. I’m already looking forward to spending a night without server setup headaches to worry about!



