extjs tree 节点清空问题

当拖拽一个树节点后将改动提交服务端后怎么样保证两处树结构一致,我的的做法是让树重新生成一遍。但是这里有个问题,extjs删除树时老是报错 removeChild this.ownerTree is null.这种情况发生在当拖拽一个树节点到一个未展开的树节点之下后删除此树时。我估计是由于刚才那个拖拽的节点造成的。
试过将整个treepanel重新构建,也是同样的错误。
原因是调用不可见节点的expand或select方法,因为这些节点的父节点没展开,这些节点不可见。
解决方法是将这些节点的父节点展开让这些节点可见。

Continue reading extjs tree 节点清空问题

添加删除.svn,cvs右键菜单的注册表 以及解锁问题

对于软件人士来说,常常需要删除某个源码文件夹下面所有cvs,.svn文件夹。

现在介绍一个网上流传的注册表方法:

删除CVS代码:delCVS.reg

Windows Registry Editor Version 5.00   
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteCVS] 
   @="Delete CVS Folders" 
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteCVS\command]  
     @="cmd.exe /c \"TITLE Removing CVS Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (CVS) DO RD /s /q \"%%f\" \""  
将上面的代码保存为delCVS.reg 后双击此文件即可,可看到文件夹右键多出个Delete CVS Folders菜单.如图

6ebc7152e122acda8d5430ff

根据上面的代码,通过修改蓝色部分,你可以自己定制更多的右键菜单来删除不同的文件夹.

下面是删除svn文件夹的代码:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@="Delete SVN Folders"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \""

 

另外,常常遇到文件被锁,使用clean up也出错的情况,可以使用bat命令解决:

cd 到svn项目目录下,然后执行如下命令 
del lock /q/s 
就把锁删掉了。

Continue reading 添加删除.svn,cvs右键菜单的注册表 以及解锁问题

xml带冒号属性怎么获取

dom4j 的el.attributeValue是无法取到名空间类型的属性,简单点说就是带冒号的属性。

带冒号的属性是与名空间定义有关的,例如

<a xmlns="http://www.w3.org/xxx" xml:lang="en"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/xxx http://www.w3.org/xxx.xsd" >

这其中的蓝色部分就是特殊属性。

要取这样的属性在dom4j中应该这样做:

xmlns是名空间Element.getNamespaceURI()可以获得

xmlns:xsi   --> Element.getNamespaceForPrefix("xsi").getURI()

xsi:schemaLocation --> el.selectSingleNode("@xsi:schemaLocation").getText()

Continue reading xml带冒号属性怎么获取

maven 导致文件损坏的问题

1 :gzip格式打包时被损坏:

今天花了一天时间,找出一个原来运行得好好的程序无法运行的原因:maven打包时将包资源里的gzip格式文件搞坏了。结果发布到产品环境下的gzip资源总是不可用,我勒个去!maven你怎么不去屎啊!

2:编译时图片(主要是png图片)资源拷贝损坏:

写swing程序时,放在源代码文件夹内的图片资源在生成到target/classes/文件夹下时出现损坏。

出现异常:

sun.awt.image.PNGImageDecoder$PNGException: crc corruption

原来是是将资源编译了

解决办法:

pom里面设置资源不编译:(但是maven默认就是false,不知怎么回事。)

      <build>
		<resources>
		<resource>
	        <directory>src/main/resources</directory>
	        <filtering>false</filtering>
      	</resource>
      	</resources>
		<finalName>xxx</finalName>		
	</build>

记住要清空再编译就发现图片好了。

Continue reading maven 导致文件损坏的问题

it-e-01 four kinds of computers

