HOWTO Dynamic setup the element’s dimension

Web December 31st, 2005

The theme of this blog is based upon Yadda, a fixed-width, two-column wordpress theme. To take the full advantage of the current wide-screen, I modified the stylesheet to make it adaptive to the screen width:

#main {
padding: 5px;
margin: 0px 220px 0 3px;
}

#sidebar {
width: 175px;
position: absolute;
right: 0px;
top: 0px;
padding: 10px 10px 10px 10px;
BACKGROUND-COLOR: #fafafa;
}

Since the position style of sidebar is absolute, if the height of the “main” is smaller than the “sidebar”, the “sidebar” would overlap the “footer”, the height of the “main” is only determined in the run-time. Here is the solution:

… …
<script type=“text/javascript”>
function adjustHeight() {
var main = document.getElementById(“main”);
var sidebar = document.getElementById(“sidebar”);
if( sidebar.offsetHeight > main.offsetHeight )
main.style.height = sidebar.offsetHeight + ‘px’;
} </script>

… …

Now the content’s height is the maximum of “main” and “sidebar”.

Passwordless login in HPCL@GWU

Gentoo December 26th, 2005

Thanks to Proshanta’s hard work, the network policy of HPCL changes slightly: all the servers are authentificated via key pair only.

Generate the public/private key pair as

$ ssh-keygen -t rsa

Copy the public key to the reomote host:

$ scp ~/.ssh/id_rsa.pub user@server:~/
$ ssh user@server [user@server]
$ ssh-keygen -i -f id_rsa.pub
[user@server] $ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys2

OpenSSH key pair format is not compatible with SSH.com’s client/server. We need to convert it before append it to the configurations if necessary.

Flame, Flame, Flame …

Desktop, Misc December 14th, 2005

There is a hot debat on slashdot about KDE vs. Gnome, ” Torvalds Says ‘Use KDE”. Thousands of Gnome users are arguing that Gnome is more elegant or relatively close to Mac OSX than KDE.

Gnome application may lacks the functionality than KDE

Hey, that is the problem, KDE application is easy to integrate the imporvement from the core by using KPart.

But it runs fast than KDE

You bet, but it is true that KDE has a larger footprint.

QT/KDE are bloated, slow

Again, I am reeeeeeeally tired of this stupid conclusion. With KDE split-ebuilds, this neat feature would be enabled in KDE 4, you just install what you want instead of the meta packages.

Here is an imcomplete list for the flamers, choose your favorite and start the engine:

  • Vim vs. Emacs
  • Gnome vs. KDE
  • FreeBSD vs. Linux
  • Reiser/Reiser4 vs. Ext3

Google Transit released

Web December 8th, 2005

Google always give us some surprise, a new service named Google Transit has been released in beta test. With open API for Google Maps, nothing but your imagination stops you building creative applications.

Here is a wild idea to create the GPS application using Google maps:

  1. Build an Firefox plugin/standalone web server to communicate with GPSd, convert the NEMA format data to standard XML data source
  2. Inject the Javascript to Google Maps webpage with GreaseMonkey plugin, which would fetch the data from the plugin/webserver, and show the current position in the map.

Update: here is the application powered by greasemonkey.

More advanced features in mind:

  • Cache Google map meta data and reuse it when offline.
  • Voice navigation

Social engineering rocks

Network December 7th, 2005

I just read this funny story about how to stop P2P user utilizing all the public bandwidth in the hotel. Just read the conversation between “Eric Smith” and “me”:

Me: Eric Smith?

Eric: Uhh, yeah?

Me: My name is Jim Grant, and I’m an investigator with the RIAA. Have you heard of us?

Eric: Uhhhhh… What does that stand for?

Me: Recording Industry Association of America. We represent several large record companies. In monitoring several p2p file-sharing networks, we have found that you Eric, are currently downloading copyrighted material. Are you aware that this is illegal?

Eric: Ummm. my laptop is off. (At this point, I no longer see him on the network)

Me: We are in the process of filing 18182 lawsuits against people who steal copyrighted music on the internet. We will continue monitoring these networks, and if we see you on them again, you will hear back from us.

Eric: Ok, thanks. Bye.

The author take another approach, social engineering to solve this problem. We would discuss more about the geek’s traditional approaches like ntop, arp poisoning, raw packet injection etc. later.