Page 1 of 2

AJAX - is it the new Betamax? What are your experiences?

Posted: Tue 27 Apr 2010 7:52 pm
by Hillbilly
Like many converts to Cumulus, I have worked my way through from restyling the core Cumulus web pages, adding Javascript gadgets and converting my pages to PHP. They've all been new to me, so lots to learn but very addictive. As the next step, I have been looking for some time at how best to convert my pages to realtime. I have been working through AJAX - studying forum postings and having a look at the packages offered for implementation here.

What interested me most was seeing the enthusiastic following on the forum posts when an AJAX package was offered but looking now, how many of those web pages no longer seem to be in use. I set up a trial AJAX page. I understand why it seems to be the way to go, updating just those fields that need to be refreshed without a trip to the server to refresh a full web page. What I'm not entirely convinced about yet is the time it takes to populate each field when the page is first loaded. I've noticed the same on some sites that I've found that use it. Swings and roundabouts I guess, you wait for a full page to build or you wait for the fields to populate. But advantages using AJAX once the page is loaded.

My PHP pages are refreshing every minute where necessary. I now ftp little except my webcam image. I'll monitor the effect this has on my bandwidth utilisation with my web host. I'll probably AJAX my php pages just to see how it goes and compare.

For those who did use or still use AJAX: Is it the best thing since sliced bread? Have you seen benefits/pitfalls? Did you trial it then abandon it? Have you tweaked things to improve it? Is it worth it?

Yours etc.,
Bewildered of the Mayenne.

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Tue 27 Apr 2010 9:47 pm
by gemini06720
Helen, if I may... :)

I have been using AJAX controlled pages for the past 5 years with Weather Display and up to a month ago, with Cumulus.

For the past years, almost all my pages have been in PHP with some HTML where needed. I have found PHP to be a lot more flexible than HTML, not just because almost all of my pages are now static (meaning that my pages do not need to be processed by any weather software) but also because my pages can be broken down into smaller PHP scripts with very dedicated functions.

As an example, I will use my 'still-under-development' Cumulus Web pages (the pages can be seen at the following link but they are no longer being updated by Cumulus as I had to stop all Cumulus operations because of continued crashes): [link removed]

Each pages is seamlessly composed of (or is using) at least 6 PHP scripts. Except for the PHP script that contains the webtags and the realtime text file, all other pages and scripts are static.

The only page that uses AJAX is the one displaying the current weather - I use AJAX on that page because I do not want to 'force' a complete page refresh - I hate imposing a complete page refresh on the users... :oops:

When the current weather page is requested by a user, the PHP scripts are first combined together on the Web server, the values contained in the webtags file inserted, and then a complete page is sent to the user's browser. At the same time, a JavaScript file is sent to the user's browser cache. If the user has the browser's JavaScript option activated, then the JavaScript starts running and request from the Web server updated weather data. That data, if available, is then downloaded into the user's browser cache where the JavaScript reads it and then replaced the values of assigned page tags with these updated values - this usually happens quickly without the need to refresh the complete page.

For the 'still-under-development' Cumulus Web pages, I have used a highly modified version of David's weather console JavaScript.
I'll probably AJAX my php pages just to see how it goes and compare.
The JavaScript will be running in the background with little or no annoyance to the user. The size of the file needed by the JavaScript being less than 250 bytes - very small compared to the size of the 25 Kbytes webtags file.

