Creating ADS AEP using VFP - visual-foxpro

My understanding is that AEP can be developed in any language but I couldn't find any sample for VFP, only VB, C++, etc
As an initial project I wanted to try something simple like send a Product Code and get back the current Stock value from a free ADS table (in fact a VFP table accessed via ADS) + errors handling.
I have good VFP experience (exe applications using ODBC) but nothing in this area (web access).
I made some researches on internet but even for the Startup/Shutdown (part of the template) I found different number of parameters to be passed, so I am confused.
A sample of Startup/Shutdown + a simple function which access a table and get some data (i.e SELECT Field1 FROM MyTable WHERE Field2=<My_Input_Value>), written in VFP for ADS V10.10 would be highly appreciated.
Thanks.

Related

Is it possible to validate all SQL expressions in application?

When importing project, there are a lot of bad table names referenced from application, which causes errors. I need to manually rename or create tables accordingly. It would be fine if i find all bad SQL expressions in application with simple few clicks.
How to validate all SQL expressions from pages content body, pages items, etc. to see at what places there are errors?
EDIT:
Here: Table SAMPLE$PROJECT_TASKS does not exist and was not find by Advisor.
Use Advisor. It is located in application's Utilities.
For example:
I created a table named brisime
then I created an interactive report based on that table (it worked OK)
went to SQL Workshop and dropped the table
interactive report doesn't work any more (of course it doesn't)
So, what does the Advisor say? I included only "Is valid SQL or PL/SQL code":
The result is then:
As expected; table doesn't exist, and Advisor found it.
[EDIT]
As of your comment that chart's series query isn't checked by the Advisor: I don't know why - maybe you should ask people who developed Apex (visit OTN Forums).
However, just for testing purposes, I created a page that has two regions:
chart
classic report
Both used the same table as a source. I then dropped the table and ran the page in Debug mode. It shows two separate debug identifiers
chart uses ajax plugin path
classic report uses show path
The Advisor says that report failed on "Is Valid SQL or PL/SQL Code" check, but nothing for the chart. Maybe it is about Ajax, i.e. it isn't checked. On the other hand, maybe it is not the reason, I really can't tell.

Save application settings in vb6

I wanted someone to help me decide which is the best option to save the settings of an application on vb6. I understand that this can be done with an INI file and/or modifying the registry. I need you to move the directory if one computer to another, the application stops working.
What you think is the best option?
If someone has an interesting link that can help me thank you very much!
Thank you for readme and sorry for my English!
We don't use the registry but follow these steps which has worked well for us even when crossing platforms and new versions of a language:
Save all parameters in a table in a database associated with the application. We normally call this "Code" with the fields "Type", "Code", "Description", and "Control". For example, the name of the company would be stored in the table as "PARM","CONAME","My Company Name","". If you have a dynamic list of transaction types, store them as "TRNS","01","My 1st Type","" and "TRNS", "02", "My 2nd Type", "" and so forth. The Control field is used for anything you want that's hidden from the user but possibly controls how the program responds based upon the users selection of that type...as an example. To get the list of types, just use a SELECT statement like "SELECT * FROM [Code] WHERE [Type]='TRNS' ORDER BY [Code];".
Save the connection to the database in an encrypted ini file. We wrote the encryption and decryption functions ourselves. There are various out of the box ways to do this on various blogs.
Installing the application on another system demands access to the database and copying the ini file.

4GL and Magento SOAP API. Need a simple example

My company runs a 4GL application internally. It's very old and no one really knows how to improve/develop for it since the developers are long gone.
I need to make a simple SOAP call to my Magento web store. There are tons of examples online in a multitude of languages, but I can't find a single 4GL (OpenEdege ABL) example.
I'm trying to set SKU's to Out of stock status.
Does anyone have a simple example that I can look at, or at least a starting point since there seems to be so little information on 4GL on the web.
Example of the call I need in PHP:
<?php
$proxy = new SoapClient('http://www.domain.com/api/soap/?wsdl');
$sessionId = $proxy->login('admin', 'password');
$proxy->call($sessionId, 'product_stock.update', array('sku123', array('qty'=>50, 'is_in_stock'=>1)));
For version 10.2B there's built in support for consuming web services in Progress ABL.
This is a basic tutorial of how to create a client for a SOAP-based web service in ABL. It's not best practices or in any way complete. Just a quick guide to get started.
1. Analyse the WSDL
There's a built in tool available via command line that lets you analyse a WSDL and create documentation about available services, datatypes, syntax etc. Invoke it on your wsdl like this:
proenv> bprowsdldoc yourwsdl-file c:\temp\docs
The wsdl can be local or remote. If its remote you specify the URL, if it's local you can specify just the local complete path. Documentation in html format will end up in c:\temp\docs. Open up index.html in that folder.
2. Create a basic client
In the index.html document there's a number of headings. Click the link under "Port types". In the Port Type document you will find some useful data.
Copy-and-paste the example in "Connection Details" into your Progress Editor. It should look something like this (names of services and procedures will be different - they are defined in the wsdl):
DEFINE VARIABLE hWebService AS HANDLE NO-UNDO.
DEFINE VARIABLE hYYY AS HANDLE NO-UNDO.
CREATE SERVER hWebService.
hWebService:CONNECT("-WSDL 'file_or_url_to_wsdl.wsdl'").
RUN XXX SET hYYY ON hWebService.
If you run this code your client is connected to the web service but it's still not doing anything.
Further down the same document there's a heading called "Operation (internal procedure) details". This is where the actual web service is invoked. It will look something like the code below. It actually show two ways of making the same call, one functional call and one procedural so choose whatever you prefer and insert it into your editor (I'm usually using the procedural for no real reason other than old habits):
DEFINE VARIABLE strXMLRequest AS CHARACTER NO-UNDO.
DEFINE VARIABLE ProcessXMLResult AS CHARACTER NO-UNDO.
FUNCTION ProcessXML RETURNS CHARACTER
(INPUT strXMLRequest AS CHARACTER)
IN hYYY.
/* Function invocation of ProcessXML operation. */
ProcessXMLResult = ProcessXML(strXMLRequest).
/* Procedure invocation of ProcessXML operation. */
RUN ProcessXML IN hYYY (INPUT strXMLRequest, OUTPUT ProcessXMLResult).
Now all you need to end your program is disconnecting and cleaning up. So insert:
hWebService:DISCONNECT().
DELETE OBJECT hWebService.
If you've followed all steps you should have a skeleton for invoking a web service. The only problem is that you need to handle the in- and out-data.
3. Handle the answer and the request
Depending on how the web service is built this can be easy (if you only input and output simple data like strings and numbers) or quite complicated (if you input and output entire xml-documents). The documentation you created in step one lists all datatypes (in the index.html document) but it doesn't offer any support in how you create any needed xml documents. There's specific Progress documentation available on how to work with xml...
The better approach is to take a look at the official documentation. There you will find everything above and more - how to handle errors etc.
Here is an overview of all 10.2B documentation and here is the PDF named Web Services.
Here is a link to a complete (but actually not so good) example in the Progress KnowledgeBase where a client and corresponding request/response xml is created and handled.
Look at these chapters:
6 - Creating an ABL Client from WSDL
7 - Connecting to Web Services from ABL
8 - Invoking Web Service Operations from ABL
That will basically take you through the entire process from start to beginning.

strutrs2 and ajax(Displaying dynamic value on jsp)

Im pretty new to struts2 and Ajax ,Actually i have a drop down menu in JSP lets say first.jsp, When user select a choice from dropdown menu,I am calling a function of Action class lets say Method1.In this method i am fetching some value from DB(lets say:a,b,c) and one value from java memory lets say d.Then I am forwarding to second.jsp and display all the parameters(a,b,c and d) in tabular format.
Now problem is that the parameter d is dynamic ,this is updating by some other application and if its change then I have to show it on JSP wihout any action.
One solution is I use in second.jsp , so after interval of 10 second again Mehod1 will call and it will fetch value(a,b,c) from db and updated value of d from java memory. and disply it to second.jsp.But in this case i am unnecessary retrieving value from db while my purpose is just to get value d from memory.This is working but this is causing my application to slower.
Can any body suggetst some other solution? or can i do it using ajax and how?
Any other advice? any help is appreciated.try to be more clear, i'm in lack of ideas in this problem, even it sounds like a classic :I have spend hours trying to play around with this but have got nowhere
Okay... What you're asking is a little fuzzy so let me rephrase:
You have a user (USER1) who opens a web page and sees some data.
You have a second user (USER2) (who may be an application) who is able set a value from time to time.
When USER2 updates that value you want USER1 to see it change in their open browser window?
If this is the case you need to understand basic ajax. For that get these demo applications working:
This example uses dojo and perhaps the S2 ajax tag lib I don't remember I prefer not to use ajax tags (as they are deprecated and prefer jquery for ajax):
http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html
This example here shows a very similar application but using jquery, no tag library, upgraded to Spring 3, it still needs polish:
http://www.kenmcwilliams.com/Downloads/
Now that you know how to get data via ajax, look at the request with firebug. You'll see that the request is just like a typical function call, the browser keeps waiting for the data to come back.
What you do is simply not return from the action until new data is provided. This is called long polling see: http://en.wikipedia.org/wiki/Comet_%28programming%29#Ajax_with_long_polling
If you have not written a simple chat program, using just terminal windows I recommend you do so. Two windows per client (client-send, client-receive windows) and you'll need a server program. I remember hacking one together in a few hours using _Thinking In Java 2nd Edition (Later books took out the networking section if I remember correctly). Anyways between understanding client server interaction and long polling will let you get things working. It would be fun to extend the simple terminal based chat application to a S2 ajax chat application. Would make an awesome tutorial! PS: This is just an application of the producer/consumer problem (If you understand that then I guess you don't need to do the fun exercise).
The interfaces would look very pretty if the server was managed by spring. I know there must be nice servers already written but I am not familiar with any, but would love to hear of one.

How to write a datatable to excel work book at client side

Currently i am doing one project in that we need to generate report from database.
Since my server memory is too low im getting 'Out of Memory' Exception when im writing it at serverside and also when i write directly to a excel file using http header as excel file im not able to create multiple sheets since my database table is huge more than 65536 rows.
I saw many solution using a third party tool but i cant use those into mine..If anyone already worked on this please give me some direction.
Also i tried using javascript but for that i need to use datagrid at server side??
but in my project i m not allowed to use like this.
You can open an excel file, as an xml document using the Open XML format SDK: http://msdn.microsoft.com/en-us/library/bb448854.aspx

Resources