Sunday, 25 May 2008

Where is my GRUB?

On the Gentoo mailing list, a nice thread evolved a way to find where did you install your bootloader last time. The question is less trivial than it seems - is it on your disk MBR or on your partition? If you have a non-obvious setup, you may forget... and if you try to upgrade/reinstall GRUB without remembering where it is, bad things can happen.

The solution is:
for i in /dev/[hs]d*
dd if=$i bs=446 count=1 2>/dev/null | strings | grep -q GRUB \
&& echo "GRUB found in $i"

Saturday, 24 May 2008

The hacker's paperclip.

On Slashdot, I found a comment giving little, good tips on how to solve annoying hardware problems with a paperclip.

The power supply tester
Creation: Unbend a paperclip, and then bend it into a big U shape.

Usage: When you are unsure whether a PSU works (a) disconnect it from anything it is connected to (b) insert one leg of the U into the hole in the 20/24 pin motherboard power plug for the green wire (c) insert the other leg into a hole for a black wire (d) plug the PSU into power and turn it on.
If the fans spin up, then the PSU at least partially works. At this point you can use a multimeter to verify the voltages of the different rails with no load.

The CD ejector
Creation: Straighten a thick-gauge (strong) paperclip, and then put a loop in one end that is big enough to put your index finger through, at least to the first knuckle (this helps with gripping it during use).

Usage: When you need to eject a CD from a powered-down computer (laptop OR desktop), push the paperclip into the emergency eject hole. On a laptop, this requires very little force, but on a standard (5.25") Desktop CD-ROM drive, this will take quite a bit of effort.

The multipurpose grabber
Creation: Straighten a regular paperclip, and put a loop on the end, as you did for the CD Ejector. On the other end, put a 90 degree bend, 2mm from the tip.

Usage: You can use this tool to remove or move jumpers (very handy for IDE hard drives), and to remove stuck floppy disks from floppy drives (use the R/W hole or 1.44MB hole as an anchor point).
Credit must be due to beav007.

Monday, 12 May 2008

EPS files and pdflatex

There is this odd quirk in LaTeX. The latex executable compiles your .tex files in the old-fashioned DVI format. As such, it accepts by default only .eps (Encapsulated PostScript) images. pdflatex compiles your .tex files in the standard PDF format. For some mysterious quirk, pdflatex accepts raster formats like .png and .jpg , but does not accept .eps!

Sometimes you want the best of both worlds. An undergraduate of my lab, after some googling, found you can force pdflatex to insert .eps files happily:

1)Install texlive-extra packages, or any other package containing the epstopdf utility.

2) Insert the following code in your .tex file:

\DeclareGraphicsRule{.eps}{pdf}{.pdf}{`epstopdf #1}

3) Compile using pdflatex with the -shell-escape command line option

It seems to work.

Sunday, 11 May 2008

Templates for CD jewel case cover in SVG - free

A quick useful link. If you need to do a CD jewel case cover and if you, like me, are an Inkscape addict, bookmark this link. These are beautiful templates for doing CD/DVD covers in SVG (Scalable Vector Graphics) format, free to download. Thanks to Kevin Deldycke for releasing them!

Saturday, 10 May 2008

Create a .tar.gz archive

Ok, this is admittedly really noobish. But it's something I always forget. While the tar -xzvf spell for unpacking archives is well known, only seldomly I need to create archives.

However, here's the magic:

tar -pczf name_of_archive.tar.gz /path/to/directory

That's more a reminder for me...

Thursday, 1 May 2008

Find and delete broken symlinks

The Gentoo guide to switch from tetex to texlive contains a little command line gem. It allows you to look for broken/dangling symbolic links and delete them interactively:

find /usr/bin -type l ! -xtype f ! -xtype d -ok rm -f {} \;

Friday, 29 February 2008

The trouble with Facebook

It's only a couple of weeks I joined the Facebook network, and even if I find it handy, I certainly cannot be said to be a Facebook addicted and/or fanboy. To me, Facebook it's just a Myspace done right: while Myspace is a slow, disorganized, nearly unusable mess, Facebook has a clear, elegant interface and it is not prone to the horrendous, Flash-ridden bloating of most Myspace pages. Apart from that, Facebook is neither good nor wrong in itself: it is just a social networking tool, with defects and advantages.

I found only today an article of this January on The Guardian about Facebook, pointed out by a friend. No matter how you can hate social networking sites or Facebook itself, the article is a startling example of the inability of a journalist to understand Internet, social networking and the implications behind that.

Mr.Tom Hodgkinson, for a start, just cannot grasp the concept of social networking (or of instant messaging, or email, or the phone, for his arguments apply to nearly every communication protocol you can use to chat with friends). Its article starts like that:Why on God's earth would I need a computer to connect with the people around me? Why should my relationships be mediated through the imagination of a bunch of supergeeks in California? What was wrong with the pub?

If it was for people like Hodgkinson, the Internet should not exist: what was wrong with the library? Here's what's wrong with the pub, mr.Hodgkinson. You can't reach the pub with your friends if your friends live on another city, or continent. I almost have no Facebook contact from my hometown in Italy. I have Facebook contacts of close friends that now work in other Italian cities, in Japan, the United States, Belgium or Holland. Try call all of them in the "pub".

Problem is, Mr.Hodgkinson does not simply misunderstand Facebook. He simply doesn't understand the Net. Here's how he continues: And does Facebook really connect people? Doesn't it rather disconnect us, since instead of doing something enjoyable such as talking and eating and dancing and drinking with my friends, I am merely sending them little ungrammatical notes and amusing photos in cyberspace, while chained to my desk? A friend of mine recently told me that he had spent a Saturday night at home alone on Facebook, drinking at his desk. What a gloomy image. Far from connecting us, Facebook actually isolates us at our workstations.

Mr.Hodgkinson: if you don't like communicating with friends with the Internet, well, don't use that. But telling that "it disconnects us" is so amazingly self-contradictory I had to read that a bunch of times before being sure. Connecting with people, at least for me, is primarily talking with them, exchanging ideas, news and good laughs. You can do it in real life, of course, but there's no reason you can't do that online.

I use to compare it with music. Surely, live music is good, and is a different experience from music on CD. But saying that you're disconnected from people because you are not in physical proximity with them is almost the same to say that recorded music is not "real" music, because you're not actually a few meters apart from a guitarist.

This is without delving into the fact that meeting people on the Net often means to build close relationships in real life too. I had and have real life relationships (even romantic ones) that started on the Internet. I went "eating,dancing and drinking" with these people, and spent unforgettable moments with them, but I wouldn't have never been able to do it without the Internet. I wouldn't ever have known them. Mr.Hodgkinson, how many social occasions have you lost by going everyday to the same pub with the same friends, instead of knowing new ones on the Internet?

And finally, we don't always want to go outside eating,dancing and drinking. I often prefer to stay at home, drink some tea, and chat with close friends in the warmth of my room, with some good music. So I can relax, I don't have to think about coming back home, weather, and the like, I can do other little stuff in the meantime, and keeping contacts with my friends. Try do that without Internet.

Hodgkinson continues: If I put up a flattering picture of myself with a list of my favourite things, I can construct an artificial representation of who I am in order to get sex or approval.. How clever, Tom! But do you need Internet to do that? Can't I just, ehm, cheat in real life too?

And now, here's a pearl: It also encourages a disturbing competitivness around friendship: it seems that with friends today, quality counts for nothing and quantity is king. The more friends you have, the better you are. You are "popular", in the sense much loved in American high schools. So, basically, what Tom is telling us is that Facebook is bad, just because kids on it behave just like they behave in their high school. I agree that the "quantity over quality" thing is superficial and stupid. But, sadly, that's not Facebook (or Myspace, which is infinitely worse in this sense) fault. It's just fault of people using it. It's people using Facebook that have that sense of popularity. Facebook doesn't push you to add kilotons of friends: in fact, on Facebook you usually add people you already know in real life.

In the second part, Hodgkinson goes on a long piece on the personalities behind Facebook. He takes on Peter Thiel, showing him as a ruthless, activist, libertarian neocon. Now, there are a few political movements I despise as much as neoconservatism. Really. Give me Nazism everyday instead of neoconservatism. Yet the fact I disagree with the political campaigns of Facebook stakeholders doesn't make me disagree with Facebook. Facebook is a tool. It works. It may have been done by neocons, Islamic fundamentalists, evil clowns or alien abductors, ok, but: who cares? Tom Hodgkinson not only cares (I suppose he asks the supermarket guys what do they vote, to be sure his money doesn't go in the pockets of people he wouldn't like), but he goes forward, by connecting ties and saying that, behind Facebook, there is the BIG EVIL PLAN: Facebook is a deliberate experiment in global manipulation.

Wohoo. Now, I agree that surely there is a lucrative social networking industry, and that this industry can manipulate you. Just like every other media, like radio or television broadcast, or newspapers and magazines, or advertising, can do. But frankly, Facebook seems the lesser evil in this case. Facebook doesn't bombard me with propaganda or biased information (like TV and magazines routinely do). Facebook doesn't ask me actively to buy stuff. Facebook doesn't incite hatred (quite the contrary). If there is an evil message being slitherily conveyed by mean of Facebook networks, well, let me know.

The article then fires against target advertising. Here Hodgkinson approach to the Net is just unexplicable. It tells you basic, obvious facts, but with an overtone like "DON'T YOU SEE HOW EVIL IT IS!!!1!". It basically boils down on this: Facebook can target advertising with far greater precision than a newspaper. Admit on Facebook that your favourite film is This Is Spinal Tap, and when a Spinal Tap-esque movie comes out, you can be sure that they'll be sending ads your way..

I don't know for sure, but what Tom is saying looks suspiciously like: "OMG! Advertising! And advertising that is currently being targeted at my interests! So I could find myself in the cruel, painful situation I actually find something I like, instead of happily wasting time with ads I would never care about. How bad, a win-win situation! And while we're at it, we don't even mention that it is Google that actually made it mainstream, when Facebook still didn't exist."

And here's the end, enlightening indeed: Why would I want to waste my time on Facebook when I still haven't read Keats' Endymion? And when there are seeds to be sown in my own back yard? I don't want to retreat from nature, I want to reconnect with it. Damn air-conditioning! And if I want to connect with the people around me, I will revert to an old piece of technology. It's free, it's easy and it delivers a uniquely individual experience in sharing information: it's called talking.

I'm all for reading books (and I admittedly should have done it, instead of replying to this pile of bullshit). I understand a bit less the purpose of seeding random things in the backyard and avoiding air-conditioning (try that in the Mediterranean summer), but oh well, anyone has his own little perversions. About talking-only communication protocols, sure, it's cool. If you still feel that the world is something that doesn't exceed the boundaries of your backyard, of course.