Thursday, May 26, 2011

[Programming] How to create your own file system








create your own file systemHave you ever wondered how your computer stores a file? How folders are different from files? How can you write your own file system from scratch? Ok I will explain you how to create a file system from scratch, and I will assume that you are comfortable with "c/c++".

 

Disclaimer: This article is not for experts, who already have many years of experience in developing a file system. This post is for naive. And the file-system mentioned here is not complete project it is less than one third of what I intended to do. I would appreciate comments/suggestions from experts.




The first rule is, when experimenting/creating your own file-system please use a blank pendrive to test, or may be a file which can act as virtual file system for the time being. Never ever test it on your own hard disk.


The method I would discuss here is a project I developed in a period of 4 months under Advanced data structure course. My thinking was very simple, a file-system is a big file which have all the files inside it. Just like a zip file. And this is true, actually a file system is a big file which is initially blank or we can say all the space is filled by either random data or filled by zeros. And we just have to find a method to allocate that space to some data so that the data is retrieval even if we don't know where it is. So we have to predefine a location where the location of files would be stored.


That means we must have a data structure for our file system and the data structure must be uniform through out the file system else we will get hard time finding the file and its location with in the disk. I used K-ary data structure but K was not defined because the children of a parent are linked to each other through a linked list so we can assume it more or or less like a B+ tree. Ok! it is really hard to explain this without a pictorial view, so here is the diagram:


pslos file system


As you can see I predefined(already decided) that there would be root directory and its child would be the folders which would be in linked list. That means all the sister nodes of the folder would be linked together and all the children are linked to its parents through a single child. But to make file system fast I used another link, a link which always has address of its parent. That means "Folder 8" would have a link to "folder 1" but "folder 1" would not have link to "folder 8" we can reach "folder 8" via "folder 6"->"folder 7".



typedef struct ffolder{
char name[32];
long sector;
long insector;
long upsector;
long next;
long prev;
long filesector;
char properties[3];
int size;
}ffolder;
//Folder structure

This was the structure of folder which has attributes like "sector" which has its own location in file system, "insector" would have location of the first folder inside that folder, "upsector" would have location of parent folder. We can understand what "next" and "prev" would store as it is a linked list. Now the two most important attributes of folder are:


1. "filesector"


Now even if we have a file system which can store multiple folders in it, it is still not complete because the basic purpose of a file system is to store files. So for that I used another structure:



typedef struct ffile{
char name[32];
long next;
long prev;
long sector;
long fsector;
char properties[4];
int size;
}ffile;
//file structure

So a folder can have link to first file and rest of the files would be linked list. Pictorially that means:


file structure of file system


The attribute "fsector" will store location of content and the content will not be at a single place, it will also have a structure



typedef struct wfile{
char buff[16];
long next;
long prev;
long sector;
}wfile;
//content structure

So you can see that content will also be a liked list of a buffer which would store only 16 characters at a time.


2. "properties"


properties is a char set of 3 characters having some  other permissions regarding a folder, like read/write/view.


So, finally we have a system where we can create folders/files and store content in files. But now we have a problem, and that is deletion. To understand deletion we need to understand that how we will insert these structures to a file.


I guess you know that can write a structure directly to file using fwrite. Hence each structure would be written sequentially(we will assume that no file is deleted until now).


file in file


Now if you delete any specific structure it will create a void and it can be filled only with the same kind of structure. We must maintain the list of all deleted files, at a separate location.


I will give link to download a working file-system for your understanding and testing. I hope you would have understood some basic concepts of creating a filesystem. Actually this topic is a vast topic and it can not be covered within a single article, if you have any query regarding the same please ask them in comments. I am writing a small e-book on it, stay tuned for the information. If you want to sponsor this project and want to get first out copies of the e-book you can mail me using contact us link.


Here is the link of the basic file-system (it may throw some errors as it was not fully tested) click here to download.


 

Wednesday, May 25, 2011

[How to] Use Google talk on Linux or Mac

Ok this tutorial has no relation with wine. I am speaking about real Google talk by Google itself. Google will not roll out Gtalk for Linux because pidgin and other clients are already there and there is no need. But I personally do not like those clients because of many reasons, one amongst them is poor audio calling quality. So I decided once to run Gtalk on Linux using wine but failed, still with new versions of wine Gtalk is not completely accessible. Finally I found the best way to run "Google talk" while I was researching on Chrome Os.

So here we go:



















Google alternate dirBefore starting any steps do the the following:type this command in terminal this will show you a freshly installed Google chrome

google-chrome --user-data-dir=".gtalk"

After selecting you default search engine move to next step.
Chrome WebstoreStep 1: Go to Chrome Webstore using this linkhttps://chrome.google.com/webstore?hl=en-US

Step 2: Search for Google talk

or click this.

Step 3: Install this app (although it is written that this app is only for chrome book)

Once these 3 steps are completed we will move to next section.
Gtalk on linuxStep 4: Now right click on "Google Talk" and click on create shortcut.Step 5: Select both Desktop and Application menu. Press Ok.

Wasn't that easy??

Yes that is it, you have a Gtalk installation on your Linux.

Now there are few other things we have to do the first one is when you will click on Gtalk it will show you an error message but at the end it will ask you if you want to continue or not, just press continue.
Gtalk in LinuxIf you remember there was one flash based g-talk also available but you could not use that for video calling or audio conferencing. But with this you can call your friends, you just need this pluginhttp://www.google.com/chat/video

Moreover it will not disturb your original Google chrome settings and you can live in peace.

The only problem with this "Google talk" is when you select any one for chat the new windows pops at the bottom of the screen which sometimes makes it irritating.

Mac users can also do the same.

I hope this tutorial would be useful.

Your suggestions are always welcome, please do post in the comments if your have any query or any complaint.

Saturday, May 21, 2011

[How to] Use your Android device from your computer

There are 'N' number of different methods to use your Android phone with your computer. But most important question is which is the easiest one?

May it be bloggers who want to post quick tutorial about certain android application, or be it a normal user who wants just to post his queries on various forums, this guide is for all'f'em. You know an image can speak thousand words, and a video can speak million words :P. Please be aware that this guide is only for "rooted" devices. If you don't know what "rooting" means you have two options:

1. Learn rooting:

2. Close this guide and live your life peacefully.

 

The guide is as simple as anything.

  1. Download and install this app https://market.android.com/details?id=org.onaips.vnc onto your device.

  2. Connect your phone through USB and ensure debugging mode is on.

  3. On Linux: Find "Remote desktop viewer" or equivalent vnc viewer and run it

  4. On Windows: Download vnc viewer from here.


Once you have completed all these steps, start "Droid vnc server" on your android device. It will look like this:







droid VNC Server screenshotYou can see the address for connecting is written as "172.20.23.254:5901", you may find your own address to connect from the same spot.
Once connected you will be able to see your Android screen from your computer. 

You can see some test screen shots here :







Android Screen shot 1Screenshot of Android

[Top 5] Wallpapers of the month

In our first edition of monthly series of top 5 wallpapers of the month, We are presenting very well chosen and tested High resolution/High definition Wallpapers. Wallpapers are more than mere pictures, they tell you about your personality, your attitude, your passion and your compassion.

So without any further delay, Let me present you "Top 5 Wallpapers of the month May,2011". This month's theme is "Gnome 3"























Berries WallpaperThe Berries Wallpaper: 

umm!! This is one of the amorous foods. On your desktop it would look very sexy. though it may help in increase your appetite still beware, because this is the best distraction.

Wikipedia entry for berries: The botanical definition of a berry is a fleshy fruit produced from a single ovary. Grapes are an example. The berry is the most common type of fleshy fruit in which the entire ovary wall ripens into an edible pericarp.

More on: http://en.wikipedia.org/wiki/Berries
The green mamba wallpaperThe Green Mamba: 

This wallpaper will keep you happy and scare of unwanted visitors near your desktop :P. Seriously this wallpaper's green shade makes it look awesome!

Wikipedia entry for Mambas: Mambas of the genus Dendroaspis (literally "tree snake"), are fast-moving land-dwelling snakes of Africa. They belong to the family of Elapidae which includes cobras, coral snakes, death adders, kraits and, debatably, sea snakes.

More on: http://en.wikipedia.org/wiki/Mamba
Gnome 3 WallpaperThe Gnome Project: 

GNOME is a desktop environment / graphical user interface that runs on top of a computer operating system. It is composed entirely of free and open source software and was created by two Mexican programmers, Miguel de Icaza and Federico Mena.

This wallpaper will look stunningly awesome on Gnome 3 desktop.

http://www.gnome3.org/
The lost Headphone ( lol ;) ): 

Ok!! I didn't find any boring information on this wallpaper. But you must agree this wallpaper will look beautiful both on Ubuntu 11.04 with ambiance theme or with Gnome 3  DE. Currently my Labrador is using it:

Lebrador Headphones
Geeky gnome WallpaperGeeky Gnome Wallpaper: 

Finally we are uploading this last wallpaper fully dedicated to geeks.

Three cheers for Geeks!!

They make our Life easy/hell. :D

We hope these wallpapers would be there on your desktops till next month.

Friday, May 20, 2011

Two good news for Tutafuta

We have some good news for you. Its been just one and half month when I launched Tutafuta (yes the name is funny, I have to find some serious acronym for it ;) ), and we already started doing fairly good job. This post initially was intended for an announcement regarding Tutafuta, but I had to change it because of OMG! Ubuntu effect.

Today OMG! Ubuntu posted one of the tutorials posted by us few days back. And the effects were amazing. Within few hours we received 1000+ visits. We (OMG! Ubuntu fans) already termed it as "The OMG! Effect".  Thank you OMG! Team.

The second good thing which is going to happen today is, We are launching "Tutafuta Short". "Short" will be a microblog which would be written in parallel to this blog with all the exciting stuff which can be read within 1 minute.

We would remain committed in bringing some nice experiments, projects, ideas and research articles here on Tutafuta.

Stay Tuned.

 

Tuesday, May 17, 2011

Google slipped off a rank in Alexa

Google fall rank AlexaFinally after many many years, it happened. Google slipped off one rank yesterday from Alexa's ranking. though some people do not consider these rankings completely accurate but still this never happened from a long time.

Facebook was at second rank from a long time and finally got a chance to enjoy rank one for one day.

Though we still can not say that facebook is the real champion because Google owns many other web-services and almost all of them are in top 100s so when we would combine everything Google would still be winning by a comprehensive margin,  way ahead of its competitors.

We wish this never happens again, but it would be interesting to see the tough competition between Google and Facebook for number one position, it can give their ego some boost. :P

 

[Reviewed] Windows phone 7 - the good, the bad and the ugly

Windows phone 7We are about to experience another competitor to add fire in ongoing competition in the smartphone sector, the freshmen is Windows 7. Why we would call windows a freshman? because the user-interface of Windows phone 7 is so fresh and awesome that you can't ignore it. We can say that it has all the potential to kill Android and iOs. Both the Operating systems are already there in the market for last 3-4 years with the full blow. We have seen Android overthrowing Symbian and iOs to take number one position in market shares of smartphones[Source]. Microsoft was observing iOs, Android, RIM and Symbian and tried to took all goodness of every Os. We all know that iOs is very easy to use and has very sleek interface, with the app market which Android has yet to match. Apple maintains an ecosystem where it is ruthless to crapwares and does not allow bullshit applications in its market(read it app store). To be true if Apple will release iOs for other manufacturers it will literally kill Android. That is one of the most important problem with iOS, Android is very very very flexible. You can install it in almost everything, Manufacturers <3 Android. Motorola who was once on the verge of bankruptcy, bounced back and now the company is on the track just because of android. Microsoft kept itself quiet for some time and observed this. Finally They launched this amazing OS called Windows phone 7.

The good:


Tiles tiles tiles and more tiles, WP7's UI is full of tiles. The phone Microsoft demonstrated was flawless. Everything worked perfectly. User interface was intuitive, speed was fast and ease of use was amazing. Microsoft just like Android will give this device to manufacturers who have freedom to re-brand it but with some restrictions. This means that we can see plethora of Windows phones in future. The other thing which can boost its market share is, the phone totally compliments your PC (Windows 7). We may see a comprehensive package where Office 365, Skydrive and Windows 7 all will come together to create a perfect ecosystem. Moreover MS has announced that it will allow only those manufacturers who will adhere by the policies of Microsoft and that would include, no modification in the UI, Hardware must be of high configuration with at-least 1 GHZ processor and 800x480 pixel touch screen. Not only this, hardware must contain only 3 keys with one "back" button, one "Windows" button and one  search button which will invoke bing search. This strategy would ensure that users will get best experience.

The Bad:


