LGF

more options

  

Advertisement

Tech Note: Safely Going Live with New Code

Mon, May 12, 2008 at 4:20:02 pm PDT

Tonight's geeked out post has to do with the difficulty of safely uploading changed web application files. Pretty sexy, huh?

When I make changes to one of the PHP scripts that drive the LGF Blog Engine, the new file has to be uploaded to the LGF web server, of course. The problem comes if someone happens to browse to that file while the upload process is taking place; this can lead to the browser being served corrupted data. The user may see a partial page load, an error, or just a blank screen in that case, and we all know how painful that can be.

The solution to this problem is known as a "file swap." You upload the new file with a different temporary name, then rename the new file to the original name. This works because the Linux 'mv' command (which is used to rename files) does not actually rewrite any data; it simply changes the filename-to-inode mapping, so that the filename points to the new data. If the old file data is being read in the middle of this operation, it's not a problem because the data continues to exist in its old location (for a while); the operating system doesn't reallocate the inode and overwrite that data until all open file handles to it are closed.

In those long-ago days of yesteryear when the LGF Blog Engine was based on a flat file system, I used this swapping technique for almost everything, and solved some serious problems with race conditions that would occasionally wipe out files.

To finish off this short exercise in geekitude, here's a bash shell script I use to automatically rename any recently uploaded temporary files.

(Note: when I upload a temporary file, I use the naming convention 'filename.tmp.php' so that the file is still a valid PHP file; this way if someone just happens to browse to it before it's renamed, they won't see a page full of PHP code. That would be annoying to them and a possible security problem for LGF.)

#!/bin/bash
#
# Rename LGF temp files to live versions
cd /path/to/weblog/folder/
for tmp in `ls -1 *.tmp.php`
do {
mv -i $tmp `echo $tmp | awk -F. '{print $1 "." $3}'`
}
done

Advertisement

131 comments

  • Comments are open and unmoderated, and do not necessarily reflect the views of Little Green Footballs.
  • Obscene, abusive, silly, or annoying remarks may be deleted, but the fact that particular comments remain on the site in no way constitutes an endorsement of their views by Little Green Footballs.
  • Posts that contain phone numbers, street addresses, email addresses or other personal information will also be deleted, as will posts that consist only of a variation on the word, "First!"
  • Comments that advocate violence will be cause for immediate banning with no appeal.
  • Disagreement and debate are welcome, but insults and abuse are not, and may cause your account to be blocked.
  • REMEMBER: posting comments at LGF is a privilege, not a right. Abuse that privilege, and your account will be blocked.

Hide comments | Jump to bottom

1 jcm  Mon, May 12, 2008 4:21:24pm

Geek!

2 coquimbojoe  Mon, May 12, 2008 4:21:54pm

No boobs? Inflated scrotums?

3 jcm  Mon, May 12, 2008 4:22:32pm

re: #2 coquimbojoe

No boobs? Inflated scrotums?

All bloatware.

4 Fat Jolly Penguin  Mon, May 12, 2008 4:23:09pm
some very annoying problems with race conditions

Call in the Obamessiah!

5 Killgore Trout  Mon, May 12, 2008 4:23:42pm
#!/bin/bash


Sounds violent.

6 goddessoftheclassroom  Mon, May 12, 2008 4:24:08pm

Good evening, Lizards.

It's so dang cold here in Western PA!

7 Kosh's Shadow  Mon, May 12, 2008 4:24:27pm

I had to deal with changed files while working on a web cache.
We do range requests and check the header information. If the size, modification time, or etags change, then we abort, fail the caching operation, and retry.
Can't get browsers to do that, though. Servers, maybe, should hold the file open, but then when it was busy, you'd never get to update files.

8 coquimbojoe  Mon, May 12, 2008 4:25:09pm

FJP, KT, JCM, it looks like we have a minyon, or a quorum...

9 Kosh's Shadow  Mon, May 12, 2008 4:25:12pm

Speaking of race problems, I understand Speed Racer is pretty lame.
Looks it from the previews.

10 coquimbojoe  Mon, May 12, 2008 4:25:49pm

re: #6 goddessoftheclassroom

Good evening, Lizards.

It's so dang cold here in Western PA!

90s here in Vegas... Bleeeaaaack!

11 buzzsawmonkey[deleted]  Mon, May 12, 2008 4:26:07pm
12 coquimbojoe  Mon, May 12, 2008 4:26:12pm

re: #9 Kosh's Shadow

Speaking of race problems, I understand Speed Racer is pretty lame.
Looks it from the previews.

Who woulda thunk it?

13 jcm  Mon, May 12, 2008 4:26:22pm

re: #6 goddessoftheclassroom

Good evening, Lizards.

It's so dang cold here in Western PA!

See, Obama was right, clinging to Guns and Religion wouldn't pay the heating bills.

14 coquimbojoe  Mon, May 12, 2008 4:26:53pm

Man, this thread is going off the rails fast...

15 Thanos  Mon, May 12, 2008 4:27:04pm

Glad you had the good sense to use a fake directory structure in your example Charles, part of security is keeping the pathing invisible.

16 beens21  Mon, May 12, 2008 4:29:07pm

can someone tell me if there is a problem with Windows SP3 service pack.

17 Killgore Trout  Mon, May 12, 2008 4:29:11pm

Brussels journal is still down. I wonder if the BNP ad will be there when it comes back.

18 jcm  Mon, May 12, 2008 4:29:13pm

re: #14 coquimbojoe

Man, this thread is going off the rails fast...

Off the rails.

19 Killgore Trout  Mon, May 12, 2008 4:29:45pm

re: #16 beens21

I've heard rumors that it has caused some problems.

20 jcm  Mon, May 12, 2008 4:30:07pm

re: #16 beens21

can someone tell me if there is a problem with Windows SP3 service pack.

XP SP3 cripples some PCs with endless reboots
Only AMD systems affected, says former Microsoft security manager

21 Izzy Dunne  Mon, May 12, 2008 4:32:43pm

re: #14 coquimbojoe

Man, this thread is going off the rails fast...

Ruby, don't take your love to town.

22 beens21  Mon, May 12, 2008 4:34:34pm

re: #20 jcm

XP SP3 cripples some PCs with endless reboots
Only AMD systems affected, says former Microsoft security manager

thanks for info,I think I will pass on installation.

23 Walter L. Newton  Mon, May 12, 2008 4:35:02pm

Three to four inches of snow coming tonight in the Denver-Metro area. It was 71 degrees today, in the low 30's tonight. We've been having these global warming problems all year.

This is the third time I've posted the weather today. I must be really bored, or just lazy. I can't think of anything else to talk about.

Walter in Golden, Co.

24 BulgarWheat  Mon, May 12, 2008 4:35:14pm

re: #5 Killgore Trout

Bourne Shell. Nothing to fear there.

25 vxbush  Mon, May 12, 2008 4:35:57pm

Sneaky, Charles. And nice. I suppose I should spend some time learning more about awk, but it just drives me nuts, using the same rules as sed. Blech.

26 Kosh's Shadow  Mon, May 12, 2008 4:36:38pm

re: #16 beens21

can someone tell me if there is a problem with Windows SP3 service pack.

I haven't risked it yet.
My desktop is old, and my laptop is a Mac, so I need to see if Parallels has any problems with SP3 before I move to it.
Of course, I'm safer with the laptop; I could take a snapshot first.

27 itellu3times  Mon, May 12, 2008 4:37:07pm

You can also shut'r down for the ten minutes it takes, esp plausible if you do it on a scheduled and preannounced basis.

Real live system updating gives me the willies.

28 goddessoftheclassroom  Mon, May 12, 2008 4:37:11pm

re: #13 jcm

See, Obama was right, clinging to Guns and Religion wouldn't pay the heating bills.

OMG! HAHAHAHAHAHAHAHA!

29 gop_patriot  Mon, May 12, 2008 4:39:12pm

re: #23 Walter L. Newton

LOL!

30 Psaturn  Mon, May 12, 2008 4:39:58pm

Sooo Geeky !

Could someone tell me if the computer programs can evolve on its own without an intelligence behind it?

/runs away....

31 jcm  Mon, May 12, 2008 4:41:06pm

re: #30 Psaturn

Sooo Geeky !

Could someone tell me if the computer programs can evolve on its own without an intelligence behind it?

/runs away....

You obviously have not seen Terminator.

32 Pent.  Mon, May 12, 2008 4:41:13pm

re: #30 Psaturn

Sooo Geeky !

Could someone tell me if the computer programs can evolve on its own without an intelligence behind it?

/runs away....

The field of artificial intelligence has actually made woefully little progress since its conception (mainly because of the sheer difficulty of the problems involved).

33 Kosh's Shadow  Mon, May 12, 2008 4:41:34pm

re: #24 BulgarWheat

Bourne Shell. Nothing to fear there.

But some people fear its sequel, the Bourne Again Shell.
/There really is one, but I think the only ones afraid of it are afraid of all Unix command interpreters.

There is another shell, the C shell
Did you hear about the woman who set up a store on the beach selling Unix command intpreters?
She sells C shells by the seashore.

34 Walter L. Newton  Mon, May 12, 2008 4:41:39pm

re: #30 Psaturn

Sooo Geeky !

Could someone tell me if the computer programs can evolve on its own without an intelligence behind it?

/runs away....

See: Microsoft

Walter in Golden, Co.

35 Empire1  Mon, May 12, 2008 4:41:44pm

The scary part is that I think I actually understand this, since I use a similar method when I upload files to my LOTGD game.

36 Kosh's Shadow  Mon, May 12, 2008 4:42:24pm

re: #34 Walter L. Newton

See: Microsoft

Walter in Golden, Co.

There certainly is little intelligence there, except on the business (monopoly) side.

37 Psaturn  Mon, May 12, 2008 4:42:28pm

re: #34 Walter L. Newton

See: Microsoft

Walter in Golden, Co.


HA!

38 goddessoftheclassroom  Mon, May 12, 2008 4:42:56pm

Especially appropriate for Charles...

39 Pent.  Mon, May 12, 2008 4:43:20pm

re: #33 Kosh's Shadow

But some people fear its sequel, the Bourne Again Shell.
/There really is one, but I think the only ones afraid of it are afraid of all Unix command interpreters.

There is another shell, the C shell
Did you hear about the woman who set up a store on the beach selling Unix command intpreters?
She sells C shells by the seashore.

There's nothing scary about the terminal. For instance, the following 13 characters will execute a fork bomb when entered in bash or zsh shell:
:(){ :|:& };:

40 ted  Mon, May 12, 2008 4:44:01pm

If I have problems opening my email I have to call the Geeksquad.

Oh the humiliation !

41 goddessoftheclassroom  Mon, May 12, 2008 4:44:29pm

re: #38 goddessoftheclassroom

Especially appropriate for Charles...

Whoops, take 2:

[Link: icanhascheezburger.files.wordpress.com...]

42 DownRightMeanAmerican  Mon, May 12, 2008 4:44:40pm

re: #23 Walter L. Newton

By the end of this week its going to be 99 deg (we will see), today it was 63 and overcast or early June gloom.

43 reno911  Mon, May 12, 2008 4:45:34pm

The more I observe BHO the more I am convinced he is a closet revolutionary. BHO seeks to usher in socialism (at least) through the back door. The question is; will our fellow citizens fall for it?

Status Quo!

44 jcm  Mon, May 12, 2008 4:46:37pm

re: #43 reno911

The more I observe BHO the more I am convinced he is a closet revolutionary. BHO seeks to usher in socialism (at least) through the back door. The question is; will our fellow citizens fall for it?

Status Quo!

Not so closeted. Only trying out the closet for since since running for national office.

45 attaboid  Mon, May 12, 2008 4:47:02pm

Sequence, selection, iteration. It's all you need.

Yeah, and data structures.

46 Psaturn  Mon, May 12, 2008 4:47:25pm

By the way, one computer I have has Vista...

It reboots on its own!

Someone here said something about shadow copy to remove it and I cannot even find it !

I cannot even use HP help either...it does not work!

And even Norton does not work !

Gosh !

I have not even really used this puter...I am still using the Mac that is 4 yrs old! And I am having all kinds of problems with VISTA !

I am really NOT impressed with Vista!

And I know how to use computer !

I mean...

Mac is not perfect...but I was able to fix a problem I had...after I upgraded my hard drive from 160 gb to 500 GB then I had problems with some programs like the Safari and the iTunes would not turn ON...and I was unable to get installer to work! I found a workaround by searching Mac helps...and also the fact that I get the UNIX terminal to let me know what was the failure...that was like wow ! I used the word of that failure and made a search using Google and voila !

I am still scratching on this Vista...

47 wrenchwench  Mon, May 12, 2008 4:48:50pm
{print $1 "." $3}

Those $3 bills will be harder to pass...

48 Dr. Shalit  Mon, May 12, 2008 4:49:24pm

Charles -

Though I sort of understand it #1 stole my thunder as in "Its ALL GEEK To Me." And, verry interresting that SP3 "Affects AMD Only" - our Secretary runs a 2003 Dell Dimension Desktop, Pentium 4, and seems to have had problems - since resolved - after installing SP3 on a few programs, most notably "OWP (One Write Pass)" from Peachtree which probably should be running on Windows 3.1 and not on XP. Oh well. Perhaps the reason behind SP3 is to screw with XP so badly that you convert to VISTA - to all 'y'all conspiracy theorists out there - Please Discuss.

-S-

49 Russkilitlover  Mon, May 12, 2008 4:50:51pm

re: #43 reno911

The more I observe BHO the more I am convinced he is a closet revolutionary. BHO seeks to usher in socialism (at least) through the back door. The question is; will our fellow citizens fall for it?

Status Quo!

Back door? If this doofus makes it to the WH, it'll be through the front doors accompanied by bands and a parade.

50 jcm  Mon, May 12, 2008 4:57:55pm

re: #46 Psaturn

Vista requires serious horsepower to run effectively. Take the MS mins and double, and add some more to have a truly Vista ready machine.

Not all hardware is Vista compatible, even if the upgrade advisor says so. To find out you have to search the forums and KB articles to find out.

Apple has the advantage of building the hardware and writing the OS.

51 Render  Mon, May 12, 2008 4:58:02pm

eh...

I've been running XP/Pro SP3 on the War Machine for about two weeks now without any issues.

SMOKIN,
R

52 stevieray  Mon, May 12, 2008 5:01:13pm

re: #16 beens21

can someone tell me if there is a problem with Windows SP3 service pack.

I installed it a few days ago. No problems so far... took about an hour to download and install.

53 freetoken  Mon, May 12, 2008 5:01:19pm

Well,

$tmp


reminds me that today the US postage $tamps have gone up in price...

54 CyanSnowHawk  Mon, May 12, 2008 5:01:54pm

re: #20 jcm

XP SP3 cripples some PCs with endless reboots
Only AMD systems affected, says former Microsoft security manager

If you download the *.iso CD image and do the installation from that, the problem does not manifest.

55 jcm  Mon, May 12, 2008 5:02:27pm
56 MandyManners  Mon, May 12, 2008 5:05:42pm

re: #6 goddessoftheclassroom

Good evening, Lizards.

It's so dang cold here in Western PA!

How cold is it?

57 ec marm  Mon, May 12, 2008 5:06:56pm

re: #56 MandyManners

How cold is it?


In Pennsylvania? Bitter cold, of course.

58 freetoken  Mon, May 12, 2008 5:07:30pm

re: #55 jcm

Life is cheaper in Asia... it seems sometimes...

59 bryantms  Mon, May 12, 2008 5:07:50pm

So what was the update the the LGF Blog Engine this time around Charles?

60 goddessoftheclassroom  Mon, May 12, 2008 5:07:51pm

re: #56 MandyManners

How cold is it?

It's 49 degrees right now, and I WILL NOT turn on the heat in May!

/I know, such stubbornness deserves to suffer...

61 A Kiwi Infidel  Mon, May 12, 2008 5:08:28pm

re: #55 jcm

China quake toll at 9000.

Burma "official" toll 28,458 with 33,416 missing. One aid flight today.

Highest of High General Boob "tell the world only 28,458 dead"

Private Parts "But sir, there are many thousands dead"

The Boob "die, fool"

62 goddessoftheclassroom  Mon, May 12, 2008 5:08:33pm

re: #57 ec marmz

