Translation


by Transposh

Posts Tagged ‘Technology/Internet’

Networking Ubuntu PCs with SSHFS

Sunday, October 18th, 2009

Two PCs that are both running on Ubuntu can share files in a number of ways. We use USB devices & swap them to synchronize files between two PCs in what was called a ‘sneaker network‘. One better way is to use an SSHFS or ‘Secure Shell File System’ network.

SSHFS uses OpenSSH to provide secure communication between PC’s/With the network connected the local PC user will be able to transfer,open as well as edit files on the remote PC as if they were on his own machine. The remote files will look and act just like the files on the local PC

To create an SSHFS network all you need are two PCs connected to the same router or gateway. Ubuntu comes with most of the software to make this work, but needs two applications available in the repositories to be initialized on both PCs. Here is how to set it up:

  1. From System>Administration>Synaptic Package Manager install the following packages: sshfs and openssh-server
  2. Also in Synaptic, confirm that openssh-client is installed(usually comes with Ubuntu)
  3. Go to System Administration>Users and Groups>unlock>Manage Groups, confirm on Fuse group
  4. Create an empty folder in your home directory

That completes the installation of the networking tools. To activate the network from one PC to the other,you just have to invoke SSHFS and indicate where the files are coming from, and where they are going to be displayed (that the new folder you made)

Go to Applications>Accessories>Terminal & enter:

1
 sshfs remoteusername@remotepc:/home/remoteusername ~/newfolder

Once you supply the password for remote PC (their password, not yours) which indicates that you have permission to access it, and for the first time only, confirm the other PC, then the network will be established and an icon will be displayed on your desktop. You will be able to access the other user’s home directory by simply clicking on that ‘newfolder’ icon in your home director.You can then copy,move,edit and delete as if they were on your PC. Password protected documents will, of course remain password protected.
To disconnect your PC from the network, enter in the terminal:

1
fusermount -u ~/newfolder

Goodbye Shared Hosting, Welcome to the Cloud

Thursday, October 15th, 2009
Cloud Computing

Back in 2007 I got a shared hosting account from Hostmonster which claimed to offer me “300GB of space” which was later upgraded to “Unlimited“, “3000GB monthly bandwidth” which was later upgraded to “Unlimited“, “Unlimited MySQL databases“,  “Unlimited mails“, etc. all for a meager amount of 5.95 USD/month. I felt as if I had all the power in the web but soon realized all the “Unlimiteds” were awfully limited. Although I had a shell access for the account, the best I could do with it was copy or move files. I couldn’t install anything onto it or modify anything I needed. What good was all the unlimited for when you had small limits on processor timings and memory usage. Especially when hundreds of shared hosted sites are hosted on the same server its only a matter of time when your site becomes listed as a malware website with Google and co just because some unscrupulous user setup a malware website on the same server as yours. Then I felt the need of having a dedicated server. Now we run Ajatus on a dedicated server which we got for a steal of a deal from Serverminds.

But, now times have changed, for a blogger of today what is the best option to host his websites along with the freedom of trying out his hands on the various components of his server? It can’t be shared hosting, and dedicated web servers are a tad bit too expensive for him. VPS (Virtual Private Servers) is another option where the hosting provider gives the user slices on servers shared over a visualization layer like that of XEN or VMWare. But, VPS are also not very recommended if you have a hunch that your site might need scaling because of a rise in traffic, as it limits the users scope for scaling without moving entire data and setup and their price are also not as reasonable. So what other option are we left with, Cloud Servers, for most of us it might sound something which would be extremely expensive and an enterprise solution. But the fact is its not at all expensive when it comes for a starting user with minimalistic requirements, provided that you choose the right hosting provider. I will provide a small price comparison of the most popular Cloud Server hosts later in this post. So, what is Cloud computing all about? Cloud Computing can be considered as an extended VPS which can be seamlessly scaled dynamically over the Internet. Amazon is one of the largest providers of Cloud computing infrastructures. But except for Amazon’s Simple Storage Service (S3) all others seemed pretty much expensive to me especially the Elastic Compute Cloud (EC2). So, what can you do with a cloud server? Well on a cloud server you can do everything that you can do on a dedicated server with an added option of dynamic scalability. You can host your blogs, experiment with all sorts of fancy technologies and once you feel you are going out of resources ask your service provider to expand your Cloud Server in-terms of memory, storage or processor cycle limits. Having told all this lets have  look at the pricing for a minimalistic Cloud Server configuration provided by some of the Industry leaders:

