秀秀撒加入了视频功能了,beta版先测试一下

Filed under: 关于秀秀撒 | No Comments »
Posted on

最大可以上传50M的视频文件

今天已经看到有两个用户上传了:)

www.xiuxiusa.com

修改log4j配置,提高jboss效率

Filed under: jboss seam | No Comments »
Posted on

最近作了一个程序,跑在jboss上的,发现日志文件动不动就上百兆,于是找到jboss-log4j.xml,修改这部分,加上红色部分:    <root>   <priority value=”INFO” />      <appender-ref ref=”CONSOLE”/>      <appender-ref ref=”FILE”/>   </root> 日志文件一下清静了 

Tags :

jboss seam 中文查询乱码解决方法

Filed under: jboss seam | No Comments »
Posted on

jboss seam 自动生成代码之后,在查询界面上输入中文,查询之后中文变成乱码,查询的内容也不符。解决该问题的办法:在{jboss home} /server/default/deploy/jboss-web.deployer/ 中找到server.xml修改其中的connecter,加上红色的部分:<Connector port=”7777″ address=”${jboss.bind.address}”             maxThreads=”250″ maxHttpHeaderSize=”8192″         emptySessionPath=”true” protocol=”HTTP/1.1″         enableLookups=”false” redirectPort=”8443″ acceptCount=”100″         connectionTimeout=”20000″ disableUploadTimeout=”true” URIEncoding=”UTF-8″ /> 问题解决! 

最近在服务器上装上了red5和ffmpeg,准备试验一下视频功能

Filed under: 关于秀秀撒 | No Comments »
Posted on

red5的安装费尽周折,red5在windows上安装是没有问题的,但是在linux上安装总是出问题,因为我是在官方下载的源文件,发现还是不能用。后来才发现必须用svn下载源码才行(从目前看来,svn已经完全取代cvs了,看来开源项目转向商业化还是挺难的)。ffmpeg安装还算顺利,一天就搞定了。然后测试了几个视频,发现网速还是不够,总是会卡。怎么办?做或是不做?

Tags :

oracle 导入中文文本数据出现乱码的问题终于解决了

Filed under: Uncategorized | No Comments »
Posted on

总体框架使用jboss seam ,正常的在界面上输入中文,oracle存储是正常的,但是用程序写了一个批量导入,发现问题就出来了,不管数据文件格式用ASCII或者UTF8,导入到数据库里的都是乱码。怎么回事?
贴导入数据的代码:

package com.baida.beans;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.core.FacesMessages;
import org.jboss.seam.log.Log;

@Name(”categoryImportor”)
public class CategoryImportor {
@In(create=true) CategoryHome categoryHome;
@In FacesMessages facesMessages;
@Logger Log log;
private byte[] data;

public byte[] getData() {
return data;
}
public void setData(byte[] data) {
this.data = data;
}

public void importFromFile()throws IOException{
if(data == null){
facesMessages.add(”upload file has no content”);
log.debug(”upload file has no content”);
return;
}

ByteArrayInputStream in = new ByteArrayInputStream(data);
BufferedReader reader = new BufferedReader(new InputStreamReader(in));

String line = reader.readLine();
while(line != null){
parse(line);
line = reader.readLine();
}
}

private void parse(String line){
String[] ss = line.split(”,”);
String categoryNo = ss[0].trim();
String categoryName = ss[1].trim();
log.info(”begin to parse category:”+categoryNo +”-”+categoryName);
Category parent = getParent(categoryNo);
Category category = new Category();
category.setCategory(parent);
category.setCategoryNo(categoryNo);
category.setCategoryName(categoryName);
categoryHome.setInstance(category);
categoryHome.persist();

}
private Category getParent(String categoryNo){
int index = categoryNo.lastIndexOf(”.”);
Category parent = null;
if(index > 0){
String parentNo = categoryNo.substring(0,index);
log.info(”try to find parent no:”+parentNo);
parent = categoryHome.getCategoryByNo(parentNo);
if(parent == null){

}
}

return parent;
}

}

