Subpages

edit
  1. /sandbox (personal sandbox)
  2. /sandbox/ex
  3. /sandbox/ex2
  4. /sandbox/ex3
  5. /sandbox/Template:NumBlk (for Special:TemplateSandbox)
  6. /Private Note
  7. /Glossary
  8. /Valuables
  9. /IRC
  10. /Blog comments
  11. /.emacs
  12. /mtbv
  13. /regtst.cpp
  14. /CheckPrintCall.cxx
edit
  1. List of XML and HTML character entity references
  2. Wikipedia:WikiProject User scripts/Scripts
  3. How to mount LVM volumes, help! (keyword="mount LVM fedora")
  4. Template:AD
  5. Ubuntu 下安装 JRE (Java Runtime Environment)
  6. Red/Black Tree Demonstration
  7. Multi Thread Programming
  8. epoll()簡單介紹(轉貼)
  9. AVL Trees vs. Red-Black Trees?
  10. Virtual memory areas (VMAs) are tracked with red-black trees, as are epoll file descriptors
  11. Epoll calls rb_set_parent(n, n) to initialize the rb-tree node
  12. reentrant,thread-safe 和 async-signal-safe
  13. Linux Interprocess Communications
  14. Comparing the aio and epoll event frameworks
  15. Linux Kernel IPC 的介紹
  16. 可重入性 线程安全 Async-Signal-Safe
  17. Bash Shell Script可以做到光棒上下移動選單的功能嗎 ?
  18. ANSI escape code
  19. Understanding the Linux Kernel
  20. (IEEE make manual) The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition manual
  21. 在Emacs裡面使用Cscope
  22. IEs4Linux
  23. 將隨身碟格式化成 NTFS
  24. [17] Exceptions and error handling
  25. Performance (Apple Developer Connection)
  26. What every programmer should know about memory
  27. Polymorphic Inline Cache
  28. Context Threading: A Flexible and Efficient Dispatch Technique for Virtual Machine Interpreters
  29. Branch prediction
  30. http://www.open-std.org/jtc1/sc22/wg...1997/N1124.pdf
  31. All about Linux signals
  32. LLVM - Low-Level Virtual Machine
  33. C++ Literal Constants
  34. mips 和 mipsel 的差異
  35. Garbage Collection
  36. Re: Problems with glibc-2.2.2 and threads (realtime signal)
  37. 搭建LLVM實驗環境(轉貼)
  38. Simple VM JIT with LLVM
  39. Communicating sequential processes (CSP) mentioned in Go language
  40. The Very Basics of Garbage Collection (see 'Myths' section)
  41. Ch interpreter (an embeddable C/C++ interpreter)
  42. JDownloader
  43. Log-Out of Google Account
  44. 在 Ubuntu 9.04 設置 Android 開發環境
  45. Java not found. Java is required for Android
  46. How to install Android SDK and play with Android 2.0 in the emulator
  47. Access Android Market from Android Emulator
  48. Dalvik spends 7.4% of its time garbage collecting => Android UI spends 7.4% of its time unresponsive
  49. Kernel : likely/unlikely macros (gcc branch prediction information `__builtin_expect()')
  50. [資料] Dalvik VM的JIT編譯器的資料堆積(dumping...work in progress)
  51. How does garbage collection work? (generational garbage collector)
  52. Using Generational Garbage Collection To Implement Cache-Conscious Data Placement
  53. gcc 預先定義的巨集 (__func__, __FUNCTION__, __PRETTY_FUNCTION__)
  54. Re: Force GCC to unroll a loop? (loop unrolling could consume instruction cache and reduce performance)

On-line Linux manual

edit
  1. Linux man
  2. POSIX:2008
  3. phpMan
  4. Ubuntu Manpage
  5. die.net
  6. About.com

Notes

edit
  • Try-catch makes the code tidy and readable, without try-catch the code becomes ugly as you need to check the result and handle exceptions after each function call. However, it is performed in run-time and have overhead each time a function is called?

Firefox

edit
  • Gmail Manager: A Gmail notifier which allows you to receive new mail notifications.

Do not feed bug

edit

Interactions

edit
  • Signals
  • File system
  • Out of memory (heap)

Timing, race conditions, program counter and execution

edit
  • Add/remove code usually changes the execution speed of the program. Which could affects the timing between different tasks, such as timeout mechanism or time restrictions in real-time systems. In the extreme case, the execution could be blocked and causes starvations/deadlocks. Add/remove code actually affects the program counter.
  • It should be helpful to prevent deadlock by checking each statement one by one in the locked area and make sure each one will not block the execution.

Power loss

edit
##  Sharing folder

##  Modify '/etc/exports', for example:
##
##      /nfstmp *(rw,sync)

sudo /etc/init.d/nfs-kernel-server restart

Emacs

edit
  • Ask community if it's a bug: Emacs seems to hang when some of SCIM are killed or closed.
;;  You can also use `M-x customize-variable <RET> x-select-enable-clipboard <RET>' to change the variable by Emacs UI.
(setq-default x-select-enable-clipboard t)

;;(defun x-clipboard-edit-key()
;;  (global-set-key [(shift delete)] 'clipboard-kill-region)
;;  (global-set-key [(control insert)] 'clipboard-kill-ring-save)
;;  (global-set-key [(shift insert)] 'x-clipboard-yank))
Emacs for MS Windows:
<S-delete> runs the command kill-region
<C-insert> runs the command kill-ring-save
<S-insert> runs the command yank

SVN tips

edit
svnadmin cteate /tmp/tstprj
mkdir /tmp/workdir
cd /tmp/workdir
svn co file:///tmp/tstprj
cd tstprj
cp /etc/fstab .
svn add fstab
svn ci --username=justin

cat << 'EOF' > /tmp/PrintPos.sh
#!/bin/bash
c=$#
i=1
while [ $i -le $c ]; do
    echo "\$$i='$1'"
    shift
    i=$(($i + 1))
done
EOF
chmod a+x /tmp/PrintPos.sh

cat << 'EOF' > /tmp/ConcurDiffWrap.sh
#!/bin/bash

##  !! There is interval between @a1@ and @a2@ such that other process would
##  interfere the execution within the interval.
NewTmpDir()
{
    local Node

    while :; do
        Node=$RANDOM
        if [ ! -e /tmp/${Node} ]; then # @a1@
            mkdir /tmp/${Node}  # @a2@
            eval "${1}=/tmp/${Node}"
            return
        fi
    done
}

NewTmpDir Dir

mv "$6" "${Dir}/Old" || echo 'Cannot move $6'
echo '' > "$6"
mv "$7" "${Dir}/New" || echo 'Cannot move $7'
echo '' > "$7"

meld "$1" "$2" "$3" "$4" "$5" "${Dir}/Old" "${Dir}/New" &

##  Print positional parameters.
##
##  Put this segment at positions where positional parameter are no longer used,
##  becasue there are `shift' in this segment.
c=$#
i=1
while [ $i -le $c ]; do
    echo "\$$i='$1'"
    shift
    i=$(($i + 1))
done

echo '==================================================================='
EOF
chmod a+x /tmp/ConcurDiffWrap.sh

svn di -r 2:3 --diff-cmd /tmp/ConcurDiffWrap.sh

minicom

edit
  • minicom in English UI
$ LANG=en_US.UTF-8 sudo minicom
  • Ctrl-A Z T and change terminal setting from VT102 to ANSI

RAM disk

edit
mkdir /tmp/ramdisk
sudo mount -t tmpfs -o size=16 tmpfs /tmp/ramdisk

sudo umount /tmp/ramdisk

Bra-ket notation

edit

Column vector & row vector

edit

"The scalar product or action is written as

 

The right part is called the ket /kɛt/; it is a vector, typically represented as a column vector, and written  

The left part is called the bra, /brɑː/; it is the Hermitian conjugate of the ket with the same label, typically represented as a row vector, and written  " - Bra–ket notation

Tensor product in bra-ket notation and vector form

edit
  and  
 
 
 
 
 
 
 
 

Quantum computer

edit
  1. "Any quantum circuit can be simulated to an arbitrary degree of accuracy using a combination of CNOT gates and single qubit rotations." - Controlled NOT gate
  2. "The first implementation scheme for a controlled-NOT quantum gate was proposed by Ignacio Cirac and Peter Zoller in 1995" - Trapped_ion_quantum_computer#History_of_trapped_ion_quantum_computing
  3. "Because the number of elements in the matrices is  , where x is the number of qubits the gates act on, it is intractable to simulate large quantum systems using classical computers." - Quantum_gate#Circuit_composition_and_entangled_states

Quantum gate - Square root of NOT gate (NOT)

edit
 .
 
 
 
 
 
 
 
 
 
 
 
 
 
 

In fact, you can use the service of online symbolic mathematics to do the above work for you. Related links:

  1. Mathics
  2. Online tools for doing symbolic mathematics - Mathematics Stack Exchange

Quantum gate - Example of operation parallelism

edit

 
 
 
 

The meaning of notation above:

For example, state   means that the first qubit is 0 and the second qubit is 1. If, for example,  , it means that state   appears with probability 0.7 after measurements.

The above map is the result of a series of quntum program executions which applying CNOT gate on the system. But you can not know the map beforehand, so how to know the value of the second qubit after applying the quantum gate operation above? Here is what you may do:

You should be able to encode the system so that each state appears with the probability according to your design. Suppose that you encode the system so that the probability distribution is
 
 
 
 
(note that  )
Suppose that you want to know the second qubit's value of state   after the quantum operation. Because the corresponding probability you have encoded is  , you should be able to find one of 4 after-operation states  ,  ,   and   appears with probability 0.2 as you repeat the quantum program over and over several times. And you will finally realize that state   appears with probability 0.2 after you repeat enough the quantum program, so it means the state transition is from   to   and therefore the second qubit's value changes from 0 to 1 after the quantum operation.

Applying a 2-qubit CNOT gate to 3 qubits

edit

 

 

 

 

Reinforcement learning

edit
  1. "If the discount factor meets or exceeds 1, the   values may diverge." - State–action–reward–state–action#Discount_factor_(gamma)

Deterministic and simplified Q functions of reinforcement learning

edit

Simplify by letting  . The result should be more close to dynamic programming.

Q-learning

 
 
 
 

SARSA

 
 
 
 

Self-pipe trick

edit
int pipefd[2];

void handler(int signum)
{
  char ch = 0;
  write(pipefd[1], &ch, sizeof(ch));
}

void startRoutine(SIMP_SOCK_Arg_T *arg)
{
  //  ...
  pipe(pipefd);
  fcntl(pipefd[0], F_SETFL, fcntl(pipefd[0], F_GETFL) | O_NONBLOCK);
  fcntl(pipefd[1], F_SETFL, fcntl(pipefd[1], F_GETFL) | O_NONBLOCK);
  signal(SIGTERM, handler);

  FD_ZERO(&rfds);
  FD_SET(arg->mSock.mSocket, &rfds);
  FD_SET(pipefd[0], &rfds);
  //  ...
  while (1)
  {
    _rfds = rfds;
    //  ...
    if (select(maxfd + 1, &_rfds, &_wfds, NULL, NULL) == -1)
    {
      if (errno == EINTR) continue;
      break;
    }

    //  ... read()/write() socket and process data ...

    //  There could be resource allocation somewhere
    void *p = malloc(...);
    //  ... do something about *p ...
    free(p);

    if (FD_ISSET(pipefd[0], &_rfds))
    {
      char ch;
      read(pipefd[0], &ch, sizeof(ch));
      break;
    }
  }
  //  ...
}

Raw Watchlist

edit
Adiabatic quantum computation
BKL singularity
BadVista
Bing
Bing (Search)
Bing (search engine)
Bing (web search engine)
Cavity quantum electrodynamics
Classical test theory
Cluster state
Coherence (physics)
Convolution
Criticism of Google
Criticism of Microsoft
Criticism of Wikipedia
Criticism of Windows 7
Device driver
Dirac delta function
Direct Rendering Manager
Euler's theorem (differential geometry)
Evolute
Fourier series
Freedesktop.org
Git (software)
Google
Google platform
Graphics Execution Manager
Guievict
Internet Explorer 8
Jordan curve theorem
Keith Packard
LOCC
Lagrange's identity
Library (computing)
List of unsolved problems in physics
Loadable kernel module
MeeGo
MeeGo (operating system)
Method of characteristics
Metric tensor
MicroXwin
Microsoft
Microsoft Office 2007
Möbius transformation
Nitrogen-vacancy center
O(1) scheduler
Office Open XML
One-way quantum computer
OpenDocument
OpenDocument software
Optical lattice
Optical pumping
Overlap-add method
Overlap–add method
Phasor
Phasor (sine waves)
Pseudo-differential operator
Pythagorean triple
Qt (framework)
Quantum channel
Quantum cryptography
Quantum error correction
Quantum gate
Quantum information
Quantum key distribution
Quantum mechanical Bell test prediction
Quantum programming
Quantum teleportation
Quasiconformal mapping
Qubit
Ratio test
Riesz transform
Selection rule
Separable state
Separable states
Squashed entanglement
Standardization of Office Open XML
Sturm-Liouville theory
Sturm–Liouville theory
Superconducting quantum computing
Topological computing
Topological quantum computer
Trapped ion quantum computer
Universal quantum simulator
Unsolved problems in physics
Wayland (display server)
Wayland (display server protocol)
Wayland display server
Windowing system
Windows 7
Windows 7/Archive 7
X Window System
Xmove
Xpra
User:HAl
User:Justin545/Blog comments
User:Justin545/Blogger
User:Justin545/IRC
User:Justin545/Private Note
User:Silly rabbit
Template:NumBlk
Template:NumBlk/doc

template:NumBlk & lists

edit
  • xyz
  • abc
  (77)
  (37)
  •   (17)
  •   (57)
  (97)
  (67)

Pages may be with issues

edit

Carbon sink