Programming



7 May 10

To install latest version of postgresql we first we need to add pgdg repository to list of repositories open terminal and fire following commands, you need to be root.

wget http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-redhat-8.4-1.noarch.rpm
rpm -Uhv pgdg-redhat-8.4-1.noarch.rpm

Once repository is installed properly use yum to install postgresql as shown below

yum install postgresql
yum install postgresql-server

You can do above in a single line choice is yours.

Initialize the database

initdb -D /usr/local/pgsql/data

Start the database server

pg_ctl start -D /usr/local/pgsql/data

Voila your database server is setup and ready to use.

 


Filed under: OpenSource,Programming

Trackback Uri






25 Jun 09

Few months back I wrote this module for some product which I was working that didn’t work out so I thought I will make it available to people to use.

This is very simple PHP API for fetching stock quotes from yahoo finance. I hope people find it useful. How to use it is mentioned in the PHP file itself. In case you have some queries regarding same ; do let me know.

You can download the PHP file from this link ystock

Any feedbacks are welcome.


Filed under: OpenSource,Programming

Trackback Uri






15 Apr 09

The Python interpreter contains few easter eggs which expresses sentiments of Python developer by and large I will listing them down if you know more kindly let me know

1. If you open a Python interpreter, and type

import this

, it outputs the following:

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea — let’s do more of those!

2. On python interpreter typing from __future__ import braces

it prints the output as follows Traceback (SyntaxError: not a chance (<interactive input>, line 1)

3. On python interpreter type import __hello__

this outputs Hello world…

Those were few easter eggs which were there in Python pre-3000 release

An antigravity module is added to Python 3.0. Importing the module opens a web browser to an xkcd comic that portrays Python having an antigravity module

Kindly let me know if you know any more easter eggs.


Filed under: Humor,Programming

Trackback Uri






9 Mar 09

I am to used to searching everything from Firefox search providers box on the left hand side; I was getting fed up when I type some issue id for my local jira and not getting any results so I decided to develop a search provider for jira quick search and to my surprise it was easier than I expected; hence I put ins some effort in working it out and I want to save effort of people who might be interested in doing same.
We will create an xml file based on following page creating open search plugin for Firefox

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Jira</ShortName>
<Description>My Personal Jira</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">My Image URl</Image>
<Url type="text/html" method="post" template="http://vishy:8080/jira/secure/QuickSearch.jspa">
<Param name="searchString" value="{searchTerms}"/>
<Param name="ei" value="UTF-8"/>
</Url>
<SearchForm>http://vishy:8080/jira/secure/QuickSearch.jspa</SearchForm>
</OpenSearchDescription>

Edit the fields in bold according to your setup and save the file in your <Firefox installation directory>\searchplugins\jira.xml

Restart your browser and check the list of search providers; you will see a new search provider with name you specified in tag short name.

The above concept can be extended for searching any other intranet side through Firefox.

Enjoy searching Jira issues; post me back if you have some issue getting it working. :)


Filed under: OpenSource,Programming

Trackback Uri






1 Jan 09

Ballmer Peak

Ballmer Peak

I agree with Ballmer’s Peak; personal experience if you have proper quantity of alcohol and than do coding you are highly efficient but have no comments on whats that quantity as when I try I am not able to reach to that level but some time it happens on its own.

So alcohol is good for programmers; just kidding. :)


Filed under: Humor,Programming

Trackback Uri






12 Aug 08

What is Perl?Perl is a programming language referred as Practical Extraction and Reporting Language written by Larry Wall. It was written with a motto TMTOWTDI i.e.

There’s More Than One Way To Do It.

Perl Properties

  • Interpreted Language
  • “Object-Oriented”
  • Cross-platform
  • Extensible, rich set of libraries
  • Used for Web Programming

What do you need?

  • Active state Perl or any other standard Perl interpreter
  • Any text editor such as notepad

You can download Perl installer from ActiveState download website, you will get a list of installers there, download installer for windows.

Install ActiveState Perl, it does not takes much, simply double click on msi installer file and it will guide you through the rest of installation process.

Now that your installation is over simply go to windows command prompt and do the following

perl -v

You should get the result as below

This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 50 registered patches, see perl -V for more detail)

If you get these lines on command prompt, it means that Perl is successfully installed on your machine.

My First program

Just open your favorite editor and type the following lines

#this is my first program
print “Hell World this is my first program”;

Your hello world program is ready save it as “helloworld.pl” in any directory you feel like.

Go to command prompt and change the current directory to directory where you have saved your “helloworld.pl” and type on command line

perl helloworld.pl

You will get output as:

Hell World this is my first program

Key things to notice:

  • Everything that starts with a hash is a comment in perl
  • Perl statement ends with a semicolon

Perl is a lot more than this hello world program, this was just to give you taste of Perl.

I will be back soon with more elaborate articles on Perl, please keep checking this place.


Filed under: Programming

Trackback Uri