Page 1 of 1

ADS Summit in Boise is now official

PostPosted: Thu Aug 02, 2012 11:28 pm
by reinaldocrespo
To all xbase in North America;

ADS summit is now official. Sep 18 and 19.

http://response.sybase.com/forms/2012ADSTechSummit

Our next Advantage Technical Summit has been scheduled for 18 – 19 September in lovely Boise Idaho. Boise is where most of the Advantage team is located including engineering, support, sales, and product management. As a result, attending the training gives you the unique opportunity to have access to the entire technical team, with plenty of time for one on one interaction.


I think this is a great opportunity to learn new things, meet people, and share information. I will take with me a lot of code where I show how to manage ads DD from xharbour and how to use SQL + ISAM and PHP on the same set of .dbfs or .adts.


Reinaldo.

Re: ADS Summit in Boise is now official

PostPosted: Fri Aug 03, 2012 12:25 am
by Colin Haig
Hi Reinaldo

Can you manage indexes with PHP with/without using ADS.

Regards

Colin

Re: ADS Summit in Boise is now official

PostPosted: Fri Aug 03, 2012 12:41 am
by reinaldocrespo
What do you mean manage indexes?

With PHP + ADS you can do any SQL on a dbf/fpt/cdx or dbf/dbt/ntx or dbf/fpt/vfp index, or adt/adm/adi:

UPDATE customers SET LasName = 'Doe', FirstName = 'John' WHERE customerid = '0001'

or

INSERT INTO customers (LastName, FirstName, Customerid ) VALUES( 'Doe', 'John', '0001' )

or

SELECT * FROM customers WHERE customerid = ?

As a parametized query or non-parametized (parametized query is much better to avoid sql injections).

All and any SQL will read/write to and from a dbf or adt table.

I have a couple of web portals written in PHP that read data from .dbf/ntx (old old old stuff) and .dbf/cdx.

I hope I answered the question.


Reinaldo.

Re: ADS Summit in Boise is now official

PostPosted: Fri Aug 03, 2012 11:48 pm
by reinaldocrespo
Hi.

If I could get a headcount of people planning to attend the Summit, perhaps we can have a track specially designed for harbour. If the number of people confirming is large enough, then I can try to persuade Sybase to bring Antonio.

If you rather write via email, please write to reinaldo.crespo at gmail.

Thank you,



Reinaldo.

Re: ADS Summit in Boise is now official

PostPosted: Mon Aug 06, 2012 2:20 am
by fraxzi
Hello Reinaldo,

I'm so eager with ADS + RadPHP..

Can you please please start on how to connect from RadPHP?

Sorry if it's a little off-topic.


Kind regards,

Re: ADS Summit in Boise is now official

PostPosted: Mon Aug 06, 2012 7:42 pm
by reinaldocrespo
Frances;

Hi. I trust you are doing file. I have seen some of your screenshots and always learn something from you.

By RadPHP I think you mean Embarcadero's PHP? I have never used RadPHP, I don't know what the difference is to plain vanilla PHP (which is what I have). I write php using the same editor (uestudio) that I use for my win32 fwh apps.

PHP with ADS works perfectly. I suggest you start by opening the help file and search for PHP. Open the 2nd entry: "A Sample PHP Web Site". You will see screenshots + PHP code. Use the forward and back buttons to see each .php file. it shows how to connect, insert, update, select data and show it on a web page. Simple PHP, but the code will show you everything you need.

It is unlikely that PHP will come setup with the Advantage language extension, but the help file also shows you that. I'm using Linux (Fedora 14) with Apache server to host the page. The actual ADS server is Windows Server and physically over 3 thousand miles away. The web server serves php pages while the data is fetched from the ADS server. A have a second setup where the web server is right next to the ADS server, both running Linux. And a third setup I also have is one where the Web server and the ADS server are both running on the same linux server.

It doesn't have to be PHP, it could also be Java, Perl, asp.net. Advantage has a client for each just like for PHP.

Here is the code I use to connect:
Code: Select all  Expand view

//----------------------------------------------------------------------------------------------------------------------
function DDconnect( $db, &$rConn )
{
    $user = $_SESSION[ 'userid' ];
    $pass = $_SESSION[ 'password' ];

    $rConn  = ads_connect( $db, $user, $pass );

    return is_resource( $rConn );
}


The login.php code is here. It is mostly PHP, HTML and some CSS:
Code: Select all  Expand view
<?php

    session_start();
    include "classes.php" ;
    include "include/corefuncs.php";
   
    if ( $_POST && isset( $login ) && ( strlen( $_POST[ "custid" ] ) < 3 || strlen( $_POST[ "password" ] ) < 6 ) )
        die( "bad user name or password" );
       
    if ( $_POST && array_key_exists('custid', $_POST) &&
        array_key_exists( 'password', $_POST ) &&
        array_key_exists( 'submit', $_POST ) &&
        !empty( $_POST[ 'custid' ] ) &&
        !empty( $_POST[ 'password' ] ) ) $login = 1;
       
    if ( isset( $login ) ) {
   
        nukeMagicQuotes();

        $user   = $_POST[ "custid" ] ;
        $pass   = $_POST[ "password" ] ;
       
        $_SESSION[ 'userid' ] = $user;
        $_SESSION[ 'password' ] = $pass;
       
        if ( !DDconnect( _DATA_DICT, $rConn ) )
            die( "<br> Error connecting to Database.<br>" ) ;

        $curruser = new user;
        if( !$curruser->load( $rConn, $user ) )  die( "<br> No access has been set for referring physician." ) ;

        //log successfull login attempt into database
        //table log keeps track of each successfull login for analisys and statistics.
        $rStmt = ads_prepare( $rConn, "INSERT INTO log ( [UserId], [login_date], [ip] ) VALUES( ?, now(), ? )" );
        $aParms = array( 1 => $user, 2 => $_SERVER[ 'REMOTE_HOST' ].$_SERVER[ 'REMOTE_ADDR' ] );
        $rResult = ads_execute( $rStmt, $aParms );
           
        ads_close( $rConn );
           
        $curruser->password = $pass;
        $_SESSION[ 'user' ] = $curruser;
        $_SESSION[ 'userid' ] = $curruser->userid;
        $_SESSION[ 'password' ] = $pass;
        $_SESSION[ 'username' ] = $curruser->GetName();
           
        header( 'location: ./main.php' );
        exit;
    }

?>

<style type="text/css">
input.required {background-color:darkred; color:white }


body {
    padding: 0;
    margin: 90px 10% 0 230px;
    background: #fff url(background.png) top left no-repeat;
    color: #fff;
    text-align: center;
    line-height: 100%;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif
}

label {
    font-size: 10px;
    width: 3em;
    float: left;
    text-align: right;
    margin: 0.05em 0em;
    clear: both; }

input {
    float: left;
    margin: .1em .1em;
    height: 20px;
    width: 110px; }

#subbutton {
    font-size: 11px;
    float: none;
    width: auto;
    margin-bottom: 1em;
    margin-left: 0em;
    height: 25px;
    line-height: 100%;
    clear:both; }

#nav {
    position: absolute;
    top: 280px;
    left: 2px;
    width: 123px;
}

#header {
    position: absolute;
    top: 10px;
    left: 660px;
}

#footer {
    position: absolute;
    bottom:10px;
    color: #aaa ;
    left: 1px;
    width: 150px;
    font-size: 75%;
    clear: both;
}

#textarea {
   font-size: 90%;
    position:absolute;
    top: 40px;
    margin: 60px 5% 0 1px;
    min-width: 425px;
    max-width: 625px;
}

br {
    clear: both;
    }
</style>

<html>
<form ACTION=""
    name="loginform"
    method="post" >

        <div id="nav">
            <strong>User Login</strong><br>
