See the series photo of Blue grotto and Get your own Slide show

| 0 评论

 

Picasa Web AlbumsFullscreen

 

想要这个效果? follow me

  1. Open the album you want to display in Picasa Web Album.
  2. Right-click on the button and "Copy shortcut" (?).
    or just open Slideshow, and copy the address of the page.
    e.g. http://picasaweb.google.com/zcambridge/MaltaBlueGrotto#slideshow
  3. Replace http://picasaweb.google.com/zcambridge/MaltaBlueGrotto#slideshow by your copied address in the code below:

  4. Now you can embedded your code in your blog anywhere you want.

There is a more convinent website doing this , but I don't want the advertisment on it. Thus my version is posted here. haha .

enjoy!!

[+/-] Read More...

linux下vnc终于设置好了,总结

| 0 评论

搜集网上资料,整理适合自己情况,主要是为了远程等服务器跑cadence。

 

1. 检查vnc客户端和服务器是否已经安装在你的系统中:
[user@centos ~]$ rpm -q vnc vnc-server
package vnc is not installed
vnc-server-4.0-11

 

2、设置登陆到Gnome/KDE桌面
a.
[root@ics-pc ~]# cat /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the line below to start a VNC server on display :1
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that. 
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/vnc/sshvnc.html>.
VNCSERVERS="1:username"
VNCSERVERARGS[1]="-geometry 800x600 -alwaysshared -depth 24"
 
注:
1. 红色部分就是被修改或增加的部分
2. -alwaysshared代表允许多用户同时登录 -depth代为色深,参数有8,16,24,32。
3. 我试验了,要想跑cadence用24没问题。 因为cadence只支持8或24.
b.
[root@ics-pc ~]# vi /root/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
 unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session & #set starting GNOME desktop
#startkde & #kde desktop
#twm & #Text interface
注:
1. 红色部分就是被修改或增加的部分
2. 普通用户的xstartup在~/.vnc/xstartup.
3. 想用什么样的桌面就怎么配,最后3行里选一个就行。

c.

重启VNC即可。

3、VNC的启动/停止/重启
$ service vncserver start/stop/restart
关闭具体的vncserver命令:
$ vncserver -kill :1
$ vncserver -kill :2
4、设置密码
# vncpasswd
$ vncpasswd
 

5、客户端登陆

  • 用vnc客户端(viewer)登陆:
服务器地址可以是:IP或域名
端口通过以下两种办法查:
# netstat -tlnp |grep vnc
启动服务的时候也会出现如下红色

[centospub@localhost ~]$ vncserver

New 'localhost.localdomain:7 (centospub)' desktop is localhost.localdomain:7

Starting applications specified in /home/centospub/.vnc/xstartup
Log file is /home/centospub/.vnc/localhost.localdomain:7.log

 
这个例子里是7,则用: IP或域名:7  登陆。
 
  • 用浏览器登陆:
服务器地址: 一样
端口:要加个5800到原来的端口上
同样的例子: 用: IP或域名:5807  登陆。
 
6. 其他技巧:

