Tag Archive | Linux

5 cool reasons to use LaTeX

TexPad on OSX

One of the differences between undergraduate level study and masters level study is the amount of report writing you do. I can only think of two times in my bachelors degree that I wrote a significantly sized report — and one of those was my dissertation. So far in my MSc I am yet to have handed in a coursework without a report.

During he early stages of my third year I discovered a tool (language?) called \LaTeX, however it would be yet another thing to learn alongside my 4 large modules and everything I needed to learn to do my dissertation, so I gave it a miss. This year I decided I would finally give it a go, see what all the fuss was about and see whether it could really replace a Microsoft Word shaped hole in my life.

It did. LaTeX offers a lot of advantages over Microsoft Word, LibreOffice and many other Word Processors, some of the more interesting ones I’ll talk about here. (Note: this isn’t a tutorial, just some observations — so if you don’t know anything about LaTeX I recommend you look it up online first)

1 – Better Source Control

\LaTeX produces full PDF output, including tables images and other complex objects, from declarations made in plain text. If you’re not quite sure how to think about \LaTeX sometimes it’s best to think of it like a Markup language — such as HTML — in which you tell it what you want in plain text and it creates the graphical representation.

Git Diff of LaTeX

Git Diff of LaTeX

Because all of the declarations are in plain text it makes source control really easy. Above you can see an image of a git diff in the Github application on OS X. Showing the difference between binary (.doc) word files is impossible, showing differences between Open Office XML files is difficult to decipher at best.

2 – Include code and automatically Syntax Highlight it

Using the listings package you can pull it code from other files on your system and automatically syntax highlight it using colours of your choice. No more copy and pasting code into your report over and over when you make changes.

First use the listings package, and load the programming language(s) you would like to include in your document. Optionally include the XColour package for some more interesting colours to use to syntax highlight your code.

% In your preamble
\usepackage{listings}
\usepackage[usenames,dvipsnames]{xcolor}
\lstloadlanguages{Ruby}

Then set up the colours you want keywords, comments and strings etc to appear as, as well as some basic settings such as line wrapping. You can redefine these at any point in your document if you need to change the colours for different bits of code for any reason:

\lstset{%
basicstyle=\ttfamily\color{black},
commentstyle = \ttfamily\color{Gray},
keywordstyle=\ttfamily\color{CornflowerBlue},
stringstyle=\color{SeaGreen},
identifierstyle=\color{Mahogany},
showstringspaces=false,
breaklines=true}

Now you can just include any code files…

\lstinputlisting[language=Ruby]{path/to/code.rb}

or any inline code snippets you like

\begin[language=Java]{lstlisting}
//This is a comment in Java
System.out.println("I love printing to stdio");
\end{lstlisting}

I personally prefer to include from files, so that I can edit the code that is being displayed in my preferred editor for that language. Additionally, if you are required to dump all of your source code in a report, as was required of me recently, this is a nice way to ensure any updates to that source code are displayed in your final document without any work on your behalf.

3 – Run a Script from inside your documents

If you run a Unix-like operating system with a bash shall, such as Linux or OS X, then you can compile your \LaTeX documents with the --shell-escape flag which allows you to embed bash scripts inside your document that get run when the document gets compiled.

I recently used this to run a bash script which counted the number of words inside the document that was being compiled, meaning I could have an always accurate word count printed inside the document. Handy.

I could also envisage this being useful to generate pretty PDF reports of services on a server or other systems. An guide on how to achieve something like this is available at CTAN.

4 – Easily cite other peoples work and change reference style

Using the Bibtex bibliography subsystem for \LaTeX you can write your references in a simple, almost JSON like, syntax — as shown below:

@online
{
	demes,
	author = {Vesselin K. Vassilev and Julian F. Miller and Terence C. Fogarty},
	title = {The Evolution of Computation in Co-evolving Demes of Non-uniform Cellular Automata for Global Synchronisation},
	year = 2007,
	url = {http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.33.9467&rep=rep1&type=ps},
	urldate = {2015-01-25}
}

When you come to cite this article in the body of your document you can just write \cite{demes} and it will print out the correct citation style as specified in your documents preamble, and print the full information about the article in the correct style in your bibliography. At York we use the IEEE citation system, and so the above is output like so:

Inline citation IEEE

Inline citation IEEE

Bibliography IEEE

Bibliography IEEE

However, if I change this one line in my preamble from:

\usepackage[backend=biber, style=harvard]{biblatex}

to

\usepackage[backend=biber, style=authoryear-ibid]{biblatex}

Then my references and citations show up in the Harvard style, as I used in my final year project at Hull. No retyping citations.

Harvard Style Reference

Harvard Style Reference

5 – Write and Read Anywhere

Because the ‘source files’ for \LaTeX are just plain text, and the output files are PDF files everyone, on any operating system, can make changes to and read the output of your documents. No more worrying about what version of word someone has, or whether or not they’ll have Calibri in their font library. Furthermore there is a LaTeX compiler available for almost any machine.

