Misc

Bixi google map

Use this link

Walk to and from the Ottawa train station

There is a bike/pedestrian trail along Tremblay Road and it goes over Vanier Parkway, then you need to go to your right and few hundred feet later to your left to cross the river (this is parallel to Queens Way). On the other side of the river, cross under Queens way, then to your left to reach Hurdman Rd (municipal machinery parking). Then take Robinson Avenue to reach Lees Avenue (to your right) and then King Edward Avenue.

Recover a lost fat32 disk

Consider using Ultimate-Restorer.

Plagiarism detection

For detecting code similarities, moss is quite useful. Another tool that you could try is jPlag.

How it works:

moss -l cc (C++)

-d submissions are by directory containing several files to be considered as a whole. ex.: -d tp1/*/qinterface.C

-b <base file>

-m <maximum passage repeated before ignored>

Examples:

moss -l cc -b skel -d remise/*/*.C

moss -l cc -d */*.c */*.C */*.cpp */*.CPP */*.h */*.H */*.hpp */*.HPP

Be careful, you can run into problems if the file names or directory names contain spaces.

Some useful command line tools that could help you in setting up the files for moss:

This works if you have a bunch of folders (one for each student), each containing one zip file (the code submitted by the student) and you want to uncompress the zip, then copy all of the code files in the directory structure of the student to the root folder for that student. This is a bash script:

for i in *

do

currentDir=`pwd`

cd $i

echo `pwd`

find . \( -name "*.zip" -o -name "*.ZIP" \) -exec unzip -u {} \;

find . \( -name "*.rar" -o -name "*.RAR" \) -exec unrar x {} \;

find . \( -name "*.c" -o -name "*.C" -o -name "*.cpp" -o -name "*.CPP" -o -name "*.h" -o -name "*.H" -o -name "*.hpp" -o -name "*.HPP" \) -exec cp -f {} . \;

cd $currentDir

done

If you have a folder containing the submitted code of each student (as a zip or rar file) and each compressed file will expand to a folder for that student, you can use the following command line:

for i in *.zip *.rar

do

currentDir=`pwd`

nospaces=`echo $i | sed 's/ //g'`

contract=`echo $nospaces|cut -c1-4`

mkdir $contract-f

mv "$i" $contract-f

cd $contract-f

find . \( -name "*.zip" -o -name "*.ZIP" \) -exec unzip -u {} \;

find . \( -name "*.rar" -o -name "*.RAR" \) -exec unrar x {} \;

find . \( -name "*.c" -o -name "*.C" -o -name "*.cpp" -o -name "*.CPP" -o -name "*.h" -o -name "*.H" -o -name "*.hpp" -o -name "*.HPP" \) -exec cp {} . \;

cd $currentDir

done

What if you have so many files that it does not fit on the command line? You can use this to get perl code to "manually" add the files to the ARGV array inside the perl submit script:

find . \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.cxx" -o -iname "*.h" -o -iname "*.hpp" -o -iname "*.hxx" \) -exec echo 'push(@ARGV,"{}");' \; > moss-update.pl

If you want to remove some specific files, here is an example:

find . \( -iname "ui_*" -o -iname "*.ui*" -o -iname "*.doc*" -o -iname "*.pdf" -o -iname "moc_*" -o -iname "*.jpg" -o -iname "*.pro" -o -iname "*.dsp" -o -iname "*.dsw" -o -iname "*.ncb" -o -iname "*.opt" -o -iname "*.plg" -o -iname "*.tmp" -o -iname "qmake*" -o -iname "*.bmp" -o -iname "*.zip" -o -iname "*.rar" -o -name "*.mdl" -o -iname "*.txt" -o -iname "*.png" -o -iname "*.vcproj" -o -iname "*.sln" -o -iname "makefile*" \) -exec rm {} \;

find . \( -iname "ArgExtracter.h" -o -iname "ArithMat.h" -o -iname "ArithSqMat.h" -o -iname "ArithVec.h" -o -iname "BitMask.h" -o -iname "CGLA.h" -o -iname "CommonDefs.h" -o -iname "ExceptionStandard.h" -o -iname "Filter.h" -o -iname "Map.h" -o -iname "Mat1x3f.h" -o -iname "Mat1x4f.h" -o -iname "Mat2x2f.cpp" -o -iname "Mat2x2f.h" -o -iname "Mat2x3f.h" -o -iname "Mat3x3f.cpp" -o -iname "Mat3x3f.h" -o -iname "Mat3x4f.h" -o -iname "Mat4x4f.cpp" -o -iname "Mat4x4f.h" -o -iname "Quaternion.cpp" -o -iname "Quaternion.h" -o -iname "RootSolvers.h" -o -iname "TableTrigonometry.cpp" -o -iname "TableTrigonometry.h" -o -iname "UnitVector.h" -o -iname "Vec1f.h" -o -iname "Vec2f.cpp" -o -iname "Vec2f.h" -o -iname "Vec2i.cpp" -o -iname "Vec2i.h" -o -iname "Vec3d.h" -o -iname "Vec3f.cpp" -o -iname "Vec3f.h" -o -iname "Vec3Hf.h" -o -iname "Vec3i.cpp" -o -iname "Vec3i.h" -o -iname "Vec3uc.h" -o -iname "Vec3usi.h" -o -iname "Vec4f.h" -o -iname "Vec4uc.h" -o -iname "glm.h" -o -iname "glm.c*" \) -exec rm {} \;

Remove all subfolders of given folders:

for i in *

do

currentDir=`pwd`

cd $i

find . \( -type d -and -not \( -name "." -or -name ".." \) \) -exec rm -r {} \;

cd $currentDir

done

Contract file/folder names:

for i in *

do

nospaces=`echo $i | sed 's/ //g'`

contract=`echo $nospaces|cut -c1-4`

if [ "$i" != "$contract" ]; then

mv "$i" $contract

fi

done

Prepend year and semester number to folder names:

for i in *

do

newname=20113_$i

mv "$i" "$newname"

done

Remove a specific folder that appears in a collection of folders:

for i in *

do

currentDir=`pwd`

cd $i

find . \( -name "_notes" \) -exec rm -r {} \;

cd $currentDir

done

Remove spaces in file/folder names:

for i in *

do

nospaces=`echo $i | sed 's/ //g'`

if [ "$i" != "$nospaces" ]; then

mv "$i" $nospaces

fi

done

Concatenate all source files to a single resulting file:

for i in *

do

currentDir=`pwd`

cd $i

find . \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.cxx" -o -iname "*.h" -o -iname "*.hpp" -o -iname "*.hxx" \) -exec cat {} >> ../$i.cpp \;

cd $currentDir

done

Same, but with nested directories:

for i in *

do

currentDiri=`pwd`

cd $i

for j in *

do

currentDirj=`pwd`

cd $j

find . \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.cxx" -o -iname "*.h" -o -iname "*.hpp" -o -iname "*.hxx" \) -exec cat {} >> ../../$i-$j.cpp \;

cd $currentDirj

done

cd $currentDiri

done