In Pennsylvania? Bitter cold, of course.

Oh, CLEVER!

63 GeeWiz  Mon, May 12, 2008 5:09:52pm

re: #46 Psaturn

What JCM said @ #50 said. I'm running Vista Home Premium on a HP laptop and have had no issues at all. I suspect you have a hardware issue. The minimum requirements that MS posts for Vista is a joke. If you give Vista the resources, it performs very well. I happen to like it. This comes from a MS user dating back to DOS 3.1 and not afraid to condemn MS for all it's short-comings for they are many.

64 A Kiwi Infidel  Mon, May 12, 2008 5:10:08pm

re: #56 MandyManners

How cold is it?


This cold

65 CyanSnowHawk  Mon, May 12, 2008 5:11:09pm

re: #58 freetoken

Life is cheaper in Asia... it seems sometimes...

It is anywhere that the ideal of "All men are created equal" is lacking or only given lip service.

66 A Kiwi Infidel  Mon, May 12, 2008 5:11:38pm

re: #55 jcm

China quake toll at 9000.

Burma "official" toll 28,458 with 33,416 missing. One aid flight today.

And I'll wager (not that I will) that 9,000 is gunna end up being a serious underestimation, as well.

67 ec marm  Mon, May 12, 2008 5:11:39pm

re: #60 goddessoftheclassroom

It's 49 degrees right now, and I WILL NOT turn on the heat in May!


Geez, warmer on the other side of the state. Only 47 degrees here, right now. The northeaster is finally starting to move east again, after stalling all day. I've set my mindset to Oct. 15 to April 15 is heating season. Not one day more!

68 GeeWiz  Mon, May 12, 2008 5:12:05pm

re: #64 A Kiwi Infidel

Tell the Goracle! He needs a clue.

69 jcm  Mon, May 12, 2008 5:12:41pm

re: #63 GeeWiz

What JCM said @ #50 said. I'm running Vista Home Premium on a HP laptop and have had no issues at all. I suspect you have a hardware issue. The minimum requirements that MS posts for Vista is a joke. If you give Vista the resources, it performs very well. I happen to like it. This comes from a MS user dating back to DOS 3.1 and not afraid to condemn MS for all it's short-comings for they are many.

I've had to install Vista on several machines in the Lab for hardware or software testing.

The machine Vista runs best on so far for me.

My MacBook Pro.

70 A Kiwi Infidel  Mon, May 12, 2008 5:13:00pm

re: #65 CyanSnowHawk


In China and India (among others) some are created more equal than others

71 DesertSage  Mon, May 12, 2008 5:13:15pm

I really like my Vista. I'll never go back to XP.
XP will be obsolete pretty soon anyhow.

72 A Kiwi Infidel  Mon, May 12, 2008 5:14:00pm

re: #68 GeeWiz


That was the Goracle, when your balls are that frozen you are NEVER going to think straight.

73 experiencedtraveller  Mon, May 12, 2008 5:14:01pm

re: #71 DesertSage

I really like my Vista. I'll never go back to XP.
XP will be obsolete pretty soon anyhow.

Lying to your friends eh sage?

74 goddessoftheclassroom  Mon, May 12, 2008 5:14:26pm

re: #67 ec marm

Geez, warmer on the other side of the state. Only 47 degrees here, right now. The northeaster is finally starting to move east again, after stalling all day. I've set my mindset to Oct. 15 to April 15 is heating season. Not one day more!

GMTA! I try to last until November if I can...

What do you set your thermostat on? I keep mine no higher than 65 unless my mom comes over. At night or when we're not home, I set it to turn down to 55.

75 DesertSage  Mon, May 12, 2008 5:15:05pm

re: #73 experiencedtraveller

Lying to your friends eh sage?

Well it sounded good for a while.

76 jcm  Mon, May 12, 2008 5:15:28pm

re: #66 A Kiwi Infidel

And I'll wager (not that I will) that 9,000 is gunna end up being a serious underestimation, as well.

I've seen estimate for Burma after the diseases run their course in a couple months up to 1 million.

China is going to go much higher. They haven't finished the surveys yet, some thing like 6000 square miles is in the severe damage zone for China. I doubt the weather in those mountains is very good at night for being in the open.

77 CyanSnowHawk  Mon, May 12, 2008 5:16:06pm

re: #54 CyanSnowHawk

If you download the *.iso CD image and do the installation from that, the problem does not manifest.

Link to mentioned image file.

I have installed it on my AMD Athlon based desktop system with no problems yet.

El Reg (The Register) has a more complete analysis here.

78 MellyMel  Mon, May 12, 2008 5:16:56pm

OT (Sort of)

Anybody know how to get your LGF registration e-mail to come through on Vista? My brother uses myway.com as his e-mail provider and has Vista as his OS, but for some reason he can't get the registration follow up e-mail. Any and all ideas would be welcome!

79 The Shadow Do  Mon, May 12, 2008 5:17:30pm

re: #58 freetoken

Life is cheaper in Asia... it seems sometimes...

Worse than that. My father, who served in that arena in WWII, said flatly that life was meaningless there. That statement has been with me for a very long time and has yet to be disproven.

80 experiencedtraveller  Mon, May 12, 2008 5:18:22pm

re: #75 DesertSage

Hows McCain looking in the Valley of the Sun these days?

81 jcm  Mon, May 12, 2008 5:18:42pm

re: #78 MellyMel

OT (Sort of)

Anybody know how to get your LGF registration e-mail to come through on Vista? My brother uses myway.com as his e-mail provider and has Vista as his OS, but for some reason he can't get the registration follow up e-mail. Any and all ideas would be welcome!

Which mail client?

82 Dr. Shalit  Mon, May 12, 2008 5:19:15pm

re: #46 Psaturn

"Psat" -

Went remotely through a VISTA based replacement at our MA property. Problem was, printer, (H/P - great printer by the way) was not plugged in when update was loaded in. Re-Loaded with printer plugged in and no problem. My experience so far with VISTA has been generally good except for the concept that I need a "heavier" chip set - like in the computer equivalent of "less miles per gallon." The only unsupported item I have, and have migrated is my Digi-Cam - even that was worked around as my 'pute can take its Memory Card directly. Ok, MS - next time - give me an OS with VISTA features that can run on less 'hoss-pressure' - meaning faster on my existing 'pute and I shall buy it as an upgrade, not as the inevitable result of buying a new 'pute. Cheaper to ME - More Profitable to YOU!

-S-

83 lawhawk  Mon, May 12, 2008 5:19:32pm

re: #66 A Kiwi Infidel

You're sadly likely to be right. The 32,000 killed in Burma is likely several times that number, and many will have died because of the junta's failures and failings.

China will suffer horribly as a result of the quake, but the government is far more capable of handling a natural disaster than the junta. The Chinese can mobilize millions to do back breaking work, but the junta has no interest in saving its own citizens.

One of my postings I'm planning for tomorrow will delve deeper into the difference in government responses to the natural disasters in Asia.

84 A Kiwi Infidel  Mon, May 12, 2008 5:19:45pm

re: #76 jcm

I've seen estimate for Burma after the diseases run their course in a couple months up to 1 million.
China is going to go much higher. They haven't finished the surveys yet, some thing like 6000 square miles is in the severe damage zone for China. I doubt the weather in those mountains is very good at night for being in the open.

Sadly, I agree. I have always thought the tsunami total was probably at half a mill, but no-one knows and, for certain, the authorities could give a monkeys. The same will happen in Burma. They may give us an official toll, but you can bet it will be way higher.

China are more relaxed and far less suspicious than they used to be and will take foreign help, coz they know it is help and not an excuse for subtefuge. (did I spell that right?) Any final figures from there will be pretty close to accurate.

85 MandyManners  Mon, May 12, 2008 5:20:10pm

Oh, dear. Am I the only one who remembers Johnny Carson and Ed McMahon's running joke about "How X is it"?


Gotta' go watch the next Jeter.

86 WrathofG-d  Mon, May 12, 2008 5:20:23pm

OT:

Doinks!

Why do Hiz'b'amalek / Lebanon clashes look just like Israel / Lebanon massacres and destruction of entire cities?

87 A Kiwi Infidel  Mon, May 12, 2008 5:20:31pm

re: #83 lawhawk


Were you watching me type?

88 ec marm  Mon, May 12, 2008 5:22:02pm

re: #74 goddessoftheclassroom

GMTA! I try to last until November if I can...

What do you set your thermostat on? I keep mine no higher than 65 unless my mom comes over. At night or when we're not home, I set it to turn down to 55.


Thermostat? I built my own fan forced woodburning stove/masonry fireplace. I start a fire on Oct. 15th and put it out April 15th. Some days it's as high as 78, some days as low as 48 inside. I got off the oil ticks about 1992. It keeps me in shape cutting and splitting and stacking wood. And it's kinda purty to see the fire always going. Turn the oil furnace on just for hot water, once a day. Eight minutes later, we turn it off.

89 DesertSage  Mon, May 12, 2008 5:22:18pm

re: #80 experiencedtraveller

Hows McCain looking in the Valley of the Sun these days?

McCain is in trouble. He's gonna have to do a lot of 'straight talkin' really quick or he'll get trounced in the general election.

90 A Kiwi Infidel  Mon, May 12, 2008 5:23:23pm

re: #89 DesertSage

McCain is in trouble. He's gonna have to do a lot of 'straight talkin' really quick or he'll get trounced in the general election.

No, no, America is in trouble if BHO becomes Pres.

91 jcm  Mon, May 12, 2008 5:24:29pm

re: #79 The Shadow Do

Worse than that. My father, who served in that arena in WWII, said flatly that life was meaningless there. That statement has been with me for a very long time and has yet to be disproven.

I actually noticed the same thing living in the middle east.

I chalk it up to the fatalism of cultures and religions. Allah, the gods, or whatever have set you destiny. Therefore there is no point in fighting your destiny.

In Arab and Persian the phrase is In'shallah. If Allah wills it. It's much deeper than the western "God Willing." In Churchill's The River War he called it a "fearful, fatalist apathy" which sums it up pretty well.

Broad general strokes I know.

92 Killian Bundy  Mon, May 12, 2008 5:24:31pm

On the front page, the threads' "last comment" mouseover pop up text box no longer works.

/IE7/XP

93 fooburger  Mon, May 12, 2008 5:25:04pm

Charles,

You should probably use a source management tool like svn, cvs, git, something like that if you aren't already.
When you need to update your site, just put a flag in whatever prepended php file you're using to force the server to wait until the update is done, and then continue reading whatever include files and executing the actual code.
This will potentially build a small queue of connections, but an 'svn update' will only take a very short while, so I wouldn't worry about it.

94 experiencedtraveller  Mon, May 12, 2008 5:26:39pm

re: #89 DesertSage

Wait to the debates. America will see an old oak against a young willow.

95 GeeWiz  Mon, May 12, 2008 5:27:39pm

re: #69 jcm

I suspect that those that have problems with Vista comes down to memory or graphics issues where this OS is a hog. Your machine needs at least 2 gigs of ram and a high end video card for Vista to function well. As I type this post, my machine is using 40% of available memory. Methinks many users enable the Aero interface on machines that lack the graphics horsepower required. My machine has 2 gigs (for now) of memory and a NVIDIA GeForce Go 7600 video card and works better than XP Pro, IMHO.

96 CyanSnowHawk  Mon, May 12, 2008 5:30:12pm

re: #85 MandyManners

Oh, dear. Am I the only one who remembers Johnny Carson and Ed McMahon's running joke about "How X is it"?


Gotta' go watch the next Jeter.

No Mandy. I picked up on it right away.

97 MellyMel  Mon, May 12, 2008 5:30:51pm

re: #81 jcm

Apparently, it literally is myway -- his e-mail extension is @myway.com.

98 jcm  Mon, May 12, 2008 5:30:53pm

re: #95 GeeWiz

I suspect that those that have problems with Vista comes down to memory or graphics issues where this OS is a hog. Your machine needs at least 2 gigs of ram and a high end video card for Vista to function well. As I type this post, my machine is using 40% of available memory. Methinks many users enable the Aero interface on machines that lack the graphics horsepower required. My machine has 2 gigs (for now) of memory and a NVIDIA GeForce Go 7600 video card and works better than XP Pro, IMHO.

Graphics is the big hog with Vista. If the graphics hardware can't handle the demands it kicks it back to the main processor and RAM which causes all kinds of havoc.

99 The Shadow Do  Mon, May 12, 2008 5:31:00pm

re: #91 jcm

I actually noticed the same thing living in the middle east.

I chalk it up to the fatalism of cultures and religions. Allah, the gods, or whatever have set you destiny. Therefore there is no point in fighting your destiny.

In Arab and Persian the phrase is In'shallah. If Allah wills it. It's much deeper than the western "God Willing." In Churchill's The River War he called it a "fearful, fatalist apathy" which sums it up pretty well.

Broad general strokes I know.

Broad general strokes, of course. Religions born there, in my less that expert database, seem to bear this out as well. Where is the dignity of the individual elevated? All very fatalistic indeed as well as I can tell. Sad really. Until it becomes dangerous.

100 Killian Bundy  Mon, May 12, 2008 5:31:07pm

re: #92 Killian Bundy

On the front page, the threads' "last comment" mouseover pop up text box no longer works.

/IE7/XP

Not sure if you just fixed it, but it's suddenly displaying again after several weeks.

/thanks Charles

101 GeeWiz  Mon, May 12, 2008 5:32:20pm

re: #98 jcm

BINGO!

102 Kosh's Shadow  Mon, May 12, 2008 5:32:27pm

re: #79 The Shadow Do

Worse than that. My father, who served in that arena in WWII, said flatly that life was meaningless there. That statement has been with me for a very long time and has yet to be disproven.

I read a description of the Chinese building bases for aircraft during WWII. They'd take a huge roller, and pull it manually. If someone slipped and was crushed, they'd laugh.

Life's pretty cheap to that type.

103 Dr. Shalit  Mon, May 12, 2008 5:33:42pm

re: #69 jcm

"jcm" -

Not a surprise to me - my Acer 7720 is more or less the previous generation Mac-Book Pro as far as chip set goes. I just wonder how well
this 'pute would work with OS-X loaded on a hard drive partition. An Acer/Apple might well be a sight to behold with a 17" screen.

-S-

104 freetoken  Mon, May 12, 2008 5:34:36pm

re: #79 The Shadow Do

There is a noticeable difference between Western values and those in the Orient. The difference in perspectives arise from ....? I can only guess that the population density, along with very long histories of national/ethnic groups, somehow accounts for this.

OTOH, a great portion of the West was "Christianized" and instilled a worldview that no doubt is different than the materialism of the far East.

105 jcm  Mon, May 12, 2008 5:35:15pm

re: #97 MellyMel

Apparently, it literally is myway -- his e-mail extension is @myway.com.

Does he use the Myway web site to read and respond to his email? if that is the case I would suspect some of the Vista security features are blocking Myway.

Have him go into the Control Panel, to the Security Center. In Windows defender add myway.com to the Allowed items.

106 Dr. Shalit  Mon, May 12, 2008 5:36:20pm

re: #94 experiencedtraveller

"ex'' -

"Whaadabout" and OLD FUNGUS vs. a young willow - NOW that's more like it.

-S-

107 freetoken  Mon, May 12, 2008 5:37:32pm

re: #94 experiencedtraveller

Wait to the debates. America will see an old oak against a young willow.

And if America is in a "young willow" sort of mood....?

108 jcm  Mon, May 12, 2008 5:38:34pm

re: #103 Dr. Shalit

"jcm" -

Not a surprise to me - my Acer 7720 is more or less the previous generation Mac-Book Pro as far as chip set goes. I just wonder how well
this 'pute would work with OS-X loaded on a hard drive partition. An Acer/Apple might well be a sight to behold with a 17" screen.

-S-

I was in the Apple store buying a battery, and drooling on the 17. 2.5Ghz Core 2 Duo (64 bit), 4 GB Ram, NVIDIA GeForce 8600M GT with 512MB.

109 experiencedtraveller  Mon, May 12, 2008 5:39:30pm

re: #107 freetoken


This young willow has A LOT of baggage we are best served without. Hopefully that will shine through.

110 Charles  Mon, May 12, 2008 5:40:31pm

re: #93 fooburger

Charles,

