Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

New project...

djshadmegodjshadmego Posts: 27Member
I finally got the calendar working. Now I need to events to be loaded dynamically. I am not very good a coding right now as I know very little about three languages and nothing about troubleshooting. I therefore submit my craziness to you all! I am builing this calendar for my church's web site and as you may know, there are several ministries or departments to go with it. I need to be able to seperate the departments and their respective schedules into seperate entities and load them into the calendar individually so as not to add to the confusion to the user. For instance, there is a section for the events dealing with the school, the women, the men, the community, the singles, the teenagers, etc. I also need to be able to add them all at the same time for those that want to view scheldule conflicts. I am looking at Perl and Python for my back end database. The web site I am going to be on supports Perl, Python, PHP, MySQL and pretty much anything else you can think of. They run a unix system and I am trying to write for MSIE 5+, Netscape 5+, and any other browser that is possible. The idea that I am going for can be found @ http://www.sba.gov/calendar/. I do not need the map though, and I want to do this without ColdFusion. (That is how this site does it.) I am looking to do this in Java/Perl/Python...well, you understand. BUT THE MOST IMPORTANT THING!!!! I want to know the code. I want to understand what is going on as I am trying to learn how to do this stuff on my own and would like to program for along time to come. Thank you for taking the time!! Merry Christmas!!

[hr][size=5][blue]d[/blue][italic][b][red]J[/red][/b][/italic][/size]

