Re: Python with Rev and postGreSQL?

2006-07-14 Thread kee nethery


On Jul 13, 2006, at 11:40 PM, John Tregea wrote:


Hi Kee,

I am aware of Rev having XML capabilities, but because of a whole  
bunch of SQL requirements I have kept it in the back of my mind for  
future investigation.


Actually, When I say use XML what I really mean is pass the data  
using that format but don't bother with using an XML library. Since  
you control the XML you will be reading, keep it simple and one  
simple parser is all you need.


For example:

User=joe Bob
account=9274564
Postal=7263 Anystreet
Apartment 16B
Flockingham
Stillton by the Whatever
Round the back and over the bridge
Camshire upon the Avon
Some British Country, UK L8K 9U6

When you use tagged pairs, and you pass data around, you have to deal  
with the data containing a return. It just confuses the situation.


If instead, you pass the data around in something that looks like  
XML, returns are not an issue.



joe Bob
9274564
< Postal>7263 Anystreet
Apartment 16B
Flockingham
Stillton by the Whatever
Round the back and over the bridge
Camshire upon the Avon
Some British Country, UK L8K 9U6


So just so you know, the above is not legit xml

The parser for this (assuming you put the whole thing into a variable  
named 'theData' would be


put getXmlNode('user',getXmlNode('xml',theData)) into theUser
put getXmlNode('account',getXmlNode('xml',theData)) into theAccount
put getXmlNode('Postal',getXmlNode('xml',theData)) into thePostal

and that function looks like:

on getXmlNode nodeName, theText
  put offset("<" & nodeName & ">",theText) + the number of chars in  
nodeName + 2 into startChar

  put offset("",theText) -1 into endChar
  if startChar > 0 AND endChar > 0 then
return char startChar to endChar of theText
  else
return empty
  end if
end getXmlNode

As long as you control the XML coming in and don't use attributes


and you don't duplicate data tags
ralph
joe

the above XML parser should be all that you need to use and you can  
create and pass data around using the XML format. My homebuilt XML  
parsers handle duplicate data tags and attributes but that is only  
because other people create the data and I have to deal with it. But  
if you own the data format, keep it simple and thats all the XML  
parser you'll need.


Kee


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Python with Rev and postGreSQL?

2006-07-13 Thread John Tregea

Anything that avoids complication is good by me.  :-D

The project has been incredible to work on. I have had to map and model 
1,600 data objects in releation to each other in the database and find 
naming conventions, permission models, role management methods etc. for 
the whole thing. The db is now done and the front end is taking shape. 
Rev is a perfect match for an environment where the structure of named 
elements within other named elements can enable you to find the 
corresponding data in a db structure.


We have one situation (in the middle east) that requires integration of 
CCTV, access control, RFID, GIS, fire alarms, intrusion alarms and 
traffic management as well as logistics, vessel and cargo tracking 
database systems. Over thirty data streams in all... I hope Rev will 
enable us to bring it all together on one screen in an emergency 
command, control and communication centre.


Regards

John T

kee nethery wrote:
I'd suggest a standard HTTPS connection and just pass it XML as part 
of a POST. Simple, easy to troubleshoot with a browser. SOAP is a 
complication and there is really no need for it.

Your project sounds like fun.
Kee


On Jul 13, 2006, at 5:34 PM, John Tregea wrote:


Thanks Kee,

While the database structure is complete, the front end is not, (that 
is why I am evaluating Rev), I believe python is a good tool to 
connect to the database, but not sure if it is used by any other 
Revolutionaries or if anyone can say what has worked well for them? I 
believe SOAP is used by some as well?


Regards

John T

kee nethery wrote:

If I were you ... starting from the database working outward:

Build a CGI that talks to your database. Host that CGI on your 
servers. Give it the ability to access your database with a username 
and password that only it knows and give it the ability to execute 
any SQL that makes sense.


Have your app talk to the CGI. Have it log in either with a stored 
password in the app or have the user enter a password that you give 
to them, or both.


Have your app only send requests for SQL to be run. Don't send the 
SQL, send the name of the SQL and the parameters. For example:


SelectGameScores
Team = Dallas
Year = 2006

That gets converted in the CGI into

SQL = "select date,teamA,teamB,scoreA,scoreB from teamScores where 
date >= 'Jan 1, {year}' and date <= 'Dec 31, {year}' and (teamA = 
'{team}' or teamB = '{team}')"


SQL submitted = "select date,teamA,teamB,scoreA,scoreB from 
teamScores where date >= 'Jan 1, 2006' and date <= 'Dec 31, 2006' 
and (teamA = 'Dallas' or teamB = 'Dallas')"


Just make sure you do some validation in the CGI on the parameters 
that come in to prevent SQL injection.


If you do this, it doesn't matter if they can get direct access to 
your CGI, they can only run the SQL you have predefined.


Kee Nethery

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Python with Rev and postGreSQL?

2006-07-13 Thread John Tregea

Hi Kee,

I am aware of Rev having XML capabilities, but because of a whole bunch 
of SQL requirements I have kept it in the back of my mind for future 
investigation.


I will have to look at the Solaris 10 environment and see what will run 
on a single server with our PostgreSQL database. I am guessing that 
Apache will run, and probably PHP (as per Dan's recommendation). I will 
look into it further.


Thanks

John T

kee nethery wrote:
I'd suggest a standard HTTPS connection and just pass it XML as part 
of a POST. Simple, easy to troubleshoot with a browser. SOAP is a 
complication and there is really no need for it.

Your project sounds like fun.
Kee


On Jul 13, 2006, at 5:34 PM, John Tregea wrote:


Thanks Kee,

While the database structure is complete, the front end is not, (that 
is why I am evaluating Rev), I believe python is a good tool to 
connect to the database, but not sure if it is used by any other 
Revolutionaries or if anyone can say what has worked well for them? I 
believe SOAP is used by some as well?


Regards

John T

kee nethery wrote:

If I were you ... starting from the database working outward:

Build a CGI that talks to your database. Host that CGI on your 
servers. Give it the ability to access your database with a username 
and password that only it knows and give it the ability to execute 
any SQL that makes sense.


Have your app talk to the CGI. Have it log in either with a stored 
password in the app or have the user enter a password that you give 
to them, or both.


Have your app only send requests for SQL to be run. Don't send the 
SQL, send the name of the SQL and the parameters. For example:


SelectGameScores
Team = Dallas
Year = 2006

That gets converted in the CGI into

SQL = "select date,teamA,teamB,scoreA,scoreB from teamScores where 
date >= 'Jan 1, {year}' and date <= 'Dec 31, {year}' and (teamA = 
'{team}' or teamB = '{team}')"


SQL submitted = "select date,teamA,teamB,scoreA,scoreB from 
teamScores where date >= 'Jan 1, 2006' and date <= 'Dec 31, 2006' 
and (teamA = 'Dallas' or teamB = 'Dallas')"


Just make sure you do some validation in the CGI on the parameters 
that come in to prevent SQL injection.


If you do this, it doesn't matter if they can get direct access to 
your CGI, they can only run the SQL you have predefined.


Kee Nethery

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Python with Rev and postGreSQL?

2006-07-13 Thread John Tregea

Hi Dan,

I will have a look at PHP and Ruby, I have seen your comments on Ruby 
(in other threads) and been intrigued by the possibilities. I have used 
Tango and Lasso at various times with both WebStar (OS9) and Apache 
(OSX) with FMPro 5.5 and 6 as a db for web and intranet projects but 
that is my only experience with cgi work.


Lots to learn, but what an adventure hey...


Regards

John T

Dan Shafer wrote:

John.

Chipp Walters and his team have a strong preference for using PHP on the
server side and have developed a powerful and stable architecture for 
using

Rev to call PHP commands that return Web pages. I suspect he'll chime in
here at some point but that is one of the most tested approaches. 
Certainly

a Python CGi would have a similar result (as would other server-side
scripting langauges such as Ruby).

On 7/13/06, John Tregea <[EMAIL PROTECTED]> wrote:


Thanks Kee,

While the database structure is complete, the front end is not, (that is
why I am evaluating Rev), I believe python is a good tool to connect to
the database, but not sure if it is used by any other Revolutionaries or
if anyone can say what has worked well for them? I believe SOAP is used
by some as well?



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Python with Rev and postGreSQL?

2006-07-13 Thread kee nethery
I'd suggest a standard HTTPS connection and just pass it XML as part  
of a POST. Simple, easy to troubleshoot with a browser. SOAP is a  
complication and there is really no need for it.

Your project sounds like fun.
Kee


On Jul 13, 2006, at 5:34 PM, John Tregea wrote:


Thanks Kee,

While the database structure is complete, the front end is not,  
(that is why I am evaluating Rev), I believe python is a good tool  
to connect to the database, but not sure if it is used by any other  
Revolutionaries or if anyone can say what has worked well for them?  
I believe SOAP is used by some as well?


Regards

John T

kee nethery wrote:

If I were you ... starting from the database working outward:

Build a CGI that talks to your database. Host that CGI on your  
servers. Give it the ability to access your database with a  
username and password that only it knows and give it the ability  
to execute any SQL that makes sense.


Have your app talk to the CGI. Have it log in either with a stored  
password in the app or have the user enter a password that you  
give to them, or both.


Have your app only send requests for SQL to be run. Don't send the  
SQL, send the name of the SQL and the parameters. For example:


SelectGameScores
Team = Dallas
Year = 2006

That gets converted in the CGI into

SQL = "select date,teamA,teamB,scoreA,scoreB from teamScores where  
date >= 'Jan 1, {year}' and date <= 'Dec 31, {year}' and (teamA =  
'{team}' or teamB = '{team}')"


SQL submitted = "select date,teamA,teamB,scoreA,scoreB from  
teamScores where date >= 'Jan 1, 2006' and date <= 'Dec 31, 2006'  
and (teamA = 'Dallas' or teamB = 'Dallas')"


Just make sure you do some validation in the CGI on the parameters  
that come in to prevent SQL injection.


If you do this, it doesn't matter if they can get direct access to  
your CGI, they can only run the SQL you have predefined.


Kee Nethery

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Python with Rev and postGreSQL?

2006-07-13 Thread Dan Shafer

John.

Chipp Walters and his team have a strong preference for using PHP on the
server side and have developed a powerful and stable architecture for using
Rev to call PHP commands that return Web pages. I suspect he'll chime in
here at some point but that is one of the most tested approaches. Certainly
a Python CGi would have a similar result (as would other server-side
scripting langauges such as Ruby).

On 7/13/06, John Tregea <[EMAIL PROTECTED]> wrote:


Thanks Kee,

While the database structure is complete, the front end is not, (that is
why I am evaluating Rev), I believe python is a good tool to connect to
the database, but not sure if it is used by any other Revolutionaries or
if anyone can say what has worked well for them? I believe SOAP is used
by some as well?



--
~~
Dan Shafer, Information Product Consultant and Author
http://www.shafermedia.com
Get my book, "Revolution: Software at the Speed of Thought"

From http://www.shafermediastore.com/tech_main.html

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Python with Rev and postGreSQL?

2006-07-13 Thread John Tregea

Thanks Kee,

While the database structure is complete, the front end is not, (that is 
why I am evaluating Rev), I believe python is a good tool to connect to 
the database, but not sure if it is used by any other Revolutionaries or 
if anyone can say what has worked well for them? I believe SOAP is used 
by some as well?


Regards

John T

kee nethery wrote:

If I were you ... starting from the database working outward:

Build a CGI that talks to your database. Host that CGI on your 
servers. Give it the ability to access your database with a username 
and password that only it knows and give it the ability to execute any 
SQL that makes sense.


Have your app talk to the CGI. Have it log in either with a stored 
password in the app or have the user enter a password that you give to 
them, or both.


Have your app only send requests for SQL to be run. Don't send the 
SQL, send the name of the SQL and the parameters. For example:


SelectGameScores
Team = Dallas
Year = 2006

That gets converted in the CGI into

SQL = "select date,teamA,teamB,scoreA,scoreB from teamScores where 
date >= 'Jan 1, {year}' and date <= 'Dec 31, {year}' and (teamA = 
'{team}' or teamB = '{team}')"


SQL submitted = "select date,teamA,teamB,scoreA,scoreB from teamScores 
where date >= 'Jan 1, 2006' and date <= 'Dec 31, 2006' and (teamA = 
'Dallas' or teamB = 'Dallas')"


Just make sure you do some validation in the CGI on the parameters 
that come in to prevent SQL injection.


If you do this, it doesn't matter if they can get direct access to 
your CGI, they can only run the SQL you have predefined.


Kee Nethery

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution