Archive for October, 2007
Your Future in Supply Chain Management
Dear ABS (SCML) students,
You are cordially invited to attend a talk organized by the representatives from the Hong Kong Chartered Institute of Purchasing & Supply (HKCIPS). The details are as follows:
Topic: Your Future in Supply Chain Management
Read the rest of this entry »
ISM001 Test Papers Ready for Pickup
Dear ISM001 students,
Thank you for coming to the test last Friday. The questions and answers are now posted here: question paper, answer sheets, answers.
The papers have been marked. Please get it back from me at your convenience. Otherwise I will return the papers to you on Friday. Thank you.
How to do evil in Java
Our Java programmer Cham Hin Cheung found a way to write to file in a Java program:
The simple program asks for a class name of an existing Java program and generates a DOS batch program that could compile and run the Java program. This is the first ever attempt in this course to compile and run one program from another.
The following link is also interesting:
Execute system commands in a Java Program
By using the Runtime.getRuntime() technique in the example, one can write a Java program that executes or even generates any other external program in the DOS environment. This includes modifying and replicating itself, which mean, in a sense, a computer virus.
Warning: Writing a computer virus is a very good training in computer programming. However, you can be prosecuted by law if you “share” the computer virus with others and cause some damage. If you want to write your own computer virus in Java, keep it in a safe place and make sure that it does not affect others. Come to me if you do not know how to do so.
Powered by ScribeFire.
How to create an exe from Java?
Some of our junior Java programmers in ISM001 asked me how to compile their Java programs into native code (i.e. .exe files on Windows) so that they do not need the Java interpreter to run.
But why do we want to do this in the first place? For me, the main reason is performance — A Java program in native code usually runs faster than Java bytecode (e.g. the .class files we have been using). Others may want to show off their Java programs to their friends who do not have Java installed.
An article by Hank Shiffman explains the pros and cons of compiling Java into native code:
Boosting Java Performance: Native Code & JIT Compilers
Feeling too complicated? The following page is easier to understand. It also contains a list of Java native compilers:
An even longer list is here:
Free Java Compilers, Assemblers, Java Development Kits
Among the many choices, my favorite is gcj, the open source, cross-platform GNU compiler for the Java programming language. The following link contains more information:
In brief, to compile the program MyJavaProg.java, just type the following:
gcj -c -g -O MyJavaProg.java
gcj --main=MyJavaProg -o MyJavaProg MyJavaProg.o
which can be simplified as:
gcj -g -O --main=MyJavaProg -o MyJavaProg MyJavaProg.java
Remarks: Sad enough, gcj does not (yet) support printf and a few other new features since javac 1.5. As a work around, do not use printf for the moment if you want to use gcj.
For those who successfully compile your Java program into native code, please share your experience in the comments.
Powered by ScribeFire.
BUSA01 Test 2 Sample Questions with Answers
This is taken from the Test 2 paper of last year. Note however that the paper in this year will only be similar to the past paper in the format, but not in the contents.
Questions [pdf]
Answers [pdf]
如何用 Google 學英文
如何用 Google 學英文(by using Phrase search)
BUSA01 Test 1 Answers and Results
Refer to the following document: BUSA01-test1-answers.pdf and BUSA01Test1Results.pdf
Answers for the make-up papers are marked on the answer sheet. Your instructor will return the papers to you next week.
Those with unsatisfactory scores please ask your instructor for assistance as soon as possible.
Powered by ScribeFire.
Make up class for BUS010 Section 4
Make up class for BUS010 Section 4 is confirmed:
Date: 27/10/2007 (Sat)
Time: 3:30pm to 5pm
Venue: NAB 101
Topic: Module 5 + 6
Reminder: ISM001 Test
Time: 15:30-17:30
Venue: NAB-206
Coverage and format:
Refer to Test and Examination Information.
Any class in the morning?
The class in the morning is canceled. I will be in an important meeting with some “big brothers” from another planet, so see you all in the afternoon.
How to survive the test:
Practise
Powered by ScribeFire.

