Downloading the web folder

November 2, 2011 Leave a comment

People generally ask “how can we download the whole web-server?” They keep looking for different softwares to do this but they forget that they already have one, inbuilt (generally) in their very own Linux system. All they have to do is to run

wget -H -r –level=1 -k -p <http://domain_name/address_of_the_folder>

to download the folder. You can change your level of recursion for download by changing the value of level according to your needs. That’s it! You have your web folder ready with you.

The Must Have in Linux

October 3, 2011 4 comments

Everytime I install a distribution of Linux (generally Fedora) on someone’s system, the first question that the owner asks me after the installation is what other software he may need apart from the ones already installed. Well, this post is more about those extra applications. This post covers almost everything that one may need. If you feel, I have missed out on something, you can add a comment and I will add that up in this list.

Autoplus+ 

I start off with this simple script that will help you get rid of most of your headache. Flash, Google Earth, Skype, audio-video codecs, VirtualBox, Imagination, DropBox – It installs just about all the daily usage things. The only catch is it works only for Fedora.

Chrome

The browser that you just cannot miss on is Chrome. Yes, Firefox is already there on most of the distros but you just cannot miss this one.

Guake/Yakuake

A drop-down console that keeps your terminal on your fingertips. While Guake is meant for Gnome, Yakuake is meant for KDE.

(VideLAN)Vlc

It’s like the list is never complete if you don’t see VLC there. This amazing open-source player is almost on all the systems be it a Mac, Windows, Linux or any other UNIX implementation.

Amarok (with gnome plugins)

Talk about songs, one just can’t forget Amarok. Though intended for KDE desktops, it works equally well on Gnome. The lack of multimedia key support in Gnome can also be done away with the gnome multimedia keys script.

Xchm

Again Okular is there to support the .chm files, but it comes no way near xchm. Try it to to see the difference.

XBMC

XBMC media center is another open-source media hub for the TV experience on your laptop. The skins are so beautiful that you will definitely fall in love with it.

VirtualBox

This freely available virtualizer is a must for any geek (be a tech or non-tech). Try new operating system or run a Windows software, you will definitely find this handy.

VMware

Another virtualizer but with extra command over hardware which thus leads to higher data transfer speed. Even the network(ing) and the network configuration are also easier.

Qemu

Qemu is both an open-source emulator and virtualizer. If you are a tech geek, you must give this a try.

Wine

Wine lets you run your Windows applications straight on your Linux. Though not an emulator in strict sense as it does not emulate each processor instruction as any other emulator would, it provides the software libraries which Windows software may require during installation. It still is under active development.

Unrar 

This will add the rar codec for extracting the rar archives.

CbrPager/Comical 

A comic book geek? Well, these cbr and cbz readers are definitely for you.

JDownloader

If you are a heavy internet user who downloads stuff from rapidshare, mediafire, hotfile or any such file-sharing sites everyday, then this download manager will be a boon for your daily dose.

GoldenDict

As name says, it is a freely available dictionary which will always be running in the notification area for your help.

NetBeans

This is a fully-fledged IDE, completely written in Java. PHP, Java, C/C++, Groovy or Ruby – you can do your development with this IDE.

HandBrake

HandBrake is an open-source media converter with a clean and simple interface. You can also convert your media files to the mkv container format.

GParted

GParted is a partitioning software to create, resize, move, delete, format and reformat your partitions. It can also format a partition with NTFS file system.

RecordMyDesktop

RecordMyDesktop is a desktop session recorder which is both easy to use and configure. It comes in both command-line and GUI mode.

TrueCrypt

A powerful encryption software that can be used to create on-the-fly encrypted volumes and partitions/drives.

Super Grub Disk

This will come in real handy when you are in need of a System rescue. It will help in restoring your boot loader.

And as a download manager don’t forget to add DownThemAll to your firefox.

One more thing that I would like to add is that, while configuring your ppp modem, the libusb1-devel rpm/deb file is generally missing on your system. So, don’t forget to install that before you start configuring your ppp modem.