设置vncserver启动变量:
为了使vncserver在每次启动时保持不变的端口号(5801或1)
在/etc/rc.d/rc.local文件中添加命令:
rm -f /tmp/.X11-unix/X*
rm -f /.vnc/*.pid
rm -f /.vnc/*.log
这样,每次启机,系统会先把上次非正常关机时留下的临时文件删除。

附注:

[原创]vnc远程连接linux服务器显示问题

2007-10-12 15:40

今天在服务器上装了 ic5141,配置好环境变量后运行提示:
*ERROR* Failed to find either 24-bit TrueColor or 8-bit PseudoColor Visual .
*WARNING* Failed to find eiher 24-bit TrueColor or 8-bit PseudoColor Visual.


在vnc上设置显示模式示果
之后更改vnc设置文件(/usr/bin/vncserver)中depth参数,

由$depth = 16;改为$depth=24;
运行后正常。

我自己用的并未成功。直到用了文章中2-a的设置才可以跑cadence。

 

Useful Links:

庖丁解牛lagvin 写得心得

这个里边有很多技巧问答。

[+/-] Read More...

Using screen for remote interaction (ZZ)

| 0 评论

Using screen for remote interaction

By Phil Hollenback on August 22, 2006 (8:00:00 AM)

Recently I needed to do some distance education; one of my coworkers wanted me to show him how to do software builds on Linux. The only problem was that I'm on the East Coast and he is on the West. How could I show him the build and install process? After considering some alternatives, we found our solution in GNU Screen.



I considered using the standard Unix utility script to save a log of my typing. script has several problems, not the least of which is the horrible resulting output (script saves everything, including carriage returns and corrections). In addition, this would be completely non-interactive. If my coworker had a question or needed a clarification, we would have to correspond via email afterward. That would be a frustrating experience for both of us.

Another possible solution would be to use VNC. My coworker could connect to my display, and we could alternate control of the mouse and keyboard. That approach seemed like overkill, since what I wanted to demonstrate was purely command-line work. It would also be difficult to generate a log of a VNC session. Finally, technical limitations dictated that the only way he could connect to my machine for the demonstration was over a simple SSH connection, so this dictated a purely command-line solution.

Screen is one of those tools that is hard to explain but pure genius once you see it in operation. The description from its official Web site doesn't help much:

Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.

Basically, screen allows you to create virtual terminals which are not connected to your actual xterms or console screens. You can then disconnect from a screen session and reconnect from somewhere else while preserving your shell or other running processes. For an introduction to screen, check out this Linux.com article.

This is just the beginning of screen's power and flexibility. You can connect to a session more than once using the -x argument to screen. That means you can for example leave your mail program running in a terminal (under screen) at work and then connect from home to read your mail in the same process. There's no need to disconnect at work, and when you come back in the next morning your mailer will be exactly as you left it, with all your state perfectly preserved.

Screen takes this feature, which is called multi-display mode, to the next level with multi-user mode. In multi-user mode more than one user can access and control a screen session. The problem with this mode is that it's not obvious how to set it up. Here's what I ultimately figured out with the help of some Google searching:

  1. Set the screen binary (/usr/bin/screen) setuid root. By default, screen is installed with the setuid bit turned off, as this is a potential security hole.

  2. The teacher starts screen in a local xterm, for example via screen -S SessionName. The -S switch gives the session a name, which makes multiple screen sessions easier to manage.

  3. The student uses SSH to connect to the teacher's computer.

  4. The teacher then has to allow multiuser access in the screen session via the command Ctrl-a :multiuser on (all screen commands start with the screen escape sequence, Ctrl-a).

  5. Next the teacher grants permission to the student user to access the screen session with Ctrl-a :acladd student where student is the student login ID.

  6. The student can now connect to the teacher's screen session. The syntax to connect to another user's screen session is screen -x username/session.

At this point the teacher and student both have control of the session. Note that there are security implications to this -- the student is operating the session as the teacher and could potentially do something to damage the system. If you don't trust your students then you should probably use a special teacher account and not your normal login account. The teacher can also make the student's session read-only. To do this, use the aclchg screen command to remove write access for the student: Ctrl-a :aclchg student -w "#". The student can then only observe the teacher's actions. Otherwise, the teacher will have to let the student work on the honor system.

While my example centers on one teacher and one student, many users could attach to one session. There could even be multiple teachers and students.

What about communication between teacher and student? Well, we used a telephone, but you could use instant messaging, IRC, or VoIP for asking questions. There is also an message feature in multiuser screen: Ctrl-a :wall message will write a message to all users connected to a screen session. One problem with this is that it uses the terminal status line. In an xterm this is the window titlebar area, which, depending on your window manager, may not be very obvious.

The final ingredient for using screen as a teaching tool is logging. With a log of all the terminal output, my coworker and I would have an exact transcript of what we did in case there were any questions later. As I mentioned earlier, the standard Unix tool script is the obvious answer, but it is a very limited tool and does not produce very readable output. You also can't turn it on and off inside a session if for example you want to run a full-screen tool such as a text editor.

Fortunately screen comes with a comprehensive logging facility that is much more sophisticated than what script can do. Screen's logging can be turned on or off at any time with Ctrl-a H, or you can use the -L switch when starting screen to enable it by default. The log file is written to the current directory under the name screenlog.n, where n is incremented by one for each new log.

The logfile will contain the output of your session with corrections and cursor movements already evaluated and applied. One caveat is that programs that send control sequences to the screen will still confuse the output. One example of this is GNU ls, which by default colorizes output. You should turn this off in your session by using something like the following bash alias:

 alias ls='ls --color=none'  

With that, all the pieces are in place: multiple users can share a screen session for any sort of command-line-based instruction. The teacher can at any time take control of the session by switching all other users to read-only access. Finally, you can turn on the logging facilities in screen to get an accurate and usable log of the entire session (or just portions of the session if you desire).

I found screen to work extremely well for this purpose, and my coworker was also pleased with the results. Some of the options and controls in screen can be hard to figure out because screen is so powerful and flexible. But I plan to use this tool in the future, and I encourage anyone in a similar situation to try it.

[+/-] Read More...