Monday, March 12, 2012

Memento


Time travel for the web...

Its not possible to say whether we could, in reality, be able to time travel but its possible now in case of web, of course virtually. To no surprise, this feature of time travelling on web was possible even before Memento, thanks to the Internet Archive's Wayback Machine which stores old copies for pages they archive.

With Time Travel of Web, it means Old versions of websites will be as easy to find as current ones with this new time-travelling technology, Memento. There are various other archive sites which strive to archive the web. Internet Archive strives to archive the whole web All these archive sites employ web crawlers, which timely in some orderly fashion crawl the whole web.

Why Memento?

One would think what is the need of Memento when already archive sites archive the web. This could be explained with an example. If you were to access cnn.com, you would be presented with today's version of the page. But what if you wanted to see how it looked one year ago? You would need to visit the Internet Archive's Wayback Machine to find a list of old copies of the page they had archived, and you would need to click on one of the links. And if IA didn't have the page archived, you would have to search other web archives for the archived version. This is potentially a lot of work.

Thus, Memento...

This effort is made transparent to user by Memento. It makes it simpler to find old versions of web pages. All the user have to do is to use a Memento enabled browser to open the web page and visit the Url and supply a desired date and thats it. Memento would fetch the archived page for that date and display. The user would not need to manually go and fetch for the page across many archive sites.

Challenges in building Memento...

The archival copies have URIs which are protocol-wise disconnected from the URI of the resource of which they represent the prior state. This is because of the lack of the temporal or time dimension based capabilities in the most common web-based protocol, HTTP. This prevents getting an archived page through URI of its original. This challenge includes following multitude links from the original to the archived resource, or searching web archives.


Memento is a protocol based solution to address this problem such that archived resources can be seamlessly accessed through the URI of its original with an added time dimension while Content Negotiation.

Experience it...

You can witness this in action by using Memento add-on for Mozilla Firefox Browser. Even after you provide a date, it is possible that the page of that date is not rendered. This is not Memento's fault. It's a limitation of web archiving in general. Its because, Memento could only find that page archived closer to the date desired by you. Ofcourse, this would work only if previous versions are availabel and are on servers that supports Memento Framework.

How does Memento works?

Memento uses the standard function of HTTP i.e. Content Negotiation. Content Negotiation is done by your browser for every page you request, however, you may not be aware of this happening. This negotiation allows Url to send multiple types of data, depending upon the browser. Usually the language constraint is negotiated for every page request. But HTTP Content Negotiation is not limited to arbitrating between media formats an dlanguages. So, another dimension of date and time is added to this negotiation on each page request.

Memento is comprised of both server and browser software. At Server end running Apache web system, just few lines of code are needed to build in date and time negotiation capability within the server. On the browser end, a provosion for the user to provide the desired date and time. Of course, this requires the website owners to store many more time stamped versions of the pages. However, web pages need no extra capability. Web servers need to be able to intercept the date-time requests made by user.

Who drives Memento?

Memento is a collaboration between:
  Memento is funded by the Library of Congress.

More Details...

For more technical details, visit Memento Guide Introduction.

Tuesday, January 24, 2012

Git: Restore files deleted in older commits

Git is a Distributed Revision Control System. These four words seem familiar, but provide a powerful mechanism when all of them come together and Git is its resultant.

However well an application may be documented, it does not satisfy all the queries.

One such query I came across in my work was "How to retrieve the files those were deleted in older commits and not just the latest commit"

Below are the two ways to do that. First is the one what I prefer and the second one is recommended by a friend.

Consider, 3 commits have been made

Commit 1 : Initial Commit, Commit A. Files to be restored reside in this commit.
Commit 2 : deleted files say, A.txt and B.txt which has been committed as Commit B
Commit 3 : Made few Changes and committed as Commit C and many commits done so on.

Problem: Retrieve files A.txt and B.txt to current Head.

Solution:

First Method:

  1. List all the files those were deleted irrespective of the commits in which they were made.
$ git log --diff-filter=D --summary

          results as follows: SHA-1 of commit in which the delete of files A.txt and B.txt was committed, commit message, deleted files etc.



      2.     Find the SHA-1 of commit which last contained the files i.e. Commit just previous to the one listed in Step 1.


            Use $ git log command. In our eg, the log for 3 commits with their respective SHA-1's look as follows:




In our example, the commit which contains our files is 1bf2d..., say source to retrieve files from.


      3.  Restore the files

