23 Jun 2011We just discovered a strange behavior on one of our test VM (one without Flash installed). I don't know how we've missed it before.
When embedding the main flash file of our application, the alternate content wasn't displayed to players. In fact it seemed to be displayed very briefly then disappear.
I had correctly embeded it with the static publishing method and added a call to swfobject.registerObject to soften the edges. I remembered it working correctly in my tests, so I quickly made a small test case.
It occurs that the alternate content was corretcly displayed if I removed the swfobject.registerObject call and only used the static publishing.
I also found that everything worked fine if I called the swfobject.js file in the head, but started to bug when I moved it at the end of the page.
As I didn't want to add a call to a .js file in my head, I google a bit and I finally found that one have to call swfobject.switchOffAutoHideShow(); right before theswfobject.registerObject call. This seems to fix things by not hiding the alternate text
Edit
I spent some more hours trying to debug the last corner cases. We had a user using Firefox 3.5.3 with Flash 10.0.42.34. Using SWFObject, we required at least version 10.1. Unfortunatly, the app was still loading, but was buggy because of features not present in the user flash version.
After some tests, I discovered that the swfobject.js code MUST be included in the <head> of the document (well, before any .swf in the page, so better put it in the <head>).
Doing so, you won't even need the previous fix (swfobject.switchOffAutoHideShow()).
I would have loved putting it at the end of the page, with the others JS files, but I guess I won't have a choice here.
22 Jun 2011This morning I started reading a lot of online blog post, framework description and other webdev material online I had in my bookmarks. After reading them, I saved them on my pinboard account to find them easily later.
Lot of good JS and CSS framework/libraries in there, I hope to be able to test them soon.
I also check my mailbox and respond to mails from my normal job. I shouldn't. I'm on a day off, I have to force myself to completly cut out those external calls.
Now, let's the work begin
Anyway, I finally finished the vimtutor. I still have a some difficulties to remember the mapping of the basic hjkl movement keys (I always want use k to move down instead of j). However, I feel confident enough in it to try writing my new code in it.
So, I headed to the Rails for Zombies tutorial. I thought it was free but the "win $5 worth of online teaching" / "next course costs $5" make me doubt it a little. Well, we'll see.
After registering to it, I wanted to save my login and password to KeePass as I always do.
Unfortunatly, KeePass on my Ubuntu machine works by using mono, and the keyboard interaction weren't that good (caret is slightly misplaced, inputs lags before getting displayed, text selection is weird). So I thought "Hey, let's see if there is a new version". Big mistake.
It appears that there was indeed a new version, a real one, with apt-get and stuff while mine was some hackish install I manually made a few month ago.
But wait, this means manually adding a ppa directory. No big deal, I trust the author. What ? Still doesn't work ? Hmm, I see. I need mono 2.6, and I only have 2.4.
What ? 2.4 is the latest available version on Ubuntu 10.10 ? You mean I must upgrade to 11.04 ? Hmm. Why not. I'll have to do it eventually, so let's go.
So I ran all my updates, to have the most up to date system. Unfortunatly, language-pack-gnome-fr doesn't want to upgrade so the OS upgrade isn't displayed.
Wait, what am I doing ?
And that's when I remember that my initial wish was to learn Ruby on Rails and that I was now on the road to upgrading my whole operating system. That is not exactly speaking procrastination, but it makes me do so much other things that my initial goal that I really looks like it.
I finally managed to purge my packets, upgrade to 10.10 and then to 11.04. But this took me 4 hours, and now it's 11PM and I guess I won't start this rails tutorial today, after all.
20 Jun 2011Last Friday, just before turning off my computer and going home, the cake project I'm working on was displaying a scary Fatal error: Class 'Controller' not found in /var/www/project/app/app_controller.php on line 5
Today, I'm getting back to work and here's what happened. After a morning of trial and error, I finally reverted back to a previous svn commit, then re- updated to the latest one and it seemed to solve the issue.
But later on the day, after another update, it started bugging again and the error message wasn't very helpful.
After much googling, this bug report gave me a hint : I had new models but didn't create the corresponding tables. Strangely, creating the missing logs table for my Log class solved the issue.
Hope this blog post will be usefull for anyone else struggling with this error message.
15 Jun 2011Here it is : my first Wednesday off. Well, not completely off because I had a technical meeting this whole morning, and my cousin dropped by in the evening so... I finally didn't have as much time reading and learning as I wanted to.
Anyway, those past weeks I started thinking about what I intended to learn, and why. The main reason is that I want to be able to build website and apps faster, with less hassle and better overall quality. And the more I thought about that, the more it became obvious that PHP was the main bottleneck.
My journey accross PHP land
I've been writing PHP for the last 12 years. I started as a script kiddy, putting things together, hacking strings, saving stuff in databases, building my own toolbox and finally making websites out of it.
Then, as I started my first job in a web development company, I started to organize stuff to be able to use and reuse code accross projects.
Later, when I started as a freelancer, I learned cakePHP, and it let me much more time to focus on each project while still reusing the common code of previous projects easily.
PHP is just so easy
I can be considered a PHP coder. I have some years of experience to consolidate that. Nevertheless, I don't consider myself "good" at PHP. I just write PHP, and that's all.
I think there isn't any flavour in writing PHP : it is so easy anyone can do it. I don't feel like I know those special stuff that can make one an "expert". PHP just feels so easy, you just write code and it works.
The only area where I can think that my years of experience can be used is in tracking PHP bug or weird error messages (If you haven't read this website, go now).
It just does not feel right to be able to say "Yeah, you should work with me. Why ? Because my strength is that I'm very good at understanding PHP bugs".
There is no "PHP Philosophy", no good practices that were kept in mind by PHP lead developers when they wrote the language and they wanted us to follow. Instead, we just have a bunch of functions, and play with it as in a sandbox.
Adding some pattern in this mess
Over the years you learn (the hard way) how to organise your code. PHP5 gives a little hope by adding more OO features. No need to get back on the namespace delimiter choice, this is one more example of the PHP weirdness we'll have to work with.
The best thing that happened to me in PHP world over those years is cakePHP. It took me quite some time to get it, having to learn the whole MVC pattern (and deal with some of cake internal inconsistencies/limitations) but the result was worth it.
A clear separation of model structure, controller logic and view rendering gave me my sanity back. I does abstract a lot of things, and makes things cleaner on the outside, you can just concentrate on writing your app code.
But even with cakePHP, you still have to write PHP.
Summing up
So, to sum up, here are my feelings about PHP
- No peculiar love for the PHP syntax and (non-)patterns
- Growing list of bugs/inconsistencies you have to work with
- Don't feel like I'm any better than any new PHP coder, no skill required
- Best thing in PHP is cakePHP, an external framework
That's why PHP is the first language I'll drop in my new learning, and I'll replace it with Ruby.
Ruby seems to fit more in my vision of a language that tells its developers what are the good and bad way of writing code. And as cakePHP is largely based upon Rails, I think catching up won't be too difficult.
Also, Rails just realease it's version 3, so now the best time to learn it from scratch.
Next week
This first day off was much shorter than I expected it to be. I wanted to start coding some Rails code, following the Rails for Zombies tutorial. I also had plans for using vim a little more.
Next week I might write about vim, or maybe how to organize javascript code, depending on the time I had.
06 Jun 2011We had a bit of an issue when launching our app a few weeks ago. Everything was working fine on our test apps, but when live, all the stream messages we posted (we call them "Sharings") had a random text appended.
Most of the time it was a generic Facebook text, but sometimes it was a creepier SQL request just displayed plain on the user feed.
The Facebook text was (for the sake of search engine goodness):
Facebook is a social utility that connects people with friends and others who work, study and live around them. People use Facebook to keep up with friends, upload an unlimited number of photos, post links and videos, and learn more about the people they meet.
As the issue only occurs in production mode and never on any of our test environments, this was pretty difficult to debug.
Here was the code used to post the Sharing :
FB.ui({
[...],
'title' : 'Title of the Sharing',
'caption' : 'Text of the Sharing'
});
As I later found out, the captionkey is not supposed to hold the Sharing text. The descriptionkey should be used for that. I'm not exactly sure was captionwas for, but it seems that if you let the descriptionkey empty, then Facebook fills it automatically with a placeholder text.
The solution simply was to put the text in the descriptiontext, and leaving the captionkey empty :
FB.ui({
'title' : 'Title of the Sharing',
'caption' : '',
'description' : 'Text of the Sharing'
});
As this behaviour is counter-intuitive, undocumented and random, I think posting it here could help other lost souls like me.