Computers are electronic devices that can follow instructions to accept input, process that
input, and produce information. There are four types of computers: microcomputers, minicomputers,
mainframe computers, and supercomputers.
Microcomputers, also known as personal computers, are small computers that can fit on a desktop.
Portable microcomputers can fit in a briefcase or even in the palm of your hand. Microcomputers are
used in homes, schools, and industry. Today nearly every field uses microcomputers.
One type of microcomputer that is rapidly growing in popularity is the portable computer,
which can be easily carried around. There are four categories of portable computers.
Laptops: laptops, which weigh between 10 and 16 pounds, may be AC-powered, battery-powered,
or both. The AC-powered laptop weighs 12 to 16 pounds. The battery-powered laptop weighs 10 to 15
pounds, batteries included, and can be carried on a shoulder strap.
Notebook PCs: notebook personal computers weigh between 5 and 10 pounds and can fit
into most briefcases. It is especially valuable in locations where electrical connections are not
available. Notebook computers are the most popular portable computers today.
Subnotebooks: subnotebooks are for frequent flyers and life-on-the-road types.[1] Subnotebooks
users give up a full-size display screen and keyboard in exchange for less weight. Weighting between
2 and 6 pounds, these computer fit easily into a briefcase.
Personal Digital Assistants: much smaller than even the subnotebooks. Personal Digital
Assistants (PDAs) weigh from 1 to 4 pounds. The typical PDA combines pen input, writing
recognition, personal organizational tools, and communication capabilities in a very small
package.
Minicomputers, also knows as midrange computers, are desk-sized machines. [2]They fall into
between microcomputers and mainframes in their processing speeds and data-storing capacities.
Medium-size companies or departments of large companies typically use them for specific purposes.
For example, they might use them to do research or to monitor a particular manufacturing process.
Smaller-size companies typically use microcomputers for their general data processing needs, such as
accounting.
Mainframe computers are larger computers occupying specially wired, air-conditioned rooms
and capable of great processing speeds and data storage. They are used by large organizations
business, banks, universities, government agencies—to handle millions of transactions. For
example, insurance companies use mainframes to process information about millions of policyholders.
Supercomputers are special, high-capacity computers used by very large organizations principally
for research purposes. Among their uses are oil exploration and worldwide weather forecasting.
In general, a computer's type is determined by the following seven factors:

The type of CPU. Microcomputers use microprocessors. The larger computers tend to use
CPUs made up of separate, high-speed, sophisticated components.
The amount of main memory the CPU can use. A computer equipped with a large
amount of main memory can support more sophisticated programs and can even hold several
different programs in memory at the same time.
The capacity of the storage devices. The larger computers systems tend to be equipped
with higher capacity storage devices.
The speed of the output devices. [3]The speed of microcomputer output devices tends to be
rated in terms of the number of characters per second (cps) that can be printed usually in tens
and hundreds of cps. Larger computers' output devices are faster and are usually rated at speeds
of hundreds or thousands of lines that can be printed per minute.
The processing speed in millions of instructions per second (mips). The term instruction
is used here to describe a basic task the software asks the computer to perform while also
identifying the data to be affected. The processing speed of the smaller computers ranges from 7
to 40 mips. The speed of large computers can be 30 to 150 mips or more, and supercomputers
can process more than 200 mips. In other words, a mainframe computer can process your data a
great deal faster than a microcomputer can.
The number of users that can access the computer at one time. Most small computers
can support only a single user, some can support as many as two or three at a time. Large
computers can support hundreds of users simultaneously.
The cost of the computer system. Business systems can cost as little as $500 (for a
microcomputer) or as much as $10 million (for a mainframe) and much more for supercomputer.

Continue reading it-e-01 four kinds of computers

it-e-02 web harvesting

As the amount of information on the Web grows, that information becomes ever harder to
keep track of and use. Search engines are a big help, but they can do only part of the work, and
they are hard-pressed to keep up with daily changes.
Consider that even when you use a search engine to locate data, you still have to do the
following tasks to capture the information you need: scan the content until you find the
information, mark the information (usually by highlighting with a mouse), switch to another
application ( such as a spreadsheet, database or word processor), paste the information into that
application.

