megan@elon

megan conklin's blog -- elon university, department of computing sciences

Friday, April 21, 2006

Batch change extension of files on the unix command line

Everytime I go to bulk change filenames on the commandline I feel depressed directly afterwards because of the hideousness of the syntax. Today I learned about the 'basename' command (via this article Batch change extension of files on the unix command line). It works like this:
# rename every *.htm file *.html
for f in *htm ; do mv $f `basename $f htm`html;done
Works like a charm!!

Wednesday, April 19, 2006

group by aggregates in mysql

I stumbled across a neat new (to me, anyway) GROUP BY aggregate function in mysql: it's called GROUP_CONCAT. (It's described here: MySQL 5.0 Reference Manual :: 12.10.1 GROUP BY (Aggregate) Functions)

Here's how I used it: For the FLOSSMole project, I was constructing a list of projects on Sourceforge, the programming language(s) used on the project, and the number of developers on the project.

Normally, we would design a SQL query like this:

SELECT p.proj_unixname, ppl.description, p.dev_count
FROM projects p, project_programming_language ppl
WHERE p.proj_unixname = ppl.proj_unixname
AND p.datasource_id =19
GROUP BY 1, 2
ORDER BY 1


Which yields results like:
project #1perl1
project #1java1
project #2python14
project #3python2
project #3C++2


In this case, we have project #1 which has 2 programming languages (perl, java), and 1 developer. We have project #2 which has one language (python) and 14 developers. We have project #3 which has 2 languages (python C++) and 2 developers. The number of rows in the table for that project is determined by the number of unique languages. So, a project with 4 languages will have 4 rows. I was hoping there was a way to group these languages together, and indeed I found one: GROUP_CONCAT.

With this new function, we can fix this so that each project will only show one row in the output table. The languages are concatenated together before printing. The query can look like this:

SELECT p.proj_unixname, p.dev_count,
GROUP_CONCAT(DISTINCT ppl.description)
FROM projects p, project_programming_language ppl
WHERE p.proj_unixname = ppl.proj_unixname
AND p.datasource_id =19
GROUP BY 1, 2
ORDER BY 1


And the output will look like:
project #11perl, java
project #214python
project #32python,C++

Wednesday, April 12, 2006

Best Job in America

According to MONEY Magazine's Best Jobs report, the best job in America is.......... software engineer. Second best job is......... college professor. So if I'm a college professor and a software engineer, that's like nirvana, right?

(psst, they measured things like stress, pay, ability for advancement, ability to telecommute, etc)

Then (this is hilarious!) they "grade" each job on a 4-point scale of Stress, Flexibility, Creativity, Difficulty. Here's how our top two jobs fared:

Software Engineer:
Stress: B
Flexibility: B
Creativity: A
Difficulty: C

College Professor (includes administrators):
Stress: B
Flexibility: A
Creativity: A
Difficulty: C

So I'm going to be a "grade grubbing student" now and ask, if college professor gets an "A" in Flexibility and Software Engineer only gets a "B", how come Software Engineer is ranked #1 and College Professor is only ranked #2? Salary potential is also higher for CP than SE. Is it projected job growth that is skewing the rank? Nope, CP has twice the number of projected jobs for average annual growth. Who knows....

Tuesday, April 04, 2006

the sad, sad truth about game development

Yes, developing games would be really cool. Unfortunately, the sad, sad truth of game developer salaries is covered in this Wired blurb: Game Devs' Salary Survey:
At the high end are executive producers, who average $127,375 (assuming six years of experience). Lowly testers pull down a sad, sad $29,722 (assuming three years of back-breaking bug testing).


Students might ask, why? Why is this the case when game dev companies make SO much money on each game? Truth is, most games aren't WoW and GTA and Halo2. More importantly, people who LOVE what they do, don't care about the salary. People who want to make games will make games for cheap or for free. Two evidences for this, besides the game development world: (1) open source software (2) university professors.

So wait, a game-loving professor who specializes in open source? Yup, destined always to be poor. Shhhh - don't tell my husband.