3 Blog Entries for 2003


PyNewbie on Using Sockets in Python

  • July 13th, 2003 (4 years, 11 months ago)

A socket is a connection from one program to another. The two programs are typically on different machines, but they can also be on the same machine. Most sockets are from a client program connect to a server program to get some sort of information. Most socket transmissions are bi-directional -- send a request, receive some information. When you request a web page from within a web browser, you are causing the initiation of a socket connect from your computer (the client) to the web server's computer (the server, which could also be located on the same machine). You request ...

Read the rest »

About this entry

Date Posted:
July 13th 2003 at 12:07:00 PM

Tagged:
python


PyNewbie on making cryptograms

  • July 18th, 2003 (4 years, 11 months ago)

I used to enjoy cryptograms a lot and wanted to generate some on my own. I originally wrote a script to do this in Perl. While learning Python, I rewrote it and learned a few things about the string library in the process. Here goes...

import sys, string, random

We're going to be using sys to catch arguments passed to our script, or to catch input from a pipe. We've got lots of string manipulation so we're importing the string module. The random module will give us a way to shuffle a list so we can match ...

Read the rest »

About this entry

Date Posted:
July 18th 2003 at 12:07:00 PM

Tagged:
python


MySQL tip

  • November 26th, 2003 (4 years, 7 months ago)

I've been studying recently for the MySQL certification test and have discovered a few tricks along the way. One of my favorites is the combination of using pager and vertical output.

To set your pager to use less:

mysql> pager less
PAGER set to less

Now when you perform a select which returns more rows than rows on your screen, the pager will allow you to paginate through the results.

To get MySQL to display results vertically instead of in columns horizontally, end your SQL with "G" instead of with the semicolon (or "g")...

mysql> SELECT * FROM mails WHERE ...

Read the rest »

About this entry

Date Posted:
November 26th 2003 at 12:11:00 PM

Tagged:
mysql