Linux Life-saver(tm)

I recovered yet another fatally crashed computer with a linux live cd and yet the term Linux Life-saver(tm) given to that Fedora live-cd!!  and the credit goes to that specific cd!!  My friend called me, worried about his just-uploaded video files.  And he didn’t have any other copy.  Using some weird program he wanted to optimize his computer, and his computer crashed with the next restart.  So he called me, and I told him put your fedora live cd in and boot your computer with that.  Then we recovered his files with ntfs-3g (now the credit goes to developers of this utility).  So I thought I would post it here on how we did it, very simple.

1) restart your computer with any linux live cd ( really, all of them would work )

2) install ntfs-3g and ntfs-config.  In fedora:

$ su -c ‘yum install ntfs-3g ntfs-config’

3) GNOME:  go to System > Administration > ntfs configuration tool

KDE 3.5:  Kmenu > System > ntfs configuration tool

KDE 4:  Alt+F2 ( run command ) and search for ntfs and click on ntfs configuration tool

4)  it gives you some choices of HDDs.  check the one you want to enable and click on Auto configure

5)  fire up a file manager and put into your computer a cd, or even better, a USB disk and start moving your files and backing up your windows drive!

Installing KDE 4 on Windows XP/Vista

today I ran across this very nice walk-through for installing KDE 4 on Windows XP/Vista.  Nothing to note here, you can run usual KDE applications on Windows too!!

a step a little ahead, gui with python/Tk

I just started to write a very very VERY simple phonebook for my own use. This is just a quick note, and I will keep you posted with snippets here and there. this link helped me get through understanding how I would go about doing it. Anyway, I’ll get started now, will post snippets whenever possible!

is that really prime?

so, today I wrote my second python script ( big accomplishment ) which just lists prime numbers. I put it in a file called prime.py so I might be able to use it later on!! This is how it looks like:

====================================================

#printing a range of prime numbers

def isPrime( n ):
	factor = n // 2

	while factor > 1:
		if n % factor == 0:
			return 0
			break

		else:
			factor -= 1
	else:
		return 1

def listPrimes( num ):
	for n in range( num + 1 ):
		if n > 1:
			if isPrime( n ):
				print n, 'is prime'

listPrimes( 100 );

====================================================

and that’s all there is to it! Well, just add the indentation yourself, I still haven’t figured out how to keep the indentation when posting scripts!

hahahaha and on a side note, I had to check all of the output numbers myself ( not thoroughly though ) just to make sure I didn’t make any mistakes in the script! funny way of debugging.

UPDATE: thanks to a fantastic blogger, Vlad Dolezal ( anamazingmind.com ) I’m able to keep the formatting of the code!

Enabling flash support for firefox in Fedora 9 for 64bit arch

ok, I admit, I got lost for less than fraction of a second ( literally ). what you do is simple, because there is no 64bit flash support from Adobe, you install the 32bit one and use it with 32bit version of nspluginwrapper. That’s all there is to it. To do that:

1) install adobe flash plugin from this link.
2) go to terminal and type:
su -c ‘yum install nspluginwrapper.i386′

3) go and test it and enjoy it!

and don’t forget to comment if it worked or not!

A fancy keyboard

Today I was typing a little bit and then I just wanted to move my mouse to some other place on the screen.  At that moment I remember the old laptops which had a dot in the middle of their keyboards and you could push that dot to a specific direction and then your mouse moved.  My uncle had that kind of laptops once I was just a little kid ( as if I’m so huge now! ).

Now, that, made me think that what if there were keyboards in which you had a small, very small dot in the middle of it and if you pushed it, your mouse moved, without the need to get your hand off keyboard and reach for mouse just for a little move.  It really doesn’t worth it!!  A good use of this ‘dot’ would be when you’re for example scripting, and you want to just open a file and keep typing.  Well, you could just get off the keyboard and move the mouse and do your stuff with it, or just set some shortcuts before hand and then use those shortcuts you made to reach your file, but it would be so much easier if you could just move your mouse with keyboard, a virtual, fast-accessed mouse right build into your keyboard.  If any of you have seen those old laptop I’m talking about, you have then a very clear idea of what I’m thinking.

The built-in mouse ( that ‘dot ) could be somewhere between Y, U, and H on keyboard.  It would make life soooooooooooo much easier, seriously.  Not just that, maybe some people just don’t like to use mouse ( e.g. me ) but NEED to use it for just a fraction of a second ( figuratively speaking ), then you could just use that ‘dot’ in your keyboard!!!