I also felt like including the softwares like GIMP, Brasero, ffmpeg, Totem, OpenOffice/LibreOffice, Transmission/KTorrent and nmap. But they generally come bundled with almost all the distributions. Well, you may also enlist your recommendations in the comments if I have missed on a few. I will re-update this list accordingly. :)

The annoying ‘yum Error’

June 17, 2011 Leave a comment

One of the most annoying error that I have faced on Fedora is the yum error:

Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again

After a lot of googling and going through forums, I have made a list of solutions that can fix this problem.

-> Sometimes, you may face this error just after a fresh install. It can be fixed then by
yum clean all
yum clean metadata
yum clean dbcache

It can also be helpful even in the cases when yum was working just a few hours back and suddenly the problem rose and you have no idea why.

-> One of the most common fix is editing the fedora repo file. The fix is uncomment the baseurl line and comment the mirrorlist and then edit the /etc/hosts file adding

80.239.156.215          mirrors.fedoraproject.org
213.129.242.84          mirrors.rpmfusion.org

Well it’s is the most common fix. But, it has never helped me.

-> Another fix is disable the repo that causes this erro and then do the yum update. This was what I found in some forums but none of the solution-seekers were satisfied. One can though try this. It might be just as helpful.

-> Sometimes you may need to fix the rpm db. Type
rpm -vv –initdb
If one still gets an error, he can further do
rpm -f /var/lib/rpm/__db*
rpmdb -vv –rebuild

-> If behind a proxy, one may have forgotten to export the proxy settings. He can do so by
export HTTP_PROXY=http://username:password@IP:port
export FTP_PROXY=http://username:password@IP:port
For permanent solution to text internet, one can create a proxy.[c]sh file in /etc/profile.d/ and type
export HTTP_PROXY=http://username:password@IP:port
export FTP_PROXY=http://username:password@IP:port
export http_proxy=http://username:password@IP:port
export ftp_proxy=http://username:password@IP:port

and then log out and log in.

And for yum, add
proxy=http://username:password@IP:port
to /etc/yum.conf and do the update.

Categories: Uncategorized Tags:

Compiling Hadoop codes

November 2, 2010 26 comments

After wandering for around a month and a half and pulling my hair off my head, it feels good when the work starts heading in a definite direction. Understanding how hadoop works and then start coding for it are miles apart.

One of the problems that I faced in coding was I couldn’t compile any of my hadoop codes that I wrote, not even the one that were given in the books. The error that came up looked something like-

xyz.java:5: package org.apache.hadoop.fs does not exist

import org.apache.hadoop.fs.Path;

^

xyz.java:6: package org.apache.hadoop.io does not exist

import org.apache.hadoop.io.*;

^

and so on..

The basic problem is the classpath. We need to set the classpath to compile our codes because hadoop library files are yet to be integrated so that they can be referred during compilation. This can be done by-

$ javac -classpath hadoop-common-0.21.0.jar <filenam.java>

you can add -verbose option to the command-line so that you can actually see what’s going on during the compilation.

Though I did this on Linux, but it doesn’t really matter on the OS. The same syntax applies even to Windows.

With this you are done with compilation of your hadoop code. Jar your files and then execute them.

Categories: hadoop Tags:

From my older blog: Quantum Computer-An Introduction

September 28, 2010 6 comments

I wrote this article some 2 years back on my older blog. Now, since I made a shift of blog, I thought of including this particular article from my older one and since I am including this here after such a long span, I have added a few things and modified it a bit.

A guy once asked me that what is my limit to find a number’s nth root. I replied that I can find only the square roots and my speed is very slow. He then said, “Dude, you are not just slow, you are also very weak with numbers. Shakuntala Devi found the 24th root of a number so long that it might take you one whole minute at your fastest reading speed to read it, in mere 50 seconds and that too exactly! Shocked?!”

This is a simple example that shows that there exists many shorter and simple algorithms that we need to implement to make calculations easy.