在日志 中可以看到:
log.info(”begin to parse category:”+categoryNo +”-”+categoryName);
如果用ASCII格式的文本文件上传,日志里是正常的中文字符,UTf-8格式的文本就不行
终于找到关键了:
BufferedReader reader = new BufferedReader(new InputStreamReader(in,”GBK”));
我的想法是:我的界面都是utf-8编码,传到服务器端,seam认为所有的都是UTF-8编码的,于是把文件内的内容也按照UTF-8编码来处理,所以出现了乱码。我告诉java这个文件是”GBK”的,所以就不会出现乱码了。
非常感谢!!!

秀秀撒可以按照地理位置距离来找朋友了

Filed under: 关于秀秀撒 | No Comments »
Posted on

根据在地图上标注的经度和纬度计算两个人的距离,然后我就可以找离我20公里的范围内,有哪些人在,有兴趣可以去看看:

http://www.xiuxiusa.com/search.php

Tags :

fluendo-another streaming media server

Filed under: Uncategorized | 1 Comment »
Posted on

==========================
Frequently Asked Questions
==========================

.. contents::
.. sectnum::

—–

About Flumotion
===============

What is Flumotion ?
——————-

Flumotion is a streaming media server written in Python and based on GStreamer and Twisted.
It focuses on providing an end-to-end solution, ease of use, and easy customisation.

What does it run on ?
———————

Flumotion runs on any Unix-like platform that has the necessary requirements installed.  These include:
- python 2.3
- Twisted 1.3.0 or later
- GStreamer and GStreamer Python Bindings (0.10 or later is preferred, though support for 0.8 is still available)
- GTK+ and PyGTK (for the GUI admin client)

What distribution do you recommend ?
————————————

Our hackers use Ubuntu, Fedora Core 4 and Gentoo.  Using either of these will probably make it easy on you.  Other distributions will work fine too, once the requirements are satisfied.

Running Flumotion
=================

When starting flumotion-manager, I get an error about a missing .pem file
————————————————————————-

::

  ERROR: .pem file /etc/flumotion/default.pem does not exist
When using SSL as the communication protocol, a .pem file needs to be generated and placed in the given location.
See [http://www.flumotion.net/doc/flumotion/manual/html/chapter-security.html] for more explanation.
See [http://www.flumotion.net/doc/flumotion/manual/html/chapter-security.html#section-certificate] for how to generate it.

When starting flumotion-manager, I get an error about an unknown component type
——————————————————————————-

If the error looks like:

::

  ERROR: unknown component in configuration file
  ‘/home/thomas/flu/svn/flumotion-template/conf/template.xml’:
  unknown component type: template

This means that the manager cannot find a description of the given component type in its registry. 

 - Run flumotion-inspect in the same environment - this will give you a list of components that Flumotion can find.  Is the component type listed ?
 - If the component is a component from an add-on project, is it installed in the same location as Flumotion ? If not, did you set the FLU_PROJECT_PATH environment variable ? Correct this and verify with flumotion-inspect

Configuring Flows
=================

Can I stream and record at the same time ?
——————————————

Yes.  The default scenario allows you to choose this by choosing to save to disk in the production steps.  This will generate a configuration where both a disker and a streamer feed from the muxer.

Can I stream and record at different bitrates ?
———————————————–

Yes.  In this case however you will have to manually adapt the configuration and create two different encoders and muxers using different bitrates.  Note that this means you will use a lot more CPU since you are doing two video encodings at the same time.  You may consider distributing the encoding tasks across two machines.
Can I stream and record at different resolutions/framerates ?
————————————————————-

It is possible, but there is no dedicated component (yet) for scaling down the video.  You can however achieve the same effect using a pipeline-converter component with a partial GSteamer pipeline doing the scaling for you.  The configuration part for this component looks like this:

.. code-block:: xml

    <!– create a scaled down copy of the overlayed video for streaming –>
    <component name=”overlay-video-small” project=”flumotion” type=”pipeline-converter” version=”0.4.1″ worker=”localhost”>
      <source>overlay-video</source>

      <property name=”pipeline”>videoscale ! video/x-raw-yuv,width=160,height=120</property>
    </component>

To change the framerate of the video, you can do something similar with the videorate element.  Set the pipeline property to
“videorate ! video/x-raw-yuv,framerate=25/2″ to go to 12.5 frames per second.

:trac:`browser:flumotion/trunk/conf/examples/twores.xml#latest The full configuration for this example flow` is included in the release.

Can I serve on-demand streams over HTTP ?
—————————————–

Flumotion includes a basic component called ‘http-server’ that can serve files in a path on your worker.
:trac:`browser:flumotion/trunk/conf/examples/ondemand.xml#latest The configuration for an example flow` is included in the release.

Can Flumotion stream MP3 ?
————————–
Yes it can, but not with a specific encoder component.  You can use a pipeline-converter component.

.. code-block:: xml

    <!– encode to MP3 –>
    <component name=”mp3-encoder” project=”flumotion” type=”pipeline-converter” worker=”localhost”>
      <source>audio-producer</source>

      <property name=”pipeline”>lame bitrate=128</property>
    </component>

Be aware that, depending on your version of gst-plugins-ugly and the settings you choose in the pipeline for lame, the sample rate may be adjusted automatically for you.
Also be aware that, if you want to stream MP3 to a Flash player, you need to make sure that it encodes to a samplerate of 11.025, 22.05 or 44.1 kHz.

Can Flumotion stream a live stream from a file ?
————————————————
It can from Ogg/Vorbis/Theora files at this point.  To do this you can use a loop-producer component.  This will endlessly loop the file from start to finish, creating a live stream.

Here is an example configuration:

.. code-block:: xml

    <component name=”loop-producer-high” type=”loop-producer” worker=”demo1-looper”>
      <property name=”framerate”>25/2</property>
      <property name=”height”>284</property>
      <property name=”width”>352</property>
      <property name=”location”>/srv/flumotion/moto.ogg</property>
    </component>
What players does Flumotion support ?
————————————-
See :trac:`wiki:Players` for more information on player support for streams served by Flumotion.

Known Problems
==============

Firewire flows not working ?
—————————-

With GStreamer release 0.10.13 and later, the firewire flow on versions of flumotion <= 0.4.2 will not work.

Debugging Flumotion
===================

Can I change Flumotion debug level on a running Flumotion process ?
——————————————————————-

Not yet; there is a ticket open for this.

Can I change GStreamer debug level on a running component ?
———————————————————–

Since 0.4.2, you can invoke a remote method to set a GStreamer debug level:

::

  flumotion-command -m user:test@localhost:7531 invoke /default/ogg-muxer setGstDebug s 5
There is a bug that prevents you from setting categories, which should be fixed in 0.4.3

Hacking Flumotion
=================

I want to create an add-on project for Flumotion with my own components
———————————————————————–

Excellent ! We’ve created a flumotion-template project just for you ! Download the source releases of it from http://www.flumotion.net/src/flumotion-template/ or browse our svn: https://core.fluendo.com/flumotion/trac/browser/flumotion-template

About Cortado
=============

When I put Cortado on my web server, my log files show 404s for AudioSystem.class
———————————————————————————

Cortado tries to see if the browser’s java VM has javax.  This is not a problem and can safely be ignored.

The debug log shows a line reading “javax.sound.sampled.LineUnavailableException: no Clip available”
—————————————————————————————————-

This can happen if you’re using a java binary with classpath.  If we understand correctly, Classpath doesn’t actually provide a javax.sound.sampled provider for its implementation, hence cannot play back sound.  See [http://www.mail-archive.com/bug-classpath@gnu.org/msg02572.html].

The debug log shows an exception containing “java.security.AccessControlException: access denied”
————————————————————————————————-

By default, unsigned applets are not allowed to open a resource (in this case, the stream or file it’s trying to play) that is located on a different hostname than the applet’s code.  This is due to Java’s security model.

There are two things you can do.  The easiest is to make sure that your <applet> tag refers to the cortado applet using the same domain name as your stream.  The second is to sign the applet (which we have not tried ourselves).

What is the difference between the different Cortado binary jar files available in the download area?
—————————————————————————————————–

The binary packages of the recent, 0.2.x, releases are divided into a number of flavors, depending on the codecs included in the jar file:

 * cortado-ov-* - include only Ogg demuxer and Vorbis decoder,
 * cortado-ovt-* - include Ogg demuxer and Theora and Vorbis decoders,
 * cortado-mmjs-* - include multipart demuxer, JPEG, Smoke and mulaw decoders.

The flavors are additionally divided into packages containing full debugging info (filenames containing “-debug”) and production packages with the debugging info stripped (filenames containing “-stripped”).

About Fluendo
=============

What is Fluendo ?
—————–

Fluendo is a company sponsoring and developing both GStreamer and Flumotion.  Fluendo is *not* the name of the streaming server.

Unanswered Questions
====================

If you feel bold and giddy today, you can send us a question by mail if you think it should be in the FAQ.  Better yet - provide us with the answer as well and we’ll review and place it in the FAQ ! How’s that for collaboration ?

Tags : ,

iptables 开放rhel端口

Filed under: 计算机技术 | No Comments »
Posted on

安装red5的时候发现关键在于端口没有开放。。。。

永久性的修改iptables:

#vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8443 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 5080 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8088 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 1935 -j ACCEPT

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 9035 -j ACCEPT

以上几个端口是red5使用的,放开他们,red5测试成功。

Tags : ,

red 5 rhel安装问题

Filed under: Uncategorized | No Comments »
Posted on

想在服务器上装red5,始终无法装上,后来发现一篇suse的安装文档,还是比较有用,解决了不少问题,关键就是要把编译好的文件重新拷贝到/opt/red5/文件夹中:

Installing Red5 on SUSE Linux 10.2

This howto was provided by Jake Hilton. If you see any errors please let him know so that they can be corrected. This was recently updated to reflect the new version of opensuse which is 10.2. These instructions are generic enough to work on many different linux operating systems.

The following are steps used to get Red5 running on SUSE Linux 10.2. This is the development version of red5.

Before beginning this make sure you are running these commands as root.

  1. You can create a red5 user to run this under if you don’t plan on using any ports below 1000. If you need red5 to bind to ports below 1000 you need to run it as root. With the red5 user disallow login access and make the red5 user part of the root group.

  2. Make sure you have downloaded and installed the latest JDK from java.sun.com

    • For this tutorial just download the .bin file. All you need to do is change the permissions of that bin file to 755 with

      chmod 755 jdk-1_6_0

      and then execute it.

      ./jdk-1_6_0

      or something similar. Then once it’s done you just copy the contents of the folder it made and put them in /usr/java/jdk1.6.0

    • Then set your JAVA_HOME variable. It may have to be set two different ways. First way:

      JAVA_HOME=/usr/java/jdk1.6.0

      and the second way.

      export JAVA_HOME=’/usr/java/jdk1.6.0′
  3. Install Apache Ant 1.7. You may have to download that as well. Install the binary for it.

    • Download and unzip the file. Then copy the contents to a directory, something like /usr/ant. Then set your ANT_HOME variable. If it doesn’t work then don’t worry about it. We will not be using that pointer in this tutorial.

  4. Once java and ant are all set up you simply pull the latest trunk for red5 to your box.

    svn co http://svn1.cvsdude.com/osflash/red5/java/server/trunk red5-trunk

    That will create a folder in your current directory called red5-trunk.

  5. Navigate to the red5-trunk directory and run

    /usr/ant/bin/ant

    That will build the project on your machine.

  6. At this point you will need to create a red5 directory in the opt directory.

    mkdir /opt/red5
  7. Then you will want to copy the contents of the dist(distribution) folder to /opt/red5 like so

    cp -R red5-trunk/dist/* /opt/red5/
  8. We need to fix the permissions on the /opt/red5 directory like so:

    chown -R red5 /opt/red5
  9. In addition we need need to fix the permissions on the red5.sh file like so:

    chmod 755 red5.sh
  10. To run the server you have a few options using the red5.sh file. Navigate to /opt/red5 to make sure you are in the proper location. Then run the server by either running

    sh red5.sh &

    or

    ./red5.sh &

    . This will start the red5 service manually. For a start and stop script look at the “Extra info” below.

  11. Run

    netstat -ant

    and verify the correct ports are being bound to. You may need to edit the red5.properties file in the /opt/red5/conf directory if you can’t connect to your server from an external location. Try to connect to the server before you modify the properties file because you may be able to connect to it with no problems.

  12. Extra info: The version compiled from source does not come with a start/stop script. I have put together one that will work with this how-to. If you run red5 as a different user this script will have to be tweaked. To put this script on your system do the following logged in as root:

    cd /etc/init.d/ touch red5 chmod 755 red5 vi red5

    then when you are in the red5 file push “i” to start inserting into that file and then put this code in by copying it and then pasting it with a right click of the mouse:

    #! /bin/sh # # Author: Jake Hilton <red5@jakehilton.com> # /etc/init.d/red5 # # Check for missing file RED5_DIR=/opt/red5 test -x $RED5_DIR/red5.sh || exit 5  case “$1″ in     start)         echo -n “Starting Red5 Service”         echo -n ” ”         cd $RED5_DIR         su -s /bin/bash -c “$RED5_DIR/red5.sh &” red5         sleep 2         ;;     stop)         echo -n “Shutting down red5”         echo -n ” ”         su -s /bin/bash -c “killall -q -u red5 java” red5         sleep 2         ;;     restart)         ## Stop the service and regardless of whether it was         ## running or not, start it again.         $0 stop         $0 start         ;; esac

    Then you can simply start, stop, and restart red5 from that script by typing:

    /etc/init.d/red5 start /etc/init.d/red5 stop /etc/init.d/red5 restart

按照上面的作,解决了不少问题,但是新问题又出来了:

[DEBUG] [main] org.red5.webapps.admin.UserDatabase - Shutdown Admin db
[DEBUG] [main] org.red5.webapps.admin.UserDatabase - Error in db shutdown
java.sql.SQLNonTransientConnectionException: Database ‘Admin’ shutdown.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
上面的说法大概是说red5会用derby的数据库,在关闭Admin数据库的时候出错了。

继续找解决方法。。。。

Tags :

昆明公交车连环爆炸事件

Filed under: 新闻图片 | No Comments »
Posted on

今天早上正好要走人民西路去西山区政府办事情,开车至小西门龟背立交处,发现交通警察已经封锁了入口,之前不知道是什么原因,问了交警,交警没有说什么,只是说可能要封锁比较长的时间。我们只能绕了一个大圈到了人民西路,又发现去昌源路的方向也是一堆警察封锁了路口,不禁一阵诧异。

后来听人说才知道连续有3辆车爆炸,其中两辆都是54路公交车,2四4伤。一听到这个消息,我的第一反应就是赶紧给家里打电话,让他们今天不要出门了。回来之后上网一查发现还有最新的报道(我之前以为消息还会被封锁)。昨天在msn首页上还看到大标题:近期是恐怖活动发生的高危期,没想到今天就发生事情了,而且是发生在我所在的城市。这不禁让我担心起来,以后如果出门坐公交车都不安全的话,这个社会该是什么样子,一个人人自危的社会如何构建和谐?

制造这次爆炸的凶手,这种无视人生命的人是社会的渣滓,最需要得到谴责。反过来我们反思一下自己,为什么08年会有如此多的天灾人祸,天灾不可避免,人祸的根源又在于何处呢?

以下是转载过来的一些相关报道:

7月21日7时许,开往岷山54路公交车,车牌云AS2035由东向西行驶至潘家湾人民西路与西昌路交叉口,公交车停靠边在站台时突然发生爆炸。致1人死亡,1人重伤,9人轻伤,车箱两侧玻璃全部破碎,部分座位变形。

  同日早上8时许,另一辆54路公交车,车牌为云AS1822,由东向西行驶至人民西路与昌源中路交叉路口时爆炸。致1人当场死亡,4人受伤。

  爆炸发生后,公安、卫生部门迅速启动应急预案,云南省委、常委、市委书记仇和,市长张祖林及有关领导及时赶到现场指挥处置,迅速将伤者送往邻近医院救治。对现场实施交通管制,对爆炸车辆开展全方位搜排爆。全面开展现场侦察、调查取证等工作。市政府已经安排有安部门领导赶赴医院看望并慰问受伤人员。

————————————————————–

昆明连续发生3起公交车爆炸事件(组图)

爆炸公交车旁边有很多碎玻璃。 云南网 冯忠摄

爆炸公交车旁边有很多碎玻璃。 云南网 冯忠摄

公交车在昆明市人民西路潘家湾附近发生爆炸。 云南网 冯忠摄

公交车在昆明市人民西路潘家湾附近发生爆炸。 云南网 冯忠摄

爆炸现场。 云南网 冯忠摄

爆炸现场。 云南网 冯忠摄

爆炸现场。 云南网 冯忠摄

爆炸现场。 云南网 冯忠摄

中广网昆明7月21日独家消息 据中央人民广播电台中国之声10点50连线记者陈鸿燕报道,云南省昆明市今天上午连续发生了3起公交车爆炸事件。

今晨7:07分,昆明市中心人民西路潘家湾车站发生了公交车爆炸案,54路公交车在横穿昆明东西向时突然发生爆炸。据现场的目击者向记者介绍,公交车发生爆炸之后,医疗救援和公安人员立即赶到现场,从车上抬下3名伤员,二男一女,他们的伤势非常严重。记者在赶到现场之后见到了家属,家属瑟吉欧在公安人员的通知下赶到医院的,正在紧急医疗室外焦急等待。据记者了解,伤势严重的女性乘客名叫是王德芝,今年29岁,她和丈夫同时乘坐了这辆公交车,他们今天正赶回家和孩子过生日。目前事件的原因尚不清楚。

不久,记者在现场听到,同样是54路车,在沧源中路又发生了爆炸案。时间是8点10分左右,目前伤亡情况尚不清楚。同时记者了解到,在昆明市的绵山另外一个车站又发生了一起爆炸。

昆明今晨发生3起公交爆炸 已致3死14伤

中新云南新闻网七月二十一日电 (记者 蒋晨 杨晶)七月二十一日上午,在云南省昆明市人民西路潘家湾公交车站台、昌源中路口、岷山分别发生公共汽车爆炸案,截至记者发稿,已造成两人当场死亡,一人在送往医院途中死亡,十四人受伤。

案件发生后,云南省、昆明市公安机关迅速组织力量赶赴现场,组成专案组开展现场勘察及案侦工作。

今天上午7点至7点10分之间,一辆开往岷山车场的54路公交车在潘家湾站发生爆炸。据两名当时在车上的乘客称,当时车上有一个不明异物,两名男子下车后,公交车就爆炸了,车体前三分之一损毁比较严重,爆炸时车上明火不多,浓烟很大,有刺鼻气味,车上人员有伤亡。7点20分左右,昆明市体育场至潘家湾一段,已全面交通管制。