A better solution, especially for companies that are aiming to exploit a broad swath of data
about markets or competitors, lies with Web harvesting tools.
Web harvesting software automatically extracts information from the Web and picks up
where search engines leave off, doing the work the search engine can't. Extraction tools automate
the reading, copying and pasting necessary to collect information for analysis, and they have
proved useful for pulling together information on competitors, prices and financial data or all
types.
There are three ways we can extract more useful information from the Web.
The first technique, Web content harvesting, is concerned directly with the specific content
of documents or their descriptions, such as HTML files, images or e-mail messages. Since most
text documents are relatively unstructured (at least as far as machine interpretation is concerned),
one common approach is to exploit what's already known about the general structure of
documents and map this to some data model.
The other approach to Web content harvesting involves trying to improve on the content
searches that tools like search engines perform. This type of content harvesting goes beyond
keyword extraction and the production of simple statistics relating to words and phrases in
documents.
Another technique, Web structure harvesting, takes advantage of the fact that Web pages
can reveal more information than just their obvious content. Links from other sources that point
to a particular Web page indicate the popularity of that page, while links within a Web page that
point to other resources may indicate the richness or variety of topics covered in that page. This
is like analyzing bibliographical citations— paper that's often cited in bibliographies and other
paper is usually considered to be important.
The third technique, Web usage harvesting, uses data recorded by Web servers about user
interactions to help understand user behavior and evaluate the effectiveness of the Web structure.
General access—pattern tracking analyzes Web logs to understand access patterns and
trends in order to identify structural issues and resource groupings.
Customized usage tracking analyzes individual trends so that Web sites can be personalized
to specific users. Over time, based on access patterns, a site can be dynamically customized for a
user in terms of the information displayed , the depth of the site structure and the format of the
resource presented.

Continue reading it-e-02 web harvesting

读The Definitive ANTLR Reference

没看的很明白,摸出来的。

lexer?parser?tree?token?

token以大写字母开头,对应目标语言的静态字段。

rule以小写字母开头对应目标语言的实例方法。

token里面的连接表现和rule里面的连接表现是不一样的。

TOKEN:

'h' 'i' //匹配hi

rule:

'h' 'i'//匹配h i,不匹配hi[中间有空格的区别]

子rule用()包含

action用{}包含,使用目标语言写

ANTLR中表示字符要用“’”单引号括起来,用‘(’ ‘)’来表示括号字符

channel:

解析的token放在不同的channel,由你来设定。

token序号是整体排序的

The token buffer preserves the relative token order regardless of the token channel numbers.

skip()小心用。

WS : (' ' |'\t' |'\r' |'\n' )+ {skip();$channel=HIDDEN;} ; //这样将匹配丢到hidden chennel可行,那么不行需要再写其他的rule时总是要写WS匹配。例: WS?'hello' WS+ 'how' WS+ 'are' WS+ 'you' -->'hello' 'how' 'are' 'you'.

Method skip( ) in an embedded lexer rule action forces the lexer to throw
out the token and look for another.运行结果似乎是视而不见【抛弃】。

fragment

如果一个token被另外的token使用,则被使用的token需要加fragment标记。

如果加了fragment,则此token不要在rule里面直接引用[如果引用了会达不到预期结果],而应该在其他的token里面引用。

对于没有加frgament的token又有个原则,它不能与其他的token有交集。即不能一个输入既可以匹配token1又可以匹配token2.

使用antlrworks时,如果出现警告,尽量消除它。尽量列举所有的情况而不要使用多个* ?来匹配。

错误解读:

line 12:15 no viable alternative at input 'xxx'

12行15字碰到没有定义的输入xxx【定义中没有列举这样的输入情况】

局部规则可能影响整个规则,特别对于+ *之类的泛匹配例如('a'..'z' | 'A'..'Z')+

暂且放下:

遇到的困难:

1:对于无引号token不知如何识别,如果使用

TOKEN=CHAR+

rule = TOKEN+

则可以匹配所有,造成整个语法混乱

2:对于递归语法不知如何识别,例如

[[...] [...]] 和 ((...) (...))

Continue reading 读The Definitive ANTLR Reference

it-e-03 Computer hardware

