Recent Forum Posts
From categories:
supras (guest) 17 Aug 2011 18:51
in discussion General Discussion / General » Reply to A Post

Without, the night was cold and wet, but in the small parlor of Lakesnam Villa the blinds were drawn and the fire burned

brightly. Father and son were at chess, the former, who possessed ideas about the game involving radical changes, putting his

king into suchm sharp and unnecessary perils that it even provoked comment from the whitehaired old lady knitting placidly by

the fire.

"Hark at the wind," said Mr. White, who, having seen a fatal mistake after it was too late, was amiably desirous of

preventing his son from seeing it.

"I'm listening," said the latter, grimly surveying the board as he stretched out his hand. "Check."

"I should hardly think that he'd come tonight," said his father, with his hand poised over the board.

"Mate," replied the son.

"That's the worst of living so far out," bawled Mr. White, with sudden and unlooked-for violence; "of all the beastly,

slushy, out-of-the-way places to live in, this is the worst. Pathway's a bog, and the road's a torrent. I don't know what

people are thinking about. I suppose because only two houses on the road are let, they think it doesn't matter."

"Never mind, dear," said his wife soothingly; "perhaps you'll win the next one."

Mr. White looked up sharply, just in time to intercept a knowing glance between mother and son. The words died away on his

lips, and he hid a guilty grin in his thin grey beard.

"There he is," said Herbert White, as the gate banged to loudly and heavy footsteps came toward the door.

The old man rose with hospitable haste, and opening the door, was heard condoling with the new arrival. The new arrival also

condoled with himself, so that Mrs. White said, "Tut, tut!" and coughed gently as her husband entered the room, followed by a

tall, burly man, beady of eye and rubicund of visage.

"Sergeant Major Morris," he said, introducing him.

The sergeant major shook hands, and taking the proffered seat by the fire, watched contentedly while his host got out whisky

and tumblers and stood a small copper kettle on the fire.

At the third glass his eyes got brighter, and he began to talk, the little family circle regarding with eager interest this

visitor from distant parts, as he squared his broad shoulders in the chair and spoke of strange scenes and doughty deeds, of

wars and plagues and strange peoples.

"Twenty-one years of it," said Mr. White, nodding at his wife and son. "When he went away he was a slip of a youth in the

warehouse. Now look at him."

"He don't look to have taken much harm," said Mrs. White politely. "I'd like to go to India myself," said the old man, "just

to look round a bit, you know."

"Better where you are," said the sergeant major, shaking his head. He put down the empty glass, and sighing softly, shook it

again.

"I should like to see those old temples and fakirs and jugglers," said the old man. "What was that you started telling me the

other day about a monkey's paw or something, Morris?"

"Nothing," said the soldier hastily. "Leastways, nothing worth hearing."

"Monkey's paw?" said Mrs. White curiously.

"Well, it's just a bit of what you might call magic, perhaps," said the sergeant major offhandedly.

His three listeners leaned forward eagerly. The visitor absentmindedly put his empty glass to his lips and then set it down

again. His host filled it for him.

"To look at," said the sergeant major, fumbling in his pocket, "it's just an ordinary little paw, dried to a mummy."

He took something out of his pocket and proffered it. Mrs. White drew back with a grimace, but her son, taking it, examined

it curiously.

"And what is there special about it?" inquired Mr. White, as he took it from his son, and having examined it, placed it upon

the table.

"It had a spell put on it by an old fakir," said the sergeant major, "a very holy man. He wanted to show that fate ruled

people's lives, and that those who interfered with it did so to their sorrow. He put a spell on it so that three separate men

could each have three wishes from it."

His manner was so impressive that his hearers were conscious that their light laughter jarred somewhat.

"Well, why don't you have three, sir?" said Herbert White cleverly.

The soldier regarded him in the way that middle age is wont to regard presumptuous youth. "I have," he said quietly, and his

blotchy face whitened.

"And did you really have the three wishes granted?" asked Mrs. White.

"I did," said the sergeant major, and his glass tapped against his strong teeth.

"And has anybody else wished?" inquired the old lady.

"The first man had his three wishes, yes," was the reply. "I don't know what the first two were, but the third was for death.

That's how I got the paw."

His tones were so grave that a hush fell upon the group.

"If you've had your three wishes, it's no good to you now, then, Morris," said the old man at last. "What do you keep it

for?"

The soldier shook his head. "Fancy, I suppose," he said slowly. "I did have some idea of selling it, but I don't think I

will. It has caused enough mischief already. Besides, people won't buy. They think it's a fairy tale, some of them, and those

who do think anything of it want to try it first and pay me afterward."

"If you could have another three wishes," said the old man, eyeing him keenly, "would you have them?"

"I don't know," said the other. "I don't know."

He took the paw, and dangling it between his front finger and thumb, suddenly threw it upon the fire. White, with a slight

cry, stooped down and snatched it off.

"Better let it burn," said the soldier solemnly.

"If you don't want it, Morris," said the old man, "give it to me."

"I won't," said his friend doggedly. "I threw it on the fire. If you keep it, don't blame me for what happens. Pitch it on

the fire again, like a sensible man."

The other shook his head and examined his new possession closely. "How do you do it?" he inquired.

"Hold it up in your right hand and wish aloud," said the sergeant major, "but I warn you of the consequences."

"Sounds like the Arabian Nights," said Mrs. White, as she rose and began to set the supper. "Don't you think you might wish

for four pairs of hands for me?"

Her husband drew the talisman from his pocket and then all three burst into laughter as the sergeant major, with a look of

alarm on his face, caught him by the arm.

"If you must wish," he said gruffly, "wish for something sensible."

Mr. White dropped it back into his pocket, and placing chairs, motioned his friend to the table. In the business of supper

the talisman was partly forgotten, and afterward the three sat listening in an enthralled fashion to a second installment of

the soldier's adventures in India.

"If the tale about the monkey's paw is not more truthful than those he has been telling us," said Herbert, as the door closed

behind their guest, just in time for him to catch the last train, "we shan't make much out of it."

"Did you give him anything for it, Father?" inquired Mrs. White, regarding her husband closely.

"A trifle," said he, coloring slightly. "He didn't want it, but I made him take it. And he pressed me again to throw it

away."

"Likely," said Herbert, with pretended horror. "Why, we're going to be rich, and famous, and happy. Wish to be an emperor,

Father, to begin with; then you can't be henpecked."

He darted around the table, pursued by the maligned Mrs. White armed with an antimacassar.

Mr. White took the paw from his pocket and eyed it dubiously. "I don't know what to wish for, and that's a fact," he said

slowly. "It seems to me I've got all I want."

"If you only cleared the house, you'd be quite happy, wouldn't you?" said Herbert, with his hand on his shoulder. "Well, wish

for two hundred pounds, then; that'll just do it."

His father, smiling shamefacedly at his own credulity, held up the talisman, as his son, with a solemn face somewhat marred

by a wink at his mother, sat down at the piano and struck a few impressive chords.

"I wish for two hundred pounds," said the old man distinctly.

A fine crash from the piano greeted the words, interrupted by a shuddering cry from the old man. His wife and son ran toward

him.

"It moved," he cried, with a glance of disgust at the object as it lay on the floor. "As I wished, it twisted in my hand like

a snake."

"Well, I don't see the money," said his son, as he picked it up and placed it on the table, "and I bet I never shall."

"It must have been your fancy, Father," said his wife, regarding him anxiously.

He shook his head. "Never mind, though; there's no harm done, but it gave me a shock all the same."

They sat down by the fire again while the two men finished their pipes. Outside, the wind was higher than ever, and the old

man started nervously at the sound of a door banging upstairs. A silence unusual and depressing settled upon all three, which

lasted until the old couple rose to retire for the night.

"I expect you'll find the cash tied up in a big bag in the middle of your bed," said Herbert, as he bade them good night,

"and something horrible squatting up on top of the wardrobe watching you as you pocket your ill-gotten gains."

In the brightness of the wintry sun next morning as it streamed over the breakfast table, Herbert laughed at his fears. There

was an air of prosaic wholesomeness about the room which it had lacked on the previous night, and the dirty, shriveled little

paw was pitched on the sideboard with a carelessness which betokened no great belief in its virtues.

"I suppose all old soldiers are the same," said Mrs. White. "The idea of our listening to such nonsense! How could wishes be

granted in these days? And if they could, how could two hundred pounds hurt you, Father?"

