Moving a window that's off screen or otherwise hidden.
When using Windows, you may run into the problem of trying to access a window that is not visible because it is far off the screen or hidden under something. This is not a bad trick to remember, from Raymond Chen:
http://blogs.msdn.com/b/oldnewthing/archive/2009/05/11/9601136.aspx
The basic idea is select the window in the taskbar, then hit Alt-Space, M, hit an arrow key, and then move the mouse.
Unfortunately, it doesn't seem to work in the case where the window is hidden under a VMWare Player window, which occasionally commandeers my entire secondary monitor.
How to add a class to an existing JAR file.
Say we have a jar file start.jar and want to add a class to it.
$ mkdir jarbuild
$ cp start.jar jarbuild
$ cd jarbuild
$ jar -xf start.jar
$ rm start.jar
$ cp -r ~/secmgr .
$ find secmgr/
secmgr/
secmgr/manager
secmgr/manager/ProfilingSecurityManager.class
$ jar cmf META-INF/MANIFEST.MF mystart.jar *
Now you have a new jarfile that's the same as start.jar but with the ProfilingSecurityManager class in it. If you want, you can:
$ mv mystart.jar ../start.jar
Numbers everyone should know.
I reproduce below Slide 24 from Jeff Dean's keynote (PDF) at LADIS 2009.
L1 cache reference | 0.5 ns |
Branch mispredict | 5 ns |
L2 cache reference | 7 ns |
Mutex lock/unlock | 25 ns |
Main memory reference | 100 ns |
Compress 1K bytes with Zippy | 3,000 ns |
Send 2K bytes over 1 Gbps network | 20,000 ns |
Read 1 MB sequentially from memory | 250,000 ns |
Round trip within same datacenter | 500,000 ns |
Disk seek | 10,000,000 ns |
Read 1 MB sequentially from disk | 20,000,000 ns |
Send packet CA->Netherlands->CA | 150,000,000 ns |
Installing rubygems on CentOS 5.5
Here is how to get rubygems working on CentOS 5.5.
- Remove the old Ruby packaged with CentOS.
$ sudo yum erase ruby
- Make sure you have zlib and zlib-devel installed.
$ sudo yum install zlib zlib-devel
- Install a newer Ruby like 1.8.7-p299.
$ wget http://core.ring.gr.jp/archives/lang/ruby/1.8/ruby-1.8.7-p299.tar.bz2
$ bunzip2 ruby-1.8.7-p299.tar.bz2
$ tar xf ruby-1.8.7-p299.tar - The following is probably not optimal, but I do it anyway. In the ruby directory, edit
ext/Setup
and uncomment out the packages that interest you. I like iconv, openssl, socket, syslog, and zlib. Make sure you have zlib. The alternative (probably recommended) method is to not statically link this modules and instead compile and install the packages individually, but I forget how to do that and didn't have time to learn. - Install ruby.
$ make
$ make test
$ sudo make install - Ensure ruby is in the path. ruby likes to install itself in /usr/local/bin, which CentOS usually doesn't have in the path.
$ which ruby # Not found? Add /usr/local/bin to your $PATH.
- Ensure ruby is installed.
$ ruby -v
- Install rubygems.
$ wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
$ sudo ruby setup.rb - Ensure rubygems works.
$ gem list # Doesn't work? Error about zlib? Make sure you have zlib-devel installed (see step 2)! Thenmake; make install
ruby again.