Mostly Linux & Python syntax notes and hyperlinks.

Friday, June 29, 2012

linux: lpr -U

The -U doesn't show up as an option in all the "man lpr" pages, including the one on the system on which we're using it.

The -U option is in this man page: http://linux.die.net/man/1/lp-cups

It is defined as -U [username] option, which actually doesn't seem to be the way it is being used in our system. Must be a clever workaround for something. 

Tuesday, May 29, 2012

Technical Interview Tips

Dear Prospective Junior Software Engineer:
  1. If we ask you to explain Object Oriented Programming, please don't just say that an object is like a car, that can have different colors.  Please go on to tell us how a piece of code can be an object, and how two other pieces of code can use that object in different ways.
  2. You might want to review any skills listed on your resume and look them up on the Web to remember what the major elements of them are.  We never ask picky syntax questions, but other places do.
  3. Before the interview, why not review what you did at the jobs that are on your resume? If you have any code saved from them, then glance through it.  If not, then try to remember what you can.
    • Corollary: When you leave a job, if you can't save any printouts or documentation from what you did there, try to write down what you remember, before the whole unpleasant episode is all blocked out of your memory. (And, no, I never did that either, but it's a good idea...)
    • If you are straight out of college, then review some recent major programming assignments and remember how you solved them.
  4. If you're unemployed, it would be a good idea to be doing any of this sort of thing:
    • Volunteer on an Open Source Project
    • Create a website and play with it
    • Download Eclipse and write a toy app for an Android.  You don't even have to own an Android--you can use the simulator, then test it on a friend's Android.
  5. If you haven't done any coding for a while, why not sit down and try to write a small program, so the general idea of how to program is fresh in your mind?  Then when we ask you to write something in pseudocode, you won't stare in blank panic.
  6. You are not in a Presidential debate.  If we ask you a question, please show that you can understand a question, and answer what we asked.  If we ask you a high-level question, please answer it at a high-level and then offer to delve into more detail. We need to know you'll be able to explain things at a high-level to our clients.
  7. If your last job was in a different industry and we ask you about the code you worked on there, please don't waste time explaining the many specific details of something that doesn't relate to us.  Just give us the few details that are needed to illustrate the problem you solved by how you structured your code.
  8. We need more people.  We are really, really, looking for any reason to hire you.  We just don't want to regret it.  If all else fails, try to show you can express some software principle in a cogent manner.  It might help.
Thank you, and good luck.

...
 (Should I have titled this Techical Interviews Tirade instead?)

Wednesday, May 23, 2012

windows 7: how to turn off auto-expansion of windows shoved to the edge of the screen

A windows thing that was driving me crazy, with my habit of mouse-button down, wrist flick, to shove windows out of the way from the window I wanted to look at.  In the version of Windows that arrived with new PC's, the wrist-flick was causing the unwanted window to expand and fill the entire screen.

To turn this off, under control panel, select "Ease of Access", then "Change how your mouse works".  Then check the box that says:

Prevent windows from being automatically arranged when moved to the edge of the screen.

Control Panel\Ease of Access\Ease of Access Center\Make the mouse easier to use\


Tuesday, March 27, 2012

Linux: moving a directory into itself

I didn't know you could do this.

OK, I had a directory with code that I was changing, and I had a bak/ directory in which I was saving current versions.

I had a some files with the string "bak" in them.  I tried to move *bak into bak and lost the entire directory.

Yeah, it was late in the day.

[fire@ice frost]$ mv _* bak
`_some.cmd' -> `bak/_some.cmd'
[fire@ice frost]$ mv say_bak.cmd bak
`say_bak.cmd' -> `bak/say_bak.cmd'
[fire@ice frost]$mv *bak bak
`bak' -> `bak/bak'
`the_world.cmd.bak' -> `bak/the_world.cmd.bak'
mv: cannot move `the_world.cmd.bak' to `bak/the_world.cmd.bak': No such file or directory

Thursday, March 15, 2012

python: ImportError: No module named slythy.toves

Why can't python see my module when it's right there?

I was copying code from one installation to another and thought I had everything.
But, the code ran on one system but not the other.

I finally found the difference: an empty (all comments) file called __init.py__

That is, if in twas/brillig.py you have "from slythy.toves import gyre"
and in twas/slythy/toves.py you define the gyre class,
you need a file called __init.py__ in the twas/slythy/ directory, or you'll get an error like:

    ImportError: No module named slythy.toves
    Python Error: Undefined Python module brillig


There are definite disadvantages to learning python piece-by-piece as you go along.  I was checking environment variables and everything before finally finding out about __init.py__