Showing posts with label coding. Show all posts
Showing posts with label coding. Show all posts

Wednesday, September 16, 2009

tada...aaaaa

[14:20:55] host bin> ./new1_minor.sh
Executes something minor......
[ADMISSION RULE] Modify resource description with type constraints
Generate a job key...
OAR_JOB_ID=18953
[14:21:00] host bin> ll
total 36
-rw-r--r-- 1 ... 11248 2009-09-16 12:54 createConfigFile.class
-rwxr-xr-x 1 ... 823 2009-09-16 14:20 new1_minor.sh
-rw-r--r-- 1 ... 529 2009-09-16 14:21 OAR.18953.stderr
-rw-r--r-- 1 ... 315 2009-09-16 14:21 OAR.18953.stdout
-rw-r--r-- 1 ... 11783 2009-09-16 12:53 somethingArray.class
[14:21:03] host bin> cat OAR.18953.stderr
Exception in thread "main" java.io.FileNotFoundException: ...

Tuesday, September 15, 2009

Tuesday, September 8, 2009

default path in Mac OS X



Actually it's for bash setups.
Depending on the type of working environment, in Mac, there are two different ways you need to complete.

1) work on only Terminal:

~/.profile -- personalize personal initialization such as classpath. Within this file you have

PATH=$PATH:...:...
export PATH

Ps. :... is additional path you put into PATH

~/.bashrc -- personalize personal bash option such as defining alias ls='ls -G'


2) work by using GUI too:
In this case, you need to set up normal path in .profile or .bashrc and also in
/.MacOSX/environment.plist

2.1 create .MacOSX folder
$mkdir .MacOSX
$cd .MacOSX/

2.2 create 'environment.plist' file
$touch environment.plist
$open environment.plist

A window of this file will pop up to you

Then, specify 'PATH' as Key and the value of PATH which is already defined in .profile into Value column.

Monday, December 8, 2008

มาเรียนภาษา ซี กันเถอะ : goodbye world!

Introduction to C Programming...


#include
int main()
{
printf("Goodbye, cruel world!\n");
return(0);
}


1. Compiling and linking your source code

The compiler translates the information in the source code file into instructions the computer can understand. The linker then converts that information into a runnable program.

The GCC compiler recommended and used in this book combines the compiling and linking steps. An object file is created by GCC but it is automatically deleted when the final program file is created.

Object code files end in OBJ or sometimes just O. The first part of the object file name is the same as the source code filename.

Compiling GOODBYE.C: at terminal being in your source code's directory and then...
gcc goodbye.c -o goodbye
Nothing happen! The only time you see a message is if you made an error.

2. Running the final result
In the Unix-like operating systems, you must specify the program's path or location before the program name. Type this command.
./goodbye
Press the Enter key and the program runs, displaying this marvelous text on your screen:
Goodbye, cruel world!




มาเรียนภาษา ซี กันเถอะ The stuff you need to know before you read all the other stuff in this book...

ขอได้รับคำขอบคุณจาก ซีฟอร์ดัมมี่ เซคเคินอิดิชั่น แอนด์ บิททอแรนท์...

The stuff you need to know before you read all the other stuff in this book...

you need two things to program in C on your computer:
- A compiler
- A place to put your programs

For Mac OS X:
GCC compiler is installed and ready to used.
To confirm this, open a terminal window and type the following line at the command prompt
gcc -v

Making programs, you need two tools:
- an editor
- a compiler

For the various UNIX operating systems, you have multiple editor choices.
The simplest text editor is Easy Editor, activated with the ee command.
The author' favorite editor for working with C is vim, a variant on the infamous vi editor in UNIX. Unlike vi, vim uses colors to code text.

Compiling and linking:
This step transforms the meek and mild text file into a robust and useable program on your computer.
The main thrust of programming the individual examples in this book involves the following three steps.
1. Ensure that you're in the work folder

2. Use your text editor to create your source code file

3. Compile and link the source code:
Compiling and linking are both handled by the GCC command. As an example, here's what you need to type to compile and link the GOODBYE.C source code created in Step 1:
gcc goodbye.c -o goodbye
- gcc, the command to compile and link the source code
- goodbye.c, the name of the source code file
- -o, the output switch
- goodbye, the name of the final program
If you leave off the -o switch and its option, GCC creates the program file named a.out. The author doesn't recommend this. Instead, remember the -o option and specify a nmae for the output program. The name can be the same as the source code file, but without the .c extension.

4. Run the program
UNIX runs only programs found on the path, and the author doesn't recommend to put your learn directory on the path.
To get the operating system to notice your program, you have to be specific about where the program lives (in the current folder, for example). you do that by prefixing ./ to the program's name. To run the goodbye program, type the following at the prompt:
./goodbye
and the program runs.

Tip: For each program you create, there are two files on disk: the source code file (a text file) and the program file. That's generally how things go in this book.
Tip: The GCC compiler automatically sets the permission bits on the resulting program file, allowing it to be run. Usually, it's -rwxr-xr-x
If you create your own programs that you want to run, copy them to a bin directory beneath your home directory, and put that directory on the path.