Quantum computing is trying to implement all these algorithms. One of the newly found algorithms – Shor’s algorithm can increase calculations’ speed exponentially. By a few 1994 algorithm methods, it would take 8,00,000 years to factorize 250 digit number & 1025 years to factorize 1,000 digit numbers. Recently, a new algorithm was developed which can do this in few million steps.

A quantum computer is a device for computation that makes direct use of quantum mechanical phenomena, such as superposition & entanglement, to perform operations on data.

A classical computer has a memory made up of bits where each bit holds either a one or a zero. A quantum computer maintains a sequence of qubits (quantum binary digits). A single qubit can hold a one or a zero or importantly, a quantum superposition of these. In general, a quantum computer with n qubits can be in up to 2n different states simultaneously in contrast to single state occupied by normal computer. This is to say that in quantum phenomena, if there were 10 pens in front of me, and if I were asked which pen am I going to use for writing, the reply would be all 10 simultaneously. Interesting, isn’t it?

Simplest implementation of qubits can start with two spin states – “up” and “down”. Rest all states for a given qubit would be formed by a combination of these states only. But the fact is that any two discrete and sufficiently spaced consecutive Eigen values can be used for implementation of qubit like +1/2 and -1/2 or +1 and -1 or 0 and 1 on our number system.

For a two-bit register on a classical computer, the computer at any time is in any one of the four possible states – 00,01,10,11. Since, they are just discrete non-negative numbers (p,q,r,s), their probability adds up to give one.

But, when we consider a two-qubit register, we get a 4-D vector (p,q,r,s) called a wave function with complex coefficients. This complex coefficient brings the difference between the two vectors – one obtained from classical computation & the second vector of quantum computing. Now, since, this happens to be a wave function of complex coefficients, the sum of squares of coefficients’ magnitudes add up to give one. Being a wave function, superposition principle comes into play and we get interference pattern between different computational paths.

To say in simple words, in quantum computing we would have to keep track of all 2n complex coefficients for our system to manipulate data.

Quantum computation preserves the Euclidean norm, i.e., their sum of squares adds up to one. Generally, the quantum computational operations are rotations. Since, any rotation can be reversed, quantum computations are reversible.
After computation, a classical computer gives a definite two-bit string as a result. On the other hand, a quantum computer destroys the original quantum state. Quantum algorithm gives the result with a certain probability of accuracy. But, by repeated computation, we can get the most accurate answer (more or less like the one we do with the help of Numerical Analysis).

A quantum computer can very efficiently break many of the cryptographic systems in use today. They can also break through many of the so-called secure web-pages and emails. Thus, a quantum computer can be a very effective tool in breaking a large cryptic key and decrypt the code.
There also exists quantum cryptography that uses digital signature schemes to protect the data.

The attempt to guess the secret key makes a quantum computer a severe attacker on symmetric ciphers such as Triple DES & AES.

Not only this, quantum system problems (related to physics & chemistry) can also be solved by the help of quantum computing. It has been estimated that these computers can speed up the problem solving approach to such an extent that a year taking problem could be solved in seconds.

NMR techniques are the evolution of quantum computation. Molecular magnet and fullerene-based ESR computer can be future generation quantum computers. Some other future generation quantum computers can be Bose-Einstein condensate-based and spin-based quantum computers.

One thing that you would have marked in this article is that everything that I said that Quantum computer can do is written as “can” do. I mean I just suggested a possibility. This is because we directly work on atoms and the quantum entanglement which is not easy to control. And, you know the best part? The world record, until last year, for quantum computation was set by IBM and the problem was “3 * 5 = 15″! Yes, you read it right. The reason this was a landmark was that the computation was done totally on atoms utilizing its wave nature. Even a minor disturbance hampered the system.

With some advances, a supercomputer, JUGENE, did factorization on 42 bit quantum computers.

Going off the topic, a researcher recently developed a new form of chess that makes it difficult for even a supercomputer to estimate the opponent’s next move, thus helping a human to atleast let him compete.

