Inspirated

 
 

March 8, 2010

Using overlays for source code listings in LaTeX Beamer

Filed under: Blog — krkhan @ 9:33 pm

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}

Overlayed Listings in Beamer

Tags: , , , ,

March 3, 2010

The Defense

Filed under: Blog — krkhan @ 10:08 pm

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: LaTeX 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
Presentation Screenshot

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: , , ,

March 2, 2010

GoDaddy/WordPress ninoplas Base64 virus and the fix

Filed under: Blog — krkhan @ 7:40 pm

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

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 https://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: , , , , , , ,