ponedjeljak, 4. srpnja 2011.

Best linux distribution for Asus EEE PC (900)

I had my Asus EEE pc 900 lying around and almost never used it, because it was slow while running Windows XP. So I decided to try some linux distribution. I found #! ( http://crunchbanglinux.org/ )and I was a bit sceptical at first. I installed it on my 4 GB SD card. I installed it from USB stick which I created with unetbootin ( http://unetbootin.sourceforge.net/ ).
Installation passed without a problem and all hardware was detected (Wow!!! :)
Because it is based on debian, apt-get work also.
I used liquorix kernel that setup offers to install.
My web n walk stick for broadband internet works out of the box :)
Wine works perfectly ( I needed for Mikrotik managing program winbox.exe , even mac detect devices (wow) )
Only little problem I found that default speaker volume was muted, so you have to bring up the volume in mixer.
CRUNCHBANG comes with Chromium browser, and flash player. Youtbe videos are working without a glitch on my 900 mhz Asus EEE 900.
All in all, if you need a distribution for your asus eee, go with CRUNCHBANG :)

Debian: How to send and read SMS with your web n walk stick

If you have T-mobile web n walk stick, witch is Qualcomm 3g CDMA model GIO255 and you want to send sms this is the way:

first check is the device detected:
:~$ dmesg
....
usb 3-1: new full speed USB device using uhci_hcd and address 6
usb 3-1: New USB device found, idVendor=0af0, idProduct=6971
usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-1: Product: Globetrotter HSDPA Modem
usb 3-1: Manufacturer: Option N.V.
usb 3-1: SerialNumber: Serial Number
usb-storage: probe of 3-1:1.0 failed with error -5
hso 3-1:1.0: Not our interface
usb 3-1: USB disconnect, address 6
usb 3-1: new full speed USB device using uhci_hcd and address 7
usb 3-1: New USB device found, idVendor=0af0, idProduct=6971
usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=4
usb 3-1: Product: Globetrotter HSDPA Modem
usb 3-1: Manufacturer: Option N.V.
usb 3-1: SerialNumber: Serial Number
hso0: Disabled Privacy Extensions



then you should look in /dev/ for device ttyHS*

:~$ ls /dev/ttyHS*
/dev/ttyHS0  /dev/ttyHS1  /dev/ttyHS2

For sending sms you will be using /dev/ttyHS0.
Now you can install and run gammu or wammu

apt-get install gammu

or

apt-get install wammu

You can reconfigure gammu with sudo gammu-config

So as port you should use /dev/ttyHS0 , then save and that is it.
You can test it with 

sudo gammu getallsms


petak, 29. travnja 2011.

Connecting to your virt-viewer from Windows

First, you have to install Xming, you can dowload it from here.
After install start it with:


>"C:\Program Files\Xming\Xming.exe" -ac -multiwindow -clipboard    or on a 64-bit system...
>"C:\Program Files (x86)\Xming\Xming.exe" -ac -multiwindow -clipboard
  Notes: using -ac is TOTALLY UNSAFE
now, connect to your linux(ubuntu, debian...) machine with ssh.
After that in shell enter:

DISPLAY=your.windows.ip.address:0.0

export DISPLAY

Dont forget to change your.windows.ip.address to your your windows ip address :)


after that you can start any Xwindow application, and for your virtual viewer you can write:


virt-viewer -c qemu:///system your_virtual_machine &

Linux software raid and S.M.A.R.T monitoring

If you want to monitor SMART settings on your debian/ubuntu system you will have to install

apt-get install smartmontools

If your SMART is disabled, use this command to test them

smartctl -s on -t short -d ata /dev/sda
after that you can check status with

smartctl --all /dev/sdb


To check status of your raid you can do

mdadm --detail /dev/md0 

ponedjeljak, 14. ožujka 2011.

PHP: verifying username and password with LDAP

here is a simple example how you can verify username and password with ldap


        $ldaphost = "aai.host.com";
        $ldapport = 389;
        $ldapconfig['basedn'] = 'dc=host,dc=com';

        $ds = ldap_connect($ldaphost, $ldapport)
        or die("Could not connect to $ldaphost");
        if ($ds)
        {
                $username = mysql_real_escape_string($_POST["user"]);
                $upasswd = mysql_real_escape_string($_POST["pass"]);
$dn="uid=".$username.",".$ldapconfig['basedn'];
                $ldapbind = @ldap_bind($ds, $dn, $upasswd);
                if ($ldapbind) {
$ok=true;
echo "Password OK!<br>";
} else {
echo "Password invalid!<br>";
$ok=false;
exit();
}
}


subota, 12. ožujka 2011.

PoE (Power over ethernet) with Mikrotik Routerboards

If you want to connect your RB411, RB433, RB711Hn or any other routerboard that has POE enabled on it ports, and do not want to buy PoE injectors, this is how you can connect it if you have power supply with 12V or any other that is specified for your device.

NOTE! This is only for simple 100 mb PoE, not for IEEE 802.3af devices! They need special electronics that negotiate with 802.3af injectors.

100 MB ethernet uses only 4 wires out of 8 wires that are in standard ethernet cable. There are 4 pairs of wires and they are orange, green, blue and brown. For T-568B Straight-Through Ethernet Cable you use wiring like this:

In 100MB ethernet, blue, blue-white, brown and brown-white are not used, so they can be used to transfer power to device. For routerboards, blue wires are positive and brown wires are negative.

So how do you connect?
You crimp your cable like on picture above (using T-568B standard) and near place you want to connect power adapter you remove the insulation (only the outer white layer that are around all wires) and cut blue and brown wires. Then you remove the insulation from them, but only on ones that are going to your routerboard, and connect blue and blue-white together, and brown and brown-white together. Then you cut connector from your power supply and measure what is positive and what is negative wire. You can do that by using voltmeter(place range to 20V or more DC-direct current, black wire to ground, red wire to voltage measurement) and placing one wire on black and another on red wire. If your voltmeter show +12 or any other voltage, then connect wire that was on black wire to brown and from red wire to blue. On the other hand, if your voltmeter shown -12V then you should do the opposite: wire that was connected to red connect to brown wires, and wire that was connected to black connect to blue wires.

Here is how I connected to my computer. I used +12V from my computer as power supply from molex connector:

Here you see orange and green wires go to connector and other 4 wires go to molex connector connected to my power supply.Other end of UTP is connected to routerboard 411, crimped as shown in first picture.