And finally... ;)
For those who did use or still use AJAX: Is it the best thing since sliced bread? Have you seen benefits/pitfalls? Did you trial it then abandon it? Have you tweaked things to improve it? Is it worth it?
Helen, AJAX (or the use of JavaScrip) is certainly not the best thing since slice bread, but it comes close - by the way, I really prefer my bread whole, just out of the oven - I really hate that store-produced-pre-sliced-whith-mushy stuff they call bread! :(

AJAX cannot be used for everything ... although Google is really paving the Internet with a lot of AJAX scripts.

Although working with AJAX (JavaScrip) can be a pain in the 'postérieur' as there is no real error reporting (contrary to what is available in/with PHP), once one discovers the weaknesses of JavaScript, one also discovers its strengths.

I have done my JavaScript apprenticeship when I started modifying the main JavaScript file on my Weather Display pages - I could not understand why any one would want use such an unfriendly script. Then, I found a way to check the progress of my modification and to determine (approximately) where an error had occurred. Eventually, after a couple of weeks of modifying, trying, re-modifying, surfing the Internet for answers, banging my head on the desk, I had an error-free JavaScript that would seamlessly update the weather page.

Anyone else would probably have given up, but I wanted to see results and that eventually happened. I have learn a lot. I am not yet proficient in AJAX/JavaScript, but I understand better.

Have I tweaked things... Really, you dared asked that question to me, little old me... :twisted: ...you should know me better, I cannot leave things alone...

Indeed, as I indicated above, my first 'major tweak' was the modification of the JavaScript that powers my InstaWeather page: [link removed]

Yes, I know there is a lot of information on that page... And yes, I know it takes a few seconds to load the page... :evil:

Most of the weather data (values) displayed on the page is already on the Web server (uploaded by Weather Display) - but the page also contains information that is downloaded/updated from (slower) external servers, such those from Environment Canada (the 'branch' of the canadian government that oversees almost everything environmental including weather information) where the page gets some [not very accurate] weather forecasts and weather radar images, and those from Weather Underground and The Weather Network where the page gets weather radar images.

Was all that aggravation and work worth it? Yes it was worth it, every minutes I spent in the code learning and swearing... ;)

If you decide to add some AJAX/JavaScript to you main page and if you head gets sore from all the banging on the stone walls, you know where you can reach me... :mrgreen:

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Wed 28 Apr 2010 9:58 am
by Hillbilly
Ray, many thanks for your comprehensive and thoughful reply.
As an example, I will use my 'still-under-development' Cumulus Web pages (the pages can be seen at the following link but they are no longer being updated by Cumulus as I had to stop all Cumulus operations because of continued crashes): http://tzouhalem.net/phpcumulus/
That's a shame it's an elegant page. Will you be reviving it and attempting to stabilise Cumulus or have you moved on?
I use AJAX on that page because I do not want to 'force' a complete page refresh - I hate imposing a complete page refresh on the users... :oops:
I have read this view beofre, why is it frowned upon?
If the user has the browser's JavaScript option activated, then the JavaScript starts running and request from the Web server updated weather data. That data, if available, is then downloaded into the user's browser cache where the JavaScript reads it and then replaced the values of assigned page tags with these updated values - this usually happens quickly without the need to refresh the complete page.
I was going to post a separate question about this. I would like to get to the point of limited tag refresh, but had a nervousness about our target audience and the likelihood of Javascript being enabled. I remember (many years ago) that Javascript was avoided as it was often not enabled on user browsers. Does anyone have a view on what proportion of people still have Javascript disabled? If it is, what is the impact on your page?
For the 'still-under-development' Cumulus Web pages, I have used a highly modified version of David's weather console JavaScript.
Synewave, on this forum, has also taken this approach very successfully. Did you create an enhanced realtime file to include the missing items, or use tags to populate them?
Although working with AJAX (JavaScrip) can be a pain in the 'postérieur' as there is no real error reporting (contrary to what is available in/with PHP), once one discovers the weaknesses of JavaScript, one also discovers its strengths.
Interesting because my initial reaction to both was that I found PHP more intuitive. You're very patient.
Indeed, as I indicated above, my first 'major tweak' was the modification of the JavaScript that powers my InstaWeather page: http://tzweather.org/wxweather/instaweather.php
That's a very comprehensive dashboard. I'm a way away from the technical compexity of that but good to see lots of ideas on there. Food for thought.
If you decide to add some AJAX/JavaScript to you main page and if you head gets sore from all the banging on the stone walls, you know where you can reach me... :mrgreen:
Thank you :D

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Wed 28 Apr 2010 8:57 pm
by gemini06720
Hillbilly wrote:Ray, many thanks for your comprehensive and thoughful reply.
Helen, my pleasure... ;)
Hillbilly wrote:That's a shame it's an elegant page. Will you be reviving it and attempting to stabilise Cumulus or have you moved on?
Well, first, I have to completely check the computer onto which Cumulus was installed, an older Pentium III, to find out if the instability problem is/was caused by some corrupted files within the operating software (Windows XP Pro SP2) or if the ageing CPU itself is the cause of the problem ... but, procrastination is one of MY problem... :oops:

