Wednesday, December 12, 2007

It Really is an LED Christmas Season

Tom Griffiths

http://www.solidstatelighting.net/lightimes/?date=2007-12-11&id=9313#top
November 29, 2007...For those around the world that celebrate Christmas or coincident holidays by stringing lights about the house and yard, it seems pretty clear that the decorative buzz is about LED lighting. The year 2007 seems to be the one where LED Christmas lights have gone from novelty to "common sense". Interestingly, they are doing so in spite of the energy payback for LED versions being something on the order of 4-10 years when a 1-2 year payback is often all the consuming public can really wrap its arms around. Frankly, if we set aside some of the local government incentives that we're seeing, I don't think it yet has a lot to do with the real payback these tiny solid state lighting alternatives are providing.

For starters, here is a quick numbers run from the resident economist. Incandescent mini-lights at 40 watts per string, running 5 hours per night, for 30 nights, adds up to an operating cost for the season of at least $.60/string (assuming a $.10/kW electricity rate... you can nearly double that in some places). Incandescent C7s that are most often used for outlining the roof of a house run more like 175 watts per string suggesting a seasonal operating cost of at least $2.50/string. One year, when we fully outlined the house in the C7s, we enjoyed better than a $200 uptick in the monthly electric bill, as well as the exciting sounds of more than one airplane making a go-around when they realized we weren't the nearby runway (at least that's my version of the story and I'm sticking to it). By contrast, the comparative LED strings will typically run at 4 watts or less, which puts them somewhere around $.06 for the season. That's close enough to free that we might as well just consider the cost of the string as the only issue. As far as the acquisition costs, $10-$15 seems to be the current "on-season rate" for something in that typical 25-foot (3-meter) length.

Since us "lighters" are used to buying a certain number of replacement incandescent strings each year, other than the 1 or 2 impulse strings, I tend to suspect most serious lighters hit the before- and after-season sales, picking the strings up for $1 to $2. Preferring simple formulas over precision, I would round that to being "nearly free" compared to the LEDs. Nearly free light strings are then head-to-head with virtually free operating costs. The $.60 to $2.50 per string "old" operating cost stacks up against a $10-$15 "new" LED purchase cost. Depending upon your choice of big or small incandescents, the payback is 4 to 20 years! (On the small incandescent string, the typical 2-3 season lifetime shortens the 20 to maybe 6 or 7 years).

While there is nothing shameful about a 4 year payback, it is just not typical of your average Wal-Mart or Home Depot holiday consumer to consider a payback period at all, much less one of that length. Lots of time, and marketing dollars have been invested on "awareness initiatives" to sway consumers to consider CFLs as replacements for Mr. Edison's original invention, and that relatively short payback has only recently begun to gain real traction in the US. So what's driving the willingness to spend $10 more for a simple light string? Two guesses are offered.

The first guess is that they are actually bright enough, believably long-lived enough and, most importantly, finally priced where they don't seem expensive (call it "cheap enough"). With the on-season price of the incandescents often around $5, a consumer can look at "the usual" few strings they'll need and reach the conclusion that "the extra $5" per string is probably worth it to start to eliminate the seasonal dead-bulb hassle. That's a bit of an impulsive conclusion if we accept that many of those consumers would really be more likely to pay the off-season price for those needed strings during any given year, but the holiday season is certainly one that is given to impulse shopping, so why not go with the flow. The 'by the way' to this guess would have the shopper adding the thought, "Oh, and I've heard they will save me a ton in electricity costs."

The second guess is that the energy saving story that accompanies LED and solid state lighting is sinking in, due almost exclusively to their presence in the more ubiquitous daily applications that work including nightlights, flashlights/torches, automotive CHMLs, tail-lights and traffic signals. The resulting impression would seem to be somewhat along the lines of, "I'm seeing those LEDs everywhere... they must really be saving some money somehow or I wouldn't keep seeing more and more of them." Add to that a strong perception of rapidly increasing energy costs of all types (for the US, the rise in gasoline prices is a strong driver for that perception), and it likely just takes a different perception path to arrive at the same "saving me a ton" conclusion.

Either way, what does it mean for the solid state lighting industry? First, it means LEDs are doing their jobs and the technology is proving itself in key applications that are causing a recognition with the majority of the the people out there. Second, the consuming public is beginning to make the logical jump that if an LED works well for lighting something up in several different types of applications, it will work well in the next application they find it in. Third, there's more of it to come. We're just at the tip of the tip of the iceberg in the start of a wider scale adoption of LED-based lighting technology. Fourth, there is still plenty of room to make things more difficult by moving too fast into applications where they might not quite be ready, such as Edison screw-based incandescent replacements. Pushing something junky into the market will erode the goodwill built up from #1 and disrupt the otherwise clear thinking that results in #2, and possibly disrupt the perceptions that is leading impulse consumerism to actually follow a desirable longer-term path. Niche-to-niche works!

Tuesday, December 11, 2007

Matlab的替代

Python + numpy + scipy + matplotlib
可以代替Matlab的部分功能,对于我来说足够了。

等过段时间,我有空了,就把以前的代码改成Python的。

Monday, October 22, 2007

INTERNATIONAL LED EVENT 2008


推荐网站
http://www.led-event.com/

通过这里可以定阅
http://www.led-event.com/subpages/newsletter.php?selected=222

Tuesday, October 09, 2007

Friday, September 14, 2007

索尼社长: 大学应调整博士的培养方针

中钵提出了产学结合的3个成功要点:(1)向大学传输"1,10,100"思想;(2)明确企业与大学的角色分担;(3)具有博士水平的理工科人才的培养及使用。

"企业希望取得硕士学位的学生能够直接投入研究开发,然而现实并非如此"(中钵)。另一方面,"由于博士生过于局限于专业,很难在企业中发挥作用,导致大 学与企业之间不合拍的发生"(中钵)。作为对策,中钵提出调整博士培养方针的重要性,"培养出即使改变其课题也能灵活对应的人才"(中钵)。

Friday, August 24, 2007

MEEP中的BUG

如果利用并行集群计算色散材料,这时,MEEP会有一个内存管理上的BUG。

On Sat, 30 Sep 2006, João Luis Silva wrote:
> I found the problem: When dispersive media is used, the memory related to
> the dispersive media is not split by the nodes, but every node has a full
> copy of the fields. In my real problem I use a Sellmeier formula for silica

Yikes, this is indeed a bug. Try the following patch:

diff -rN old-meep/src/polarization.cpp new-meep/src/polarization.cpp
29c29
< if (sc->pb == NULL) return NULL;
---
> if (sc->pb == NULL || !sc->is_mine()) return NULL;

Thursday, July 05, 2007

关于MEEP的一个小tip

MEEP中有个功能是dft-flux,
这是个很重要的函数,关于它的定义,要特别注意,只能放在run之前,定义了这个函数之后,再定义其它的东西都没有用了。
很奇怪,要和Steven沟通一下。

Monday, April 23, 2007

Firefox中的小插件Gspace

http://linuxtoy.org/archives/gspace-make-gmail-your-network-disk.html

Gmail 受到许多人的追捧,其中很大一部分原因就在于它为用户提供了海量的邮箱空间。事实上,对于普通用户而言,仅会占用其很少的容量。或许我们可以将 Gmail 变成自己的网络硬盘以便随处使用。

要实现上述设想,有一个 Firefox 扩展就可以办到,它的名字是 Gspace。这是一个充满创意,并且非常实用的 Firefox 扩展。我在试用之后很快便喜欢上了它,并成为了我以后必装的 Firefox 扩展之一。

Gspace

Gspace 可以将 Gmail 变成一个在线存贮空间,方便我们将文件、资料、音乐、图片等存入其中。除了存贮功能之外,使用 Gspace 你也能够直接播放所存贮的音乐,查看所存贮的图片。利用 Gspace,我们就可以把重要的东西存入 Gmail 空间,以做到有备无患。

安装 Gsapce

Gspace 的安装过程与其他的 Firefox 扩展并无二致,从 Gspace 的下载页面上点击适用于 Linux 系统的链接,之后按照提示即可完成安装。在安装完成后,需要重新启动 Firefox 方能开始使用。

建立 Gspace 帐户

在使用 Gspace 存贮文件之前,你需要将有效的 Gmail 帐号信息提供给 Gspace。点击"Tools -> Gspace"菜单命令可以打开 Gspace 控制窗口。然后,单击左上角的"Manage Accounts"按钮可以添加一个新的 Gspace 帐号。在建立帐号时,需要输入你的 Gmail 帐号及密码。

上传文件

如果你有使用 FTP 客户端的经历,那么在 Gsapce 中上传文件将不在话下。先选择左边的本地文件,再按中间的上传按钮即可将文件上传到 Gmail 空间中。如果是下载文件,其过程与此类似。

听音乐,看图片

这个首先要保证你的 Gmail 空间中存贮有音乐、图片这些东西。然后只需将 Gspace 的文件传输模式切换成相应的 Player Mode 和 Photo Mode 即可。另外,还有一个 Gmail Drive Mode,不过我在试用时发现存在不小的问题,要慎用。

Gspace 还有一个迷你窗口,可从状态栏中的图标处打开。

Thursday, April 19, 2007

Matlab中的reshape

若要重新安排矩阵的形状,可用reshape命令: 

B = reshape(A, 4, 2) % 4是新矩阵的列数,2是新矩阵的行数  

B = 

5 8 

9 12 

5 6 

11 5 
小提示: A(:)就是将矩阵A每一列堆叠起来,成为一个行向量,而这也是MATLAB变数的内
部储存方式。以前例而言,reshape(A, 8, 1)和A(:)同样都会产生一个8x1的矩阵。

另外移动一个数组,可以如下操作
A = [A(51:end) A(1:50)]
【 在 snakehope (格物致知) 的大作中提到: 】
: 记不起来了,
: 想把一个数组的前五十个元素放到最后面,matlab用什么命令,谢谢 


如果是移动高维数组中的一例,注意矩阵的转置。

Monday, April 16, 2007

无须翻页 直接显示Google多页搜索结果

http://www.gseeker.com/50226711/eceaccgoogleecc_88311.php

