ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 11th, 2003, 01:56 AM
pixel_ronin pixel_ronin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 8 pixel_ronin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy tab-delimited blues

I'm in dire need of some assistance on parsing a txt file. I'm currently involved in redoing the website for a Community Supported Radio station here in Austin, TX.



The station's URL is: http://kmfa.org/index.asp

The new site that I'm developing is:

http://wide-awake-garage.homeip.net/cms/



Login using:
user name = guest

password = password



The txt file I'm having the problem parsing is part of the play list area in the existing site:
http://kmfa.org/fortissimo_playlist...&yr=2003&dy=Thu



This play list is generated by a software program called Music Librarian and is exported as a fixed-length txt file. Well, sort of. I think the txt file starts out as fixed-length then loses the fixed lengths. As you see below.





++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++

Play Report




PLAY DATE: Tue, 04/01/2003
12:00 AM PROGRAM 69086A LOT OF NIGHT MUSIC + 8888888
12:01 AM PROGRAM 74191From the Beethoven Satellite Network + 8888888
6:00 AM PROGRAM 72473CLASSICS FROM THE KMFA LIBRARY + 8888888
6:01 AM Leopold Mozart 1736Trumpet Concerto Erato 55014



++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++



I would like to clean out the header at the top of the page and parse out the 'PROGRAM' lines and to parse out the numbers prior to third field, ie 69086A LOT OF MUSIC, the 69086 needs to be taken out.



I would like to import this file into Access because I'm not very versed in VBScript, or any other scripting language for that matter. I'm a Graphic Artist learning Web skills to become more marketable - hence this pro-bono job.



I have attached the txt playlist file spewed out by Music Librarian, I have contact the Software vendors and got no help from them. Big surprise there!



Ideally, I need to write a parser that converts the present "whatever" delimited txt file into a comma separated file to so I can import this file into Access.

This is a far as I have gotten in this process.

http://wide-awake-garage.homeip.net...&yr=2003&dy=Thu



The program titles for the station are in a separate db, I would like to have the db create the table headers then VBScript parse in the songs associated to the program.

Is this too much to ask?

Let me know and I really appreciate any assistance you can give!

christopher

Reply With Quote
  #2  
Old April 12th, 2003, 05:14 PM
numbernine numbernine is offline
Up To His Eyes In Ads
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Chicago
Posts: 160 numbernine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 25 sec
Reputation Power: 7
You won't be able to do much with a text file that starts out with fixed widths and then loses the fixed widths. Are there any other export options on the music database software?

Reply With Quote
  #3  
Old April 12th, 2003, 08:05 PM
pixel_ronin pixel_ronin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 8 pixel_ronin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hey #9

I spoke to the developer @ Music Librarian and they are pretty
much unwilling to change the exporting functionality. They're looking "into" it - but I'm not keeping my finger crossed.

So, I have done the following.
Parsed the whatever-delimited txt file this way
==============================================
<%

DIM databaseMonths(12)
databaseMonths(0) = "jan"
databaseMonths(1) = "feb"
databaseMonths(2) = "mar"
databaseMonths(3) = "apr"
databaseMonths(4) = "may"
databaseMonths(5) = "jun"
databaseMonths(6) = "jul"
databaseMonths(7) = "aug"
databaseMonths(8) = "sep"
databaseMonths(9) = "oct"
databaseMonths(10) = "nov"
databaseMonths(11) = "dec"

databaseYear = MID(REQUEST("yr"),3,2)
'---SET VARIABLES AND OPEN DATA FILE
dim thepath
thepath = server.mappath("/cms/FileLib/") & "\"
Response.ContentType="application/vnd.ms-excel"
set fso=Server.CreateObject("Scripting.FileSystemObject")
'SET playlistObject = Server.CreateObject("Scripting.FileSystemObject")
set file=fso.OpenTextFile(thepath & databaseMonths(REQUEST("mo")-1) & databaseYear & ".txt")
'set file=fso.OpenTextFile("D:\Inetpub\wwwroot\test\apr03.txt")
'SET playlist = playlistObject.OpenTextFile(thepath & databaseMonths(REQUEST("mo")-1) & databaseYear & ".txt")

size1=len(" 12:00 AM ")
size2=len("PROGRAM ")
size3=len("Parisian Quartet No. 10 (Nouveau No. 4)")
%>
<table border=1 CELLPADDING="1" CELLSPACING="1" BORDERCOLOR="#FFFFFF" BGCOLOR="#CCCCCC">
<%
function getLastNum(stext)
s=""
for i=len(stext) to 1 step -1
if mid(stext,i,1)<>" " then
s=s+mid(stext,i,1)
else
i=-1
end if
next
getLastNum=s
end function
while not file.AtEndOfStream
sline=file.ReadLine
if sline<>" " AND sline<>"" then
if instr(1,sline,"PLAY DATE:")=0 then
stime=left(sline,size1)
sline=replace(sline,stime,"")

stype=left(sline,size2)
sline=replace(sline,stype,"")

snumber=""
snumber=CStr(getNum(sline))
sline=replace(sline,snumber,"")

slastnumber=getLastNum(sline)
sline=replace(sline,slastnumber,"")

stitle=left(sline,size3)
sprod=replace(sline,stitle,"")

if snumber<>"1.#QNAN" then
%>
<tr BORDERCOLOR="#FFFFFF">
<td><font size=2><%=stime%></font>
</td>
<td><font size=2><%=stype%></font>
</td>
<td><font size=2><%=snumber%></font>
</td>
<td><font size=2><%=stitle%></font>
</td>
<td><font size=2><pre><%=sprod%></pre></font>
</td>
<td><font size=2><pre><%=slastnumber%></pre></font>
</td>
</tr>
<%
end if
else
%>
<tr>
<td colspan=6 BORDERCOLOR="#FFFFFF"><font size=3><b><%=sline%></b></font>
</td>
</tr>
<%
end if
end if
wend
%>
</table>
<script language=javascript runat="server">
function getNum(str)
{
return parseInt(str)
}
</script>
<%
rsPLAYlist.Close()
Set rsPLAYlist = Nothing
%>
=============================================
http://wide-awake-garage.homeip.net...&yr=2003&dy=Sat

This creates a excel wrkbok that I can manage to export a tab-delimited file into Access then use my limited experience in, <embarrassed> MM Dreamweaver to display the recordset by three session variables:
1) current time
2) current month
3) current year
I hate to go the well on this thread, but do you know how I could merge two Access tables by one criteria/variable? I'm mean, I have one table that contains the station programming information, and then I have this playlist file residing in another table. Is it possible to have a faction build the program info in the table header then strip in the playlist info accordingly?
For I would like to have the user to see what playing by those three criteria - this was gleaned from a survey.
More importantly - I would like to have the front page display the current composition, real-time, via a timer that queries the db for the current:
1) composition title
2) composer
3) program title/description
4) announcer bio

I have bitten off WAY more than I can chew. I would greatly appreciate any help you could offer.
Attached Files
File Type: txt apr03.txt (92.3 KB, 275 views)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > tab-delimited blues


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT