JavaScript File Selection Simulation

Context The build-in file selection elements of browsers are ugly and cannot be customized easily. If developer need to change the appearance of the file selection element, it’s almost impossible because of some security issues. So I wrote this script to simulate the file input selection by javascript so that the end user can click… Read More »

新浪微博RSS生成器Ver 1.0 同步Twitter帐号

同时在用twitter和新浪微博,在twitter上主要看贴为主,在新浪微博上发帖比较多。于是就想到是否搞一下将新浪微博同步到twitter上。搜索了下,发现月光博客上提供了解决方案,不过稍有遗憾的是没有图片的同步。于是就自己用asp.net实现了下,用下来感觉还行,所以分享一下,同时提供源代码,如果有定制开发的朋友可以修改源码,但如果再发布时候,请注明出处,先谢谢了! 下载 新浪微博RSS生成器Ver 1.0 发布包 新浪微博RSS生成器Ver 1.0 源代码 部署步骤 首先,需要一个.Net Framework 2.0以上的IIS环境。 将SinaFeed_Bin_ver_1.0.zip解压以后,部署成网站或者虚拟目录。 将包里面的db文件夹赋予network service以及aspnet用户可写权限,偷懒且安全的话,给everyone即可。 运行起来的话,应该会是个Authentication Error的错误,这是正常的,因为接下来要配置下。 同步原理 用FeedBurner绑定Twitter,在FeedBurner中配置Rss源到SinaFeed应用。当FeedBurner每次来ping的时候,SinaFeed抓取新浪微博的内容,检查是否已经抓取过,把结果保存在Access数据库中,返回Rss给FeedBurner。 实现功能 同步新浪微博到Twitter。 包含图片链接,可配置。 包含转发原文及作者。 配置 在Web.Config里,有以下几个可以配置的选项: 代理服务器相关,例如你的网站访问外网需要代理的话,请设置一下配置: UseProxy , ProxyAddress, ProxyPort, ProxyDomain, ProxyUserName, ProxyUserPassword AuthCodeConfig 配置在应用里的授权码,自己设定一个,例如abc,当外面请求RSS的时候,需要在Url传递一个AuthCode,要和所配置的(abc)一直,程序才会返回结果,否则报Authentication Error错误。 AllowedUserIds 允许被处理新浪微博Id,如何得到你的Id?只要点击“关注”,在Url里就会出现你的Id,例如,我的Id是:1650422717 。SinaFeed支持多个Id,用逗号(,) 分割。 RssChannelUrl 所生成的Rss的ChannelUrl RssBaseGuid 所生成的Rss的唯一标识 RssTitle 所生成的Rss的标题 RssDescription 所生成的Rss的描述 使用步骤 例如,你部署在www.example.com上,虚拟目录为SinaFeed,你的新浪Id为1650422717,AuthCodeConfig你配置了jinweijiesinafeed那么 访问 就可以得到用户1650422717的Rss了。 另外的一些可传参数的配置: UseOriginalImage 是否使用原来的大图片,默认True,如果False的话,将会使用新浪微博的缩略图。… Read More »

Add UTF-8 Signature(BOM) at the Start of Response File

In ASP.Net, if you write a file to the client using code like this: HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader( "content-disposition", string.Format( "attachment; filename={0}", fileName ) ); HttpContext.Current.Response.ContentType = "application/ms-excel"; using( StringWriter sw = new StringWriter() ) { using( HtmlTextWriter htw = new HtmlTextWriter( sw ) ) { // Create a form to contain the grid Table table =… Read More »

Preload Next Image in Thickbox

Thickbox is a great image viewer plugin for jQuery. This post is to show how to preload the next image in Thickbox. My example is for wordpress, my version is . 1. Open /wp-includes/js/thickbox/thickbox.js 2. Around line 106, replace the following lines: imgPreloader = new Image(); imgPreloader.onload = function(){}; imgPreloader.onload = null; with: imgPreloader =… Read More »

Fix NextGen Gallery IPTC Encoding Error in Chinese

NextGen Gallery is a great gallery plugin for wordpress. I am using it for my blog. I found a problem that if the IPTC information is in Chinese, it cannot import properly import as meta data. After searching and searching, finally I fixed the issue by modifying the /wp-content/plugins/nextgen-gallery/lib/meta.php file in get_IPTC function: Original code:… Read More »

Solve LoadPostData Not Firing Problem

When you are developing a server side control and want to handle some postback data. You can implement the IPostBackDataHandler interface. One issue I encountered is that the LoadPostData() method does not fire when the page posting back. Even if some values of textboxes are changed. To solve this issue, you need to call the… Read More »

ASTreeView 1.5.9 Release Notes

In ASTreeView, two small issues have been fixed: 1. Fixed error when the depth of treeview exceeds 20. 2. Fixed a typo error with “checkbox”. Download: