anything

fixing monitor problem on zoneminder

After installing Zoneminder, some people (including me) reported that they had a problem with monitor. A black screen, or even no picture / video at all. From logs, it’s usually said: “Can’t get shared memory id…” or “Shared memory invalid…”, something like that. Especially when we’re using a webcam.
After googling, i found some solutions for this. First, increase the shared memory, and second, edit zmdc.pl file.

1. Increase shared memory maximum

Open the file “/etc/sysctl.conf”, and paste this 2 line at the bottom of the file.

# Increase the maximum shared memory
kernel.shmmax = 167772160

save, and restart your machine.
If still no luck, continue to the next step:

2. Edit zmdc.pl

We need to edit zoneminder source to point the video driver.
Open file ” /usr/bin/zmdc.pl” (the location on some machine, might be different)
and add this code, right before the “my @daemons =….” (about line 64).

$ENV{LD_PRELOAD} = ‘/usr/lib/libv4l/v4l1compat.so’;

.

*UPDATE!* added by ldp

Also work:
$ENV{LD_PRELOAD} = ‘/usr/lib/libv4l/v4l2convert.so’;

check your /usr/lib/libv4l or /usr/lib64/libv4l directory for other files to preload

save, and restart your zoneminder.

WALLA!!!
it works like charm…

Programming

Reset Mysql Root Password

Terrible, just setup a new server, then i forgot root password for mysql database. So i need to reset the root password.

This is the way i do:
1. Login to our server machine as root (system administrator). Yes! we must have root access to our machine.

2. Shutdown mysql server (if already running). Make sure no other mysql daemon running.

$ /etc/init.d/mysql stop

3. Create a text file and place the following statements in it. Replace the password with the password that you want to use.

UPDATE mysql.user SET Password=PASSWORD(‘YourNewPasswordHere’) WHERE User=’root’;
FLUSH PRIVILEGES;

The UPDATE and FLUSH statements each must be written on a single line. And make sure we have statement “where user=’root’“, to make sure, only our root password is updated.

4. Save the text file into our home directory, or somewhere else. Example, i saved this as: “/home/vandai/mysql-reset

5. Start the MySQL server with the special –init-file option:

mysqld_safe –init-file=/home/vandai/mysql-reset &

This will execute the contents of the file named by the –init-file option at startup, changing each root account password.

6. Don’t forget to delete mysql-reset file immediately!!

Now we will be able to login to MySql database as root with our new password.

Never forget the password again!!

Programming

PHP-GD: Resize Transparent Image PNG & GIF

By default, you will get black background if you resize a transparent image. Play Daisy slots to see how good the quality of the background images are. To fix it, you need set alpha channel imagecolorallocatealpha to 127.
With imagecolorallocatealpha, it will allocate a color for an image.

Usage:
int imagecolorallocatealpha ( resource image, int red, int green, int blue, int alpha)

From PHP manual:
imagecolorallocatealpha() behaves identically to imagecolorallocate() with the addition of the transparency parameter alpha which may have a value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.
Returns FALSE if the allocation failed.

Before using it, you must set to false the blending mode for an image and set true the flag to save full alpha channel information.

Example:

<? $newImg = imagecreatetruecolor($nWidth, $nHeight); imagealphablending($newImg, false); imagesavealpha($newImg,true); $transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127); imagefilledrectangle($newImg, 0, 0, $nWidth, $nHeight, $transparent); imagecopyresampled($newImg, $im, 0, 0, 0, 0, $nWidth, $nHeight, $imgInfo[0], $imgInfo[1]); ?>
Tech-News

Google has change the Google Search Favicon

Baru sadar, waktu lagi nyari sesuatu di Google, ada yang beda pada tampilan halaman Google.
Favicon Google berubah. favicon itu yang ada disebelah alamat URL pada address bar, dan juga biasanya ada di tab browser.

Biasanya selama ini favicon Google adalah huruf G dengan uppercase.
Sekarang jadi huruf g dengan lowercase.

Google Favicon

Tapi ternyata tidak semua mirror Google yang berubah. Pada beberapa negara masih menggunakan favicon yang biasa. Setidaknya pada mirror Google di Indonesia, Prancis, Italy, Belanda, Rumania, dan Malaysia faviconnya berubah.
Bahkan di server utama nya http://www.google.com/ masih menggunakan favicon yang standar kebesaran Google.

Yah, biar tidak bosan kali…

Programming

Mysql String Functions