wouldn’t that be a good idea?  let me know what you think about it!

Learning python…

After quite some time not blogging anything, I though I would blog about my recent “success.”  Ok, you see it’s in quotes and that means it’s not generally a big deal.  Simply I started to learn python.  And I was able to write an addressbook (  I really needed one ) in just 4 hours, and with only 62 lines of code ( no OOP, only structured ). so, for a quick reference, I’ll just post it here.  it’s also good to say that it was written in less than 30 mins ( including debugging and including the fact that it was my first python script/program ).

=====================================================

#!/usr/bin/python

D = { }

name = ”
number = 0

print “For searching a particular phone# press 1″
print “For adding an entry press 2″

opt = raw_input()

if opt == ‘1′:
file = open( ‘adb.txt’, ‘r’ )

string = file.readline()
string = string.rstrip()

while string != ”:
rl = string.split()
fname = rl[ 0 ]
fnum = rl[ 1 ]

D[ fname ] = fnum

string = file.readline()
string = string.rstrip()

print “enter the desired name: “
name = raw_input()

for key in sorted( D ):
if key == name:
number = D[ key ]
print number
exit()

print “no entry found”
exit()

elif opt == ‘2′:
print “enter a name and a number: “
file = open( ‘adb.txt’, ‘a’ )
s = raw_input()

while s != ‘0′:
l = s.split()
name = l[ 0 ]
number = l[ 1 ]
D[ name ] = number

file.write( name )
file.write( ‘ ‘ )
file.write( number )

s = raw_input()

exit()

else:
print “inappropriate option”
exit()

======================================================

so, that’s it, 62 lines.  It still feels strange to not put if, while, for statements in blocks {}  but I will get used to it.  The indentation syntax is also good, I thought I wouldn’t like it, but turned out that it makes the code easy to read.  Not much difference though, I still did the same thing with C++.

Anyhow, that’s enough for today, I’ll keep you posted.

looking for some web space

Okie dokie, I haven’t posted anything for a while, mainly because I was busy AGAIN with compiling KDE 4.1 trunk.  I finally did it, successfully!  I just followed the tutorial at techbase!

Anyway, as I was waiting for this to compile, I wrote two useful scripts, each one only 60 lines.  One of them is a bash utility which you give a directory as an argument to it and then it backs up that folder and sends it over to a remote server ( the server should support sftp ).  It’s good for example if you have another computer and it supports sftp, and then you want to back up your files and send it over, but do not want to waste a whole amount of time on this!  It’s annoying when you have to back up everything.  Though, what I do is that I have a backup folder in my home directory, and then I put everything in it, and then I just run this script.  And it will replace the old version, which is good!!!

The other one is a c++ program that converts a string of characters ( a line of text ) into binary form!  This is also useful because sometimes I want to send some things in ‘code style’ ( being fancy here )!  Anyway, it was fun, at least I didn’t waste my time doing nothing :)

So now, the problem is: I don’t have anywhere to upload these two guys ( read: files ) so you could also use them!!  Does anyone know where can I upload them?

The real reason why we use linux

I was looking looking around the net when I ran across a very interesting post on why do some people use linux! People who use linux usually say because it’s secure, free, and because it’s customizable. But is that why we really use linux? Those reasons are all valid, though, but for us linux users, there is something more to linux than just security and customizability ( put the freedom concept aside ).

I personally have multiple reasons to use linux. One being that other OSs simply just don’t do things the way I want. Another on being that sometimes I’m curious about what is going on inside that program I’m using, so I check out the source code to see what is going on. I like using terminal, it’s fun!! There are many other reasons why I use linux which I can’t remember now, but I agree with every bit of this post by Vlad Dolezal.

Shell history meme

following the planet Fedora’s race for who got the higher number, I’ll do mine too.  My numbers are nowhere close to those numbers, but it’s fun.

armin@blk-215-88-124:~> history | awk ‘{a[$2]++ } END{for(i in a){print a[i] ” ” i}}’|sort -rn|head
32 cd
29 exit
19 ls
14 su
13 vncviewer
13 g++
10 sftp
7 vim
6 fluxbox-generate_menu
6 ./calc

‘calc’ is the name of a single-source-file, very simple but very handy calculator I’m working on to make life calculations easier!

« Previous entries