男单 618

生活象筒装的卫生纸,开始的时候怎么扯都不觉得在转,后来转的越来越快。

Archive for the ‘linux’ Category

一句话减肥JPEG文件

without comments

使用Imagemagick。
convert -quality 80 org.jpg  new.jpg
如果还想同时调整一下大小:
convert -quality 80 -resize 50%x50% org.jpg new.jpg
如果是想处理目录下的所有jpg文件(如果是Win平台,可以写个bat文件):
for i in *.jpg; do convert -quality 80 “$i” “sm-$i”; done

Written by amao

十一月 1st, 2009 at 8:10 下午

Posted in linux, 软件

Tagged with ,

使用cos-html-cache插件后的两个问题

without comments

1、WordPress内置的搜索功能不能使用。
2、搜索引擎没有更新,所收录的页面还是http://www.yoursite.com/?p=23这样的格式,无法正确跳转。

对于第一个问题,网上有一些讨论,主要是建议使用google搜索代替内置的搜索,或者修改源文件。使用Google搜索的话,当然有一些好处,但是搜索结果不如内置的准确。修改源文件的话,有几个地方都有可能涉及到这行代码,比如当前模板目录下的searchform.php,wp-includes下的general-template.php等,具体是哪一个文件在起作用,取决于使用的模板和WordPress版本。而且修改源文件这种方法在版本升级的时候,很容易失效,还要重新改一次。

而对于第二个问题,网上好象没有什么讨论。可能很多人不像我这么懒,一开始就将默认的永久链接格式改掉了。

其实这两个问题有一个共同解决方法,就是在.htaccess文件中加一句:
DirectoryIndex index.php index.html

这句话的作用是指定index.php的优先级比index.html高,也就是说,如果访问http://www.yousite.com/的话,会先访问index.php文件。在使用cos-html-cache插件之前,由于没有index.html文件,所以不存在优先级的问题。使用了这个插件之后,index.html的优先级通常比较高,问题就来了。

btw: .htaccess是个好东西。

Written by amao

十月 20th, 2009 at 5:17 下午

Posted in linux, 软件

Tagged with , ,

解决apt依赖问题

without comments

在Ubuntu下一直是用国内朋友修改后的texlive,原来是2005,现在是2008。这样如果再要装kile这样的软件的话,就会有包依赖的问题,一直不知道怎么解决。今天在查另外一个问题的时候,无意中看到解决方案。总的来就,就是造一个假包装上。在这里,42楼:http://forum.ubuntu.org.cn/viewtopic.php?f=35&t=168940。下面还是转一下原文。

引用:

另外我想重复再问一下,谁有解决 apt 包依赖问题的办法?

手工安装 TeX Live 后,如果还要从源里安装依赖 texlive 的软件(一个明显的例子就是 LaTeX 的编辑器 kile),就又会要求你再装源里面的那个已经被分解得比较零碎的 texlive2007。似乎是需要做一个关于 texlive 的空的假包?哪里有相关的文档,似乎不好找。

装 dummy 包的办法很简单了,过程如下:

代码:
sudo apt-get install equivs

它要装不少东西,好在不是很大,另外有我本来就需要的 MySQL。

在桌面上新建一 .ctl 个文件,比如:texlive-dummy.ctl 。

然后添加如下内容:

代码:
Section: tex
Package: texlive-dummy
Provides: texlive, texlive-base-bin, texlive-base-bin-doc,texlive-bibtex-extra, texlive-common, texlive-doc-base, texlive-doc-bg,texlive-doc-cs+sk, texlive-doc-de, texlive-doc-el, texlive-doc-en,texlive-doc-es, texlive-doc-fi, texlive-doc-fr, texlive-doc-it,texlive-doc-ko, texlive-doc-mn, texlive-doc-nl, texlive-doc-pl,texlive-doc-pt, texlive-doc-ru, texlive-doc-th, texlive-doc-tr,texlive-doc-uk, texlive-doc-vi, texlive-doc-zh, texlive-extra-utils,texlive-font-utils, texlive-fonts-extra, texlive-fonts-extra-doc,texlive-fonts-recommended, texlive-fonts-recommended-doc,texlive-formats-extra, texlive-full, texlive-games,texlive-generic-extra, texlive-generic-recommended, texlive-humanities,texlive-humanities-doc, texlive-lang-african, texlive-lang-all,texlive-lang-arab, texlive-lang-armenian, texlive-lang-cyrillic,texlive-lang-czechslovak, texlive-lang-danish, texlive-lang-dutch,texlive-lang-finnish, texlive-lang-french, texlive-lang-german,texlive-lang-greek, texlive-lang-hebrew, texlive-lang-hungarian,texlive-lang-indic, texlive-lang-italian, texlive-lang-latin,texlive-lang-manju, texlive-lang-mongolian, texlive-lang-norwegian,texlive-lang-polish, texlive-lang-portuguese, texlive-lang-spanish,texlive-lang-swedish, texlive-lang-tibetan, texlive-lang-ukenglish,texlive-lang-vietnamese, texlive-latex-base, texlive-latex-base-doc,texlive-latex-extra, texlive-latex-extra-doc, texlive-latex-recommended,texlive-latex-recommended-doc, texlive-latex3, texlive-math-extra,texlive-metapost, texlive-metapost-doc, texlive-music, texlive-omega,texlive-pictures, texlive-pictures-doc, texlive-plain-extra,texlive-pstricks, texlive-pstricks-doc, texlive-publishers,texlive-publishers-doc, texlive-science, texlive-science-doc,texlive-xetex, texlive-lang-other, texlive-lang-croatian, texlive-base,texlive-doc-ja, cm-super, lmodern, latex-xcolor, latex-beamer, pgf,preview-latex-style
Description: TeXlive dummy package
This package provides dpkg with the information that
there is a local TeXlive version installed.

保存后开始打包:

代码:
sudo equivs-build texlive-dummy.ctl

然后可以看见一个 deb 文件,名为:texlive-dummy_1.0_all.deb

现在就可以安装它了:

代码:
sudo dpkg -i texlive-dummy_1.0_all.deb

行了,下面就不用多说了,打开新立德,找到 kile 安装就是了,效果如下:

附件:
Screenshot.png

Screenshot.png [ 1002.93 KiB | 被浏览 738 次 ]

顺便把这两个文件也一并打包附赠:

附件:

texlive-dummy.tar.gz [4.25 KiB]

被下载 90 次

Written by amao

十月 19th, 2009 at 8:02 下午

Posted in LaTeX相关, linux

Tagged with , ,

Hawkhost的svn服务设置

without comments

    Hawkhost的空间有SVN服务器,事先没想到。

    1. 如果曾经使用ssh在命令行中建立过版本库的话,先删除之,如果没有,则跳过该步;
    2. 在cPanel面板中将界面主题改为RVSkin(只有在这个主题下,才能看到 SVN/Trac 管理器选项);
    3. 在 SVN/Trac 管理器中启用它;
    4. 一个默认的 repository 就已经建好了,可以添加一个子库,比如说叫repo:
    5. 在客户机上进入命令行环境,转到要提交的目录下,并输入如下命令:svn import -m “initial commit” svn://<yourdomain>/repo
    6. 要 checkout 的话,可以这样:svn co svn://<yourdomain>/repo

    消息来源:http://forums.hawkhost.com/showthread.php?t=232

    Written by amao

    十月 10th, 2009 at 10:47 上午

    Posted in linux

    Tagged with , ,

    XeTeX

    with 2 comments

    昨天有朋友问学位论文模板的问题,感觉问题多多,也确实很长时间没更新了,学校的格式要求也有了新的变化。主要的问题还是中文处理方面的问题。CTeX上看了一圈,XeTeX应该是个不错的方案。
    有人已经把学位论文模板改成XeTeX的了,在这里:国防科技大学硕/博论文的Latex模板,或者这里:nudtpaper

    Written by amao

    八月 23rd, 2009 at 2:00 下午

    Posted in NUDT模板, linux

    linux下计算程序的运行时间

    with 3 comments

    命令:
    time 程序名
    可以显示程序运行总时间,程序所用时间,以及系统所用时间
    比如
    time ls

    Written by amao

    八月 12th, 2009 at 10:57 下午

    Posted in linux

    Tagged with ,