Thursday, October 9, 2008

stty -echo

Note to self:

use stty -echo to hide keyboard input on terminal, stty echo to undo hide.

Source: Read in passwords with bash

Wednesday, October 8, 2008

.local Host Name and Multicast DNS

While installing and configuring OpenVPN on Ubuntu, I ran into a network problem I've been intermittently encountering on Windows.

Not much was required in installing and configuring openvpn. I just installed the prebuilt package via apt. Configuration files were downloaded from the Astaro firewall running the openvpn server. The only change needed was to include

up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

in the .ovpn file to apply/undo the nameserver settings the openvpn server pushes to the client upon connect/disconnect. "update-resolv-conf" is a script that came with the openvpn package that parses the environment variables for the DNS settings the openvpn server pushes and the client exports to "foreign_variable_#" variables before calling the up/down scripts. And "resolvconf" package needed to be installed since "update-resolv-conf" uses it.

Even after configuring things this way, though, I couldn't connect to machines on the VPN. I could retrieve the correct IP addresses via nslookup, but when trying to connect any application them resulted in the hosts the names not resolving correctly. Connecting by specifying the IP address manually worked.

After some searching, I found some online discussions referring to this problem. "/etc/nsswitch.conf" was configured to kill the name resolution process when the mDNS could not resolve a ".local" name.

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

... was changed to ...

hosts: files dns mdns4

I suppose one way to look at it is that the a ".local" domain name was chosen for host names on the VPN even though mDNS was not set up. Astaro apparently doesn't support the protocol.

If I were in charge of managing the network, I would transition all hosts to use a different domain. But I'm not. The administrator insists that we continue using ".local" because Astaro should support mDNS. I think he should put his love for all things Apple aside for once and face the messy reality.

The underlying cause of the problem may be the same for the Windows machines. Though the fact that the problem crops up only occasionally with Windows is odd. For Windows, I've specified the IP addresses of the few hosts I need to connect to on the VPN in the "hosts" file. This has so far worked out for me.

TOra with Oracle Support

Used these instructions to build and install TOra with Oracle support.

Will try out and update.

Saturday, July 19, 2008

New Hard Drive - Determining Best Parameters for ext3 File System

I've install a new hard drive on my laptop. Got a 320 GB Western Digital Passport and followed instructions here to extract the 320 GB SATA hard drive and replace my old 100 GB hard drive. I ended up mangling a plastic fastener in the hard drive enclosure like the author of the instructions did. But it still closes fine and now holds the old hard drive.

EDIT: Another guide (with pictures!) for disassembling this external drive. Might be better to follow this page.

In moving contents of the old hard drive to the new, I decided to stick with ext3. I've read JFS is faster, but I really like being able to access my linux partitions while using Windows. Also, this thread seems to suggest that ext3 is better at recovering from disk errors.

I want good parameters for partitions and file systems on the new drive. So, using tools like "df" and "tune2fs", I found out some statistics on the files residing on my old partitions.

I use two non-swap partitions for linux. A partition for "/home" and a partiton for everything else ("/"). "/" partition used 4.2 GB with 209893 items (files, directories, symbolic links...). In the "/home" partition, 61681 items took up 30.8 GB. From this, I've determined that "/" partition will be 20 GB and "/home" will be 140 GB on the new hard drive.

On the "/" partition, 42% (1,250,630/3,166,498) of blocks and 14% (209,301/1,609,344) of inodes were used. On the "/home" partition, 88% (10,061,413/12,016,356) of blocks and 2% (86,576/6,087,360) of inodes were used. I imagine the disparity in blocks and inodes used for "/home" results from large files I stored there. As both partitions used 4 KiB blocks, the ratio of bytes to inode were 8,059 for "/" and 8.085 for "/home". Clearly, past usage shows "/home" partition could do with larger bytes/inode ratio. As the laptop will continue to be used exclusively by me, I feel it's safe to change the ratio to 10,000 for "/" and 200,000 for "/home" without worry of running out of inodes.

