What a Victory !!!

Man of the Match @ ElthamWhat an amazing victory by our team (Royal College of Surgeons) v/s EDF at Eltham on 26th July 2009. I will remember this day for a bit long time wonderful day with a great excitement of sport.

Early in the morning, I was so scared to loose again with the same team.Last year, the same team has crushed us very badly. In that game, half of our team were playing cricket first time and unfortunately we lost the toss and with the help of extra run generously given by our bowler bowled wide deliveries crossing the boundary in number of times. At the end, I turned up bowled 14 overs as no one else can bowl without giving extra run.

EDF score 293 in 40 overs. I had over expectation from our team that, we will win the game if we able to survive till 40 overs.  We start our inning and within couple of overs two wicket were down. I went for batting and scored 26 runs which was highest run in our team and got caught on Mid off. After my wicket no one could survive to give fight back to them and we ended up with 98 all out. What a shame for us !

Since that defeat, we aimed to improve our game for next season. We went for net practice number of times at Oval cricket ground and we had couple of field session at Regents Park’s ground.  After hard work, we feel that our game is competitive and we all were so confident that, this time we can fight back to EDF.

26th July, the day we all eagerly waited for, it was bit scary and little excited as, we don’t  want to loose again. We selected decent team with batting order from very less options.

3762452663_8086812870_bWe lost the toss, Oh God!! not again, please keep your holy hand on us to win this game. Greg and Myself start the first bowling spell. First delivery of Greg was fabulous, Opener of EDF get bowled which is very helpful for us as they got themselves in pressure. After first spell, Jamie and James bowled which was quite expansive for us as they are quite medium pace sort pitch bowlers. Now it was time for Matt and Ian to bowled and both done very well. Last 10 over remaining and they were planning to attack us but we had plan to come back with tight spell on last spell. Greg and Myself introduced in bowling. With no wicket on my first spell I was so hungry to get wicket and I start bowling with all my pace and you know what?? in the second ball I got wicket…..   new batsman on the field. I had intention to bowled yorker but didn’t mange to get it. Ball became full toss on wicket player miss the ball and howzzat, got another wicket. I did swing like Soyeb Akhtar.  It was a wonderful moment of the day. We ended up with 163-8 in 40 overs. I bowled 7 overs with 2 maiden overs with only 17 runs. I though and infact everyone of us were thinking that we did quite well in bowling side.

It’s batting time for us now. Jaime and Ian had opened up batting for us. Ian hit boundary on first ball which was quite impressive. Jamie didn’t do well, missed couple of deliveries and then got out on duck. Same thing happened with Greg he got out in next the over. It was time for me to get on the field. I played couples of nice shot and quickly I had scored 25 run. In bad shot selection I got caught on Mid On. I was so tense that this is it. we were loosing again as I was not sure about my other team mates could survive. The Score was 63-3, 101 runs needed to win. Ian and Matt performed extremely well, both were quite lucky  as fielding team dropped couple of catches. At the end, our team survived to make 164 without loosing any more wickets. Ian did quite well and score 83 not out with two sixes.

It was time for celebration, there were barbecues from EDF. Most of EDF members didn’t stayed for it though . Jamie’s partner  was doing scoring for us.  Statically ‘Man of the Match’  awarded to me for my contributions in bowling and batting. It was really nice day for all of us.

Installing MySQLdb and ZMySQLDA for Zope in Windows

1. Shutdown Zope if running.

2. Copy the directory and files

Download Module Zope_MySQLConnection

MySQLdb
_mysql.pyd
_mysql.exceptions.pyc
_mysql.exceptions.pyo

to the lib/python/ directory inside your Zope instance.

In a generic default install of Zope the location will be:
C:\Zope\Instance\2.10.4\lib\python\

MySQLdb (MySQL for Python) 1.2.2 allows Python to access MySQL using
the Python DB API 2.0 syntax. This version of MySQLdb uses Python
2.4. (The version of Python installed by the Zope 2.10.4 installer
is 2.4.4.) Older/newer versions of Python (2.3, etc.) will not work
with these files, but a version of MySQLdb which does is available from
the sourceforge link below.