Amazon EC2: For the smallest Cloud Server they charge 0.10 USD/hour that makes it 0.1 x 24 x 30 = 72 USD/month. For the same price you could easily rent a dual Opteron Dedicated Server with 2GB memory for your self.

Aptana Cloud: Their pricing for 256 MB memory and 5 GB storage is  20 USD/month. This seems a bit more reasonable. Actually this would also be the price of an equivalent VPS.

RackspaceCloud or Mosso CloudFS: Their pricing seemed the best to me. For 256 MB memory and 10 GB storage they charge on 1.5 cents/hour or 10.95USD/month. Now that is extremely low. This is just a little bit more than what most of the shared hosting provider charge for their pseudo “Unlimited” hosting. What more whenever your site seems to soar up in traffic just dynamically add another Cloud Server and share your load.

GoGrid Cloud Hosting: Their minimum offering is half a Gig of Memory and 30 GB of storage at a price of 0.095 USD/hour = 68.4 USD/month. This also seems high for a beginer.

There are other Cloud Computing service providers also, but most of their offerings target the enterprise more than to the  personal usage. One such example is RightScale, although they provide Developer free trials their pricing is simply too expensive for a beginner.

Weave Your World With Mozilla

Wednesday, October 14th, 2009
Weave Mechanism

Weave Mechanism

Password as well as bookmark Synchronization is a thing of past. Welcome to Mozilla Weave, a Mozilla Labs project which is a tool designed to let you keep in synchronization with absolute ease & more importantly keep it secure. If you’re one of the many “road warriors” depending on Mozilla browsers, Weave is your ticket to a seamless Firefox experience across all your machines.If you only have one machine where you use Firefox to browse the Web, you probably don’t have much need for Weave. But if you’re using Firefox at home and at work, or any other scenario with multiple machines, you’ll definitely want to take a look at the latest iteration of Mozilla Weave. The project recently released Weave Sync 0.7 for Firefox 3.5 and later (including the 3.7a1 release)

Even though Weave is the answer to a lot of my problems, I haven’t been using it previously. I’d tried Weave before, but stopped using Weave pretty quickly because it seemed to make Firefox enormously sluggish. However, the most recent release seems quite snappy.

Using Weave is simple: Install the extension and restart Firefox. Then create a new account or enter your username, password, and passphrase if you already have an account.

One word of caution — you need to keep your passphrase handy. You apparently can’t recover the passphrase, only reset it and delete your data. This is a bit of a hassle if you (like me) have gone a longish interval between using your passphrase and have forgotten it. I have a number of “stock” strong passwords I use for services like Weave that I can cycle through, but passphrases aren’t terribly common — when I started looking at Weave 0.7, there was pretty much zero chance I’d remember what I used last time I set it up. I do know for certain what it wasn’t at this point, but that did me little good. Since I was only reviewing Weave and not depending on it previously, that wasn’t a big deal for me — but if you’re going to depend on Weave, make sure you have picked a passphrase you won’t forget!

What Weave Syncs

As mentioned, Weave does more than just sync passwords and bookmarks — though it does that. It also syncs history and tabs, and does so continuously. So, if you’re at home and logged into sync and surfing the Web at home, you should be able to pick up the same session at work after your commute.

Of course, you don’t have to sync all that. You can opt out of syncing certain things like history, tabs, passwords, etc. So if you want to sync history and bookmarks but don’t want to have your passwords backed up, it’s totally doable.

The data is also encrypted, so you shouldn’t have to worry about your data being exposed on Mozilla’s servers. If you’re truly paranoid, it gets even better. Individuals or organizations that would like to deploy Weave Sync without sending data to the Mozilla mothership can set up their own server. Yes, you can have your cake and sync it too!

