## Monday, November 26, 2007

### copy folders in sftp

[from http://www.cae.wisc.edu/site/public/?title=linux-sftp]
Recursive Copy

If you try to copy a folder using the get or mget commands, sftp will complain that it "Cannot download non-regular file: filename". This is because the basic sftp client doesn't allow for a recursive copy. However, the program scp will allow you to do this. The scp command will not allow you to see what's on the sftp server, so the files need to be located using the sftp client.

Note: the scp command is a Unix command, and needs to be run from the Unix prompt. NOT within the SFTP client.

Usage: scp user@host:remote-path local-path

scp is like the Unix command cp and should work similarly. To copy a file from your Unix home directory and put it in the working directory, use the following command:

scp @sftp.cae.wisc.edu:~/ ./

Where is your CAE username, and is the file you wish to copy. Enter your password when scp asks for it. scp works just like a get command in sftp.

To recursively copy files or directories from your CAE account, use the -r switch.

For example, to copy the entire directory "tutorial" from my CAE Unix home directory to the home directory on your machine, the following command would be used:

ComputerName:~ # scp -r username@sftp.cae.wisc.edu:~/tutorial ~/

## Sunday, November 25, 2007

Use the following command:
wget -r -p -np -k {url}
where
-r means recursive
-p means page requisites
-np means no parent
-k means convert.

man wget to get the details

## Monday, November 12, 2007

### Rotating in LaTeX

\usepackage{rotating}
you can use three new environments:
1. \begin{sideways}
it will rotate the whole argument by 90 degrees counterclockwise. Moreover:
2. \begin{turn}{30}
it will turn the argument of 30 degrees. You can give any angle as an argument, whether it is positive or negative. It will leave the necessary space to avoid any overlapping of text.
3. \begin{rotate}{30}
like turn, but it will not add any extra space.

## Thursday, November 8, 2007

### Mutual Inductance in PSpice Schematics

Using pure Spice programming instead of PSpice schematics could easily puts an mutual inductance "K" between two inductors "L1" and "L2"by typing:
"K L1 L2 0.02"
where 0.02 is the coupling coefficient.
However, for no reason I decided to use PSpice schematics to analyze the crosstalk of several inductors, as illustrated in the figure below:

It is indeed easy to find out the part for mutual inductance in PSpice is "K_linear". However, when it came to specify "L1" and "L2", I became confused. After half an hour's searching on the internet, finally I got the answer from MIT open courseware.

Now let's do it step by step:
1.Double click the one of the K_linear element (it is suggested to click on the squared K)to open the property editor, as show in the following figure(In this example, I double clicked K2)

2.Now look at the columns with "L1" "L2" "L3" "L4" "L5" "L6" as headers, among which column header "L1" is for the primary inductor, the rest 5 columns are for secondary inductors. In this example, only the first two columns are needed for each "K_linear". As we can see from the last figure, the mutual inductors for "K2" is "L3" and "L4", thus what we need is to input "L3" under the first column, that is, the column of L1; input "L4" under the second column, that is , the column of L2.
3.Complete configuring the other K_linear using the principles above.

After all these efforts, I suddenly realized that I had never read any book about PSpice. From college what I had done was all based on the instruction sheet given by my teachers, which means my knowledge base for PSpice is far from enough. In fact, it can't even be called "Knowledge base", they are "Knowledge pieces". Next I need to seriously read one book.

At last, MIT open course ware is really great. Take use of it!!!

## Sunday, November 4, 2007

1st Choice:

Use "curl"
for example:

curl -O http://www.jcedu.org/2/jq/dcd/mp3/[01-30].mp3

pay attention to the option "O" ,which means remote names. It will write output to local files with the same name as the remote files we get. Otherwise all data will be printed in the terminal, which means we will get nothing.

2nd Choice

Use "wget" by shell scripting
for example:

to get the same files as above, edit a script like this:

#!/bin/sh
for ((i=1;i<10;i++))
do wget http://www.jcedu.org/2/jq/dcd/mp3/0"$i".mp3 done for ((i=10;i<31;i++)) do wget http://www.jcedu.org/2/jq/dcd/mp3/"$i".mp3
done
exit 0