Compile libjingle on ubuntu

Problem 1:

First, the library will not even compile (with gcc 4.x) without source
code modifications:
The first error is:
../../talk/base/stringutils.h:272: error: extra qualification
‘talk_base::Traits::’ on member ‘empty_str’

Solution:
This can easily be fixed by making the source change to ‘talk/base/
stringutils.h’:
From (will be found at line no. 272 in version 0.4 of libjingle, as already gven in the error message):
inline static const char* Traits::empty_str() { return “”; }
To:
inline static const char* empty_str() { return “”; }

Other errors can be corrected by applying a similar change to:
talk/base/base64.h
(i.e. change
Base64::Base64Table to Base64Table and Base64::DecodeTable[] to DecodeTable[] in line nos. 26 & 27)
talk/xmpp/xmppclient.h
(i.e. change XmppClient::GetStateName to GetStateName in line no. 141)

talk/p2p/base/sessionmanager.h
(i.e. change SessionManager::CreateErrorMessage to CreateErrorMessage in line no. 159)


Problem 2:

Second, the pcp example will not correctly run giving the error (on
the file ‘receiver’):
File transfer started.
Get temp failed
File transfer failed
session.cc(377): state_ == STATE_RECEIVEDINITIATE @ ChooseTransport
Aborted (core dumped)

Solution:

This error is caused because a temporary path is attempting to be
generated, but fails because the function incorrectly does not return
the result code ‘true’. The file that must be modified is ‘talk/base/
unixfilesystem.cc’:
simply add the line:
return true;
to the end of the function UnixFilesystem::GetTemporaryFolderI
resulting in:
bool UnixFilesystem::GetTemporaryFolderI(Pathname &pathname, bool
create,
const std::string *append) {
pathname.SetPathname(“/tmp”);
if (append) {
pathname.AppendFolder(*append);
if (create)
CreateFolder(pathname);
}
return true; //Insert this here at line no. 114
}
(more…)

Share
Posted in ubuntu, 网站. Tags: , , , . »

How to convert office document to picture

Ms Office doc =>pdf => picture (JPEG,PNG,etc..)

 

1. Install openoffice.org-headless,openoffice.org-calc,openoffice.org-writer,openoffice.org-draw,imagemagick.Under windows system, both imagemagick and ghost script were needed

2.Start openoffice  as service

#!/bin/bash
/usr/lib64/openoffice.org/program/soffice.bin -headless -nologo -norestore -accept=”socket,host=localhost,port=8100;urp;StarOffice.ServiceManage” &

3.DOWNLOAD JODConverter ,and start it

4.Convert doc to pdf

function convert2pdf($inputData,$inputType,$outputType=”application/pdf”){
 require_once ‘HTTP/Request.php’;
 $request = new HTTP_Request(“http://localhost:8080/convert/service“);
 $request->setMethod(“POST”);
 $request->addHeader(“Content-Type”, $inputType);
 $request->addHeader(“Accept”, $outputType);
 $request->setBody($inputData);
 $request->sendRequest();
 return $request->getResponseBody();
}

WARNING Install pear HTTP_Request First

# pear intall HTTP_Request

5.Convert pdf to picture

function convert2jpeg($pdffile,$dest){
 if(!file_exists($pdffile)){
  return;
 }
 exec(“convert -quality 70 -density 250 -geometry 25% $pdffile $dest”);
 $dir = dirname($dest);
 return $dir;
}

Share
Posted in ubuntu. Tags: , , , , , , , , , . »

how to set up jvm by apt under ubuntu

1. GET jdk and jre by apt

#apt-get install sun-java6-jdk sun-java6-jre

2.SET JRE 

#update-alternatives –config java

you will see

    ———————————————–
          1    /usr/bin/gij-4.2
          2    /usr/lib/jvm/java-gcj/jre/bin/java
          3    /usr/lib/jvm/ia32-java-6-sun/jre/bin/java
*         4    /usr/lib/jvm/java-6-sun/jre/bin/java
 +        5    /usr/lib/jvm/java-6-openjdk/jre/bin/java
          6    /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
choose which you want

3.SET JAVAC

    #update-alternatives –config java
———————————————–
          1    /usr/bin/gij-4.2
          2    /usr/lib/jvm/java-gcj/jre/bin/java
          3    /usr/lib/jvm/ia32-java-6-sun/jre/bin/java
*         4    /usr/lib/jvm/java-6-sun/jre/bin/java
 +        5    /usr/lib/jvm/java-6-openjdk/jre/bin/java
          6    /usr/lib/jvm/java-1.5.0-sun/jre/bin/java

4. # javac -version
javac 1.6.0_06

5 # java -version
java version “1.6.0″
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)

