Fix: Internet Explorer 6 div height when less than 20px

Empty divs in IE6 seem to have a minimum height more or less equal
to the current line-height so if you want to have an emty div of 10px for example IE will render it as
being 20px in height.

To fix this add a html comment inside the div:

<div id=”smalldiv”> <!– –> </div>d

:)

Leave a Comment

HowTo: Find Extensive Hard Disk Info on Linux

If you want to find additional information on your hard disks in linux you can use an utility called: hdparm.

If you can’t find this utility install it using apt-get on debian: apt-get install hdparm

then at the console type: hdparm -I /dev/sda an it should list something like this:

/dev/sda:

ATA device, with non-removable media
Model Number:       ST31000340NS
Serial Number:      9QJ365N0
Firmware Revision:  SN05
Transport:          Serial
Standards:
Used: unknown (minor revision code 0×0029)
Supported: 8 7 6 5
Likely used: 8
Configuration:
Logical         max     current
cylinders       16383   16383
heads           16      16
sectors/track   63      63

CHS current addressable sectors:   16514064
LBA    user addressable sectors:  268435455
LBA48  user addressable sectors: 1953525168
device size with M = 1024*1024:      953869 MBytes
device size with M = 1000*1000:     1000204 MBytes (1000 GB)
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec’d by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16  Current = 16
Recommended acoustic management value: 254, current value: 0
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
Enabled Supported:
*    SMART feature set
Security Mode feature set
*    Power Management feature set
*    Write cache
*    Look-ahead
*    Host Protected Area feature set
*    WRITE_BUFFER command
*    READ_BUFFER command
*    DOWNLOAD_MICROCODE
SET_MAX security extension
*    48-bit Address feature set
*    Device Configuration Overlay feature set
*    Mandatory FLUSH_CACHE
*    FLUSH_CACHE_EXT
*    SMART error logging
*    SMART self-test
*    General Purpose Logging feature set
*    64-bit World wide name
*    Write-Read-Verify feature set
*    WRITE_UNCORRECTABLE_EXT command
*    {READ,WRITE}_DMA_EXT_GPL commands
*    Segmented DOWNLOAD_MICROCODE
*    SATA-I signaling speed (1.5Gb/s)
*    Native Command Queueing (NCQ)
*    Phy event counters
*    Software settings preservation
*    SMART Command Transport (SCT) feature set
*    SCT LBA Segment Access (AC2)
*    SCT Error Recovery Control (AC3)
*    SCT Features Control (AC4)
*    SCT Data Tables (AC5)
Security:
Master password revision code = 65534
supported
not     enabled
not     locked
not     frozen
not     expired: security count
supported: enhanced erase
196min for SECURITY ERASE UNIT. 196min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000c50010f8c3d0
NAA             : 5
IEEE OUI        : c50
Unique ID       : 010f8c3d0
Checksum: correct

Leave a Comment

Apache not reading .htaccess

I had this problem on a client’s server. Apache was not reading the .htaccess files thus mor_rewrite was not working. After i did a few searches i found out that the Directory settings in the apache configuration hat AllowOverride None as directive instead of AllowOverride All.

I made the change, restardet apache and all went as it should.

Leave a Comment

Samba: Can’t browse domain computers list. The network path was not foud.

I’ve ran into this situation while configuring a samba domain. I’ve searched for hours in forums and in google and found lots of causes for this issue. In my case i had the following:

i could ping the domain clients using their netbios name ( my pdc was also running as a wins server )

i could acces the clients by using their netbios name ( eg. \\netbiosname )

I just couldn’t browse the domain ( the list with computers on my domain ).

The problem was caused by samba working only on port 445. I’ve enabled samba to work on port 139 also and the error was gone.

Leave a Comment

HowTo: rename a samba domain member computer from registry

I had the difficult task to reorganise a medium network in a factory. Inbetween all the operations i had to do i also had to rename all the computers in the network and organise them by departments. Now this wouldn’t be such a headache unless all the computers are in a linux domain. As you probably know when joining a domain, every computer gets a “computer account”. If you want to rename the computer you have to disconect the computer from the domain, reboot it, rename the computer, reboot it again, re-join the domain and reboot again to be able to login and have the new computer running in the domain again. This really sucks when you have to deal with 50 computers or more. Here’s the solution i found to do this.

REMEMBER! THIS WORKS WITH A LINUX SAMBA DOMAIN running with a TDBSAM Backend, If you have a WINDOWS DOMAIN or a LINUX DOMAIN with LDAP BACKEND this WON’T WORK !!!! Also this howto was only tested with WINDOWS XP. I don’t know if it’ll work in vista but i think it should.

First of all you have to login to the computer with a local administrative account ( eg. Administrator ).

Go to -> Start -> run > and type regedit.

Go to this key: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName]

Under Computer Name you’ll have 2 subfolders: ActiveComputerName and ComputerName, and in the 2 subfolders you’ll see the key ComputerName with the value being your current computer name. Change both of these values to the new name you want for your machine.

Reboot. ( this is the only time you need to reboot ).

Go to your linux domain controler and search for the smbpasswd file. This file stores both the computer and user accounts. Find your old computer’s name in this file. It should look something like this :

GKOO$:1396:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:578E3D23GF5C1AA7588D3295281282EB:[W          ]:LCT-00000000:

Change it’s name to the new name you assigned previously to your windows machine. Be sure to keep the $ mark at the and of the name ( the $ sign means this account is a machine account not a user account ) and also all the other numbers following your computer name.

Next create a machine account on your linux box with the new computer name:

useradd -s /bin/false -d /dev/null gkoonew$ ( remember to always attach the $ sign to your machine account name ).

That’s it you should now be able to login to your domain with the new computer name. If you can’t watch the samba logs, they’ll tell you a lot. Also you can remove the old machine account from your linux users database to keep things more organised.

Good luck, GKoo.

Leave a Comment

SSH Password Prompt Timeout

When try-ing to ssh into a linux server from a machine that doesn’t have reverse dns setup you might fall intro the situation where your ssh connection times-out befor you get the password prompt.

In this case, on the server, in sshd_config add the following line to solve your issue:

UseDNS no

Leave a Comment

HowTo: force umount a busy device in linux

Here’s how :

When you try to umount the regular way, if a device is busy you’ll get the following :

dev:/# umount /dev/sda1
umount2: Device or resource busy
umount: /boot: device is busy

This can be solver very easy by entering this :

dev:/# umount -l /dev/sda1

Comments (1)

Useful iproute2 comands in linux

While reading the Link Advanced Routing and Trafic Control howto i decided to extract a list of useful commands, in case i forget them later. I’ve posted them here for whoever finds’em useful.

ip link show - shows the available interfaces on your machine

ip address show - shows the IP addresses attached to your interfaces.

ip route show - shows the available routes on your machine.

ip neigh show - shows the current information in your ARP cache.

ip rule - shows the routing tables active on yout machine.

ip route list table table_name - lists the rules available in a specific table

ip rule add from 10.0.0.1 table table_name - adds a new rule in the table_name table.

ip route add default via 200.100.50.25 dev eth0 table table_name - adds a default route on a specific table.


Leave a Comment

HowTo: Test the link on your network cards in linux

If you work remote and want to test if the link is up or not on your linux interfaces use mii-tool.

If the thing is not already installed on your machine, if you run debian simply use apt-get install mii-tool . After the tool in installed just type mii-tool in your console.

Example:

server1:~# mii-tool
eth0: negotiated 100baseTx-FD flow-control, link ok
eth1: negotiated 100baseTx-FD, link ok
eth2: negotiated 100baseTx-FD, link ok
eth3: negotiated 100baseTx-FD, link ok

Leave a Comment

HowTo: write circular text with php and gd

I had a project in which I had to generate an image based on a string. The problem was that the text had to be displayed circulary. After hours of internet searching I’ve came across http://www.phpgd.com and found this piece of code which did the job quite nicely.

<?php

$text = “Around and around around and around and around “;

$image = imagecreatetruecolor(400,400);
$white = imagecolorallocate($image,255,255,255);
imagefill($image,0,0,$white);
$red = imagecolorallocate($image,255,0,0);

$degrees = (360/strlen($text));

for ($i=0;$i<strlen($text);$i++) {

$a = ($degrees*$i)+180;

$cos = cos(deg2rad($a));
$sin = sin(deg2rad($a));
$x = 0;
$y = 180;
$xt = round($cos*($x) - $sin*($y));
$yt = round($sin*($x) + $cos*($y));
imagettftext($image,20,180-($a),200+$xt,200+$yt,$red,”fonts/arial.ttf”,$text[$i]);

}

header(”Content-type: image/jpeg”);
imagejpeg($image,”",100);
imagedestroy($image);

?>

Here is the direct link to the script http://www.phpgd.com/scripts.php?script=25. You might look through the site because there are other many interesting scripts which may come useful in your projects.

Enjoy!

Leave a Comment

Web Brands