Archive for April, 2006
support10 Worst Computer Science Exam Questions
I have a friend, relatively computer literate, but definately not a “geek”, who was taking a low level computer course at a community college recently. After taking his first exam, he came to me, asking about some of the questions.
Well, I thought, ok, I’ll take a look, and explain to him why some of the answers he gave were wrong – until I saw the questions.
after the break are the worst of the questions on the test, and you can get the whole test here. The “correct” answers are designated by an asterisk
For reference, the community college in question is Portland Community College, the course was BA 131, and the instructor’s name was Bill Bruno.
Bash/perl command to get all asterisk functions
I needed a lits of all the asterisk functions, in a html list format, so I whipped up this:
-
-
sudo -u www-data asterisk -rx 'show functions'|grep \(|awk '{print $1}'|while read line; do sudo -u www-data asterisk -r -n -q -x 'show function '$line''|perl -0777 -ne "\$f = \$_;\$f = s/\033\[(?:\d+(?:;\d+)*)*m//go;if (/function\s'(.*?)'.*?\[Syntax\]\n(.*?)\n.*?\[Synopsis\]\n(.*?)\n.*?\[Description\]\n(.*?)\n/sg) {print '<li>' . \$1 . '<span class="informal"><span class="syntax">' . \$2 . '</span><span class="synopsis">' . \$3 . '</span><span class="description">' . \$4 . '</span></span></li>' . \"\\n\";}" ; done
-
and for all applications, xml format:
-
sudo -u www-data asterisk -rx 'show applications'|grep
awk -F : '{gsub( /^ +| +$/, "", $1 ) ; print $1}'|sort|while read line; do sudo -u www-data asterisk -r -n -q -x 'show application '$line''|perl -0777 -ne "\$f = \$_;\$f = s/\033\[(?:\d+(?:;\d+)*)*m//go;\$f = s/\</</go;\$f = s/\>/>/go;if (/application\s'(.*?)'.*?\[Synopsis\]\n(.*?)\n.*?\[Description\]\n(.*?)\n(.*?)\n\n/sg) {print '<application><name>' . \$1 . '</name><synopsis>' . \$2 . '</synopsis><usage>' . \$3 . '</usage><description>' . \$4 . '</description></application>' . \"\\n\";}" ; done
Obviously, replace the www-data username with your asterisk username. Also, if you want to change the output details, just change the last bit, where perl outputs the results of the regex.
Have fun.





