Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

Introduction
Welcome, Guest. Please login or register.
November 21, 2008, 10:40:23 AM
11306 Posts in 1249 Topics by 501 Members
Latest Member: rosaline
Experts Round Table Network  |  Community Affairs  |  Introductions  |  Introduction « previous next »
Pages: [1] 2
Author Topic: Introduction  (Read 6036 times)
Bunnywabbit

Offline Offline

Posts: 5


« on: March 13, 2007, 11:07:35 AM »

Hi y'all,

Pleased to meet you.

Google pointed me to http://www.expertsrt.com/tutorials/Rod/JSread.php#ftn2 (the tutorial on XMLhttprequest file reading) by Rod Divilbiss. It was so useful, detailed and informative that i just had to sign up and see what other goodies you might have. (I was looking for something that would allow me to make a client-side read-only database app).

I'm a dilletant web dev; I dabble in Javascript, css and asp by way of a hobby. A hobby that more or less by accident became useful in my professional life as well.

Not much else to tell. I hope to get to know you people soon. Perhaps one day I might even be able to contribute something of use.

regards,
BW.
« Last Edit: March 13, 2007, 01:49:36 PM by CrYpTiC_MauleR » Logged
CrYpTiC_MauleR
Site Builder

Offline Offline

Posts: 489



WWW
« Reply #1 on: March 13, 2007, 01:49:05 PM »

Welcome to ERT =o)
Logged

[x] Fight | www.crypticmauler.com
"You must be
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #2 on: March 13, 2007, 01:55:13 PM »

Hi y'all,

Pleased to meet you.

Google pointed me to http://www.expertsrt.com/tutorials/Rod/JSread.php#ftn2 (the tutorial on XMLhttprequest file reading) by Rod Divilbiss. It was so useful, detailed and informative that i just had to sign up and see what other goodies you might have.

Thanks very much BW.  I appreciate your kind words...although I need to update that article.

Writing to the client side is difficult due to security imposed upon the developer by the browser.  You'll probably need some sort of assistant program that the person using the browser will agree to download, such as a Java Applet, or possibly a Flash script.

Welcome aboard!

Rod
Logged

Rod
COBOLdinosaur
ERT.com Admin

Offline Offline

Posts: 481



WWW
« Reply #3 on: March 13, 2007, 02:02:23 PM »

if you are looking at being self-contained on the client and you are on a Windoze box, you can use an .hta.  That is an HTML page saved with a .hta extension.  You can deploy it to the destop, and it will allow you to access just about anything using activex and shell scripting.

All you need is interfacing code to manipulate an access DB and you should have what you want.  I am not an Access or Windows developer, so we will have to wait for someone to help with the details of the coding, but that should do the trick if I am understanding what it is you want to do.

Logged
Bunnywabbit

Offline Offline

Posts: 5


« Reply #4 on: March 13, 2007, 02:32:19 PM »

Thank you, Rod,

I won't be needing write-functions on the app i have in mind, which is lucky, since i don't know Java or actionscript.
The data to display will be so rarely altered that i'm not even sure i won't just slap it into a hidden html table anyway. But i'm looking forward to playing around with the stuff in your article. 

if you're interested, the app i'm working on will function as a first-line of defense for a helpline forum for an open source game. It's supposed to guide users to relevant troubleshooting info based on their input  and hold users' hands in posting help requests by generating a standardized-formatted copy-paste-ready PHBB post if all else fails. I am not the site's admin, and i do not have access to a mySQL/ASP enabled server so client-side code is the only way to go.

Depending on the app's popularity/use and the rate in wich new issues pop up, i might consider converting it into a server-side DB app and adding writing priviliges, but for now read-only will do.

Thanks again,
BW.

An early proof-of-concept (using hidden HTML tables) is here: http://bunnywabbit.atspace.org/helplinepostgen.html.

edit: wow, i'm getting tips even before asking for them! This community is great!
« Last Edit: March 13, 2007, 02:34:44 PM by Bunnywabbit » Logged
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #5 on: March 13, 2007, 05:37:47 PM »

if you don't "have access to a mysql enabled server", I doubt doing queries client-side in stead of server side (PHP, forget about ASP please) will solve your problem.

can't you get a free hosting accout somewhere ? I know plenty of places where you can get a full *AMP server for free, with at least 100MB disk space.
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #6 on: March 13, 2007, 06:11:18 PM »

Forget about ASP please

Yes, I agree with VGR, ASP 3.0 is essentially orphaned as of 1999. http://www.rodsdot.com/ee/learningASP.asp

ASP.NET is viable, but it is a development framework, not just a server side scripting language.  If you are learning web development, it is better you learn HTML, CSS, JavaScript and PHP or PERL.  Other offerings are great in a mid to large size company where team development and the use of RAD tools are necessary, but even huge sites such as Yahoo use PHP.

Fair warning: PHP has so many extensions and hooks to the server, it sometimes makes it easy for developers to make unsafe decisions.  Learn to program securely and don't just cut and paste example code without understanding where there may be vulnerabilities.


Logged

Rod
Bunnywabbit

Offline Offline

Posts: 5


« Reply #7 on: March 13, 2007, 06:34:16 PM »

*giggles*
Quote
I doubt doing queries client-side in stead of server side (...) will solve your problem.
...but i don't have a problem (yet). At this point i'm merrily hopping about in Javascript-land and i have a new toy to play with.
I know i won't be able to query those files or change their data.   

Quote
I know plenty of places where you can get a full *AMP server for free ...
O. Ehm. You do? Well, i'd certainly be interested in one of those. Any in particular you can recommend? (assuming board rules permit, of course)

For this project, though, i'm bound to client side code for a lot of reasons, only a few of which are technical.

