Site moved

25/02/2009

We are currently on a temporary website. It might take a few months until I can move the blog back to its own website.

For now, cuadradouno.com.ar is dead.

uTorrent: How to Share Between Ubuntu and Windows

27/01/2009

While Ubuntu (Wine) and Windows can both run uTorrent, it’s not that easy to keep one copy. Say, for example, that you want to use uTorrent on a Flash drive (USB stick). You run with the problem of having a Z: drive in Wine, which most likely won’t be anything like the structure in Windows (even if you simulate or change the drive letter.)

For example, I have set a partition under a folder in Ubuntu, so the torrent destination path in Wine is Z:\partition\Torrents

In Windows, I can only point a drive letter to a folder, but not the other way around!

I wondered if Windows had anything similar to symbolic links. I figured I could point a drive letter to a folder, then put a symbolic link to the folder, to simulate the path in Wine.

Apparently, it’s not well-known, but there are symbolic links in Windows. They’re not documented, and you need to buy a Microsoft software kit, which includes special tool to create them. They’re also called something else: junction points.

Fortunately, there’s a freeware GUI program that can do this for you: Junction Link Magic. It’s a very small download!

Create a virtual drive

subst Z: C:\vdrive

The vdrive folder is a placeholder, we’ll never actually see vdrive. Create a folder called partition inside Z: (C:\vdrive\partition).

Use Junction Link Magic

Create a link from Z:\partition to the actual partition drive.

When you browse Z:\partition, you should see your Torrents folder.

Now, you can safely run uTorrent from the USB stick, and it won’t notice a thing!

Facebook Dev: You CAN use your localhost as test server

07/01/2009

This might be obvious, but if you don’t want to have a test server online because Facebook doesn’t seem to allow “localhost”, all you need to do is edit your hosts file.

Yep, it’s THAT simple. Here are the locations of the hosts file on different systems.

All you need to do is add an entry:

127.0.0.1      http://www.myfbappwebsite.com

This should only be used for the very first stages of your site development, as it doesn’t allow any other users. It also might not be team-friendly. In that case, you can use a dynamic DNS service and use a temporary URL in the App’s settings.

Note: It’s possible that if you’re behind a router and you use a dynamic DNS service, *you* will be shown your router’s control panel. Confirm this with a trusted friend before giving away the temporary URL. Once you’re sure only you can see your router’s control panel, correct this issue locally by using the hosts file solution above.

Ubuntu: Show Directory Names in Bash

26/12/2008

This is a very short tip.

I made a small shell script to delete and create a link to my localhost htdocs directory. That way, I never have to move my projects around, I just keep them in separate directories under one main directory.

The problem comes when I forget important things: such as directory names. Instead of just typing ls /projects, I want the script to tell me the options I have.

And so, this little code is born, by not giving the script any arguments:

#!/bin/bash
	if [ -z $1 ]
	then
		echo "No valid user was provided!"
		echo "Possible users:"
		declare -a FOO
		let count=0
		let count2=0
		for d in $( find /projects -maxdepth 1 -type d -printf "%f " ); do
			if [ $count2 -gt 0 ]
			then
				FOO[$count]=$d
			fi
			((count++))
			((count2++))
		done
		echo ${FOO[@]}
	fi

Note: I did it this way because otherwise you get “projects” in the list of results.

Ubuntu: Intrepid Ibex “breaks” the random wallpaper script

14/12/2008

I posted the random wallpaper script a couple of months ago, and some time after that I upgraded my system from Hardy to Intrepid, and found out the script wasn’t working.

Since it was not something important to me, it took me a while to start searching for a solution.

The problem is not a bug, it’s a change made to gconf.

Fortunately, someone was able to find a workaround to those changes. It only involves creating a shell script, setting it to start every time you log in (it will create a file called .Xdbus in your home path), and then you modify your crontable so that the .Xdbus file is called before your script.

Once you log back in, you should see the wallpaper being changed again! :D

Ubuntu: Get VisualBoyAdvance fully working with Wine

10/12/2008

If you miss VisualBoyAdvance’s cheats systems (GameShark, CodeBreaker/ActionReplay, and the memory editor) and you really don’t want to use Linux-based ports because they lack this feature, you’re in luck!

Let’s see the versions:

Wine (development version): 1.1.10
VisualBoyAdvance: 1.8.0-beta3 Read the rest of this entry »

Ubuntu: Your Custom Command PHP Script

31/10/2008

While it’s obvious for experienced users, I’m sure many newcomers to Linux might be wondering how to have a command like chmod, mv, ls, etc.

In other words, a command that accepts parameters, switches, and does interesting things in a language we all love and understand.

First of all, we’ll try phpLipsum, my newest CLI script. I wanted to have a way to access lipsum.com without any fancy GUI, just a quick command.

At YubNub.org they have online commands (very useful!), this command was the one I needed on my computer.

Handling the switches should be easy enough. We’ve seen this before, in previous articles. ;-)

$data = @file_get_contents($url) or die("\nError: Could not download the data.\n\n");
$xml = simplexml_load_string($data);

Once we have our URL built, we can make SimpleXML parse the XML for us. The text will be available through $xml->lipsum.

echo $xml->lipsum;

To make it a little bit easier on the eye I did this:

echo "\n    ".wordwrap(str_replace(".\n", ".\n    ", $xml->lipsum), 80)."\n\n";

This way, the text will be formatted nicely on the CLI. And the spaces shouldn’t affect its appearance on HTML!

Once our script is done, we make it executable. Remember how?

chmod +x lipsum.php

But I wanted to use it like this:

lipsum -a 2

So, we move it to /usr/bin/

sudo cp lipsum.php /usr/bin/lipsum

Note: You can move it (mv) or copy it (cp). I chose to copy it, so that I can keep a backup.

Now, we can finally have our own “command”! It’s quite easy and practical, and we haven’t abandoned our dear PHP. <3

Download phpLipsum

DreamHost: Promo Codes

30/10/2008
  • 2FREEDOMAINSWOOT: gives you two free lifetime domain registrations
  • GOOD4LESS: gives you some discount in the final price
  • TENPCENTBONUSDIS: gives you 10% more bandwidth and space, 1 free lifetime domain registration, and a $15 discount in the final price
  • TENPCENTBONUS: gives you 10% more bandwidth and space and a 1 free lifetime domain registration
  • DULCEDELECHE: gives you 20% more bandwidth and space, a 1 free lifetime domain registration, and a $16 discount in the final price
  • MOAR4ME: gives you 40% more bandwidth and space
  • 4FREEDOMAINSWOOT: gives you four free lifetime domain registrations

Ubuntu: Automatically Sort Firefox Downloads (Beta Code)

26/10/2008

IMPORTANT: This is still in testing mode. Should you try this, make sure the download is not important. If you have a monthly limit of downloads or a low bandwidth, wait and see until I have done more tests! I’ll try to keep this post updated.

You probably have heard of the famous “cron jobs” – be them from your web hosting service or your own Linux computer. In fact, I’ve covered how to use them both in Ubuntu and in Windows XP, with PHP scripts. A cron job lets you execute a command at a desired time. However, there is also incron, which stands for inotify cron. incron monitors your file system for changes, and executes a command on a specific action. Say, for example, every time a file is deleted, a script is called to log the affected file’s name and its deletion time.

Read the rest of this entry »

Ubuntu: OpenOffice.org 3.0 DEB archive

13/10/2008

OpenOffice.org is a powerful free open source alternative to Microsoft Office. As the newest version came out today, the OpenOffice.org site was so strained they had to shut it down! They only use the front page to show all the downloads, for now. But for a while, some people reported it was completely offline.

Here is a mirror for the Gzip archive with all the Deb packages needed to install OpenOffice.org 3.0. It’s for Debian-based Linux distros, so if you have Ubuntu or Debian, this is what you need.

Note: I would recommend uninstalling the OOo version that comes with Ubuntu, as it might conflict with the new version.

OOo 3.0 asked me if I wanted to start afresh or import settings from OOo 2.x… So maybe you can keep the old version, import the settings by running OOo 3.0 once, then uninstalling OOo 2.x.

Important: If you’re new or not in a rush, you could wait until it’s available in the Ubuntu repositories.

Once you extract the contents of the archive, open the Terminal in the directory where all the Deb packages are, and run the following command:

sudo dpkg -i *.deb

Enjoy!