Notice: do not set JAVA_HOME!

Share
Posted in ubuntu. Tags: , , , , , , , . »

Ubuntu使用小窍门

寻寻觅觅Ubuntu横空出世。
1.Apt和deb的支持
不愧也是Debian的嫡传正系,数不清的源,数不清的软件包,把光盘的源禁用,以后只要有网络,我的系统就是最新的,也不用插光盘了
2.没有root用户
不要被表面给蒙蔽了,有root,只是root用户没有密码,无法登陆,用
#sudo passwd root
指定密码后再SU试试看?
3.有设备不能正常用?
我用这个系统的时候出现了网卡不能正常使用的情况,我检查了系统日志 原来是IRQ有冲突,系统日志中记录下的提示信息显示
只要在KERNEL的启动参数中增加irqpoll 就可能会正常,我尝试了一下,重启,果然,操作eth0的时候不再死机了
4.PCMCIA无线网卡和wifi
原先,我的ASUS的107G网卡无法通过NIDSWRAPPER使用,现在Ubuntu下,能用了,能连上任何无线路由,原先Ndiswrapper就相形  见绌了
5.软件编译安装
不用多说了,不过Ubuntu默认没有安装gcc还有make自己装一个吧
6.acpi s3
还是没有解决,期待中
7.GNOME下设定cpu频率
#chmod +s /usr/bin/cpufreq-selector
在面板上添加cpu频率监视器,就能改cpu频率了
当然,不是移动版本的不能用,别来找我。
8.运行速度
平滑的没话说,相当的快,看样子RH的研发团队要做一下检讨了

Share
Posted in ubuntu. »

Magic Linux,软件,ACPI,使用

成功的在笔记本上安装了Magic Linux ,有些东西是在让人觉的受不了,首先就是ACPI的功能不了。现在连网卡也不正常了,打算尝试Ubuntu,接近Debian的,用起来比较舒服
不过Magic Linux确实是非常好的系统,易用

1.CPU降频
安装
powersave
acpid
cpufreqd
powernowd
powersaved
即可实现

2.休眠到硬盘
在内核启动参数上增加 resume=/dev/hda3(我的SWAP),可顺利休眠到硬盘

3.休眠到内存,未果,为此还给kernel的官方发了bug票,目前,还没有结论,官方达人正在解决

4.图形界面
原先我的电脑没有办法安装Fedora系列,因为xorg对via的显卡支持有点欠缺。
目前此问题在Magic Linux下已经解决
下载最新驱动 http://dri.freedesktop.org/snapshot
将驱动的so文件直接复制到/usr/X11R6/lib/module/driver和/usr/X11R6/lib/module/dri下
用root身份运行driconf进行配置
注意 /usr/X11R6/lib/module/driver是驱动程序所在目录
/usr/X11R6/lib/module/dri 是direct rending 驱动所在目录
有了dri的驱动,就可以使用硬件加速了,对于需要使用图形的人来说,非常有用

5.CPU性能配置文件
/etc/cpufreqd.conf

6.PCMCIA无线设备的使用
下载ndiswrapper ,sourceforge上有,加压缩出来后操作如下
#./make-kernel-patch
#make && make install
到此,安装完毕。每次升级核心都要重新安装

使用方法
#modprobe nidswrapper
#ndiswrapper -i driver.inf (注意 driver.inf是网卡的windows驱动的inf文件名,windows下的驱动复制过来,可直接安装)
自此可以使用无线工具连上无线网了
ndiswrapper 自动挂载方法:
#ndiswrapper -m 每次启动时候自动挂载

Magic Linux使用感受:
优点:
1.人性化,适合中文用户,界面美观
2.占用硬盘少,但是工具比较齐全,适合工作站
3.多媒体功能较好
4.速度比Fedora快
弱点:
1.电源管理能力不足
2.glibc版本是2.36,低于2.4导致某些软件无法安装
3.升级包管理混乱,听官方论坛上透露,需要重新整理
4.smart程序的源地址速度慢,经常超时

Share
Posted in ubuntu. »