Defining Two Different System Gateways

Situation above ground forces:
You have two modems, or two ethernet connections, and want part of your connections to go through ppp0, and the rest through ppp1

Quick Fix:
Quite easy, get both your connections live, and ppp0 will by default be the default gateway. Now, use a proxy for all other connections, so if this proxy is on some random port, and the gateway to ppp1 is, issue the following:

route add gw

Fedora Constantine, SYSRQ and needless swapping

By default, fedora disables the SYSRQ functionality of the kernel, for some reason. To enable it, either add sysrq_always_enabled at the end of your kernel line in /boot/grub/menu.conf, or edit /etc/sysctl.conf, changing

kernel.sysrq = 0


kernel.sysrq = 1

Some kernel updates on fedora also have the tendency to write to swap needlessly, even though you have loads of RAM available, to stop this, edit /etc/sysctl.conf again, and add the following two lines

# Controls the swapiness of the machine
vm/swappiness = 0

To just temporarily disable it, do

echo -n 0 > /proc/sys/vm/swappiness

as root

***These tips are applicable to almost any GNU/Linux distribution, not necessarily for Fedora alone

Visual Basic drinking Wine

This tutorial is depreciated, please follow my new tutorial: visual basic 6 revisited – linux – wine
Visual Basic running on Fedora

Get past with your life on Windows, install Microsoft Visual Basic 6 on GNU/Linux with some good old wine…

  1. Install the required libs, etc.
    $ winetricks ddr=gdi vb6run gecko gdiplus fontfix d3dx9 corefonts mdac_typ dcom98
  2. From a working Windows XP installation, copy over riched20.dll, riched32.dll, urlmon.dll, oleaut32.dll, and hhctrl.ocx, from the system32 folder to your wine system32 folder
  3. In your Wine configuration dialog, under the Libraries tab,
    set the following files to native:
    And set these to builtin:
  4. Do a fresh install of IE6 with ies4linux, click on Advanced and edit the downloads and the install prefix to make it totally compatible with your existing .wine directory.
  5. Then run the Visual Basic 6 installer, and if everything goes well, cd to .wine/drive_c/windows/system32 and execute “wine regsvr32 comcat.dll” and “wine regsvr32 MSSTDFMT.DLL”

And your done! Have fun with Visual Basic on Linux!

Tested with wine 1.1.38 and Fedora Constantine(F12)

Upgrade WordPress, eh?

Here’s what most, or at least all of you are doing: your upgrading your WordPress blog back-end from time to time as and when releases are out. Most of the articles about this tell you how to upgrade. Well, this one doesn’t. Here are five reasons why not to upgrade WordPress!

  • Your present theme(which you are most comfortable with) would probably break
  • Your plugins, if the authors are either paralyzed or dead, won’t upgrade them, so you lose out on plugins that you already have installed and then waste your time looking for newer ones which provide the same functionality
  • In worse scenarios, you may lose your database(of course, you do have a backup, but restoring it would take time)
  • Takes ten minutes of your precious time(as a science student, I really don’t have much time on my hands)
  • Why on earth would you want to upgrade?

Then again, “When I upgraded my WordPress, I have new features and increased robustness”. Okay, so what? Let’s stick to one release which doesn’t have any bugs nor any glitches. Recently, around a year back, Automatic released two upgrades for WordPress, one after another within a month or so, because the earlier one had a potential security flaw. So your really not sure if the one your going to updade to would be secure as in “secure”, or would a flaw be discovered after you’ve upgraded, and then have your blog hacked.

There are so many features in the present WordPress which most of us fail to use or make use of properly, so why would you want to upgrade it when your not going to use the new features?

Now, think again,

Do I really want to upgrade my WordPress back-end?

P. S. If anyone knows how to disable that yellow banner that pops up when a new WordPress update is available, and/or know how to disable plugins from showing their updates, please comment how to.

You should not use Airtel

No one likes to be controversial about this. I would definitely agree with Airtel and it’s “just awesome” service to me. Now, I rather would not at all. “Airtel has me on the worse side”. Looking at this agreeable GPRS scheme, “Nightly Month@Rs. 89”, displayed at *567#, is that you get 100MB during the day free and 2GB free from midnight to early morning eight, with validity for thirty days. Convincing myself to go for this scheme(because as of now I live without the Internet), I happily activated it on my Airtel number. First day, 200MB was downloaded, no charges whatsoever, fine. Last night, 357MB was downloaded, which is numerically less than 2048MB, was downloaded, they charged me Rs. 62.35. So now, whatever happened to the free 2GB downloads in the night? I’ll tell you what happened to it: Airtel had a big stick up in their a**. Convincing some of my friends to go to some other provider won’t be easy.

Of course, your all wondering what happened to the Technical Support available at 121, well all I now hear is “Please SMS AIRTEL to 121 for all your balance related queries”, instead of the friendly, “Please hold while I transfer the call, blah blah blah”.