Windows phone has many problems yet to be solved. Some of the problems I see in WP7 is:

  • Slow updates: With Android/iOS having decent pace of development WP7 is slow providing vital updates.

  • No HTML5 support: this may effect in future.

  • Less reconfigurability: WP7 is tightly bound and Users would not be able to make there phone look like iOS or Android or even any other theme very easily.

  • Price: while Android can be bought  with as low as 100$ phone, WP7's demanding hardware will result in very high prices. That will make the phone only tagged to upper ranged customers. We may not see a huge population going crazy for WP7 (at least in developing countries like India).

  • No good track record: Windows does not hold a good track record when it comes to smartphones. Almost every attempt to topple Apple has failed. Apple grew from 16 billion $ firm to 208 billion $ huge company while Microsoft sunk from 500 billion $ plus company to just 218 billion $ company.

  • Competitors are tough: Smartphone market is one place where real development is going on with very fast pace. MS is entering late to the party, that means it would have to eat food which is left over by early comers.

  • Android factor: with each version of Android the OS is becoming better and better and better. If I look back to version 1.6 Android, it was crap in front of current 2.3/3. Android even ate shares of iOS and RIM and toppled Symbian to get first position. It is really hard to catch up Google's pace.


The Ugly:


Ugly this is the truth. WP7 is created by Microsoft in its desperate attempt to try and do things differently. They tried their best, I hope this attempt will be a success. But if WP7 failed then it will demolish the hopes of MS to be in Smartphone Market which according to me is the future. MS has to be a bit open in its nature to gain love from developers as well as people across the globe. Currently most people are in love with Google, just because of its cool nature while MS acts like a 60 year old fellow who is always serious with his life. We can not predict the phone would be a success or faliure but it is a great attempt by MS and it surely deserves market and a niche for itself.

Friday, May 13, 2011

Convert your Ubuntu into Chrome OS

Chrome OS on Ubuntu

Yes you read it right!! This tutorial will tell you that how you can convert your Ubuntu machine into Browser only desktop. You may have heard the latest news that first NetTop (Chrome Netbooks) by Acer and Samsung are being launched in June.

But If you could make your own system behave exactly the way Chrome OS behaves, wouldn't that be amazing?  I was also intrigued by the same fact. After all Chrome OS is just a browser on top of Gentoo or Ubuntu [wiki:Talk] (I am sorry Chrome OS developers I know you have worked hard a lot to make Chrome OS complete OS and is very different from Google chrome/Chromium but for a laymen it is just a browser on top of a Linux).

Now my basic idea was, if we could run Google Chrome just at the starting of computer and nothing else is started we could save a lots of ram and can have access to Internet within seconds. So without any further delay lets see how we can configure Linux to achieve this.






Step 1: Start Autologin
You have to auto login to system so that you can access browser as fast as you can. To start auto login:
Login Screen
Go to:System->Administration ->Login ScreenUnlock: unlock the system by typing in your password.

Select: Click on radio box where it is written "Login as ******** Automatically"

Close it







Step 2: Install Openbox Search and install "Openbox" from Ubuntu Software Center.Or

simply type in terminal

sudo apt-get install openbox openbox-themes







Step 3: Install fbpanel and PCManFM Fbpanelis one of the lightest panel yet it is enough powerful to let you work in peace.To install fbpanel in Ubuntu

Search and install "fbpanel" and "PCManFM" from Ubuntu Software Center.

Or

simply type in terminal

sudo apt-get install fbpanel pcmanfm







Step 4: Install Chromium Search and install "chromium-browser" from Ubuntu Software Center.Or

simply type in terminal

sudo apt-get install chromium-browser







Step 5: Leave rest on me Download this file : chrome-session.tar.gzmake this install.sh file executable using

chmod +x install.sh

and install chrome-session by typing

./install.sh in terminal

Thats it now you can logout the computer and choose chrome-session at login (you can find it at the bottom of login screen). You should see chromium running with fbpanel at the top hidden until you move your mouse at top screen.

I will try to experiment more on this, meanwhile you can try to run a pure Firefox session. If you find any bug please report me as a comment here.

Here are some cool things I observed about this chrome session:

  • Access your Internet using the same nm-applet which power gnome desktop

  • Access Folders just like you open it in any other windows environment, as easy as that

  • You will find chrome market more useful in this case. Because you will have to find a web app for what you can do otherwise on your desktop.

  • Change many windows using the same old alt + tab