"Might drop on his head from the sky," said the frivolous Herbert.

"Morris said the things happened so naturally," said his father, "that you might, if you so wished, attribute it to

coincidence."

"Well, don't break into the money before I come back," said Herbert, as he rose from the table. "I'm afraid it'll turn you

into a mean, avaricious man, and we shall have to disown you."

His mother laughed, and following him to the door, watched him down the road, and returning to the breakfast table, was very

happy at the expense of her husband's credulity. All of which did not prevent her from scurrying to the door at the postman's

knock, nor prevent her from referring somewhat shortly to retired sergeant majors of bibulous habits, when she found that the

post brought a tailor's bill.

"Herbert will have some more of his funny remarks, I expect, when he comes home," she said, as they sat at dinner.

"I daresay," said Mr. White, pouring himself out some beer; "but for all that, the thing moved in my hand; that I'll swear

to."

"You thought it did," said the old lady soothingly.

"I say it did," replied the other. "There was no thought about it; I had just— What's the matter?"

His wife made no reply. She was watching the mysterious movements of a man outside, who, peering in an undecided fashion at

the house, appeared to be trying to make up his mind to enter. In mental connection with the two hundred pounds, she noticed

that the stranger was well dressed and wore a silk hat of glossy newness. Three times he paused at the gate, and then walked

on again. The fourth time he stood with his hand upon it, and then with sudden resolution flung it open and walked up the

path. Mrs. White at the same moment placed her hands behind her, and hurriedly unfastening the strings of her apron, put that

useful article of apparel beneath the cushion of her chair.

She brought the stranger, who seemed ill at ease, into the room. He gazed furtively at Mrs. White, and listened in a

preoccupied fashion as the old lady apologized for the appearance of the room, and her husband's coat, a garment which he

usually reserved for the garden. She then waited as patiently as her sex would permit for him to broach his business, but he

was at first strangely silent.

"I—was asked to call," he said at last, and stooped and picked a piece of cotton from his trousers. "I come from Maw and

Meggins."

The old lady started. "Is anything the matter?" she asked breathlessly. "Has anything happened to Herbert? What is it? What

is it?"

Her husband interposed. "There, there, Mother," he said hastily. "Sit down, and don't jump to conclusions. You've not brought

bad news, I'm sure, sir," and he eyed the other wistfully.

"I'm sorry—" began the visitor.

"Is he hurt?" demanded the mother.

The visitor bowed in assent. "Badly hurt,"[b]supra skytops for sale

cheap[/b]
he said quietly, "but he is not in any pain."

"Oh, thank God!" said the old woman, clasping her hands. "Thank God for that! Thank—"

She broke off suddenly as the sinister meaning of the assurance dawned upon her and she saw the awful confirmation of her

fears in the other's averted face. She caught her breath, and turning to her slower-witted husband, laid her trembling old

hand upon his. There was a long silence.

"He was caught in the machinery," said the visitor at length, in a low voice.

"Caught in the machinery," repeated Mr. White, in a dazed fashion, "yes."

He sat staring blankly out at the window, and taking his wife's hand between his own, pressed it as he had been wont to do in

their old courting days nearly forty years before.

"He was the only one left to us," he said, turning gently to the visitor. "It is hard."

The other coughed, and rising, walked slowly to the window. "The firm wished me to convey their sincere sympathy with you in

your great loss," he said, without looking around. "I beg that you will understand I am only their servant and merely obeying

orders."

There was no reply; the old woman's face was white, her eyes staring, and her breath inaudible; on the husband's face was a

look such as his friend the sergeant might have carried into his first action.

"I was to say that Maw and Meggins disclaim all responsibility,"[b]nike air jordans

for sale cheap[/b]
continued the other. "They admit no liability at all, but in consideration of your son's services

they wish to present you with a certain sum as compensation."

Mr. White dropped his wife's hand, and rising to his feet, gazed with a look of horror at his visitor. His dry lips shaped

the words, "How much?"

"Two hundred pounds," was the answer.

Unconscious of his wife's shriek, the old man smiled faintly, put out his hands like a sightless man, and dropped, a

senseless heap, to the floor.

In the huge new cemetery, some two miles distant, the old people buried their dead, and came back to a house steeped in

