Archive for May, 2010
Railscasts Silverlight video player
May 31st
This is my second shot to create a better player for Railcasts. As you can see, it goes better and better. Who knows what might be next?
- How and why I choose the Silverlight platform
- How to integrate your Silverlight content with your WordPress blog (and presumable all blog systems who allow you to add JavaScript)
Create a simple HTML .MOV player
May 26th
As a Ruby developer, I work quite a lot with their “special” plugins called gems. The nice fact about the gems is that they bring lots of functionality. By example, there’s a gem for paginating a collection who takes just few parameters and not only that finds out how many objects the collection has, but also how to split them, generating the corresponding links and serving to the original container (that used to show the entire collection) only the collection part that is representative in the context of current page and items per page.
Before someone new to a specific gem starts thinking to implement it, usually searches on the net for examples. The most important gems are described and exemplified in Railscasts.com. The content is excelent, the quality is good, sound is nice but the format chosen for movies is Apple’s .MOV proprietary format. There are few plugins to install for playing the files with MediaPlayer, but frankly I wanted a quicker solution than go on some obscure websites and getting from there a creepy .exe installer.
So I’ve created a simple .mov player that will replace the 33 MB of useless QuickTime Player (if you’re a Mac user, you have already this installed so you’ll not need my hack).
So let’s see some code!
First, I decided to use the Object method in order to play mov files. Apple provides a .cab file, who is able to play this files in browser. More documentation on its parameters you can find in their Embedding tutorial.
Don’t forget to add a link to JQuery library!
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
The html code is shown below and it is pretty straight forward:
<body>
<div class="media">
<div class="navigationTabs">
<input type="text" id="txtURL" style="width:75%"/>
<input type="button" id="btnPlayMov" value="Play"/>
<input type="button" id="btnClearMov" value="Clear"/>
</div>
<div id="divPlayer">
http://media.railscasts.com/videos/188_declarative_authorization.mov
</div>
</div>
</body>
The JavaScript is a little bit trickier as it involves JQuery. For a newbie, it is pretty hard to debug, but after a while you’ll just feel it:
$(function() {
// bind an onClick event for this second Flash container
$("#btnPlayMov").click(function() {
var _height = "306px";
var _width = "400px";
var _movie = $('#txtURL').val();
var _html = '';
$("#divPlayer").html(_html);
});
$("#btnClearMov").click(function() {
$("#divPlayer").html("http://media.railscasts.com/videos/188_declarative_authorization.mov");
})
})
Not to mention that it works in all major browsers (IE 8, FireFox 3.6 and Chrome) !
How to add ui-icons to JQuery tabs
May 25th
While working in UniBonn, I have a lot of contact with Ruby on Rails and JQuery; I actually started loving its interactivity and stability. But lately I encountered a small situation with the tabs object that they offer.
This is their default view, with Redmond theme applied. Nice and clean, you might say. But what’s missing? These tabs don’t support images. So you’ll not be able to show an image to specify, let’s say, that this tab has some updated information or a warning that something important is inside that tab.
I wanted to have some kind of control on specifying how the tab should look when I wanted my users to understand that something important is inside and requires their immediate attention.
As I searched through the website, I found the mentions of how to change the tab looks into an “error” style, so that it will attract attention no matter how tired the users are. In the Theming area of JQuery UI website, I found the help for Layout Helpers. Basically, you can specify additional classes who can override the theming of an element. Under Interaction cues, you’ll find all you need to set your elements style to highlighting, error, disable etc.
1 month since LASIK
May 16th
So it’s been now 1 month since I had my LASIK surgery. In this month I had a very strict program with my drops provided by EyeStar center. I used them as prescribed. I believe that my eyes didn’t need so much artificial tears, but if the doctor says it is important you have to take them!
During my reading of the file that I received from Eyestar I noticed that they prohibit very clear to rub your eyes because the flap might move. But nowhere is mentioned how you realize that the flap actually moved. After discussing with Mr. Fred, Foreign patient coordinator, I found out that if the flap is moved, your vision decreases very much, so it would be like you need glasses again.
Everything is ok, I can see very well. I found out that there are few self-testing eye charts to measure your vision. You just have to print the PDF files and you can see for your self how well you actually see. But be careful: none of this will replace professional help! So if you feel that something’s wrong, you should see a doctor right away.
The eye check files are suitable for printing on letter sized paper:
During this month I had some small issues – few times, under my upper eye lid, I felt like some dust accumulated there, but they passed after one day.
Things that I was careful about (it might seem crazy for you, but imagine that these are your ONLY eyes):
- I was careful not to go out in winds or stay in the face of an air conditioner.
- When I went out in crowded places, I always wear my Uvex i-vo protective glasses so even if someone is not very careful and hits me by mistake, my flap won’t move.
- Took my medicine as prescribed
- Worked fewer hours per day in front of the computer
- Had 5 minutes break at each 55 minutes of work at computer
- I’ve avoided as much as possible dusty areas, barbecues, bars who allow smoking inside
This is my personal experience. Looking back, I am sorry only that I didn’t do this simple operation earlier.
"Windows Live Writer" won’t upload images to WordPress
May 15th
I’ve used WordPress for almost two years now and today I faced a big challenge: I couldn’t post my articles who contained images to Word press with my Windows LiveWriter application.
Note: This comes after a long period in which I didn’t upgrade the plugins of my WordPress application ( I had 11 of them pending upgrade). Also, I had a full system reinstall (you know, the one with formatting the system drive). After that, I reinstalled and configured all my tools, starting with Visual Studio and ending with Paint .Net.
Because I had a lot of stuff to write, in the first free moment that I had a little time, I started my Live Writer and configured it to be able to post on my blog. When finishing the article, I tried to post it as a draft to www.radupoenaru.com and check if there’s something to be modified.
And when I hit the button that saves draft on my blog, bang! -I got this error:
Windows Phone 7 Coding Camp
May 12th
Just joined Microsoft Students Partners for few days, and me and my colleagues in Team West were invited to a Code Camp for learn developing for Windows 7 Phone with XNA. The camp was established in the castle, in Freusburg. We traveled from Köln after my RIA Business Applications presentation in the Springboard conference.
This special event joined together five very known and respected Microsoft Evangelists: Frank Fischer, Oliver Scheer, Frank Prengel, Tom Wendel and Jan Schenk. They are experts and known figures in programming world, with expertise in Windows Phone 7, Silverlight and XNA.
In the landscape of the castle, with Towers and defensive walls, we’ve been Knights .. of Code, of course (in German is Code Ritter). The organization was purely German: perfect! We had a lot of fun, lots of presentations and access to the knowledge gathered along the years of all five Evangelists.
In the first evening (who was right our Team West own event), we had the Microsoft Phone introduction by Frank Prengel (also known as Dr. Mobile) , XNA presentation by Tom Wendel (The Ant Man) and Silverlight presentation by Oliver Scheer, known as “Mr. deep zoom”. After all presentation, a collective brainstorming revealed around 30(!) ideas for implementing next day, who were judged from usability, possibility of creation and interesting points of view by our 5 Evangelists. Finally, we created teams based on the projects appealing to us. We followed our instincts and smell the code inside each application promise.