There is an abundance of editors for  \LaTeX including features such as syntax highlighting, autocomplete, automatic packing including and simplification of the PDF generation process. My personal favourite is TexPad.

 

I hope I will have convinced at least a few of you to try out LaTeX when you’re next writing a report for university of work. Let me know how it goes if you do!

Danny

MODE Assessment 1 Coursework Result – 72%

Eclipse Epsilon on OSX

At The University of York each module has a four letter code, MODE stands for Model-Driven Engineering. MODE is one of the first modules I have taken as part of my MSc in Advanced Computer Science. The lecture series has actually already finished because modules here are only 4 weeks long, as opposed to 12, but have many more lectures per week.

Model-Driven Engineering is the process of developing software with models as first class citizens, which can then optionally be used to generate code.

In our coursework we have been using Eclipse Epsilon, a package developed here at The University of York, to develop a metamodel of a Media Library, a set of constraints for that metamodel and finally some queries to find out information about any model which conforms to that metamodel.

The coursework consisted of a number of firsts for me:

  • My first coursework completed entirely on Linux and OS X
  • My first coursework report written entirely in LaTeX
  • My first mitigating circumstances — unfortunately I missed quite a few lectures due to acute appendicitis.

Fortunately after my small bout of bad health I quickly managed to catch up with the program of study and managed to submit my coursework 6 days after everyone else. A few days ago I got my results back and am happy to say I got 72%.

At masters level rather than awarding degrees with a classification such as 1st class, upper second class etc. degrees are awarded as either:

  • Pass (50-59%)
  • Pass with Merit (60-69%)
  • Pass with Distinction (70%+)

Therefore this mark was a pass with distinction, a good start to the degree!

This coursework was worth 40% of the module overall and I am currently completing the second coursework which builds on top of this and requires us to build a graphical editor and reporting system for our metamodel.

I will of course keep the blog up to date with this module and the others I am currently enrolled on.

Danny

Campus Party : Europe in London

Last week I was fortunate enough to be with some of my fellow Microsoft Student Partners, some Windows Ambassadors, some Microsoft Interns and some Microsoft Employees at Campus Party Europe, an event which was described by the BBC as ‘Glastonbury for geeks’.

I would say this was fairly accurate, except there was less mud! Like Glastonbury there were several stages, a whole host of interesting people to meet, and tents!

Working on the Microsoft Stand

Tuesday through to Friday I worked for 6 hours a day on the Microsoft Stand. It was really good fun! Our job was to talk to people about Windows 8.1, Windows Phone 8, Microsoft Surface and the Xbox One and endeavour to answer any questions they had about either the software or hardware. As well as that we tried to get as many people as possible to take our surveys, in return each participant got a surprisingly stylish pair of Windows 8 Branded Sunglasses and a glow stick!

I was also fortunate enough to have Academic Audience Lead Phil Cross, point a few developers who had questions about Visual Studio and developing for Windows platforms my way.

The TeamworkPM App for Windows 8 I developed on the 2 big displays and the Surface Pro I wrote it on

The TeamworkPM App for Windows 8 I developed on the 2 big displays and the Surface Pro I wrote it on

Throughout Wednesday and Thursday I spent much of my shifts writing a Windows 8 app for the project management website TeamworkPM. It was especially interesting to do this because my display was being projected on two 42inch monitors above my head, this meant everyone could see what I was doing and I attracted quite a few developers to come and talk about developing for the platform.

In the evenings when the stand got a bit quiet we would try to entice people to come and see our wares in a variety of ways, one of which was through the medium of dance :P. My highlight was the Macarana, or the Microsoft Macarena as I called it.  Below you can see us all dancing and waving our glowsticks to the ever-entertaining Harlem Shake.

Talks

The main thing that first attracted me to the offer of working for Microsoft at Campus Party Europe was the fact that we could spend our down time watching some of the many speakers that came to talk about their respective fields.

I was fortunate enough to catch 2 or 3 lectures a day, from people as well respected and diverse as Jon “Maddog” Hall — chairman of Linux International — and Ian Livingstone — President of Eidos and founder of Games Workshop.

The O2 arena hosted 8 stages, of all of which had talks from 10am – 10pm each night, so there was certainly a lot to take in — too much to write about here.

My favourite talks were actually that about free and open source software (sorry, Microsoft), and the relatively new phenomenon of open data.

Swag

At the end of the week my fellow MSP’s and I were super happy with being able to have witnessed one of the coolest, and largest tech conferences in the world, but even on top of that Microsoft were generous enough to allow us to keep the devices we had been using throughout the week to showcase both Windows 8.1 and Windows Phone 8 to customers, this meant a Nokia Lumia 920 and a Microsoft Surface RT each!

I was over the moon with the Surface RT because I had been looking to get an RT device for a while to test the performance of a few of my apps on the lower powered ARM CPU’s — but I was especially happy with the Nokia Lumia 920. My phone contract ends in a few days, and because now I have an awesome new phone I’m gonna go on a SIM only plan and save myself some money 🙂

Thanks

I would like to say a massive thank-you to everyone involved at the O2, the people behind Campus Party, and of course Microsoft for making everything work like clock work and giving me a fantastic opportunity to learn from some of the best minds in our industry, a lot of laughs, some great knowledge and some cool electronics! I hope to see you all again soon!

Danny.

Searching Algorithms, Cleaning the Pig Sty & Freeside

Today was that lovely day I have each week where I don’t have a lecture at 9:15 in the morning.  So I spent my day relaxing, tidying my room and attending my one lecture on different ways of searching using algorithms, which I personally in my sad little way found fascinating. I love logic and problem solving.

Above you can see the end result of the cleaning, stored forever on the internet to show the one day I will manage to keep it safe for human habitation.

Tonight I set up a 3 Network Sim card on my old ZTE Blade Android phone so that Jess can use her 5000 free 3 to 3 calls to ring me and save on contract costs (is the word three starting to sound weird yet? :P). I also joined the Freeside IRC channel and made some friends and learnt more about the group, it’ll be fun joining them from time to time, especially now that I have my own  user on their cake server with some web-space!

Im trying to keep my blogs more consise and readable, so thats all for now!

Thanks for Reading,
Danny

A visit to the Brynmor Jones Library and meeting Freeside

Today was another enjoyable, yet incredibly long day — I left my flat at 8:40am and didn’t get back to it until 7pm this evening! As with any other day it all started with me dragging myself out of bed and attempting to get ready for a full day of computer science before the bus left without me, fortunately as I woke up a bit earlier than usual today and my bag was already packed from the previous evening i managed it.

From 9:15 – 10:05 in Lecture Theatre A of the Robert Blackburn Building I had a Quantitive Methods for Computing Lecture with Dr. Gordon — thankfully I think I am finally starting to get some of the more advanced parts of the module and I am hopeful of not only passing but hopefully doing well! From 10:15 – 11:05 we had an induction follow up lecture ran by Dr. Gordon, Amanda the Administrator and the head of computer science (who’s name totally escapes me) — this essentially was a question and answer session to work out any issues we had and was full of sarcastic banter from some of the students in the row in front of me — very funny indeed.

After an hours bacon bap break we return to AS3-LLT — where the induction follow up had been held — for a fascinating Computer Systems lecture on “The Nature of Computers Today & the Launch of the Home Computer” which detailed how computers scaled down from being massive room sized machines which several users connected to with “dumb terminals” and automated much of the computing process to the personal computing at home. The irony of course being that the move to the cloud is a move back to mainframe style systems, its weird how such concepts come round again.

After this Rob and I has 2 hours to fill before our QMfC tutorial so we decided to venture into the MASSIVE Brynmor Jones Library — which was formerly the library of Philip Larkin, one of the most famous poet laureates of all time and the namesake of one of the buildings at the university — its pictured above. Its 7 floors tall and thanks to Murphy’s law all of the Computer Science and Maths books are on the top floor — however we were pleasantly surprised by the views presented to us once we’d got to the top. Some of the pictures I took are below:

View of Faculty of Business from the Brynmor Jones Library

View of Faculty of Business from the Brynmor Jones Library

View of Chemistry Building from Brynmor Jones Library

View of Chemistry Building from Brynmor Jones Library

View of Venn Building from the Brynmor Jones Library

View of Venn Building from the Brynmor Jones Library

Rob Checking out some of the Computer Science Books in the Brynmor Jones Library

Rob Checking out some of the Computer Science Books in the Brynmor Jones Library

After the brief visit to the library we waited in the Sanctuary bar in the Student union for our 3rd Lecture of the day with Dr. Gordon — a tutorial to support the earlier lecture for QMfC. This was excellent and helped me finally get my head round equations with fractions of x in — which I’m sure will be vital in my day to day life 😉

After that we had a one hour Programming Lecture which consisted of learning about Programming languages and our jobs as programmers. We learnt a few very important things, 1) If you don’t keep the specification of a contract your customer wont pay you. 2) 66% of IT projects fail — mainly due to miscommunication of what the end result should be and perhaps most interestingly

English would make a terrible programming language as a lot of its words are ambiguous and could mean any number of things given the situation its used in. Computers are too thick to understand this and require a precise language where one word or phrase can only have one meaning.

That’s the sole reason we have languages such as C#, Java and BASIC.

After this I went to Freeside‘s first meeting of the year in which they installed Linux onto the attendees computers for them — in this case it was the brand new 10.10 distro of Ubuntu. It was lovely to speak to all the people there, especially “TastyWithPasta” — the executive of the ComSoc at hull as well as to have some free fairy cakes and Pepsi Max, I can’t wait to see what’s going on n the future with the Department of Computer Scientists FOSS group.

Well, it seems I’ve written far too much for anyone to bother reading again so i’ll leave it there!

If you’ve gotten this far well done!

Thanks,
Danny

BTW: If you like reading stories that make no sense whats-so-ever you may be interested in Jess’ blog about her really weird dreams which no-one (including herself) understand — you can find it at http://luciddreamerjess.wordpress.com/