Tuesday, October 30, 2012

Python programming Day 05

To convert from a string to a list of characters

>>> s = 'spam'
>>> t = list(s)
>>> print t
['s', 'p', 'a', 'm']

To break a string into words

 >>> s = 'pining for the fjords'
>>> t = s.split()
>>> print t
['pining', 'for', 'the', 'fjords']

To convert all elements in a list to a string

>>> t = ['pining', 'for', 'the', 'fjords']
>>> delimiter = ' ' # the delimiter is a space character, so join puts a space between words
>>> delimiter.join(t)
'pining for the fjords'


References
Allen B. Downey, Think Python: How to Think Like a Computer Scientist,
http://www.greenteapress.com/thinkpython/html/index.html

Tuesday, July 31, 2012

UNIX/Linux/Ubuntu system administration DAY 02

Linux system commands
  1. lastb : show details of failed logins
  2. last : display the last login and logout details of all users
  3. uptime: display how long the system has been running
  4. who: list of users who are currently logged in to the system
  5. w: display information about users currently logged in to the system
  6. telinit: change run levels (e.g. single user mode: run level 1)
  7. netstat -rn: check the default gateway on an unix/linux machine
Useful Linux commands
  1. apropos: search for strings that exist in each Linux command e.g. apropos printing
  2. cat /etc/shells: list all available shells in the system
  3. set: display all environmental settings
Managing users and groups
  1. /etc/passwd
  2. /etc/groups: consists of a list of groups each in a different line

Managing partitions
  1. fdisk: mange partition table
  2. sfdisk: manage partition table
  3. parted: a partition manipulation program
  4. partprobe: inform the OS of partition table changes
Manage packages using RPM
  1. rpm -i packagename: install a package
  2. rpm -F packagename: reinstall a package
  3. rpm -U packagename: upgrade a package
  4. rpm -e package name: remove a package
  5. rpm -qa list all packages that are installed on your system
YUM component acts as the front-end package installer for RPM

  1. yum install R R-core R-core-devel R-devel //to install R in Linux/Centos

Web systems day 06-Topic: declaration

Common <!DOCTYPE> declaration




References

  1. http://www.w3schools.com/ accessed date 31 July 2012

Monday, July 30, 2012

IT for Users in Organisations Day 01

Ways to increase productivity
  1. higher production
  2. improve quality
  3. improve efficiency
  4. improve effectiveness
  5. automate manual tasks
  6. empowering staff
Ways to improve customer service
  1. increase customer satisfaction
  2. extend customer services
  3. monitor customer contacts – feedback and analysis
  4. customer service online
  5. automate manual tasks
  6. empowering staff
References
  1. Melbourne Institute of Technology (Semester 2, 2012). BN105 IT for Users in Organisations Lecture Notes.

Friday, July 20, 2012

UNIX/Linux/Ubuntu system administration DAY 01

Force new users change their password at their first log-in

  1. top command shows more details than ps command. It is like running ps permanently while allowing users to change parameters or apply filters to the output.
  2. sar command shows the system's activities in a period of time (e.g. "> sar 10 5" get 5 samples in a 10-second interval.).
  3. "user@linuxhost:> find . > list_of_files.txt" creates a list of files and save it into list_of_files.txt.
  4. "user@linuxhost:> find  /user/local -xdev > list_of_files_in_local_folder.txt" creates a list of files in the folder /user/local and save it ist_of_files_in_local_folder.txt.
  5. "user@linuxhost:> grep passwd list_of_files.txt" search the location of the file passwd.
  6. "user@linuxhost:> ps uawx | head" shows the 10 processes using most of the CPU cycles.
  7. "user@linuxhost:> man -s 4 passwd" access information contained in section 4 of the command passwd.
  8. Create a new user (useradd), create the password for the user (passwd username) make sure the user's home directory exists and corresponds to the entry in the /etc/passwd file, verify that the user owns his or her home directory and startup files, and that they are readable (and, in the case of the home directory, executable). E.g. chown -R username /home/username; chgrp -R username /home/username.
  9. "user@linuxhost:> id username" to display user/group information.
  10. "user@linuxhost:> usermod -G admin -a username" add username to group admin.
  11. "root@linuxhost:> shutdown -P now" to shutdown the machine right away.
  12. Modify /etc/sudoers file in order to use command sudo. E.g. EDITOR="emacs" visudo; and use the usermod command at list number 10 above.
References
Erik M. Keller, Unix/Linux Survival Guide, Charles River Media, Inc. , 2006.

Wednesday, July 18, 2012

CSS Day 01

CSS Box model


CSS ID selector example



CSS Class selector example



CSS Syntax 


CSS Pseudo class example



CSS Pseudo element example




References
  1. http://www.w3schools.com/ accessed date 18 July 2012

Thursday, June 21, 2012

Web systems day 05-Topic: JavaScript Objects

I JavaScript Objects

1. Facts about JavaScript objects
  • An object is just a special kind of data. An object has properties and methods.
  • The String object is used to manipulate a stored piece of text.
  • The Date object is used to work with dates and times.
  • The Array object is used to store multiple values in a single variable.
  • The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).
  • The Math object allows you to perform mathematical tasks.
  • The regular expression (RegExp) Object.
2. Properties are the values associated with an object.

3. Methods are the actions that can be performed on objects.

4. String object

5. Date object
6. Array object
  • An array is a special variable, which can hold more than one value, at a time.
7. Boolean object

8. Math Object

9. RegExp Object
  • A regular expression is an object that describes a pattern of characters.
  • When you search in a text, you can use a pattern to describe what you are searching for.
  • A simple pattern can be one single character.
  • A more complicated pattern can consist of more characters, and can be used for parsing, format checking, substitution and more.
  • Regular expressions are used to perform powerful pattern-matching and "search-and-replace" functions on text.

II. JavaScript Advance
  • The Navigator object contains information about the visitor's browser.
  • A cookie is often used to identify a user.
  • A cookie is a variable that is stored on the visitor's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With JavaScript, you can both create and retrieve cookie values.
1. JavaScript Browser Detection

The Navigator Object


2. JavaScript Cookies


References
  1. Wendy Willard (2010). Web Design DeMYSTiFieD. McGraw-Hill Osborne Media
  2. http://www.w3schools.com/ accessed date 21 June 2012

Mounting USB drives in Windows Subsystem for Linux

Windows Subsystem for Linux can use (mount): SD card USB drives CD drives (CDFS) Network drives UNC paths Local storage / drives Drives form...