Google的搜索结果一向被认为是更准确、相关度更高的,因此理论上,我们在 Google上面搜索一个关键词,能在进行较少翻页操作的情况下,便可找到想要的结果。然而事实上并不完全如此。由于目前的搜索引擎包括Google在 内,依然没有采用足够的人工智能技术,因此当我们自己都不太清楚自己想搜索什么的时候,我们就需要进行多次翻页,一直浏览数页甚至数十页的结果,可能才能 找到我们想要的答案。比如,当你看到一个人名,你觉得有点熟但又想不起他到底是谁,而实际上他又不是名人,因此你要进行漫游式的搜索及浏览。

   在默认的情况下,Google的搜索结果页会显示10个结果,当然你也可以自行设置为更多,但那样会影响加载速度。但如果每次都要重复点击"下一页", 你可能会感到厌倦。有没有办法让Google可以在我们滚动页面时,自动在当前页加载并显示下一页的搜索结果呢?这样一来,我们既不用重复点击"下一页 ",也不怕浏览体验受影响。

  答案是肯定的,因为在日本有人写了一个FireFox的Greasemonkey脚本(via GOS),利用它,我们即可实现上述的功能。

  点击这里安装该脚本(请先安装Greasemonkey

  这是一个非常实用的脚本。如果你也像我一样,正在使用FireFox浏览器,并且经常会进行Google搜索,强烈推荐使用这个脚本!

Sunday, April 15, 2007

开机惊魂

昨晚回去没关机,早上来发现死机了,重启......
结果无法正常启动了,心里一惊,提示我输入root的密码,进入系统,/home下面是空的,手心的汗都出来了。心里那个紧张啊。
突然看到要我手动fsck一下,fsck是什么?
google了一下,是用来检查系统完整性的。
那就fsck吧,然后reboot,ok。

还好还好,没出大事。


附:

用fsck检查文件系统完整性

文件系统很复杂,因此易于发生错误。可以用fsck 命令 检查文件系统是否正确和有效。它可以根据指令修复找到的小错误,并将未修复错误报告用户。 幸运的是,文件系统的代码非常有效,所以根本极少出现问题,并且问题通常原因是电源失败、硬件失败、 或操作错误,例如没有正常关闭系统。

大多数系统设置为启动时自动运行fsck , 因此任何错误将在系统使用前被检测到(并根据希望修正)。使用有错误的文件系统可能使问题变得更坏: 如果数据结构有问题,使用这个文件系统可能使之更糟,导致更多的数据丢失。 当然,在大的文件系统上运行fsck 会花一定的时间,如果系统正常 关闭,几乎从不发生错误,因此有一些方法可以不进行检查。如果文件/etc/fastboot  存在,就不检查。另外,如果ext2文件系统在超级快中有一个特定的标记告知该文件系统在上次mount后没有正常unmount. 如果标记指出unmount正常完成(假设正常unmount指出没问题),e2fsck (fsck 的ext2文件系统版) 就不检查系统。/etc/fastboot 是否影响系统依赖于你的启动手稿, 但ext2标记则在你使用e2fsck 时发生作用--基于一个e2fsck  选项(参阅e2fsck 手册页)

自动检查只对启动时自动mount的文件系统发生作用。 使用fsck 手工检查其他文件系统,比如软盘。

如果fsck 发现为修复的问题,你需要深入了解文件系统的一般工作原理和有问题的文件系统的细节, 或好的备份。最后一个办法容易(虽然冗长)安排,如果你自己不知道,有时可以通过朋友、Linux新闻组、电子邮件列表或其他支持源安排。 我很想告诉你更多,但我对这的学习和实践也并不多。Theodore T'so的debugfs 程序应该有用。

fsck 只能运行于未mount的文件系统,不要用于已mount的文件系统(除了启动时的只读根文件系统)。 这是因为它存取原始磁盘,在操作系统不知道的情况下修改文件系统。 There will be trouble, if the operating system is confused.


Monday, March 19, 2007

Ubuntu中使用texlive 2007

参考http://mailboxpublic.googlepages.com/texlive2007cjkchinesehowto
主要是Yue Wang在水木tex版发的文章

浙大88上也有texlive2007可以下载

1. Install texlive 2007
unzip texlive2007-live-20070212.iso.zip
mount -o loop texlive2007-live-20070212.iso /mnt
cd /mnt
sudo ./install-tl
then, press I to install.

2. Set the path. Take debian GNU/Linux as example, modify your /etc/environment
like this and make a reboot:
[
PATH="/usr/local/texlive/2007/bin/i386-linux:/usr/local/matlab/bin:/usr/local/sb
in:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games"
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
]

3. 安装字体

Yue Wang放了一份在
lftp softup@soft.eeatech.org:/texlive2007-zhfonts_yuewang>
文件名texlive-zhfonts.tar.bz2,//他应该还在更新中
首先remove自己的~/.texlive2007
然后,
cd ~
解压缩texlive-zhfonts.tar.bz2
sudo texhash
updmap --enable Map cjkutf8.map

字体有simsun,simhei,simli,simkai,simyou,simfang,
测试文件
#test.tex
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{song}
你好, 万岁
\end{CJK}
\end{document}

latex test.tex
dvipdfmx test.dvi
acroread test.pdf

Tuesday, February 06, 2007

lftp 用法 教程 大全

lftp

登录 ftp

> open -u

下传目录

方法一 > mget -d dirname/*

方法二 > mirror dirname

上传目录

方法一 >mput -d dirname/*

方法二 >mirror -R dirname

下传普通文件

> get filename

下传多个普通文件

> mget *

lftp搜索文件方法
ls -R | grep .iso
find -d 3 | grep .iso

在使用中,多看看帮助 help

bookmark 标签

cat/more/less 显示文件内容(用cat和more)
zcat/zmore/zless 显示文件内容(用zcat和zmore,区别是zcat和zmore只能直接操作.gz文件)
bzcat/bzmore/bzless 显示文件内容(用bzcat和bzmore,区别是bzcat和bzmore只能直接操作.bz2文件)

get/mget/pget 抓取文件
put/mput/ 上传文件
mirror (-R) 下载上传目录
version 显示版本
cache 缓存操作

!ls !rm !rmdir !mkdir !mv !du !chmod
ls rm rmdir mkdir mv du chmod

scache 显示登录的站点会话(就是你进入过的并且缓存了的目录)
suspend 相当于 ctrl-z命令,主要是因为lftp不能用ctrl-z命令挂起,然后用fg命令回复
queue 队列 -d -m -v stop start
jobs (下载任务的显示)
kill 关闭下载任务
wait/fg 将任务放到前台,等待其结束

bye/quit/exit 退出
close 关闭发呆的连接,作用很弱
history 历史控制,history all 显示全部
open/connect 登录
user/login 在同一个ftp中改换用户名和密码登录
find -d 3 | grep .iso
ls -R | grep .iso
get1 获取单个文件(来自man lftp)

sleep 在睡眠阶段的间隔时间?什么时候是睡眠阶段? 不会用
repeat 可能是续传或登录的尝试间隔和次数?不会用
lftp 为什么这里面还有一个lftp?不会用
slot 连接的虚拟控制台,不会用
command 无帮助(几乎不用)
echo 无帮助(几乎不用)
site (几乎不用)
debug 调试(几乎不用)
source 读取外部lftp设置文件(几乎不用)
set 设置lftp参数(几乎不用)
alias 软链接(几乎不用)
module 读取外部lftp函数模块(几乎不用)
glob (几乎不用)
quote (几乎不用)
anon (匿名登录,几乎不用)

对于本地的目录改变要用lcd 而不能用!cd,而远程只用cd即可
对于本地目录要用lpwd,而不能用!pwd,而远程只用pwd(-p)即可

put [OPTS] [-o ]
get [OPTS] [-o ]
-c 选项,表示续传
-o 表示指定下传(上载)后得文件名
-E 表示删除远程文件
-a 表示用ascii模式(默认是用 binary模式)
-O 指定下传的文件所处的目录

reget [-o ]
等价与 get -c

mput [OPTS] [-o ]
mget [OPTS] [-o ]
-c 选项,表示续传
XXXXXX -o 表示指定下传(上载后)得文件名(这一项功能没有了)
-d 表示创建文件夹,使其与远程的文件夹名相同,并将其下的文件放入这个文件夹,如果不用这个命令,远程的文件夹中的内容就存到当前文件夹内了
-E 表示删除远程文件
-a 表示用ascii模式(默认是用 binary模式)
-O 指定下传的文件所处的目录

reput [-o ]
等价于 put -c

bye/quit/exit 退出
用法: exit [|bg]
exit - exit from lftp or move to background if jobs are active

If no jobs active, the code is passed to operating system as lftp
termination status. If omitted, exit code of last command is used.
`bg’ forces moving to background if cmd:move-background is false.

close 关闭发呆的连接,作用很弱

rm -r(删除目录内容和目录) 和 rmdir(只删除空目录)

对于ls的用法有很多
ls cls
rels recls
nlist relist

用法: bookmark [SUBCMD]
bookmark 命令控制书签

支持下面的子命令:
add [] - 把当前位置或指定的位置加入书签,并使用给定名字
del - 删除指定名字的书签
edit - 编辑书签文件
import - 导入其他程序的书签
list - 列出书签 (默认)

用法: cache [SUBCMD]
cache 命令控制本地的缓存

支持下列子命令:
stat - 显示缓存的状态 (默认)
on|ff - 打开/关闭缓存
flush - 清除缓存
size - 设置内存限制, -1 表示没有限制
expire - 设置缓存过期的时间为 N 秒 (x=s)
分钟 (x=m) 小时 (x=h) 或天(x=d)

open [OPTS] 打开站点
-e 在打开执行命令
-u [,] 指定用户 比如 open -u fff,fffcode 202.xxx.xxx.xxx
-p 指定端口
主机名,URL或书签名

user/login 在同一个ftp中改换用户名和密码登录,这要求你的ftp服务器有多个用户可以登录
用法: open [OPTS]
选择一个服务器, URL 或书签
-e 在选中后执行命令
-u [,] 使用指定的用户名/口令进行验证
-p 连接指定端口
主机名, URL 或书签

cache 缓存,在读入一次后,该目录或站点的内容就自动存在本机的缓存中,显示或者其它操作就不用再次下载远程的内容了,如果远程的内容有了变化,那么缓存若没有 更新,就无法显示远程的更新内容。这时需要用cache flush来清空缓存,这样在显示时就会再次登录ftp来更新缓存

du 常用 du -ah; du -sh; du -ch;若要比较大小变化,不要用h
-h 表示用M kb等表示文件大小
-a 全部显示
-s summrize
-c 最后显示total

mirror [OPTS] [remote [local]]
-c 续传
-e 比较并同步
-R 上传整个目录
-r 不递归目录
-n 只下载较新的档案
-parallel=n 同时下载n个档案(预设一次只下载一个)

用法: rm [-r] [-f]
Remove remote files
-r recursive directory removal, be careful
非常可怕,没有任何寻问,直接递归删除指定的文件,太可怕了
但是rm是不能用通配符的
-f work quietly(不反馈消息)

用法: mrm
使用通配符展开来删除指定的文件,不同同时和递归一起使用
-r 使用递归删除,这个命令等同于rm -r,这时是无法使用通配符的
-f work quietly

用法: mkdir [-p]
建立远程目录
-p 建立各级路径

用法: pwd [-p]
Print current remote URL.
-p show password(显示路径和密码)

用法: rmdir [-f]
删除远程目录,只能删除空目录

用法: chmod [OPTS] mode file…
Change the mode of each FILE to MODE.

-c, –changes - like verbose but report only when a change is made
-f, –quiet - suppress most error messages(安静模式)
-v, –verbose - output a diagnostic for every file processed(冗余模式)
-R, –recursive - change files and directories recursively(递归处理)

用法: history -w file|-r file|-c|-l [cnt]
-w Write history to file. 写入文件
-r Read history from file; appends to current history. 读入文件
-c Clear the history. 清除历史
-l List the history (default).
Optional argument cnt specifies the number of history lines to list,
or "all" to list all entries.(显示全部历史)

用法: kill all|
删除指定的任务号为 的任务, 或者所有的任务

flashfxp,用法ftp对传
ftpcopy

Obsolete. Use one of the following instead:
get ftp://… -o ftp://…
get -O ftp://… file1 file2…
put ftp://…
mput ftp://…/*
mget -O ftp://… ftp://…/*
or other combinations to get FXP transfer (directly between two ftp
servers). lftp would fallback to plain copy (via client) if FXP trans-
fer cannot be initiated or ftp:use-fxp is false.

get1用法,表示传送担搁文件,这真是太奇怪了
get1 [OPTS] rfile

Transfer a single file. Options:
-o destination file name (default - basename of rfile)
-c continue, reget
-E delete source files after successful transfer
-a use ascii mode (binary is the default)
–source-region=
transfer specified region of source file
–target-position=
position in target file to write data at

slot用法,对于多个ftp的登录
slot [name]

Select specified slot or list all slots allocated. A slot is a connec-
tion to a server, somewhat like a virtual console. You can create mul-
tiple slots connected to different servers and switch between them. You
can also use slot:name as a pseudo-URL evaluating to that slot loca-
tion.

Default readline binding allows quick switching between slots named 0-9
using Meta-0 - Meta-9 keys (often you can use Alt instead of Meta).

suspend用法
suspend

reconnect 是 `close; cache flush; cd .’ 的别名

ls,cls,nlist
rels,recls,renlist(与上面的命令相同,只是忽略cache缓存)

用法: [re]cls [opts] [path/][pattern]
List remote files. You can redirect output of this command to file
or via pipe to external command.

-1 - single-column output 单列显示
-h, –human-readable - print sizes in human readable format (e.g., 1K) 显示文件大小(可读性好一点)
-l, –long - use a long listing format 显示长文件信息
-s, –size - print size of each file (常用cls -sh)
–filesize - if printing size, only print size for files
-i, –nocase - case-insensitive pattern matching(对于通配符很有效果)
-I, –sortnocase - sort names case-insensitively(对于显示顺序有用)
–sort=OPT - "name", "size", "date"( cls –sort="size")(cls –sort="date")
-S - sort by file size (cls -S)
–user, –group, –perms, –date, –linkcount, –links (这些是显示所选内容,只加这些值即可比如cls –user pattern)
- show individual fields

-q, –quiet - don’t show status
-d, –directory - list directory entries instead of contents 只显示文件夹
-F, –classify - append indicator (one of /@) to entries ??
-B, –basename - show basename of files only 只显示文件名,不给全路径名
–block-size=SIZ - use SIZ-byte blocks
–si - likewise, but use powers of 1000 not 1024
-k, –kilobytes - like –block-size=1024
-D, –dirsfirst - list directories first(没用)

By default, cls output is cached, to see new listing use `recls’ or
`cache flush’.

The variables cls-default and cls-completion-default can be used to
specify defaults for cls listings and completion listings, respectively.
For example, to make completion listings show file sizes, set
cls-completion-default to "-s".

Tips: Use –filesize with -D to pack the listing better. If you don’t
always want to see file sizes, –filesize in cls-default will affect the
-s flag on the commandline as well. Add `-i’ to cls-completion-default
to make filename completion case-insensitive.
continue the process with shell’s fg or bg commands.

ls用法
ls 相当于 cls -l,不能控制文件大小的显示等等,但是,ls可以用-R命令递归
关键的关键是ls -R 可以输出重定向到grep或more,cat,less等命令来进行内容的筛选
这个功能可以完成ftp上的文件查找,实在是太强大了,不过,如果server不支持ls -R
那么就用传说中的find来实现

ls -R | grep .iso
find | grep .iso 不过find和ls -R 相比有些不足,有时会堵死,这时用 find -d 3 来指定
只搜索3层文件,一般就不会挂了

nlist
显示远程文件名,这个是不能用彩色显示的,功能一般,而且参数也很少

queue jobs suspend
queue
-m num1 num2
-d num
-n num command

example:

queue get FC4-i386-disc1.iso 任务将立即执行,如果前面没有任务的话
jobs
queue get FC3-i386-disc1.iso 添加这个任务到1号
jobs
queue get FC3-i386-rescuecd.iso 添加这个任务到2好
jobs
queue -n 1 get FC3-i386-disc3.iso 将这个命令添加到队列1号任务
jobs
queue -m 3 1 将排名第3的排到第1
jobs
queue -d 2 将队列中的2号任务删除
jobs

get aaa.iso
在文件传送中用ctrl-z,那么这个传输将被放到后台运行,可以用jobs来查看
实际上命令应当用后台下载,也就是
get aaa.iso &

queue stop将停止队列的执行,但是正在执行的队列不会受影响

queue start 将重新启动队列运行

queue单独的这样一个命令会列出queue的信息

停止运行中的jobs
kill all
kill job_number

当你在一个ftp server中打开了多个文件夹之后,一般你的命令若没有用re前缀的话,都会将当前的内容cache到本地硬盘内,这时你可以用scache看看你到过那些目录,然后可以用这个命令前面的数字,直接进入其目录内,比如
scache
4 ftp://aldfja/asldkfj/
6 ftp://aldfja/asdfasd/asa

scache 6 这时你就进入了ftp://aldfja/asdfasd/asa这个目录中

Wednesday, January 17, 2007

如何在MEEP中定义会聚的高斯光束

FDTD计算中,经常要用到高斯光束 ,MEEP中没有给出现成的高斯光束的定义。
按浙江大学出版的<光电子学>书中的定义,写了一段定义聚焦高斯光束的代码。

其中,
g_beam_width 是束腰的宽度。
g_beam_freq 是工作频率(归一化的)。
g_beam_xcen, g_beam_ycen 是束腰的中心位置。
调用的方式:
continuous_src_time src(g_beam_freq, 20);

geometric_volume twist(vec(g_pml, 0), vec(g_pml, g_y));
在y方向,源伸入到了pml里,这样可以保证边缘处不发生突变。

f.add_volume_source(Hz, src, twist, gaussian, 1e3);
f.add_volume_source(Ez, src, twist, gaussian, 1e3);


complex gaussian(const vec &p) {

double width = g_beam_width;
double lambda = 1./g_beam_freq;
double y = g_beam_ycen - g_y/2.;
double z = -g_beam_xcen;
double z0 = pi * width*width / lambda;
double wz = sqrt( width*width * ( 1.0 + pow(z/z0, 2) ) );
double phiz = atan(z/z0);
double r = sqrt( pow( p.x() - z, 2 ) + pow( p.y() - y, 2 ) );
double k = 2*pi/lambda;
double Rz = 0;

complex u(0.0, 0.0);

if ( abs(z) > 1e-6 ) {
Rz = z * ( 1.0 + pow(z0/z, 2) );
u = width/wz * exp( -r*r / pow(wz, 2) ) * polar(1.0, ( k * (z + r*r/(2*Rz)) - phiz) );
}
else {
Rz = 0;
u = width/wz * exp( -r*r / pow(wz, 2) );
}

return u;
}

如何判断一个点在不在三角形内部

用MEEP做计算时,初始化epsilon,想做一个三角形,这就需要判断这个点在不在三角形的内部。
写了一小段C++代码来判断一个点是不是在三角形内部。
基本思想:
这个点和三角形三个顶点构成了三个小三角形,
比较这三个小三角形的面积之和与原三角形的面积,如果相等,说明这个点落在三角形内部。
如果三个小三角形的面积之和大于原三角形的面积,则说明这个点落在三角形的外面。

技术细节:
1、已知三角形三个顶点的坐标,求三角形的面积。1/2*|axb|即是三角形的面积。
a和b分别是两条边。
2、判断大小时,要注意数值误差,也就是1e-6的作用。

double area(const vec p, const vec p2, const vec p3)
{
double x = p2.x() - p.x();
double y = p2.y() - p.y();

double x2 = p3.x() - p.x();
double y2 = p3.y() - p.y();

double s = abs(x*y2 - x2*y)/2.;
return s;
}

bool inside(const vec insert, const vec corner, const vec corner2, const vec corner3)
{
double s = area(corner, corner2, corner3);
double ss = area(insert, corner, corner2);
double ss2 = area(insert, corner2, corner3);
double ss3 = area(insert, corner, corner3);

if ( ss + ss2 + ss3 - s > 1e-6 ) return false;

return true;
}