Not much to say about this program; it's very self-explanatory, besides the fact that it will only work with Linux computers with working scanners attached. Also gthumb, scanimage, and pygtk are required (though you can use different programs than the former two by editing the config.) I find it extremely useful.
http://code.google.com/p/page-archive/
Sunday, June 5, 2011
Friday, February 11, 2011
Writing and Coding
I have always wanted to make a good comparison between writing in English (or any similar language, or even possibly dissimilar ones) and writing code. I have been proof-reading some writing for a friend recently and I have come up with a good comparison:
When you are done writing some small bit of code, you usually test it. If it does not work for all values of input, you carefully read through each line of the code to see what has logical errors. You continue to retest until the code works for all inputs.
When you are done writing some small (relatively; an essay is the largest I would consider small; though, what I am about to write applies to larger pieces. I have no experience with writing things like short stories or novels so I won't go into them.) bit of English, you do not have to test it. You can assume that there will be syntactical, logical, and structural errors. So to be a concise, clear, robust writer, you must carefully read through each line of the text to find these errors. Then you release it into the wild, like your blog.
When you are done writing some small bit of code, you usually test it. If it does not work for all values of input, you carefully read through each line of the code to see what has logical errors. You continue to retest until the code works for all inputs.
When you are done writing some small (relatively; an essay is the largest I would consider small; though, what I am about to write applies to larger pieces. I have no experience with writing things like short stories or novels so I won't go into them.) bit of English, you do not have to test it. You can assume that there will be syntactical, logical, and structural errors. So to be a concise, clear, robust writer, you must carefully read through each line of the text to find these errors. Then you release it into the wild, like your blog.
Saturday, January 29, 2011
"They"
As an undergrad, I hear the term "they" a lot. What "they" want "you" do to. The work that "they" want "you" to show when doing a Calc II "problem". I honestly think this is a very bad way to go about wording things when teaching to students of any age. When you, the instructor, use these pronouns, you make the education of your students revolve around "them". The people who write "the tests", the people who have written "the tests" and will be writing more tests. The point of teaching any form of calculus (passed the superfluous Calc I, from which I have seen questions such as "what is the graph of |y|=1?", at least at SUNY Binghamton) or any theoretical (or even practical) study is to build a foundation of thinking for higher practice. Calculus is the foundation for some higher math and most higher physics. If you are teaching a convention, it is not because of the rules; the rules are, hopefully, incidental of the convention's strength.
So forget about what "they" might want. When you're discussing standards or showing work, and a student asks how they "should" do something, style-wise or otherwise, say not "this is the way they want" but "this is the way that makes the most sense".
Unless it doesn't make sense. Then mention "them" by name and insult them appropriately.
So forget about what "they" might want. When you're discussing standards or showing work, and a student asks how they "should" do something, style-wise or otherwise, say not "this is the way they want" but "this is the way that makes the most sense".
Unless it doesn't make sense. Then mention "them" by name and insult them appropriately.
Tuesday, January 25, 2011
An Anagram Solving Bot In Python
This article will detail how I made a bot in Python that can solve web-based anagram games. I wrote it for people with at least a beginner's grasp of Python and programming languages. I originally wrote it for a joint blog my friend and I were starting but it never got started. It is half a tutorial, half a 'look what I did!' post.
Any experienced developer knows that before you can run a program with an interface of bells and whistles, it is best to write a command-line version; reduce the problem to a command, and it becomes an algorithm. Therefore, before I made the bot itself, I wanted to make a method that solves anagrams, as many times as I wanted, whenever I wanted.
Any experienced developer knows that before you can run a program with an interface of bells and whistles, it is best to write a command-line version; reduce the problem to a command, and it becomes an algorithm. Therefore, before I made the bot itself, I wanted to make a method that solves anagrams, as many times as I wanted, whenever I wanted.
Saturday, January 1, 2011
heart.py: String macros in Linux with Python
Here's something I made after discovering the Python module virtkey: a way to bind macros that type out strings for you to keyboard shortcuts in Ubuntu (and most likely other Linux platforms):
The fourth line (time.sleep(0.5)) is a necessary hack: When you bind the keyboard shortcut, you will likely bind it to Windows + a letter key or Ctrl + Alt + a letter key. The delay gives you time to release those held mod keys before virtkey starts typing the argument, or if there is no argument, a heart (♥). It would be run as:
And one could keybind it with the Keyboard Shortcuts dialog in Ubuntu, or a similar tool in other Linux distros. The original script can be downloaded here. It's also in my code scraps on Google Code
The idea is, for developers or other people who have strings that they use a lot and would like to keep on a permanent clipboard, to bind oft-used strings to Windows + 1, Windows + 2, ... , Windows + 0, for quicker access. This has probably been done with multiple-clipboard applications, but this was still fun to make.
import virtkey import time import sys time.sleep(0.5) v = virtkey.virtkey() if len(sys.argv) > 1: str = sys.argv[1] strords = [ord(c) for c in list(str)] else: strords = [9829] #heart! for i in strords: v.press_unicode(i) v.release_unicode(i)
The fourth line (time.sleep(0.5)) is a necessary hack: When you bind the keyboard shortcut, you will likely bind it to Windows + a letter key or Ctrl + Alt + a letter key. The delay gives you time to release those held mod keys before virtkey starts typing the argument, or if there is no argument, a heart (♥). It would be run as:
python ~/heart.py "hello, world!"
And one could keybind it with the Keyboard Shortcuts dialog in Ubuntu, or a similar tool in other Linux distros. The original script can be downloaded here. It's also in my code scraps on Google Code
The idea is, for developers or other people who have strings that they use a lot and would like to keep on a permanent clipboard, to bind oft-used strings to Windows + 1, Windows + 2, ... , Windows + 0, for quicker access. This has probably been done with multiple-clipboard applications, but this was still fun to make.
Subscribe to:
Posts (Atom)