Ending it, for the lovers of these two fields, quantum physics and computing, this definitely is a place to be and for the guys who want to do a research, this is the ideal platform to begin because the potential is huge and you have almost everything to discover and develop.

Categories: Uncategorized Tags: ,

Using Windows Management Instrumentation(WMI)

August 29, 2010 2 comments

Planning of scripting for Windows? The command shell, the Windows Scripting Host (WSH) and the Windows Management Instrumentation (WMI) provide a nice infrastructure for this.

The Windows command shell is better than ever (though I will say that UNIX still rules the chart when it comes to the shell that a UNIX administrator will gain access to). One can rapidly perform the task when the GUI capabilities aren’t required.

WSH is more an administrator tool, as per Microsoft. One can install almost any scripting engine that he wishes and get started with it. It just provides an environment for the scripts to run. Technically, it has no big and unique scripting feature. Though, I am not that big a scripting guy, I wont comment much on this.

The Windows Management Instrumentation almost gives you power to handle almost everything, right from your computer hardware to event management architecture to scriptable APIs. Yes, it’s a bit complicated to learn. A better alternative is wmic, a command-line interface, which comes with full documentation. With the short aliases, one can easily shorten lengthy WMI calls. A short simple example- let’s say that we have to see the number of processes running on my system and the amount of space they occupy. Type wmic on the command prompt and then type

process get name, workingsetsize

The output generated would be:

                          wmi

Now, one may ask why should we go for wmic when we can actually view this in Windows Task Manager and that too just with a few clicks, just no use of any freaking command? Well, now imagine you are sitting in a network and want to know what are the processes running on a node, say node1. You will just have to write /node:switch which is followed by the remote system’s name and then type this very same command.

/node:“node1”

process get name, workingsetsize

Want to delete a process? Type

process where name=<process_name> delete

or you can try the UNIX equivalent command

process [pid] delete

Well, the output format is tougher to read in this normal format. One can, therefore, view these outputs in both Excel or HTML format too. I personally prefer HTML among these two. To view the output in HTML format, one has to write

/output:E:\process.html

process get name, workingsetsize /format:htable

The output generated can be viewed by opening the web page ‘process.html’ which looks like

                                         wmi-html

For Excel, the format switch becomes csv.

Basically, everything that we do in wmic is decided by the verbs that are associated with its classes. The available verbs are

ASSOC Outputs Associates of the wmi object
CALL Executes a method
CREATE Creates a new instance and helps in setting its properties
DELETE Deletes the instance of the class
GET Retrieves the information about specific properties
LIST Lists the concerned data
SET Helps in modifying the properties of an instance

One can even manage the system configuration options with wmic. For an instance, let’s try

bootconfig get

The above command shows you the boot directory, configuration path and other related stuff.

As simple as that! Well, you can use WMI in GUI mode too. Just type wmimgmt.msc in command prompt and then go to the security tab in the properties of WMI control to handle the root directory.

Well I won’t talk all technical stuff because simply put, it’s almost impossible to talk about it on this very page. New shell options like Windows PowerShell are also available. Until I try it and write again, wmic can give you kick-start if you want to be a network administrator or try it simply because you love playing with your system.

The All Task Manager (blogosphere’s so called God Mode)

April 17, 2010 Leave a comment

One of the coolest features that Vista incorporated was All Task Manager. Though unknown to almost all of its users, this is one cool feature that will bring down the whole of Control Panel to your feet and that too according to your convenience.

Take a sneak peek in one such manager. :)

All Tasks

The only thing that I did was created a new folder and named it as “I am God.{ED7BA470-8E54-465E-825C-99712043E01C}”. :D Well, you can give any name instead of “I am God” :D totally your wish.. But, the code (CLSID) should be same (there is no space between the ‘.’ and the CLSID).

With this simple tweak, the power is now on your fingertips.. not hidden somewhere in your pocket so that you will have to dig in and find out to use it! And, this is just one! There are in fact 50+! And among them 24 surely work on Win Vista and 38 on Win 7 without any extra support. The best part is that these shortcuts automatically detect their icons without setting it externally. Other remaining managers do require some extra support (hardware/software).