nm-applet in Chrome SessionFolder in chrome sessionChrome market in Chrome sessionchange active window in chrome session





Edit:

1. To revert back just close the browser. It will automatically log you out. You may then select Unity/Ubuntu classic again, just as you had selected chrome-session.

2. Here is the file if you want to enjoy firefox-session use this file firefox-session.[UPDATED]

3. If the script throws an error please post your queries in the comments. Before posting please try to start fbpanel by typing command "fbpanel", it may not run by showing some error but then you can re run the script and every thing would work perfectly.

PS: I updated firefox session file. You can use this new one. Please make sure that you have decompressed the downloaded file (you can do this by right click on the file and select extract here). Once decompressed  a folder named firefox-session would appear. using terminal go to the firefox-session folder and follow the above mentioned 5 th step.

Thursday, May 12, 2011

Android App of the Month: Saavn

Is this happened with you, that when you are travelling and some song comes to your mind, but unfortunately you do not find that song in your SD card? You may get it in Youtube, but as video will be played simultaneously it would be slow as well as it will eat up lots of your MB.

A few days ago I was in the similar situation. I Googled one song and got its link also but that was a streaming link which uses adobe flash player for streaming. I searched for many websites and apps and finally I found this piece of gem called Saavn.

Saavn is a web application which lets you search and play any of the Bollywood/Tollywood songs. They recently released Android application and thus life became easier of songomaniacs like me.

The Basic interface

Saavn Android home screen


When I get up in morning I want some random sweet songs which would help me to wake up smoothly. Saavn's Surprise me section is apt infact more that apt for it. It automatically generates a playlist, I am not sure how it selects random songs but it mostly selects all the songs which are my favorite. Other than this "Weekly top 15" lets me to listen to the cool new songs which other wise I never care to listen until I find them being played somewhere.

You can save your playlist online and add to it as you find more good songs. Some of the great and hand picked playlists are there in Featured playlist section, this section personally my favorite. I do not need to tell you that you can search your song amongst thousands of available songs.

In my opinion Saavn has potential and that is why we have chosen it as "Android app of the month"

You may have many application for western music but there are very few application which can stream Indian music on the go, thats where "Saavn" excels

I am leaving with  couple of other screen shots.

 







Saavn ScreenshotSaavn Screenshot

To install this app use the following link:

https://market.android.com/details?id=com.saavn.android

 

Friday, May 6, 2011

Whitebeam - Web Application Server, beware PHP



"Whitebeam", I guess you have not heard this word before unless you are a botanist. but there is one another Whitebeam out there in this world. This Whitebeam is a web-application server created for Rapid Application development. Whitebeam is created with an intent to reduce the cost of development of sophisticated web-apps and makes the life of developer a little bit easy.

If you have used PHP/javascript/html you will be able to pick up this language pretty fast. The best thing about Whitebeam is, if you know javascript, you will have it all to get started using and developing applications. The syntax of the language is very easy and with intuitive libraries it is very east to develop websites.

Let me throw an example on you:











PHPWhitebeam

<html>
<head><title>Hello World</title></Head>
<body>
<?php
// Server-side PHP
$msg = "Hello World";
echo();
?>
<?= "The message is'$msg'" ?>
</body>
</html>

<html>
<head><title>Hello World</title></Head>
<body>
<?rbscript
// Server-side JavaScript
var msg = "Hello World";
?>
<?= "The message is '"+msg+"'" ?>
</body>
</html>

You can clearly see, Whitebeam is a server-side javascripting language, having plethora of features.
There is an interesting fact given on their website while comparing to php
Whitebeam provides an intuitive, well documented object orientated set of APIs that abstract away the underlying complexity in order to reduce barriers to entry for new users. While developers can get down to the underlying functionality, it is perfectly possible to build a feature rich database driven application without ever having to learn SQL. Even where the user wishes to get to the underlying functionality the Whitebeam aim is to provide a consistent interface to similar technologies.

So, forget about complexities PHP brought to you while coding and maintain unanimity while using same scripting language for both server and client side. Not only features, You will save a good amount of lines of code if your project is huge. This will directly and positively effect your web-site's speed. You may however need to learn a bit of XMl.

I personally feel it is a language worth learning and you can use it to boost up your websites performance. To get started just click this link : http://www.whitebeam.org/library/guide/TechNotes/technotes.rhtm.

Happy learning