The long term prospects for Weave are even better, though. Weave is actually being developed as a platform that will allow other extensions to sync data as well — so the possibilities for Weave are pretty exciting, if Mozilla can get the same kind of buy-in with Weave that they have with Firefox add-ons.

Finally, Weave also has a great story for mobile users. Weave also works with Fennec, the Mozilla Project’s mobile browser effort — so as users take up Fennec on mobile devices, they can sync with their desktop browser and mobile device. The most obvious advantage here is the ability to sync passwords with mobile devices to avoid retyping passwords on devices with tiny keyboards.

Overall, I was much more impressed with Weave this time around. Users who have a mobile lifestyle should definitely take the time to take it out for a road test. Some things remain unsynced (like extensions), but Weave Sync is a definite improvement over simpler tools like Xmarks.

From CAPTCHA to PICTCHA

Wednesday, October 14th, 2009
Captcha

Sample Captcha

Pictcha is an experiment designed to improve security over typical text-based CAPTCHAs and enhance image search.

CAPTCHA is an acronym for completely automated public turing test to tell computers and people apart. It ensures that an online transaction is being performed by a human rather than a computer.CAPTCHAs have been successfully used to distinguish people from computers by challenging users to decipher distorted text, a task that is relative easy for people but quite difficult for computers.
However, with the improvement of machine-learning algorithms, CAPTCHAs must be regularly updated to thwart would-be spammers.

Sample Recaptcha

Thus came the concept of ReCaptcha.About 200 million CAPTCHAs are solved by humans around the world every day. In each case, roughly ten seconds of human time are being spent. Individually, that’s not a lot of time, but in aggregate these little puzzles consume more than 150,000 hours of work each day. What if we could make positive use of this human effort? reCAPTCHA does exactly that by channeling the effort spent solving CAPTCHAs online into “reading” books.

In the Pictcha experiment, users are shown a randomly selected Web image and challenge them to provide two descriptive labels.Passing the test requires that at least one of the user-provided labels matches a known tag for the image. The collection of known tags is generated by previous users who have tagged the same image.Pictcha is currently in experiment stage.

Try a Pictcha demo here

Clean Without Fuss

Tuesday, October 13th, 2009

We partition our hard drive into sections & select one to install our favourite operating system. There is always a good chance that over time you find there is not much space left on it & reformating option comes into your mind to get rid of the unwanted data.I was in this situation myself with only 60MB space left on my C:Drive. And after using CCleaner I was left with 800MB! all it did was delete temporary files & stuff that has been cached.CCleaner is a freeware system optimization, privacy and cleaning tool. It removes unused files from your system – allowing Windows to run faster and freeing up valuable hard disk space. It also cleans traces of your online activities such as your Internet history. Additionally it contains a fully featured registry cleaner. But the best part is that it’s fast (normally taking less than a second to run) and contains NO Spyware or Adware! :) .CCleaner

Cleans the following:

  • Internet Explorer
  • Firefox
  • Google Chrome
  • Opera
  • Safari
  • Windows – Recycle Bin, Recent Documents, Temporary files and Log files.
  • Registry cleaner
  • Third-party applications
  • 100% Spyware FREE

Using the program is really quite obvious too. Just tick or untick the options you want to delete and click Analyse to tell you how much space you will create.CCleaner doesn’t support the large number of extraneous programs that some competitors do, but it can erase traces from such popular programs as Spybot – Search & Destroy and WinZip. CCleaner now offers secure file erasing along with a Registry-cleaning utility that quickly scans for invalid entries before removing them. CCleaner can even back up your Registry before removal, in case it accidentally removes a crucial component, and the download includes a rudimentary feature for uninstalling any program on your machine.Since this free application handles the majority of PC-cleaning chores and offers a nice extra .
Do be aware that things like auto logins on websites you visit regularly are stored as cookies in your browser software, and deleting them will mean you have to enter your password again next time you visit – if you can remember it, that is!.I strongly recommend CCleaner to all users, except those who need robust tools to remove supersensitive data.

Empathy for Pidgin

