January 15th, 2009
Even though I am an Ubuntu user (and fan) I still like to keep Windows on my machine in-case I need to test a website in IE or need to run Windows only software that does not run nicely under wine. I do not dual boot with Ubuntu and Windows, but instead I use VirtualBox which is free open source virtualization software developed by Sun Microsystems that works on all platforms.
Anyway, I started downloading Windows 7 the other day and then suddenly realized the file was 2.4gigs! So I immediately canceled because it would have meant that 1 out of our two Telkom internet accounts would have been capped half way through the download. We easily use over 10gigs a month here at home and if I downloaded Windows 7, we would have never lasted the rest of the month. I actually think it is about time I get a prepaid ADSL account…
Never-the-less, today I was presently surprised when browsing twitter to find a local download link of Windows 7. Thanks to Jason Adriaan’s awesome site called LocalList we can actually download Windows 7 on a capped Telkom account. LocalList also provides a bunch of other cool local sites which you can browse when your internet account has been capped.
Lucky for me, one of our accounts is about to be capped and so I am going to leave the download to run through the night on that account
I am using the KGet KDE download manager as I don’t trust the FireFox resume feature at all.
You can find the local South African download link to Windows 7 here.
January 14th, 2009
While dealing with files and directories in PHP you will most likely at some point want to check if a folder/directory is empty. To do this, you need to write a script that does the check. There are two ways of doing this. The first is supported in PHP 4 and 5 only and the second will only work if you are running PHP 5 on your server. Here they are:
Method 1:
This code works with PHP 4 and PHP 5.
// Open directory and create an object
// The dir() function creates the object
$directory = dir('path_to_directory');
// Loop while the read method goes through each and
// every file
while ((FALSE !== ($item = $directory->read())) && ( ! isset($directory_not_empty)))
{
// If an item is not "." and "..", then something
// exists in the directory and it is not empty
if ($item != '.' && $item != '..')
{
$directory_not_empty = TRUE;
}
}
// Close the directory
$directory->close();
Method 2:
Although the code below is a lot neater and lighter, it will only work with PHP 5.
// Scans the path for directories and if there are more than 2
// directories i.e. "." and ".." then the directory is not empty
if ( ($files = @scandir('path_to_directory') && (count($files) > 2) )
{
$directory_not_empty = TRUE;
}
And there you have it. Two simple ways of checking if a directory is empty. Let me know if you found this useful in the comment block below.
January 14th, 2009
As you probably know, I relaunched my blog on 1st of January and since then it has really started to take off. I am getting quite a decent amount of search engine traffic and the amount of direct traffic I am getting is also on the increase (which tells me people like my posts and are coming back to read more). Most importantly though, I am really enjoying blogging and am I loving the feedback I am getting.
Anyway, one of my goals (not made public) was to start writing a lot more technical/development related posts. Now, I know that may not be everyones cup of tea and it may even drive a few return visitors away from the blog but it is something I really want to start doing. I especially want to talk about some of the stuff I am currently working on and explain how I am doing it. Heck, you may be able to tell me how to do it better. That’s what I want.
What I am going to do though (to cater for visitors who are not so interested in development but are interested in technology) is supplement each development related post with a non-technical post. Those non-technical posts will be stuff like reviews, current happenings on the web, tech trends, a lot about mobile stuff and I also hope to start videocasting soon!
At the current rate, I am getting out about 2-4 blog posts a day (usually more on the weekends when I am not working). So I definitely think I will be able to manage one technical and one non-technical post a day. What do you think of this idea? What do you want to read more of?
January 14th, 2009
I have spent the whole day today dealing with files and folder structures with PHP and even though I have dealt with this quite a bit in the past, I still found that I needed to double check some of the functions on PHP.net. So I thought I would create a quick little reference guide on some of the more useful file and folder PHP functions. So, here they are:
dir(’dir_path’)
This is a very common function and what it does is open the directory you pass to it and then it returns an object which you can then use to read all the files and folders in that directory. For more info on it’s implementation check out the dir() function on PHP.net.
mkdir(’dir_path’, permission, recursive)
The mkdir() function is a simple little one which creates a directory on your server. All you do is pass it a path (make sure the parent directory is writable), set the permissions of the directory you are about to create and if you are creating multiple sub-directories, mark the recursive parameter as TRUE and it will create all the sub-directories for you. Check out the mkdir() function on PHP.net for more.
rmdir(’dir_path’)
rmdir() is similar to mkdir but instead of creating a directory, it deletes the directory. You set the path of the directory you want to remove (make sure that it is empty and the permissions are set to be able to delete the folder) and then the function does all the rest. Take a look at PHP.net to learn more about the rmdir() function.
is_dir(’dir_path’)
This function simply checks the path you give it and makes sure that it is a directory. If you pass it a file or a non-existent directory it will return false. If the path does point to a directory, the function will return true. It is a simple function, but can be very useful. You can learn more about is_dir() and its implementation on php.net.
scandir(’dir_path’)
The scandir() function was probably the one I got the most use out of. It is a very cool function which returns an array of files listed in the specified directory. It is extremely useful for checking if a folder is empty or not. If you are using PHP 4, unfortunately it wont work, it is a PHP 5 specific function. Goto the scandir() function page on PHP.net to see how to implement it.
unlink(’file_path’)
This fancy function simply deletes the file that you specify. You pass it the path of the file you want deleted and it takes care of the rest. Again, it is an extremely useful function and I use it extensively. Read more on the unlink() function on PHP.net.
is_file(’file_path’)
And last but not least on my list of useful file and folder functions is is_file(). It is exactly the same as the is_dir function, but checks if the path specified is a file or not. Visit PHP.net to learn more about the is_file() function.
January 13th, 2009
I am busy developing a WordPress plugin that will automatically update your WordPress plugins in the background without you ever having to click a button. There will be various settings and you can even select plugins that you do not want to update automatically, but anyway, that is besides the point. Because the process of updating all your out-of-date plugins generally takes quite a lot of time, I needed to develop the plugin so that it runs all those update processes in the background. There would be nothing worse than having to wait for all your plugins to update before you can write a post!
So I did my research on running PHP scripts in the background and I was surprised that there was actually quite a lot written about it on the web. It is a fairly simple task and can be done in multiple different ways. The two most common seem to be:
- Use PHP to execute the script via command line in the background using the exec() function
- Using an asynchronous HTTP request. What you do is call the script with an HTTP request and then kill the connection so that you don’t have to wait for everything to process.
I am currently leaning towards the second method but also still exploring the first. If you want a very good tutorial on how to do the above two methods, then check out this tutorial on w-shadow.com. It gives you code samples and explains quite a bit of it.
January 13th, 2009
Owning a Nokia handset for me is like being in a love/hate relationship. Firstly, the phones are almost always wonderful phones to have. They generally have fairly good features and look very sexy. However, I have yet to meet someone who has not had a problem with buggy Nokia software. It seems like everyday I hear of a friend or friend of a friend who is having troubles with their Nokia phone software.
Since getting my e71 I have been extremely pleased with it. The GPS has gotten me out of trouble many a time and web browsing is a breeze. However, there is one little bug that is annoying me to bits. My silly wallpaper keeps getting set back to the default and I keep having to reset it.
What is it with Nokia software that it is so buggy? And the weird thing is everybody I have talked to with e71’s have different types of software bugs. My girlfriends e71 is completely screwed and has to get sent back to the factory to be fixed. Everytime she presses a “,” or a “.” it doesn’t do anything. She has to press her question mark for a “.” and don’t even ask me where her question mark is. All her keys are completely messed up.
But of course it isn’t just the e71’s that are troublesome. A friend of ours had a n97 (I think it was that model) and it has been sitting in the Nokia factory for weeks because of a software bug. Heck, you would think they would just replace the damn thing.
Nokia really needs to sort their software issues out. I have owned countless other phones and have never once had an issue with any them. With that said though, I would still go to the shops tomorrow and purchase a Nokia because their phones are totally kick ass despite the software issues…
January 12th, 2009
I first took a look at Qik a little while back and ended up extremely disappointed because it did not work on my SonyEricsson k800i. The next best alternative at the time was Kyte.tv (which by the way is also pretty cool), and so I signed up for that. Then today in the office Tyler started talking about Qik and I realized that I could now install Qik because I recently upgraded to the Nokia e71. BTW Qik might even be available on the k800i now. So I downloaded and then installed it
What Is Qik And Why Is It So Cool?
At its core, Qik is basically a cell phone app which you can use to stream live video to the web. Once you have installed the app on your cell phone you hook it up with your Qik.com username and password and then you can start streaming video immediately.
Something that I really like about Qik is the fact that all my live video streams are stored on my Qik.com profile and once the streaming is finished, visitors can then go and download them in 3 different formats (.mp4, .3gp and .flv).
Qik is also perfect for something like a live QnA session. People can goto your Qik.com profile and join the live chat and ask you questions while you are streaming. Every message sent will then be displayed on your cell phone screen in real time.
I did have a few troubles with Qik on a slower connection. The audio and video did not sync well. So when streaming you should make sure that you are connected via wlan (if your phone supports a wireless lan connection) or over a 3G/HSDPA connection.
A “Quick” Qik Demo
I tried for the last 30 minutes to record a video (definitely want to do a lot of video this year) but because of the crappy lighting combined with a very slow connect tonight, I was not able to get a video of sufficient quality. You can check out some of the current videos on my stream but their quality isnt too hot either. I really need to get a faster internet connection.
I will try do a proper Qik demo tomorrow when the light is better and hopefully my connection speed is back to normal.
Where To Download Qik
You can download Qik by accessing d.qik.com on your mobile phone. I could not find a list of supported phones but I know that most Nokia video phones will work. Once you have downloaded the app you will need to create a profile at Qik.com (I actually think you might even be able to sign up directly from your cell phone).
And then, once all that is done, go ahead and follow me on my Qik.com profile. I will be sure to follow you right back.
January 11th, 2009
When setting up this blog I made the decision not to include a blogroll on the sidebar. I have had blogrolls on previous blogs of mine but I found that they always did more harm than good. Not SEO wise but relationship wise. It’s a weird thing but people take offense to you not linking back to them if they include you on their blogroll.
Now some would say, let them take offense – who cares anyway. But for me, when someone adds me to their blogroll I almost feel obliged to link back to them. Almost as a thank you. By doing this, the blogroll ends up being pages and pages long and it actually becomes worthless.
So is there an alternative to having a blogroll? Well, I have thought about it and there are two things you can add to your blog, at least one of which I plan on implementing on this blog pretty soon.
The first (which I am still not 100% sold on) is having a sidebar item which aggregates via RSS feed all the latest blog posts from your blogroll blogs, but only displays the latest 5 posts. So you can have it set to pull from 1000 feeds, but only the 5 latest posts will display on your sidebar. Thus the content in this block is constantly changing and your users get quick and easy access to posts that they might like from your “blogroll”.
The second idea which I like a lot more, is having a “Top Commenters” block on your sidebar. Thus the people who enjoy reading your blog and comment often get credited with a link back to their homepage in your sidebar. This also encourages participation via comments. There may be a downside to this though in that people start writing short and silly comments just to get a link back.
What I would do for the second idea is setup some cases in my query where firstly, it only looks at commenters in the past month. Secondly, the comments must have at least 100 characters to be given any weight. Thirdly I would give the commenters the option to leave their name and then also the name of their website or keywords they are targeting. In the comments list it will display their name and on the sidebar their keywords or website name.
I think I will look at implementing at least one of these two ideas next month. Heck, I may even do both.
January 10th, 2009
Thanks goes out to everyone who helped in the decision making (via comments and twitter) of the WordPress plugin that I am to develop this month. It was a tough decision cause all the plugins listed I think are worthy of being developed (and will be developed in time). In the end is came down to these 2 different plugins:
- Complete Monetization Plugin. This plugin would do everything you need to monetize your blog including click tracking, adding of affiliate datafeeds to posts, managing ad blocks etc etc.
- Automatic Plugin Updater. This plugin would automatically update all your plugins without the administrator having to do anything. Perhaps using a cron job or something like that.
I really could not decide between the two and so I have decided to develop both of them
I have really great ideas for both and I am really excited to get started on them. I will start with the Automatic Plugin Updater (because it is the easier of the two
) and then probably start on the Monetization plugin a little later this month. I will definitely have the Automatic Plugin Updater completed by the end of this month!
Ok, now I need to go start coding…
January 10th, 2009
I was just browsing my stats for the past week and a half since my new blog went live and noticed a very cool trend. Screen resolutions are getting bigger and bigger. Gone are the days where your website has to fit inside 768 pixels wide.
Since I have relaunched this blog, only 0.7% (yes, less than 1%) of my visitors were browsing on an 800*600 resolution. About another 0.4% browsed on a resolution lower then 800*600. The rest all had larger resolutions with the most popular being 1280*800.
Now, the interesting thing for me is for how long this trend of using larger and larger screen sizes will continue. I want to think that 800*600 resolutions will be completely dead in time but my head says they wont. Why? Because of netbooks.
Netbooks are becoming more and more popular. The 7″ EeePC has a resolution of 800*400 pixels. With the rise in popularity of netbooks, the browser sizes may even start falling. The bigger EeePC’s such as the 8.9″, 10″ and 10.2″ models have resolutions of 1024*600 which for me is a more reasonable resolution.
And then we have cell phones. In my stats above I have not included mobile traffic which this site actually gets quite a bit of. For me the web and the mobile web are two completely different things. As mobile is becoming more and more popular you should definitely have a separate version of your website for mobile (hint: MobilePress if you are using WordPress). But that right there is the key. You need a separate version of your site. There is no way (at least at this point in time) that you can optimize and integrate your current web presence with your mobile web presence without having a separate mobile version of your website.
My hope for the future is that more and more people start optimizing their web presence for larger resolutions (because they CAN!) and that they also have a separate mobile web presence because as it stands, mobile is about to explode in popularity.