Also, I'll set inode size to 256 in both partitions. 256 byte inodes improve performance for some applications and allow smooth upgrade to ext4. While older kernels won't be able to use the file system and grub had trouble booting on ext3 partitions with 256 byte inodes. But I'm not concerned as I won't use older kernels and grub has been patched. Ext2 IFS, the Windows driver I had been using to access the ext3 partitions, doesn't seem to support this setting so I may go with Crossmeta or ext2fsd as latest version of those drivers should support 256 byte inodes.

To determine the best blocks size, I ran some "find" commands to find out the distribution of the items based on their size:

ubuntu@ubuntu:/media/disk-1$ sudo find | wc -l
ubuntu@ubuntu:/media/disk-1$ sudo find -size +1k | wc -l
ubuntu@ubuntu:/media/disk-1$ sudo find -size +2k | wc -l
ubuntu@ubuntu:/media/disk-1$ sudo find -size +3k | wc -l
ubuntu@ubuntu:/media/disk-1$ sudo find -size +4k | wc -l
ubuntu@ubuntu:/media/disk-1$ sudo find -size +5k | wc -l

Resulting data:

Item Distirbution by Size
>1KiB, ≤2KiB246875951
>2KiB, ≤3KiB130024934
>3KiB, ≤4KiB295186902
>4KiB, ≤5KiB55652536
>5KiB, ≤6KiB42101860
>6KiB, ≤7KiB33941429
>7KiB, ≤8KiB28951232
>8KiB, ≤9KiB26091054
>9KiB, ≤10KiB2787955
>10KiB, ≤11KiB2285767
>11KiB, ≤12KiB2133878
>12KiB, ≤13KiB1793803
>13KiB, ≤14KiB1509852
>14KiB, ≤15KiB1313942
>15KiB, ≤16KiB13881110
>16KiB, ≤32KiB1069614588
>32KiB, ≤64KiB793810158
>64KiB, ≤128KiB39243666

More than half the files in "/" partition were 2 KiB or smaller. In the "/home" partition, however, only around 28% fell into this category and only 41% were smaller than 4KiB.

I ran the commands again with "-type d" option to find size distribution of directories. Because both of the old partitions used 4 KiB block sizes, the size attributed to the directories are all multiples of 4 KiB. This explains how the distribution for both partitions seem to deviate from the decreasing pattern at 3 KiB to 4 KiB range. Most of the directories uses a single 4 KiB block and causes the spike.

Though "/" may benefit from smaller block size, 4 KiB doesn't seem bad. I'll leave that as is.

I've decided to preserve some of other configuration from the old file systems. So following are the resulting mkfs commands I'll be running:

For "/", mkfs.ext3 -c -b 4096 -i 10000 -I 256 /dev/sda3

For "/home", mkfs.ext3 -c -b 4096 -i 200000 -I 256 /dev/sda4

Other options specified in the "/etc/mke2fs.conf" file seemed good enough (sparse_super,filetype,resize_inode,dir_index). Hopefully all goes well.

UPDATE: Output from running mkfs is below. Might come in handy for data recovery.

ext3 -c -b 4096 -i 200000 -I 256 /dev/sda4;
mke2fs 1.40-WIP (14-Nov-2006)
Warning: 256-byte inodes not usable on older systems
warning: 380 blocks unused.

Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2000176 inodes, 4882432 blocks
244140 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
149 block groups
32768 blocks per group, 32768 fragments per group
13424 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

Checking for bad blocks (read-only test): done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
mke2fs 1.40-WIP (14-Nov-2006)
Warning: 256-byte inodes not usable on older systems
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
691488 inodes, 33709204 blocks
1685460 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1029 block groups
32768 blocks per group, 32768 fragments per group
672 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Checking for bad blocks (read-only test): done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

UPDATE2: After doing some reading, I've decided to create an ext2 boot partition. It seems the only sure-fire way to have grub boot and have the other partitions be ext3 with 256 byte inodes.

Thursday, April 17, 2008

