Feeds:
Posts
Comments

Archive for April, 2013

當細心回想,土壤上曾有過像螢光的小點,原來這是真菌蚋的幼蟲的絲。

最初在盆栽中出了一兩隻真菌蚋(蚊滋)。由於太忙沒有理會他們。結果在有三格幼苗的土壤表面上出現大量似出白色的真菌物體,一天後有部份轉至褐色。真菌蚋(蚊滋)的數量也多了幾隻。

我決心要處理這些真菌蚋(蚊滋)。在網上有位年輕的太太在其blog上介糿用tumble dryer sheets。

我在兩天前乘車時,曾在思考如果為樹木殺滅埃及吹棉介殼蟲(見本人的Facebook內提及天水圍樹木被埃及吹棉介殼蟲為患一文)。想到了用freeze spray。今早,我以Freeze spray將真菌蚋(蚊滋)的成蟲殺滅了。真菌蚋成蟲被Freeze Spray急凍之下,最初還有活動能力,相信其腹部不能禦寒,一分鐘內變得無法行動,然後死去。

我會更換受真菌蚋(蚊滋)幼蟲感染的泥土,亦會為泥土噴上Freeze Spray,研究一下Freeze Spray對真菌蚋(蚊滋)幼蟲的影響。

如果能對真菌蚋(蚊滋)幼蟲有效,我會試用Freeze Spray去對付 埃及吹棉介殼蟲。

Read Full Post »

十多年前,經多翻嘗識開發用不同的種子培植芒果的方法。在開發過程中,三十多個培植盤樣本之中,其中一個樣本中發現一隻芒果種子象甲蟲。這是我第一次接觸植物種子相關的蟲子。

因為這次的經歴,我每次以種子種植,都會將種子放在密閉的培植床之上。其中一個作用為檢疫。

最近研究種植枇杷,給了一些本地買回來的枇杷給姊姊吃,她把種子給我,並附上她在家鄉吃的枇杷的種子。今天,我也買了一些進口的枇杷。姊姊給回來的,有部份有梨小食心蟲。將種子的外衣剝開,有部份發現梨小食心蟲的蟲卵。

每次大量種植之前,我都會剝開種子的外衣,作初步的檢疫。然後,就會將種之放在隔離用的培養器內,以減低外來物種入侵的機會。

我個人認為有意去栽培的人,應該養成良好的檢疫習慣。尤其是不要忽略種子檢疫。

Read Full Post »

Java HelloFriend Guide

Java is a quite common programming language nowadays. If you want to know more about Java, you better trying to play and write Java program yourself. The following program may give you some ideas about Java:

1. Create a folder to store your source file (Java uses subfolder as packages: org.examplet.HelloFriend should be store in folders: org/examplet), for example:

mkdir -p ~/source/java/src/org/examplet

2. Go to your folder, for example:

cd ~/source/java

3. Edit your Java source code:

nano src/org/examplet/HelloFriend.java

4. In the nano screen, type the following source code:

package org.examplet;
import java.util.Scanner;
import static java.lang.System.out;
import static java.lang.System.in;
class HelloFriend{
	public static void main(String args[]){
		String name="";
		Scanner sc=new Scanner(in);
		while(true){
			out.print("What is your name (type 'quit' to quit) ? ");
			if(sc.hasNext()){
				name=sc.nextLine().trim();
				if(name.toLowerCase().equals("quit"))
					break;
			}
			out.printf("Hello, %s!\n",name);
		}
	}
}

5. save the file by press ctrl-x

6. create a folder to store the compiled file, for example:

mkdir build

7. compile the file and output the file to the “build” folder

javac -d build -sourcepath src src/org/examplet/HelloWorld.java

8. run the code by the following command:

java -cp build org.examplet.HelloFriend

9. As you run the program, you’ve been asked for your name repeatedly:

What is your name (type 'quit' to quit) ? Peter Pan
Hello, Peter Pan!
What is your name (type 'quit' to quit) ? quit

Read Full Post »

Go Lang HelloFriend Guide

If you go to go language website, you’ll find out “go” is a quite new and different computer language. If you want to know more about go language, you should try to write a program yourself. The following is a simple example for you:

1. Create a folder to store your source file, for example:

mkdir -p ~/source/go/src

2. Go to your folder, for example:

cd ~/source/go

3. Edit your HelloFriend go language source code:

nano src/HelloFriend.go

4. In the nano screen, type the following source code:

