Posts Tagged: Ubuntu


15
Jan 10

View PDF files inline in Firefox on Ubuntu Karmic 9.10

When using Firefox on Ubuntu, PDF files are opened in a separate PDF viewer rather than being displayed within the browser window itself.

If you follow this guide, you should be able to get PDF files to open inline, embedded within the Firefox window as in the screenshot below:

firefox-inline-pdf.png

To allow PDF files to be opened inline within the browser window, you need to do the following:

Install Mozplugger and Evince:

sudo apt-get install evince mozplugger

Edit the Mozplugger config file:

gksudo gedit /etc/mozpluggerrc

Find the following block of text (or something very similar):

application/pdf:pdf:PDF file
application/x-pdf:pdf:PDF file
text/pdf:pdf:PDF file
text/x-pdf:pdf:PDF file
        ACROREAD()
        repeat noisy swallow(kpdf) fill: kpdf "$file"
        repeat noisy swallow(Xpdf) fill: xpdf -g +9000+9000 "$file"
        repeat noisy swallow(okular) fill: okular "$file"
        GV()
        repeat noisy fill exits: evince "$file"

If you prefer to use the Evince PDF viewer replace the above code with the following:

application/pdf:pdf:PDF file
application/x-pdf:pdf:PDF file
text/pdf:pdf:PDF file
text/x-pdf:pdf:PDF file
	repeat noisy swallow(evince) fill: evince "$file"
	ACROREAD()
	repeat noisy swallow(kpdf) fill: kpdf "$file"
	repeat noisy swallow(Xpdf) fill: xpdf -g +9000+9000 "$file"
	repeat noisy swallow(okular) fill: okular "$file"
	GV()
	repeat noisy fill exits: evince "$file"

Or if you prefer to use the xpdf PDF viewer, you can use the following lines (make sure you if not already installed that you install xpdf using the command sudo apt-get install xpdf):

application/pdf:pdf:PDF file
application/x-pdf:pdf:PDF file
text/pdf:pdf:PDF file
text/x-pdf:pdf:PDF file
	repeat noisy swallow(Xpdf) fill: xpdf "$file"
	ACROREAD()
	repeat noisy swallow(kpdf) fill: kpdf "$file"
	repeat noisy swallow(okular) fill: okular "$file"
	GV()
	repeat noisy fill exits: xpdf "$file"

Save changes, close all instances of Firefox and Evince/Xpdf and then open firefox and try viewing a PDF file. Everything should now function as you want it to.


17
Nov 09

Improve Wireless Performance in Ubuntu Karmic on Asus EeePC 1005HA

We have a problem
For the last month or so since I bought my Asus EeePC 1005HA, I’ve been wanting to throw the thing out of the window, such has my frustration been with it’s wireless performance.

Poor Wireless Performance
Whilst the laptop is a great little machine, since I installed Ubuntu Karmic on it, the wireless connection had been completely useless. At first, Network Manager would report great signal strength for wireless networks within range of the netbook. However, once connected to the access point, the wireless signal which was first reported at over 80% would rapidly deteriorate to something much lower, often below 30%. Even when the computer was within metres of the wireless access point, the connection speed would be incredibly slow and I frequently experienced wireless drops, especially when connecting to secure wireless networks.

Solution at hand
However, fear not. After doing much searching around on the internet it seems that there is a solution to this problem. I managed to find a bug on launchpad where other EeePC 1005HA users suggested that installing the “Karmic Wireless Backports Module” would make most of the problems go away. This module contains all the cutting edge wireless drivers for Ubuntu Karmic from the testing repositories which haven’t yet been officially released.

After installing the module via apt-get, I have experienced a 30% increase in wireless signal strength, a faster connection and no drops for the last half and hour or so, it would indeed seem that the problem is solved or at least much less annoying. Here are the steps you need to follow to install the backport modules:

Enable Karmic backports
First we need to enable the Karmic backports repository. Open up “Software Sources” and browse to the “Updates” tab, make sure the karmic-backports option is ticked.

软件源.png

Install the Karmic wireless backports module
Now open a terminal and enter the following commands to install the backports wireless module.

sudo apt-get update && sudo apt-get install linux-backports-modules-wireless-karmic-generic

Please note that it is not recommended to install linux-backports-modules-karmic-generic as it has been suggested in some posts as this may affect other things on your system apart from the wireless.

Once complete, reboot your computer and enjoy.


24
Oct 09

使用 totem-pps 在 Ubuntu 下完美地观看 PPS 电影

在 Ubuntu 下运行 PPS

我之前在 Ubuntu 的中文论坛里看到过不少有关使用一个 Totem 插件来观看 PPS 在线视频的帖子,而且我最近还注意到了 PPS 的官方下载页面上竟然多出了一个 Linux 版本的链接与相关安装说明。

pps-linux.png

本人作为一个热爱看中国电影的老外,只要闲着都会跑一趟图书馆去借一些中国片子。我得知有如此有用的 Totem 插件之后,就根据帖子里面的说明安装到我电脑上了。然而,我很快就发现安装上述插件的过程并非简单,需要我自己下载源代码,将其编译好。虽然我最终还是安装成功了,但是后来发现这个插件有不少缺陷,其中最主要的是你只能在 Totem 里用这个插件来浏览 PPS 所提供的在线视频而不能用浏览器直接上官方网站去找。插件的浏览界面很简单又超级慢,其电影的分类杂乱无章,也没有搜索电影功能。因此,我怎么都找不到我想看的片子,实在是太不好用了,还是算了吧!

既然在 Ubuntu 下收看在线视频如此的麻烦,所以我暂且在 Virtualbox 的虚拟机里安装了 XP 和 PPS,每次想看电影时我就会启动虚拟机,打开 PPS 后就能开始收看电影了。不过,由于我这用的是笔记本,所以每当我同时开着 Ubuntu 和 Windows,电脑就会变得非常热,内存占满,处理器忙不过来,以至于电影的画面质量大大降低,收看的体验大打折扣,我实在是看不下去了。

面临着如此大的困难,我今天又在谷歌上搜了一下,想知道有没有别的办法让我能够顺顺利利地看一些在线电影。令我吃惊的是,在一两个月的时间内,上述插件的开发者都已经发布了一个新的版本,名叫 totem-pps。这次开发者还提供了一个 DEB 的软件包,让用户能摆脱十分复杂的手动安装过程。不仅如此,开发者还编了一个非常棒的 Greasemonkey 脚本。使用 Firefox 的用户安装这个脚本后便能直接到 PPS 的官方网站上去找电影看,只要点击电影的缩略图即可,视频将在 Firefox 的窗口里自动开始播放。

总之,totem-pps 这个插件使 Ubuntu 用户能享受到一个完美的,非常便捷的收看在线视频的体验。它的功能非常丰富,性能也很强,而且如果你将它与 Greasemonkey 并用的话,搜索到你最想看的电影已经不成一个问题了。有人感兴趣的话,可以按照下面的安装步骤,自己试一下这个非常棒的 Totem 插件。

如何安装:

先把 Mingming 的 Launchpad PPA 添加到你的软件源:

Ubuntu Karmic:

sudo add-apt-repository ppa:portis25/ppa

Ubuntu Jaunty:

将下面两行添加到 /etc/apt/sources.list/totem-pps.list

deb http://ppa.launchpad.net/portis25/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/portis25/ppa/ubuntu karmic main

在终端中执行下面的命令来获取上述 PPA 源的密钥。

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EF666E7B1E758171B82B7C5327F5B2C1B3EAC8D9

更新软件包列表:

sudo apt-get update

安装 totem-pps 和 totem-mozilla (Totem 的 Firefox 插件):

sudo apt-get install totem-pps totem-mozilla

在 Totem 里启用 totem-pps 插件:

配置插件.png

打开 Totem(电影播放器),然后在菜单里面选:

编辑 –> 插件

在所打开的窗口里勾上 “PPS 浏览器” 此插件就可以了

在 Firefox 里安装 Greasemonkey 脚本:

你如果没有安装过 Greasemonkey,要先到此网页,安装后要重启 Firefox。

点击此链接来安装脚本

脚本的配置如下:

管理用户脚本.png

测试一下:

http://kan.pps.tv/ 找自己想看的电影并点开,等视频在 Firefox 的窗口中开始播放就行了。 (要等待视频缓冲完了才能开始看,等候时间根据自己的网速而定)

要想知道更多关于这个插件的开发,可以到它的Google Code页面去看看。


9
Jul 09

用 tsocks 和 proxychains 使 Linux 下所有软件能够翻墙

情况
由于最近在中国某个地方爆发了 riot, 所以境内很多网站又是无法访问 (twitter.com、facebook.com 等),让我们这些网民很无奈。

使用 SSH 翻墙
我曾经介绍过如何使用 SSH 来建立一个 SOCKS 代理服务器,让你能够在 Firefox 里正常访问以上所提起的网址。然而不是所有 Linux 软件都能支持代理服务器。如果你最热爱的 Linux 工具需要访问”被封”的网站,又没有嵌入的代理支持,该怎么办呢?
遇到这种情况当然不要放弃该软件… 毕竟我们用的系统是 Linux 而不是以前让我们咳声叹气,丧失信心的 Windows,总有一个方法去解决问题。

举个例子吧
我不久前发现了 Twitter 这个网站。我一开始不经常用,也搞不明白别人为什么对这个 web 2.0 服务都着了迷。后来我在推特上跟的人越来越多,跟着我的人亦是日益增多,不知不觉我也迷上了该网站,天天都会上。凡是经常用推特的人一般都会用一个推特的客户端,这才能跟得上朋友们的状态更新和最火热的网络新闻。本人作为 Ubuntu 的用户,我自然就选了 Gwibber 这个基于 GNOME 的客户端来访问我的推特。这个软件功能很丰富,用起来得心应手,不过总有一个问题让我有点遗憾,就是 Gwibber 还不听从 GNOME 的代理设置。平时这也不是一个很大的问题,但是每遇中国网络封锁较严重时,都会让我暂时无法使用该软件。

解决方案… Tsocks
经过几个 Google 搜索,我最终很高兴地发现 Linux 有一个能够强迫任何软件通过 SOCKS 代理上网的工具,其名就是 tsocks。Tsocks 是一个透明 SOCKS 代理软件,只要你电脑有一个连接到国外服务器的 SSH 隧道,你就能让任何软件翻墙。

安装并配置 Tsocks
以下说明都是为了那些使用 Ubuntu 的 Linux 用户,不过在别的 Linux 发行版下,安装的过程应该与此差不多。

在终端中:

sudo apt-get install tsocks

修改配置文件:

sudo nano /etc/tsocks.conf

将其内容改成以下几行并保存退出:

local = 192.168.1.0/255.255.255.0 #local表示本地的网络,也就是不使用socks代理的网络
server = 127.0.0.1 # SOCKS 服务器的 IP
server_type = 5 # SOCKS 服务版本
server_port = 9999 #SOCKS 服务使用的端口

你可能需要修改一下以上内容,用你自己的 SSH 隧道设置。

运行软件
用 tsocks 运行你的软件很简单,在终端中:

tsocks 你的软件 &

我现在运行 Gwibber 都是这样运行的:

tsocks gwibber &

祝你们翻墙愉快!

EDIT—————–>

我今天还发现了另外一个工具,其功能似乎比 tsocks 要更丰富,配置起来更简单,而且不会那么容易出错。这个工具就是 proxychains。以下有配置方法:

sudo apt-get install proxychains

修改配置文件 (/etc/proxychains.conf),应该如下:

# proxychains.conf  VER 2.0
#
#        HTTP, SOCKS4, SOCKS5 tunneling proxifier.
#

# The option below identifies how the ProxyList is treated.
# only one option should be uncommented at time,
# otherwise the last appearing option will be accepted
#
# Dynamic - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# at least one proxy must be online to play in chain
# (dead proxies are skipped)
# otherwise EINTR is returned to the app
#
# Strict - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# all proxies must be online to play in chain
# otherwise EINTR is returned to the app
#
# Random - Each connection will be done via random proxy
# (or proxy chain, see  chain_len) from the list
# this option is good for scans

dynamic_chain
#strict_chain
#random_chain

# Make sense only if random_chain
chain_len = 2

# Quiet mode (no output)
#quiet_mode

# Write stats about good proxies to proxychains.stats
#write_stats

#Some timeouts in milliseconds
#
tcp_read_time_out 15000
tcp_connect_time_out 10000

[ProxyList]
# ProxyList format
#       type  host  port [user pass]
#       (values separated by 'tab' or 'blank')
#
#
#        Examples:
#
#            	socks5	192.168.67.78	1080	lamer  secret
#		http	192.168.89.3	8080	justu	hidden
#	 	socks4	192.168.1.49	1080
#	        http	192.168.39.93	8080
#
#
#       proxy types: http, socks4, socks5
#        ( auth types supported: "basic"-http  "user/pass"-socks )
#
#http 	10.0.0.5 3128
socks5 127.0.0.1 9999
socks4 127.0.0.1 9050

注意事项:

  1. 要选 dynamic_chain 而不是 random_chain
  2. 可以列举几个代理服务器,proxychains 会按顺序用,代理无法访问即自动选用下一个
  3. 代理服务器要根据自己电脑的情况自行调整

运行 proxychains
运行 proxychains 跟运行 tsocks 完全一样。在终端中:

proxychains 你的软件 &

比如说:

proxychains chromium-browser &

我还是推荐你使用 proxychains!