University posts
You may notice that every now and then there appears a post that seems forced, or not in line with the kinds of posts I usually make such as the Javascript and DOM references post. This is because one of my university courses at Bond University is running a Blog Assessment in which we are given certain topics to blog about every now and then. Since these assignments are compulsory, I cannot refrain from writing them though they clutter the rest of the blog entries.
Oh well, just thought I would explain the issue for those who are confused by these seemingly random posts.
My web
We all use the web differently, and all have the pages we cannot live without. Following is a list of the top websites I cannot live without. What are yours?
Google Apps
Google Apps is a service that allows you to manage Google services for your own domains. For instance – I own several domains (thesquareplanet.com, casa-rioja.com, awknard.com, nerd-geek.com …), and host them all myself. I also used to host my own mail and calendar, but when I discovered Google Apps, I stopped doing that. Not only would I lose all mail that was sent to me if my server or internet connection went down, but I also had to constantly maintain security and other enhancements. With Google Apps, you can add all of your domains into a central system, and manage e-mail addresses, users, calendars and all sorts of other Google hosted services. Best thing is – it’s free! (as long as you’re non-profit that is)
I now have the GMail and GCalendar interfaces on my own domains, and can use all of their features as if I was using my Google Account.
Although Facebook receives quite a bit of critique with regards to privacy issues, and many abandon it entirely because of this, I feel that it is truly an amazing tool on the web that should be taken advantage of. As with everything else one does online, one has to be conscious that everything that is put out can, and probably will, be used against you, but as long as this is clear, Facebook brings a lot to the table. It allows you to organize your social life, and easily stay in touch with everyone you know (and some you don’t). By using Facebook, you also create an online presence which is extremely important in this increasingly online world.
Google Reader
If you follow anything online, be it a blog, a forum, a news site, a video feed or acoolname.com, you should get a feed reader. It allows you to merge feeds from all your article sources, and view them in one grand, unified list; sorted and grouped to heart’s desires. Google Reader is an online feed reader which provides a clean online interface for you to check updates in your online world from anywhere, at any time. All you need is a Google account, and you’re on your way!
What else do I use?
- Vimeo – Upload & watch videos
- YouTube – Upload & watch videos
- GrooveShark – Listen to music online for free
- Songza – Listen to music online for free
- XMarks – Synchronize your bookmarks and passwords across browsers and computers, and access them from anywhere
- StumbleUpon – Find new, interesting pages on the web
SPeeDY – The new HTTP?
Google have been coming with a lot of new cool projects lately – From Chrome and Chrome OS to Wave and Social Search. Following this innovative trend, they have now announced that they’re working on a possible replacement for HTTP. Actually, it is not as much a replacement as it is an augmentation or “fix”. SPDY will still be using the headers and basic structure of HTTP, but will treat that structure quite differently and introduce several enhancements to make it more efficient and more suitable for the contemporary web context.
Google argues that we need a new protocol for web traffic because of the way the web has changed over the last decade. Nowadays, pages use both multimedia and several externally linked files – something which HTTP was not optimized for. More specifically – HTTP does not allow:
- Fetching several resources through a single HTTP connection
- Push-like behavior from the server to the client
- Lack of native, and compulsory, compression of packet contents – especially headers
- Statelessness – HTTP does not “remember” anything from previous exchanges. This makes for redundant information such as certain almost static headers to be resent unnecessarily
Although several other projects have tried to come up with an appropriate replacement for the HTTP protocol, Google now believe that they have found one that is suitable. The SPDY project aims to accomplish several things; for example, a 50% decrease in latency for online request-response cycles and near-transparent transfer from the old technology to the new one.
This latter point is quite interesting, and has been the reason why many other similar proposals have failed. Far too many protocols attempt to reinvent the wheel, but Google has decided to retain the TCP protocol as the underlying transportation agent, and to minimize the impact on developers and end-users. This is achieved by the SPDY protocol avoiding any changes to the way the data is handled on both end-points, only the protocol in between, so that web developers won’t have to change a thing on the server side. The only changes that are needed are in the browsers and the web server itself.
The reduction in latency will be primarily by enforcing compression on headers and body, slicing away unnecessary header tags and allowing several resources to be fetched in a single TCP request to avoid packet overhead. Google has also decided to take some steps to improve the overall quality of the protocol as a whole by introducing SSL as the rule, and non-SSL as the exception (if it will be allowed at all); as well as cutting down the protocol definition so that the implementation will be much simpler.
Overall, SPDY promises a lot, and looks very promising – All that remains is to see whether server and browser developers will join the cause and develop working implementations of the draft for testing. Knowing Google, they will probably release support for it in both Chrome and an “experimental” web server that will probably be released soon.
One major obstacle for its popularity though is that the premise of multiple resources in a single TCP stream, and a move away from the stringent request/response cycle of current HTTP sessions means substantial changes will be made to the web servers to allow for this kind of behavior. Hopefully Google will release their testing server to the public soon so we can start to see test implementations of the technology, and how hard or easy it will be to implement.
For more info on the technology, have a look at the SPDY Whitepaper
Recovering data from a Mac drive from Linux
The Mac of a friend of mine crashed the other day – complete harddrive failure. He turned it into the Apple store, and they decided to give him a new disk because they said they couldn’t recover the old one. Somehow, he managed to talk them into leaving him with the old drive so he could try to get at least some of his data back. My friend then came to me, and asked me to have a look at what I could find.
He had already tried to hook the drive into another mac, but it just froze every time he tried to enter a folder on the drive. The same happened when I used my SATA docking station, and attempted to either access or repair the drive through a piece of software called MacDrive. It seemed as though all hope was lost.
I decided to give it another shot from Linux, just to see if I could somehow avoid the corrupt files, and copy only those that could be properly read. Turns out, Linux didn’t even break a sweat when seeing the corrupted harddrive. All I had to do ( using Arch Linux that is ) was this:
- Attach drive to my SATA dock
- Mount the drive: “mount /dev/sdg2 /mnt/ext”
- This assumes the external drive is sdg, check “fdisk -l” to find attached drives
- Mac-formatted drives have at least two partitions ( one is the boot partition ). Therefore, you must mount partition two ( or whichever is formatted as HFS+ )
- Because Apple decided to use journaling on their HFS+ drives, these are not writable from Linux. Either live with it, or insert the drive into a Mac, open up the terminal ( usually Applications/Utilities/Terminal ) and run “diskutil disableJournal /dev/disk#” where # is the drive number. Find the drive number by running “diskutil list”. For more info, see: http://castyour.net/node/40
- Run “cd /mnt/ext/”
- Navigate to whatever folder you want to copy and run “cp -R <folder> <destination>”
- The cp command will then dutifully copy all the files it can read properly into your destination folder, and tell you if it can’t read a file. It will automatically skip them.
- Your files are saved!
Yahoo Pipes
Ever wanted to grab some data from a webpage, or perhaps several, manipulate it in one way or another, and then format access the data through, for instance, JavaScript? Earlier, you would have to write such a script in PHP, ASP, Perl or another scripting language on your web server, and then get the data from that script through JavaScript. This meant you had to run a web server in the first place, and that it would have to support not only fetching data remotely, but also the scripting language you chose to use. And if you didn’t know any scripting languages apart from JavaScript, you would be out of luck.
The engineers over at Yahoo came up with a solution: Yahoo! Pipes. Pipes allows you to set up a series of, well, pipes, for your data to go through, each manipulating it slightly, until you have processed your raw data into what you wanted to extract in the format you want it.
Pipes is an essential tool in today’s world of mash-ups ( that is, sites that do not have any content themselves, but just collect data from other sources, combine and manipulate them, and then publish the processed data ), because it allows you to do most of the work on a remote server ( Yahoo! ), through a simple drag-and-drop GUI ( Pipes ), and fetch the end result using nothing but JavaScript. You can of course access the data using whatever technology you want, since you determine the output format.
Just to give a simple example of what Pipes can do: Say I wanted to create a feed for my users that contained all my posts, except those that contain the word “task”. In order to do this before Pipes, I would have to write up a new PHP script that would fetch all my articles from the database, filter out those with “task” in them, and create a whole new RSS document. Replicating large portions of the code that renders my current feed. Or, I could change my current RSS feed generator so that it accepted URL arguments that allowed filtering by words. All of this would require me both to edit files on my server and make my scripts more complex.
With Yahoo! Pipes, I can simply set my feed as the input source using feed auto-discovery, set up a filter to block items containing “task”, and output the resulting elements as RSS XML. Done!
You can see my pipe for doing this at: http://pipes.yahoo.com/jonhoo/nontaskblog
Oh, and did I mention you can publish pipes…? ;)
PS: If you want to fetch the feed form a WordPress blog, notice that you should not input the feed URL directly, but rather select the source to be “Site Feed”, and then input the URL for the front page of your blog.
Portfolio live
Finally, my long-awaited ( on my part at least ) portfolio is live!
You can see it at http://thesquareplanet.com
Design and coding entirely by me.. The coding was not really much of a feat, as it is quite simple, but design has never been my thing, so it was fun to get to stretch my visual creativity legs ( we’ve all got them ).
Drop-in PHP folder gallery
Update 21/11/09: The script now supports thumbnails for video and text, as well as timecodes for video and audio. FFMpeg is needed though..
Have you ever uploaded a bunch of images to a new folder at your webserver to share them with others, and ended up with just a listing of clickable filenames? No previews or thumbs of anything..
Well, I’ve found myself in that position too many times, and decided to create a standalone drop-in PHP gallery file that pulls thumbs from images, videos and text files and displays them in an easily scannable format. The thought behind it was that it should be a single PHP file that could be dropped in the directory and left there without any more work.
The file is not complete, but it does work with images so far, and video and text support is half-way there.
You can see the alpha version here: http://jon.thesquareplanet.com/index.gallery.phps
To see it in action, see: http://jon.thesquareplanet.com/bond/toga/
Hot-swapping drives in Windows 7
I have recently bought two external SATA docking stations – one internal ( i.e. it fits in a 5.25″ bay, and loads the drive from the outside like a large floppy ), and the other one completely external and connected through eSATA. For the first couple of weeks, I thought hot-swapping was not possible with these, and kept rebooting if I wanted to swap out a drive, however one day I came across a setting in BIOS describing how SATA drives should be treated. It was set to “IDE compatible”.. The other options were “Enhanced” and “AHCI”. I tried googling this, and soon found that AHCI is actually a technology that enables plenty of the cool features of the SATA technology – most notably hot-swapping!
I enabled AHCI, booted up the computer, and Windows 7 presented me with a BSOD… Again, Google was my friend, and I found several other people who got the same problem when enabling AHCI after install. It seems as though Windows 7 checks for AHCI when installed, and determines then whether to load the AHCI drivers or not.. It then never checks again…. Smart…
Luckily, there is a solution.. First you have to get back into Windows my resetting the SATA drives to “IDE compatible” mode. Next, open up the registry explorer, and follow this guide: http://support.microsoft.com/kb/922976. If it is already set to 0, set it to 1, then to 0 again, and reboot. Now, set the drives to AHCI in BIOS, and reboot again. Hopefully your Windows should start up without a bluescreen.
Now, all your SATA drives will appear when you use the “Safely remove device” icon near the clock in the bottom right corner. If you choose to remove a drive, you can eject it from there and then take it out and put in a new one. This is where the problems start to arrive though. Sometimes, this approach works without a problem, but sometimes Windows simply goes silent, and acts as though nothing has been connected at all. Other times, it tells you that it has found partitions, but that they are in RAW format, and have to be reformatted!
After living with this for a couple of days, I decided that there had to be a more stable way of doing this, and that was when I came across HotSwap!. This piece of software is made for managing hot-swap drives in Windows, and once installed, allows you not only to scan for new drives ( and load them properly! ), but also to safely remove them AFTER doing a spin-down.
After running this stand-alone .exe, you can set it to autostart with Windows. After that, whenever you want to swap a drive, just right-click the hotswap icon at the bottom right near your clock, safely remove the device you want to swap, exchange the drives and choose “Scan for changes” in the HotSwap! menu and up comes your drive!
Happy hot-swapping!
