# parentNode，parentElement,offsetParent区别

parentNode与parentElement同义，但是parentElement不是w3c规范的。这里主要讨论parentNode,offsetParent的区别：

offsetParent直接的将是影响元素位置的上级element，而parentElement与位置显示无关时dom中的上级element。

<BODY>
<div   style="border:   1px   solid   black;position:absolute;">
<form>
<input   type="checkbox"   id="cc">
</form>
</div>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<script type="text/javascript">
var el = document.getElementById('t2');
};
</script>
<body style="width: 1000px;">
<table id="tb">
<tr id="tr1"><td>t1</td></tr>
<tr id="tr2"><td id="t2">t2</td></tr>
</table>
</body>
</html>

# it-e-70 Why You should Not Use JPEGs for Image Storage

If I were king, I'd banish JPEGs forever. JPEGs (pronounced "jay-pegs", and sometimes
spelled "JPGs") are the images you see all over the Web. Pictures stored as JPEGs are highly
compressed so they can be sent across the Internet faster. A picture that takes up 1 million bytes
can be squeezed down to 1/10th of that size if you turn it into a JPEG.
That would seem like a good idea. But it's actually a good idea gone bad. JPEGs are like
jigsaw puzzles that can never be put back together again right. Pieces will always be missing.

Every time you change a normal image into a JPEG, you lose part of the picture. You can never
get it back.
Remember that. I'll repeat it in a slightly different way to help out: When you create or save
a JPEG image, you lose part of the picture and you simply can't get it back, ever.
JPEGs are losers. They use what's called "lossy" compression. To squeeze an image's file
size down to something really small, the JPEG process tosses out 80 or 90 percent of the
information and fakes a lot of the rest. JPEGs take advantage of a trick of our eyesight. When we
see part of a small, familiar object, we automatically fill in the rest of it. JPEG processing breaks
an image up into a lot of small pieces and strips out a great deal of detail from each small piece.
A picture of your grandmother holding a shawl might show every detail ordinarily, but a
JPEG version might not show the way her fingers wrap around the fabric. Instead, they might be
depicted as areas of light and dark contrast that suggest an old woman's fingers. Your eyes and
brain do the rest. They turn what is only a suggestion of fingers into what your brain thinks is the
real thing.
This might be fine for some uses. But anyone who cares about digital photography should
consider JPEG as an enemy, not a friend. I'll bet you don't want that picture of grandma turned
into someone who looks sorta like grandma. You want the real thing.
JPEGs are one-way trips to the Badlands. Here's a familiar scenario. You have a normal,
non-compressed image. It's a Windows bitmap, maybe. (They're BMP files.) You open this
bitmap in your image-editing software and save it as a JPEG. The file is a lot smaller. You
celebrate a little. What a trick you just pulled!
Later, you realize you need to tweak the picture a little. Maybe you need to crop it. Maybe
you just want to make the colors more vivid.
So you open the JPEG in your image editor, make your changes and save the file as a JPEG
again.
The image you cropped or tweaked can't be the same as the one you started with. It was
already chopped up a lot by the JPEG processing, and when you saved it again it got chopped and
diced some more.
The PNG image format is the best thing since the wheel. PNG (pronounced "Ping," not "Pea
En Gee") means "Portable Network Graphics." When you save an image as a PNG, nothing gets
sliced or diced. A PNG is almost surely going to be smaller than a standard uncompressed image,
but it won't have any wounds. Cut it up all you want, slice it hither and yon. It will be all there,
even though it's smaller.
This miracle is actually just a trick of counting. We all do the same thing that PNGs do. We
learned this trick in grade school.
Here's how it works. Suppose you have a lot of sheep to count. You could count every
single one of them. Boring, right? Or you could count them by twos. Or maybe, if your eye is
quick, you could count them by threes.
Let's say you've done thismaybe you were trying the old technique of counting sheep to

get to sleep but it didn't workand now it's time to come up with the real number. If you counted
by twos, you just multiply your total by two. If you counted by threes, you multiply your number
by three.
Cool, right? You're storing something like 31 in your brain, but you can quickly turn that
into the real number62 or 93.
It's all shorthand. It's a perfectly sane mathematical trick. PNG uses the same approach. It
squeezes the data in an image file using tricks of math. Does the image have 61 pixels of nothing
but azure blue in one area? PNG stores that information as an instruction to make an azure blue
pixel 61 times. That takes up a lot less space than something like this: azure blue pixel, azure
blue pixel, azure blue pixel, ... you get the point.
The best part of this trick is the way it can be totally reversed without losses. the sky looks
exactly the way it was supposed to in the image with all those azure blue pixels. Storing
information by listing it as "1 pixel times 61" is the same as storing 61 pixels. Except that it
doesn't take up all that wasted space.
PNGs can't quite squeeze images as much as JPEGs can. There's no way to do it the lossless
way and get the same reduction in file size. But PNGs can cut an image down to anywhere from
one-half to one-third of its normal file size without any loss of data. Some images can be reduced
even more.
I took a few hundred uncompressed digital images and changed them from BMP to PNG to
find out how much space I could save. Most of them were 12 megabyte files stored as BMPs.
PNG squeezed these scans down to a little less than half their uncompressed size on average.
Some scans, especially ones that did not have much detail, compressed a lot more. But since I
started storing most of my digital images as PNGs, I've come to expect about a 50 percent to 60
percent savings in file space.
That might not seem like much compared to the way JPEG squeezes images, but it's a huge
bonus when you realize that PNG is harmless. Images are not changed in any way.
Good image viewers and editors know how to deal with PNG. If you don't see PNG listed as
an option in your image editor's "Save As" menu (under the "File" menu), you have old software
and should get a newer version.
If you don't have an image viewer of any kind, buy ACDSee, available for both Windows
PCs and Macintoshes.

1, shawl  [ʃɔ:l]
n. 披肩,围巾

2, sorta  ['sɔ:tə]

3, vivid  ['vivid]
a. 生动的,栩栩如生的,鲜艳的

4, dice  [dais]
vt. 切成方块
n. 骰子
vi. 掷骰子

5, sliced  [slaist]
v. 切成薄片；分配（slice的过去式和过去分词）

6, yon  [jɔn]
n. 那边，远处
pron. 彼处之人或物

7, chopped
v. 斩碎(开裂,中断,多变,开路)

8, sane  [sein]
a. 神智健全的,理智的

9, azure
n. 天蓝色,碧空
a. 蔚蓝的

10, squeeze  [skwi:z]
n. 压榨,挤
v. 紧握,挤

PNG原来是无损压缩位图

GIF也是无损压缩位图,只是由于压缩算法专利问题，逐渐被PNG取代。

http://zh.wikipedia.org/wiki/GIF

http://zh.wikipedia.org/wiki/PNG

Continue reading it-e-70 Why You should Not Use JPEGs for Image Storage

# it-e-69 Image Compression

Why is image compression so important? Image files, in an uncompressed form, are very large.
And the Internet, especially for people using a 56k dialup modem, can be pretty slow.[1]This
combination could seriously limit one of the Web's most appreciated aspectsits ability to present
images easily.
JPEG (Joint Photographic Experts Group)compression is currently the best way to compress
PHOTOGRAPHIC IMAGES for the web. Other forms of image compression, including GIF and
PNG, are best used for other purposes on the web.
GIF (Graphics Interchange Format) is best used for graphics that have a limited color pallet
and large areas of flat tone, like cartoons or banners. Although it has several remarkable features,
such as transparency and the ability to present animated images, it is not well suited for the
presentation of continuous tone images, such as photographs, due to its limit of 256 colors.
PNG (Portable Network Graphics) is a relatively new format with a lot of potential but, until
all browsers can see images compressed in PNG form, it is not a good idea to use it.
JPEG, or JPG, is an evolving format that is universal in its use as a means of compressing
continuous tone photographs for speedy transmission over the Internet. Photographs compressed
using the JPEG format look good because JPEG supports millions of colors, so you can see the
A Bitmap is a simple series of pixels all stacked up. But the same image saved in GIF or
JPEG format uses less bytes to make up the file. How? Compression.
"Compression" is a computer term that represents a variety of mathematical formats used to
compress an image's byte size. Let's say you have an image where the upper right-hand corner
has four pixels all the same color. Why not find a way to make those four pixels into one?[2]That
would cut down the number of bytes by three-fourths, at least in the one corner. That's a
compression factor.
Bitmaps can be compressed to a point. The process is called "run-length encoding." Runs of
pixels that are all the same color are all combined into one pixel. [3]The longer the run of pixels,

the more compression. Bitmaps with little detail or color variance will really compress. Those
with a great deal of detail don't offer much in the way of compression. Bitmaps that use the
run-length encoding can carry either the common ".bmp" extension or ".rle". Another difference
between the two files is that the common Bitmap can accept 16 million different colors per pixel.
Saving the same image in run-length encoding knocks the bits-per-pixel down to 8. That locks
the level of color in at no more than 256.
So, why not create a single pixel when all of the colors are close? You could even lower the
number of colors available so that you would have a better chance of the pixels being close in
color. Good idea. The people at CompuServe felt the same way.
GIF, which stands for "Graphic Interchange Format," was first standardized in 1987 by
CompuServe, although the patent for the algorithm (mathematical formula) used to create GIF
compression actually belongs to Unisys. The first format of GIF used on the Web was called
GIF87a, representing its year and version. It saved images at 8 bits-per-pixel, capping the color
level at 256. That 8-bit level allowed the image to work across multiple server styles, including
CompuServe, TCP/IP.
CompuServe updated the GIF format in 1989 to include animation, transparency, and interlacing.
They called the new format, you guessed it: GIF89a.
There's no discernable difference between a basic (known as non-interlaced) GIF in 87 and
89 formats.

1, continuous tone

n. （色彩、颜色、次序、音调等的）渐变；分等级；（各种状态、性质等的）分阶段渐变；元音交替

3, discernable  [di'sə:nəbl, -'zə:-]

4, interlaced  [,intə'leist]
a. 交织的,交错的

5, interlacing  [intə(:)'leisiŋ]
n. 交错，隔行；隔行扫描
v. 交错，交织（interlace现在分词）

Continue reading it-e-69 Image Compression

# 【转+评】淘宝数据魔方技术架构解析

程序员原文:http://www.programmer.com.cn/7578/

NoSQL是SQL的有益补充

# it-e-68 Can Graphics Files Be Enctypted

Of course you can encrypt a graphics file. After all, most encryption algorithms don't care
about the intellectual content of a file. All they chew on is a series of byte values. Therefore,
most any encryption program that works on ordinary text files will work on graphics files as well.
Why would you want to encrypt a graphics file? Mostly to control who can view its contents.
You can invent a proprietary file format and that might slow a file format hack down for, say,
five or ten minutes. You could add a proprietary data compression scheme, possibly a twisted
variation of an already public algorithm. But there are so many people out there with nothing
better to do than hack at unknown data formats that your data would probably be exposed in little
time. But suppose we top off all this effort by encrypting the graphics file itself as we would an
ordinary text file. Would your data then be safe?
Realize that an encrypted graphics file still might not be very secure. For every data
encryption algorithm there exists at least one method of getting around it, although it may take
hundreds of computers and many years to fully employ and execute that method!
For example, one of the more popular methods used to encrypt data is the Vernam or XOR
cipher. This cipher Exclusive ORs the plain-text data with a single, random, fixed-length key.
The longer the key the harder it is to break the cipher. A totally random key the length of your
data is impossible to break. Shorter and less-random keys are easier to break.
XOR is very simple and fast, which is a must for a graphics file translators/viewers that
must decrypt a file on the fly. A problem, however, is that most graphics files contain fixed size
headers which vary only slightly in content from file to file. If you knew the approximate
contents of the header of an encrypted file you could XOR a "decrypted" header with the
encrypted file and possibly produce the key used to encrypt the file. A short key might be very
easily discovered in this way.
If you wish to use a public key/private key encryption method, then storing the public key in
the file format header (usually as a 4-byte field) and only encrypting the image data would be the
way to go. The SMPTE DPX file format supports such an encryption feature.
If you really need to make the contents of a graphics file secure, then I'd suggest not only
using some form of data encryption, but also create an unconventional and proprietary file format
and do not publish its format specification.

###### cipher ['saifə]

n. 零,暗号

• v. 计算,做算术

Continue reading it-e-68 Can Graphics Files Be Enctypted

# it-e-67 Can Graphics Files Be Infected with a Virus

For most types of graphics file formats currently available the answer is "no". A virus (or
worm, Trojan horse, and so forth) is fundamentally a collection of code (that is, a program) that
contains instructions which are executed by a CPU. Most graphics files, however, contain only
static data and no executable code. The code that reads, writes, and displays graphics data is
found in translation and display programs and not in the graphics files themselves. If reading or
writing a graphics file caused a system malfunction is it most likely the fault of the program
reading the file and not of the graphics file data itself.
With the introduction of multimedia we have seen new formats appear, and modifications to
older formats made, that allow executable instructions to be stored within a file format. These
instructions are used to direct multimedia applications to play sounds or music, prompt the user

for information, or display other graphics and video information. And such multimedia display
programs may perform these functions by interfacing with their environment via an API, or by
direct interaction with the operating system. One might also imagine a truly object-oriented
graphics file as containing the code required to read, write, and display itself.
Once again, any catastrophes that result from using these multimedia application is most
like the result of unfound bugs in the software and not some sinister instructions in the graphics
file data. Such "logic bombs" are typically exorcised through the use of testing using a wide
variety of different image files for test cases.
If you have a virus scanning program that indicates a specific graphics file is infected by
virus, then it is very possible that the file coincidentally contains a byte pattern that the scanning
programming recognizes as a key byte signature identifying a virus. Contact the author (or even
read the documentation!) of the virus scanning program to discuss the probability of the
mis-identification of a clean file as being infected by a virus. Save the graphics file, as the author
will most likely wish to examine it as well.
If you suspect a graphics file to be at the heart of a virus problem you are experiencing, then
also consider the possibility that the graphics file's transport mechanism (floppy disk, tape or
shell archive file, compressed archive file, and so forth) might be the original source of the virus
and not the graphics file itself.

1, catastrophe  [kə'tæstrəfi]
n. 大灾难；大祸；惨败

2, sinister  ['sinistə]
a. 不吉利的,凶恶的,左边的

3, exorcise  ['eksɔ:saiz]
vt. 驱邪；除怪

4, coincidentally  [kəu,insi'dentli]

Continue reading it-e-67 Can Graphics Files Be Infected with a Virus

# it-e-66 Introduction to Digital Image Processing

An image is digitized to convert it to a form that can be stored in a computer's memory or on

some form of storage media such as a hard disk or CD-ROM. This digitization procedure can be
done by a scanner, or by a video camera connected to a frame grabber board in a computer. Once an
image has been digitized, it can be operated upon by various image processing operations.
Image processing operations can be roughly divided into three major categories, Image
Compression, Image Enhancement and Restoration, and Measurement Extraction[提取尺寸]. Image
compression is familiar to most people. [1]It involves reducing the amount of memory needed to
store a digital image.
Image defects which could be caused by the digitization process or by faults in the imaging
set-up (for example, bad lighting) can be corrected using Image Enhancement techniques. Once
the image is in good condition, the Measurement Extraction operations can be used to obtain
useful information from the image.
Some examples of Image Enhancement and Measurement Extraction are given below. The
examples shown all operate on 256 grey-scale images. This means that each pixel in the image is
stored as a number between 0 to 255, where 0 represents a black pixel, 255 represents a white
pixel and values in-between represent shades of grey. These operations can be extended to
operate on colour images.
The examples below represent only a few of the many techniques available for operating on
images. Details about the inner workings of the operations have not been given.
Image Enhancement and Restoration
The image at the left of Figure 1 has been corrupted
by noise during the digitization process. The "clean"
image at the right of Figure 1 was obtained by applying a
median filter [中值滤波器]to the image.
An image with poor contrast, such as the one at
the left of Figure 2, can be improved by adjusting the
image histogram to produce the image shown at the
right of Figure 2.

The image at the top left of Figure 3 has a corrugated effect due to a fault in the acquisition
process. This can be removed by doing a 2-dimensional Fast-Fourier Transform[快速傅里叶变换] on the image
(top right of Figure 3), removing the bright spots (bottom left of Figure 3), and finally doing an
inverse Fast Fourier Transform to return to the original image without the corrugated background
(bottom right of Figure 3).

An image which has been captured in poor lighting conditions, and shows a continuous
change in the background brightness across the image (top left of Figure 4) can be corrected
using the following procedure. First remove the foreground objects by applying a 25 by 25
greyscale dilation operation (top right of Figure 4). Then subtract the original image from the
background image (bottom left of Figure 4). Finally invert the colors and improve the contrast by
adjusting the image histogram (bottom right of Figure 4).

The example below demonstrates how one could go about extracting measurements from an
image. The image at the top left of Figure 5 shows some objects. The aim is to extract information
about the distribution of the sizes (visible areas) of the objects. The first step involves segmenting
the image to separate the objects of interest from the background. This usually involves
thresholding the image, which is done by setting the values of pixels above a certain threshold value
to white, and all the others to black (top right of Figure 5). Because the objects touch, thresholding
at a level which includes the full surface of all the objects does not show separate objects. This
problem is solved by performing a watershed separation on the image (lower left of Figure 5). The
image at the lower right of Figure 5 shows the result of performing a logical AND of the two
images at the left of Figure 5. This shows the effect that the watershed separation has on touching
objects in the original image. Finally, some measurements can be extracted from the image.

frame grabber board  帧中继访问设备

1, corrugated  ['kɔrəgeitid]
a. 缩成皱纹的,使起波状的

2, dilation  [dai'leiʃən, di-]
n. 扩张，扩大；膨胀；详述

3, subtract  [səb'trækt]
v. 减去,扣掉,减少

4, segmenting
n. 分段

5, thresholding
n. 阈值转换法；域值

6, watershed  ['wɔ:təʃed, 'wɔ-]
n. （美）流域；分水岭；集水区；转折点

Continue reading it-e-66 Introduction to Digital Image Processing

# it-e-65 Convert a Graphics Format

Why change vectors to bitmaps?
Most of the clip art gallery is vector-based and will need to be converted into bitmap formats
(GIF) prior to putting it on the Web.
Why change bitmaps to vectors?
You will need to change vectors to bitmaps to perform tasks from the Drawing toolbar on a
bitmap picture (such as animate parts of a bitmap picture) you will need to convert it into a vector
format. You can then e.g. ungroup it and apply animations to only parts of it.
Which graphic converter to use?
To change your graphics format, you need to use a graphics converter. A popular graphics
editor you can use for this is Paint Shop Pro. Another graphics editor you can use is Adobe
PhotoShop, which is said to be the best one for this kind of conversion.
How to use your graphic converter?
Open your file in the graphics editor chosen: Select File | Open.
Select File | Save As.
Rename your file and choose a new format. For a bitmap to vectors conversion select the
WMF format. For the opposite conversion, select the GIF format if you have PowerPoint 97,
otherwise select JPEG or TIFF.
Unfortunately, some of the quality may be lost in the switch. MS office also provides
graphics converters.

Continue reading it-e-65 Convert a Graphics Format

# phprpc初步

http://phprpc.org/

java只有源代码，不过包含了个make.bat运行后就生成了三个jar包，服务端只需要phprpc.jar,客户端需要phprpc_client.jar,不需要别的依赖包,very nice,那个phprpc_spring.jar的包尚不知是做什么用的。

>package kzg.phprpc.hello.api;

## Pagination

Total views.

Powered by Hydejack v6.6.1