All Tasks Manager

This snap shot is a collection of all those tweaks that work on Win Vista and later. Those which work on Win 7 and upcoming versions are snapped below.

Win 7

Hard luck XP users! Windows has no such support for you guys.

Listing down all such CLSID is tough. I will better give you the link where you can find out all the canonical names (this is what MS calls it).

Link –> click here.

Be GOD of your Windows and have fun and do drop your comments. :)

The lettered programming languages

March 27, 2010 1 comment

A - array oriented language
B - almost extinct. It was essentially BPCL, made to write the coding for UNIX
C - well known
D - re-engineering of C++
E - pure object oriented model for secure distributed computing
F - subset of Fortran
G - more famously know as LabVIEW (I don’t know how famous it is.. never heard of it :P ) and the interesting part- there is one more programming language Deesel which first called itself G and is still sometimes referred as G
H - no such language I came across
I - no such language I came across
J - developed for mathematical, statistical and logical analysis of data
K - mixture of APL and a functional programming language
L - not sure, Wiki says many languages call themselves L and googling also gives the same answer
M - built by MS for building textual domain-specific languages
N - no such language I came across – but we have n prolog
O - no such language I came across
P - no such language I came across
Q - interpreted, functional programming language
R - statistical computing and graphics and it is an implementation of S programming language
S - obvious from R, S is also a statistical computing language
T - a dialect of “Scheme” programming language to test the thesis developed by Steele and Sussman
U - no such language I came across
V - AI based. It’s being developed. The best I came across. You just don’t have any syntax :)
W - new form of assembly language that isn’t actually an assembly language. It’s type-less and has no keywords. The only ‘type’ it has is ‘word’ (hope you would have understood why I called it type-less :) )
X - declarative, functional and imperative programming. You just have to write what you want. I don’t know how exact is it in it’s claim.
Y - used for peephole optimizers(remember the optimizers in compiler design? more or less the same thing). I am waiting for my ACM account to know more about it.
Z - stack based with its main motto being performance

Damn!! What the heck? Don’t these guys find any other interesting name for the languages? Now what? 1,2,3,4.. (sleeping 8 ) ?

Factorial Number System (factoradic)

March 25, 2010 10 comments

Once while surfing through Wikipedia, I came across a new kind of number system – Factorial Number System. Also known as factoradic, this number system is most apt for permutations. Like 10 is the base in decimals, 2 in binary, factorials are the bases in factoradics(though not in true sense because it is a mixed radix number system; the factorials just provide the values for a particular digit’s place).

As a brush up, mixed radix system are the numeral systems in which the base varies from one place to another. This is to say that the base value varies from what it was for ones digit to what it will be for the tens digit to that for hundreds digit. The table below will make the idea clearer. For the digit at ones place, the base is 0!, for tens it’s 1!, for hundreds it is 2! and so on.

base 8 7 6 5 4 3 2 1
place value 7! 6! 5! 4! 3! 2! 1! 0!
in decimal 720 360 120 24 6 2 1 1

A point to be remembered is one should keep in mind that a digit can’t be placed at a position if it’s numeral value is greater than or equal to the base. This is to say that one cannot place 1 at ones place or 2 at tens or 4 at the thousands place.

So how to write these factorial numbers is what comes next.

Suppose we want to write 16 in factorial number system. Now, we can write 16 = 2*3! + 2*2! + 0*1! + 0*0!

So, 16 in decimals becomes 2200.

We often drop the last 0 in this system because the last position can only be occupied by 0 which is obvious. So, you may write 16 as 220.

The obvious: 54321 is the largest factoradic for 5 digits (or 543210 if you include 0 too in the system in 6 digits).

Now, a question arises why should I prefer a new number system when we have many others along with us which keep bugging? Well the reason would just satisfy you. This number system helps us in finding the permutations more easily and efficiently.

