Sunday, September 12, 2010

MySQLdb - 1153, 'Got a packet bigger than 'max_allowed_packet' bytes'

the technology

- mySQL Server 5.?
- python 2.6
- MySQLdb 2.3.1?
- Windows 7

the scenario

1. import MySQLdb
2. create a connection to the db:
> connxn = MySQLdb.connect(params_dict)
3. loop, re-using the connection, each time inserting say 250 records in one query
> cursor = connxn.cursor()
> cursor.execute(multi_record_insert_statement)
> cursor.close()
> connxn.commit()

problem is, i was getting the following errors:

- 1153, 'Got a packet bigger than 'max_allowed_packet' bytes'
then, when i tried to create a new connection, i was getting
- 2006, 'MySQL server has gone away'

Saturday, September 11, 2010

ubuntu splash screen

How to change the gnome splashimage.
1. Put the splash image you want in "png" format and store it in /usr/share/pixmaps/splash. (You can use Nautilus or the "cp" or the "mv" command from the terminal window if you want. Just remember to use "sudo" before your command. )
2. Press ALT-F2 then at the prompt type "gconf-editor" (without the quotes).
3. Click on "apps" then "gnome-session" then "options".
4. To the right of the Name "splash_image" double click on the Value "splash/ubuntu-splash.png".
5. Change "splash/ubuntu-splash.png" to reflect your new splash image: "splash/newsplash.png".
6. Click on "File" then "Quit".
7. Logout then login in again to see your new splashimage.

ssh to ubuntu machine

http://mybroadband.co.za/vb/showthread.php/52204-How-to-do-VPN-with-iBurst-with-Linux

https://wiki.ubuntu.com/AdvancedOpenSSH

Did you install the SSH server on your Ubuntu box? Check with this:
Code:

which sshd

and if you installed check with this if it's running:
Code:

ps -ef | grep sshd

If both are true then check if you have it listening:
Code:

netstat -aln | grep ":22"

Kind regards,

Eric

Make sure SSH is running on Ubuntu:
Code:

ps -ae | grep sshd

It should return something like:
Code:

720 ? 00:00:00 sshd

Thursday, September 9, 2010

Python is Not Java - PJ Eby

When arriving at python from a statically typed OO language such as c# or java, many people are initially tempted to emulate the formalism required by a statically typed language. Like S&M being permissible in certain liberal jurisdictions, the free-form multi-paradigm environment that is python allows you to follow your slavish inclinations if you so desire, but it would be entirely your own choice - as python generally always offers alternatives, and often a more compact or concise one than that which first comes to the the python-naive mind.

Phillip J. "PJ" Eby
Python is Not Java

The Joel Test

http://www.joelonsoftware.com/articles/fog0000000043.html
http://en.wikipedia.org/wiki/The_Joel_Test
http://stackoverflow.com/questions/402050/administering-the-joel-test

The Joel Test

Do you use source control?
Can you make a build in one step?
Do you make daily builds?
Do you have a bug database?
Do you fix bugs before writing new code?
Do you have an up-to-date schedule?
Do you have a spec?
Do programmers have quiet working conditions?
Do you use the best tools money can buy?
Do you have testers?
Do new candidates write code during their interview?
Do you do hallway usability testing?

Friday, September 3, 2010

Use dotNET 2.0 Assembly in dotNET 4.0

ERROR

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

FIX

ensure that app.config contains the following







Thursday, September 2, 2010

Exception Handling in Python

quoted directly from Doug Hellman


#!/usr/bin/env python

import sys
import traceback

def throws():
raise RuntimeError('error from throws')

def nested():
try:
throws()
except Exception, original_error:
try:
raise
finally:
try:
cleanup()
except:
pass # ignore errors in cleanup

def cleanup():
raise RuntimeError('error from cleanup')

def main():
try:
nested()
return 0
except Exception, err:
traceback.print_exc()
return 1

if __name__ == '__main__':
sys.exit(main())


This construction prevents the original exception from being overwritten by the latter, and preserves the full stack in the traceback.

Wednesday, September 1, 2010

WPF Navigation OverView

file:///C:/Users/david/Desktop/coding_ref/dotNET/WPF/WPF%20Navigation%20-%20Paul%20Stovell.htm

Microsoft Inductive User Interface Guidelines

Microsoft Inductive User Interface Guidelines