The covenant that I make,

“Thou shall and not think deepest in their thoughts about using Airtel and its services, for thou shall be doomed afterwards.”

You should not use Airtel.

Easily Sort Your Music Library

Here is a very simple script to sort your whole music library according to their artists,

# sortMusic v0.4
# make sure this script in in the music directory and you execute this script from there
# know issue: will display many errors, but it does it fine, those errors are not to be bothered about
# still needs a workaround
echo "$(ls -l *.mp3 | wc -l) Files will be sorted according to their Artists"
echo "Make sure all your song artists are correct, will wait for 3 seconds..."
sleep 3
for i in ./*; do
	artist=$(mp3info "$i" | sed -n 's/Artist: *//p')
	if [ -d "$artist" ]; then
		mv "$i" "$artist"
		mkdir "$artist"
		mv "$i" "$artist"
# To move all the incorrect id3 artists
mkdir "Z Singles Z"
mv *.mp3 "Z Singles Z"

# That was very simple, wasn't it?

Just make a file called sortMusic-v0.4 in your main music folder, paste the above code into that file, then do $ chmod +x sortMusic-v0.4 and then do a $ ./sortMusic-v0.4 in the music folder. Please download mp3info as this uses that package. Please note that this is very case-sensitive, so if your artists are same but differ in case, it will make a new directory for that one, so please take care until I have a workaround for this.

NON-Standards Compliant C++ with Mumbai University

Mumbai University fails to keep up with the ever-evolving C++ syntax. Making Turbo C/C++ as their prescribed IDE, Turbo C/C++ is ancient and will not compile with the present syntax of C++. Here is the simplest example:

#include <iostream.h>
#include <conio.h>
void main()
	cout << "Hello";

The above code, when compiled with g++ 4.3.4, will give the following errors, but with Turbo C/C++ will compile and run just fine:

firstApp.cpp:1:22: error: iostream.h: No such file or directory
firstApp.cpp:2:19: error: conio.h: No such file or directory
firstApp.cpp:4: error: '::main' must return 'int'
firstApp.cpp: In function 'int main()':
firstApp.cpp:6: error: 'cout' was not declared in this scope

Here is the same code, but following the correct syntax:

#include <iostream>
using namespace std;
int main()
	cout << "Hello";
	return 42;

will compile and run just fine.

Argggg!!! This never ends! They even introspect on Valid XHTML and CSS standards!

Managing Your Gentoo [“Sort-Of” Easily], Tips, and More

***This article has been placed under constant expansion. So keep a check on it!***

Law #1: If anyone tells you that, “To administer a Gentoo Build is easy”, tell him/her to go f*** off. Ofcourse, if your an expert at it, then it’ll be an exception for you. Yes, it really is easy if you understand what you are doing, unlike pulling your hair out.

Gentoo offers the most that you can think of getting out of any GNU/Linux box, and that is the very fact why administering it often becomes a headache. You will at first curse portage(the package manager), but eventually will realize that it’s the most superior one out there. Okay, I hate introductions, let’s get to work.

Required Gears:

  • Gentoo Build from stage3(stage3 is the best method to install Gentoo)
  • Some patience for reading

Package Managing and Tune-Ups:

You’ve probably noticed that compile time is long, so, if you have like >1GB RAM, you can opt to compile in RAM. Here’s how you do this in /etc/fstab. Add this line there and do a “# mount /var/tmp/portage”.

none /var/tmp/portage tmpfs nr_inodes=1M,size=900M 0 0

Portage does all its compiling in /var/tmp/portage, so if we have that in RAM, read/write speeds would be better. Again, you may also try out ccache, but it will cause some build to fail. For me, it failed to compile mono as it had some error in the cached libs. Now we have faster build time. Let’s make the searching and “Calculating dependencies…” happen a lot faster. For this, we’ll create a reiser4 loopback filesystem which will also compress the huge tree into only 220MB max. This is just done by making the blocksize a bit smaller. I prefer reiser4 as it’s extremely good with small files(you will have to patch your kernel for reiser4fs, so head out here: Patching the Linux Kernel for reiser4 support).

# dd if=/dev/zero of=s-port bs=1M count=250
# mkfs.reiser4 ./s-port
# mv ./s-port /usr
# mount -o loop /usr/s-port /usr/portage/
# emerge-webrsync

Note: You’ll have to relocate your distfiles, as this images is only 250MB and you cannot store distfiles in this image. Refer to the make.conf

You can add the following line to /etc/fstab to make it mount on every boot.

/usr/s-port /usr/portage reiser4 loop,noatime 0 0

Now, we should have a faster portage. In case you have a lower bandwidth, I suggest you to use the delta method of patching the tree. The package is called “app-portage/emerge-delta-webrsync”. Go ahead and install it. It will not download the whole tree everytime you want to sync, but only fetch patches(usually less than 2MB) and patch up the tree. It may hit your head that emerge –search is a bit slow. So then install “app-portage/eix”. It’s a common tool for searching as it displays results in less than 10 seconds.

