作者归档:℃冻番茄

sablogClient 在ubuntu 9.04 mono环境下正常运行

一直以来都以为mono只能运行控制台程序,今天把昨天做的sablogClient放到ubuntu运行,没想到还能打开

但是刚开始,因为读取不到xml文件而报错,后把xml放在home下用户根目录下就ok了

另org.phprpc.client.dll 用的是3.5下面的,非mono下的

 

screenshot-2.png

SaBlogClient 1.0发布(支持sablog1.6和2.0)

现已支持sablog 1.6 和sablog 2.0,如其它bug问题,欢迎留言!

需安装Microsoft .NET Framework 3.5 安装客户端时自动下载安装Microsoft .NET Framework 3.5

客户端下载后直接安装使用,第一次使用时,请先点配置,输入php端地址 管理员用户名及密码及可。

php服务端,直接解压后上传至sablog 根目录下,打开http://您的网址/client/

能打开则表示安装服务端成功!

 无标题.jpg

客户端下载

sablogclientsetup.rar

php服务端下载

client.rar

sablog client 正在开发中

今天正在用c#写一个基于phprpc+sablog 1.6的winform

开发环境:vs 2008 c# 3.5 php5

目前完成部分:

1,vs2008设计界面,现已完工

2,博客管理员登陆及退出

3,把用户名密码加密加上服务器url地址保存在一个xml格式的配置文件中

4,自动获取日志的分类

5,php服务端完成用户登陆,用户退出,判断用户登陆状态及获取日志分类信息

6,timer通过读取配置完成,开启自动存稿间隔时间

未完成或正在开发的部分:

1,自动存稿功能

2,读取草稿功能

3,最重要的,发布日志部分

 

sablogclient.png2.png3.png4.png

小试一下PHPRPC php做服务器端c#做客户端

今天看了下phprpc的用法,打算以后用c#做一个写针对本blog发博文的桌面程序,这样就可以想什么时候写就什么时候写了!

c#客户端源码。可执行文件在debug文件夹下面

phprpclogin.rar

vs 2008开发 c# 3.5

 d.png

PHP代码
  1. <?php   
  2. require_once(‘PHPRPC/phprpc_server.php’);   
  3.   
  4. class xzy   
  5. {   
  6.     function login($user,$pass)   
  7.     {   
  8.         if($user==‘xzy’ && $pass==‘xzy’){   
  9.             return true;   
  10.         }else{   
  11.             return false;   
  12.         }   
  13.     }   
  14.     function hi($name)   
  15.     {   
  16.         return ‘hi  ‘.$name;   
  17.     }   
  18. }   
  19. $rpc = new phprpc_server();   
  20.   
  21. $rpc->add(array(‘login’,‘hi’),new xzy());   
  22.   
  23. $rpc->start();   
  24.   
  25. ?>  

apache非80端口在Google Chrome本地调试时问题

http://127.0.0.1:102/ 的网页可能暂时无法连接,或者它已被永久性地移动到新网址。

 禁用的端口列表

解决方法就是更换一个不在禁用列表里的端口

另外:

1,    // tcpmux
7, // echo
9, // discard
11, // systat
13, // daytime
15, // netstat
17, // qotd
19, // chargen
20, // ftp data
21, // ftp access
22, // ssh
23, // telnet
25, // smtp
37, // time
42, // name
43, // nicname
53, // domain
77, // priv-rjs
79, // finger
87, // ttylink
95, // supdup
101, // hostriame
102, // iso-tsap
103, // gppitnp
104, // acr-nema
109, // pop2
110, // pop3
111, // sunrpc
113, // auth
115, // sftp
117, // uucp-path
119, // nntp
123, // NTP
135, // loc-srv /epmap
139, // netbios
143, // imap2
179, // BGP
389, // ldap
465, // smtp+ssl
512, // print / exec
513, // login
514, // shell
515, // printer
526, // tempo
530, // courier
531, // chat
532, // netnews
540, // uucp
556, // remotefs
563, // nntp+ssl
587, // stmp?
601, // ??
636, // ldap+ssl
993, // ldap+ssl
995, // pop3+ssl
2049, // nfs
4045, // lockd
6000, // X11

 

 

 

