Charlie 想戒毒,于是将毒品交给了Locke。


Did you hear
what I said? I want my drugs back. I need ‘em.

Yet you gave
them to me. Hmm.

And I bloody
well regret it. I’m sick, man. Can’t you see that?

I think you’re a
lot stronger than you know, Charlie. And I’m going to prove it to
you. I’ll let you ask me for your drugs three times. The third
time, I’m going to give them to you. Now, just so we’re clear,
this is one.

Why? Why? Why
are you doing this? To torture me? Just get rid of them and have
done with it?

If I did that
you wouldn’t have a choice, Charlie. And having choices, making
decisions based on more than instinct, is the only thing that
separates you from him [indicating the boar].


Then why aren’t
you with them? You didn’t come here to tell me about Jack, did

CHARLIE [looking
like he going to cry]:
I want my stash, Locke. I
can’t stand feeling like this.

Come here. I’m
going to show you something. [They walk to a plant with a cocoon
on it]. What do you supposed is in that cocoon, Charlie?

I don’t know, a
butterfly, I guess?

No, it’s much
more beautiful than that. That’s a moth cocoon. It’s ironic,
butterflies get all the attention; but moths — they spin silk,
they’re stronger, they’re faster.

wonderful, but. . .

You see this
little hole? This moth’s just about to emerge. It’s in there
right now, struggling. It’s digging it’s way through the thick
hide of the cocoon. Now, I could help it, take my knife, gently
widen the opening, and the moth would be free. But it would be
too weak to survive. The struggle is nature’s way of
strengthening it. Now this is the second time you’ve asked me for
your drugs back [he holds the heroin up]. Ask me again and it’s


Give them to me.

This is the
third time. Are you sure you really want them?

I’ve made my

[Locke hands the
drugs to Charlie.
Charlie looks at them and
throws them in the fire. Locke smiles.]

I’m proud of
you, Charlie. Always knew you could do it.





开放,使广大用户可以修改定制自己想要的东西,满足自我价值实现的同时,希望分享自己的劳动成果,主动做了传播者的角色。某某软件不错,是吗?推荐你用一下,但是,该软件based on WinXP。WinXP没怎么做广告,因为所有基于它开发的软件都在给他作广告。





看了几集“Desperate Housewives”,经常听到一个词叫“Dirty Laundry”,根据上下文理解,含义应该是那种每个人不可告人的小秘密吧。

[noun] personal matters that could be embarrassing if made public.


Template Method,模板方法,听名字已经有那么点意思了。





看到一篇较为古老的“文章”, 于是自己写代码实现了一下,发现果然有很大的差别。


            // Read One
            while ((isStream.read()) != -1) readLen++;
            // Read Buffer

            while ((readOnce = isStream.read(buffer, 0, buffer.length)) != -1)
            { readLen+=readOnce; }




Read Buffer



    ReadOne: 125     94     188
    ReadBuf: 31     31     15

    ReadOne: 6102     6135     6192
    ReadBuf: 18     17     18


 * HelloMidlet.java

package hello;

import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.InputStream;

 * @author Vince