I know this comment is/might/will make some users angry, but, contrary to many users, I find Cumulus very limited/restrictive (obviously, as I compare it to Weather Display ... and I know, there is a big price difference between the two software).

My involvement with Cumulus was more for the development of the file around the program itself. Take for example my new PHP/AJAX driven pages (the ones you are referring in the above quote), they were to be designed in cooperation with other people... Unfortunately, I ended up doing all the designing... By the way, those pages are fully operational except that I do not have Cumulus running to provide them with new weather data. And I guess that I will be moving away from them - I will probably ZIP all the files and start on something different/new... :|
Hillbilly wrote:I have read this view beofre, why is it frowned upon?
There are a few things that I really dislike about Web pages: Being imposed (by the page designer) a complete page refresh, being imposed long pages without any way of quickly getting to the top of the page, being imposed poorly located menus (as is the case with the Cumulus templates).

Obviously, because of the above dislikes, I will not design my pages with an automatic refresh and if I have no other option than to force a complete page refresh, then I will place a text on the page indicating that the page is refreshed at regular intervals (and possibly place a counter somewhere) ... one of my pet peeve... :roll:
Hillbilly wrote:I would like to get to the point of limited tag refresh, but had a nervousness about our target audience and the likelihood of Javascript being enabled. I remember (many years ago) that Javascript was avoided as it was often not enabled on user browsers. Does anyone have a view on what proportion of people still have Javascript disabled? If it is, what is the impact on your page?
Helen, if JavaScript is not enable in one's browser, one sees very little of the Web, such as page formatting, audio/video players, etc.

To properly view almost all Web pages, one needs to have JavaScrip enable in his/her browser ... Helen, JavaScript needs to be activated to properly (completely) view your own 'La Locherie' Web pages - your Web server is 'forcing-on-me' no less than 4 JavaScripts... ;)

So, Helen, you do not have to worry about your (or anyone's else) targeted audience and the JavaScript activation (or rather browsers being enable to allow passage of Java scripts) - it is needed! :|
Hillbilly wrote:Did you create an enhanced realtime file to include the missing items, or use tags to populate them?
So that you understand my page design... As you are aware, my pages are all of the PHP type with additional HTML code where and when needed.

When a user requests my main weather page, for example, the Web server first loads/uses the Cumulus webtags file to populate the different empty weather fields (on that main page). Then, the page (including the image files, the CSS files and the JavaScript files) is sent to the user's computer (into the browser's cache). If the JavaScript option has been enable into the user's browser, then the JavaScript updater fetch back data from the Web server and update whichever fields it was programmed to update. If the JavaScript option has NOT been enable into the user's browser, then the fields are not updated any further, until the user click on the browser's refresh button.
Hillbilly wrote:Interesting because my initial reaction to both was that I found PHP more intuitive. You're very patient.
Indeed, PHP is so much easier to work with - you should know by now that error reporting, as is available in PHP, makes one's programming life much more interesting, to say/write the least...

But there is no such easy way to design/work with JavaScript - one has to develop his/her own 'intuitive' way of working with JavaScript, such as adding new code at the bottom of the working file, checking the results, and eventually (when the new code is finally producing the results expected) moving that new code to its proper location within the file... It is a learning experience where one needs to have some patience... :mrgreen:
Hillbilly wrote:That's a very comprehensive dashboard. I'm a way away from the technical compexity of that but good to see lots of ideas on there. Food for thought.
Helen, I must have spent no less than 50 hours adapting, developping, modifying and testing just the JavaScript that powers/updates my InstaWeather page - that was my learning head-banging experience... :evil:

The page probably only appears complexe because of the quantity of weather information available on one single page. But, other than the JavaScript, the InstaWeather page is made up of a header script, a menu script, a main page script and a footer script, just slightly more complexe than my Cumulus pages.

Have you seen my 'less complexe' weather Web pages - here is the 'root' link to Tzouhalem-Maple Bay Weather pages: [link removed]

Less complexe is a figure of speech/writing - there is much complexity in the quantity and quality of 'weather-related' information provided into those pages - more than five years of continuous development/updating has gone (and is still going) into those Web pages. :o