Boys Who Don't Play Video Games (or Play Violent Games Exclusively) at Risk

Authors of "Grand Theft Childhood" were interviewed by G4 (seems a bit rehearsed) on video games and violence. They suggest video games are not cause of violence. And though playing violent games excessively is associated with higher risk of getting into trouble, so is not playing video games at all.


Playing violent video games is not a cause of real world violence.

Exclusively playing violent M-rated games and for 15 hours or more a week is a risk marker - associated with statistically significant risk of getting in trouble. This is true for both boys and girls.

But for boys, not playing any video games at all is also a risk marker. The researchers suppose that playing video games is a sign of social competence for boys and not playing at all is a sign that something is wrong.

A whole lot of people play games (63% of US). Yet we're still doing well and we'd see that if we stop paying attention to a causal link that does not exist.

Violent media does not cause crime. But if a person is at risk of violent behavior, an underlying factor may also cause them to consume violent media excessively. Or if they are socially isolated they may get into more trouble, and video games are a big part of how boys socialize now.

Seems like mainstream media has got cause and effect backwards. If the world survived Jazz and Rock & Roll, I'm sure it will survive video games.

Sunday, April 13, 2008

Ignorance is Bliss to None but Fools

It's funny how I thought I was a decent-looking guy. Didn't even notice my face was so asymmetrical and misshapen until I took a few pictures of myself to draw self-portraits recently.

Maybe it's a recent development. I've seen plenty of my baby pictures and pictures from high school, but I never noticed this.

I'll probably stop minding it soon, but it disturbs me that I failed to notice it soooner. What else about myself did I fail to perceive accurately?

Thursday, April 10, 2008

I Do Not Want to Extend My Auto Warranty Coverage

I get calls from "extend your auto warranty" telemarketers, almost every day. Mostly on my work phone and sometimes on my cellphone (despite it being illegal for telemarketers to call cellphones).

It sucks nasty meatballs. But wait. There's more. Months ago, I finally stayed on and talked to a rep. They wanted make, model and year of my car. They didn't even know how old my car was! All they had was my number! Haha. They were National Dealers of St Peters, MO. I clearly told the rep that I want my information taken off THEIR system. He then forwarded me to their "do not call department" - a recorded message instructing me to make use of the national do-not-call registry. I had to chuckle at their audacity. They basically gave me the finger.

It was awful nice of them when later they started offering an option to "press 3" to get off their list. Too bad it didn't work.

And now, even as my phone numbers sit on the do-not-call list, their autodialer calls. It instructs me to "press 2" to take advantage of this "final notice" to extend my auto insurance.

So today, I press 2. I wait for a rep. She asks me for my vehicle's make, model and year. Instead of answering, I ask for the name and location of the company she works for. *CLICK* she hangs up abruptly.

My guess is that it's the same scum from St. Peters.

Hope they get shut down soon. I'm having hard time suppressing the urge to drive down there to drill holes through their equipment.

Found an article from MSNBC on these car warranty companies, written two months ago. That could explain why they didn't bother to give me the company info today.

Wednesday, April 9, 2008

Fun with Oracle Data Dictionary Views

Played around with some data dictionary views in Oracle. "USER_TAB_PRIVS" is a view which contains information about object privileges that are associated with the user (object privileges for which the current user is object owner, privilege granter, or privilege grantee). "ROLE_TAB_PRIVS" is a view of object privileges granted to roles given to the user.

I wanted to find out exactly how these views work. So I set up a test in the following way to see how "ROLE_ROLE_PRIVS" and "ROLE_TAB_PRIVS" work.

create user testuser identified by "pass";
create role testrole1;
create role testrole2;
create role testrole3;
grant testrole1 to testuser;
grant testrole2 to testrole1;
grant testrole3 to testrole2;

grant select on testschema.testview1 to testrole1;
grant select on testschema.testview2 to testrole2;
grant select on testschema.testview3 to testrole3;

I logged in as "testuser". Querying "ROLE_ROLE_PRIVS" displayed both "testrole2" and "testrole3" as "GRANTED_ROLE". Querying "ROLE_TAB_PRIVS" displayed all three views under the column "TABLE_NAME" for which the user has been granted "SELECT" privileges via the roles.

I mainly wanted to find out whether I'd need to recursively query these views for all object privileges a user has. But it seems the task will simply require querying "USER_TAB_PRIVS" and "ROLE_TAB_PRIVS".

Reading through descriptions of other data dictionary views, it occurs to me that I might as well query the "ALL_TAB_PRIVS_RECD" since it will list all privileges user has on objects the user does not own. Then querying "USER_OBJECTS" for views would yield the views user owns.

Alternatively, querying "ALL_OBJECTS" for views could also work if it is a assumed that the user has "SELECT" privilege to those views.

Monday, March 31, 2008

An Accident

I rear-ended a car today. Actually two cars. I was very glad no one was hurt, though the other drivers seemed unsure of whether their neck/back was injured.

Don't know why I didn't stop in time. I'm still trying to figure it out.

It was raining. Had been for a while. Maybe the window was foggy. It was certainly foggy when I was driving back from the accident an hour afterwards.

I thought that I had I heard my phone ring. I mentioned this to the other drivers, that "my phone rang" while explaining what happened. But by the time the police officer arrived, my words had transformed in their minds and they were wondering if I was talking on the phone at the time of the accident.

While my vehicle and driver license info was being processed, I checked my phone's call history and there was no incoming/missed call. Maybe it was the radio or it was the sound of collision or maybe it was my imagination. It wouldn't have mattered anyway as that was precisely the moment my car made contact with the first car. I explained this to the police officer at the scene, but I wonder if I cleared it up properly as all I wanted at the time was to go home.

Well, hope it all works out. Gotta sleep. Gotta go to work tomorrow so I can pay for my insurance premium which I'm sure will rise due to this.

Wednesday, March 26, 2008

HL7 Sucks Dirt

HL7 sucks. Two days of "training" that was hardly better than reading the HL7 specification. Plus two days to travel to Marquette and back. All I got was a headache and deep hatred for all things HL7.

Ugly hack by incompetent fools. I'll make programs that work with non-XML HL7 when hell freezes over.

Saturday, March 15, 2008

Rational Living

Throw away all ideals.
Stop listening to people who claim to know.
No one knows.
Name someone who knows.
Same name belongs to ignorance.
Make your own observations.
Draw your own conclusions.
There is no right or wrong.
There is only you and reality you observe.

Some cling onto thoughts that do not match reality. Instead of trying to fit ideas to observations, they make selective observations and interpret them in convoluted and far-fetched ways to fit their ideas. Such individuals are despicable and untrustworthy. But do not insult them as it will only make them yet more irrational. Ignore them and be on your way. Try to correct them if you must, but don't waste all your life on them. They should live their lives as they will. And so should you.

The world is not black and white. Not even a spectrum of colors will fit reality of a grain of sand. Do not attempt to simplify reality for the sake of your ideas. Change your ideas so that they may better fit your observations. There is no right and wrong. There is only degree of consistency with reality.

Friday, March 14, 2008

Do Talk to Strangers

Met someone new today. It's rare that I talk so much with someone without being introduced. She was pleasant and interesting company.

I didn't want to bring up my age. She asked but I refused to answer. It'd have diverted the conversation and made me (her?) feel awkward.

It'd be nice to meet her again but I wonder if it'd feel as natural as it did today.

Tuesday, March 11, 2008

An Old Acquaintance

I regret taking my leave so soon,
Old acquaintance of mine.
I've always held you at an arm's length.
I've always been awkward with you.
There was no helping it.
I was myself.
And you, a person.
Though it's been so long,
I have not changed.
And you remain human.
I regret taking my leave so soon.
I regret exchanging such few, trivial words.
If only I were a different person.
Or you, a Bengal tiger.

Monday, March 10, 2008


Stranger, where are you going?

I slow down so our paths may cross.

