Webmaster Forum Rules | Posting Guide | Contact Us | Testimonials | Contributing Geek Program | Advertise on Geek/Talk
Welcome to the GeekTalk Webmaster Discussion Forums from GeekVillage.com

Click Here To Register. It's Free!

Go Back   geek/talk: Signature-free discourse for serious web publishers > YOUR CREATION: Building & Maintaining A Web Site > Web Development - Programming / Coding
User Name
Password
Register FAQ Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 08-16-2001, 08:01 AM   #1
orfeo
Registered User
 
Join Date: Apr 2001
Location: Greece
Posts: 112
Default Data keeps reseting

Hello everyone.

I have written a script to rate pictures. The think is that the data after a couple of months and a total of 20.000 just resetted. I opened the data file and it was as if someone emptied it completely and the program tried to write again rates. I include a small portion of the code that actually re-writes the data file. The process I follow is the following

1. get the rate from Env query
2. read data file.
3. add the rate to the points of the particular image
4. calculate average
5. print to data file the new data using this code :
@rates[$number]=$number.":".$votes.":".$points.":".$average."\n";

#open picture database for writing
open PHOTODATA, ">$data" or die "Can't open database for writing: $picturedata";
flock(PHOTODATA, LOCK_EX);
print PHOTODATA @rates;
close PHOTODATA;

I know code is sluppy but I am trying.
I would appreciate any help. You can see the script working in the site of the signature.
orfeo is offline   Reply With Quote
Old 08-16-2001, 12:37 PM   #2
theDirtiest
Registered User
 
theDirtiest's Avatar
 
Join Date: Aug 2001
Location: Maryland
Posts: 61
Default

do you know if the server had any problems around the time you noticed this? maybe during the middle of the script something happened? I don't know exactly what may have happened, but if that data is important (which it obviosly is since you posted this) you should back up the file periodically with a crontab. That way if this happens again you can have all the data back up to the point of you last update.
theDirtiest is offline   Reply With Quote
Old 08-18-2001, 06:20 AM   #3
orfeo
Registered User
 
Join Date: Apr 2001
Location: Greece
Posts: 112
Default

I don't how to do that with crontab but I'll check it out.

What you say sounds interesting. If the server has a problem while I write the file, it will be resetted or cut ?

Is there a way to defend using code? Some kind of safe way? I thought of writting a backup file everytime but I don't like it much.

Anyone thinks my code is to blame?
orfeo is offline   Reply With Quote
Old 08-20-2001, 08:59 AM   #4
theDirtiest
Registered User
 
theDirtiest's Avatar
 
Join Date: Aug 2001
Location: Maryland
Posts: 61
Default

The data could reset or cut off, really depends.

Crontabs are pretty really easy to write. Either telnet or ssh into your server. type "crontab -e" at the command prompt to get into the crontab (this will allow you to edit your crontab in vi). This is where you tell your server when and what script to run. I do not feel like typing out all the instructions for crontabs (sorry I am lazy), but here are some good links to help you learn.

http://www.superscripts.com/tutorial/crontab.html
http://www.nerc-online.com/support/www/crontab.html

To make a backups, simply tell the crontab when to run, and have the script that runs make backups.

-jeff
theDirtiest is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Google rejects subpoena of data Larwee Google Search Engine and AdWords 5 03-18-2006 04:20 AM
Storing and displaying data in HTML DougM Web Development - Programming / Coding 1 02-06-2006 03:04 AM
Passing encrypted data through a form to an ASP tbrick18 Web Design and Webmaster Issues 2 08-10-2000 05:09 AM
data com stats fairhousing Making Money with CPC and/or CPM Programs 2 12-31-1999 02:41 PM
WARNING TO ALL DATA COM AFFILIATES fairhousing Making Money with CPC and/or CPM Programs 5 12-18-1999 12:57 AM

Please support our advertisers. They ensure our survival.

All times are GMT -5. The time now is 09:43 PM.


GeekVillage.com is copyright © 1998-2015 Curiosity Cave - Science gifts for clever kids. All rights reserved.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.