You and I should be able to easily adapt JavaScript to your main weather page... :D

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Thu 29 Apr 2010 6:18 pm
by Hillbilly
There's a lot to think about Ray. Thanks for all the information. I will digest it!

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Thu 29 Apr 2010 6:44 pm
by daj
I am a huge fan of Javascript (and Ajax) in the right place. A complete site based on it is not necessary in my opinion, however for something like (near) realtime data it is great. And throw in a great big serving of PHP too and you've got a great, dynamic site

All the big players now use these techniques to work in the background while you read the page -- Google mail will refresh the Inbox portion of the page if a new email arrives; Google Docs and Microsofts new Web based Office tools too.

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Thu 29 Apr 2010 10:04 pm
by gemini06720
daj wrote:...A complete site based on it is not necessary in my opinion, however for something like (near) realtime data it is great. And throw in a great big serving of PHP too and you've got a great, dynamic site
I think this is what Helen is looking at, making the main/current weather page more realtime - I do not think that adding JavaScript/AJAX to all of one's Web pages would do anything good ... but, again... :roll:
daj wrote:All the big players now use these techniques to work in the background while you read the page -- Google mail will refresh the Inbox portion of the page if a new email arrives; Google Docs and Microsofts new Web based Office tools too.
I do not use many (read: none) of the services from the 'big players' you mentioned... I have heard and read about 'Cloud' - am I correct in assuming that AJAX is being used to provide the 'Cloud' services?

(I guess I should 'surf' the Web to find out more about 'Cloud' computing... :oops: )

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Fri 30 Apr 2010 7:14 am
by Hillbilly
daj wrote:I am a huge fan of Javascript (and Ajax) in the right place. A complete site based on it is not necessary in my opinion, however for something like (near) realtime data it is great. And throw in a great big serving of PHP too and you've got a great, dynamic site
Thanks David. I implemented your excellent weather console and can see that you have a couple of near live pages updating with Javascript. Do you use the Cumulus processing of xxxxT pages for others? You also make good use of your sql database in presenting additional key stats, which I want to do too.

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Fri 30 Apr 2010 8:54 am
by daj
Hillbilly wrote:...Do you use the Cumulus processing of xxxxT pages for others?
Hi Helen

No, I do not use the standard processed files. I process the PHP webtags file and uses this on my website pages

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Tue 04 May 2010 4:58 pm
by Hillbilly
daj wrote: No, I do not use the standard processed files. I process the PHP webtags file and uses this on my website pages
Thanks David. Do you do any refreshing of the php pages or work on the basis that someone will only look at a given page for a short time?

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Tue 04 May 2010 8:21 pm
by daj
Hillbilly wrote:
daj wrote:Thanks David. Do you do any refreshing of the php pages or work on the basis that someone will only look at a given page for a short time?
Helen

This page is an auto refresshing page, based on PHP initially

http://www.grantownweather.co.uk/realtime

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Wed 05 May 2010 10:59 am
by gemini06720
daj wrote:This page is an auto refresshing page, based on PHP initially
David, looking at the page reminded me of your weather console (not the design but the updating procedure). I found the 'previous value' column kind of interesting ... any chance you might be sharing the 'design secret' involved in producing the column without having to sign a non-disclosure agreement... ;)

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Wed 05 May 2010 8:56 pm
by Synewave
Ray,
It's all there to see if you click on view source, including the scripts.

Very clever David, I'm also loving the use of Google translate. That is very useful for me. I shall try and implement it soon.

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Thu 06 May 2010 12:24 am
by gemini06720
Synewave wrote:It's all there to see if you click on view source, including the scripts.
Paul, I knew that ... but I wanted to get David's permission before 'stealing' his code... :twisted:
Synewave wrote:Very clever David, I'm also loving the use of Google translate. That is very useful for me. I shall try and implement it soon.
Paul, I tried the french translation and ... YEACH!!! It can be horrible!! :evil:

Re: AJAX - is it the new Betamax? What are your experiences?

Posted: Thu 06 May 2010 7:09 am
by Synewave
Synewave wrote:Very clever David, I'm also loving the use of Google translate. That is very useful for me. I shall try and implement it soon.
Paul, I tried the french translation and ... YEACH!!! It can be horrible!! :evil:[/quote]

Yes, I tried it too. It was OK at first glance. But it doesn't want to handle the dynamic text data, i.e. forecast very well. I think I may stick with my own translated version of Le hamel.