HowTo: Install guest additions for VirtualBox on Debian Lenny 5.0

I have the following setup. The Host machine is running Windows Vista 64 with VirtualBox.

I’ve installed Debian Lenny 5.0 from a NetCD and now i want to install the guest additions modules. The guest additions are very useful because they have a lot of usability features like: copy-ing/pasting from the guest system to the host sistem, you can fly the mouse pointer in and out of the guest system and so on.

On the VirtualBox menu go to Devices and click Install Guest Additions. This will mount a virtual cd in your linux guest system. Go to your cd-rom ( which also has the guest additions for windows ) :

cd /cdrom and run ./VBoxLinuxAdditions-x86.run.

You might get an error about installing linux kernel headers and build packages. That can easily be solved by using apt-get :

apt-get install build-essential linux-headers-`uname -r`

the ‘uname -r’ will autocomplete the kernel needed kernel version.

After this rerun the ./VBoxLinuxAdditions-x86.run and it should all go well. Reboot the debian system and enjoy the magical guest additions.

Leave a Comment

HowTo: Disable yellow colored inputs in firefox because of google toolbar

You might have noticed that once installed, google toolbar will automatically fill with yellow the e-mail inputs in your nicely developed website. Now this might be ruining your design and functionality when you’ve got a dark background and a light color for the inputed text ( white or yellow ).

You can easily get rid of this so called “feature” by adding the following in the css style for your input:

background: #(your own color code) !important;

Adding “!important” will force the browser to use your code instead of the google toolbar color.

Enjoy !

Leave a Comment

dk_eom(): resource unavailable: d2i_PUBKEY_bio() failed

Ok, i’ve gotten this error while trying to implement DomainKeys on one of my servers.  I’m using a debian etch with postfix amavis and dk-filter for signing emails. The errors i was getting in the logfiles were:

dk_eom(): resource unavailable: d2i_PUBKEY_bio() failed
SSL error:0D06B08E:asn1 encoding routines:ASN1_D2I_READ_BIO:not enough data

After searching a while over the internet i’ve figured out i was getting this error because the selector TXT DNS record was incomplete. I am using ISPconfig3 with MyDNS and the MyDNS field in the ispconfig database was limited to 116 characters. The TXT DNS record had 230. I had to modify the database structure.

This error can also occur when you copy/paste the public key from your public key file to the dns record. Be careful not to have any white-spaces or line-breaks in it.

After fixing your selector wait for the dns to refresh so it’ll see your new dns record.

Hope this helps you out cause i lost half a day trying to figure it out.

Leave a Comment

mydns: out of memory: Cannot allocate memory error

MyDNS was working great on my machine until i’ve decided to implement DomainKeys and DKIM support for my e-mail system. As you probably know DKIM and DomainKeys require a long TXT record with a public key to be inserted in the DNS.

MyDNS started giving me problems when i was query-ing the DNS for this TXT record which has around 230 characters. MyDNS was crashing with the following log entry:

mydns: out of memory: Cannot allocate memory

The solution for this was replacing MyDNS 1.0.0 with the brand new MyDNS-NG ( Next Generation ) 1.2.8.26. Everything came back to normal now and It’s working like a charm.

You can get the mydns-ng 1.2.8.26 from here : http://sourceforge.net/projects/mydns-ng/

Leave a Comment

HowTo: Completely Remove Debian Applications With apt-get

I have a testing server on which i fool around and test things.

I had to completely remove postfix from my server to reinstall it using other settings. Here’s how i did it :

apt-get –purge remove postfix

This will completely whipe out postfix from your server along with it’s dependencies.

I’ve been looking over for this for a long time. Hope it helps you too.

Leave a Comment

HowTo: Restore action to open instead of search on drive click ( Windows XP )

I presume this applies only to Windows XP but you can also test on Vista.

Sometimes, for example if you try to change the default icon on a drive in windows ( by the way icon’s for drives can’t be changed like that ) you select a new icon and apply it. You will notice that the default action when clicking on a drive in windows becomes Search ( Find ) instead of Open. That is really annoing isn’t it ?

Well here’s the solution for you :

type regsvr32 /i shell32 in the command prompt ( start / run / cmd ).

It’ll get fixed in no time :)

Comments (1)

HowTo: Start Task Manager in a Remote Desktop Session

Ctrl + Alt + delete on local session will give you the option to open the task manager, but what about if you are remoting into another server ? If you press Ctrl + Alt + Delete in a remote session it will pop up the Task Manager for your local station.

Ctrl + Shift + Esc opens Task Manager in a Remote Session

Leave a Comment

HowTo: manually install .deb packages:

This process only installs the downloaded .

deb package. If the package has dependencies, you may need to install them as well.

First, download your .

deb package via wget or whichever method you prefer. Then on the terminal type dpkg -i packagename.
deb
(replacing packagename with the name of the package).

That’s it ;)

Leave a Comment

HowTo: Create Picture Thumbnails with PHP and GD

Hi, first of all I’d like to wish you all a Happy New Year. Hope you enjoyed your holidays, because I know most of us are now behind the desks again, working.

Now, here’s a nice PHP plugin you can use to generate thumbnails in PHP. It’s called phpThumb and you can get it from phpthumb.sourceforge.net.

First of all take note that this plugin uses the GD or ImageMagick library so be sure you have at least one of them installed on your server/host. I’m using GD and it works just fine. ImageMagick has some extra features that I didn’t need, so be sure to check the official site for more details.

How To use phpThumb:

Copy the contents of the plugin somwhere in your site’s directory ( eg. /lib/phpThumb/ )

Rename the phpThumb.config.php.default to phpThumb.config.php. I didn’t modify this config at all but you might take a look inside it if you’d like to setup various parameters.

Having that done you can easily generate thumbnails like this:

<img src=”lib/phpthumb/phpThumb.php?src=nameofthefile.jpg&w=150&h=50&zc=1″  alt =”someText” />

w stands for width of course and h stands for height. zc means zoomCrop.

The plugin has a lot of other options and tweaks to play with, check’em out here.

Enjoy

Leave a Comment

URL rewriting with .htaccess

If you’re looking for this, you know why you need it. But just in case you’ve stumbled upon this and are curious, URL rewriting is useful for several reasons:

1. Accessibility: most people will rather remember a path that looks like http://www.example.com/products/shoes/12/ than http://www.example.com/index.php?category=products&type=shoes&productid=12

2. Security: granted, this is security through obscurity, but at the very least it will hide from most users the server-side technology used (PHP, ASP, etc) and the passed variable names

3. SEO compliance: Web crawlers work by following links and caching the content found; however, they don’t parse anything beyond the filename, so generally index.php?category=products, index.php?category=pages and index.php are seen as a single address, index.php. On the other hand, /products/, /pages/ and / are seen as 3 separate folders, and your content will thus be indexed correctly.

So, you’re thinking “Yes, that would be nice” (or alternatively, “Yeah yeah,get to the point already”). What do you need?

Well, first of all, your pages have to be hosted on an Apache server. Since over 50% of the servers in the world run on Apache, that shouldn’t be a problem.

Secondly, it should have mod_rewrite activated. This is a bit trickier; most hosts have it on by default, but you should probably check with your host.

Finally, a good grasp of regular expressions helps, but isn’t mandatory.

So,  for basic URL rewriting, create a new file containing the following:

RewriteEngine On
RewriteRule ^$ index.php
RewriteRule ^([a-z0-9]+)(/)?$ index.php?page=$1 [NC]

This assumes, of course, that your paging is driven by  a variable called page :)

Save this file as .htaccess

Please note that .htaccess is the actual extension of the file, the filename being blank. If you save it as, for instance, .htaccess.txt, it will not work.

Here, the first line activates mod_rewrite. The second line redirects all incoming requests to index.php. Finally, the last one takes any input, followed by a slash or not, case-insensitive, and redirects it to index.php?page=[the input]

You should however be careful with this, as a user with malicious intent might exploit this. Thus, in your code, you should sanitize all the inputs, or, in case you only have a few “main” pages (such as About, Tutorials, Links and Downloads, for instance) you could modify the last rule thus:

RewriteRule ^(about|tutorials|links|downloads)(/)?$ index.php?page=$1 [NC]

This can be further modified, adding whatever RegEx you need. So, you use our first example, you can write

RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/([0-9]+)(/)?$ index.php?category=$1&type=$2&productid=$3 [NC]

I hope you found this useful :)

Update: For RegEx goodness, have a look at this article Mike Malone has posted: The absolute bare minimum every programmer should know about regular expressions

Leave a Comment

Web Brands