shadow and silence. It was all over so quickly that at first they could hardly realize it, and remained in a state of

expectation, as though of something else to happen—something else which was to lighten this load, too heavy for old hearts

to bear. But the days passed, and expectation gave place to resignation—the hopeless resignation of the old, sometimes

miscalled apathy. Sometimes they hardly exchanged a word, for now they had nothing to talk about, and their days were long to

weariness.

It was about a week after that that the old man,
[url=http://www.itemsclass.com][b]cheap mbt shoes[/b][/url]
waking suddenly in the night, stretched out his hand and

found himself alone. The room was in darkness, and the sound of subdued weeping came from the window. He raised himself in

bed and listened.

"Come back," he said tenderly. "You will be cold."

"It is colder for my son," said the old woman, and wept afresh.

The sound of her sobs died away on his ears. The bed was -warm, and his eyes heavy with sleep. He dozed fitfully, and then

slept until a sudden cry from his wife awoke him with a start.

"The monkey's paw!" she cried wildly. "The monkey's paw!"

He started up in alarm. "Where? Where is it? What's the matter?" She came stumbling across the room toward him. "I want it,"

she said quietly. "You've not destroyed it?"

"It's in the parlor, on the bracket," he replied, marveling. "Why?"

She cried and laughed together, and bending over, kissed his cheek.

"I only just thought of it," she said hysterically. "Why didn't I think of it before? Why didn't you think of it?"

"Think of what?" he questioned.

"The other two wishes," she replied rapidly. "We've only had one."

"Was not that enough?" he demanded fiercely.

"No," she cried triumphantly; "we'll have one more. Go down and get it quickly, and wish our boy alive again."

The man sat up in bed and flung the bedclothes from his quaking limbs.[url=http://cg4w.com/Monster-Headphones-][b]beats dr.dre for sale cheap[/b][/url]
"Good God, you are mad!" he cried, aghast.

"Get it," she panted; "get it quickly, and wish— Oh, my boy, my boy!"

Her husband struck a match and lit the candle. "Get back to bed," he said unsteadily. "You don't know what you are saying."

"We had the first wish granted," said the old woman feverishly; "why not the second?"

"A coincidence," stammered the old man.

"Go and get it and wish," cried the old woman, and dragged him toward the door.

He went down in the darkness, and felt his way to the parlor, and then to the mantelpiece. The talisman was in its place, and

a horrible fear that the unspoken wish might bring his mutilated son before him ere he could escape from the room seized upon

him, and he caught his breath as he found that he had lost the direction of the door. His brow cold with sweat, he felt his

way around the table, and groped along the wall until he found himself in the small passage with the unwholesome thing in his

hand.

Even his wife's face seemed changed as he entered the room.[url=http://www.itemsclass.com/Vibram-Five-Fingers--][b]vibrm five fingers shoes[/b][/url]
It was white and expectant, and to his fears seemed to have an unnatural look

upon it. He was afraid of her.

"Wish!" she cried, in a strong voice.

"It is foolish and wicked," he faltered.

"Wish!" repeated his wife.

He raised his hand. "I wish my son alive again."

The talisman fell to the floor, and he regarded it shudderingly. Then he sank trembling into a chair as the old woman, with

burning eyes, walked to the window and raised the blind.

He sat until he was chilled with the cold, glancing occasionally at the figure of the old woman peering through the window.

The candle end, which had burned below the rim of the china candlestick, was throwing pulsating shadows on the ceiling and

walls, until, with a flicker larger than the rest, it expired. The old man, with an unspeakable sense of relief at the

failure of the talisman, crept back to his bed, and a minute or two afterward the old woman came silently and apathetically

beside him.

Neither spoke, but both lay silently listening to the ticking of the clock. A stair creaked, and a squeaky mouse scurried

noisily through the wall. The darkness was oppressive,[b]moncler down jackets

for sale cheap[/b]
and after lying for some time screwing up his courage, the husband took the box of matches, and

striking one, went downstairs for a candle.

At the foot of the stairs the match went out, and he paused to strike another, and at the same moment a knock, so quiet and

stealthy as to be scarcely audible, sounded on the front door.

The matches fell from his hand. He stood motionless, his breath suspended until the knock was repeated. Then he turned and

fled swiftly back to his room, and closed the door behind him. A third knock sounded through the house.

"What's that?" cried the old woman, starting up.

"A rat," said the old man, in shaking tones, "a rat. It passed me on the stairs."

His wife sat up in bed listening. A loud knock resounded through the house.

"It's Herbert!" she screamed. "It's Herbert!"

She ran to the door, but her husband was before her,[b]cheap adidas

shoes[/b]
and catching her by the arm, held her tightly.

"What are you going to do?" he whispered hoarsely.

"It's my boy; it's Herbert!" she cried, struggling mechanically. "I forgot it was two miles away. What are you holding me

for? Let go. I must open the door."

"For God's sake don't let it in," cried the old man, trembling.

"You're afraid of your own son," she cried, struggling. "Let me go. I'm coming, Herbert; I'm coming."

There was another knock,[url=http://cg4w.com/MBT-Shoes-c48/][b]mbt shoes for sale cheap[/b][/url]
and another. The old

woman with a sudden wrench broke free and ran from the room. Her husband followed to the landing, and called after her

appealingly as she hurried downstairs. He heard the chain rattle back and the bottom bolt drawn slowly and stiffly from the

socket. Then the old woman's voice,[url=http://www.itemsclass.com/MBT-shoes--c38/][b]cheap mbt shoes[/b][/url]

strained and panting.

"The bolt," she cried loudly. "Come down. I can't reach it.[b]adidas jeremy scott

js wings for sale cheap[/b]
"

But her husband was on his hands and knees groping wildly on the floor in search of the paw. If he could only find it before

the thing outside got in. A perfect fusillade of knocks reverberated through the house, and he heard the scraping of a chair

as his wife put it down in the passage against the door. He heard the creaking of the bolt as it came slowly back, and at the

same moment, he found the monkey's paw, and frantically breathed his third and last wish.

The knocking ceased suddenly, although the echoes of it were still in the house. He heard the chair drawn back and the door

opened. A cold wind rushed up the staircase, and a long, loud wail of disappointment and misery from his wife gave him

courage to run down to her side, and then to the gate beyond.[b]tory burch

flats for sale cheap[/b]
The streetlamp flickering opposite shone on a quiet and deserted road.

Copyright: this story is in the public domain and not protected by copyright [b]monster beats

for sale cheap[/b]
.

by supras (guest), 17 Aug 2011 18:51

你好,最近看了你开发的实用工具,但很遗憾和别的快捷方式工具比并没有我迫切要用的功能! 所以提个建议,把设置里的电话下sim卡自带应用做成快捷方式! 最好能一键调用! 因为这个功能是一卡多号用户经常要用的功能,但现在操作确需要4步。。。。。。。。 简直头痛! 在一些论坛上大家也迫切需要这样的功能,无奈自己不会编程,所以求助你做一个这样的工具造福大家! 谢谢先!

hihi
mqjxmqjx 06 Jul 2008 03:37
in discussion General Discussion / General » hihi

hi…

hihi by mqjxmqjx, 06 Jul 2008 03:37

由於最近寫了一些程式,其中碰到了不少檔案控制的問題,特別是在多工系統上
,如何確保能正確的對檔案做讀取或更改之動作,這些幾乎是平常很少注意的細節,
因此在一番摸索後,總算也才有一點點心得,在此與大家分享,也請大家多多指教!

以下便是關於如何用C語言做到檔案的上鎖(file locking)與解鎖之一些方法,
由於用到一些特殊函數,因此只能在UNIX或UNIX-like 如Linux 等作業系統中使用,
Compiler 部份則建議使用gcc 。

要如何對檔案做lock與unlock之動作呢?其實方法至少便有三種之多,分別是使
用下列之function:
/*** Method 1 ******/
#include t
#include t
#include t

int fcntl(fd, cmd, arg)
int fd,cmd,arg;

/*** Method 2 ******/
#include t
#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* excluded lock */
#define LOCK_NB 3 /* don't block when locking */
#define LOCK_UN 4 /* unlock */

int flock(fd,operation)
int fd,operation;

/*** Method 3 ******/
#include t
int lockf(fd,cmd,size)
int fd,cmd;
long size;

若要說起最正式之用法,或者說是功能最強大之用法,那麼就非Method 1莫屬;
但對於僅僅只要從事lock file 而言,Method 3卻是最簡單之方法,因此在此也就以
Method 3 為例,介紹其基本用法!

首先再看一次其function prototype:
int lockf(fd,cmd,size)
int fd,cmd;
long size;
其中之fd為檔案之handle number ,cmd 為所要使用lockf 之何種功能,size則
為執行此功能所要影響之範圍大小。

眼尖的看倌或許已經發現,在此所使用之file handle number為int 型態,並非
我們平常慣用之FILE型態;事實上對於檔案之開啟,除了我們常使用之FILE *fopen
外,尚可使用int open此函數,而FILE這個資料型態事實上也並非是一種 primary
data type ,而是在stdio.h 中所定義之一種struct而已,由此不難想見,在一些較
低階,較乏人使用之function中,自然使用int 之file handle number者會較多囉!
但問題是對於習慣使用fopen 的使用者而言,一旦改用open之後,固然開檔問題解決
了,但其它常用之函數如fscanf, fgets 等等卻都將因為所傳之file handle 型態不
同而無法使用;所幸的是,在 stdio.h 中也提供了另一個 function : int fileno
(FILE *fd) ,藉由此函數,使用者便不須改用 open做為檔案開啟之工具,而仍然可
以繼續使用fopen 開啟檔案,同時可繼續使用 fscanf fgets 等等函數,只要在使用
lockf 前,將file handle 用fileno 轉成int 型態代入即可!

其次是cmd 這個參數要代進什麼樣的數值呢?其實在unistd.h中也有以下之定義
,使用時只要依照所需代入即可:
#define F_ULOCK 0 /* Unlock a previously locked section */
#define F_LOCK 1 /* lock a section for exclusive use */
#define F_TLOCK 2 /* test and lock a section(non-blocking) */
#define F_TEST 3 /* test section for other process' locks */
其中F_TEST並無lock之功能,其主要目的只是在測試檔案是否正被其它 process
鎖住而已,當已被鎖住時lockf 傳回-1,否則傳回0 ;而F_LOCK和F_TLOCK 之功能皆
為將檔案鎖住,不同之處在於倘若此檔案原先已被其它process 鎖上時,F_LOCK 會
block 住,並等候此檔案直至被解除鎖定為止,至於F_TLOCK 則並不會將自己 block
住,而會馬上傳回-1,至於F_TLOCK 等不等於下列程式呢?
while (lockf(fd,F_TEST,0L)==-1) {}
lockf(fd,F_LOCK,0L);
結果當然是不等於囉!因為這就必需考慮到critical section等問題了!當然,
對於一個單純的系統而言,F_LOCK便可以達到目的,但對於大系統而言,由於許多難
已預測之因素,倘若某process 沒有把檔案unlock,則使用F_LOCK便將因等不到檔案
可以上鎖而使整個系統陷入starvation,這是程式設計者必需先考慮清楚的風險!

那麼lockf 的最後一個參數size又要如何使用呢?其實size的值指的就是從檔案
目前之讀取位置開始,要往前或往後多少位置做lock或unlock之動作,而假若是要對
整個檔案做lock或unlock的話,則並不需要特別去量測size大小,只要直接輸入0 即
可,lockf 便會知道所要影響之範圍為整個檔案了!

以上便是利用lockf 這個函數之方法,下面則是一個小例子,不妨實際測試一下
,相信必可更增進對此函數之了解!

/*
file name: run1.c
data file: file
Program 1: Change number in a file without locking file
Compile: gcc -o run1 run1.c
Usage: run1 1 file &p run1 2 file &p
*/
#include t
void main(int argc, char *argv[]){
FILE *in;
int i=10,temp;
if (argc-3) {
printf("t\nUsage %s id file\n"t,argv[0]);
return;
}
while (i){
in = fopen(argv[2],"tr+"t);
fscanf(in,"t%d"t,&ptemp);
temp++;
fseek(in,0L,0);
fprintf(in,"t%d"t,temp);
printf("t\n\tid = %s\tnum = %d"t,argv[1],temp);
fclose(in);
i—;
}
}

/*
file name: run2.c
data file: file
Program 1: Change number in a file with file locking
Compile: gcc -o run2 run2.c
Usage: run2 1 file &p run2 2 file &p
*/
#include t
#include t
void main(int argc, char *argv[]){
FILE *in;
int i=10,temp;
if (argc-3) {
printf("t\nUsage %s id file\n"t,argv[0]);
return;
}
while (i){
in = fopen(argv[2],"tr+"t);
lockf(fileno(in),F_LOCK,0L);
fscanf(in,"t%d"t,&ptemp);
temp++;
fseek(in,0L,0);
fprintf(in,"t%d"t,temp);
printf("t\n\tid = %s\tnum = %d"t,argv[1],temp);
lockf(fileno(in),F_ULOCK,0L);
i—;
}
}

lockf() 使用方法 by superartsuperart, 12 Jun 2008 06:59

使用lockf 命令

man lockf: lockf — execute a command while holding a file lock

例:如果要执行 /home/lg/run.sh ,

/usr/bin/lockf -t 0 /tmp/run.lock /home/lg/run.sh

例子的含义是:
1、/usr/bin/lockf -t 0 /tmp/run.lock /home/lg/run.sh 开始运行时首先检查 /tmp/ 下是否有run.lock 文件,是,不执行/home/lg/run.sh,退出,否,生成/tmp/run.lock 文件,执行/home/lg/run.sh

2、当/home/lg/run.sh 执行完成后,lockf 删除/tmp/run.lock

既然你一开始就认为这种想法不妥,那么直接无视即可,也请不要浪费那些真正关心这个问题的人的时间,比方说我

发文了就要有接受批判的心理准备;发布一个命题,就不能直接认定自己的命题是真命题,就要接受别人认为这是假命题的质疑。对于花时间看了你的文章的人,提出任何自己的意见,都不能说是“浪费”你的时间,因为照这么说,你的文章不也“浪费”了其他人的时间?请不要写了一篇文章就不允许别人质疑你的文章没意义,办不到。

Blizzard的游戏一向不支持“无限强大的宏”,比如WOW中必须要有的1sec cool down,比如作者所说的一些限制。请不要认为这些限制是Blizzard的短视、bug、技术限制,事实上玩家应该有体会,宏的功能和游戏节奏、平衡性都有关系,并非越强大越好。详细的不说了,反正也没人仔细看……

- superarts.org

Reply to A Post by superartsuperart, 11 Jun 2008 10:09

1: 87 - 90
2: 24 - 30
5: 6 - 7
10: 2 - 3

10000: 76
1000: 100 - nearly crush

usleep() test on my computer by superartsuperart, 11 Jun 2008 10:05

不错~~~~~~

笑话
superartsuperart 06 Jun 2008 03:16
in discussion 综合讨论区 / 综合 » 笑话

请问金庸先生写了哪十四部作品?
肥户外传、穴煽肥户、连蹭诀、舔弄八部、射吊硬雄传、白玛小细缝、露腚记、小凹浆户、叔奸恩愁录、神吊吓驴、侠渴性、易舔凸弄记、逼血溅、猿痒到。

笑话 by superartsuperart, 06 Jun 2008 03:16
  1. GUI是用来“用”的,“学习”还是多google吧。对普通用户来说那些信息似乎意义不大。
  2. So far,yum确实不如apt。这是我用ubuntu的两大原因之一。(另一个是RT Kernel的易用性,Planet ccrma不是很好用。)
  3. 同上……多少和包管理机制有关系。
  4. 不清楚,用gnome。不过fedora的gnome也一样稳定啊,作者这么说不确定是xfce的问题,还是fedora的问题。
  5. 分开说:
    • QQ:eva可以,pidgin也可以,但确实有可能某些帐号无法使用。这个不要怪linux了,tecent的问题,这个公司RP不敢恭维,反正我用MSN——Microsoft的RP都比他好得多。
    • Game:Linux通用问题。Quake3,xmame,rrotage,小游戏(不预装某些游戏不算发行版的缺点吧?)。不过fedora好像有game的spin,您可以看看。话说game还是玩wii吧。
    • scim现在很OK。
  6. 下载是您自己设定有问题,和source也有关系。sourceforge直接下载100K说明单线程没问题,多线程可以用lftp,bt我用 azureus,经常100K。amule确实没搞定。还是那句话,这些问题和发行版关系真的不大……您大可说是linux的通用问题。wine这东西最好少用。
  7. 比得上vista?unrar现在没问题了。
  8. 算是os通用问题了(mac不知道),windows、linux对重装支持都不好。不过linux至少可以备份/home……据说windows 7会改善,拭目以待。
  9. 硬件支持f8有很好的改善。
  10. 参见2,yum目前确实不如apt。

我喜欢fedora,而且一直再用。不过有些问题想抱怨一下。我现在很难恰当的解决这些问题。所以认为是fedora自身的毛病

1,fedora的所有图形界面工具缺少底层信息的显示,我并不能知道最后执行了那些命令,或者那些文件被修改了。这个很不透明。也不利于学习。相比直辖suse上的配置软件好一些

2,yum 升级到rawhide以后会产生很多问题。比如我是fc7, yum升级某个库到fc8,接下来有的软件rpm时候需要fc7的某个库。否则就装不上。或者只能用nodeps 或者froce覆盖哪个fc8版。 而且yum没法回退。很麻烦。很容易造成库混乱,相比之下ubuntu的apt似乎好一些。

3,有的包需要的库要装了之后才知道。比如fvwm需要libstroke,但是他给我装上了,启动时候死掉。看。xsession-error时才看到。 realplay需要以前的c++库才能正确运行。可是安装时并没有提示。只有运行时才报错。redhat自己的包都有这种问题。何况第三方的。

4,xfce太不稳定。经常死掉,而且是按ctrl-alt f* 都没法退出的问题。看来只能玩玩。 不装kde时候kde上的软件不能用。而ubuntu的gnome下面可以不做任何设置直接运行kde的东西。

5,直接装上的QQ不能用,也没人更新。只好用eva,缺省安装时连mc等基本工具都没有。游戏太烂,都没什么游戏性。缺省时bsd-game也不装,Xchess还经常把我的X弄崩溃。scim和 firefox有冲突。经常切换几个页面后就无法打字了。还是fcitx好用

6,amule要自己设置和firefox连接。麻烦, bt下载都很慢,还要手动开端口,最后只好用utorrent。wine问题多多。软件放个lnk在桌面上它也不管是不是真的能用。(下载速度实在慢!)

7,占磁盘大。默认的fileroller的rar只能打开很老的rar包,很多rar包打开时候会认不出。只好用虚拟机里的xp解压缩后再拷出来

8,夸版本升级会留下很多问题。我用yum从fc5到fc7,结果三维桌面什么的就没有了。release不能直接升级到rawhide, rawhide升级到release也很麻烦。

9,对有的U盘支持不好,我的朗科u盘fat32怎么都不认,后来我在fedora下用fat32再格式化一遍才能认出来。现在改了很多设备的名字, 有时还要demsg找一番才能找到新的设备名。(我的ipod也出现不能卸载的问题,要强行插拨)

10,图形化的软件安装界面很糟糕,出了错就跳出一个unknow error让你猜。软件升级system-config-packages启动很慢,出现dependence error时也是只告诉出错了。缺少某个lib,让你自己找。(本人对此深以为然,因为我除了以前遇到安装Realplayer时出现类似问题,在安装星际译王也出现类似缺少某个库的情况!)

综上,越来越多的gui软件把系统弄得越来越难用。我希望软件是个真正的帮手,cmd和gui界面并不重要。但我不想要徒有一个gui界面。然后跳出一些莫名的错误提示。系统的配置应该集中。需要很好的文档说明。幸好有emacs还能整合系统。要不然真是难用阿。

文章来源:作者博客 http://blog.csdn.net/hide1713/archive/2007/10/02/1809673.aspx

言之有理, 哈哈

Re: Welcome! by Anonymous (218.17.67.x), 04 Jun 2008 04:14
Re: Welcome!
saorrensaorren 02 Jun 2008 19:24
in discussion General Discussion / General » Welcome!

hi this is saorren~ first (second?) user here! XD thank you for inviting me…

不打中文的话会不会吓跑中国的同胞呢~~

多多指教~~

Re: Welcome! by saorrensaorren, 02 Jun 2008 19:24
Welcome!
superartsuperart 02 Jun 2008 08:27
in discussion General Discussion / General » Welcome!

Leave your message here please :)

Welcome! by superartsuperart, 02 Jun 2008 08:27
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License