Tuesday, September 28, 2010

注册离岸公司

http://www.midunshangwu.com/list/zhu-ce-li-an-gong-si.shtm

世界上一些国家和地区(多数为岛国)近些年纷纷以法律手段制订并培育出一些特别宽松的经济区域,这些区域一般称为离岸法区。而所谓离岸公司就是泛指在离岸法区内成立的有限责任公司或股份有限公司。如英属维京群岛、 纽埃岛、巴哈马群岛、塞舌尔群岛、巴拿马共和国、毛里求斯共和国等,允许国际人士在其领土上成立一种国际业务公司。当地政府对这类公司没有任何税收,只收 取少量的年度管理费,同时,所有的国际大银行都承认这类公司,为其设立银行帐号及财务运作提供方便。通常情况下,这类地区和国家与世界发达国家有很好的贸 易关系。

无论在上述任何一个国家或地区注册的海外离岸公司,均具有高度的保密性、减免税务负担、无外汇管制三大特点,因而吸引了众多商家与投资者选择海外离岸公司的发展模式。 离岸公司与 一般有限公司相比,主要区别在税收上。与通常使用的按营业额或利润征收税款的做法不同,离岸法区的政府只向离岸公司征收年度管理费,不再征收任何税款。而 且几乎所有的离岸法区均明文规定:公司的股东资料,股权比例,收益状况等,享有保密权利。而"离岸"的含义是指投资人的公司注册在离岸法区,但投资人不用亲临当地,其业务运作可在世界各地的任何地方直接开展。

海外离岸公司常见用途:

  • 贸易公司:直接的好处就是极为方便的资金运作和超低的税赋成本。
  • 控股公司:包括商业控股公司和以保持隐秘性为主要目的的私人控股公司。排名第一香港和第二的英属维尔京群岛都是著名的离岸地。
  • 国际投资:用于持有债券、股票以及交易等。
  • 其他用途:游艇持有公司、物业持有公司、资产保护公司、公众投资公司、知识产权拥有公司、运输公司、网络公司、保险公司等。

公司转口贸易

转口贸易又称中转贸易(intermediary trade)或再输出贸易(Re-Export Trade),是指国际贸易中进出口货物的买卖,不是在生产国与消费国之间直接进行,而是通过第三国转手进行的贸易。

公司转口贸易

什么是转口贸易

转口贸易又称中转贸易(intermediary trade)或再输出贸易(Re-Export Trade),是指国际贸易中进出口货物的买卖,不是在生产国与消费国之间直接进行,而是通过第三国转手进行的贸易。这种贸易对中转国来说就是转口贸易。 交易的货物可以由出口国运往第三国,在第三国不经过加工(改换包装、分类、挑选、整理等不作为加工论)再销往消费国;也可以不通过第三国而直接由生产国运 往消费国,但生产国与消费国之间并不发生交易关系,而是由中转国分别同生产国和消费国发生交易。转口贸易有货物集散地、仓库、堆栈之意,它属于再出口贸易 和过境贸易中间接过境的一部分。

转口贸易的发生,主要是有些国家(或地区)由于地理的、历史的、政治的或经济的因素,其所处的位置适合于作为货物的销售中心。这些国家(或地区)输 入大量货物,除了部分供本国或本地区消费外,又再出口到邻近国家和地区。如新加坡、香港、伦敦、鹿特丹等,都是国际著名的中转地,拥有数量很大的转口贸 易。它们通过转口贸易除了可以得到可观的转口利润和仓储、运输、装卸、税收等收入外,同时也推动了当地金融、交通、电讯等行业的发展。

转口贸易产生的条件

转口贸易(Entrepot Trade)是指两国的进出口贸易是通过第三国的中间商把货物转手来完成的贸易方式。这种贸易方式在生产国为间接出口,在消费国为间接进口,因而是一种间 接贸易方式。而对第三国来说,它将进口的货物再出口,所以是转口,又称再出口贸易。转口贸易已有数百年历史,伦敦、鹿特丹、新加坡是著名的转口贸易港。战 后转口贸易在香港、新加坡、日本、等地发展甚为迅速,并成为这些地区对外贸易的一个重要组成部分。

转口贸易对中间商所在国而言,一般必须具备两个条件:

①自然条件,即中转国的港口必须是深水港、吞吐能力强,地理位置优越,处于各国之间的交通要冲或国际主航线上;
②人为条件:要求中转国对中转地采取特殊的关税优惠政策和贸易政策,如自由港、自由贸易区等,使中转费用不致过高。同时,要求该地的基础设施、交通、金融和信息等服务系统发达且完备,以利于转口贸易的进行。

转口贸易的方式

转口贸易的形式多样,根据货物流通渠道的不同,可分为再出口贸易和单所处理贸易方式两种:

①再出口贸易(Re-export Trade)方式,是指出口商通过中间商与进口商发生买卖关系。而后将货物直接从出口国运往进口国的贸易方式。在这种情况下,货物并未在第三国通关进出 口,而中间商亦仅涉及交易单据的处理。这种单据处理贸易方式实际上是货物所有权的再出口。再出口贸易方式在转口贸易发展的初期较多发生。人们由于经验、通 讯设备等的缺管,转口贸易就通过两交货物的进出口来完成。随着转口贸易的发展,单据处理贸易的方式逐渐发展起来,为种方式可以避免货物在第三国通关进出口 的每秒杂手续,节省运费、保险费和手续费等费用,减少风险,还可缩短交货时间,有利于进口商抓信货物销售良机,从而实现较大的利润。因而单据处理贸易方式 逐渐取代再出口贸易方式,成为当今转口贸易的主要方式。转口贸易根据货物是否在中转地加工,可分为纯粹转口贸易和加工转口贸易两种。

②纯粹转口贸易。所谓纯粹转口贸易系指中转的第三国的中间商对进口的货物未经加工再出口。当然,中间商可以将进口货物在当地保税仓库进行分级、混装、加包装、贴标签等。这些活动并未改变原进口货物的形态、性质,结构或效用等,所以不属于加工的范围。

③加工转口贸易,指货物通关输入到中转国,红加工增值后再输往进口国的贸易方式。货物经过某种程度的加工,使加工后的货物与原来未经加工的货物在形 态、性质、结构或交用上发生某此变化,大气层以这种贸易方式不仅可以获得转口利润,还可获加工利润。加工转口贸易要求中转地有大量的劳动力,工资水平较 低,基础设施较好,并有保科仓库或保税区等,这样才能使商品加工成本低,具有国际竞争力。加工转口贸易可以对整批货物进行加工、装配等;也可以是从国处采 购某些零部件,与原有的设备配套装配成大型设备出口。

香港是典型的贸易转口港口,香港公司的转口贸易具有代表性,故以香港公司的转口贸易操作来做个简单的理解。香港是英美法系国家并且没有外汇管制!而 在英美法系国家的税务条例中,都适用“利润来源地征税法”。所以,如果您打算注册海外公司运转贸易,那就要和自己的海外客户所在国避开。注册香港有限公司 操作贸易比国内公司操作贸易具备优势的是两点:海外公司做贸易所产生的利润,可以合法免税;海外公司的帐户可以自由外汇资金流动。

案例说明:上海A公司有一批价值为70万美金的货物,准备以100万美金的价格卖给美国B公司。(对于无进出口权外贸企业,依然是委托外贸公司代理出口,流程不变,但是大大保密了自己的海外客户信息,详细操作可看之前信用证的解释)

※一般贸易出口运作
上海A公司<========>美国B客户
                100万
                               注:合同:========>
                                                            收款:<==========
分析: ①A公司盈利:100万–70万=30万,按照中国的税制进行完税。
      ②100万美金全部打到国内被结汇,汇率有损失。

※转口贸易出口运作(上海A公司通过一间香港离岸公司做转口)
上海A公司=================美国B客户
            \\                              //
         U$80万                          U$100万
                \\                     //
                     香港离岸公司
分析: ①A公司盈利:80万–70万=10万,按照中国的税制进行完税。
       ②C公司盈利:100万–80万=20万,根据香港税务法规定:业务不在香港本土发生,是无需向香港税务局交税的。受益20万美金留在香港公司帐户,不会被结汇且不会被打税。
       ③80万美金打到国内被结汇,汇率损失减少。

 


Friday, September 24, 2010

test

test posting

Tuesday, September 21, 2010

License in SG

www.spf.gov.sg for liquor lic

www.nea.gov.sg for food lic.

www.hsa.gov.sg for selling cig & cigar lic.

in reference to:

"www.spf.gov.sg for liquor lic www.nea.gov.sg for food lic. www.hsa.gov.sg"
- Singapore Expats Forum - View topic - Setting up a company. Need help (view on Google Sidewiki)

Wednesday, September 01, 2010

Using Top More Efficiently

http://www.linuxforums.org/articles/using-top-more-efficiently_89.html


For desktop users, monitoring resource usage is an important task. By doing this, we can locate system bottleneck, planning what to do to optimize our system, identifying memory leak and so on. The problem is, which software one should use and how to use it according to our need.

Among many monitoring tools that available, most people use "top" (a part of procps package). Top provide almost everything we need to monitor our system's resource usage within single shot. In this article, all the information are based on procps 3.2.5 running on top of Linux kernel 2.6.x

Here, we assume that procps package is already installed and run well in your Linux system. No previous experience with top is needed here, but if you had given it a try briefly, that would be an advantage.

Here are some challenges:

A. Interactive or batch mode?

By default, top is invoked using interactive mode. In this mode, top runs indefinitely and accepts keypress to redefine how top works. But, sometimes you need to post-process the top's output and this is hardly achieved using this mode. The solution? Use batch mode.

$ top -b

You will get output like below:

top - 15:22:45 up  4:19,  5 users,  load average: 0.00, 0.03, 0.00
Tasks: 60 total, 1 running, 59 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.8% us, 2.9% sy, 0.0% ni, 89.6% id, 3.3% wa, 0.4% hi, 0.0% si
Mem: 515896k total, 495572k used, 20324k free, 13936k buffers
Swap: 909676k total, 4k used, 909672k free, 377608k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 16 0 1544 476 404 S 0.0 0.1 0:01.35 init
2 root 34 19 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/0
3 root 10 -5 0 0 0 S 0.0 0.0 0:00.11 events/0

Uh, wait, it runs repeatedly, just like interactive mode does. Don't worry, limit its repetition with -n. So, if you just want single shot, type:

$ top -b -n 1

The real advantage of this mode is you can easily combine in with at or cron. Together, top can snapshot resource usage at certain time unattendedly. For example, using at, we can schedule top to run 1 minute later.

$ cat ./test.at
TERM=linux top -b -n 1 >/tmp/top-report.txt
$ at -f ./test.at now+1minutes

Careful reader might ask "why do I need to set TERM environment before invoking top when creating new at job?". The answer is, top needs this variable set but unfortunately "at" isn't retained it from the time of invocation. Simply set it like above and top will work smoothly.

B. How to monitor certain processes only?

Sometimes, we are only interested on several processes only, maybe just 4 or 5 of the whole existing processes. For example, if you want monitor process identifier (PID) 4360 and 4358, you type:

$ top -p 4360,4358
OR
$ top -p 4360 -p 4358

Seems easy, just use -p and list all the PIDs you need, each separated with comma or simply use -p multiple times coupled with the target PID.

Another possibility is just monitoring process with certain user identifier (UID). For this need, you can use -u or -U option. Assuming user "johndoe" has UID 500, you can type:

$ top -u johndoe
OR
$ top -u 500
OR
$ top -U johndoe

The conclusion is, you can either use the plain user name or the numeric UID. "-u, -U? Those two are different?" Yes. Like almost any other GNU tools, options are case sensitive. -U means top will find matching effective, real, saved and filesystem UIDs, while -u just find matching effective user id. Just for reminder, every *nix process runs using effective UID and sometimes it isn't equal with real user ID. Most likely, one is interested in effective UID as filesystem permission and operating system capability are checked against it, not real UID.

While -p is just command-line option only, both -U and -u can be used inside interactive mode. Like you guess, press 'U' or 'u' to filter the processes based on their user name. Same rule is applied, 'u' for effective UID and 'U' for real/effective/saved/filesystem user name. You will be asked to enter the user name or the numeric UID.

{mospagebreak title=Fast or slow update?}

C. Fast or slow update?

Before we answer this question, let's take a short look on how top really works. Strace is your friend here:

$ strace -o /tmp/trace.txt top -b -n 1

Use you favourite text editor and load /tmp/trace.txt. What do you think? A lot of jobs for single invocation, that is what I think and maybe you'll agree. One of the jobs top must do in every iteration is opening many files and parsing their contents, as shown by the number:

$ grep open( /tmp/hasil.txt | wc -l

Just for illustration, in my Linux system, it yields 304. Closer look reveals that top iterates inside /proc directory to gather processes information. /proc itself is pseudo filesystem, meaning it doesn't exist on real disk but is created on the fly by the Linux kernel and live on RAM. Within directory such as /proc/2097 (2097 is a PID), Linux kernel exports information about related process and this is where top gathers processes information along with resource usage.

Also try these:

$ time top -b -n 1

This will give you illustration how fast top works on single round. In my system, this yields around 0.5-0.6 seconds. Look at "real" field, not the "user" or "system" field because "real" reflects the total time top needs to work.

So, realizing this fact, it will be wise to use moderate update interval. Browsing RAM based filesystem takes time too, so be wise. As rule of thumb, 1 to 3 seconds interval is enough for most users. Use -d in command line option or press "s" inside interactive mode to set it. You can use fractional number as interval, e.g: 2.5, 4.1 and so on

When we should faster than 1 seconds?


  • You need more samples during a time. For this need, better use batch mode and redirect standart output to a file so you can analyze it better.
  • You don't mind with extra CPU load carried by top. Yes, it is small but it is still a load. If your Linux system is relatively idle, feel free to use short interval, but if not, better preserve your CPU time for more important task.
  • One way to reduce top's work is by monitoring certain PIDs only. This way, top won't need to traverse all the /proc sub-directory. How about user name filtering? It won't do any good. User name filtering brings extra work for top, thus combining it with very short interval will increase CPU load.

    Of course, whenever you need to force the update, just press Space and top will refresh the statistic right away.

    {mospagebreak title=Fields we need}

    D. Fields that we need

    By default, top starts by showing the following task's property:

    FieldDescription
    PID : Process ID
    USER :Effective User ID
    PR : Dynamic priority
    NI :Nice value, also known as base priority
    VIRT : Virtual Size of the task. This includes the size of process's executable binary, the data area and all the loaded shared libraries.
    RES : The size of RAM currently consumed by the task. Swapped out portion of the task is not included.
    SHR : Some memory areas could be shared between two or more task, this field reflects that shared areas. The example of shared area are shared library and SysV shared memory.
    S : Task status
    %CPU : The percentage of CPU time dedicated to run the task since the last top's screen update.
    %MEM : The percentage of RAM currently consumed by the task.
    TIME+ : The total CPU time the task has been used since it started. "+" sign means it is displayed with hundreth of a second granularity. By default, TIME/TIME+ doesn't account the CPU time used by the task's dead children.
    COMMAND : Showing program names.

    But, there are more. Here, I will just explain fields that might interest you:

    FieldDescription
    nFLT (key 'u')

    Number of major page fault since the process is started. Technically, page fault happens when the task access a non existant page in its address space. A page fault is said as "major" if kernel needs to access the disk to make the page available. On the contrary, soft minor page fault means the kernel only need to allocate pages in RAM without reading anything from disk.

    For illustration, consider the size of program ABC is 8 kB and assume the page size is 4 kB. When the program is fully loaded to RAM, there will be 2 times major page fault (2 * 4 kB). The program itself allocates another 8 kB for temporary data storage in RAM. Thus, there will be 2 minor page fault.

    A high number of nFLT could mean:

    1. The task is aggressively load some portions of its executable or library from the disk.
    2. The task is accessing a page that is swapped ou

    It is normal if you see a high number of major page fault when a program is run for first time. On the next invocations, buffer is utilized so likely you will see "0" or low number of nFLT. But, if a program is continously triggerring major page fault, big chance your program needs larger RAM size than currently installed.

    nDRT (key 'v')

    The number of dirty pages since they are written back to the disk.

    Maybe you wonder, what is dirty page? First, a little bac ground. As you know, Linux employ caching mechanism, so everything that is read from disk is also cached in RAM. The advantage of this action is, subsequent read to the same disk block can be served from RAM thus reading completes faster.

    But it also costs something. If the buffer's content is modified, it needs to be synchronized. Thus, sooner or la this modified buffer (dirty page) must be written back. The failure on the synchronization might cause data inconsistency on related disk.

    On mostly idle to fairly loaded system, nDRT is usually below 10 (this is just a raw prediction)or mostly zero. If it is constantly bigger than that:

    1. The task is aggresively write something to file(s). It is so often that disk I/O can't keep up with it
    2. The disk suffers I/O congestion, thus even the task only modifies small portion of file(s), it must wait a bit longer to be synchronized. Congestion happens when many processes access the disk at a time but cache hit is low.

    These days, (1) unlikely happens because I/O speed is getting faster and less CPU demanding (thanks to DMA). So (2) has bigger probability.

    Note: On 2.6.x, this field is always zero without unknown reason.

    P (key 'j')

    Last used CPU. This field only has meaning in SMP environment. SMP here refers to Hyperthread, multi core or true multi processor. If you just have one processor (non multi core, not HT), this field will always show '0'.

    In SMP system, don't be surprised if this field change sometimes. That means, the Linux kernel tries to move your task to the other CPU which is considered less loaded.

    CODE (key 'r') and DATA (key 's')

    CODE simply reflects the size of your application code, while DATA reflects the size of data segment (stack, heap, variables but not shared libraries). Both are measured in kilobyte.

    DATA is useful to show how much your application allocates memory. Sometimes, it can also reveal memory leaks. Of course, you need better tool such as valgrind to differentiate between repetitive memory allocation or growing memory leaks if DATA continously climbs up.

    Note: DATA, CODE, SHR, SWAP, VIRT, RES are all measured in page size (4KB in Intel architecture). Read only data section is also calculated as CODE size, thus sometimes it is larger than the actual text (executable) segment.

    SWAP (key 'p')

    The size of swapped out portion of a task's virtual memory image. This field is sometimes confusing, here is why:

    Logically, you would expect this field really shows whether your program is partially swapped out and how much. But the reality shows otherwise. Even the "Swap used" field shows 0, you will be surprised that SWAP field of each tasks show greater than zero number. So, what's wrong?

    This comes from the fact that top use this formula:

                    VIRT = SWAP + RES or equal
    SWAP = VIRT - RES

    As explained previously, VIRT includes anything inside task's address space, no matter it is in RAM, swapped out or still not loaded from disk. While RES represents total RAM consumed by this task. So, SWAP here means it represents the total amount of data being swapped out OR still not loaded from disk. Don't be fooled by the name, it doesn't just represent the swapped out data.

    To display the above fields, press 'f' inside the interactive mode. Then press the related key (mentioned above inside the parentheses). Those keys toggle the related fields, so press once to show it, press again to hide it. To find out whether the fields are displayed or not, simply watch the series of letters on the first line (at the right of "Current Fields"). Uppercase means the fields is shown, lower case means the opposite. Press Enter after you are satisfied with the selection.

    Sorting use similar way. Press 'O' (upper case) followed by a key representing the field. Don't worry if you don't remember the key map, top will show it. The new sort key will be marked with asterisk and the letter will change to upper case, so you can notice it easily. Press Enter after you are finished

    {mospagebreak title=Multi view are better than one?}

    E. Multi view are better than one?

    In different situations, sometimes we want to monitor different system property. For example, at one time you want to monitor %CPU and cpu time spent by all tasks. At another time, you want to monitor resident size and total page faults of all tasks. Rapidly press 'f' and change the visible fields? I don't think this is a smart choice.

    Why don't you use Multiple Windows mode? Press 'A' (upper case) to switch to multi windows view. By default, you will see 4 different set of field groups. Each field groups has a default label/name:

    • 1st field group: Def
    • 2nd field group: Job
    • 3rd field group: Mem
    • 4th field group: Usr

    1st field group is the usual group you see in single window view, while the rest are hidden. Inside multi window mode, press 'a' or 'w' to cycle through all the available windows. Pay attention, switching to another window also change the active window (also known as current window). If you are not sure which one is currently the active one, just look at the first line of top's display (at the left of current time field). Another way to change active window is by pressing 'G' followed by windows number (1 to 4).

    Active window is the one which react to user input, so make sure to select your preferred window first before doing anything. After that, you can do anything exactly like you do in single window mode. Usually, what you want to do here is customizing field display, so just press 'f' and start customizing.

    If you think 4 is too much, just switch to a field group and press '-' to hide it. Please note, even you hide current field group, that doesn't mean you also change the active group. Press '-' once again to make current group visible.

    If you are done with multi window mode, press 'A' again. That also make active group as the new field group of single window mode.

    F. "How come there is only so few free memory on my Linux PC?"

    Come to same question? No matter how much you put RAM in your motherboard, you quickly notice the free RAM is reduced so fast. Free RAM miscalculation? No!

    Before answering this, first check the memory summary located on the upper side of top's display (you may need to press 'm' to unhide it). There, you will find two fields: buffers and cached. "Buffers" represent how much portion of RAM is dedicated to cache disk block. "Cached" is similar like "Buffers", only this time it caches pages from file reading. For thorough understanding of those terms, refer to Linux kernel book like Linux Kernel Development by Robert M. Love.

    It is enough to understand that both "buffers" and "Cached" repre- sent the size of system cache. They dynamically grow or shrink as requested by internal Linux kernel mechanism.

    Besides consumed by cache, the RAM itself is also occupied by application data and code. So, to conclude, free RAM size here means RAM area that isn't occupied by cache nor application data/code. Generally, you can consider cache area as another "free" RAM since it will be shrunk gradually if the application demands more memory.

    On the task point of view, you might wonder which field truly represent memory consumption. VIRT field? certainly not! Recall that this field represent everything inside task address space, including the related shared libraries. After reading top source code and proc.txt (inside Documentation/filesystem folder of kernel source's tree), I conclude that RSS field is the best field describing task's memory consumption. I said "best" because you should consider it as approximation and isn't 100% accurate on all time.

    G. Working with many saved configurations

    Wanna keep several different configuration of top so you can easily switch between preconfigured display? Just create symbolic link to the top binary (name it anything you like:

    # ln -s /usr/bin/top /usr/bin/top-a

    Then run the new "top-a". Do the tweak and press 'W' to save the configuration. It will be saved under ~/.top-arc (the format is your top alias name+'rc').

    Now run the original top to load your first display alternative, top-a for the second one and so on.

    {mospagebreak title=Conclusion}

    H. Conclusion

    There are numerous tricks to use top more efficiently. The key is by knowing what you really need and possibly a little good understanding of Linux low level mechanism. The statistics isn't always correct, but at least it is helpful as a overall measurement. All these numbers are gathered from /proc, so make sure it is mounted first!

    Reference:

    • Understanding The Linux Kernel, 2nd edition.
    • Documentation/filesystems/proc.txt inside kernel source tree.
    • Linux kernel source.


    --
    Demo:         http://groupon.gmimi.com
    Dev Blog:    http://blog.gmimi.com
    Gtalk/MSN:  micdim@gmail.com