## Tools used in our Lab

We use Latex, Matlab, and xfig/visio/omnigraffle to write papers. This section contains the paper writing guidelines used at NMSL.

### HackMD on NMSL

Here is our own HackMD system. Please feel free to write documents and share them with your labmates.

### Technical report template

This is a template for writing technical/course reports. Please use the template for all your reports.

### Installing Latex compiler and integrated environment

• Windows: First install Miktex, a Latex compiler, and then install TexMaker or TeXincCenter, an integrated environment. Texmaker includes unicode support, spell checking, auto-completion, code folding and a built-in pdf viewer with SyncTeX support and continuous view mode. TexMaker is also available for Mac or Linux.
• Linux: Find and install Latex packages in your distributions. There have been quite a few Latex packages, but recently TexLive is probalby one of the most active Latex projects. Then, install Kile, which is a KDE-based integrated environment.
• Mac: The most user-friendly Linux package is MacTex. I don't use integrated environment (GUI) on Mac; I use makefile to compile PDF in Terminal prompt. Note that, from time to time, you may need tools from package like imagemagick and ghostscript, and projects like MacPort and Fink come handy.

### Exporting Matlab figures in the consistent dimension

Matlab allows you to save a figure in a high-quality eps file. However, choosing font size and figure dimension is very tricky and often lead to tiny, unreadable figure labels and legends. Always apply the following Matlab script twice before saving figures. This can be done by cut and paste the whole paragraph into Matlab. Also notice that, after applying the script, do not change the figure dimension before saving its eps file.

% for 3-column figuresset(gca,'FontSize',20)set(gca, 'FontName', 'Times New Roman');set(gca,'TickDir','out')set(get(gca, 'xlabel'), 'interpreter', 'latex');set(get(gca, 'xlabel'), 'FontName', 'Times New Roman');set(get(gca, 'xlabel'), 'FontSize', 20);set(get(gca, 'ylabel'), 'interpreter', 'latex');set(get(gca, 'ylabel'), 'FontName', 'Times New Roman');set(get(gca, 'ylabel'), 'FontSize', 20);set(legend(), 'interpreter', 'latex');set(legend(), 'FontName', 'Times New Roman');set(legend(), 'FontSize', 20);set(gcf, 'WindowStyle', 'normal');set(gca, 'Unit', 'inches');set(gca, 'Position', [.65 .65 4.6 3.125]);set(gcf, 'Unit', 'inches');set(gcf, 'Position', [0.25 2.5 5.5 4.05]);

### Drawing and exporting diagrams

Vector images must be used for high-quality papers. Omnigraffle and xfig both support exporting eps files. Visio, unfortunately, does not export images in EPS format. As a workaround: (i) print your figure as a pdf file, (ii) use ImageMagick to convert it into a ps file, and (iii) use ps2eps to get an eps file.

### Adding Latex math symbols in xfig figures

1. First you're in Xfig. Write equations or characters in the schematic. You need $in both sides, eg,$\phi\$.
2. Press the "Edit" icon and turn on the Special flag.
3. Export the figure into Combined Postscript/LaTeX instead of the usual Encapsulated postscript (EPS) .
6. When storing fig files in a different from tex files, you need to manually modify pstex_t files whenever you export them. E.g.. I have to change \epsfig{file=coverage.pstex}% into \epsfig{file=../fig/coverage.pstex}%.
7. Write the following command to insert your figure in TeX file.
\begin{figure}[ht] \centering{ \resizebox{.48\textwidth}{!} { \input{../fig/coverage.pstex_t} } } \caption{Test.} \label{fig:test}\end{figure}

### Embedded fonts in PDF files

It is required by IEEE, ACM, and many other publishers that all fonts are embedded in the document. Embedding fonts is important in order to make the document look and print in the same way the authors intended on different systems.

• In TeXincCenter, you may import this profile using Build -> Define Output Profiles -> Import, and then use this profile to compile your PDF.
• Instead, you can use the following argument line for ps2pdf post processor (in TeXnicCenter: Build->Define Output Profiles. Then choose Latex => PS => PDF. Then, Postprocessor tab).
-sPAPERSIZE=letter -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -r600 -dCompatibilityLevel=1.4 -sOutputFile="%bm.pdf" -c save pop -f "%bm.ps"
• You can use the following script with Ghostscript. You need to change the "outFile.pdf" and "inputFile.pdf" to your files.

gs -sDEVICE=pdfwrite -q -dBATCH -dNOPAUSE -dSAFER \-dPDFX \-dPDFSETTINGS=/prepress \-dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode \-dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode \-sOutputFile=outFile.pdf \-c > setdistillerparams \-f inputFile.pdf \-c quit

## Tutorials

### Mininet and Ryu

These are few topics in this tutorial.

1. Prerequisites: Install required tools
2. Mininet: Create a custom topology
3. Ryu: Simple switch (add flow, pakcket-in and packet-out message, MPLS operations, multiple flow tables)

### Python

These are some python tutorials and exercises.

Materials: Please see slide No.34 ~ 63.

Exercises:

1. Hello World in Python: print "Hello World!".
2. How to find stuff in a list, for loop, if branch, len() function
1. Given a list of integers, use for loop to find and print those that are a multiple of 3
2. Given a list of strings, use for loop to find and print strings longer than 3 character
3. Print the length of the list
3. How to find stuff in a dictionary, sometimes with tuple, for loop
1. Given a dictionary with different attriutes, print out john's number
2. Given a nested dictionary with tuple, print out the 'name' attribute associated to tuple (2,3)
3. Given a list of dictionary, print out the 'number' attribute if 'name' attribute is 'john'
4. Learn to import stuff
1. print length random_list, all numbers in random_list (in a single line, with a white space in the middle of each number), random_number
2. print the biggest number available in Python on this machine (available through importing sys)
3. print the copyright message of the Python interpreter (available through importing sys)
5. Write a function
1. Given a list of integer, write a function and pass the list as argument, return the total value and print it
2. Given a list of integer, write a function and pass the list as argument, change all of the multiple of 3 to 0. Print the original list and the new list
6. Use everything you've learned, and you may need to find how to use number as index for for-loop. Given the 'link_info' in mpls_proto_topo2.py
1. Import 'link_info' from mpls_proto_topo2.py, print out all the 'link_id' and 'port_map' attribute, see partial example output below
0: (1,1,1)
1: (1,2,1)

2. Same as the last one, but when link_id is greater than 5, add equal number of tabs as the mod of 3, see partial example output below
6: (3,1,2)
7:(3,2,2)
8:(3,3,1)
9:(3,4,2)

### Android

1. Introduction to Android: An introduction to Android
2. Android Development Environment Setup: How to setup Android development environment
3. Android Basic UI Operations: Basic user interface operation tutorial on Android
4. Android Intent: Android Intent tutorial
5. Android Socket: Android Socket tutorial
6. Android IO: Android IO tutorial