You should probably use a source management tool like svn, cvs, git, something like that if you aren't already.
When you need to update your site, just put a flag in whatever prepended php file you're using to force the server to wait until the update is done, and then continue reading whatever include files and executing the actual code.
This will potentially build a small queue of connections, but an 'svn update' will only take a very short while, so I wouldn't worry about it.

I do use Subversion on my local machine, but haven't gotten around to setting it up on the web server yet. One of these days.

111 Charles  Mon, May 12, 2008 5:41:18pm

re: #100 Killian Bundy

Not sure if you just fixed it, but it's suddenly displaying again after several weeks.

/thanks Charles

Didn't do anything to that code -- but you're welcome!

112 Dr. Shalit  Mon, May 12, 2008 5:46:44pm

re: #108 jcm

I was in the Apple store buying a battery, and drooling on the 17. 2.5Ghz Core 2 Duo (64 bit), 4 GB Ram, NVIDIA GeForce 8600M GT with 512MB.

jcm -

HOW MUCH? - a similar SONY - VISTA Based is $3,299 through Sony-Style, my ACER - granted, a generation behind, was $699.

-S-

113 jcm  Mon, May 12, 2008 5:49:05pm

re: #112 Dr. Shalit

jcm -

HOW MUCH? - a similar SONY - VISTA Based is $3,299 through Sony-Style, my ACER - granted, a generation behind, was $699.

-S-

$2,799.00 with the stock 2GB Ram.

114 MellyMel  Mon, May 12, 2008 5:51:41pm

re: #105 jcm

Thanks! We tried that, but quickly realized it is not his computer. I logged on to his e-mail account from my computer, added the LGF regbot to the safe list and it still didn't come through -- dang it.

/Well, he is now on his own calling his IP. Thanks for trying I really appreciate it (I know NOTHING about Vista!).

115 jcm  Mon, May 12, 2008 5:57:06pm

re: #114 MellyMel

Thanks! We tried that, but quickly realized it is not his computer. I logged on to his e-mail account from my computer, added the LGF regbot to the safe list and it still didn't come through -- dang it.

/Well, he is now on his own calling his IP. Thanks for trying I really appreciate it (I know NOTHING about Vista!).

It's a pretty safe bet they'll be able to resolve it. Seldom I have I had computer problems that only happened to me.

116 GeeWiz  Mon, May 12, 2008 6:20:00pm

re: #113 jcm

For comparisions only, my machine purchased 14 months ago:

HP Pavillion dv8000
(2) 120 gig SATA 5200 hard disks
(1) LightScribe CDDVD RW X 16 Drive
(2) Gig DDR X2 Memory
Intel Centrino Duo-Core 1.83 GHZ
NVIDIA GeForce Go 7600 graphics w/256MB on-board
17" Ultra Bright View display
Full size keyboard w/numeric keypad
Bluetooth wireless
4 USB ports
TV tuner
Altec Lansing speakers
And many other options too numerous to mention.
Price: $1399, less shipping and tax.

117 Robert Schwartz  Mon, May 12, 2008 6:32:28pm

Is the operation that turns you into a UNIX painful?

Are you going to begin to LISP?

118 vilmos  Mon, May 12, 2008 6:50:36pm

> #
> # Rename LGF temp files to live versions

Do you really need to comment something like this? Don't forget that whenever this script runs, the shell needs to parse the comments as well.

> for tmp in `ls -1 *.tmp.php`

for tmp in *.tmp.php

You don't need an ls here. Anyways, the shell does the expansion, not ls. (Remember, this is a Unix shell). Also, by using a command substitution (backtick), you start an extra shell just to do what the shell does anyways. And why do you need to put each file in a separate line? Bash will break the output of ls based on $IFS which includes a space (unless you redefine $IFS).

> do {

OK. I never put a curly bracket here but it is a question of taste.

mv -i $tmp `echo $tmp | awk -F. '{print $1 "." $3}'`

This is not the best way to solve it. And I was nice. :-)) For every single mv, you start an extra awk process (bash uses its own built-in echo). And not only you use an extra awk process, you also use command substitution which is yet another process. Just use bash' built-in parameter expansion. bash(1), and search for "Parameter Expansion". Or search for " Parameter Expansion" to skip all the matching strings which are in sentences.

mv -i $tmp ${tmp/.tmp/}

Here is short example in real life:

for x in hello.tmp.php world.tmp.php; do
echo mv -i $x ${x/.tmp/}
done

Vilmos

119 excel  Mon, May 12, 2008 6:54:29pm

Why not just use .tar.gz archive, upload it then unzip. Another thing that works for me is to export the entire site into a new folder, then just rename public_html folders.

120 snowcrash  Mon, May 12, 2008 6:55:26pm

re: #78 MellyMel
A short while ago Charles added a link to re send the e-mail confirmation if you didn't get it. I'm not sure when, but searching the tag storm for registration might help find the thread.

121 eyore  Mon, May 12, 2008 6:55:59pm

Too often we forget the elegance of a simple Unix shell script. The students these days just know what the IDE gives them, and never look further.

In this case, though, I would have used sed instead of awk, just for the regular expressions.

122 Charles  Mon, May 12, 2008 7:36:29pm

re: #118 vilmos

#
> # Rename LGF temp files to live versions

Do you really need to comment something like this? Don't forget that whenever this script runs, the shell needs to parse the comments as well.

> for tmp in `ls -1 *.tmp.php`

for tmp in *.tmp.php