Putting the next thing bluntly, many users are often very frustrated when portage complains about “masked” packages. For this, install “app-portage/autounmask”. The syntax for autounmask goes like this: autounmask category/package-version
# autounmask x11-wm/compiz-fusion-0.6.0
Continue reading “Managing Your Gentoo [“Sort-Of” Easily], Tips, and More”

[HOWTO] Create a hidden loopback device in a .jpg file

Well, I’m sure that you are definitely curious about how do you do this. Let me tell you this, it’s really simple.

  • Image File(any format will do or even any file will do)
  • Linux(I’ve only tested it on this platform but I guess Mac would also do)

Let’s get started, shall we?
First create a standard loopback device.

dd if=/dev/zero of=hiddenimage bs=1M count=10

Let’s see what does this do:
It creates a file called “hiddenimage”, with it’s size as 10MB.
Then, create a filesystem on it.

mkfs.ext4 hiddenimage

mke2fs 1.41.8 (11-July-2009) hiddenimage is not a block special device. Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 2560 inodes, 10240 blocks 512 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=10485760 2 block groups 8192 blocks per group, 8192 fragments per group 1280 inodes per group Superblock backups stored on blocks: 8193 Writing inode tables: done Creating journal (1024 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

Continue reading “[HOWTO] Create a hidden loopback device in a .jpg file”

EyeCandy for your VIA Unichrome

Not until recently, did I find out about the EXA acceleration method of xorg. It’s the new acceleration architecture. Well, I tried it out, read that it had chances of decreasing the responsiveness of my computer, but hey, there’ no harm in trying it. So, got to their documentation, followed through the steps, and wow!!! The 3D graphics work very well. It didn’t even slow down my computer one bit. Let’s take it to a higher cliff this time. Installed avant-window-navigator, and that too works great. Now, even a bit higher… the compiz-fusion test. I’m not sure if compiz would work on my VIA card, with its high 3D quality, but I’m eager to try it out this evening. So, all the users still using VIA Unichrome cards, don’t give up hope! 3D does work on with the EXA acceleration. Testing will begin this evening with compiz-fusion…
Avant Navigator on my Machine
UPDATE: Running compiz results in a “White Screen”, where the cursor is available, but the rest is white. I think I’m happy with shadows, transparency, fade in/out and avant navigator.

Sabayon fOuR oH

Based on Gentoo,
Sabayon 4.1, tells me:

  • Great performance with less RAM(though you need like 1GB RAM for it to work well enough).
  • Package Management System is absolutely fantastic, with it’s new “Entropy”.
  • Totally the perfect distribution.
  • A fine distribution for the newbie or the expert.

This is what a critic would say:

  • Definitely better than the leading Ubuntu, like a total drift between Ubuntu and Gentoo.
  • It has many other applications that do the same thing as the main one does.

It’s an absolutely fabulous Linux Experience ever. I would rate it 9/10. Highlighting one of its features, is that all small applications can be just installed from it’s binary form, while high-end application, like openoffice, can be compiled using portage, to provide maximum efficiency. What’s more? It’s speedy and a completely out of the box experience.

Finally it all pays off!!!

Yipee!!! I got 78.86% ! All the hardwork for five months pays back.

Indian Certificate of Secondary Education Examination 2009
Index No T/6563/015
Date of Birth 28/10/1993
Subject Percentage Marks
ENG 78
HIN 72
EED 86
HCG 76
MAT 74
SCI 72
CTA 94
Result * PCA

[HOWTO] Dynamic Plugins for WordPress

Problem: Installed the hemingwayEx theme. Looks great, but the pagination doesn’t work well without the custom hemingwayEx pagination plugin. I got that installed. The hemmingwayEx theme looks cool when it displays two posts per page. The plugin worked well except that for my other two themes, displayed two posts per page. I posted a topic at WordPress Forums. No results.

Solution: Just at the beginning of the hemingwayEx theme, I modified it to create a cookie, like this:

if(!isset($_COOKIE["wptheme" . COOKIEHASH])) {
		setcookie("wptheme".COOKIEHASH, stripslashes($ctheme), $expire);

Continue reading “[HOWTO] Dynamic Plugins for WordPress”

P&P Lava Lamp nav for your WP Blog

After two days of having intense jolts given to my head, I finally got the lava lamp navigation working! The orignal idea is from G. Marwaha’ Blog and Cory’s Place. By compiling the two articles, I have a clean way to implement it in probably any wordpress theme. I struggled at this one… but where there is a will, there is a way. This has been tested on the wordpress default theme and the subtleflux theme. You can see it live at my developmental theme. This is also for the lazy man, the quick “copy & paste” method.

So let’s get started, shall we?

Download this zip file containing the jQuery files for Lava Lamp Menu Unzip the files in your theme direcrory.

Continue reading “P&P Lava Lamp nav for your WP Blog”