Comments

  • infidelinfidel Posts: 2,900Member
    : I finally got the calendar working. Now I need to events to be loaded dynamically. I am not very good a coding right now as I know very little about three languages and nothing about troubleshooting. I therefore submit my craziness to you all! I am builing this calendar for my church's web site and as you may know, there are several ministries or departments to go with it. I need to be able to seperate the departments and their respective schedules into seperate entities and load them into the calendar individually so as not to add to the confusion to the user. For instance, there is a section for the events dealing with the school, the women, the men, the community, the singles, the teenagers, etc. I also need to be able to add them all at the same time for those that want to view scheldule conflicts. I am looking at Perl and Python for my back end database. The web site I am going to be on supports Perl, Python, PHP, MySQL and pretty much anything else you can think of. They run a unix system and I am trying to write for MSIE 5+, Netscape 5+, and any other browser that is possible. The idea that I am going for can be found @ http://www.sba.gov/calendar/. I do not need the map though, and I want to do this without ColdFusion. (That is how this site does it.) I am looking to do this in Java/Perl/Python...well, you understand. BUT THE MOST IMPORTANT THING!!!! I want to know the code. I want to understand what is going on as I am trying to learn how to do this stuff on my own and would like to program for along time to come. Thank you for taking the time!! Merry Christmas!!

    Ok, first of all, Perl and Python are not databases. MySQL is a database, so you'll want to store event information there. I have never used MySQL or Perl so I can't help much there. I don't see any reason to use fancy products if you can write Python scripts and a MySQL database. ColdFusion would be excessive, IMO, since all you're doing is generating HTML.

    As far as cross-browser issues go, as long as you stick to the basic HTML tags you should be AOK. What I would do is have a checkbox for each group (Men, Women, Teens, etc) with an "Update Calendar" button. When you click the button, it calls your script which can query the MySQL database for all events for the groups that were checked. Once you have the event records, it's just a matter of outputting valid HTML tables to display the data. I've never done any website scripting like this, but I'll be happy to help where I can.

    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

  • djshadmegodjshadmego Posts: 27Member
    : Ok, first of all, Perl and Python are not databases. MySQL is a database, so you'll want to store event information there. I have never used MySQL or Perl so I can't help much there. I don't see any reason to use fancy products if you can write Python scripts and a MySQL database. ColdFusion would be excessive, IMO, since all you're doing is generating HTML.
    :
    : As far as cross-browser issues go, as long as you stick to the basic HTML tags you should be AOK. What I would do is have a checkbox for each group (Men, Women, Teens, etc) with an "Update Calendar" button. When you click the button, it calls your script which can query the MySQL database for all events for the groups that were checked. Once you have the event records, it's just a matter of outputting valid HTML tables to display the data. I've never done any website scripting like this, but I'll be happy to help where I can.
    :
    : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]
    :
    Would I have to use Python or another language with JavaScript to load my Calendar? Or could I get by with MySQL and my calendar? If I need one or the other (Perl/Phython), which one would be better at querrying the database? I am not sure about using JavaScript like that. Then again, I am about at the point where I am thinking about paying someone to write this script for me and teach me how they did it. I know it isn't a small project, but things like this can't be uncommon. I know alittle about Pyhton and alittle more about JAvaScript. Not enough to hold my own right now unfortuneately, but I'm getting there. If I could use JavaScript, that would be nice. You are right though, I don't want to be excessive. I want to be small, usable, and professional. As much as is possible though. I really do appreciate any help you toss my way. Thanks
    [hr][size=5][blue]d[/blue][italic][b][red]J[/red][/b][/italic][/size]

  • infidelinfidel Posts: 2,900Member
    : Would I have to use Python or another language with JavaScript to load my Calendar?

    You're still confused about what languages do what. Javascript is embedded in HTML pages to make browsers to special things. Python scripts are used by the server to [italic]create[/italic] the HTML pages sent to the browser. What you want is to use Perl or Python to query the MySQL database and create an HTML file that may or may not include Javascript. I would suggest not trying to do everything at once, so maybe save the Javascript for later.

    : Or could I get by with MySQL and my calendar?

    You calendar isn't a program. Your calendar is an HTML page created by some script using data from MySQL.

    : If I need one or the other (Perl/Phython), which one would be better at querrying the database?

    That I can't help you with. I've never used Perl. I also have never used Python with a database, but I believe the interface with MySQL is fairly robust.

    : I am not sure about using JavaScript like that.

    See above comment. Javascript would only be used to add special functionality to the result of your Python/Perl script.

    : Then again, I am about at the point where I am thinking about paying someone to write this script for me and teach me how they did it.

    That's always an option but not nearly as instructive. If you can slug through this, you'll have learned a great deal more than if someone does it for you.

    : I know it isn't a small project, but things like this can't be uncommon.

    Actually, as far as projects go, this is fairly small. You're just freaking out because you are lost. My recommendation is to stop, take a deep breath, and sketch out some design ideas. Write down what you want the calendar to look like, what kinds of options you want to give the users, what kind of data you will have available (have you given any thought as to how the data will get into the MySQL database for you to query?), etc etc etc.

    : I know alittle about Pyhton and alittle more about JAvaScript. Not enough to hold my own right now unfortuneately, but I'm getting there. If I could use JavaScript, that would be nice. You are right though, I don't want to be excessive. I want to be small, usable, and professional. As much as is possible though. I really do appreciate any help you toss my way. Thanks

    It might make sense to start work by making an HTML page by hand that has the look and feel you want in your calendar page. Once you have HTML code, it's much easier to break it into pieces and figure out how to write code that will create it dynamically. Also, knowing the structure of the database will help us plan ahead.

    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

  • infidelinfidel Posts: 2,900Member
    [b][red]This message was edited by infidel at 2002-12-27 11:37:11[/red][/b][hr]
    Ok, I have set up my machine to run Apache when I want to try cgi scripting. I have successfully executed a very simple cgi script written in python so now I can help you do the actual scripting if/when you get that far. The first step to getting this to work will be to see if you can get a script to execute too.

    You said that your server is running UNIX, so I'm assuming they have Apache running as well. It shouldn't matter, though, as long as it is set up to run cgi.

    Find out if you can run cgi and if you can, where the cgi-bin directory is. Write a script named pythontest.py and put this in it:

    [code]
    #!/usr/bin/python

    print "Content-type: text/plain
    "

    print "Hello, cgi world!"
    [/code]

    /usr/bin/python is the path to the interpreter on my system. It might be different on yours. Make sure the hash (#) is the first character in the file.

    Make sure the script file is executable. If you have a command line, the UNIX command is:

    [code]chmod +x pythontest.py[/code]

    Now, try to open the script in your browser. On my system, the URL is:

    [my machine name]/cgi-bin/pythontest.py

    If everything is set up correctly, you should get a plain text page that says:

    [code]Hello, cgi world![/code]

    I can't help you much with this part since I don't have access to your server. If you have problems, ask your system administrator for help. Once you have things set up so you can execute python scripts we can start playing with returning HTML code.

    Good luck.

    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]



  • djshadmegodjshadmego Posts: 27Member
    Before now, I was inbetween hosting sites. I have recently moved to a new hosting site and am waiting for my access to be granted. It might take a day or two, but then I will be able to set up my machine to run Apache(which they have). They are running Red Hat Linux 7.1. As a matter of fact, this is the page that tell you all this site has to offer: http://arkwebs.us/acctfeatures.htm. It really has jsut about everything a programmer looks for in a hosting company. I'm excited about diving into this thing called Programming!! As soon as I am allowed access, I will let you know and until then, I'm studying and thinking up some more questions.


    [hr][size=5][blue]d[/blue][italic][b][red]J[/red][/b][/italic][/size]

  • djshadmegodjshadmego Posts: 27Member
    [b][red]This message was edited by djshadmego at 2002-12-31 0:2:49[/red][/b][hr]
    : You're still confused about what languages do what. Javascript is embedded in HTML pages to make browsers to special things. Python scripts are used by the server to [italic]create[/italic] the HTML pages sent to the browser. What you want is to use Perl or Python to query the MySQL database and create an HTML file that may or may not include Javascript. I would suggest not trying to do everything at once, so maybe save the Javascript for later.

    [red]Is it possible to write a calendar script using Python?[/red]



    : Actually, as far as projects go, this is fairly small. You're just freaking out because you are lost. My recommendation is to stop, take a deep breath, and sketch out some design ideas. Write down what you want the calendar to look like, what kinds of options you want to give the users, what kind of data you will have available (have you given any thought as to how the data will get into the MySQL database for you to query?), etc etc etc.

    [red]I have given it some thought. The look is the calendar I have on the site I am working on. I want the user to be able to check what groups they want to see activities for. One or more or all groups. Then when the events are loaded into the calendar, I want to be able to click on them (the events) individually and bring up a small window with the more detailed data in that. (Date, Times, People involved, location, etc). I don't want the script to be slow and I want it to be USER FRIENDLY!! So that an 8 year old can use it. I don't know much about MySQL or how to put events into it. I don't know how to write Python to querry those events, and I don't know how to write the load functions to put into the calendar itself. You can get a glimpse of what I mean by looking at the calendar in question @ http://www.febconline.com/calendar.html Interesting predicament indeed! I am excited about learning how to accomplish this...and so much more along the way.[/red]
    :
    : : I know alittle about Pyhton and alittle more about JAvaScript. Not enough to hold my own right now unfortuneately, but I'm getting there. If I could use JavaScript, that would be nice. You are right though, I don't want to be excessive. I want to be small, usable, and professional. As much as is possible though. I really do appreciate any help you toss my way. Thanks
    :
    : It might make sense to start work by making an HTML page by hand that has the look and feel you want in your calendar page. Once you have HTML code, it's much easier to break it into pieces and figure out how to write code that will create it dynamically. Also, knowing the structure of the database will help us plan ahead.
    :
    : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]
    :
    :

    [hr][size=4][blue][b]D[/b][/blue][/size][size=5][italic][grey][b]J[/b][/grey][/italic][/size]



  • infidelinfidel Posts: 2,900Member
    : [red]Is it possible to write a calendar script using Python?[/red]

    Absolutely

    : [red]I have given it some thought. The look is the calendar I have on the site I am working on. I want the user to be able to check what groups they want to see activities for. One or more or all groups. Then when the events are loaded into the calendar, I want to be able to click on them (the events) individually and bring up a small window with the more detailed data in that. (Date, Times, People involved, location, etc). I don't want the script to be slow and I want it to be USER FRIENDLY!! So that an 8 year old can use it. I don't know much about MySQL or how to put events into it. I don't know how to write Python to querry those events, and I don't know how to write the load functions to put into the calendar itself. You can get a glimpse of what I mean by looking at the calendar in question @ http://www.febconline.com/calendar.html Interesting predicament indeed! I am excited about learning how to accomplish this...and so much more along the way.[/red]

    Ok, I took a look at your current calendar and it looks really nice. My only suggestion would have it default to the current month set to "All events" but that won't be an issue until it actually shows events. I really like the look of the calendar.

    One thing about your FORM tags, I believe that you need to have all of the checkboxes and the button within the one set of FORM tags for the browser to know that they all belong together as one unit.

    Clicking on a specific event to show more data is a good idea and should be simple to add once everything else is done.

    As far as execution speed, here we might have an issue. Right now your calendar is all coded in Javascript. The browser is what is executing the function so it is very fast. In our calendar, the browser will have to call the script on the server which will have to execute and then return the html back to the browser. It should still be fast, but you'll probably notice a difference. If your server is Apache then it's possible to have mod_python loaded by Apache so it can execute Python scripts directly rather than calling the regular interpreter. A lot of time can be saved if you don't have to wait for the interpreter to start up.

    User friendly isn't a problem. Click a few checkboxes, push a button, voila you have a calendar. Users won't even know there's a Python script doing the work.

    The MySQL database will only store information. It doesn't even make sense to program "events" in a database. Events will be handled by the browser and any javascript we embed in the HTML. The Python script will handle form submissions and querying the database. The database will just store event information. I've never used MySQL before so that might take a little bit of research. I've never used Python to query a database either, but I've read that it is fairly simple.

    Ok, there are a number of things to work on here. We'll need to design the data model we'll use to build the database. We need to know everything that we want to have stored in the database. Events, times, locations, groups involved, do you want to store individual people too? Just start writing down everything you want as you think of it and we can work out a diagram from that. We also need to figure out how to use Python to query a MySQL database. This can probably wait until later but it'll be good to think about it in case we stumble upon anything useful. One important thing will be translating the Javascript calendar code into Python. We can both work on that and compare notes. I'll fiddle with it as I have time today. One thing I'm not sure about yet is how to traverse the calendar forwards and backwards while still submitting the form data. Something we still haven't discussed is how this event information is going to get in the database in the first place.

    Very cool stuff. Thanks for the learning opportunity.

    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

  • djshadmegodjshadmego Posts: 27Member
    : : [red]Is it possible to write a calendar script using Python?[/red]
    :
    : Absolutely
    :
    [blue]It is indeed possible, but there I have no idea on how to do it. I just finished a cursory look at a beginning tutorial for Python and wasn't introduced to building tables with Python. If it is possible, then the tags must be the same or relatively close to JavaScript.
    [/blue]
    :

    Ok, I took a look at your current calendar and it looks really nice. My only suggestion would have it default to the current month set to "All events" but that won't be an issue until it actually shows events. I really like the look of the calendar.

    [blue]I was thinking of leaving the calendar blank until the user asks for the specific groups events for that month. But is really isn't important yet as you say.[/blue]

    One thing about your FORM tags, I believe that you need to have all of the checkboxes and the button within the one set of FORM tags for the browser to know that they all belong together as one unit.
    :
    [blue]I am going to write a table to clean up the astetics of the checkboxes. My question is could I put the whole table into a form and use it that way? I probably will have tried this before you read this so this question is mute. Just thought I'd put it out there.[/blue]

    : Clicking on a specific event to show more data is a good idea and should be simple to add once everything else is done.


    : As far as execution speed, here we might have an issue. Right now your calendar is all coded in Javascript. The browser is what is executing the function so it is very fast. In our calendar, the browser will have to call the script on the server which will have to execute and then return the html back to the browser. It should still be fast, but you'll probably notice a difference. If your server is Apache then it's possible to have mod_python loaded by Apache so it can execute Python scripts directly rather than calling the regular interpreter. A lot of time can be saved if you don't have to wait for the interpreter to start up.

    [blue]I can slow it down a few seconds here and there. Most of the people that are going to be using this calendar have dial-up and are primed for waiting to begin with. They aren't going to notice a few seconds here or there. I do however want to keep it streamlined so that it still loads as close to lightning quick as possible. It just doesn't have to be like it is now.[/blue]

    : User friendly isn't a problem. Click a few checkboxes, push a button, voila you have a calendar. Users won't even know there's a Python script doing the work.
    :
    : The MySQL database will only store information. It doesn't even make sense to program "events" in a database. Events will be handled by the browser and any javascript we embed in the HTML. The Python script will handle form submissions and querying the database. The database will just store event information. I've never used MySQL before so that might take a little bit of research. I've never used Python to query a database either, but I've read that it is fairly simple.

    [blue]This is where I have been thinking. Could I not store the events into a .js file and use Python to querry that? Maybe even skip the MySQL thing all together. Though if we do that, we might lose functionality with the calendar. Not that I am trying to shy away from learning MySQL mind you, I just checked some prices on classes and they range from $1,000 to upards of $2,000. This is alittle out of my range and I can't find free tutorials anywhere. Maybe you know where to learn, but to be honest, I checked out the admin tool for MySQL on my website and was lost on the first page. This database reads to me like C/C++. And that is why I started learning JavaScript and Python. They are easier to understand. Just thinking of the path of least resistance.[/blue]

    : Ok, there are a number of things to work on here. We'll need to design the data model we'll use to build the database. We need to know everything that we want to have stored in the database. Events, times, locations, groups involved, do you want to store individual people too? Just start writing down everything you want as you think of it and we can work out a diagram from that. We also need to figure out how to use Python to query a MySQL database. This can probably wait until later but it'll be good to think about it in case we stumble upon anything useful. One important thing will be translating the Javascript calendar code into Python. We can both work on that and compare notes. I'll fiddle with it as I have time today. One thing I'm not sure about yet is how to traverse the calendar forwards and backwards while still submitting the form data. Something we still haven't discussed is how this event information is going to get in the database in the first place.

    [grey][b]I am working on what information will be available to the user. It might take a few days to get this in order. As I said earlier, I just finished with a beginners tut for Python and near the end of it, the guy started talking about file IO. It seems to me that we can use this funuction to call the database, get what information we need out of it, write it into the calendar and send it to the browser. We can even use this function with any file we need to retrieve information from. At least that is what it seemed like to me. WE can even use the "open_file.write('filename.txt','w')" call to make a file to store information in. The url for this page in the tut is as follows:
    http://www.honors.montana.edu/~jjc/easytut/easytut/node17.html[/b][/grey]
    :
    : Very cool stuff. Thanks for the learning opportunity.

    [blue]I need to be thanking you for helping me with this project. I have a feeling that before we are done with this project, we will have learned more than we thought possible! Let's both be thankful for that![/blue]

    [hr][size=4][blue][b]D[/b][/blue][/size][size=5][italic][grey][b]J[/b][/grey][/italic][/size]

  • infidelinfidel Posts: 2,900Member
    : [blue]It is indeed possible, but there I have no idea on how to do it. I just finished a cursory look at a beginning tutorial for Python and wasn't introduced to building tables with Python. If it is possible, then the tags must be the same or relatively close to JavaScript.
    : [/blue]

    All we do is use the print command to write html:

    print ""
    print ""
    print "
    Table Data
    "

    See? Easy as pie. That's what so neat about CGI (which I never knew before). Your script's standard output stream is what is sent to the browser. I never realized it was so easy.

    : [blue]I was thinking of leaving the calendar blank until the user asks for the specific groups events for that month. But is really isn't important yet as you say.[/blue]

    That's a good idea too.

    : [blue]I am going to write a table to clean up the astetics of the checkboxes. My question is could I put the whole table into a form and use it that way? I probably will have tried this before you read this so this question is mute. Just thought I'd put it out there.[/blue]

    You can put any html you want in the FORM tags.

    : [blue]I can slow it down a few seconds here and there. Most of the people that are going to be using this calendar have dial-up and are primed for waiting to begin with. They aren't going to notice a few seconds here or there. I do however want to keep it streamlined so that it still loads as close to lightning quick as possible. It just doesn't have to be like it is now.[/blue]

    Python is pretty fast once the interpreter is loaded. Of course it helps if the server is faster. I don't see this being a problem.

    : [blue]This is where I have been thinking. Could I not store the events into a .js file and use Python to querry that? Maybe even skip the MySQL thing all together.[/blue]

    That's certainly an option. Doesn't have to be a .js file. Any text file will do, though SQL is easier to write than regular expressions, either way is an option.

    :[blue] Though if we do that, we might lose functionality with the calendar. [/blue]

    Depends on how well we can store the data in a flat text format.

    :[blue] Not that I am trying to shy away from learning MySQL mind you, I just checked some prices on classes and they range from $1,000 to upards of $2,000. This is alittle out of my range and I can't find free tutorials anywhere. Maybe you know where to learn, but to be honest, I checked out the admin tool for MySQL on my website and was lost on the first page. This database reads to me like C/C++. And that is why I started learning JavaScript and Python. They are easier to understand. Just thinking of the path of least resistance.[/blue]

    Depending on how well Python interfaces with MySQL we may be able to do all the work in Python and let it mess with the MySQL guts.

    : [grey][b]I am working on what information will be available to the user. It might take a few days to get this in order. As I said earlier, I just finished with a beginners tut for Python and near the end of it, the guy started talking about file IO. It seems to me that we can use this funuction to call the database, get what information we need out of it, write it into the calendar and send it to the browser. We can even use this function with any file we need to retrieve information from. At least that is what it seemed like to me. WE can even use the "open_file.write('filename.txt','w')" call to make a file to store information in. [/b][/grey]

    Yes, reading and writing text files is an option but may not be as flexible as a database.

    : [blue]I need to be thanking you for helping me with this project. I have a feeling that before we are done with this project, we will have learned more than we thought possible! Let's both be thankful for that![/blue]

    Does it matter to you that an atheist is helping with your church webpage?

    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

Sign In or Register to comment.