I do appreciate your help and advice, though. Thank you.
Logged
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #8 on: March 14, 2007, 11:03:33 AM »

Yes I do. You can get a "free" hosting at www.free.fr, lycos, www.multimania.com, www.hebergement-gratuit.com and the like. (quick list, I'm sure there are others around here, and many others all over the world : bravenet.com ? doteasy.com ? freewebspace.net ?)

you'll get a mutualized Apache+PHP4 or PHP5 webserver, a MySql DB, and between 2MB and 300MB of disk space (even 2MB is good enough for some sites ; at least you won't have any ads ;-)
of course, "free" means "cluttered to various level with ads and ad popovers", but that's the game isn't it ?
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #9 on: March 14, 2007, 12:22:49 PM »

Hi Rod,

again thanks for the great script. I spent last night playing around with it and am having a blast.

so, on to the meat of this PM:
instead of doing this:
Code
Language: javascript (GeSHi-highlighted)
               tmp=tmpArr[idx].split(',');
               val = tmp[0].replace('"','');
               val = val.replace('"','');
               txt = tmp[1].replace('"','');
               txt = txt.replace('"','');
           }

I did this (thoroughly confusing the code highlighter):
         
Code
Language: javascript (GeSHi-highlighted)
//replace all double quotes with empty strings:
tmpArr[idx] = tmpArr[idx].replace(/\"/g, '')
tmp = tmpArr[idx].split("
;");
//assign each 'column' to the variables created above:
                      //out +=  "
<tag property='"+tmp[0]+"'>"+tmp[1]+"</tag>"
           }

So instead of using 2 separate instructions  in each 'cell' to remove the quotes, i used a regular expression with the 'g' flag (global replace) to remove all quotes in the entire row in a single instruction and split the now quoteless 'row' into the tmp array afterwards.

I think this improves the scalability of the function and cleans up the code quite a bit, eliminating the need for the holding vars txt and var. (also, it's less confusing for those that don't know the replace function halts at the first positive result by default).

question: is there any way to pass an argument through this instruction:
Code
Language: javascript (GeSHi-highlighted)
eval('xmlhttp.onreadystatechange='+pFunc+';');
I've already thought of a workaround (setting a global variable with a different function and calling it with e.g. the makeList function), but if at all possible, i'd like to keep it clean. :)

anyway, hope you like my suggestion and talk to you soon.
cheers,
BW.

Yes, I actually rewrote that script in response to another person's comment, but have not updated the article.

Code
Language: javascript (GeSHi-highlighted)
<script type="text/javascript">
<!--
//create the Cross-browser XMLHttpRequest object
function getFile(pURL,pFunc,pId) {
var xmlhttp;
if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc
xmlhttp=new XMLHttpRequest();
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { //IE
       xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
}

if (xmlhttp) {
xmlhttp.onreadystatechange = function() { pFunc(xmlhttp,pId); };
xmlhttp.open('GET', pURL, true);
xmlhttp.send(null);    
} else {
alert('You need to upgrade your browser to use this page.\r\nAs of March 2006 more than 98% of the web browsers in use support the remote scripting object. Either your browser does not support remote scripting or the support has been disabled.');
xmlhttp=false;
}
}
 
// function to handle asynchronous call
function postFileReady(oXML,pId) {
  if (oXML.readyState==4) {
     if (oXML.status==200) {
        document.getElementById(pId).innerHTML=oXML.responseText;
        oXML = null;
     }
  }
}
 
//-->
</script>

Of importance is
  • By moving the var declaration,
Code:
var xmlhttp;
inside the function, you may execute multiple calls at once, and[/li]
[li]changing this line thus, allows you to pass any function to handle the response. [/li][/list]
Code:
xmlhttp.onreadystatechange = function() { pFunc(xmlhttp,pId); };
    [/li]

Which allows you to call

Code:
getFile('page1.htm',function1,'elementId1');
getFile('page2.php',postFileReady,'elementId2');

etc.
« Last Edit: March 14, 2007, 12:26:47 PM by rdivilbiss » Logged

Rod
Bunnywabbit

Offline Offline

Posts: 5


« Reply #10 on: March 14, 2007, 12:28:23 PM »

Woot!
thanks :)
Logged
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #11 on: March 14, 2007, 12:44:09 PM »

Fast, sometimes, LOL.

Like I said, I really need to update that article.
Logged

Rod
COBOLdinosaur
ERT.com Admin

Offline Offline

Posts: 481



WWW
« Reply #12 on: March 14, 2007, 09:08:47 PM »

There is all kinds of free web hosting around.  You just have to find one that has the features you want.  Here are a couple of free hosting directories:

http://www.free-webhosts.com/
http://www.freewebspace.net/

And there are thousands indexed by Google:
http://www.google.com/search?hl=en&q=free+web+hosting

Logged
Bunnywabbit

Offline Offline

Posts: 5


« Reply #13 on: March 14, 2007, 09:45:22 PM »

Thank you for your kind tips, although tbh, I was already aware of the concept of sponsored server space.

for those interested in how this particular project is going; i have updated the helpline app to get it's data from three different .csv files.
http://bunnywabbit.atspace.org/helplinepostgen.html
The bit that handles userinput for later use is broken for now- haven't gotten around to fitting it in it's new environment, but you should be able to get a good idea of what I was planning to do, here.

Client-side is definitely not the best way of going about this, but it sure is a fun challenge :)
Logged
ayman2243

Offline Offline

Posts: 1


« Reply #14 on: October 18, 2007, 12:08:50 PM »

best free web hosting
http://free-php.110mb.com
Logged
Pages: [1] 2
« previous next »
    Jump to: