Test post to see how wordpress.com handles code

Following are the problems that I faced while pasting inline code using <code> and <pre> tags in wordpress.com with the theme – Twenty Ten

0. <code> tag does not work. Following is an indented code snippet put within the code tag.


void build_emp_list_frm_opt_emp_ds(opt_emp_ds* opt_emp_ds_ptr_arr[], emp* sorted_emp_ptr_arr[], int n_emp) {
int count = 0;
while (count curr_emp_ptr;
count++;
}
}

Using <pre> helps but not completely. It imposes the following limitations:

1. No matter what I do – I cannot indent the argument list of following function definition – move the last 2 args to the second line, keep all args on different lines, etc:

 
void build_emp_list_frm_opt_emp_ds(opt_emp_ds* opt_emp_ds_ptr_arr[], 
                                                 emp* sorted_emp_ptr_arr[],  int n_emp) {
    int count = 0;
    while (count < n_emp) {
        sorted_emp_ptr_arr[count] = opt_emp_ds_ptr_arr[count]->curr_emp_ptr;
        count++;
    }
}

2. <pre> messes up indentation of something as simple as this:

1. name                # salesman name
2. base_salary       # base salary
3. n_cust_conned  # number of customers conned
4. comm_per_sale  # commission per sale

3. No bells and whistles – numbering code lines, highlighting syntax, scrollable bars within the code snippet (available in some of the other themes but no luck with indentation), etc.

Will try switching themes to see if this post reflects favorable changes.

If you can live with a little bit of unindented code, then make do with wordpress.com. I can’t. So I moved to blogspot where in I can install the SyntaxHighlighter widget.

Advertisements
Posted in Uncategorized | Leave a comment

Going back to blogspot

The Reason

Further posting at: curiosityhealsthecat.blogspot.com

Posted in Uncategorized | Leave a comment

Perl program to simulate tail -f

Created a github account to share my bin with the rest of the world.

Had written a perl program to simulate tail -f quite some time ago. Put it up there. Enjoyed writing it. Hope you feel the same while playing with it.

Here it is: simtail

Posted in Uncategorized | Leave a comment

A very good link to know more about ELF files

Was searching the net to learn about the structure of ELF files. This was a godsend:

Linux Forums – understanding ELF

Posted in Uncategorized | Leave a comment

Cygwin + Poderosa = bye bye cmd.exe

Does your job require you to boot up your box in Windows instead of Ubuntu? Do you miss the vi-mode on the command line? Do you become nostalgic at the mention of multiple shell tab sessions? Do you feel like bashing your boss’s head if he says he won’t shell out any extra money to buy you a shiny new Windows power shell (I think it should be worth a try)

Fear not, for the open source world has made efforts to bring you closer to your $HOME.

Cygwin – a Linux like environment for Windows gives you all the tools that you missed on cmd.exe – find, grep, ls and many more. You can download Cygwin from Cygwin home

Just remember one thing – when you install it for the first time – do a basic installation – i.e. do not select too many packages. Let the default installation do its job. You can always add new packages by running the setup again (no – it won’t erase the previous setup – that’s just cygwin’s way of adding new packages).

And while I see some of you drooling and foaming at the mouth with this knowledge, while others rubbing their palms in anticipation and clearing your throats for a wicked mad scientist laugh, a little info which saved me some more time while installing cygwin – the clear command is a part of the ncurses package, which is not a part of the default installation. So check that one on if you can type clear faster than you can do a ctrl-l.

And so with cygwin, it is a cyg-win-win situation. I will try to keep the wordplay at a minimum – I promise. Please read on.

Cygwin gives you find but not the vi-mode on the shell. And neither does it give you tabbing.

That prophecy is fulfilled by Poderosa. Its pre-requisite is the presence of Cygwin (I don’t think it does check but it has a cygwin icon on which you click to open up tabbed cygwin sessions). Download it. Its a simple ‘click-next-click’ installation.

But whenever I try to connect to cygwin via Poderosa I get an error “The registry key SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/ is not found. Cygwin may not be installed correctly” (Damn you windows for not giving copy-paste on error dialog boxes). But like a good ignorant Windows user I click OK and it works.

<jingle_bells_tone>
multi tabs, multi tabs – bashing all the way.
oh what fun, it is to type, in the vi-mode today.
</jingle_bells_tone>

I have been using Cygwin + Podersoa as per the recommended dosage and the doctor says my recovery is pretty fast.

Get well soon.

Posted in Uncategorized | Tagged , , | Leave a comment

Speeding up ppm module installation

Now that I have to (not that I want to) work on Windows, I am doing what I can to make my experience on it as comfortable as it was on Ubuntu – at least for the command line part. So a few initial posts will contain links, tips and all that I did to break the barriers of cmd.exe. Irony – I am blogging from my roommate’s stylish Dell Studio XPS which is running Ubuntu.

I recently installed Active state Perl and while playing along I tried to do a few module installations. Invoking ppm-shell gives you a cpan shell like prompt where in you can install all the modules that Active state has to offer. A serious pain in this process is that after downloading and installing each module, it generates HTML as a part of its document repository and this slows down the installation to a great extent.

And what does that deny you? No more under 30 second installs of File::ReadBackwards and trying to see if the apache access log when read backwards spouts out satanic verses. 🙂

So I did what I do when I am caught in a fix like this – Seek the wisdom of the monks. And as always, I leave the monastery with a happy grin. Following is the link to my post and the replies: Perl monks query

I have always got a reply to my queries on perlmonks.org within 2-3 hours of my posting a question. I guess that’s their unwritten SLA 🙂

Posted in Uncategorized | Tagged , | Leave a comment