公告板
预览模式: 普通 | 列表

SQLite 多线程开发 线程池问题

火车采集器商业版里面采用的是SQLite数据库存储数据,以前一直被多线程操作SQLite出现错误烦恼,以前的解决办法一直是在操作数据库时lock对象。
经过今天一天的研究,终于解决了这个难题。

问题解决提示:
1.研究System.Data.SQLite.dll (http://sqlite.phxsoftware.com/)附带的source test项目内的 TestCases.cs  多线程单元测试部分代码。

需要对每个连接克隆再使用 ((ICloneable)this.Connection).Clone() as DbConnection;

2.结合使用 ta8210兄的 实现高效的数据库连接池代码(http://blog.csdn.net/ta8210/archive/2007/04/24/1582162.aspx


在多线程多插入(非事务插入)及火车头程序中表现良好。算是基本解决了这个头疼的问题

Editplus 中文正则

editplus的正则我一直觉得相对奇怪一些
[^\x00-\x80]

paipai.com可以自动上传缩略图的商品发布模块

用户定制的。暂时就不发布出来了,附件带密码不知道的朋友就不要下载了
下载文件paipai.com可以自动上传缩略图的商品发布模块.rar (706.82 KB , 下载:32次)

宝宝的新相片出来了(百日照)

赶紧夸夸吧

幻灯模式:

 



组图模式:

attachments/200903/6367524146.jpg attachments/200903/5734374083.jpg attachments/200903/9824348012.jpg

attachments/200903/2679965581.jpg attachments/200903/0995340954.jpg attachments/200903/7666559253.jpg

attachments/200903/2238335844.jpg attachments/200903/0993216923.jpg attachments/200903/6147018879.jpg

attachments/200903/4230741844.jpg attachments/200903/1024376118.jpg attachments/200903/6845870619.jpg

attachments/200903/9042323812.jpg attachments/200903/3830025759.jpg attachments/200903/7453850674.jpg

attachments/200903/7822320102.jpg attachments/200903/3775733924.jpg attachments/200903/7782995784.jpg

attachments/200903/6342574158.jpg attachments/200903/4388575039.jpg attachments/200903/4921091324.jpg

attachments/200903/2213621192.jpg attachments/200903/5622730221.jpg attachments/200903/5826354286.jpg

attachments/200903/9527374141.jpg attachments/200903/1176782623.jpg attachments/200903/6286369457.jpg

attachments/200903/7224179272.jpg attachments/200903/4599428746.jpg attachments/200903/9097303782.jpg

attachments/200903/1873175295.jpg attachments/200903/3109196197.jpg attachments/200903/1338332855.jpg


attachments/200903/4292518561.jpg attachments/200903/5350501966.jpg attachments/200903/1175914366.jpg


attachments/200903/6060724961.jpg attachments/200903/0140594319.jpg attachments/200903/2426609841.jpg


attachments/200903/2178229509.jpg attachments/200903/7768041366.jpg attachments/200903/5524116025.jpg


attachments/200903/5381681047.jpg attachments/200903/5293885245.jpg attachments/200903/4388290432.jpg


attachments/200903/2336977062.jpg attachments/200903/6869933982.jpg attachments/200903/3424535001.jpg


attachments/200903/9583090863.jpg attachments/200903/0459942874.jpg attachments/200903/9392178936.jpg


attachments/200903/4720440661.jpg attachments/200903/2125336300.jpg attachments/200903/7704139709.jpg


attachments/200903/8914283273.jpg attachments/200903/2008483331.jpg attachments/200903/2915216568.jpg


attachments/200903/8471907839.jpg attachments/200903/2354523159.jpg attachments/200903/5011767826.jpg

attachments/200903/6418352519.jpg attachments/200903/8418750946.jpg

html实体转换[转]

Html entity encoder/decoder Detail refer to http://andrewu.co.uk/clj/entityencode/.


  1. function TextToEntities(strPlainText, blnPartialEncodeOnly) {
  2.  var strPartial = [];
  3.  var strFull = [];
  4.  var intP = 0;
  5.  var intF = 0;
  6.  var objPartialRegExp = (new RegExp).compile("[\\w\\s]");
  7.  
  8.  for (var intI=0; intI<strPlainText.length; ++intI) {
  9.  var strChar = strPlainText.charAt(intI);
  10.  var intChar = strChar.charCodeAt(0);
  11.  
  12.  if (isNaN(intChar)) {
  13.  // IF CHAR FAILED TO DECODE, LEAVE AS CHAR
  14.  strPartial.push(strFull.push(strChar));
  15.  }
  16.  else {
  17.  var strEntity = "&#" + intChar + ";";
  18.  strFull.push(strEntity);
  19.  // IF CHAR WAS [a-zA-Z0-9_ \t] LEAVE AS CHAR, ELSE REPLACE WITH ENTITY
  20.  strPartial.push(objPartialRegExp.test(strChar) ? strChar : strEntity);
  21.  }
  22.  }
  23.  return (blnPartialEncodeOnly ? strPartial.join("") : strFull.join(""));
  24.  }
  25.  
  26.  function EntitiesToText(strEncodedText) {
  27.  var strData = String(strEncodedText);
  28.  var objRegExp = (new RegExp).compile("&#(\\d+);", "ig");
  29.  
  30.  /**//* FOR EACH MATCH TO ANY ENTITY, REPLACE THAT
  31.  ENTITY GLOBALLY WITH ITS SINGLE CHAR EQUIVALENT */
  32.  while(strData.match(objRegExp)) {
  33.  var strCharMatch = RegExp.$1;
  34.  var objRegExpMatch = new RegExp("&#" + strCharMatch + ";", "ig");
  35.  strData = strData.replace(objRegExpMatch, String.fromCharCode(strCharMatch));
  36.  }
  37.  return strData;
  38.  }


最近在解析一个天气预报的xml文件时,发现它里面所有的汉字都转化为了html实体(十进制表示的Unicode编码),这样做的好处就是不管网页的编码是什么,都可以正常的显示汉字,而不会出现乱码,当然也适用于其他字符集。在php中我们可以用mbstring的mb_convert_encoding函数实现这个正向及反向的转化。
如:

mb_convert_encoding ("你好""HTML-ENTITIES""gb2312");    //输出:&#20320;&#22909;
mb_convert_encoding ("&#20320;&#22909;""gb2312""HTML-ENTITIES");    //输出:你好 

可以查看这个页面:htmlentities.html, 不管选择什么网页编码,网页都能正常显示。

如果需要对整个页面转化,则只需要在php文件的头部加上这三行代码:

mb_internal_encoding("gb2312");  // 这里的gb2312是你网站原来的编码
mb_http_output("HTML-ENTITIES");
ob_start('mb_output_handler'); 

如果没有打开mbstring扩展,可以参考coolcode.cn上的这两篇文章:
在任意字符集下正常显示网页的方法
在任意字符集下正常显示网页的方法(续)

在asp中我们可以用下面这个函数来实现这个转化:

Function htmlentities(str)
    For 
1 to Len(str)
        
char mid(stri1)
        If 
AscW(char) > 0 then
            htmlentities 
htmlentities "&#" Ascw(char) & ";"
        
Else
            
htmlentities htmlentities "&#" & (65536 ascW(char)) & ";"
        
End if
    
Next
End 
Function 

我的2008

        平时不咋写文字,今天在博客园逛时,发现许多大佬们都要对自己做总结,回想起今年发生的一些事。于国家于自己都发生了巨多的变化,借今年的酒兴(哈,刚跟大学好友啊飞搞了一顿,很爽),也回顾一下,记录一下我的2008年。
        生活上,今年是我的本命年,论吉凶祸福,长辈们总会说起要倒霉、不顺,穿红衣避邪。哈哈,我也照做了。不过从过来的一年看,今年可以算是我人生最最有意义的一年的,在2008年中,从上海转战到了合肥,我买房了(虽然不大,但很温馨),我结婚了,从暗恋了10来年的同学到4年前女朋友,今年我们走进了婚姻的殿堂,我生宝宝了,长相和老婆神似,但性格却和我几无二样,好动、精力充沛、喜欢晚上活动。宝宝就是上天赐给我们的礼物,这一年性格变化了很多,感觉到了责任的重大了,虽然不能像从前那样西安上海全国得随便跑,但同样很充实,每天只要回家见到温柔的妻子和可爱的宝宝,你还需要什么呢?
        工作上,今年硬着头皮注册了自己的公司,找到了非常好的合作伙伴,小文同学。小文有着和我当年同样的冲劲和激情,学东西也非常快,给予了我很大的帮助,他今年在生活上运气相对差了一点,在这里祝福他在新的一年我们一起齐头共进,收获更多。
        最后在这里向在给我帮助,支持的家人,朋友,公司伙伴以及火车采集器所有会员们表示感谢,新的一年,生活基本稳定的基础上,我会更加努力地工作,不负大家对我的期望,创造更佳业绩。
标签: 2008,总结

飞信登录时限制只能开一个客户端,利用这个补丁可以解决该问题

该补丁针对最新版的飞信(3.3.0)制作
默认去掉了广告显示(非网络上流行的每个用户更改配置文件的方法)
普通的多开补丁无法保存原来的登录信息,这个版本可以解决

最新版的飞信2008 3.3.0奥运版 可以到迅雷 http://119.147.41.16/down?cid=2EF9F770A08F850E1BB184243D5FADEF3632F636&t=2&fmt=- 下载

附补丁FetionFx.exe文件下载,覆盖到飞信目录即可
下载文件飞信补丁.rar (1.69 MB , 下载:800次)

·此地為某只的個人YY之地,言論僅代表自己的個人觀點,和現實、社會、政治完全沒關係,沒事請不要在此惹事生非。
·若要轉載本blog内容請註明轉載地址和作者名字,禁止無權轉載/盜鏈等無恥行爲。
·如有轉載侵權請聯系刪除。
·謝謝合作。^_^