Google
 
Web www.bloodpet.tk
phreakfish.blogspot.com emans.blogspot.com

20140108

Rubber Duck

With a rubber duck, one's never alone. -- The Hitchhiker's Guide to the Galaxy

20090224

Calculator Generator

I've just released a simple version of my Javascript Calculator generator.
I created this originally for a debt settlement company, using EMANS as my inspiration.
This Javascript Calculator Generator is a minimalist approach to create a customized calculators that can easily be shared to other people using just a web browser.

This is a simple calculator maker that will allow you to create your own web-based calculator. This calculator generator and the calculators it generates uses Prototype (a Javascript Library).
To use, simply download the latest version and open the index.html in the extracted directory.
For those interested in helping out, here are the links to the development sites:
Currently, this lacks a few more functionalities from the Javascript Math Object. There is also no documentation yet, and translations of this wouldn't hurt either.

20090202

Microdia Webcam with Neo Laptop now working with Kubuntu

From the forum Anybody have a driver for this Microdia PC Camera (SN9C201) web camera?
There are instructions to install microdia-dkms drivers in intrepid, just by adding

deb http://ppa.launchpad.net/nickel62metal/ubuntu intrepid main
deb-src http://ppa.launchpad.net/nickel62metal/ubuntu intrepid main
to /etc/apt/sources.list and running:
apt-get install microdia-dkms
I figured that they had this on hardy, so i just replaced "intrepid" with "hardy" on those two lines, resulting to:
deb http://ppa.launchpad.net/nickel62metal/ubuntu hardy main
deb-src http://ppa.launchpad.net/nickel62metal/ubuntu hardy main
Now, running the same command with apt-get, i've successfully installed the driver for the Microdia webcam, and can use it with all the applications i use with a webcam.

20060709

Why is programming fun?

Why is programming fun? What delights may its practioner expect as his reward?

First is the sheer joy of making things. As the child delights in his mud pie, so the adult enjoys building things, especially things of his own design. I think this delight must be an image of God's delight in making things, a delight shown in the distinctness and newness of each leaf and each snowflake.

Second is the pleasure of making things that are useful to other people. Deep within, we want others to use our work and to find it helpful. In this respect the programming system is not essentially different from the child's first clay pencil holder "for Daddy's office."

Third is the fascination of fashioning complex puzzle-like objects of interlocking moving parts and watching them work in subtle cycles, playing out the consequences of principles built in from the beginning. The programmed computer has all the fascination of the pinball machine or the jukebox mechanism, carried to the ultimate.

Fourth is the joy of always learning, which springs from the nonrepeating nature of the task. In one way or another the problem is ever new, and its solver learns something: sometimes practical, sometimes theoretical, and sometimes both.

Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures. (...)

Yet the program construct, unlike the poet's words, is real in the sense that it moves and works, producing visible outputs separately from the construct itself. It prints results, draws pictures, produces sounds, moves arms. The magic of myth and legend has come true in our time. One types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.

Programming then is fun because it gratifies creative longings built deep within us and delights sensibilities we have in common with all men.

Fred Brooks, The Mythical Man-Month

20050714

Slackware + Debian using chroot

Because of the chroot tips, i decided not to remove my Slackware installation. I made a Slackware+Debian system using chroot.
I run all the important (servers, databases, software projects) in Slackware and all the frontend stuff (GUI, browser, mail client, players, games, et al) in Debian.
Here's what i did in Slackware's /etc/inittab:

c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:12345:respawn:/sbin/agetty 38400 tty2 linux
c3:12345:respawn:/sbin/agetty 38400 tty3 linux
c4:12345:respawn:/sbin/agetty 38400 tty4 linux
c5:124:respawn:/sbin/agetty 38400 tty5 linux
c6:124:respawn:/sbin/agetty 38400 tty6 linux
d5:35:respawn:/usr/sbin/chroot /mnt/deb /sbin/getty 38400 tty5 linux
d6:35:respawn:/usr/sbin/chroot /mnt/deb /sbin/getty 38400 tty6 linux
d8:35:respawn:/usr/sbin/chroot /mnt/deb /sbin/getty 38400 tty8 linux
d9:35:respawn:/usr/sbin/chroot /mnt/deb /sbin/getty 38400 tty9 linux
d13:35:wait:/usr/sbin/chroot /mnt/deb /root/bin/chroot
x1:4:wait:/etc/rc.d/rc.4
x2:5:wait:/etc/rc.d/rc.5
There's a script in /mnt/deb/root/bin/chroot (/root/bin/chroot in Debian) that runs in runlevel 3 & 5. This mounts partitions that i find necessary.
The rc.4 file is for Slackware's X and rc.5 is for Debian's X.
To see how i made Debian's X run, here's a part of /etc/rc.d/rc.5 in Slackware:
# Try to use KDE's kdm session manager:
if [ -x /mnt/deb/etc/init.d/kdm ]; then
exec /usr/sbin/chroot /mnt/deb /etc/init.d/kdm start
fi

# Not there? OK, try to use GNOME's gdm session manager:
if [ -x /mnt/deb/etc/init.d/gdm ]; then
exec /usr/sbin/chroot /mnt/deb /etc/init.d/gdm start
fi
Then, i attached the lines from /etc/rc.d/rc.4 to go to the X of Slackware (in case something happens to Debian).

20050623

Kewl chroot tips

8.6.35 chroot

The chroot program, chroot(8), enables us to run different instances of the GNU/Linux environment on a single system simultaneously without rebooting.

One may also run a resource hungry program such as apt-get or dselect under the chroot of a fast host machine while NFS-mounting a slow satellite machine to the host as r/w and the chroot point being the mount point of the satellite machine.


8.6.35.1 Run a different Debian distribution with chroot

A chroot Debian environment can easily be created by the debootstrap command in Woody. For example, to create a Sid chroot on /sid-root while having fast Internet access:

     main # cd / ; mkdir /sid-root
main # debootstrap sid /sid-root http://ftp.debian.org/debian/
... watch it download the whole system
main # echo "proc-sid /sid-root/proc proc none 0 0" >> /etc/fstab
main # mount proc-sid /sid-root/proc -t proc
main # cp /etc/hosts /sid-root/etc/hosts
main # chroot /sid-root /bin/bash
chroot # apt-setup # set-up /etc/apt/sources.list
chroot # vi /etc/apt/sources.list # point the source to unstable
chroot # dselect # you may use aptitude, install mc and vim :-)

At this point you should have a fully working Debian system, where you can play around without fear of affecting your main Debian installation.

This debootstrap trick can also be used to install Debian to a system without using a Debian install disk, but instead one for another GNU/Linux distribution. See http://www.debian.org/releases/stable/i386/ch-preparing#s-linux-upgrade.


8.6.35.2 Setting up login for chroot

Typing chroot /sid-root /bin/bash is easy, but it retains all sorts of environment variables that you may not want, and has other issues. A much better approach is to run another login process on a separate virtual terminal where you can log in to the chroot directly.

Since on default Debian systems tty1 to tty6 run Linux consoles and tty7 runs the X Window System, let's set up tty8 for a chrooted console as an example. After creating a chroot system as described in Run a different Debian distribution with chroot, Section 8.6.35.1, type from the root shell of the main system:

     main # echo "8:23:respawn:/usr/sbin/chroot /sid-root "        "/sbin/getty 38400 tty8"  >> /etc/inittab
main # init q # reload init

8.6.35.3 Setting up X for chroot

You want to run the latest X and GNOME safely in your chroot? That's entirely possible! The following example will make GDM run on virtual terminal vt9.

First install a chroot system using the method described in Run a different Debian distribution with chroot, Section 8.6.35.1. From the root of the main system, copy key configuration files to the chroot system.

     main # cp /etc/X11/XF86Config-4 /sid-root/etc/X11/XF86Config-4
main # chroot /sid-root # or use chroot console
chroot # apt-get install gdm gnome x-window-system
chroot # vi /etc/gdm/gdm.conf # do s/vt7/vt9/ in [servers] section
chroot # /etc/init.d/gdm start

Here, /etc/gdm/gdm.conf was edited to change the first virtual console from vt7 to vt9.

Now you can easily switch back and forth between full X environments in your chroot and your main system just by switching between Linux virtual terminals; e.g. by using Ctrl-Alt-F7 and Ctrl-Alt-F9. Have fun!

[FIXME] Add a comment and link to the init script of the chrooted gdm.


8.6.35.4 Run other distributions with chroot

A chroot environment for another Linux distribution can easily be created. You install a system into separate partitions using the installer of the other distribution. If its root partition is in /dev/hda9:

     main # cd / ; mkdir /other-dist
main # mount -t ext3 /dev/hda9 /other-dist
main # chroot /other-dist /bin/bash

Then proceed as in Run a different Debian distribution with chroot, Section 8.6.35.1, Setting up login for chroot, Section 8.6.35.2, and Setting up X for chroot, Section 8.6.35.3.


8.6.35.5 Build a package with chroot

There is a more specialized chroot package, pbuilder, which constructs a chroot system and builds a package inside the chroot. It is an ideal system to use to check that a package's build-dependencies are correct, and to be sure that unnecessary and wrong build dependencies will not exist in the resulting package.



source: Debian Reference - Chapter 8 - Debian tips