February 24th, 2010 . Posted in _ | 1 Comment »
Essentially, two things. First, when configure, add --x-libraries /usr/X11R6/lib --x-includes /usr/X11R6/include. Second, add -framework CoreFoundation into each Makefile.in you need to build. Probably there should be a better way to add this flag with less effort, there is an “all-recursive” dependency item in “ns” makefile, which is quite a bit amount of labor work to modify all those “recursively”.
The “./install” is really somehow ugly written. For example, when “nam”‘s compilation failed, it will not stop. I really suggest you build each separately by hand, which maybe even easier.
February 24th, 2010 . Posted in _ | No Comments »
It seems that by default nam is not built automatically, at least for me, using Ubuntu 64-bit 9.10. Here is how to make it work.
- Install some libs:
sudo apt-get install xlibs-dev
- Run these under folder
nam-1.14:
./configure
make
February 17th, 2010 . Posted in _ | 1 Comment »
Tags: ssh
I changed my desktop’s ssh port from 22 to another number because there are username/password scanners running in campus every minute. However, this introduces a disadvantage on running an svn server on this machine, because svn+ssh does not support port other than 22 by default.
There are plenty of dirty hacks on this problem, like export SVN_SSH="ssh -p 5555", where 5555 is (hypothetically) the alternative ssh port. I am not satisfied with this hacking because it will ruin other svn+ssh repository using port 22, and I am always working with multiple projects.
It is a pain until I find this solution. What it says there is create a ~/.ssh/config file, and add lines like:
host hellen
Hostname liulonnie.ucsd.edu
Port 5555
ForwardAgent no
ForwardX11 no
hellen is an alias for my office desktop. Then when using svn, use svn+ssh://hellen instead of svn+ssh://liulonnie.ucsd.edu.
I should really learn more about command ssh.
January 23rd, 2010 . Posted in _ | No Comments »
http://userstyles.org/styles/10822
A really cool fix with stylish. Better than mine.
January 21st, 2010 . Posted in _ | No Comments »
When default ubuntu language support for Simplified Chinese is installed, wqy fonts will be set as default, and even your own .fonts.conf will be blinded. To fix this, you need to edit /etc/fonts/conf.d/44-wqy-zenhei.conf and comment down this arrogant configuration part:
<!--
<alias>
<family>serif</family>
<prefer>
<family>Bitstream Vera Serif</family>
<family>DejaVu Serif</family>
<family>WenQuanYi Zen Hei</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Bitstream Vera Sans</family>
<family>DejaVu Sans</family>
<family>WenQuanYi Zen Hei</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Bitstream Vera Sans Mono</family>
<family>DejaVu Sans Mono</family>
<family>WenQuanYi Zen Hei Mono</family>
</prefer>
</alias>
-->
And then your own ~/.fonts.conf will work again.
October 3rd, 2009 . Posted in _ | No Comments »
This is technically not a tech post but an experience sharing. I put a 3-inch CD into my Macbook, and was expecting my laptop could do something with it. Obviously, nothing happened, except that I could not take the disc out.
Then my girlfriend sent me a link from zhidao.baidu. And I followed its instruction:
- Close your macbook
- Grab your macbook firmly, with your CD slot towards downside
- Throw down fast, and then stop throwing suddenly, for several times
And finally I get it out. Stupid Macbook…
ref: http://zhidao.baidu.com/question/39736306.html
July 27th, 2009 . Posted in _ | 1 Comment »
I have personally upgraded to Firefox 3.5.1 myself, by downloading the binary from Mozilla and manually change the firefox symbolic link under /usr/bin to my new downloaded version. It seems to be a litter bit faster. But one thing is that the link color of the auto-completion menu is defined to dark-blue(#0000FF I think) as default. The auto-completion is the menu that pops out when you type something in the url input box. The background color of that auto-completion bar is set to menu background color, and mine is black. Dark-blue text can be hardly seen under black. So I make some personal modifications on the theme files.
My theme files which I am using are stored in a folder like this:
/home/lonnie/.mozilla/firefox/rsh6zrom.default/extensions/{1ebc69c0-92ff-11dc-8314-0800200c9a66}
I do not know what it stands for, I find this by blind guess+test. The theme style files are written in a css like form and I think the structure this css describing is well defined by Mozilla or something. I didn’t find out a line of correct written code to modify the url text color in auto-completion, but I have found a way to modify the background and other title text colors. They are defined in a file called ./chrome/gnome/global/autocomplete.css in that theme folder and I make the following modification:
141c141,142
< background-color: transparent;
---
> /* background-color: transparent; */
> background-color: -moz-Field;
151c152
< color: MenuText;
---
> /* color: MenuText; */
For reference, here is also a part of the origin file, generated by grep . -n
137:/* ::::: richlistbox autocomplete ::::: */
139:.autocomplete-richlistbox {
140: margin: 1px;
141: background-color: transparent;
142:}
144:.autocomplete-richlistitem[selected="true"] {
145: background-color: Highlight;
146: color: HighlightText;
147:}
149:.autocomplete-richlistitem {
150: padding: 1px 2px;
151: color: MenuText;
152:}
154:.autocomplete-richlistitem:not(:first-child) {
155: border-top: 1px solid ThreeDLightShadow;
156:}
And now the color of the auto-completion menu is much easy for me to read.
However, there are still some potential problems for Firefox 3.5. First, the firefox3.5 from ubuntu source simply can not be started properly. Second, my downloaded firefox3.5 binaries refuse to response from time to time, especially while dealing with some flash or sound or other multimedia things. I think there is something incompatible with the add-ons. And crashed firefox cannot be killed by killall command, and refuse to restart a new session (I think something is deadlocked or similar) and I have to restart my computer (or at least logout X I guess) to make it work properly again. This is somehow irritating…
June 14th, 2009 . Posted in _ | No Comments »
Tags: latex, thuthesis
It is time to write final thesis. There is a LaTeX thesis template called thuthesis. It is good, but the document is not well maintained and the installation and configuration of latex with Chinese support to compile thuthesis template is quite complex and also time consuming. Luckily, we have this. Just download an iso and replace your latex (if you have installed one) with the version in the iso (by mounting or mirroring or extracting to some place) and then add the bin directory into your path, then the thuthesis will be able to compile correctly.
Tip 1: To modify the $PATH in linux, please modify .profile instead of .bashrc. This will make your $PATH modification applied to every program including GUI program (such as scite) after a reboot, instead of only interactive command line programs.
Tip 2: You do not really need to use make clean thesis to rebuild it every time. I personally prefer a script like this (utf-8 version only):
pdflatex main.tex
bibtex main
pdflatex main.tex
pdflatex main.tex
I named it as build.bat so that it is useful in both linux and window command line. You need to build it twice to make the content list updated correctly. To deal with the gbk verison, an additional command line gbk2uni main must be inserted between the two main.tex. (ref)
Tip 3: The blank line for signatures of the second page (acknowledgement page) are too long by default and the last one wraps to next line (probably because of font rendering in my ubuntu is different from windows). To fix this (for bachelor template), I modified thuthesis.cls at line 700 and line 701 (line number for thuthesis-4.5.1 utf-8 version). I replaced each \thu@underline in these two lines with \thu@underline[5em] (by default, it is 6em).
If you want to learn more on TeX, you may visit TeX board on newsmth.net. There are a bunch of skilful folks hanging around but they seemingly do not write easy-to-read documents and maintain them very often (this is a quite common problem for open-source and also closed-source tech-supporting…) It is somehow a shame that they do not make Chinese support for TeX a really good module or package or patch or something for LaTeX system. Although some people have brunched the CTeX and CTeXLive for easy installation and using, it is still a little bit complex to add Chinese support to an existing general LaTeX distribution to for example make it suitable for thuthesis. Maybe it is because thuthesis is using out-of-date packages (I do not like the CJK environment by the way, it makes me somehow feel wierd to use an environment before using any Chinese character). Anyway, it is just a layout and printing tool for me; why bother?
June 14th, 2009 . Posted in _ | No Comments »
Tags: hotkey, linux, ubuntu
Usage:
halfwin.py left Win+Left in Windows 7
halfwin.py right Win+Right in Windows 7
halfwin.py top Win+Up in Windows 7
The python script is here:
#!/usr/bin/env python
import gtk
import wnck
import sys
def halfwin(k):
screen = wnck.screen_get_default()
while gtk.events_pending(): gtk.main_iteration()
win = screen.get_active_window()
h = screen.get_height()
w = screen.get_width()
if win.is_maximized() and k != 'top':
win.unmaximize()
if win.is_minimized():
win.unminimize()
f = (wnck.WINDOW_CHANGE_X | wnck.WINDOW_CHANGE_Y
| wnck.WINDOW_CHANGE_WIDTH | wnck.WINDOW_CHANGE_HEIGHT)
if (k == "left"):
win.set_geometry(wnck.WINDOW_GRAVITY_CURRENT, f, -4, 0,
w / 2, h + 2)
elif (k == "right"):
win.set_geometry(wnck.WINDOW_GRAVITY_CURRENT, f, w / 2, 0,
w / 2, h)
elif (k == "top" and not win.is_maximized()):
win.maximize();
def main():
argv = sys.argv
if len(argv) <= 1:
pass
elif argv[1] == 'left':
halfwin('left')
elif argv[1] == 'right':
halfwin('right')
elif argv[1] == 'top':
halfwin('top')
if __name__ == '__main__':
main()
It is not working perfectly well, but fairly good already.
To bind a command with a hot-key in ubuntu, please play with System->Preference->Keyboard Shortcuts. I am very sure you will find it.