Recent Notes

Displaying keyword search results 1 - 10
Created by Dr. Xi on March 02, 2011 11:39:18    Last update: March 09, 2011 12:19:30
Some peculiarities about Java PrintWriter: PrintWriter never throws any exceptions. From JavaDoc : Methods in this class never throw I/O exceptions, although some of its constructors may. The client may inquire as to whether any errors have occurred by invoking checkError(). When error occurs, you'll never know anything more than that it occured, because checkError returns boolean. When a character is out of the range of the character encoding of the PrintWriter, it prints a question mark (?). But this is not an error. Test code: import java.io.*; public class TestPrintWri... Latin1 test result: java TestPrintWriter iso-8859-1 | od -bc 000000... UTF-8 test result: java TestPrintWriter utf-8 | od -bc 0000000 141... Also, the constructor throws a FileNotFoundException when you try to write to a...
Created by mak on March 04, 2011 14:17:32    Last update: March 04, 2011 14:18:35
To create a zipfile in python: Code: #!/usr/local/bin/python import zipfile #... Test unzip -l test.zip Archive: test.zip Lengt... To read a zipfile in python: Code: #!/usr/local/bin/python import zipfile #...
Created by Dr. Xi on August 30, 2010 18:17:15    Last update: August 30, 2010 18:19:49
Use the codecs module to read file in Unicode. This is from the Python doc : import codecs f = codecs.open('unicode.rst', en... I had some luck reading files mainly in ASCII but contained some binary data with: import codecs f = codecs.open('unicode.rst', en...
Created by Dr. Xi on August 30, 2010 16:33:46    Last update: August 30, 2010 16:33:46
For Python 2.6 and later, this: with open(filename) as logfile: for line in... is equivalent to this: logfile = open(filename) try: for line i...
Created by Dr. Xi on May 23, 2010 01:16:57    Last update: May 23, 2010 01:16:57
open(IMG, "Sample.jpg") or die "Can't open file: $...
Created by Dr. Xi on September 18, 2008 21:38:27    Last update: February 06, 2010 21:55:26
Editing Shortcut Meaning Ctrl+C Copy Ctrl+V Paste Ctrl+X Cut Ctrl+Z Undo Ctrl+F Find Ctrl+G Find Again Viewing Shortcut Meaning Esc Stop Ctrl+R Reload Mozilla/NS: Ctrl+Shift+R, IE: Ctrl-F5 Force reload (not from cache) Home Go to top of page End Go to end of page Page Up Scroll up one page Page Down Scroll down one page Ctrl+- (minus sign) Make fonts smaller Ctrl++ (plus sign) Make fonts bigger Ctrl+0 Restore default font size Tools Shortcut Meaning Alt Toggle menu bar (IE7 only) Ctrl+T Open new tab Ctrl+N Open new window Ctrl+P Print Ctrl+I, Ctrl+B Bookmarks Ctrl+H History Ctrl+U View page source Ctrl+W Close Window or tab if more than one tab is open Ctrl+L Go to location box Ctrl+E Go to search box
Created by voodoo on January 24, 2010 06:29:11    Last update: January 24, 2010 19:31:22
SIKULI is Jython. AutoPy is Python. Both use bitmaps to find areas of interest. It seems that SIKULI comes with an IDE but AutoPy doesn't. A sample SIKULI script captured from the project site: A sample AutoPy script from the project site: import autopy def where_is_the_monkey_i_say(): ...
Created by woolf on January 15, 2010 05:00:14    Last update: January 15, 2010 05:03:49
Video taken with the Canon SD1200 camera comes in the AVI format, where the video is MJPEG and the audio is PCM. For some weird reason it doesn't play on my Windows XP box! The video is sluggish and the audio is often interrupted. But it works fine on my old Windows 2000 box. Since it's taking too much space anyway, I used mencoder to compress the video with XVID encoding and audio with MP3. This is the script. #!/usr/bin/perl $destdir = "C:/Documents and Se... Tools used: Mencoder: http://www.mplayerhq.hu/ Mediainfo: http://mediainfo.sourceforge.net
Created by Dr. Xi on January 08, 2010 03:53:37    Last update: January 08, 2010 03:54:56
This is an Ant custom task to merge Properties files I lifted from http://marc.info/?l=ant-user&m=106442688632164&w=2 , with some minor bug fixes. Example usage: <taskdef name="mergeProperty" classname="ant.task.... Implementation: package ant.task.addon; import java.io.Buff...
Created by Dr. Xi on December 05, 2009 20:12:16    Last update: December 05, 2009 20:46:45
It's quite easy for Perl to open a pipe and read from it: $file = "nospace.txt"; open(IN, "cat $file |") ... But the code breaks when the file name contains a space: # This does not work! $file = "yes space.txt"; ... On Windows, these don't work either: # This does not work! $file = "yes space.txt"; ... You need to use a technique called Safe Pipe Opens : $file = "yes space.txt"; $prog = "cat"; ...
Previous  1 2 Next