Friday, October 9th, 2009
Empathy for pidgin

Empathy for pidgin

The choice is yours.Such is the power of open source.But that doesn’t mean that there are no favourites.Vi editor is the most used text editor while open office remains the most powerful office suite platform.Gimp is a lovely image editor.And if we talk about Instant messaging client Pidgin has been ruling the roost. But things are moving fast, fast enough for Pidgin earlier known as Gaim(GTK AOL Instant messenger).

Empathy Screenshot

Empathy Screenshot

The new kid off the block is known as Empathy which rides on a new framework providing a real-time communication on Linux desktops.Empathy is another instant messaging program which supports numerous networks and has lots of features.The project was introduced into GNOME with release 2.24 as the desktop’s messaging client. Empathy was built to take advantage of the new Telepathy framework which enables system wide communication not previously possible.Empathy also utilizes libpurple (the same library as Pidgin) and as such inherited support for all of its networks from the onset. Although a young project, it has quickly grown an impressive set of features, including the geolocation of contacts and support for video and audio chat over both XMPP (Jabber) and SIP. The XMPP protocol is used by numerous networks, including Google Mail and is considered a very important feature of the application.

Empathy, which literally translates as ‘in feeling’, is the capability to share and understand another’s emotions and feelings. It is often characterized as the ability to “put oneself into another’s shoes”.

Telepathy framework has three main benefits:

Real-time: Telepathy supports instant messaging (both one-to-one and in groups), voice calls and video calls; it’s less suited for store-and-forward applications like email.

Unified: Many different programs can take advantage of these communications; Telepathy lets these programs work together.

Framework: Telepathy allows the different aspects of communication handling to be divided between different parts of the system, meaning each part is simple.

The GNOME project has adopted Telepathy into the environment so that all applications can have system-wide communication. Just where this technology will take the desktop is not yet clear, but the possibilities are endless. This simple game of Sodoku is a good example of what’s possible with the Telepathy framework.Due to its use of the Telepathy framework, Empathy can tie itself into the desktop far more closely than Pidgin ever could.As free software improves over time and applications come and go, it only stands to reason that what is a common tool today might not be tomorrow. The fact that there is lots of choice is naturally a good thing, after all, competition encourages innovation. It is sad to see Pidgin replaced in GNOME because it has been (and continues to be) a great instant messaging client.

Install empathy

s

The Future of Scalable Databases

Thursday, October 8th, 2009

For most of us database is synonymous to tables, tuples, SQL, RDBMS, or normalization, but is that what databases actually mean or is it beyond just the relational data-model? Relational data-model although the most popular and the most accepted data-model is not apt for all problems. And how far can we go by mapping all our problems on to the relational data-model. After certain table size eventually the database starts slowing down so we move towards replications via multiple configurations which obviously increases the operating expenses. Now when this is not enough we employ some expensive sys-admins to configure sharding for our database for which we require still more resources or pay a fortune worth of money to the “Big Guys” like Oracle and Microsoft to tweak our databases for performance. But is this the future of databases? I guess not. Let us have a look at what other database options which are not based on the RDM and are free from SQL:

  • MongoDB: It is a very high performance open source, schema-free document-oriented database.It provides a JSON like data-store mechanism which can free the software architects from the limitations of the RDBMS. It also supports full indexing including inner objects and arrays, dynamic queries, query profiling, efficient storage of binary data including blob data, replication and fail-over, auto-sharding for extreme loads and we thought MySQL was ultimate for databases?
  • CouchDB: It is a free and open source document-oriented database written in the Erlang programming language which is a functional language. It is well suited for local replications and vertical scaling. It again has a JSON data-store as documents which need not share a schema, but retain query abilities via views. Views are a combination of aggregate functions and filters and are computed in parallel, much like MapReduce. With bindings for many languages this is sure to become one of the most popular databases in the future.
  • Mnesia: It is a distributed database system written in Erlang. The data-store of Mnesia can be considered Relational but isn’t what someone familiar with SQL might expect. A database contains tables. Relationships between them are modeled as other tables. A key feature of Mnesia’s is tables can be reconfigured within a schema and relocated between nodes, not only while the database is still running but even while write operations are still going on which make both the read and write operations extremely fast and fault tolerant.
  • Cassandra: It is an open-source distributed database management system with a five dimensional Key value hash. It was developed by facebook and open sourced in July 2008. It provides a structured key-value store with eventual consistency. The major components of a Cassandra data-model are Columns, SuperColumns, ColumnFamily and KeySpace. It is considered as a Hybrid of the BigTable and Amazon Dynamo Key Value store. It is currently used by facebook, twitter and Digg.
  • HyperTable: It is an open-source database based on Google’s BigTable. It used HDFS (Hadoop Distributed File System) as a storage file system and is distributed.
  • Amazon Dynamo Key-Value Store: It is a proprietary high availability Key-Value data-store which has properties of both Databases and distributed hash tables. It powers parts of Amazon Web services.