public class HelloMidlet extends MIDlet implements javax.microedition.lcdui.CommandListener {
    String fileStringName="/test.bin";
    /** Creates a new instance of HelloMidlet */
    public HelloMidlet() {
    private javax.microedition.lcdui.Form helloForm;                    
    private javax.microedition.lcdui.Command exitCommand;
    private javax.microedition.lcdui.Command readOneCommand;
    private javax.microedition.lcdui.Command readBufCommand;
    private javax.microedition.lcdui.StringItem stringItem1;
    private javax.microedition.lcdui.StringItem stringItem2;                  
    /** This method initializes UI of the application.                     
    private void initialize() {
    /** Called by the system to indicate that a command has been invoked on a particular displayable.                     
     * @param command the Command that ws invoked
     * @param displayable the Displayable on which the command was invoked
    public void commandAction(javax.microedition.lcdui.Command command, javax.microedition.lcdui.Displayable displayable) {                   
    // Insert global pre-action code here

    if (displayable == helloForm) {                    
        if (command == exitCommand) {                  
        // Insert pre-action code here
        // Insert post-action code here
        } else if (command == readOneCommand) {                    
        // Insert pre-action code here
        try {
            InputStream isStream = getClass().getResourceAsStream("/hello/test.bin");
            long preTime = System.currentTimeMillis();
            int readLen = 0;
            while ((isStream.read()) != -1) readLen++;
            long postTime = System.currentTimeMillis();
            isStream = null;
            get_stringItem2().setText("get"+readLen+"; elapse:" + (postTime – preTime));
        catch (Exception e) {
            helloForm.append(new StringItem("Exception", e.getMessage()));
        // Do nothing                      
        // Insert post-action code here
        } else if (command == readBufCommand) {                    
        // Insert pre-action code here
        byte[] buffer = new byte[4096];
        try {
            InputStream isStream = getClass().getResourceAsStream("/hello/test.bin");
            long preTime = System.currentTimeMillis();
            int readLen = 0;
            int readOnce = 0;
            while ((readOnce = isStream.read(buffer, 0, buffer.length)) != -1)
            long postTime = System.currentTimeMillis();
            isStream = null;
            get_stringItem2().setText("get"+readLen+"; elapse:" + (postTime – preTime));
        catch (Exception e) {
            helloForm.append(new StringItem("Exception", e.getMessage()));
        // Do nothing                       
        // Insert post-action code here
        buffer = null;
    // Insert global post-action code here
     * This method should return an instance of the display.
    public javax.microedition.lcdui.Display getDisplay () {                        
    return javax.microedition.lcdui.Display.getDisplay(this);
     * This method should exit the midlet.
    public void exitMIDlet () {                        
    /** This method returns instance for helloForm component and should be called instead of accessing helloForm field directly.                       
     * @return Instance for helloForm component
    public javax.microedition.lcdui.Form get_helloForm() {
    if (helloForm == null) {                     
        // Insert pre-init code here
        helloForm = new javax.microedition.lcdui.Form(null, new javax.microedition.lcdui.Item[] {                      
        // Insert post-init code here
    return helloForm;
    /** This method returns instance for exitCommand component and should be called instead of accessing exitCommand field directly.                       
     * @return Instance for exitCommand component
    public javax.microedition.lcdui.Command get_exitCommand() {
    if (exitCommand == null) {                     
        // Insert pre-init code here
        exitCommand = new javax.microedition.lcdui.Command("Exit", javax.microedition.lcdui.Command.EXIT, 1);                     
        // Insert post-init code here
    return exitCommand;

    /** This method returns instance for readOneCommand component and should be called instead of accessing readOneCommand field directly.                       
     * @return Instance for readOneCommand component
    public javax.microedition.lcdui.Command get_readOneCommand() {
    if (readOneCommand == null) {                     
        // Insert pre-init code here
        readOneCommand = new javax.microedition.lcdui.Command("ReadOne", javax.microedition.lcdui.Command.ITEM, 1);                     
        // Insert post-init code here
    return readOneCommand;
    /** This method returns instance for readBufCommand component and should be called instead of accessing readBufCommand field directly.                        
     * @return Instance for readBufCommand component
    public javax.microedition.lcdui.Command get_readBufCommand() {
    if (readBufCommand == null) {                      
        // Insert pre-init code here
        readBufCommand = new javax.microedition.lcdui.Command("ReadBuf", javax.microedition.lcdui.Command.ITEM, 2);                      
        // Insert post-init code here
    return readBufCommand;

    /** This method returns instance for stringItem1 component and should be called instead of accessing stringItem1 field directly.                        
     * @return Instance for stringItem1 component
    public javax.microedition.lcdui.StringItem get_stringItem1() {
    if (stringItem1 == null) {                      
        // Insert pre-init code here
        stringItem1 = new javax.microedition.lcdui.StringItem("Welcome", "Choose \"ReadOne\" menu item or \"ReadBuf\" menu item to see the time spending of reading stream(100,000 bytes)");                      
        // Insert post-init code here
    return stringItem1;

    /** This method returns instance for stringItem2 component and should be called instead of accessing stringItem2 field directly.                        
     * @return Instance for stringItem2 component
    public javax.microedition.lcdui.StringItem get_stringItem2() {
    if (stringItem2 == null) {                      
        // Insert pre-init code here
        stringItem2 = new javax.microedition.lcdui.StringItem("Microsecond", "0");                      
        // Insert post-init code here
    return stringItem2;
    public void startApp() {
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {











1.     Explain the difference between a hot backup and a cold backup and the benefits associated with each.

A hot backup is basically taking a backup of the database while it is
still up and running and it must be in archive log mode. A cold backup
is taking a backup of the database while it is shut down and does not
require being in archive log mode. The benefit of taking a hot backup
is that the database is still available for use while the backup is
occurring and you can recover the database to any point in time. The
benefit of taking a cold backup is that it is typically easier to
administer the backup and recovery process. In addition, since you are
taking cold backups the database does not require being in archive log
mode and thus there will be a slight performance gain as the database
is not cutting archive logs to disk.

2.     You have just had to restore from backup and do not have any
control files. How would you go about bringing up this database?

I would create a text based backup control file, stipulating where on
disk all the data files where and then issue the recover command with
the using backup control file clause.

3.     How do you switch from an init.ora file to a spfile?

Issue the create spfile from pfile command.

4.     Explain the difference between a data block, an extent and a segment.

A data block is the smallest unit of logical storage for a database
object. As objects grow they take chunks of additional storage that are
composed of contiguous data blocks. These groupings of contiguous data
blocks are called extents. All the extents that an object takes when
grouped together are considered the segment of the database object.

5.     Give two examples of how you might determine the structure of the table DEPT.

Use the describe command or use the dbms_metadata.get_ddl package.

6.     Where would you look for errors from the database engine?

In the alert log.

7.     Compare and contrast TRUNCATE and DELETE for a table.

Both the truncate and delete command have the desired outcome of
getting rid of all the rows in a table. The difference between the two
is that the truncate command is a DDL operation and just moves the high
water mark and produces a now rollback. The delete command, on the
other hand, is a DML operation, which will produce a rollback and thus
take longer to complete.

8.     Give the reasoning behind using an index.

Faster access to data blocks in a table.

9.     Give the two types of tables involved in producing a star schema and the type of data they hold.

Fact tables and dimension tables. A fact table contains measurements
while dimension tables will contain data that will help describe the
fact tables.

10. . What type of index should you use on a fact table?

A Bitmap index.

11. Give two examples of referential integrity constraints.

A primary key and a foreign key.

12. A table is classified as a parent table and you want to drop and
re-create it. How would you do this without affecting the children

Disable the foreign key constraint to the parent, drop the table, re-create the table, enable the foreign key constraint.

13. Explain the difference between ARCHIVELOG mode and NOARCHIVELOG mode and the benefits and disadvantages to each.

ARCHIVELOG mode is a mode that you can put the database in for creating
a backup of all transactions that have occurred in the database so that
you can recover to any point in time. NOARCHIVELOG mode is basically
the absence of ARCHIVELOG mode and has the disadvantage of not being
able to recover to any point in time. NOARCHIVELOG mode does have the
advantage of not having to write transactions to an archive log and
thus increases the performance of the database slightly.

14. What command would you use to create a backup control file?

Alter database backup control file to trace.

15. Give the stages of instance startup to a usable state where normal users may access it.

STARTUP NOMOUNT – Instance startup

STARTUP MOUNT – The database is mounted

STARTUP OPEN – The database is opened

16. What column differentiates the V$ views to the GV$ views and how?

The INST_ID column which indicates the instance in a RAC environment the information came from.

17. How would you go about generating an EXPLAIN plan?

Create a plan table with utlxplan.sql.

Use the explain plan set statement_id = ‘tst1′ into plan_table for a SQL statement

Look at the explain plan with utlxplp.sql or utlxpls.sql

18. How would you go about increasing the buffer cache hit ratio?

Use the buffer cache advisory over a given workload and then query the
v$db_cache_advice table. If a change was necessary then I would use the
alter system set db_cache_size command.

19. Explain an ORA-01555

You get this error when you get a snapshot too old within rollback. It
can usually be solved by increasing the undo retention or increasing
the size of rollbacks. You should also look at the logic involved in
the application getting the error message.

20. Explain the difference between $ORACLE_HOME and $ORACLE_BASE.

ORACLE_BASE is the root directory for oracle. ORACLE_HOME located beneath ORACLE_BASE is where the oracle products reside.

21.  How would you determine the time zone under which a database was operating?

select DBTIMEZONE from dual;

22.  Explain the use of setting GLOBAL_NAMES equal to TRUE.

Setting GLOBAL_NAMES dictates how you might connect to a database. This
variable is either TRUE or FALSE and if it is set to TRUE it enforces
database links to have the same name as the remote database to which
they are linking.

23.  What command would you use to encrypt a PL/SQL application?


24.  Explain the difference between a FUNCTION, PROCEDURE and PACKAGE.

A function and procedure are the same in that they are intended to be a
collection of PL/SQL code that carries a single task. While a procedure
does not have to return any values to the calling application, a
function will return a single value. A package on the other hand is a
collection of functions and procedures that are grouped together based
on their commonality to a business function or application.

25.  Explain the use of table functions.

Table functions are designed to return a set of rows through PL/SQL
logic but are intended to be used as a normal table or view in a SQL
statement. They are also used to pipeline information in an ETL process.

26.  Name three advisory statistics you can collect.

Buffer Cache Advice, Segment Level Statistics, & Timed Statistics

27.  Where in the Oracle directory tree structure are audit traces placed?

In unix $ORACLE_HOME/rdbms/audit, in Windows the event viewer

28.  Explain materialized views and how they are used.

Materialized views are objects that are reduced sets of information
that have been summarized, grouped, or aggregated from base tables.
They are typically used in data warehouse or decision support systems.

29.  When a user process fails, what background process cleans up after it?


30.  What background process refreshes materialized views?

The Job Queue Processes.

31.  How would you determine what sessions are connected and what resources they are waiting for?


32.  Describe what redo logs are.

Redo logs are logical and physical structures that are designed to hold
all the changes made to a database and are intended to aid in the
recovery of a database.

33.  How would you force a log switch?


34.  Give two methods you could use to determine what DDL changes have been made.

You could use Logminer or Streams

35.  What does coalescing a tablespace do?

Coalescing is only valid for dictionary-managed tablespaces and
de-fragments space by combining neighboring free extents into large
single extents.

36.  What is the difference between a TEMPORARY tablespace and a PERMANENT tablespace?

A temporary tablespace is used for temporary objects such as sort
structures while permanent tablespaces are used to store those objects
meant to be used as the true objects of the database.

37.  Name a tablespace automatically created when you create a database.

The SYSTEM tablespace.

38.  When creating a user, what permissions must you grant to allow them to connect to the database?

Grant the CONNECT to the user.

39.  How do you add a data file to a tablespace?

ALTER TABLESPACE <tablespace_name>; ADD DATAFILE <datafile_name>; SIZE <size>;

40.  How do you resize a data file?

ALTER DATABASE DATAFILE <datafile_name>; RESIZE <new_size>;;

41.  What view would you use to look at the size of a data file?


42.  What view would you use to determine free space in a tablespace?


43.  How would you determine who has added a row to a table?

Turn on fine grain auditing for the table.

44.  How can you rebuild an index?

ALTER INDEX <index_name>; REBUILD;

45.  Explain what partitioning is and what its benefit is.

Partitioning is a method of taking large tables and indexes and splitting them into smaller, more manageable pieces.

46.  You have just compiled a PL/SQL package but got errors, how would you view the errors?


47.  How can you gather statistics on a table?

The ANALYZE command.

48.  How can you enable a trace for a session?



49.  What is the difference between the SQL*Loader and IMPORT utilities?

These two Oracle utilities are used for loading data into the database.
The difference is that the import utility relies on the data being
produced by another Oracle utility EXPORT while the SQL*Loader utility
allows data to be loaded that has been produced by other utilities from
different data sources just so long as it conforms to ASCII formatted
or delimited files.

50.  Name two files used for network connection to a database.


Technical – UNIX

Every DBA should know something about the operating system that the
database will be running on. The questions here are related to UNIX but
you should equally be able to answer questions related to common
Windows environments.

1.  How do you list the files in an UNIX directory while also showing hidden files?

ls -ltra

2.  How do you execute a UNIX command in the background?

Use the "&"

3.  What UNIX command will control the default file permissions when files are created?


4.  Explain the read, write, and execute permissions on a UNIX directory.

Read allows you to see and list the directory contents.

Write allows you to create, edit and delete files and subdirectories in the directory.

Execute gives you the previous read/write permissions plus allows you
to change into the directory and execute programs or shells from the

5.  the difference between a soft link and a hard link?

A symbolic (soft) linked file and the targeted file can be located on
the same or different file system while for a hard link they must be
located on the same file system.

6.  Give the command to display space usage on the UNIX file system.

df -lk

7.  Explain iostat, vmstat and netstat.

Iostat reports on terminal, disk and tape I/O activity.

Vmstat reports on virtual memory statistics for processes, disk, tape and CPU activity.

Netstat reports on the contents of network data structures.

8.  How would you change all occurrences of a value using VI?

Use :%s/<old>;/<new>;/g

9.  Give two UNIX kernel parameters that effect an Oracle install


10.  Briefly, how do you install Oracle software on UNIX.

Basically, set up disks, kernel parameters, and run orainst.



你想再用几个月尝试一下Ajax, HttpXmlRequest, DWR?你的Web App正使用的是Spring的框架?恩,你来对地方了。



虽然DWR自己也提供了一些对于Spring的支持,但是却无法做到无缝整合。例如,它需要你在Web.xml中配置一个独立的Servlet,却无法让它访问Web App Context中的Beans。

首先,我们来配置一个Spring MVC Controller,称之DWRServlet,用它取代上面所说的那个独立的Servlet。还好,Spring已经提供了一个现成的,叫ServletWrappingController。将下列代码加到你的dispacher app context,DWR就会成为一个标准的Spring Controller。

<bean id="dwrController" class= "org.springframework.web.servlet.mvc.ServletWrappingController">

  <property name="servletClass">



  <property name="initParameters">


      <prop key="debug">true</prop>





添加一条Url Mapping以确保所有的请求都首先交由这个DWRServlet处理。注意,这个Mapping应该处于最后,以确保能处理到所有的请求。

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">

  <property name="mappings">


      <prop key="/**/*.html">defaultController</prop>

      <prop key="/**/*">dwrController</prop>




另外,还要确定所有的后缀请求(包括没有后缀)都交给Spring的dispatcher处理了。所以,除了Mapping JSP和HTML以外,还要像下例一样Mapping所有的后缀。下例假设已经定义了名为“main”的Spring DispacherServlet。





虽然可以通过初始参数改变,但DWRServlet假设配置文件为/WEB-INF/dwr.xml。下面是一个示例配置文件,文件中使用了假设在App Context中已经存在的一个id为productManager的Bean。

<?xml version="1.0" encoding="ISO-8859-1"?>


  "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"












      <param name="beanName" value="productManager"/>




注意,现在默认情况下包含了一个Spring creator。这个Creator将处于App Context中的productManager Bean暴露(指在JS中可以调用)了出来。可以用此法创建一个新的Bean,或者找到一个已经存在的Bean。



该做的都差不多了,让我们试试看访问这个Product Manager。假设这个Bean有一个getAllProducts()的方法,并以List方式组织所有已知的Product(JavaBean)将它作为返回。首先需要在我们的页面中包括两个Javascript文件。

<script type='text/javascript' src='/dwrPath/interface/productManager.js’></script>

<script type=’text/javascript’ src=’/dwrPath/engine.js’></script>

上面的dwrPath就是之前提到的已经被映射了的dwrcontroller。现在,唯一要做的就是调用Product Manager的方法了。假设我们需要一个按钮来触发获取信息的过程,并用span来取得所有的返回值。

<input type="button" onclick="productManager.getAllProducts(productCallback);" value="Get all products"/>

<script type="text/javascript">

  var productCallback = function(products) {

    var text = 'Products: <br><ul>';

    for(i = 0; i < products.length; i++) {

      text += '<li>';

      text += products[i].name;


      text += ' (';

      price= products[i].price;

      text += price.currency;

      text += ' ';

      text += price.value;

      text += ')';

      text += '</li>';


    document.getElementById('productlist').innerHTML = text;



<span id="productlist">

注意嵌套的属性如price.currency和price.value。仅当Product和Price位于Bean Convertor所指定的路径(本例为your.package)下的时候,才能被正确解析。

DWR 提供了内置的调试功能。由于在初始参数中将debug置为true,我们可以使用这些内置的调试功能。使用浏览器访问/dwrPath,你会发现一个列表,列出了所有通过DWR暴露的Beans。通过他们的链接,还可以得到每个Bean暴露的方法列表。它还提供了调用这些方法调试例子,以方便使用和调试。


我希望这个简单的教程让你了解了如何集成Spring和DWR,并让你更容易的创建一个基于Ajax技术的Web App。  我现在还在看一些如何使用Spring+DWR进行实时的表单校验等。所以,经常逛逛本Blog以保持你跟上进度了哦!



至此, “$”从当前的HTML文档中找到指定id的元素,所有非字符串的参数,将会返回原值,另外,本$函数对Prototype中的函数中的函数作了部分改进,可能会适应更多浏览器。