Introduction to Knowledge Society Technology
Records of lectures
Exercises
- Records of lectures
- Answers to some questions
- Enrol yourself to the course (should be working now)
- Optional — prepare standard environment for your homework
- 1. Computers and binary data
- 2. Documents and archives
- 3. Networking
- 4. Audio
- 5. Imaging
- 6. Video
- 7. Security
- 8. Databases
- 9. Python
- 10. Contribution to wikipedia
Description of homework deliveries
Deliveries for exercises are prepared as files in form 1234abcd.E.F.ggg, where:
- 1234abcd is your randomly generated unique identifier
- E is number of exercise (1, 2, 3, etc.)
- F is number of the file for the task (1, 2, etc.)
- ggg is extension of the file
For example, name of the first file for first exercise and first task should be in the form: 1234abcd.1.1.txt
You can upload only files with correctly formatted name. You can upload the same file several times, then older file will be rewritten with newer version. Report of uploaded files is generated once a day.
To get maximum score, you should complete all tasks of all exercises. If you complete only some, you will get part of total score. If the same result is submitted by several participants, score is divided between them.
Answers to some questions
In English
In Latvian
- Kāpēc Linux nevis Windows
- Kāpēc Ubuntu vai Xubuntu
Enrol yourself to the course (should be working now)
- Register yourself into system: https://artss.mii.lv/login/signup.php
- Log into system https://artss.mii.lv/?redirect=0
- Search course Introduction to Knowledge Society Technology (RTC702)
- Enrol yourself to the course
Optional — prepare standard environment for your homework
For this class only free to use open source tools are used, which work on different computers and operating systems. But it may cost you hours of troubleshooting if something doesn't work as expected, therefore, to perform tasks in the most efficient way, it is recommended that you install Xubuntu 20.04 as native operating system on your computer or inside virtual machine.
Download setup disk image from http://cdimage.ubuntu.com/xubuntu/releases/20.04/release/.
If you set up Xubuntu as native operating system on computer:
- Create bootable USB from dowloaded image.
Or, if you use virtual machine:
Use following settings to set up system:
- Location: Riga
- User: student
- Password: Student007
- Computer name — first syllables of name and surname separated with dash, e.g., val-vit
- Language English or Latvian
Complete setup wizard and log into your computer
1. Computers and binary data
1. task
Create plain text file with e.g. mousepad in Xubuntu, or notepad editor in Windows. Create file in form 1234abcd.1.1.txt where 1234abcd is your actual identifier and write your name (if necessary also middle name) and surname in it (and don't write anything else in the file). For example:
Valdis Vītoliņš
2. task
If necessary, install bindechexascii tool by entering following command in terminal:
sudo apt install bindechexascii- Convert following text: Vexed nymphs go for quick waltz job. to binary representation, where each bit is shown with 1 or 0 and bytes are delimited with spaces:
Using Linux command line tool:
bindechexascii --a2b "Vexed nymphs go for quick waltz job."or
- Using online ASCII,Hex,Binary,Decimal,Base64 converter
- Save produced text in file 1234abcd.1.2.txt
3. task
- Decode following Base64 ecoded text Rml2ZSBoZXhpbmcgd2l6YXJkIGJvdHMganVtcCBxdWlja2x5Lg== back into ASCII text:
Using Linux command line tool:
echo "Rml2ZSBoZXhpbmcgd2l6YXJkIGJvdHMganVtcCBxdWlja2x5Lg=="|base64 -dor
- Using online ASCII,Hex,Binary,Decimal,Base64 converter
- Save produced text in file 1234abcd.1.3.txt
Deliveries
- Text file 1234abcd.1.1.txt with your name and surname
- Text file 1234abcd.1.2.txt with binary encoded message
- Text file 1234abcd.1.3.txt with Base64 decoded message
2. Documents and archives
1. task
- Download archive file
Extract archive with your preferred archive manager (For Windows users it could be 7-zip). In terminal you can do it with command:
tar xzf Exercise2.tgzFind all files in exctracted folders, review and copy their content in the new plain text document. In Bash you can do it in following way:
for i in $(find -type f); do libreoffice "$i"; donein Windows you can find all files and folders with command:
dir /b/s- Sort lines of collected content in ascending order
- Save created document as plain text document in form 1234abcd.2.1.txt
2. task
Use created document 1234abcd.2.1.txt from previous task and convert it to following formats:1.
PDF document. With LibreOffice you can convert it with following command in terminal:
libreoffice --headless --convert-to pdf 1234abcd.2.1.txtIf necessary, rename created document 1234abcd.2.1.pdf to 1234abcd.2.2.pdf, e.g. with command in terminal:
mv 1234abcd.2.1.pdf 1234abcd.2.2.pdfHTML document. With LibreOffice you can convert it with following command in terminal:
libreoffice --headless --convert-to html 1234abcd.2.1.txtIf necessary, rename created document 1234abcd.2.1.html to 1234abcd.2.2.html, e.g. with command in terminal:
mv 1234abcd.2.1.html 1234abcd.2.2.html
Create folder inside folder inside folder, inside folder, ... with following structure:
Parent folder is named f1, its child folder is f2, its child folder is f3 and so on until folder f100.
In command line you can do it with following command:for i in {1..100}; do mkdir "f$i"; cd "f$i"; doneIn Windows you can do it with command (paste all at once):
for /l %x in (1, 1, 100) do (
echo f%x
mkdir f%x
cd f%x
)- Put created PDF and HTML documents, e.g. 1234abcd.2.2.pdf and 1234abcd.2.2.html in the folder f100 (easier to do with drag an drop in graphical file manager, or with Midnight commander
Create Zip archive of created folders and documents, starting with folder f1 (i.e. root folder inside archive should be folder f1). E.g. in command line:
zip -qr 1234abcd.2.2.zip f1
Workaround for Windows users
- Download and install PuTTY
- Download and install Midnight Commander for Windows
- Make SSH connection to server tools.odo.lv with username and password. Create folders as described before for Linux system.
- Copy needed files from your workstation to server tools.odo.lv using Midnight Commander:
- Press F9, choose Right and then SFTP link...
- write artss@tools.odo.lv in machine name and click OK
- write password and click on OK
- Copy files from left window showing your local files and folders to right window showing remote files and folders.
Deliveries
- Text file in form 1234abcd.2.1.txt with collected and sorted content from extracted documents
- Zip archive in form 1234abcd.2.2.zip with 1234abcd.2.2.pdf and 1234abcd.2.2.html files in f1/.../f100 folder of the archive
3. Networking
1. task
- On Linux based system, if necessary, install Wireshark on Linux
- On Windows download Wireshark Windows package and install it
Prepare terminal and enter following command:
On Linux based system:
traceroute -m 20 odo.lvor
On Windows:
tracert -h 20 odo.lv
- Ensure there is no unrelated network activities happening
- Start recording network traffic of active network card
- Enter prepared command in terminal and wait till it finishes
- Stop recording of network traffic in Wireshark
- Save recorded traffic in file with form 1234abcd.3.1.pcapng
- Create simple, unformatted text file in form 1234abcd.3.2.txt and describe everything what you have recorded in Wireshark.
2. task
- If necessary, on Windows download and install PuTTY and Midnight Commander for Windows
- Create SSH connection to the remote server tools.odo.lv:
On Unix-like system system open terminal and enter command:
ssh artss@tools.odo.lvor
- On Windows open PuTTY and create new connection to server tools.odo.lv
- Ensure you have established remote SSH connection to the server (command prompt should show artss@tools:~$)
Execute following command:
java -jar encrypt-session.jar "Name Surname"where Name Surname is your actual name and surname.
- Save generated output e.g. MhtAnXdjllA5OwaRSP0eVAGfpJie9zJJNE3yYpb3YARxCiOsvdheYZqVzFv+l/XG in file 1234abcd.3.3.txt
3. task
- On Linux:
If necessary, install Remmina:
sudo apt-get install remmina- Open Remmina and create new VNC connection with address tools.odo.lv:5901
- On Windows
- Download FreeRDP package, e.g. WFreeRDP 1.1
Run wfrerdp with command:
wfreerdp.exe /v:tools.odo.lv- Change port number to 5901, enter password and press OK
- You may also download TightVNC and use it for remote connection using VNC protocol.
On remote desktop connection open terminal and execute commands:
cd
java -jar encrypt-session.jar "Name Surname"where Name Surname is your actual name and surname and 1234abcd is your identifier.
- Save generated output e.g. MhtAnXdjllA5OwaRSP0eVAGfpJie9zJJNE3yYpb3YARxCiOsvdheYZqVzFv+l/XG in file 1234abcd.3.4.txt
Error solutions
Deliveries
- Wireshark traffic file 1234abcd.3.1.pcapng
- Text file 1234abcd.3.2.txt with explanation of Wireshark data
- Text file 1234abcd.3.3.txt with encrypted SSH session data
- Text file 1234abcd.3.4.txt with encrypted RDP/VNC session data
4. Audio
1. task
- Set up sound editor of your preferences e.g. Rosegarden or any other sound/MIDI editor.
Get your melody signature (i.e. letters from a till h) from your name and surmame using Latin letters only, e.g. by running command:
echo "Valdis Vitolins"|egrep -io "[a-h]"
a
d- Create project in sound editor from allowed notes (e.g. A and D):
- create first track with melody, e.g. using quarter notes
- create second track with bass, where notes are 2 octaves lower (and may change slower than for melody)
- Create at least 4 bars, and copy notes or add some variations if like
- Export project into MIDI file in form 1234abcd.4.1.midi and check, that it can be played by e.g. timidity player
2. task
- Use sound recorder and editor, e.g. Audio-recorder and Audacity, and create audio file with content of your preference. If no better ideas, at the beginning of file you can say something like "Helo, my name is Valdis Vītoliņš". Remaining part should not be just noise, but is up to your preferences. It should not contain copyrighted or any similarly legally obstructed material.
- Cut file that its playback length is exactly 1 minute.
Export file into FLAC format FLAC in form 1234abcd.4.2.flac
with following properties:Property Value No of channels 1 (monophonic) Sample Rate 44100 (Hz) Precision 16-bit unsigned Duration 60 seconds Encoding FLAC On Linux you can check that file is created properly with soxi tool. It should show something like this:
soxi 1234abcd.4.2.flac
Input File : '1234abcd.4.2.flac'
Channels : 1
Sample Rate : 44100
Precision : 16-bit
Duration : 00:01:00.00 = 2646000 samples = 4500 CDDA sectors
File Size : 1.70M
Bit Rate : 227k
Sample Encoding: 16-bit FLACIf necessary, change project sample rate to 8kHz and export file into WAV in form 1234abcd.4.3.wav with following properties:
Property Value No of channels 1 (monophonic) Sample Rate 8000 (Hz) Precision 8-bit unsigned Duration 60 seconds Encoding WAV On Linux you can check that file is created properly with soxi tool. It should show something like this:
soxi 1234abcd.4.3.wav
Input File : '1234abcd.4.3.wav'
Channels : 1
Sample Rate : 8000
Precision : 8-bit
Duration : 00:01:00.00 = 480000 samples ~ 4500 CDDA sectors
File Size : 480k
Bit Rate : 64.0k
Sample Encoding: 8-bit Unsigned Integer PCM
Deliveries
- MIDI file in form 1234abcd.4.1.midi
- FLAC file in form 1234abcd.4.2.flac
- WAV file in form 1234abcd.4.3.wav
5. Imaging
- Download file and extract it
1. task
- Select some of your own private photos with your image and cut out only your image from the photo.
- Depending on properties of your image, choose one of extracted image files Spring.jpg, Summer.jpg, Autumn.jpg or Winter.jpg as a background image.
- Place your own image in front of chosen background image. To get full credit for exercise, ensure, that it looks natural.
- Place your unique identifier in top left corner of the image, e.g. 1234abcd
- Export your prepared image in JPG file with dimensions of 1024×768 pixels in form 1234abcd.5.1.jpg
You can check properties of generated file with command:
identify 1234abcd.5.1.jpg
2. task
- Use exported Library.jpg file as bitmap input file for background.
- Convert bitmpap file into vectorized form. E.g. in Inkscape:
- Choose Path — Vectorize bitmap
- In setup choose Colors:16, ...groups...Color
- Remove original bitmap image
- Place your own image in front of prepared background. Convert your image to vector form and remove original bitmap image as well.
- Place your unique identifier in top left corner of the image, e.g. 1234abcd and convert from object to path
- Export image as A4 landscape page in SVG format in form 1234abcd.5.2.svg, ensure that background takes all space and there ar no empty spaces in the image.
- Check size and content of generated SVG file, to be sure it contains only vector objects
Deliveries
- Bitmap file in form 1234abcd.5.1.jpg
- Vector file in form 1234abcd.5.2.svg
6. Video
Use sound recorder and editor, e.g. Cheese and/or SimpleScreenRecorder and Cinelerra CV, Cinlelerra GG or VirtualDubMod and create video file in Ogg format with following properties:
Property | Value |
---|---|
Duration | 60 seconds |
Video stream: | |
Codec | Theora |
Resolution | 1024×768 |
Aspect ratio | 4:3 |
Frames/sec | 24 |
Audio stream: | |
Channels | 1 (Monophonic) |
Codec | Vorbis |
Sample rate | 44100 Hz |
Content of video file should not be just noise, but otherwise is up to your preferences.
On Linux you can check that file is created properly with ffprobe tool. It should show something like this:
...
Duration: 00:01:00.00, start: 0.000000, bitrate: ...
Stream #0:0: Video: theora, yuv420p, 1024x768 [SAR 1:1 DAR 4:3], 24 tbr, 24 tbn, 24 tbc
...
Stream #0:1: Audio: vorbis, 44100 Hz, mono, fltp, 36 kb/s
...
If you are using some editor, which doesn't support output to *.ogv file directly, you may convert produced file to *.ogv format with some of conversion tools, e.g.:
Deliveries
- Video file in form 1234abcd.6.1.ogv
7. Security
- Install GnuPG in Linux or in Windows or Mac
According to the The GNU Privacy Handbook: Getting Started create your own keypair, e.g.:
gpg --gen-keyand follow setup wizard.
According to the The GNU Privacy Handbook: Exchanging keys export your public key, e.g.:
gpg --output 1234abcd.7.1.pub --export "your@email"where your@email is your actual email.
- Create plain text file in form 1234abcd.txt, write your name and surname, and save it.
According to the The GNU Privacy Handbook: Making and verifying signatures, sign file 1234abcd.txt with your private key, e.g.:
gpg --output 1234abcd.7.2.sig --sign 1234abcd.txt- Open page https://keys.openpgp.org/search?q=valdis.vitolins@odo.lv, copy and save public key in local file e.g. valdis.vitolins.pub.asc
Import public key from valdis.vitolins.pub.asc. E.g. (if file is saved in the current folder):
gpg --import valdis.vitolins.pub.ascAccording to the The GNU Privacy Handbook: Encrypting and decrypting documents encrypt created file witg GnuPG using public key for valdis.vitolins@odo.lv. E.g.:
gpg --output 1234abcd.7.3.gpg --encrypt --recipient valdis.vitolins@odo.lv 1234abcd.txt
Deliveries
- Your public key in form 1234abcd.7.1.pub
- Signed file with your signature in form 1234abcd.7.2.sig
- Encrypted file in form 1234abcd.7.3.gpg
8. Databases
- Download and install MySQL Workbench
- Create connection to the MySQL server over SSH connection as it is described here with following parameters:
- Server: tools.odo.lv
- Username for SSH and MySQL connections: artss
- Password is the same for SSH and MySQL and is given in artss.mii.lv
- Open artss database on the server.
Select first records from the hashes table by executing statement:
SELECT * FROM artss.hashes LIMIT 1;Select that record, right click on it, choose Copy row in pop-up menu and paste it in some editor.
Delete chosen record from hashes table by executing statement:
DELETE FROM artss.hashes WHERE id = ID1;where ID1 is actual identifier for chosen record
Select last record from the entries table:
SELECT * FROM artss.entries ORDER BY id DESC LIMIT 1;Update next_id field of this entry by executing statement:
UPDATE artss.entries SET next_id = ID1 WHERE id = ID2;where:
- ID1 is chosen record identifier from hashes table
- ID2 is record identifier of the last record in the entries table
Create new record in entries table by executing statement:
INSERT INTO artss.entries (id, hash, your_id) VALUES (ID1, 'aa...aa', '1234');where:
- ID1 is actual identifier for chosen record in hashes table
- aa...aa is actual hash for chosen record in hashes table
- 1234 are first four characters of your eight-character identifier
If necessary, search for chosen record in hashes table by executing statement:
SELECT * FROM artss.hashes where id = ID1;where ID1 is chosen record identifier from the hashes table
and check that no record is returnedSearch for your added/modified records in entries table by executing statement:
SELECT * FROM artss.entries where id = ID1 or next_id = ID1;where ID1 is chosen record identifier from the hashes table
Copy and paste selected rows or export them in text file with following format:
0,aa...aa,0000,1
1,bb...bb,1234,NULLCheck that there are no unneeded rows (e.g. field names) and delimiters (e.g. ', ` or ") around values.
Save file in format 1234abcd.8.1.txt
Deliveries
- Text file in form 1234abcd.8.1.txt with list of field values of your updated and created record.
9. Python
- Install latest stable environment for Python 3 programming langugage:
On Debian-based Linux distribution:
sudo apt install python3or
- Download and install it from https://www.python.org/downloads/
- Install Python editor/IDE of your preference e.g. Eric or PyDev
Create file in format 1234abcd.9.1.py, that:
- reads two passed parameters, which represents number of month and number of day in month
prints out zodiac sign according to the Tropical date
N.B overlapping dates belong the previous sign. E.g. March 21 belongs to Pisces as it is shown in example below:python3 1234abcd.9.1.py 3 21
Pisces
Deliveries
- Python script in form 1234abcd.9.1.py, which prints Zodiac sign for passed month and day
10. Contribution to wikipedia
In this exercise you have to register into wikipedia and contribute some content about topics covered in this course. As information in English there is quite wast, it is recommended to do this in Latvian or other language. You can write something new, or just translate content from English to other language. Don't use jargon. Look for proper terms in dictionaries).
Deliveries
Simple text file in form 1234abcd.10.1.txt with your name and surname and link to contribution of your Wikipedia username (not changed article) to wikipedia.
For example:
Deliveries
- File in format 1234abcd.10.1.txt with link to your wikipedia profile
Footnotes
1. On Debian based Linux distributions like Ubuntu and Xubuntu you install ghex with command sudo apt-get install ghex in terminal.
2. On Debian based Linux distributions like Ubuntu and Xubuntu you install GnuPG with command sudo apt-get install gnupg.