Computer hardware has four parts: the central processing unit (CPU) and memory, storage
hardware, input hardware, and output hardware.
The part of the computer that runs the program is known as the processor or central processing
unit (CPU). In a microcomputer, the CPU is on a single electronic component, the microprocessor
chip, within the system unit or system cabinet. The CPU itself has two parts: the control unit and
the arithmetic-logic unit. In a microcomputer, these are both on the microcomputer chip.
The Control Unit The control unit tells the rest of the computer system how to carry out a
program's instructions. It directs the movement of electronic signals between memory and the
arithmetic-logic unit. It also directs these control signals between the CPU and input and output
devices.
The Arithmetic-Logic Unit The arithmetic-logic unit, usually called the ALU, performs
two types of operations—arithmetic and logical. Arithmetic operations are, as you might expect,
the fundamental math operations: addition, subtraction, multiplication, and division. Logical
operations consist of comparisons. That is , two pieces of data are compared to see whether one is
equal to, less than, or greater than the other.
Memory Memory is also known as primary storage, internal storage, it temporarily holds
data, program instructions, and information. One of the most important facts to know about
memory is that part of its content is held only temporarily. In other words, it is stored only as
long as the computer is turned on. When you turn the machine off, the content immediately
vanish. The stored contents in memory are volatile and can vanish very quickly.
Storage Hardware [1]The purpose of storage hardware is to provide a means of storing
computer instructions and data in a form that is relatively permanent, that is, the data is not lost
when the power is turned off—and easy to retrieve when needed for processing.There are four
kinds of storage hardware: floppy disks, hard disks,optical disk,andmagnetic tape.
Floppy Disks Floppy disks are also called diskettes, flexible disks, floppies, or simply

disks. The plastic disk inside the diskette cover is flexible, not rigid. They are flat, circular pieces
of mylar plastic that rotate within a jacket. Data and programs are stored as electromagnetic
charges on a metal oxide film coating the mylar plastic.
Hard Disks Hard disks consist of metallic rather than plastic platters. They are tightly
sealed to prevent any foreign matter from getting inside. Hard disks are extremely sensitive
instruments. The read-write head rides on a cushion of air about 0.000001 inch thick. It is so thin
that a smoke particle, fingerprint, dust, or human hair could cause what is known as a head crash.
A head crash happens when the surface of the read-write head or particles on its surface contact
the magnetic disk surface. A head crash is a disaster for a hard disk. It means that some or all of
the data on the disk is destroyed. Hard disks are assembled under sterile conditions and sealed
from impurities within their permanent containers.
Optical Disks Optical disks are used for storing great quantities of data. An optical disk can
hold 650 megabytes of data—the equivalent of hundreds of floppy disks. Moreover, an optical disk
makes an immense amount of information available on a microcomputer. In optical-disk technology,
a laser beamalters the surface of a plastic or metallic disk to represent data. To read the data, a laser
scans these areas and sends the data to a computer chip for conversion.
Magnetic Tape Magnetic tape is an effective way of making a backup, or duplicate, copy of
your programs and data. We mentioned the alarming consequences that can happen if a hard disk
suffers a head crash. You will lose some or all of your data or programs. Of course, you can always
make copies of your hard-disk files on floppy disks. However, this can be time-consuming and may
require many floppy disks. Magnetic tape is sequential access storage and can solve the problem
mentioned above.
Input Hardware Input devices take data and programs people can read or understand and
convert them to a form the computer can process. This is the machine-readable electronic signals
of 0s and 1s. Input hardware is of two kinds: keyboard entry and direct entry.
Keyboard Entry Data is input to the computer through a keyboard that looks like a
typewriter keyboard but has additional keys. In this method, the user typically reads from an
original document called the source document. The user enters that document by typing on the
keyboard.
Direct Entry :Data is made into machine-readable form as it is entered into the computer,
no keyboard is used. Direct entry devices may be categorized into three areas: pointing devices
(for example, mouse, touch screen, light pen, digitizer are all pointing devices), scanning devices
(for example, image scanner, fax machine, bar-code reader are all scanning devices), and
voice-input devices.
Output Hardware Output devices convert machine-readable information into people-readable
form. Common output devices are monitors, printers, plotters, and voice output.
Monitors Monitors are also called display screen or video display terminals. Most monitors that
sit on desks are built in the same way as television sets, these are called cathode-ray tubes. Another type
of monitor is flat-panel display, including liquid-crystal display (LCD), electroluminescent (EL) display

and gas-plasma display. An LCD does not emit light of its own. Rather, it consists of crystal molecules.
[2]An electric field causes the molecules to line up in a way that alters their optical properties.
Unfortunately, many LCDs are difficult to read in sunlight or other strong light. A gas-plasma display is
the best type of flat screen. Like a neon light bulb, the plasma display uses a gas that emits light in the
presence of an electric current.
Printers There are four popular kinds of printers: dot-matrix, laser, ink-jet, and thermal.
Dot-Matrix Printer Dot-matrix printers can produce a page of text in less than 10 seconds
and are highly reliable. They form characters or images using a series of small pins on a print
head. The pins strike an inked ribbon and create an image on paper. Printers are available with
print heads of 9, 18, or 24 pins. One disadvantage of this type of printer is noise.
Laser Printer The laser printer creates dotlike images on a drum, using a laser beam light
source. [3]The characters are treated with a magnetically charged inklike toner and then are
transferred from drum to paper. A heat process is used to make the characters adhere. The laser
printer produces images with excellent letter and graphics quality.
Ink-Jet Printer An ink-jet printer sprays small droplets of ink at high speed onto the
surface of the paper. This process not only produces a letter-quality image but also permits
printing to be done in a variety of colors.
Thermal Printer A thermal printer uses heat elements to produce images on heat-sensitive
paper. Color thermal printers are not as popular because of their cost and the requirement of
specifically treated paper. They are a more special use printer that produces near photographic
output. They are widely used in professional art and design work where very high quality color is
essential.
Plotters Plotters are special-purpose output devices for producing bar charts, maps, architectural
drawings, and even three-dimensional illustrations. Plotters can produce high-quality multicolor
documents and also documents that are larger in size than most printers can handle. There are four types
of plotters: pen, ink-jet, electrostatic, and direct imaging.
Voice-Output Devices Voice-output devices make sounds that resemble human speech but
actually are pre-recorded vocalized sounds. Voice output is used as a reinforcement tool for
learning, such as to help students study a foreign language. It is used in many supermarkets at the
checkout counter to confirm purchases. Of course, one of the most powerful capabilities is to
assist the physically challenged.

Continue reading it-e-03 Computer hardware

skype4java :

skype4java 地址:

http://skype.sourceforge.jp/index.php?Skype%20API%20For%20Java%20%28English%29

使用jni封装skype com+接口

但其

Win32Connector::protected void initializeImpl() 方法有些问题,其意图是如果没又找到skype库就从包里面解压缩skype.dll到临时文件夹下,但是我不知道为什么作者要用zip遍历,而不是使用类加载器获得资源来解压缩。

我做的修改:

try {
            System.loadLibrary("skype");
        } catch(Throwable e) {
            try {
                if(!ConnectorUtils.checkLibraryInPath(LIBFILENAME)) {
                    String dllPath;
                    String tmpDir = System.getProperty("java.io.tmpdir");
                    if(!tmpDir.endsWith("" + File.separatorChar)) {
                        tmpDir = tmpDir + File.separatorChar;
                    }
                    dllPath = tmpDir + LIBFILENAME;
                    File dll = new File(dllPath);
                    if(!dll.exists()) {
extractDll(dll);
                        if(!dll.exists()) {
                            throw new RuntimeException("can't load " + dllPath);
                        }
                    }
                    System.load(dllPath);
                }
            } catch(Exception e1) {
                throw new RuntimeException(e1);
            }
        }

private void extractDll(File destFile) {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        InputStream input = loader.getResourceAsStream(LIBFILENAME);
        FileOutputStream output = null;
        try {
            output = new FileOutputStream(destFile);
            byte[] buffer = new byte[1024 * 4];
            long count = 0;
            int n = 0;
            while(-1 != (n = input.read(buffer))) {
                output.write(buffer, 0, n);
                count += n;
            }
        } catch(Exception e) {
            throw new RuntimeException(e);
        } finally {
            try {
                if(null != input) {
                    input.close();
                }
            } catch(IOException e) {
            }
            try {
                if(null != output) {
                    output.close();
                }
            } catch(IOException e) {
            }
        }
    }

需要

winp.jar 检查是否running

swt.jar 借用OS基础功能

Continue reading skype4java :

Pagination


Total views.

© 2013 - 2019. All rights reserved.

Powered by Hydejack v6.6.1