21,   // ftp data
22, // ssh


ubuntu 9.04 用wine安装fireworks等windows下的软件

1、先把win下的中文字体(主要是simsun)都拷到
$HOME/.wine/drive_c/windows/Fonts
2、再新建一个纯文本文件,例如叫 zh.reg,加入以下内容

REGEDIT4

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"Arial"="simsun"
"Arial CE,238"="simsun"
"Arial CYR,204"="simsun"
"Arial Greek,161"="simsun"
"Arial TUR,162"="simsun"
"Courier New"="simsun"
"Courier New CE,238"="simsun"
"Courier New CYR,204"="simsun"
"Courier New Greek,161"="simsun"
"Courier New TUR,162"="simsun"
"FixedSys"="simsun"
"Helv"="simsun"
"Helvetica"="simsun"
"MS Sans Serif"="simsun"
"MS Shell Dlg"="simsun"
"MS Shell Dlg 2"="simsun"
"System"="simsun"
"Tahoma"="simsun"
"Times"="simsun"
"Times New Roman CE,238"="simsun"
"Times New Roman CYR,204"="simsun"
"Times New Roman Greek,161"="simsun"
"Times New Roman TUR,162"="simsun"
"Tms Rmn"="simsun"

3、运行 regedit zh.reg

screenshot-1.png

使用zend studio自带SubVersion客户端

电脑新装的ubuntu 9.04 ,在linux下没有好用的图形svn客户端,用命令行又嫌麻烦,工作中又要用到svn来进行代码管理,以前也知道zend studio自带了svn客户端,但以前一直没用过,正好现在拿来用用,使用方法非常简单

Zend Studio默认使用CVS,可在“工具”->“首选项”->“source control”中选择Subversion即可。
配置Zend Studio客户端使用SVN:
打开“工具”->“SubVersion”->”checkout“,显示对话框
Module ULR 指要下载的源程序在源码库的位置,工作目录是下载到本机的程序存放位置,如果所填目录不存在,则程序自动创建。
用户名密码如果不需要的时候默认为空。

Subversion菜单命令说明:
Update : 将svn 源码库端文件同步到本地的工作拷贝。
Commit: 提交当前工作拷贝的更改。这个地方是有可能出现代码冲突的。最安全的解决方法,先update一下,再修改程序并Commit。
Add :将当前文件添加到版本控制库中。原来该版本不处于版本控制之下。比如新建立的一个程序或者文件。
Delete: 将当前文件从版本控制库中删除,脱离svn版本控制。
Revert : 取消当前文件的所有的本地编辑。并且解决所有的冲突状态。
Resove : 删除工作拷贝文件或目录的“冲突”状态。
Status: 查看当前工作拷贝文件和目录的状态。
Diff : 比较当前文件与源码库中相应文件的不同。
Log : 当前文件的所有修改记录,从创建开始的每一次修改都能显示出来。

注意:上面的命令也可以在Zend Studio 左侧的项目区域对多个文件或文件夹同时操作。

在修改完成之后,可以到程序运行服务器的项目目录下svn update一下,就可得到最新的程序。

Svn高级操作:
a. 解决冲突(合并别人的修改)
b. 分支与合并

screenshot.png

最近打算用python操作串口实现短信收发功能

python操作串口的库 pyserial

因为考虑到跨平台,可能要布署在linux,再结合开发的容易度,最终认为python在这方面有一定的优势

做短信收发主要是用于:

1,用户快速注册

2,用户绑定手机

3,密码安全

4,重要通知(短信群发)

Short introduction

Open port 0 at "9600,8,N,1", no timeout

>>> import serial
>>> ser = serial.Serial(0) #open first serial port
>>> print ser.portstr #check which port was really used
>>> ser.write("hello") #write a string
>>> ser.close() #close port

Open named port at "19200,8,N,1", 1s timeout

>>> ser = serial.Serial('/dev/ttyS1', 19200, timeout=1)
>>> x = ser.read() #read one byte
>>> s = ser.read(10) #read up to ten bytes (timeout)
>>> line = ser.readline() #read a '\n' terminated line
>>> ser.close()

Open second port at "38400,8,E,1", non blocking HW handshaking

>>> ser = serial.Serial(1, 38400, timeout=0,
... parity=serial.PARITY_EVEN, rtscts=1)
>>> s = ser.read(100) #read up to one hundred bytes
... #or as much is in the buffer

Get a Serial instance and configure/open it later

>>> ser = serial.Serial()
>>> ser.baudrate = 19200
>>> ser.port = 0
>>> ser
Serial<id=0xa81c10, open=False>(port='COM1', baudrate=19200, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=0, rtscts=0)
>>> ser.open()
>>> ser.isOpen()
True
>>> ser.close()
>>> ser.isOpen()
False

Be carefully when using "readline". Do specify a timeout when opening the serial port otherwise it could block forever if no newline character is received. Also note that "readlines" only works with a timeout. "readlines" depends on having a timeout and interprets that as EOF (end of file). It raises an exception if the port is not opened correctly.
Do also have a look at the example files in the examples directory in the source distribution or online.

Examples

Please look in the SVN Repository. There is an example directory where you can find a simple terminal and more.
http://pyserial.svn.sourceforge.net/viewvc/pyserial/trunk/pyserial/examples/

Parameters for the Serial class

ser = serial.Serial(
port=None, #number of device, numbering starts at
#zero. if everything fails, the user
#can specify a device string, note
#that this isn't portable anymore
#if no port is specified an unconfigured
#an closed serial port object is created
baudrate=9600, #baudrate
bytesize=EIGHTBITS, #number of databits
parity=PARITY_NONE, #enable parity checking
stopbits=STOPBITS_ONE, #number of stopbits
timeout=None, #set a timeout value, None for waiting forever
xonxoff=0, #enable software flow control
rtscts=0, #enable RTS/CTS flow control
interCharTimeout=None #Inter-character timeout, None to disable
)

The port is immediately opened on object creation, if a port is given. It is not opened if port is None.
Options for read timeout:

timeout=None            #wait forever
timeout=0 #non-blocking mode (return immediately on read)
timeout=x #set timeout to x seconds (float allowed)

 

Methods of Serial instances

open()                  #open port
close() #close port immediately
setBaudrate(baudrate) #change baudrate on an open port
inWaiting() #return the number of chars in the receive buffer
read(size=1) #read "size" characters
write(s) #write the string s to the port
flushInput() #flush input buffer, discarding all it's contents
flushOutput() #flush output buffer, abort output
sendBreak() #send break condition
setRTS(level=1) #set RTS line to specified logic level
setDTR(level=1) #set DTR line to specified logic level
getCTS() #return the state of the CTS line
getDSR() #return the state of the DSR line
getRI() #return the state of the RI line
getCD() #return the state of the CD line

 

Attributes of Serial instances

Read Only:

portstr                 #device name
BAUDRATES #list of valid baudrates
BYTESIZES #list of valid byte sizes
PARITIES #list of valid parities
STOPBITS #list of valid stop bit widths

New values can be assigned to the following attribues, the port will be reconfigured, even if it’s opened at that time:

port                    #port name/number as set by the user
baudrate #current baudrate setting
bytesize #bytesize in bits
parity #parity setting
stopbits #stop bit with (1,2)
timeout #timeout setting
xonxoff #if Xon/Xoff flow control is enabled
rtscts #if hardware flow control is enabled

 

Exceptions

serial.SerialException

 

Constants

parity:

serial.PARITY_NONE
serial.PARITY_EVEN
serial.PARITY_ODD

stopbits:

serial.STOPBITS_ONE
serial.STOPBITS_TWO

bytesize:

serial.FIVEBITS
serial.SIXBITS
serial.SEVENBITS
serial.EIGHTBITS