The kth permutation of order n can be written in mere seconds. Suppose that we have to write 9,99,999th permutation of 10th order permutation which is 2,78,39,15,460. The mere hit and trial is definitely going to give a hard time.

With factoradics, the only thing that we gotta do is write the factoradic for 9,99,999. We find that 9! = 362880 and 10! = 3628800. Clearly, we don’t require the 10! in our answer as 10! – 1 = 3628799 > 9,99,999. Now, 999999/9! gives 2 as quotient. Now, we are left with 2,74,239. Continuing this, 2,74,239/8!, we get 6 as quotient and 32319 as remainder and so on. Thus, we get 9,99,999 as 2,66,25,12,110 in factoradics (including 0!).

The set for which we have to find the permutation is {0,1,2,3,4,6,7,8,9}. We have to permute them in such a way that the string thus generated contains every digit without repetition. We are going to select the corresponding digit of the factoradic from the remaining set to write the required permutation. The process will be easy to understand with the illustration below.

2                                                     6                               6    —>    1            1      0

|                                                      |                                |    —>     |             |      |

(0,1,2,3,4,5,6,7,8,9)–>(0,1,3,4,5,6,7,8,9)–>(0,1,3,4,5,6,8,9)—>(0,4,6)->(0,6)->(0)

Thus our 9,99,999th permutation becomes 2,78,39,15,460. In seconds as I said!

Not just in string permutations, factoradics also help in encryption system, block ciphers being one such example. I wont dwell a lot in that again. Moreover, I read somewhere that in this system , e (exponential) can be represented as 10.1111.. and π (pi) as 11.1010101.. Though, I am not sure about these claims.

But there are still some problems with it. You need to have large set of numbers to represent very large numbers. After 9 we use A,B,C,D.. Z for integers upto 35. Well, one can use subscripts to represent larger numbers with subscipts to represent their base, e.g., 2423020for 16 but even that is cumbersome. Next, representation of decimals is again something to be worked on. Though after a small googling, i found that a guy did propose how to write decimals -

an*n! + an-1*(n-1)! + … + a2*2! + a1*1! + a0*0! + b1/2! + b2/3! + … + bn-1/n! + …

where ai represents digits before decimal while bi represents digits after decimal. How? That will lead this blog haywire! So, I will better leave that. Though this proposal does give an instance where we can get e = 10.111.. as e = 1/0! +1/1! + 1/2! + 1/3! + ..

Concluding note – all cryptographers should know this simple basic concept because this method accomplishes their task elegantly and with almost no pain (at least in comparison to the labor applied without this knowledge).

How to copy files from someone’s system (which is protected too, obviously) without letting him know?

February 21, 2010 5 comments

I once faced a problem in booting that showed a NO READ HEAD error. Now, that error sounds really horrible because if there is really a no read head, you definitely gonna have a real hard time. But I guess it actually didn’t mean what it actually said because when I inserted my OS boot-DVD in the DVD drive, it read that :) I started the booting process.

But, before that I tried the repair process that was on the DVD. After starting the repair process, a System Recovery Options window popped up. It had two buttons – Load Drivers and Next. What we are concerned here with is Load drivers. On selecting that, an Add Drivers window pops up. It’s a confirmation window with buttons OK and Cancel. We select OK and again a pop up Window appears, that says Open. Well actually, it’s for opening the particular drivers that you think is missing during booting process. But, it has a bug. Yes you are right! It’s here where you gonna do your copy and paste work. Just open the drive (C:, D:, E: whatever) that contains the file to be copied and copy the file and paste that in your pen drive.

Done with this remove your pen drive and Shut Down the system. That’s it!

There is also a Send to option. But it has no path specified, making it useless.

The biggest advantage is – it doesn’t require any file to be Shared with Everyone to be accessible. And, your user would never come to know that a file was actually copied as you didn’t boot the original OS. So, even the event manager would show nothing to the user if he uses that.

Categories: Hacks
Follow

Get every new post delivered to your Inbox.