Saturday, December 29, 2012

How to cook Potato for Masala Dosa

Wash the potatoes, cut them in half and put them in a cooker. Add water and put it on the stove. When the steam comes out 3 times, switch off and wait for the potatoes to cool down.

Once the potatoes cool down, peel off the skin and throw it away. Mash the potatoes, mix salt and taste it to make sure you have the right amount of salt.

Cut onions, tomatoes and chillies.
Put some oil in a kadai and let it heat a bit.
Add awalu, jilakara, urad dal and karepaku and fry them till it goes chat pat.
Add onions and fry till light brown.
Add tomatoes and chillies.
Take a small spoon and add a quarter spoon of turmeric powder.
Add the mashed potatoes and mix.

Keep it on the stove on a low flame for a few minutes and serve hot.

Deploying a Catalyst application with Starman and Apache on Linux

Go to your application directory and run this command, to run the server.

starman -I./lib --workers 1 --port 3000 myapp.psgi --log log/myapp.log --pid run/paxi.pid --daemonize

Confirm that the PSGI server is running on the server by visiting http://localhost:3000.

Add this to your Apache configuration file. On centOS, you will find it at /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
    ServerAdmin email@myapp.com
    DocumentRoot /var/www/vhosts/myapp
    ServerName myapp.com
    ErrorLog /var/log/httpd/error_log-myapp
    CustomLog /var/log/httpd/access_log-myapp common

    ProxyPreserveHost On
    ProxyPass / http://0:3000/
    ProxyPassReverse / http://0:3000/
</VirtualHost>


Now, you should be able to visit http://myapp.com from any browser.

Thursday, November 1, 2012

How to make dosas

Get up early in the morning.

Wash 3 cups rice, 2 cups boiled rice, 1 cup pesarapappu (urad dal) and a handful of menthi seeds.
Mix them all and soak them in water in a vessel.

Come home from work in the evening, and go straight to the kitchen.

Put the seeds in a mixie along with some water. Take all the batter and put it in a vessel. Keep it next to the stove and leave it overnight for fermenting.

Next morning, add some salt, and mix.

And you are ready to start making your dosas.

Take a non stick tawa, and keep a cup of oil and a wooden ladle ready. Put the tawa on a stove on a small flame, put some oil on it and spread the oil.

Take a big ladle with a flattish base and use it to pour one cupful of batter onto the tawa. Spread it going in a circle from the center to the outside until it is reasonably thin. Don't make it too thin, or the dosa will get stuck to the tawa. Raise the flame on the stove, and wait till it starts becoming brown. Reduce the flame on the stove. Use the ladle to raise the dosa from the tawa, and turn it around. Fry it a little bit.

The first dosa is ready.

Before making the next one, take an onion, and cut off the base. Rub the onion on the tawa. This helps prevent the next dosa from sticking to it.

Enjoy your dosa! You deserve it after working so hard!

Wednesday, October 31, 2012

TWS - How to add a new workstation

Below are the steps to add a new FTA to your Tivoli Workload Scheduler environment.

Create a file, ws.txt, with the workstation definition,like this

CPUNAME MACHINE_NAME
  OS UNIX
  NODE MACHINE_NAME TCPADDR 31111
  DOMAIN MASTERDM
  FOR MAESTRO
    TYPE FTA
    AUTOLINK ON
    BEHINDFIREWALL OFF
    FULLSTATUS OFF
    SERVER D
END



Run this command to add the workstation

composer add ws.txt

To start the netman process on the workstation, login to the workstation as the tws_user, and run this command
StartUp
or
/opt/IBM/TWS/TWS/StartUp 


To create the Symphony file on the workstation, run this command on the master
JnextPlan -for 0000


To link the  new workstation to the master, run this from the master
conman 'link MACHINE_NAME'

To raise the limit of the number of jobs that can be run on the machine at one time,
conman 'lc MACHINE_NAME;40'

Once this is done, you can start scheduling new jobs on this workstation.
 

Starting with vim

To open a file in vim, at the prompt, type
$ vim test.txt

This opens test.txt if it already exists. Otherwise, it creates a new empty file named test.txt and opens it.

You can not type anything as soon as you open the file, because there are two modes in vim. And when you first open the file, vim is in command mode.

In the command mode almost every key on the keyboard is a command. For example, i is the command to start inserting text.

In the commands which follow, I will say esc before the command every time(eg: esc i), because we are usually using these commands after we finish typing something. But if you are already in command mode, you can just hit the key and there is not need to hit the escape key every time.

esc i    Insert text
Now, you can start typing in any text.

Once you have finished, press escape again, to go back to command mode.


esc :w Save File
esc :wq Save and Quit
esc :q! Quit without saving   
esc u Undo changes
esc control R     Redo changes