Stranger, where are you going?

You cannot hear this question in my eyes.

You walk briskly in the snow,

Firmly staring on, to a destination unknown.

Sunday, March 9, 2008


The only thing I'm good at seems to be not doing.

Not drinking. Not smoking. Not chasing tail. Not talking. Not realizing my dreams. Do I even dream?

So very good at demonstrating to myself there is no reason to do anything, no reason to change.

Why bother? What's the point? I can never answer these questions.

I waste away in a sea of insignificance. No person, thing, or thought stays for long here.

One day I'll look back upon my life and see a gigantic nothingness. I dread that day.

Or will I change before that day and eek out a life worth remembering?

Then again... why bother? Why is this important - to live such a life? It's not. I would have to make it important to myself. There is no objective value system that will impart wisdom. Because there is no such thing as wisdom. I hate all things subjective.

I embrace my inhibitor, my prison guard, myself. Objective reality - you are my reality.

Saturday, March 8, 2008

Feeling Sore

Started working out with a friend from work.

My arms are sore from first day of workout. Did shoulders and triceps the second day. Did legs today. I need to write down the routine and memorize it so I can do it by myself.

I can't put on my jacket right and I'm clumsy with utensils during meals, but the pain feels good somehow.

Saturday, March 1, 2008


As many persons have found, Juno's a fun movie. I was a little late to confirm this. But better late than never.

Also, it has inspired me to find a high school girl to impregnate. If the movie taught me anything, it's that pregnant high school girls are cool. And that teenage pregnancies bring excitement and intrigue to boring ordinary lives.

I expect US population will grow rapidly in the next few years as teens give birth to the Juno generation.

Thursday, February 28, 2008

3-Day Comcast Internet Outage

Comcast internet went down for me starting Tuesday and it hasn't come back up yet. We had a snow storm and all but I can't think what kind of a problem that could cause that couldn't be fixed in a day.

EDIT: Turns out it wasn't an outage at all. My connection was being blocked because I had Comcast change the plan on my account and modem had to be re-registered. It would have been nice if the customer service rep who changed my account had let me know what to expect.

EDIT 2: On the first two calls to Comcast, automated messages informed me of an outage and some sort of maintenance work. I hung up without talking to a rep, assuming the problem would be resolved.

Wednesday, February 6, 2008

Video Playback Problem Fixes

Have been putting up with bad color in video playback. I would adjust the "Hue" setting in the media player but the colors were always off. Turns out the culprit is ATI's video driver. That'd explain why video applications had this problem but Flash-based video applications didn't. Flash must not use video card acceleration for video playback. Not on my computer, at least.

The exact problem is that a bug in ATI's driver swaps U and V color coordinates in YUV color space.

The forum thread about the problem suggests the following solution:

launch gstreamer-properties from terminal
change the video output plugin to custom
change the video output pipeline to:

ffmpegcolorspace ! video/x-raw-yuv,format=(fourcc)YV12 ! xvimagesink

Yet another problem with video playback I've been having is that some files will have a green band on top when played in VLC. I thought it was a deinterlacing problem since some deinterlace option changed the size of the green band. But There was an online discussion about this also. The fix is to change VLC preferences to use a differnt video output module. Using X11 video output module instead of the "Default" option got rid of the green band. As a bonus, this change also got rid of an artifact where fast-changing image would show that the video was being rendered in two steps triangles.

These problems counted two in the ever-shrinking list of reasons to have Windows around. Not many more left. I think I can safely delete my Windows partition soon.

Friday, February 1, 2008

Pattern of Inaction (Sweet Regret)

Saw a girl at a boboa tea place today. Was with her friend. Wanted talk to them. Didn't. Kept my laptop open, earbuds on, tried to ignore her. But I'd catch myself glancing their way from time to time.

Which is not out of the ordinary, I guess. I do this all the time. Each time I get to savor hours of regret afterward. Mmm...

If I think about it, she's no different from any other cute girl I've never talked to and don't know a thing about. But that doesn't help for some reason.