Coldfusion Script Suggestions

Reply

Join Date: Jul 2008
Posts: 4
Reputation: RedDem0n is an unknown quantity at this point 
Solved Threads: 0
RedDem0n RedDem0n is offline Offline
Newbie Poster

Coldfusion Script Suggestions

 
0
  #1
Jul 31st, 2008
Hey everyone, I am on a month long project on a coldfusion script I have to work on. Bare with my noobness here Basically here is the jist of it.

-- I have a huge sql database filled with various random people information, such as their phone #"s, email addresses, name, etc...this database it might be going off from could be anywhere from 8,000-15,000 users on it that it will be going off from.

--From time to time I will get a list of say 200-300 email addresses sometimes it can go up to 3000 email addresses from the database whose emails are bounced.

--Now what I am trying to do here is ..making a script where when you input this large list of email addresses, whether it be .txt or just copying it and pasting it into a form with all the bad email addresses...you hit submit..and the system automatically would search the user from its main database to see if it finds the email address, and if it does it retrieves the phone # for that specific person that's stored on the database and outputs it back into the page so every email that's been submitted returns back with a email address and phone # right next to each other...

How complicated would this be to make such a script? ANY help / suggestions / advice / or the jist of what I'm going to be dealing with would be MUCH appreciated.


Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 60
Reputation: hinde is an unknown quantity at this point 
Solved Threads: 4
hinde hinde is offline Offline
Junior Poster in Training

Re: Coldfusion Script Suggestions

 
0
  #2
Aug 2nd, 2008
One of the nice things that you can do with coldfusion is utilize java objects. BufferedReader is one of my favorite ones. It allows you to read extremely large files a bit at a time instead of reading in an entire file all at once. Coldfusion servers tend to choke because when you use cffile to read in a file you get all of the file's contents read into memory. This tends to suck the life out of your server when you are dealing with 50 megabyte or larger files. I suggest you look into using BufferedReader to read in the text or csv file. Here is a degraded snippet of something I wrote a while ago to import a couple hundred thousand email addresses into a database (client of a client wanted this. god knows why). Its actually taken from someone's blog so I can't take credit for parts of this code.

  1. <cfscript>
  2. // large text file, 4MB, 80,000+ lines
  3. srcFile = "#ExpandPath('.')#/myfile.txt";
  4. // create a FileReader object
  5. fr = createObject("java","java.io.FileReader");
  6. // Call the constructure with the source file path
  7. fr.init(srcFile);
  8. // create a BufferedReader object
  9. br = createObject("java","java.io.BufferedReader");
  10. // call the constructor with the FileReader as the arg
  11. br.init(fr);
  12. // read the first line
  13. str = br.readLine();
  14. // loop ... str will be undefined if there are no more lines
  15. while (isDefined("str"))
  16. {
  17. myColdfusionFunction(str);
  18. // read the next line so we can continue the loop
  19. str = br.readLine();
  20. }
  21. // close the buffered reader object
  22. br.close();
  23. </cfscript>
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ColdFusion Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC