To selecting device simulation model in Cadence Spectre for Cadence Affirma, here is how.

## Picking values from a point in Mayavi2

by Forrest Sheng Bao http://fsbao.net

Sometimes we have scientific data, each point of which has multiple values associated with. If the data is visualized, we want to pick up values at certain points. I have been needing this features for too long. And today someone gave me some hints to figured it out.

Step 1 (optional): prepare your VTK file. Make sure you have POINT_DATA and/or CELL_DATA segment(s). Do NOT create multiple POINT_DATA n and/or CELL_DATA n lines in one file - VTK format is linear.

Step 2: Start Mayavi2 GUI application and load the VTK file. There are two ways to do so.

I am always lazy. So I run command like the one below from UNIX/Linux Shell.

## 1-minute Git tutorial/cheatsheet

by Forrest Sheng Bao http://fsbao.net

I assume that you have already had a Git repository somewhere, like Git hub.

Get a clone:

git clone git@github.com:ACCOUNT/REPOSITORY.git

Update changes:

git add FILE
git commit -m 'this is a change...'
git push origin master

Remove a file from repository:

git rm FILE
git commit -m 'something is removed'
git push origin master

References: http://help.github.com/

## Deleting all FreeSurfer original files in surf folder

by Forrest Sheng Bao http://fsbao.net

I need to delete, or purge, all original files in FreeSurfer's $subject/surf folder - because i only need my result files in that folder but not original ones. Here is a Shell script that i hope to help others, who also need to do the same. Please replace SUBJECT by the subject ID. I assume you have already setup $SUBJECTD_DIR environment variable. You may also replace $D by a real path. You can also embed the script below into a loop block so you can process many surf folders at once. #!/bin/sh$D=$SUBJECTS_DIR/SUBJECTID/surf echo$D
rm $D/rh.smoothwm.C.crv rm$D/ rh.smoothwm.FI.crv
rm $D/rh.smoothwm.H.crv rm$D/rh.smoothwm.K1.crv
rm $D/rh.smoothwm.K2.crv rm$D/rh.smoothwm.K.crv


## Font matters, on papers and webpages

by Forrest Sheng Bao http://fsbao.net

Kindle does not like Modern Serif fonts!

I just got a Kindle 3 from a friend. I tried to read some PDF papers on it. But the experience was horrible! It took me longer than normal to recognize letters in words. They are so blur and dim to my eyes. Since those papers are written by myself, I thought that changing font type or size may help. So I studied fonts today, to the best of my time allowance and brain power.

So a flash card about fonts

• There are 4 major types of fonts, Serif, Sans-Serif, typewritter and handwritten.

## Money, killing the fun part of a startup

“Being the richest man in the cemetery doesn’t matter to me … Going to bed at night saying we’ve done something wonderful… that’s what matters to me.” -Steve Jobs said in an interview with The Wall Street Journal, May 25, 1993

by Forrest Sheng Bao http://fsbao.net

I am interested in startups. I have a couple [of] ideas and energetic friends who may join me if I begin. But I never take any action.

The reason is very simple, a startup will soon lose its fun part when people start thinking about monetization.

## scp and rsync: two cool UNIX commands for file transferring between computers

by Forrest Sheng Bao http://fsbao.net

This is a simple tutorial for my colleagues who need to transfer files between Linux/Mac OS X boxes. I love scp and rsync. They are both very simple and there is no need to start a GUI.

### scp

scp means "SSH copy". Thus you can copy a file from a server to you computer (or even another server) via SSH. It's syntax is very simple.

scp OPTIONS SOURCE DESTINATION

For example, if I wanna copy all files under /data/MEG/MEG077 on example.com to my current computer, I will do this

scp -r  example.com:/data/MEG/MEG077/* .

The -r option means "recursive" that I need to copy everything in MEG077 hierarchically.

## Meaning of #domain declaration in answer set programming

by Forrest Sheng Bao http://fsbao.net

I just notice that a weight constraint acts oddly'' for variables declared in #domain declaration in answer set programming (ASP). My grounder and solver are lparse and smodels.

Here is a demo program:

const n=2.
step(0..n).

#domain step(S).
block(a). block(b).

#domain block(B).

1{put(X,S):block(X)}1 :- step(S), S < n . % rule 1

1{gen(B,S)}1 :- step(S), S < n .          % rule 2


I thought I should get one and only one put/2 and gen/2 literal, respectively, for each S, because the lower and upper bounds are both 1. But this is what I got:

Stable Model: put(a,0) put(a,1) gen(b,0) gen(b,1) gen(a,0) gen(a,1) step(0) step(1) step(2) block(b) block(a)