473,327 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Help with language, dev tool selection

I have a problem that I have to solve programmatically and since HTML
is pretty much the only code I have been exposed to I need an advice on
how to develop the programmatic solution to the problem I have.

In the nutshell, it'd be great if you can give me guidance in terms
of:

1) What programming language to use
2) What development tools to use
3) Tips on how to code the solution

So, here is my challenge:

I have a flat text file, 30000 records, each record has two columns,
the columns are tab separated.

The file looks like this (approximately)

Sarajevo 431104-133111
Mostar 441242-133421
Zagreb 432322-134423
The first value is a name of a town, and the second value represent
longitude-latitude in degrees, minutes and seconds.

For each record I have to create an html file that will be named as the
name of the town (i.e. Sarajevo.html). The content of the file will be
rather simple; in the first row it will contain the header (i.e.
"This page displays longitude-latitude information") - The second
row will have the following word: "Grad" - and the third row will
contain the name of the city and the fourth row will have the
longitude-latitude info.

The program also needs to prompt me (before it starts spitting the html
pages) and ask what test should be entered in line one (I would than
manually enter "This page displays longitude-latitude information")
and it also need to prompt me about the text that should be entered in
line two (I'd go and manually enter "grad").

I'd greatly appreciate any coment and/or guidance.
Best,

Vasilije Petkovic Vasa

Oct 21 '05 #1
5 1484
Further clarification:

The pages will have to be pure static html pages (so no datasource will
be driving generation of the pages).

Therefore, I'd have to create
30,000 files.

It's my understanding that almost every host should be
able to serve a simple and static html code.

Best,
Vasa

Oct 21 '05 #2
va**************@yahoo.com wrote:
1) What programming language to use
This is trivial task, whatever language you choose, will do it.
Python too, and its also simple and popular, so i can recommend it.
2) What development tools to use
You don't need nothing beyond python interpreter.
3) Tips on how to code the solution
Read the python tutorial (www.python.org) and thats probably all you need to
know.
For each record I have to create an html file that will be named as the
name of the town (i.e. Sarajevo.html). The content of the file will be
rather simple; in the first row it will contain the header (i.e.
"This page displays longitude-latitude information") - The second
row will have the following word: "Grad" - and the third row will
contain the name of the city and the fourth row will have the
longitude-latitude info.


Its maybe 10-20 lines of trivial code, so i suggest you to read python
tutorial, unless its only do-it-once operation.

Do you really need to create 30k files? this will take a lot of time
(creating a file is time-consuming operation on creation, sending them to
server too) and disk space greedy - even if file has 300 bytes, it may take
4kb or more on disk, depending on filesystem and its settings.
Perhaps collecting names starting with the same letter in single file will
be enough.

--
Maciej "Fiedzia" Dziardziel (fiedzia (at) fiedzia (dot) prv (dot) pl)
www.fiedzia.prv.pl

Ankh if you love Isis.
Oct 21 '05 #3
Hi Vasilije,

Try the Python 411 Podcast for a good introduction.

http://www.awaretek.com/plf.html

Cheers,
Davy Mitchell

http://www.latedecember.com

Oct 21 '05 #4
1) Python can do this easily
2) No tools required
3) Don't do it the way you describe.

Here's what I would do:

Load the information that you have in the text file
into a MySQL database (MySQL import has tab delimited
as its default so it is easy) and write a few lines of
PHP to serve up the HTML pages dynamically. I say PHP
and MySQL because almost every Internet Service
Provider installs those tools for free when you host a
website. If you are self hosting, use Python to create
the pages dynamically as they are required. Besides,
it will take you almost as long to upload the 30000
html pages to your webserver as to write this entire
application.

-Larry Bates
va**************@yahoo.com wrote:
I have a problem that I have to solve programmatically and since HTML
is pretty much the only code I have been exposed to I need an advice on
how to develop the programmatic solution to the problem I have.

In the nutshell, it'd be great if you can give me guidance in terms
of:

1) What programming language to use
2) What development tools to use
3) Tips on how to code the solution

So, here is my challenge:

I have a flat text file, 30000 records, each record has two columns,
the columns are tab separated.

The file looks like this (approximately)

Sarajevo 431104-133111
Mostar 441242-133421
Zagreb 432322-134423
The first value is a name of a town, and the second value represent
longitude-latitude in degrees, minutes and seconds.

For each record I have to create an html file that will be named as the
name of the town (i.e. Sarajevo.html). The content of the file will be
rather simple; in the first row it will contain the header (i.e.
"This page displays longitude-latitude information") - The second
row will have the following word: "Grad" - and the third row will
contain the name of the city and the fourth row will have the
longitude-latitude info.

The program also needs to prompt me (before it starts spitting the html
pages) and ask what test should be entered in line one (I would than
manually enter "This page displays longitude-latitude information")
and it also need to prompt me about the text that should be entered in
line two (I'd go and manually enter "grad").

I'd greatly appreciate any coment and/or guidance.
Best,

Vasilije Petkovic Vasa

Oct 21 '05 #5
va**************@yahoo.com wrote:
I have a flat text file, 30000 records, each record has two columns,
the columns are tab separated.

The file looks like this (approximately)

Sarajevo 431104-133111
(when did they move sarajevo to italy?)
Mostar 441242-133421
Zagreb 432322-134423


here's a straightforward Python solution:

HEADER = "This page displays longitude-latitude information"
SUBHEADER = "Grad"

for line in open("datafile.txt"):

town, latlong = line.split()
lat, long = latlong.split("-")

f = open(town + ".html", "w")
f.write(HEADER + "\n")
f.write(SUBHEADER + "\n")
f.write(town + "\n")
f.write(long + " " + lat + "\n")
f.close()

# end

tweak as necessary. see the Python tutorial for help:

http://docs.python.org/tut/tut.html

</F>

Oct 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
by: nobody | last post by:
This article is posted at the request of C.W. Yang who asked me to detail my opinion of Lisp, and for the benefit of people like him, who may find themselves intrigued by this language. The...
33
by: conimus | last post by:
I'm new in the programming business and I don't know what program I should use for begining development?(GNU c++...?) ---------------------------------------------- Posted with NewsLeecher v1.0...
5
by: - | last post by:
Hello to all I need help on some sql statements and wondering is anyone out there is able to help. I've extracted some data from the database into a new table consisting of 4 fields CustomerID...
3
by: clintonG | last post by:
I'm messing around with the Request.UserLanguages and the Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"); to see how similar or dissimilar they may be. I observe and conclude that both get...
35
by: John Coleman | last post by:
Greetings, I have a rough classification of languages into 2 classes: Zen languages and tool languages. A tool language is a language that is, well, a *tool* for programming a computer. C is the...
6
by: Sharon | last post by:
Hi gurus, I have a Form with some controls, some of them are my own. The GUI text is shown in English US. This application is for our customer in Japan that ask to change the application GUI...
11
by: Xah Lee | last post by:
Of interest: • The Semicolon Wars, by Brian Hayes. 2006. http://www.americanscientist.org/template/AssetDetail/assetid/51982 in conjunction to this article, i recommend: • Software...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
4
by: triton96 | last post by:
I want to get in to programming but would like your input on a couple of things: I would like to write some basic applications that would for example create a payroll check or create a billing for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.