package main
import(
	"bufio"
	"fmt"
	"os"
	"strings"
)
func main(){
	rd := bufio.NewReader(os.Stdin)
	for{
		fmt.Printf("What is your name (type 'quit' to quit) ? ")
		line,err := rd.ReadString('\n')
		if err==nil{
			name := strings.TrimSpace(line)
			if "quit"==strings.ToLower(name) {
				break
			}
			fmt.Printf("Hello, %s!\n",name)
		}
	}
}

5. save the file by press ctrl-x

6. compile the source code, for example:

go build -o build/HelloFriend src/HelloFriend.go

7. run the compiled program by the following command:

build/HelloFriend

8. As you run the program, you’ve been asked for your name repeatedly:

What is your name (type 'quit' to quit) ? Peter Pan
Hello, Peter Pan!
What is your name (type 'quit' to quit) ? quit

Read Full Post »

C++ HelloFriend Guide

Elementary Tutorial for Writing and Running c++. Follows the following steps to run a basic C++ program:

1. create a folder to store your source code, for example:

mkdir -p ~/source/cpp/HelloFriend/src

2. change the current directory to the working folder, for example:

cd ~/source/cpp/HelloFriend

3. create the source code by the following command:

nano src/HelloFriend.cpp

4. In the nano environment, type the source code:

#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main(int argc, char* argv[]){
	string name;
	while(true){
		cout<<"What is your name (type 'quit' to quit) ? ";
		getline(cin,name);
		if(name.compare("quit")==0) break;
		cout<<"Hello, "<<name<<"!"<<endl;
	}
	return 0;
}

5. press ctrl-x to leave and save the source code

6. Create the Makefile.am to instruct makefile program to look for sub-folders

nano Makefile.am

7. The source code for the Makefile.am should be:

SUBDIRS=src

8. press ctrl-x to save and exit the nano editor

9. Create the sub-folder Makefile.am, e.g.

nano src/Makefile.am
[/source}

10. Update the sub-folder Makefile.am as followings:

bin_PROGRAMS=HelloFriend
HelloFriend_SOURCES=HelloFriend.cpp

11. Press Ctrl-X to Save and Exit the nano editor.

12. Generate a template config file by invoking the autoscan command:

autoscan

13. A file called configure.scan has been generate for you, change the name to configure.ac and edit it by the following command:

mv configure.scan configure.ac
nano configure.ac

14. Change line 5 of the code into (replace your email accordingly):

AC_INIT([HelloFriend],[1.0],[cloudgen@examplet.org])

15. Add a line below line 5 and type the following:

AM_INIT_AUTOMAKE([foreign])

16. Then your configure.ac should look like:

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([HelloFriend],[1.0],[cloudgen@examplet.org])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([src/HelloFriend.cpp])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CXX

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL

# Checks for library functions.

AC_CONFIG_FILES([Makefile
                 src/Makefile])
AC_OUTPUT

17. Prepare the makefile.in and config.h.in by the following command:

autoheader
aclocal
autoconf
automake --add-missing

18. Configure your compiler by the following command:

./configure

19. Compile runnable code by the following command:

make

20. Install the program to your system by the following command,

make install

21. Run the installed program by,

HelloFriend

22. As you run the program, you’ve been asked for your name repeatedly:

What is your name (type 'quit' to quit) ? Peter Pan
Hello, Peter Pan!
What is your name (type 'quit' to quit) ? quit

Read Full Post »

Scala HelloFriend Guide

The is a Helloworld tutorial for scala programming language and how to process console’s input and output. Follows the following steps to see how it works:

1. create a folder to store your source code, for example:

mkdir -p ~/source/scala/HelloFriend/src

2. change the current directory to the working folder, for example:

cd ~/source/scala/HelloFriend

3. create the source code by the following command:

nano src/HelloFriend.scala

4. In the nano environment, type the source code:

object HelloFriend{
	import scala.util.control.Breaks._
	def main(args:Array[String]){
		var name=""
		breakable{
			while(true){
				print("What is your name (type 'quit' to quit) ? ")
				name=readLine.trim
				if(name.toLowerCase=="quit") break
				printf("Hello, %s!\n",name)
			}
		}
	}
}

5. press ctrl-x to leave and save the source code

6. Run the program by the following command:

scala src/HelloFriend.scala

7. As you run the program, you’ve been asked for your name repeatedly:

What is your name (type 'quit' to quit) ? Peter Pan
Hello, Peter Pan!
What is your name (type 'quit' to quit) ? quit

Read Full Post »

Python HelloFriend Guide

The is a Helloworld tutorial for python. Follows the following steps to learn the fundamental of Python input and output:

1. create a folder to store your source code, for example:

mkdir -p ~/source/python/HelloFriend/src

2. change the current directory to the working folder, for example:

cd ~/source/python/HelloFriend

3. create the source code by the following command:

nano src/HelloFriend.py

4. In the nano environment, type the source code:

#!/usr/bin/python
def hello_friend():
	name=''
	while True:
		name=raw_input("What is your name (type 'quit' to quit) ? ").strip()
		if name.lower()=='quit':
			break
		print 'Hello, '+name+'!'
hello_friend()

5. press ctrl-x to leave and save the source code

6. Grant the Execution right to the python file:

chmod +x src/*.*

7. Run the program by the following command:

src/HelloFriend.py

8. As you run the program, you’ve been asked for your name repeatedly:

What is your name (type 'quit' to quit) ? Peter Pan
Hello, Peter Pan!
What is your name (type 'quit' to quit) ? quit

Read Full Post »

Ruby HelloFriend Guide

The is a Helloworld tutorial for ruby input and output. Follows the following steps to examine how ruby process console’s input and output:

1. create a folder to store your source code, for example:

mkdir -p ~/source/ruby/HelloFriend/src

2. change the current directory to the working folder, for example:

cd ~/source/ruby/HelloFriend

3. create the source code by the following command:

nano src/HelloFriend.rb

4. In the nano environment, type the source code:

#!/usr/bin/ruby
def hello_friend
	begin
		print "What is your name (type 'quit' to quit) ? "
		name=gets.chomp.gsub(/^\s+|\s+$/,'')
		if name.downcase=='quit'
			break
		end
		puts 'Hello, '+name+'!'
	end while true
end
hello_friend

5. press ctrl-x to leave and save the source code

6. Grant the Execution right to the ruby file:

chmod +x src/*.*

7. Run the program by the following command:

src/HelloFriend.rb

8. As you run the program, you’ve been asked for your name repeatedly:

What is your name (type 'quit' to quit) ? Peter Pan
Hello, Peter Pan!
What is your name (type 'quit' to quit) ? quit

Read Full Post »

Perl HelloFriend Guide

The is a Helloworld tutorial for perl input and output. Follows the following steps to examine how perl process console’s input and output:

1. create a folder to store your source code, for example:

mkdir -p ~/source/perl/HelloFriend/src

2. change the current directory to the working folder, for example:

cd ~/source/perl/HelloFriend

3. create the source code by the following command:

nano src/HelloFriend.pl

4. In the nano environment, type the source code:

#!/usr/bin/perl
sub hello_friend{
	while(true){
		print "What is your name (type 'quit' to quit) ? ";
		chomp($name=<STDIN>);
		$name =~ s/^\s*(.*?)\s*$/$1/;
		last if lc($name) eq 'quit';
		print "Hello, $name!\n"
	}
}
hello_friend

5. press ctrl-x to leave and save the source code

6. Grant the Execution right to the perl file:

chmod +x src/*.*

7. Run the program by the following command:

src/HelloFriend.pl

8. As you run the program, you’ve been asked for your name repeatedly:

What is your name (type 'quit' to quit) ? Peter Pan
Hello, Peter Pan!
What is your name (type 'quit' to quit) ? quit

Read Full Post »

Coffeescript HelloFriend Guide

If you have just install Coffeescript and want to play Coffeescript in a fun way. Coffeescript’s HelloFriend guide should help you.

All you need to do is to install Coffeescript and follow the following steps:

1. Create a folder to store your source file, for example:

mkdir -p ~/source/coffee/src

2. Go to your folder, for example:

cd ~/source/coffee

3. Edit your NodeJS source code:

nano src/HelloFriend.coffee

4. In the nano screen, type the following source code:

readLine=require 'readline'
helloFriend=()->
	con=readLine.createInterface
		input:process.stdin,
		output:process.stdout
	con.question "What is your name (type 'quit' to quit) ? ",(name)->
		name=name.replace /^\s+|\s+$/g, ''
		if name.toLowerCase()!='quit'
			console.log 'Hello, '+name+'!'
			con.close()
			helloFriend()
		else
			con.close()
helloFriend()

5. save the file by press ctrl-x
6. compile the script into javascript into folder called build (no need to create the folder, coffeescript compiler will create it for you).

coffee -o build src/HelloFriend.coffee

7. run the code in NodeJS by the following command:

node build/HelloFriend.js

8. As you run the program, you’ve been asked for your name repeatedly:

What is your name (type 'quit' to quit) ? Peter Pan
Hello, Peter Pan!
What is your name (type 'quit' to quit) ? quit

Read Full Post »

Older Posts »