So seeing these I am sure Relational Databases are soon to loose their share of importance when concerns like high scalability of databases arise.

Lessons in Twittering

Wednesday, October 7th, 2009

Today micro blogging & Twitter have become synonymous to each other. The service that lets you keep the world abreast of your doing in 140 characters or less. Such is twitter’s popularity that there are several businesses around the service, but Twitter itself has a little idea on how to make money. On the other hand, Facebook is growing rapidly & blogging is still not passe. Twitters, too,are yet to master all the rules of twitting. So here’s a”dos and don’t s” listtwitter logo

  1. Your Twitter account and your blog are private and reflect only your thoughts. But even if you run a disclaimer, your opinions can be reflective of a certain bias. Tread carefully on subjects that involve you or your company
  2. Take care about what your colleagues say. In an attempt to prove loyalty to you or the company, they can do far more harm than good. Have a proper ‘public engagement’ policy for your minions, and one for yourself.
  3. Do not under any circumstances get involved in a ‘flame war’ online. A ‘flame war’ happens when two or more people start arguing online. A long and sustained ‘flame war’ can damage your reputation more than mistimed punch.
  4. Don’t try and be too preachy either, because that would make anyone sound like a complete twit. So what if it is only 140 characters?
  5. You found something funny online and want to share it on Twitter or a blog? Go ahead, but please spend some time checking the antecedents of what you are posting. The Internet is full of sob-stories and hoaxes. Be wary.
  6. Different social networks serve different purposes. LinkedIn is for professional contacts and Facebook is for friends. Twitter is to tell people about what you are thinking or doing. People won’t add you because you know them.
  7. Follow back only if the situation demands,but a moderate ‘following’ list on Twitter also highlights your taste. Only new-bots and people with a highly exaggerated opinion follow virtually no-one.

JavaScript Best Practices

Monday, October 5th, 2009

I always wondered why developers have to get reminded again & again to follow something which common sense should drive. Quite a handful of developers who are about to read this series will also question the fact that this is so very obvious to follow best practices & just a sensible thing to do. However, the ground reality is something different. Getting code handed over to me from other developers  has taught me that common sense is actually quite a rarity in live code, and the “sensible and logical thing to do” gets pushed far down the priority list once you are in the middle of a project, and the deadline is looming. Its something which is spoiling the aesthetics of development.

Thus this decision to create an article which is an accumulation of the best practices & excellent advice gathered over my short but eventful career. I have amassed quite a few rather I have learn it the hard way. There will be lots of things to disagree with & that is the best thing-you should question what you read and thrive to find the better solution. But these practices have transformed me into a much more effective developer & wade me out of troubled waters whenever I felt the pressure to deliver.

This is going to be a series where I will be posting all my experiences while working with Javascript. Keep checking the posts for new articles or subscribe for RSS feeds for  updates.

Working with strings

Concatenating strings has been a major issue which Microsoft has been grappling with its IE browsers(both 6 & 7) because of questions on performance due to garbage collection. As rumors suggested Microsoft has addressed this issue to some extent though not fully in its latest release of Internet Explorer 8. But browsers like chrome & Firefox have a slightly more efficient way of handling things strings.

Consider this example:

?View Code JAVASCRIPT
1
2
3
4
5
6
7
8
var annualRevenue = 10000;
var  longStringMessage = 'My name is Janmejay Mohapatra ' +
'I work for Ajatus Software ' +
'Ajatus Software is a web design & development company '+
'Ajatus Software is based in Bhubaneswar ' +
'Ajatus has an annual revenue of '+annualRevenue+
'Ajatus Motto is to work for the masses '+
'And create a better web'

Instead of concatenation, use join:

?View Code JAVASCRIPT
1
2
3
4
5
6
7
8
var annualRevenue = 10000;
var  longStringMessage =[ 'My name is Janmejay Mohapatra',
'I work for Ajatus Software',
'Ajatus Software is a web design & development company',
'Ajatus Software is based in Bhubaneswar',
'Ajatus has an annual revenue of ',annualRevenue,
'Ajatus Motto is to work for the masses',
'And create a better web'].join();

Similarly, building up a string across conditional statements and/or loops by using concatenation can be very inefficient.
The wrong way:

?View Code JAVASCRIPT
1
2
3
4
var primeNumbersStr = 'prime numbers less than 100:';
for (var i = 0; i > 100; i++) {
     primeNumbersStr += i + ' = ' + checkPrime(i) + '';
}

The right way:

?View Code JAVASCRIPT
1
2
3
4
5
var strBuilder = ['prime numbers less than 100:'];
for (var i = 0; i > 20; i++) {
     strBuilder.push(i, ' = ', checkPrime(i));
}
var primeNumbersStr = strBuilder.join('');

Firefox Addons for Web Devs

Sunday, October 4th, 2009

Firefox, one of the most popular browsers, can be the best tool for a web developers at work.

The following are some of the most popular and useful Firefox add-ons for a web developer:

  1. FireBug: It is undoubtedly the best Javascript and CSS debugger created till date. The main components of Firebug are the console, the HTML inspection tool, the CSS Manipulation tool, the script debugging tool, the DOM inspector and the Net console. Each of these are extremely useful while creating or testing both static or dynamic web-pages. The console can be used to monitor all sorts of AJAX get or post requests, checking for headers, requests and responses sent or received in these requests, keeping watch on which script makes the AJAX call, etc. The HTML inspection tool can help check the HTML structure of the web page element by element as well as can help manipulate the styling for these elements and see the preview instantly, it also helps in checking out DOM manipulations made by the Javascript. The CSS, script debugging tools can be used to manipulate the script or the styling instantly.

  2. Measure It: As a web developer it is very common that we require certain dimensions of the page we created to be measured on the fly. The only way to do this till now was to take a screenshot and use a photo manipulation software to get the exact dimension of the page. But thanks to Measure It we now can take the measurement of any page or image opened inside Firefox just by clicking and dragging.

  3. Colorzilla: How many times does a web developer wish that he could use a color picker to get the color form the web page into hex. Now because of Colorzilla its possible on Firefox. Just select the color and check out the Hex code of the color in the bottom bar. The only con in this Add-on is that it doesn’t give an option to copy the hex code directly to the clipboard. But still its surely a life saver.

  4. Web developer Tool: The much acclaimed all in one web developer tool for Firefox. It is a mix of everything that a web developer might need to inspect his website. But the sad part is the presence of all options makes it lesser usable and more confusing for a first time user. Anyways some of its important tools are the disabling features which can disable almost anything on a web page i.e. from images to scripts, the Cookies feature which can be really helpful for checking the behavior and values of the cookies on a web page, CSS tool which has similar features to firebug but in a worser UI, the Form tool to manipulate and inspect forms on a web page, images tool used for finding broken, half loaded images, images loaded from different domain and to disable images. There are few more additional features as well but the UI undoubtedly could have been better.

  5. Resize Window: Any web developer knows 1024×768 happens to be one of the most common resolutions on which web sites need to look good but most web devs happen to have higher resolution screens so this add-on can help them to check out their website instantly on any resolution instantly by resizing their window.

So, if you are someone who is just entering the field of web development do not forget to load these add-ons onto your Firefox to turn it into the perfect web developer tool.