esc dd Delete a line
esc dw Delete a word
esc x Delete one character
esc yy Copy a line
esc yw Copy a word
esc p Paste last copy or cut contents

When you want to learn more, you can try this vim tutorial.

Tuesday, October 30, 2012

Happiness

The more I want someone to suffer, the more I suffer myself.

The more I want someone to be happy, the happier I find myself.

How to check your TWS workstation

ps -u twsuser
Displays a list of processes owned by twsuser which are currently running.

ps -aef | grep tws
Displays a list of processes which contain the string 'tws'

Any of these commands should show that these processes are running:
netman, monman, writer, mailman, batchman

$ ps -u twsadm
  PID TTY          TIME CMD
 5312 ?        00:00:22 netman
 5403 ?        00:01:30 monman
12041 ?        00:00:00 writer
12042 ?        00:00:00 mailman
12044 ?        00:00:00 batchman
$

conman start
If netman is not running, use this command to start it. If that doesn't work, try using the full path.

/opt/IBM/TWS/TWS/bin/conman start


conman 'link  MACHINE_NAME'
If netman is running, but the other commands are not running, you will have to link this workstation from the master. Login to the master domain manager as the tws_user, and run the command. Or, you can run this command to link to all machines.

conman 'link @!@'

Perforce Environment Variables

To use Perforce commands from the command line, we need to set up these environment variables.

P4USER=myusername
P4PORT=path.to.p4.com:1666
P4PASSWD=mypass

You can find a list of commands for developers here.
Admin commands are here.

TWS composer commands

Here is a list of Tivoli Workload Schedule composer commands that I have used.


composer display ws=@
Display details of all workstations.

composer display ws=MACHINE_NAME
Display details about the workstation MACHINE_NAME

composer modify ws=MACHINE_NAME
This displays a temporary file with the details of the workstation in the default editor, usually vi. You can edit the file as necessary and save it. Sample file is below.

CPUNAME MACHINE_NAME
  OS UNIX
  NODE MACHINE_NAME TCPADDR 31111
  DOMAIN MASTERDM
  FOR MAESTRO
    TYPE FTA
    IGNORE
    AUTOLINK ON
    BEHINDFIREWALL OFF
    FULLSTATUS OFF
    SERVER D
END

This file shows the definition of an FTA which is ignored by the master domain manager.
If you don't want your FTA to be ignored, remove the line with 'IGNORE' in it.

For more information, please go here.

Monday, October 29, 2012

How to schedule a TWS job from the command line

Create a text file with the information of the job stream and the job. Make sure that the names of the jobs and the job streams are not the same as any other jobs on that machine. Then run the composer command to schedule the job.

To get a list of all the jobs on any system,
conman 'ds MACHINE_NAME#@' > all_jobs.txt

To check if you have used the name already,
cat all_jobs.txt | grep NEWNAME

Create a new file, new_job.txt, with content like this:

SCHEDULE MACHINE_NAME#JOB-STREAM-NAME
ON RUNCYCLE RC1 VALIDFROM 10/29/2012 "FREQ=DAILY;INTERVAL=2"
( AT 1230 )
KEYSCHED
:
MACHINE_NAME#JOB-NAME
 SCRIPTNAME "/path/to/some/dir/script.sh"
 STREAMLOGON username
 TASKTYPE UNIX
 RECOVERY STOP
 KEYJOB
END

This creates a schedule for a job which starts from October 29th 2012, and runs daily. There is an interval of 2 days between each run, so, the job runs on alternate days. Make INTERVAL=1 if you want the job to run every day.
TWS creates a new shell and logs into the system as 'username' and then runs the command. Make sure that username has permissions to execute the script.

Once the file is created and has all the details, run this command to schedule the job
composer replace new_job.txt

To check if the job has been scheduled properly, again run the conman ds command and check that the new job shows up.
conman 'ds MACHINE_NAME#@' > all_jobs.txt

Perforce admin commands

Some useful commands in case your Perforce ever gets hung.


p4 counters
If this displays monitor = 2, it means that you have monitoring enabled.

p4 monitor show
Shows perforce process ids, the owners of those processes, the current status/job type and how long they have been running.
p4 monitor show -ela | grep -v IDLE 
Shows a longer output. And removes the idle processes from the list.

p4 monitor terminate
If you find that any commands are running for a long time, you can delete them with this command.
p4 sync and p4 submit commands are not terminated this way because even though they may be long running, they do not hold excessive database locks and are not the cause of hung systems.

p4 admin stop
To stop perforce

p4 users
To show a list of Perforce users

p4 groups
Displays a list of Perforce groups.

p4 workspaces
Displays a list of client workspaces of all the Perforce users.

p4 opened -a
Displays a list of all opened files in all client workspaces

p4 info
Displays client information.

p4 lockstat
Displays the locks which are held by Perforce.


Sunday, July 1, 2012

Lacuna Expanse

The Lacuna Expanse is a region of space with millions of habitable worlds. You can play with or compete against thousands of players as you build your empire, fight off spies in a battle for cold war supremacy, form alliances, search the expanse for lost ancient artifacts, and more.

https://us1.lacunaexpanse.com/#referral=6a5a982f-dd3f-3499-9efe-e3079cbb5aa6

From FB: 
the game is almost 4 games in one... Build and explore, trading and interacting with other people, playing a cold war type of spying game, and fighting with potentially HUGE fleets, between you and AI's, or some human protagonist.

Sunday, April 29, 2012

Generosity

Three homeless boys who made a living by begging and shining shoes on trains got out of three different compartments, met on the platform and started exchanging notes. One of them had earned 5 rupees, another had earned 2. And one had nothing. But he said something that I will never forget-

"Kal maine das rupay kamaya. Sabko khana khilaya."
meaning
"Yesterday, I earned 10 rupees. I bought food for everyone."

Who was more generous?

The boy who gave everything, when he had nothing.
Or the rich man who gave 85% of his wealth, but still had a few billion dollars left.

Monday, April 23, 2012

Perl marketing and CPAN module install tests

Swartz asks us to stop running tests while installing CPAN modules. This a very good idea.

It is very important to make it easy for a beginner to install and work on any Perl module. And a beginner can not be expect to be able to use the results of the tests for anything useful.

We should make a default Perl not require tests to install CPAN modules, while an experience user should still be able to turn on tests.

This will make it faster, and easier for a beginner to actually do something productive and get to the aha moment.

We don't want people to feel the same way as they do with slow web pages or splash screens.

Saturday, April 14, 2012

Learning Perl with Testing

If you want to learn Perl, you will find many tutorials which teach you how to program. And then, when you want to learn testing, you will find other tutorials, which teach you only how to test.

Eventually, you will want to do test driven programming where you write code and tests and the same time.

Much better to learn to code and test at the same time right from the beginning.

Here is an example of how to do it in Perl.

binary.pl

#!/usr/bin/perl
# Recursion - convert decimal number to binary
# from Higher-Order Perl: Transforming Programs with Programs
sub binary {
my $n = shift;

return $n if $n == 0 || $n ==1;

my $k = int($n / 2);
my $b = $n % 2;

my $E = binary($k);
return $E . $b;
}

binary.t

require "binary.pl";
use Test::More;

is( binary(0), 0, "0 : 0" );
is( binary(1), 1, "1 : 1" );
is( binary(2), 10, "2 : 10" );
is( binary(3), 11, "3 : 11" );
is( binary(4), 100, "4 : 100" );
is( binary(5), 101, "5 : 101" );
is( binary(6), 110, "6 : 110" );
is( binary(7), 111, "7 : 111" );
is( binary(37), 100101, "37 : 100101" );

done_testing;

You can run it to see all the tests passing.
ok 1 - 0 : 0
ok 2 - 1 : 1
ok 3 - 2 : 10
ok 4 - 3 : 11
ok 5 - 4 : 100
ok 6 - 5 : 101
ok 7 - 6 : 110
ok 8 - 7 : 111
ok 9 - 37 : 100101
ok 10 - 0 : 0
ok 11 - 1 : 1
ok 12 - 2 : 10
ok 13 - 3 : 11
ok 14 - 4 : 100
ok 15 - 5 : 101
ok 16 - 6 : 110
ok 17 - 7 : 111
ok 18 - 37 : 100101

This tests that it works. Now, we think about how to break it. Lets add tests to see what our function does if we give it a negative number or a string as an input.
Lets assume that the function should return a 0 if the input is incorrect.

is( binary("a"), 0, "a : 0" );
is( binary(-1), 0, "-1 : 0" );

You see that the function fails like this:

not ok 19 - a : 0
# Failed test 'a : 0'
# at C:\Documents and Settings\others\My Documents\perl_stuff\recursion\dec_to
_bin.pl line 53.
# got: 'a'
# expected: '0'
not ok 20 - -1 : 0
# Failed test '-1 : 0'
# at C:\Documents and Settings\others\My Documents\perl_stuff\recursion\dec_to
_bin.pl line 54.
# got: '01'
# expected: '0'
1..20
# Looks like you failed 2 tests of 20.

So, you change your binary function to return a 0 if the input is not a positive integer, and you are done.

sub binary {
my $n = shift;

return 0 unless $n =~ /\d+/ && $n >= 0;
return $n if $n == 0 || $n ==1;

my $k = int($n / 2);
my $b = $n % 2;

my $E = binary($k);
return $E . $b;
}

How Perl and PHP became popular languages

Disclaimer: This is completely my imagination, and may be far from true.

Perl

First there were cgi programs. You had a web server, and you named one directory as 'cgi-bin'. Any programs in this directory were executed, and the results were sent back to the browser.

If a company wanted to have a website, they would speak to their sysadmins, who would just have to create a simple script and put it in the cgi-bin directory. Perl was already available, and it was easy to learn for someone who knew bash or awk. So, they chose Perl.

And that was how Perl first became popular.


PHP

If someone has learnt some HTML, and is able to make a website. But now wants to add some features which need a backend. Then, the easiest way to do it, especially if you are already using apache, is to use PHP.

Since there are a lot of such people, PHP became popular.

And since there are a lot more people who come from a HTML background, than from a programming background, PHP is more popular than Perl.


Perl was the king of open source web programming, but now PHP has taken its place.

The Best Marketing for Perl

"Do you like your job?"
"I love it."
"What do you do?"
"I'm a Perl programmer."

Sunday, April 8, 2012

Perl Target Markets

These are my thoughts about marketing perl in response to the discussion going on on chromatic's blog.

Before we sell a product, we first need to learn something about the people who we are selling to. At the same time, we need to focus on our strengths.

Here, I'm going to try to categorize the Perl market, so that we can decide which one to focus on, and work on it.

One way to categorize is -
  • Existing users
  • New users

We want both to use Perl for new projects. And we want existing users to stay with Perl on their current projects.

Another way to categorize-
  • Perl project maintainers
  • Job creators / Managers / Decision makers on new projects
  • Job seekers / Programmers / Testers
  • Students
  • Open Source project creators / maintainers
  • Scientists
  • System Administrators
  • Computer Science teachers

Each of these markets has different requirements, and we need to focus on different things while selling to each of them.

Managers

For a manager in a company to seriously consider a language, he must know that he will be able to find people with experience in that language, or who can pick up the language and become productive in it quickly. If we target students, they would include Perl in their resume right in the beginning of their careers and not delete it for many years.

Programmers / Testers

Most programmers would stick to the language which their work needs them to use. And it would be very difficult to convince them to learn a new language. So, students are our best bet.

In companies, Perl is already used for testing. A look at the job ads show that though Perl developer jobs are few, there are a lot of openings for Perl testers.

We need to do our best to make the Perl testing team one of the most productive and efficient teams in the company.

Students

A student may be interested in

  • Doing what everyone else is doing (peer pressure)
  • Getting a good job
  • Impressing her professor
  • Getting that class project done on time
  • Learning new concepts
  • Easily able to get books and reference material, preferably for and online
  • Getting help easily

If you can help with all of this, you will attract new students to Perl

But, as a person the student may be interested in other things like, say, getting a date.

Now, if Perl can help the student do that, you can guarantee that they will be devoted to Perl!

Saturday, April 7, 2012

How to say Thanks

You may read advice on how to be a good leader, and see "Thank your team members whenever you get an opportunity to do so".

If you do say thanks, please say it because you actually feel grateful, and not just because you are supposed to say it.

A true leader is always genuine and never fake.

Wednesday, March 14, 2012

Magento import - misleading error - sku not defined

I got this error while doing an import into Magento:
Skipping import row, required field "sku" is not defined.

When I checked, all the rows did have a valid value for the SKU.

But, I had a few column names which contained special characters like this - text_with_specialÂcharacter.

When I changed the column names to something like text_with_special_character, and removed the special characters, the error went away and the import was successful.

Tuesday, March 13, 2012

Magento Import successful, but no imported products seen

I successfully ran an import of a CSV file into Magento, and it said
  • Processed 100% 2/2 records
  • Imported 2 records
But when I logged into the magento admin panel, I could not see the two new records.

To fix this, I had to change the value of the status column to 'Disabled' or 'Enabled' for all records in the CSV file.

Friday, January 20, 2012

Relationship health check

If you're joking with each other, you have a healthy relationship.

If you're joking about each other, its time for some medicine!

If you're not joking at all...

Monday, January 16, 2012

Convincing arguments

Just because you won the argument doesn't mean you convinced them!

Sunday, January 15, 2012

Control

It is very important to understand what we are trying to control, in order to control it successfully.

When there is a forest fire, we would try to put out the fire as soon as possible. We may be able to put it out a few times very quickly and easily. But because we do this, it means that a large amount of dry wood, grass and leaves is left unburnt. And the next time there is a forest fire, it is so huge, that you can't control it no matter how hard you try.

Whether you are trying to control your project, your anger or your debts, understand it well, and then decide what you need to do about it.