Beauty’s where you find it
26 May
Quite often I find myself overwhelmed by the amount of news I try to consume on a daily basis. Often the result, unfortunately, is that my brain shuts down to some extent and I find it hard to prioritize the things I really want to investigate. For example, ever since the January 2008 edition of PHP | Architect, in which there was an article about The Doctrine Framework, I have been trying to find the time to dig in. On the way into work today I made the decision that, on a weekly basis, I would begin investigating things that interest me. This week of course is devoted to Doctrine.
What is Doctrine? According to the website:
Doctrine is a PHP ORM (object relational mapper) for PHP 5.2.3+ that sits on top of a powerful PHP DBAL (database abstraction layer). One of its key features is the ability to optionally write database queries in an OO (object oriented) SQL-dialect called DQL inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains a maximum of flexibility without requiring needless code duplication.
Ok, sounds good to me. Let’s get started. (more…)
19 May
I’ve been trying for at least a month to make my Netvibes OPML file publicly available, and finally this morning I was successful. So, if you are at all interested in the feeds that I am interested in, you can visit my Netvibes public page.
http://www.netvibes.com/leveille
One of the first things I do in the morning and last things I do at night is run through my feed list to see if there is anything interesting. If your feedlist is publicly available in one form or another, I would love to see what interests you. Feel free to share.
14 May
I have used http_build_query numerous times in the past and I’ve never had to pay attention to the third parameter before: arg_separator. I am making use of a great Curl wrapper to abstract some of the more mundane setup tasks associated with a Curl request. Initially I had constructed the setup of CURLOPT_POSTFIELDS as follows:
$url = 'http://rest-toolkit/api/users/5';
$response = $curl->post($url,
$vars = array(
'username' => 'baz',
'password' => 'bar'
)
);
...
curl_setopt($handle,
CURLOPT_POSTFIELDS,
http_build_query($vars)
);
Upon receiving the request, my script was showing $_POST variables as follows:
Array
(
[username] => baz
[amp;password] => bar
)
Thanks to a comment on the http_build_query page regarding the use of the third parameter, I quickly realized that my php.ini setting for arg_separator.output was in fact set to &. The quick fix:
curl_setopt($handle,
CURLOPT_POSTFIELDS,
http_build_query($vars, '', '&')
);
And the result:
Array
(
[username] => baz
[password] => bar
)
7 May
I just finished a great Digital Web Magazine article about improving page load times with lazy loading techniques. The article (by Jakob Heuser) was very well written and described proximity, timeout, and event based lazy loading. If you continue to read you will see how I was able to reduce page load by 300+kb by implementing lazy loading.
Lazy loading, described by Martin Fowler in “Patterns of Enterprise Application Architecture”, is the process by which an object isn’t loaded with data until it is needed. Of course “needed” is subjective to the needs of your application (for example needed in proximity or based on an event). In the context of this article, Jakob Heuser was really talking about lazy loading JavaScript files when they are needed, as opposed to loading them on page load. The loading of the files happens via XHR (therefore the request is subject to the browser same origin policy). He provides examples of Gaia Online and Zimbra who both reduced their page load by 200k+ after implementing lazy loading techniques. (more…)
5 May
Quick install guide for Aptana on Ubuntu 8.04. Modeled after the Installing Aptana Studio on Debian guide found at the Aptana page for Installing Aptana on Linux. The issue with the guide provided by Aptana (at least for Ubuntu) is that Ubuntu comes with FF 3 Beta 5 (as of the time of this writing) by default. Aptana doesn’t play nicely with FF 3 Beta 5, and after what appears to be a successful install, spits back an “embedded browser not available” error. Note: you don’t have to worry about uninstalling FF 3! (more…)
5 May
This morning I got into work early (6:30am, which is early for me) and decided to add the ability to define special methods to Rest Toolkit (original blog entry). “Special” in this case means adding the ability to call specific methods which allow special processing for a resource. (more…)
2 May
I spend most of my time in PHP and JavaScript. Just the way I like it. 6 months ago I refactored a .net application from a codebase which originated in India. I’ve seen a lot of good code come from India, but this was some Ravioli code. Ultimately the client ended up happy, but I found myself cursing .net 4 days out of my 5 day workweek. Today I was asked to provide password reset functionality to a portion of the application. Because we made the decision early on to use ASP.NET 2.0’s membership service, adding the feature was as easy as dragging and dropping a PasswordRecovery login control. In a business where so much of developing an application is maintenance, this was really nice. There are a lot of things I don’t like about .net, but I thought this one deserved some accolades.
1 May
I recently finished my first CakePHP application. Not only was the application the largest I have ever written, but I had never worked with CakePHP before. So, needless to say, not only did I have to overcome a learning curve, but I had to deal with all that comes with writing a large application. Today I was contacted by the project manager regarding a bug which had surfaced in the application. In my quest to squash the bug I discovered a script which was causing a section of the administrator to act very sluggish. In examining exactly what was going on, I realized that there were 200+ calls being made to the database. Ok. That’s bad. I’d like to clarify that I was the one who wrote the original offending code. In about 2 minutes of work I was able to bring the query count down to 2, and reduce the page response time considerably. (more…)
1 May
I have taken some time to refactor my original implementation of Depth First Search and Iterative Deepening in JavaScript. Namely, I removed any dependencies on the ExtJS JavaScript library, and added dependencies to the jQuery library. The advantage here is that the combined size of the files is now < 60k, whereas the original implementation was needlessly around 500k.
Recent Comments