采用 WordPress API wrapper for .Net.
在POST结构增加
public string mt_keywords; //标签
public string wp_slug; //URL别名
Post pp = new Post();
pp.title = nl.name;
pp.description = nl.txt;
pp.dateCreated = DateTime.Parse(nl.time);
TreeNode[] ts = treeType.Nodes.Find(nl.parent, true);
if (ts.Length > 0)
{
pp.categories = new string[] { ts[0].Text };
}
pp.wp_slug = nl.p;
string[] stags = nl.p.Split(‘-’);
string strtag = “”;
for (int i = 1; i < stags.Length;i++ )
{
strtag = stags[i] + “,” + strtag;
}
pp.mt_keywords = strtag;
string s = wp.NewPost(pp, true);
将别名分拆后组成TAG
然后发布,返回BLOGID号
标签:c++, rpc, word, wordpress, xml
WordPress 2.7 XML-RPC wrapper for .Net
http://www.orbifold.net/default/?p=1721
XML-RPC.Net
http://www.xml-rpc.net/
WordPress 2.5 XML-RPC wrapper for .Net
http://www.orbifold.net/default/?p=1003
Using Wordpress XMLRPC services | PHP Made Simple
http://www.phpmadesimple.info/2009/07/05/using-wordpress-xmlrpc-services/
Weblog Client « WordPress Codex
http://codex.wordpress.org/Weblog_Client
3.4. C# XML-RPC Tutorial
http://www.wordtracker.com/docs/api/ch03s04.html
CodeProject: Coding Blog Engine with MetaWeblog API Support and Using it with Windows Live Writer. Free source code and programming help
http://www.codeproject.com/KB/XML/MetaWeblogAPI.aspx?display=Print
WP-XML-RPCLib2 – SharpLab.
http://blog.sharplab.net/computer/cprograming/wp-xml-rpclib/3015/
WP-XML-RPCLib2 – SharpLab.
http://blog.sharplab.net/computer/cprograming/wp-xml-rpclib/computer/cprograming/wp-xml-rpclib/3015/
CodeProject: Coding Blog Engine with MetaWeblog API Support and Using it with Windows Live Writer. Free source code and programming help
http://www.codeproject.com/KB/XML/MetaWeblogAPI.aspx
MetaWebLog API and Blog Writers – Rick Strahl’s Web Log
http://www.west-wind.com/WebLog/posts/23858.aspx
Windows Live Writer Beta 2 Now Available
http://www.gtrifonov.com/blog/2007/06/06/Windows_Live_Writer_Beta_2_Now_Available.aspx
Coding blog engine with MetaWeblog API support and using it with Windows Live Writer
http://www.gtrifonov.com/blog/2006/11/27/Coding_blog_engine_with_MetaWeblog_API_support_and.aspx
15 Seconds : Programming for the Palm Part 2 – The Synchronization Process
http://www.15seconds.com/Issue/030722.htm
C# blog client
http://www.aspcode.net/C-blog-client.aspx
The MetaBlog API (Creating and Editing Posts)
http://geekswithblogs.net/Tariq/archive/2009/07/05/133264.aspx
public string wp_slug;
XML-RPC Request Format
http://www.tutorialspoint.com/xml-rpc/xml_rpc_request.htm
3.4. C# XML-RPC Tutorial
http://www.wordtracker.com/docs/api/ch03s04.html
Request from client does not contain valid XML
好好的程序,突然不能发布了。报告这个错误
上网搜索下:
代码是:
public XmlRpcRequest DeserializeRequest(TextReader txtrdr, Type svcType) { if (txtrdr == null) throw new ArgumentNullException(“txtrdr”, “XmlRpcSerializer.DeserializeRequest”); XmlDocument xdoc = new XmlDocument(); xdoc.PreserveWhitespace = true; try { xdoc.Load(txtrdr); } catch (Exception ex) { throw new XmlRpcIllFormedXmlException( “Request from client does not contain valid XML.”, ex); } return DeserializeRequest(xdoc, svcType); }
搞了半天,又是抓包,又是下载WINDOWS LIVE WRITE试验
最后发现是COMODO搞鬼
我运行TOOLS死活不提示是否可以运行,是否可以联网
就那么悄然的卡掉了
而BIN目录下的也是时而正常时而不正常
即使手工加入规则也没法
最后卸载COMODO。OK。
标签:com, comodo, rpc, xml20080326 gzip ICSharpCode 日历控件
http://www.yippeesoft.com
GZip
加入ICSharpCode.SharpZipLib.dll的引用,在#Develop的安装目录下的\\SharpDevelop\\bin目录下。然后在程序中使用using语句把GZip类库包含进来。
由于GZip没有BZip2的简单解压缩方法,因此只能使用流方法来进行解压缩。具体的方法见程序的说明。
编译程序,然后在命令行方式下输入GZip 文件名(假设建立的C#文件是GZip,就可以生成压缩文件;输入GZip -d 文件名,就会解压出文 件来(-d是用来表示解压,你也可以使用其他的符号)。
using System;
using System.IO;
using ICSharpCode.SharpZipLib.GZip;
class MainClass
&leftsign;
public static void Main(string[] args)
&leftsign;
if (args[0] == "-d") &leftsign; // 解压
Stream s = new GZipInputStream(File.OpenRead(args[1]));
//生成一个GZipInputStream流,用来打开压缩文件。
//因为GZipInputStream由Stream派生,所以它可以赋给Stream。
//它的构造函数的参数是一个表示要解压的压缩文件所代表的文件流
FileStream fs = File.Create(Path.GetFileNameWithoutExtension(args[1]));
//生成一个文件流,它用来生成解压文件
//可以使用System.IO.File的静态函数Create来生成文件流
int size = 2048;//指定压缩块的大小,一般为2048的倍数
byte[] writeData = new byte[size];//指定缓冲区的大小
while (true) &leftsign;
size = s.Read(writeData, 0, size);//读入一个压缩块
if (size > 0) &leftsign;
fs.Write(writeData, 0, size);//写入解压文件代表的文件流
&rightsign; else &leftsign;
break;//若读到压缩文件尾,则结束
&rightsign;
&rightsign;
s.Close();
&rightsign; else &leftsign; // 压缩
Stream s = new GZipOutputStream(File.Create(args[0] + ".gz"));
//生成一个GZipOutputStream流,用来生成压缩文件。
//因为GZipOutputStream由Stream派生,所以它可以赋给Stream。
FileStream fs = File.OpenRead(args[0]);
/生成一个文件流,它用来打开要压缩的文件
//可以使用System.IO.File的静态函数OpenRead来生成文件流
byte[] writeData = new byte[fs.Length];
//指定缓冲区的大小
fs.Read(writeData, 0, (int)fs.Length);
//读入文件
s.Write(writeData, 0, writeData.Length);
//写入压缩文件
s.Close();
//关闭文件
&rightsign;
&rightsign;
&rightsign;
使用ICSharpCode.SharpZipLib.dll实现在线解压缩
http://blog.csdn.net/MaleLionOfWakeUp/archive/2008/03/18/2193480.aspx
http://www.dc9.cn/post/Python-gzcompress-php-net.html
总算在C#.NET,Python,Ruby上实现了php的zlib的gzcompress函数
PRB: 工具箱或菜单项是 VisualBasic IDE 中缺少
症状
当您打开 VisualBasic 项目, 您将不能查看工具箱或几项是从菜单选项丢失。
回到顶端
原因
此问题的一个可能的原因是注册表损坏。
回到顶端
解决方案
要重置为其默认设置, 选项请按照下列步骤操作:
1. 右击主菜单栏并选择 自定义 。 自定义 对话框打开。
2. 选择 工具栏 选项卡并单击 Reset 按钮。
3. 自定义 对话框保持打开, 右击要在主菜单栏 (例如, 文件、 编辑和等等), 重置, 然后选择 重置 选项所有菜单选项。
4. 关闭 自定义 对话框。
I can no longer make exe\’s in VB6. The Make exe item on the File menu is
grayed out. I have been creating exe files for at least a year on this
machine, but suddenly no go. I did have a few VB crashes when I was working
on creating an OCX. I\’m guessing that one of these crashes caused the
problem. The only way to make an executable now is to have my project in a
project group. I can then Make Project Group and select the project that I
want. It\’s a pain for project groups with lots of projects, however.
http://support.microsoft.com/kb/266747/en-us
http://blog.csdn.net/kimsoft/archive/2006/05/24/753225.aspx
[2008-03-22更新]一个JavaScript WEB日历控件,支持IE6,FireFox,可支持不同语言版本,目前支持中英文
http://www.notii.com/2007/05/top-5-javascript-framework.html
Top 5 Javascript 框架
ExtJS(http://extjs.com/)和DWR( http://www.getahead.ltd.uk/dwr/)。
http://www.open-open.com/67.htm
Java开源AJAX框架
http://blog.csdn.net/cityhunter172/archive/2006/11/28/1417752.aspx
推荐兼容 IE、 FireFox 的 javascript 日历控件
http://blog.csdn.net/cityhunter172/archive/2006/11/28/1417752.aspx
http://code.google.com/p/kimsoft-jscalendar/downloads/list
http://dev.csdn.net/author/Jason009/65c69cc4e34a4ef783c45add211105e0.html
gzip压缩算法
http://ms.mblogger.cn/downmoon/posts/19951.aspx
http://hi.baidu.com/huohuoluo/blog/item/122bf562f40946dde6113a42.html
一个不错的js日期控件
http://www.cnblogs.com/xgpapa/archive/2007/08/07/846985.html
超级简单好用的JS日期控件
http://hi.baidu.com/sunweiliang/blog/item/d181d5b49b4d7c778ad4b2c5.html
js 日期控件
http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=121&threadID=36592
JS日期控件
http://www.iusesvn.com/html/02/9502-2640.html
SVN总结
20080324 ICSharpCode GZipStream
http://www.yippeesoft.com
http://www.cnblogs.com/DreamlikeAttic/archive/2006/07/07/445643.html
在Pocket PC/Smartphone智能设备上编写压缩程序(特别简单,任何人都能简单使用)
2.0里内置了DeflateStream GZipStream压缩算法,没有压缩比的选择,实验了一下一个49,934字节的文件,用gzipstream压缩后35,964,用deflatestream压缩后35,946,用winrar3.62最大压缩26,598,7-zip也可以压缩成gzip,用7-zip选择压缩成gzip并最大压缩后26,485,比winrar都强。显得2.0自带的这个算法真是没用啊。
但是好玩的是,.net里用gzipstream却可以解压用7-zip压缩的gz,这样就可以用7-zip压缩成gz给工程用,比如作成资源,然后光用.net的解压就可以了
xml文件操作时挺有用,可以压缩减少文件尺寸。
压缩:
public static string Compress(string code_type, string text)
&leftsign;
byte[] buffer = Encoding.GetEncoding(code_type).GetBytes(text);
MemoryStream ms = new MemoryStream();
using (GZipStream zip = new GZipStream(ms, CompressionMode.Compress, true))
&leftsign;
zip.Write(buffer, 0, buffer.Length);
&rightsign;
ms.Position = 0;
MemoryStream outStream = new MemoryStream();
byte[] compressed = new byte[ms.Length];
ms.Read(compressed, 0, compressed.Length);
byte[] gzBuffer = new byte[compressed.Length];
System.Buffer.BlockCopy(compressed, 0, gzBuffer, 0, compressed.Length);
return Convert.ToBase64String(gzBuffer);
&rightsign;
解压:
public static string Decompress(string code_type, string compressedText)
&leftsign;
byte[] gzBuffer = Convert.FromBase64String(compressedText);
using (MemoryStream ms = new MemoryStream())
&leftsign;
int msgLength = BitConverter.ToInt32(gzBuffer, 0);
ms.Write(gzBuffer, 0, gzBuffer.Length );
byte[] buffer = new byte[msgLength];
ms.Position = 0;
using (GZipStream zip = new GZipStream(ms, CompressionMode.Decompress))
&leftsign;
zip.Read(buffer, 0, buffer.Length);
&rightsign;
return Encoding.GetEncoding(code_type).GetString(buffer);
&rightsign;
著名的压缩库ICSharpCode.SharpZipLib.GZip我是没有试出来,我认为他没有提供这种不包含头的压缩功能。我压缩出来的都是包含头的。于是我再次寻找到了zlib.net.dll这个是从http://www.zlib.net/官方网站找到的,果然什么东西都得用官方的!
那么代码就是这样的
byte[] byteData = System.Text.Encoding.UTF8.GetBytes("http://www.dc9.cn");
MemoryStream ms = new MemoryStream();
Stream s = new ZOutputStream(ms, 9);
s.Write(byteData, 0, byteData.Length);
s.Close();
byte[] compressData = (byte[])ms.ToArray();
ms.Flush();
ms.Close();
FileStream fileStream = new FileStream("C:\\\\dc9.cn.zip", FileMode.Create, FileAccess.Write);
Console.Write(System.Convert.ToBase64String(compressData, 0, compressData.Length));
fileStream.Write(compressData, 0, compressData.Length);
fileStream.Flush();
fileStream.Close();
我最先想到的是.net framework2.0以来新加入的一个System.IO.Compression;这里面的GZipStream 不提供level,不提供无头压缩。很郁闷。这个压缩出来是直接能用winrar解压的。带头的才能winrar/winzip解压。
FileStream fileStream = new FileStream("C:\\\\dc9.cn.zip",FileMode.Create,FileAccess.Write);
MemoryStream ms = new MemoryStream();
GZipStream compressionStream = new GZipStream(ms,CompressionMode.Compress);
StreamWriter writer = new StreamWriter(compressionStream);
writer.Write("http://www.dc9.cn");
writer.Close();
fileStream.Write(ms.ToArray(), 0, ms.ToArray().Length);
fileStream.Flush();
fileStream.Close();
using ICSharpCode.SharpZipLib.GZip;这个我懒得说了,也是带头的
关键就是
FileStream destinationStream = new FileStream("C:\\\\dc9.cn.zip",FileMode.OpenOrCreate);
GZipOutputStream outStream = new GZipOutputStream(destinationStream);
outStream.Write(buffer, 0, buffer.Length);
outStream.Flush();
outStream.Finish();
20080324 X509Certificate cer ICSharpCode
http://www.yippeesoft.com
http://support.microsoft.com/kb/318217/zh-cn
PRB: X509Certificate 支持仅 DER Encoded 证书
http://blog.joycode.com/mvm/archive/2006/03/25/73468.aspx
X509Certificate代码示例 (.NET 1.1)
http://blog.csdn.net/nutian/archive/2006/10/26/1352099.aspx
[C#]使用HttpWebRequest请求远端服务器时如何加载SSL证书
http://www.cnblogs.com/zhifengwu1211/archive/2007/04/27/729360.aspx
在C#中使用 makecert 创建自签名的证书
http://www.microsoft.com/china/technet/security/guidance/secmod27.mspx
如何使用来自 ASP.NET 的客户端证书调用 Web 服务
http://www.bzsh.cn/software/p155/A15519010.shtml
获取已有证书的信息c#有提供方法,但如何根据客户参数与公私钥对生成证书呢??string certificate = @"e:/xxx.cer";
x509certificate cert = x509certificate.createfromcertfile(certificate);
string resultstrue = cert.tostring(true);
console.writeline(resultstrue);
http://msdn2.microsoft.com/zh-cn/library/system.security.cryptography.pkcs.signerinfo.countersignerinfos(VS.80).aspx
SignerInfo.CounterSignerInfos 属性
C#中,byte为无符号8位整数,而Sbyte为有符号8位整数,对应java中的byte类型。
将 byte 转为 sbyte。原理很简单,就是当 byte 小于 128 时其值保持不变,大于等于 128 时就将其减去 256。代码如下:
sbyte[] mySByte = new sbyte[myByte.Length];
for (int i = 0; i < myByte.Length; i++)
&leftsign;
if (myByte[i] > 127)
mySByte[i] = (sbyte)(myByte[i] – 256);
else
mySByte[i] = (sbyte)myByte[i];
&rightsign;
http://hi.baidu.com/kissrun/blog/item/ea97d218bfbff2b74bedbc33.html
用ICSharpCode.SharpZipLib.Zip实现下载整个文件目录(小文件推荐)
2) 你可以使用第三方的类库和工具包
http://www.icsharpcode.net/opensource/nziplib/default.asp
用SharpZipLib(#ZipLib)压缩MemoryStream
SharpZipLib是一个开源的用C#编写的Zip,GZip,Tar and BZip2库,用于C#的开发.可以在http://www.icsharpcode.net/OpenSource/SharpZipLib/得到.
压缩
为了方便起见,我们添加IO,Text和SharpZipLib名字空间
using System;
using System.IO;
using System.Text;
using ICSharpCode.SharpZipLib.BZip2;
首先,开始压缩.我们创建一个MemoryStream
MemoryStream msCompressed = new MemoryStream();
这次我使用Bzip2,你可用使用zip或tar,然而,他们需要实现一个虚假的文件.选择BZip2而不是Gzip是由于大的数据会压缩的小些.以花费较大的报头为代价.
接下来,我们创建一个BZip2 output stream对象,容纳MemoryStream.
BZip2OutputStream zosCompressed = new BZip2OutputStream(msCompressed);
现在我来解说上面报头的含义.在我的实际测试中使,用GZip时,压缩1字节数据需要28字节的额外报头,那些额外的字节是不能被压缩的.用BZip2时,需要36字节的额外报头.实际上,用BZip2可以压缩一个12892字节的源文件到2563字节,有大概75%的压缩率.另一个测试是从730字节压缩到429字节,最后一个测试是174字节到161字节.显然,任何压缩需要额外的可用空间.
下面我们将数据写入BZip2OutputStream
string sBuffer = "This represents some data being compressed."
byte[] bytesBuffer = Encoding.ASCII.GetBytes(sBuffer);
zosCompressed.Write(bytesBuffer, 0, bytesBuffer.Length);
zosCompressed.Finalize();
zosCompressed.Close();
由于要用到IO和stream方法,要使用字节数组替代字符串.所以我们用字节数组作为输出,然后将压缩的流写入内存流.
bytesBuffer = msCompressed.ToArray();
string sCompressed = Encoding.ASCII.GetString(bytesBuffer);
这样内存流中包含了压缩过的数据,我们将数据用字符数组输出,然后转换成字符串.要注意,这个字符串是乱码,不可读的.如果你想查看数据,我用的方法是把它转换为Base64编码的数据,但是这样会增加大小.运行程序使43字节的未压缩数据变成74字节的压缩数据,如果用base 64编码,会得到100字节的结果:
QlpoOTFBWSZTWZxkIpsAAAMTgEABBAA+49wAIAAxTTIxMTEImJhNNDIbvQ
aWyYEHiwN49LdoKNqKN2C9ZUG5+LuSKcKEhOMhFNg=
解压缩
MemoryStream msUncompressed =
new MemoryStream(Encoding.ASCII.GetBytes(sCompressed));
BZip2InputStream zisUncompressed = new BZip2InputStream(msUncompressed);
bytesBuffer = new byte[zisUncompressed.Length];
zisUncompressed.Read(bytesBuffer, 0, bytesBuffer.Length);
zisUncompressed.Close();
msUncompressed.Close();
string sUncompressed = Encoding.ASCII.GetString(bytesBuffer);
这样sUncompressed将被解压到原始的字符串.文件也是相同的原理.
一个在.net平台上易用的开源制图组件
ZedGraph是一个用来创建2D线,条,饼图的类库,windows窗口控件和asp,asp.net控件.类库提供了高的适用性,几乎图形的每个外表都能被用化修改,图形的默认属性值使其用起来很方便.
ZedGraph源码,示例可用在zedgraph.org上找到.
标签:arp, cer, code, icsharpcode, rpc20080306 c# substring xmlrpc
http://www.yippeesoft.com
如以下这段代码:
string first=”纪念12″;
string second=first.Substring(0,2);
string third=first.Substring(1,2);
string fourth=first.Substring(2,2);
程序运行后 second=”纪念” , third=”念6″ , fourth=”6/”
而不是我原来预想的 second=”纪” , third=”*乱码*” , fourth=”念”
开发中经常遇到,字符串过长,无法完全显示的问题
string first=”纪念6/4″;
byte[] bytes = System.Text.Encoding.Default.GetBytes(first);
MessageBox.Show(System.Text.Encoding.Default.GetString(bytes,0,2));
MessageBox.Show(System.Text.Encoding.Default.GetString(bytes,1,2));
MessageBox.Show(System.Text.Encoding.Default.GetString(bytes,2,2));
这时候就需要截取我们所需要的长度,后面显示省略号或其他字符。
由于中文字符占两个字节,而英文字符占用一个字节,所以,单纯地判断字符数,效果往往不尽如人意
下面的方法通过判断字符的类型来进行截取,效果还算可以:)
如果大家有其他的解决方法欢迎贴出来,共同学习:)
**********************************************************************
private String str;
private int counterOfDoubleByte;
private byte b[];
/**
* 设置需要被限制长度的字符串
* @param str 需要被限制长度的字符串
*/
public void setLimitLengthString(String str)&leftsign;
this.str = str;
&rightsign;
/**
* @param len 需要显示的长度(<font color=”red”>注意:长度是以byte为单位的,一个汉字是2个byte</font>)
* @param symbol 用于表示省略的信息的字符,如“…”,“>>>”等。
* @return 返回处理后的字符串
*/
public String getLimitLengthString(int len, String symbol) throws UnsupportedEncodingException &leftsign;
counterOfDoubleByte = 0;
b = str.getBytes(“GBK”);
if(b.length <= len)
return str;
for(int i = 0; i < len; i++)&leftsign;
if(b[i] < 0)
counterOfDoubleByte++;
&rightsign;
if(counterOfDoubleByte % 2 == 0)
return new String(b, 0, len, “GBK”) + symbol;
else
return new String(b, 0, len – 1, “GBK”) + symbol;
&rightsign;
Sample code as follows:
string ss=”asdfafadfadfalskdhoweifaklsenfoweicakmsndva;woeifhakjlsdnvalkwfihfh”;
byte[] bData = Encoding.Unicode.GetBytes( ss );
Stream ss2 = new MemoryStream( bData, true );
ss2.Read( bData, 0, bData.Length );
1)SOAP
SOAP,全名是Simple Object Access Protocol,是Microsoft提交给W3C的Web Service协议。我觉得SOAP的两个最大的好处是:
* 协议的可扩展性(Extension Mechanism)
* 良好的工具支持
SOAP的消息称为一个SOAP Envelope,包括SOAP Header和SOAP BODY。其中,SOAP Header可以方便的插入各种其它消息来扩充Web Service的功能,比如Security(采用证书访问Web Service),SOAP BODY则是具体的消息正文,也就是Marshall后的信息。
SOAP调用的时候,也就是向一个URL(比如http://ws.invesbot.com/stockquotes.asmx?WSDL)发送HTTP Post报文,调用方法的名字在HTTP Request Header SOAP-Action中给出,接下来就是SOAP Envelope了。
服务端接到请求,执行计算,将返回结果Marshall成XML,用HTTP返回给客户端。
SOAP的工具支持非常好,比如在.NET里,可以用WSDL.exe非常方便的为一个Web Service生成本地Proxy(Proxy模式),这样,你的程序就像调用本地API一样了,而由Framework为你完成Marshall和传送的工作。
2)XMLRPC
XMLRPC ,我记着看过一段Don Box的采访,他说当时Microsoft费了7年的时间(大概,记不清楚了)才成功的把SOAP提交给W3C,而Dave Winer(眼熟吧,RSS’s Father)借鉴SOAP实现了一个更轻量级的协议,那就是XMLRPC。以前曾经大概看过XMLRPC,XMLRPC就是SOAP的简化和改进,比如说:
* Marshall类型的支持有限
* 取消HTTP Header中的SOAP Action,而将Method Name也放到XMLRPC的Body中
* 传送的XML信息中没有Header,只有Body。
XMLRPC相比于SOAP最大的优势就是它的简单,弱点就是扩展性弱,另外,工具支持也不如SOAP那般正规,感觉起来,一个像正规军,一个像游击队。不过,游击队才有作战灵活的特点
标签:c++, rpc, string, xml