Name Description
ASCII() Return numeric value of left-most character
BIN() Return a string representation of the argument
BIT_LENGTH() Return length of argument in bits
CHAR_LENGTH() Return number of characters in argument
CHAR() Return the character for each integer passed
CHARACTER_LENGTH() A synonym for CHAR_LENGTH()
CONCAT_WS() Return concatenate with separator
CONCAT() Return concatenated string
ELT() Return string at index number
EXPORT_SET() Return a string such that for every bit set in the value bits, you get an on string and for every unset bit, you get an off string
FIELD() Return the index (position) of the first argument in the subsequent arguments
FIND_IN_SET() Return the index position of the first argument within the second argument
FORMAT() Return a number formatted to specified number of decimal places
HEX() Return a hexadecimal representation of a decimal or string value
INSERT() Insert a substring at the specified position up to the specified number of characters
INSTR() Return the index of the first occurrence of substring
LCASE() Synonym for LOWER()
LEFT() Return the leftmost number of characters as specified
LENGTH() Return the length of a string in bytes
LIKE Simple pattern matching
LOAD_FILE() Load the named file
LOCATE() Return the position of the first occurrence of substring
LOWER() Return the argument in lowercase
LPAD() Return the string argument, left-padded with the specified string
LTRIM() Remove leading spaces
MAKE_SET() Return a set of comma-separated strings that have the corresponding bit in bits set
MATCH Perform full-text search
MID() Return a substring starting from the specified position
NOT LIKE Negation of simple pattern matching
NOT REGEXP Negation of REGEXP
OCTET_LENGTH() A synonym for LENGTH()
ORD() Return character code for leftmost character of the argument
POSITION() A synonym for LOCATE()
QUOTE() Escape the argument for use in an SQL statement
REGEXP Pattern matching using regular expressions
REPEAT() Repeat a string the specified number of times
REPLACE() Replace occurrences of a specified string
REVERSE() Reverse the characters in a string
RIGHT() Return the specified rightmost number of characters
RLIKE Synonym for REGEXP
RPAD() Append string the specified number of times
RTRIM() Remove trailing spaces
SOUNDEX() Return a soundex string
SOUNDS LIKE(v4.1.0) Compare sounds
SPACE() Return a string of the specified number of spaces
STRCMP() Compare two strings
SUBSTR() Return the substring as specified
SUBSTRING_INDEX() Return a substring from a string before the specified number of occurrences of the delimiter
SUBSTRING() Return the substring as specified
TRIM() Remove leading and trailing spaces
UCASE() Synonym for UPPER()
UNHEX()(v4.1.2) Convert each pair of hexadecimal digits to a character
UPPER() Convert to uppercase

String-valued functions return NULL if the length of the result would be greater than the value of the max_allowed_packet system variable.

For functions that operate on string positions, the first position is numbered 1.

ubuntu

Create ISO Images from CD/DVD and Folder Files

With Ubuntu, you can create ISO disk Images directly from CD/DVD and folder files. Then create MD5 Checksum files.
Assumed that the CD/DVD device is located at /dev/cdrom/

Turn a CD/DVD into an .iso
$ sudo umount /dev/cdrom
$ dd if=/dev/cdrom of=file.iso bs=1024

Turn a folder into an .iso
$ mkisofs -r -o file.iso /location_of_folder/

Generate an MD5 checksum file

$ md5sum file.iso > file.iso.md5

Check MD5 checksum of file
$ md5sum -c file.iso.md5

ubuntu

Finally The Hardy Heron has arrived!

Yay, its arrived..! Linux Ubuntu 8.04 (Hardy Heron) free CDs. Requested it from https://shipit.ubuntu.com/
Kinda late, because i already downloaded and installed it since the first time released. And like always, i have to go to the Post Office, and pay Rp.7000 for the tax.

The Package:

Ubuntu Package

And the package content:

Paket Ubuntu

There’s some difference from edubuntu cd. its called “Education Edition Add-on CD”. Ubuntu Education Edition is an additional selection of free and open source software for education to be used with Ubuntu. This CD is does not offer LTSP installation directly. To get the same out-of-the-box-set-up as before, start from the Ubuntu alternate install CD, and select “Install an LTSP server” from the Modes menu.

The Ubuntu Promise

  • Ubuntu will always be free of charge, including enterprise releases and security updates
  • Ubuntu comes with full commercial support from Canonical and hundreds of companies around the world
  • Ubuntu includes the very best translations and accessibility infrastructure that the free software community has to offer
  • Ubuntu CDs contain only free software applications; we encourage you to use free and open source software, improve it and pass it on