<br>

<p><label for="id">&nbsp;Username: </label></p>
           
            <input type="text" name="custid"/>
         
<p><label for ="pass">&nbsp;Password: </label></p>
           
            <input type="password" name="password"/>
             
              <br>
              <br>
              <input type="submit" name="submit" value="  Login  " id="subbutton" />
         
  </div>
</form>
</html>

<?php
//  include('include/header.php');
//  include('include/footer.php');

//  echo '<div id="TextAreaHome"> ';
    echo '<div id="wrapper">';
   
    include( 'include/home.txt' );

    echo '</div>';
    echo '</div>';

?>

 


It will probably be easier to start by looking at the sample PHP web site from the help file. Then it is only a matter of learning PHP. Any PHP sample using mySQL will work the same, you only need to change the database functions to the respective ads_xxx function like you see on my code ads_execute(), ads_connect()... I wrote my only 2 web portals with PHP over 5 years ago. Haven't done many changes on them. The few times I have gone back to change something, it takes me a while to remember how to write PHP.

I hope that helps,


Reinaldo.

Re: ADS Summit in Boise is now official

PostPosted: Tue Aug 07, 2012 12:24 am
by fraxzi
Dear Reinaldo,

Thank you so much for a well detailed explanation. It's a very good start.

I'm so interested with radPHP (embarcadero) because it's so simplified and the fact that we can combine [x]Harbour+FWH CGI app.

ADS released v11 with Php client. I should look dig into it as well as the 'web client' but as much as I can consume.. I would like to start with Php + ADS + FWH app fired in CGI/FastCGI.

Please continue your most informative information we all learned from.

Kind regards,

Re: ADS Summit in Boise is now official

PostPosted: Thu Aug 09, 2012 10:22 pm
by cdmmaui
Dear Reinaldo,

Thank you for posting details about PHP and ADS. By any chance, do you have sample code related to autocomplete that includes look up to ADS/DBF with index file?

Sincerely,

Re: ADS Summit in Boise is now official

PostPosted: Thu Aug 09, 2012 11:15 pm
by Gale FORd
Darrell,
I just noticed that your online location says The Woodlands TX. I have been living there for about 20 years.
I also work in the transporation industry. Small world.

Contact

PostPosted: Fri Aug 10, 2012 12:01 am
by cdmmaui
Hi Gale,

Most definitely! Please send me your contact details at Darrell.Ortiz@cdmsoft.com

Re: ADS Summit in Boise is now official

PostPosted: Fri Aug 10, 2012 9:59 pm
by reinaldocrespo
Darrell;

I'm using a class named Autocomplete that inherits from TGet. The class was originally started by James Bott and it was pretty much his baby. It's been years and I can't remember how much I've change the class, but I do know it works with arrays as well as .dbf/cdx, .dbf/ntx, and .adt/adi. I feel James is owed the credit here so I'm afraid I can't post it.

BTW - you should seriously consider attending the summit. I'm sure you won't regret it. Same to Gale Ford, Roger Selik, Tim Stone, Rick Lipkin, James (who else is in NA?). We could eventually make this into a yearly xharbour summit.

Best regards,


Reinaldo.

Re: ADS Summit in Boise is now official

PostPosted: Wed Aug 15, 2012 2:10 am
by cdmmaui
Hello Reinaldo,

I agree about attending summit, however I already have commited to another trip. I would be very interested in attending xHarbour summit anywhere in the world, especially if Antonio and other wonderful forum supporters attend. I am constantly learning new tricks and tips from everyone on this forum.

Sincerely,

Re: ADS Summit in Boise is now official

PostPosted: Mon Aug 20, 2012 4:14 pm
by TimStone
Reinaldo,

I tried to get info, dates, etc since last spring. They simply released the info too late. I realize its a "month" away but when I consider my total "out of the office" time this year, the conference will just not be doable this time.

I will again consider it for next year.

Tim