Categories of posts

Showing posts with label Learning points. Show all posts
Showing posts with label Learning points. Show all posts

Saturday, September 18, 2010

linuxNUS Hackers' Workshop series - The UNIX philosophy

The below is what I've learnt from the workshop lecture by Prof. Michael Brown, at NUS LT19 on 17/09/2010 6.30pm - 8pm.

The driving idea of UNIX

  • portable

    • Unix written in C, with some assembly code.

    • Not welded to the computer used

  • multi-tasking, multi-user

  • simple and light-weight

  • use of”flat” plain text files – user-readable code

  • large number of software tools

  • hierarchical file system


Sending messages to other processes: echo “” > dev/pts/

File/device notification:

  • files: can read and write chars or blocks of data

  • devices:

    • char devices (eg keyboard) – read chars, not seekable

      • /dev/pts10

    • block devices (eg HDD) – read blocks of data, seekable

  • pseudo devices:

    • /dev/zero: produces zeros

    • /dev/null: ignores all input, has no output

    • /dev/random: produces a stream of rand output


Unix shell

  • allows “shell scripting”

    • can write “for loop” to create 10 .txt files.

for i in 0 1 2 3 4 5 6 7 8 9

do

touch $i.txt

  • can tie processes together


Selective rules for programming:

  • rule of modularity:

    • write simple modules connected via clean interface

  • rule of clarity:

    • clarity >> cleverness

  • rule of composition:

    • design programs to be connected with other programs

  • rule of user input:

    • do not make programs WAIT for user input

  • rule of simplicity:

    • add complexity only if you must

  • rule of transparency:

    • make inspection and debugging easy – a good man page helps.

  • rule of robustness:

    • program should work well, but if it fails, make sure it fails gracefully.

    • Do input checking

  • rule of least surprise:

    • in interface design, always do the least surprising thing

    • stick with convention (+ means add)

    • avoid excessive features and novelty (max of 3 clicks to go to ANY file on iPod)

  • rule of silence:

    • when program has nothing surprising to say, it should say nothing.

  • rule of repair:

    • when you must fail, fail noisily and as soon as possible

  • rule of (late) optimisation:

    • get it working before optimising it.

Sunday, September 12, 2010

How to allow "limited account" users to change power management plans in Windows XP

Spent a significant amount of time searching for this, so figured I ought to note it down somewhere:

Accreditation: Written by Curtis Clay III (original source here)

1. Log on as Administrator.

2. Click Start , click Run, and then type "Regedt32" (without the
quotation marks).

3. Locate and click the following registry key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ControlsFol
der\PowerCfg\GlobalPowerPolicy

On the Security menu, click Permissions. Either add the users separately,
or add the users' group and give all the users full control over this
key.

4. Locate and click the following registry key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ControlsFol
der\PowerCfg\PowerPolicies

On the Security menu, click Permissions.
Either add the users separately, or add the user s' group and give all
the users full control over this key.

5. In addition, users need to be given the right to shut down the system.
To accomplish this, follow these steps:

a. In Control Panel, double-click Administrative Tools, and then
double-click "Local Security Policy".

b. In the left pane, expand Local Policies and click User Rights
Assignment.

c. In the right pane, double-click "Shut down the system", and add each
user individually or add the Users group to this local security policy.
Making these changes will allow normal users to alter power scheme settings
without being added to the Local Administrators group.

Note If users are running Windows 2000 Service Pack 3 (SP3), an
Administrator must also provide the users with the "Create Pagefile"
permission.

Tuesday, August 31, 2010

PM Lee's 2010 National Day Speech

Points discussed during the speech can be found here.

Saturday, August 21, 2010

linuxNUS Hack Workshop Series Opening

Attended the afore-mentioned event yesterday (on a Friday, 6.30 to 8pm no less), and thought I would share some key excerpts with everyone.

Hack != crack.
Hacking is just finding clever ways to get around limitations/get something done.
Cracking is finding loopholes in things and use it with malicious intentions.

3 steps in hacking:
1. A cool idea (conception) - "Hey, it would be cool if we could do this.."
2. Finding a way to do it (method) - "Hmm.. that's one way of doing this.."
3. A motivation to do it (execution) - "I bet I could do this.. "
4. Bonus - doing it on a large scale.

Hacking demonstrated:
1. It would be cool to have a reversed soft-boiled egg - Fully cooked and hardened yolk, with a runny white.
2. Turns out that egg whites coagulates at 66 degs, and yolks at 64 degs.. so if the egg is cooked at precisely 65 degs.. the desired outcome can be achieved.
3. I bet I could do this - finding out a way to maintain the temperature of a water bath at 65 degs.
4. Buy a machine (which costs about $200) that maintains the temperature of a water bath automatically - can cook a bunch of reversed soft-boiled eggs (like 4 dozens) at 1 go!

Failed/insignificant projects:
Time spent on small projects or projects that don't quite work are not wasted. With everything done, you learn a little about stuff. All these knowledge are gained from the process of doing something.

Power of a good presenter:
Of the 3 presenters, the last made the most impact - in fact, most of the things I remember above are said by him. So why?

First of all, he came dressed for the occasion. A suit and tie makes you look more reputable. And people want to listen to you. And not to that shabby dressed guy, unless your reputation precedes you.

Secondly, interesting opening to get the audience's attention. He didn't start with his theories, or what he wanted to tell us, but showed us the reversed soft-boiled egg and how he made it. That caught everyone's attention. Then people WANT to hear what he says next.

Third, good oration. No unnecessary fillers, good tone, good pronunciation and good pace makes people entranced with what he wanted to say and want to continue listening.