You don't need an ls here. Anyways, the shell does the expansion, not ls. (Remember, this is a Unix shell). Also, by using a command substitution (backtick), you start an extra shell just to do what the shell does anyways. And why do you need to put each file in a separate line? Bash will break the output of ls based on $IFS which includes a space (unless you redefine $IFS).

> do {

OK. I never put a curly bracket here but it is a question of taste.

mv -i $tmp `echo $tmp | awk -F. '{print $1 "." $3}'`

This is not the best way to solve it. And I was nice. :-)) For every single mv, you start an extra awk process (bash uses its own built-in echo). And not only you use an extra awk process, you also use command substitution which is yet another process. Just use bash' built-in parameter expansion. bash(1), and search for "Parameter Expansion". Or search for " Parameter Expansion" to skip all the matching strings which are in sentences.

mv -i $tmp ${tmp/.tmp/}

Here is short example in real life:

for x in hello.tmp.php world.tmp.php; do
echo mv -i $x ${x/.tmp/}
done

Vilmos

I knew if I posted this, someone would post a better way to do it. Thanks for the tips.

123 Charles  Mon, May 12, 2008 7:40:55pm

And by the way, I comment everything, even if I don't strictly need to. This practice has saved my bacon more than once.

124 justadot  Mon, May 12, 2008 8:13:37pm

re: #118 vilmos

${parameter/pattern/string}

Thank you, Vilmos. That will definitely help me.

125 snowillard  Mon, May 12, 2008 11:35:41pm

lgf is the most awesome blog script ever. No other blog script is so full featured and the usability is great. I cant praise it enough. Great work.!

126 Psaturn  Tue, May 13, 2008 12:40:36am

re: #50 jcm

Vista requires serious horsepower to run effectively. Take the MS mins and double, and add some more to have a truly Vista ready machine.

Not all hardware is Vista compatible, even if the upgrade advisor says so. To find out you have to search the forums and KB articles to find out.

Apple has the advantage of building the hardware and writing the OS.

re: #63 GeeWiz

What JCM said @ #50 said. I'm running Vista Home Premium on a HP laptop and have had no issues at all. I suspect you have a hardware issue. The minimum requirements that MS posts for Vista is a joke. If you give Vista the resources, it performs very well. I happen to like it. This comes from a MS user dating back to DOS 3.1 and not afraid to condemn MS for all it's short-comings for they are many.

re: #82 Dr. Shalit

Thanks for your attempt to help...this is a brand new machine HP

With Quad Core Intel 2.4 ghz.
3 gig of memory (the max capacity is 4 gig)
2 HD with 320 Gig each.
256 meg of Vram forgot what was the video card...
HD TV tuner installed (came with it)

It came with Vista installed.

This machine was specifically MADE for Vista.

127 deathtotheswiss  Tue, May 13, 2008 2:43:05am

This reminds me of Jurassic Park.

128 whiteside  Tue, May 13, 2008 10:53:31am

re: #123 Charles

And by the way, I comment everything, even if I don't strictly need to. This practice has saved my bacon more than once.

I agree that comments are important, but I usually leave them to a minimum in PHP and other "scripty" languages as they do have to get parsed out each time the file is tokenized.

Every time I release a new version of a php program (for deployment), I tag the svn trunk to /tags/deployed and run a little script on it that parses out comments.

Just my 2c.

129 Charles  Tue, May 13, 2008 12:29:50pm

re: #128 whiteside

I agree that comments are important, but I usually leave them to a minimum in PHP and other "scripty" languages as they do have to get parsed out each time the file is tokenized.

Every time I release a new version of a php program (for deployment), I tag the svn trunk to /tags/deployed and run a little script on it that parses out comments.

Just my 2c.

I agree -- I remove most comments when I deploy code too. (Check out the JS files...)

I was referring to my local copies of the code.

130 whiteside  Tue, May 13, 2008 4:27:00pm

Charles,

I see. Have you considered packing your code (removing whitespace)?

I sometimes try this with JS, but it seems I frequently end up introducing new bugs in the process, and once packed the JS is impossible to debug.

131 Charles  Wed, May 14, 2008 10:57:54am

re: #130 whiteside

Charles,

I see. Have you considered packing your code (removing whitespace)?

I sometimes try this with JS, but it seems I frequently end up introducing new bugs in the process, and once packed the JS is impossible to debug.

Actually, I use Javascript Minify for some of our Javascript files. I've also had problems with packing files, so jsmin is a better solution. If you combine it with gzip compression on the server, this actually results in smaller files than packing.

There's a very cool jsmin Unix filter for BBEdit (Mac OS), that does the Minify operation right in the editing buffer. If you Minify, upload, then Undo, you're right back to an uncompressed source file.


This entry has been archived.
Comments are closed.

^ back to top ^

log in
Name:
Pass:

Register Forgot Your Password? My Account Re-send Confirmation (To log in, cookies must be enabled in your browser!)

► LGF Headlines

► Top 10 Comments

► Bottom Comments

► Recent Comments

► Tools/Info

► LGF Hits

► Slideshows

► Resources

► Never Forget

► Statistics

► Tag Cloud

► Contact

You must have Javascript enabled to use the contact form.
Your email:

Subject:

Message:


Messages may be published in our weblog, unless you request otherwise.
Tech Note:
Using the Contact Form

► News/Opinion

Mystery Sale - Buy 1 Mystery Paperback, Get a 2nd 50% Off!
More Partners

Compare Electricity Prices in your area. Texas Electricity is deregulated; you have the right to choose Texas Electric Rates from among many Texas Electric Companies.

Govern yourself accordingly!


PC & Video Games
Free Shipping  and up to 30% savings on new Textbooks