(Source: http://sourceforge.net/projects/mysql-python )

3. Copy the directory ZMySQLDA

to the Products/ directory inside your Zope instance.

In a generic default install of Zope the location will be:
C:\Zope\Instance\2.10.4\Products

This is the database adaptor used inside Zope. (ZMySQLDA 2.0.9b3)

(Source: http://sourceforge.net/projects/mysql-python )


4. Restart Zope.

Upon starting Zope you will see a few depreciation warnings. These
are no cause for alarm, however ZMySQLDA will apparently need to be
updated to work with Zope versions 2.11 and above.

If the database adaptor is installed correctly, the item Z MySQL
Database Connection should be available in the “add” dropdown list
and ZMySQLDA should be listed in the collapsable Products menu
(under Control Panel) in the left frame.

You probably need to have installed MySQL and created at least 1
database to add the connection object. The connection string is

database user password

or if there is no user/password simply

database

Click on the connection object to “browse” the database items or enter
“test” SQL queries. If you can browse the database and successfully
enter SQL instructions, the connection between Zope and MySQL **MAY**
be complete. (See below.)

Python Tutorials

Python tutorials for beginner to advance level programmer including video tutorials.

Video Tutorials

Categorized Tutorials

Beginners (20)

General and Advanced (14)

Internet: Django (9)

Extending and Embedding (8)

Games (7)

GUI Programming: General and Miscellaneous (10)

GUI Programming: Tkinter (10)

GUI Programming: wxPython and PythonCard (11)

GUI Programming: pyGTK and Gnome (16)

GUI Programming: QT and KDE (6)

HTML and XML (35)

Internet: Network and Web Programming (16)

Web Scraping, Screen Scraping (3)

Internet: CGI (5)

Python CGI FAQ

Internet: Web Frameworks-Turbogears and Cherry Pie (7)

Internet: Web Frameworks-Twisted (5)

Internet: Web Frameworks- Zope and Plone (5)

Internet: Web Frameworks-Other (4)

Internet: Django (9)

Jython (12)

Testing, Test Driven Programming and Unit Test (5)

Editors and IDE’s (7)

Mac and Apple (13)

Windows (14)

IronPython (7)

Decorators (6)

Generators and Iterators (7)

Database (12)

Biology and Bioinformatics (7)

Statistics(1)

Math, Science, and Physics (38)

OOP, Objects, and Object Orientation(6)

Descriptors(2)


Design Patterns(6)

Introspection(1)

Metaclasses(5)

Firedrop (2)

Weblog and Content Management System

  • Firedrop Plug-ins Tutorial Firedrop is a (Programmable with Plug-ins) Python (and Wax) Blog Client Manager Tool and Content Management System

Concurrent Programming (2)

Stackless Python (5)

Threads (11)

Threads and Concurrent Programming

  • Python Threads PDF file, click on “threads” at top of html page

Unicode (7)

  • Python Unicode Tutorial

Continuations (3)

Continuations

Regular Expressions (5)

Text and String Processing (4)

Linguistics and Natural Language Processing (5)

VPython (6)

Curses (3)

Searching and Sorting (4)

Python and Simulation (4)

  • Python as a Discrete Event Simulation environment
  • Quick and Painless Monte Carlo Simulation
  • Quick and Painless SimPy Tutorial SimPy is for Discrete Event Simulation

Search Engines and Social Software (7)

Python on Mobile Devices (2)

Flash (3)

  • A tutorial on connecting client-side Flash applications to Python XML-RPC web services
  • Embedding Flash in Python
  • Tutorial: Macromedia Flash served by Python

Robotics (3)

Functional Programming (5)

Genetic Algorithms and Python (1)

Date and Time Usage (1)

Neural Networks (3)

Pickle (1)

PyPy (1)

Miscellaneous Specific Topics (22)

Cryptography

Documentation and Reference (11)

Python Zip Compression

Send email using python script in Plone

If you dont want to hardcode the Mail Host id into your script and want to be able to send email to someone from within a (Script) Python this script will do it.

try:
    mailhost=getattr(context, context.superValues('Mail Host')[0].id)
except:
    raise AttributeError, "cant find a Mail Host object"

mMsg = 'a testful email message \n that contains a few line breaks. \n ~runyaga'
mTo = 'runyaga@abc.com'
mFrom = 'runyaga@xyz.com'
mSubj = 'mail subject'

mailhost.send(mMsg, mTo, mFrom, mSubj)

Random password generator Python script

A Simple and effective two line python code for password generator.

A short, readable password generator that can be launched from the command line. Just launch it from the shell and it will print out an 8-character password. You can also specify the length.

string_list = [ch for ch in string.digits if not ch in '10'] + \
               [ch for ch in string.ascii_uppercase if not ch in 'LO']  + \
                [ch for ch in string.ascii_lowercase if not ch in 'lo'] 

return string.join(random.sample(string_list,8),'')