Use $ git checkout <revision> file.ext
  • revision : SHA-1 of source commit
  • file.ext : file name and path from where to retrieve.(Files are retrieved to their older path and not to new place. Of course, you can move them through Cut-Paste once restore.)


       4.  Do not forget to commit once the files are restored. In our eg after commit, the directory listing shows that the files are restored. The above snap shows that listing and deleted files A.txt and B.txt are restored back to same location.

Second Method:
  1. Use $ git log know the SHA1 commit versions.
  2. Check out the commit which contains the files you want to retrieve. Now, you will find the deleted files in the directory. Copy them to a temporary location.
  3. Now, again checkout to the latest commit i.e. Get back to the same place where you were before Step 2.
  4. Add the files to their respective directories from the temporary location.
  5. And, finally commit and list the directory to find the files.
Which method is better?

Both methods have upper hand depending on the situation and requirements.
  • If you want to restore the files to some new locations other than from where they were originally deleted, second method is good. However, you can use first method and then change file locations.
  • If you want the files to restore to same locations, first method is good. Ofcourse, with second method also you can do it. But, the overhead of copying files to temporary locations is eliminated in first method.
  • I would recommend the first method because the checking out to previous without committing the current may result in loosing your work yet to be committed for current verison.
Hope, this article has helped you and served the purpose for which you have visited this page.

Do post your feedbacks. Thats encouraging.

Monday, January 23, 2012

ICS vs iOS 5.0



7 days after Apple released it’s highly anticipated iOS 5 on October 12, 2011, Google announced it’s another sweet treat by name Ice Cream Sandwich, the first unified version of OS for tablets and smart phones, in succession to Gingerbread and Honeycomb on October 19, 2011.

Now, as both are launched and a significant time has passed to experience their features, the question arises as to which is the best.

The major issue comes that where they can work on. While iOS works only on Apple products, which is not the case with Ice Cream Sandwich.  Ice Cream Sandwich’s operating system is an open source OS, and it can easily run on any third party phones and tablets.

User Interface: 

To start with user interface, iOS aims at simplicity and any naïve user can grab an iOS 5 based Apple products and get going.  For Android, its quite opposite.  For someone who already knows their way around, it’s simple. But when you start, you might have to go through a couple of extra menus to get to the thing you need, however, it’s a lot more flexible than the iOS.


Voice Assistant:

Apple released its voice assistant service, siri, which is a really creative thing that provides users a totally different experience, and become the focus of the smartphone field. However, after the first few month’s fresh, I don’t think people will speak to their smart phone on the street.

Voice assistant appeared on Android system long before. But due to the limitation on content, voice assistant on Android is far behind iPhone 4s’s Siri. Even though Android’s voice assistant also has a nice performance. It can help you to make a call, send SMS, open GPS, play music and take a note and so on.

Gaming:

When it comes to games, iOS 5 gives a better experience than ICS. This is not only because iOS has its own Game Center, but also because the hardware of the devices. For example, the new iPhone 4s has dual-core Graphics processor, while in Android phones; only Samsung Galaxy nexus is comparable. In Android 4.0, we only find the new 3D driver

Browser:

 Both ICS and iOS 5 have beefed up there browser capabilities in own respect. ICS uses chrome based browser and iOS uses Safari. ICS chrome has got features like Google chrome bookmarks sync, incognito window and also a useful feature of offline web page caching for offline reading. Apple has got Reading Lists that allow you to save web pages to read later but however it does not support offline caching of web pages as does ICS. But an interesting thing Reading Lists does is it syncs across all your iCloud enabled devices. iOS 5 added tabbed browsing which was added to Android tablets since Gingerbread.

Near Field Communication:

Android Beam takes the notion of NFC even further by allowing data transfer between compatible devices just by tapping their backs and ofcourse for the mobile payments. However, iOS 5 did not include any NFC technology.  Several analysts said Apple won't be hurt by waiting to deliver an NFC-ready iPhone.

Customization:

 For the customization part, iOS really isn't customization without a jailbreak. Without a iailbreak, you will only be able to rename folders and change wallpapers, that's all. But when it comes to jailbreak, you can do several things like apply different themes, customize your lock screen, change names of Applicationsand much more. But with Android, you can do everything without doing anything at all. However, jailbreaking or rooting on Android is far more complex than on iOS Devices.

Facial login:

Apple still remains true to its good old 'swipe to unlock' screen gesture, while Android steps ahead with their new facial login capability. While Apple fans still swipe across that dainty touchscreen, Android users can flash those pearly whites to make their way across a locked screen.  Android really puts you 'into the picture'.

For me:



Hope this picture says what I want to.
Stay tuned. More to come...