Paradigm | object-oriented, procedural, 4-GL |
---|---|
Developer | VFP Community |
First appeared | 2001 |
Stable release | 6.03 / January 29, 2013 |
Typing discipline | Dynamic, weak |
Implementation language | Visual FoxPro 9 SP2 |
OS | Windows |
License | MIT |
Filename extensions | Common extensions .avfp Other extensions extensionless |
Website | activevfp |
ActiveVFP (also known as AVFP) is a server-side scripting framework designed for Web development to produce dynamic Web pages. Similar to PHP, but using the native Visual Foxpro (VFP) language and database (or other databases like Microsoft SQL and MySQL), ActiveVFP can also be used in Model-View-Controller (MVC) web applications as well as RESTful API. ActiveVFP is completely free and open source and does not require the purchase of Microsoft Visual FoxPro or any additional software.
ActiveVFP was originally created in 2001. The main implementation of ActiveVFP is now produced by the Foxpro Community at activevfp
ActiveVFP is unique among server-side web languages and frameworks because it has a database and database functionality built into the language.
ActiveVFP uses the native Visual Foxpro language as it exists in the latest version produced by Microsoft, Visual FoxPro 9 SP2. The multi-threaded VFP runtime, vfp9t.dll, is used instead of the regular desktop version of the VFP runtime. [1]
Using ActiveVFP, the VFP compiler only executes VFP code within its delimiters. Anything outside its delimiters is not processed by VFP. The most common delimiters are ASP-style short forms <% or <%= and %>. <% %> executes a FoxPro code block and <%= %> prints the variable out immediately. The purpose of all these delimiters is to separate VFP code from non-VFP code, including HTML.
The main objects available to ActiveVFP for web programming are: oRequest, oResponse, and oSession (and all of the objects that have been available in Classic Active Server Pages (ASP)). These objects are used entirely within Visual FoxPro to accomplish web programming with FoxPro.
The FoxPro language contains commands quite similar to other programming languages such as Basic. Loops include do, if, while, for, else commands in a usage easily understood by anyone familiar with other programming languages. Commands take the form of "command" and "endcommand". The language also has extensive database manipulation and indexing commands. [2]
Like PHP, ActiveVFP takes advantage of automatic memory Garbage Collection (GC) and Dynamic/Weak Typing, [3] boosting programmer productivity.
In addition to “scripting” mode, ActiveVFP offers Model-View-Controller (MVC) design as well. The Controller consists of FoxPro class code located in a Foxpro .prg file. Output can consist of .avfp views, JSON, and others, similar to other modern MVC implementations. The Model can be DBF files or other back end databases.
<!DOCTYPE html><html><head><metacharset="utf-8"><title>VFPcodeinHTML</title> ... <%*SettingslnTotPerPage=10lnpagenumbers=5lnStart=VAL(oRequest.querystring("page"))lcButton=oRequest.querystring("nav")*sqlSELE*FROMCustomerINTOCURSORtCursor*createpagenumbersSTART=0lnPageMax=0lnPageBegin=0lnRowCount=RECCOUNT()SETPROCtooProp.AppStartPath+'prg\pages' ADDITIVE lcPages=pages(lnTotPerPage,lnpagenumbers,lnStart,lcButton,lnRowCount)%> ... <%FORlnX=lnPageBeginTOlnPageMaxIFlnX<=lnRowCountGOTOlnX%><tr><tdwidth="40%"><fontface="helvetica, arial"size="2"><ahhref="<%=JustPath(oProp.ScriptPath)+[/detail.avfp?cust_id=]+;ALLTRIM(cust_id)%>"><%=tCursor.company%></a></font></td><tdwidth="36%"><fontface="helvetica, arial"size="2"><%=tCursor.Contact%></font></td><tdwidth="24%"><fontface="helvetica, arial"size="2"color="#000000"><%=tCursor.Title%></font></td></tr><%ENDIFENDFOR%> ... <%=lcPages%>
* customers.prg -Customers Controller* * bypasses Main.prg and .AVFP script code* DEFINE CLASS customersController AS restController *PROCEDURE openData SELECT 0 USE (THIS.homeFolder + "customers.dbf") ALIAS customers ENDPROCPROCEDURE infoAction && GET www.hostname.com/app/customers/infoRETURN"homeFolder: <b>" + THIS.homeFolder + "</b>"ENDPROCPROCEDURE getAction && GET www.hostname.com/app/customers/<id>LOCAL cCustId cCustId = THIS.Params[1] THIS.openData() SELECTCUSTOMERS LOCATE FOR custId = cCustId IFFOUND() LOCAL cJSON **USE mydbf &&test error*quick and dirty JSONcJSON = [{"custId":"] + RTRIM(custId) + [","custName":"] + RTRIM(custName) + [",] + ; ["custStat":"] + RTRIM(custStat) + ["}] RETURN cJSON ENDIF ENDPROCPROCEDURE listAction && GET www.hostname.com/app/customers/LOCAL cHTML cHTML = ""*oEmp=newOBJECT('schedbizobj','c:\avfp5.61Demo\prg\utiltest2.prg')SET PROC to substr(oProp.AppStartPath,1,AT([\],oProp.AppStartPath,2))+'prg\AVFPutilities' ADDITIVE && Make sure you use ADDITIVE or bad things happen!THIS.openData() SELECTCUSTOMERS cHTML= oHTML.mergescript(FILETOSTR(substr(oProp.AppStartPath,1,AT([\],oProp.AppStartPath,2))+'viewtest.avfp')) RETURN cHTML ENDPROC PROCEDURE helloworld && custom method (&& GET www.hostname.com/app/customers/helloworld/)LOCAL cHTML cHTML = ""*USE mydbf*SET PROC to substr(oProp.AppStartPath,1,AT([\],oProp.AppStartPath,2))+'prg\AVFPutilities' ADDITIVE && Make sure you use ADDITIVE or bad things happen!cHTML= oHTML.mergescript(FILETOSTR(substr(oProp.AppStartPath,1,AT([\],oProp.AppStartPath,2))+'hello.avfp')) RETURN cHTML ENDPROC PROCEDURE getemployees && custom method (&& GET www.hostname.com/app/customers/getemployee/<id>oJSON=NEWOBJECT('json','json.prg') SET PATH TO oProp.AppStartPath+'data\AVFPdemo41\'select e.emp_id as id, e.first_Name as firstName, e.last_Name as lastName, e.title as title, [images/Emps/]+e.picture as picture,count(r.emp_id) as reportCount ;from employee e left join employee r on VAL(r.reports_to) = VAL(e.emp_id) ;INTOCursor SearchResults;group by e.last_Name,e.emp_id, e.first_Name,e.title, e.picture;order by e.last_Name,e.first_Name oJSON.keyforcursors="items"* send JSON data and properties backoResponse.ContentType = "application/json;charset=utf-8" oResponse.Write(oJSON.stringify('SearchResults')) oResponse.Flush lcHTMLout=[] ENDPROC************************************************************************ENDDEFINE
Active Server Pages (ASP) is Microsoft's first server-side scripting language and engine for dynamic web pages.
Server-side scripting is a technique used in web development which involves employing scripts on a web server which produces a response customized for each user's (client's) request to the website. Scripts can be written in any of a number of server-side scripting languages that are available. Server-side scripting is distinguished from client-side scripting where embedded scripts, such as JavaScript, are run client-side in a web browser, but both techniques are often used together. The alternative to either or both types of scripting is for the web server itself to deliver a static web page.
In computing, a hyperlink, or simply a link, is a digital reference to data that the user can follow or be guided to by clicking or tapping. A hyperlink points to a whole document or to a specific element within a document. Hypertext is text with hyperlinks. The text that is linked from is known as anchor text. A software system that is used for viewing and creating hypertext is a hypertext system, and to create a hyperlink is to hyperlink. A user following hyperlinks is said to navigate or browse the hypertext.
Mojibake is the garbled or gibberish text that is the result of text being decoded using an unintended character encoding. The result is a systematic replacement of symbols with completely unrelated ones, often from a different writing system.
Vector Markup Language (VML) is an obsolete XML-based file format for two-dimensional vector graphics. It was specified in Part 4 of the Office Open XML standards ISO/IEC 29500 and ECMA-376. According to the specification, VML is a deprecated format included in Office Open XML for legacy reasons only.
Courier is a monospaced slab serif typeface commissioned by IBM and designed by Howard "Bud" Kettler (1919–1999) in the mid-1950s. The Courier name and typeface concept are in the public domain. Courier has been adapted for use as a computer font, and versions of it are installed on most desktop computers.
A lightweight markup language (LML), also termed a simple or humane markup language, is a markup language with simple, unobtrusive syntax. It is designed to be easy to write using any generic text editor and easy to read in its raw form. Lightweight markup languages are used in applications where it may be necessary to read the raw document as well as the final rendered output.
In software engineering, dependency injection is a programming technique in which an object or function receives other objects or functions that it requires, as opposed to creating them internally. Dependency injection aims to separate the concerns of constructing objects and using them, leading to loosely coupled programs. The pattern ensures that an object or function that wants to use a given service should not have to know how to construct those services. Instead, the receiving "client" is provided with its dependencies by external code, which it is not aware of. Dependency injection makes implicit dependencies explicit and helps solve the following problems:
In computing, an attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such. For clarity, attributes should more correctly be considered metadata. An attribute is frequently and generally a property of a property. However, in actual usage, the term attribute can and is often treated as equivalent to a property depending on the technology being discussed. An attribute of an object usually consists of a name and a value. For an element these can be a type and class name, while for a file these can be a name and an extension, respectively.
dwm is a minimalist dynamic window manager for the X Window System developed by Suckless that has influenced the development of several other X window managers, including xmonad and awesome. It is externally similar to wmii, but internally much simpler. dwm is written purely in C for performance and lacks any configuration interface besides editing the source code. One of the project's guidelines is that the source code is intended never to exceed 2000 SLOC, and options meant to be user-configurable are all contained in a single header file.
The Web Application Description Language (WADL) is a machine-readable XML description of HTTP-based web services. WADL models the resources provided by a service and the relationships between them. WADL is intended to simplify the reuse of web services that are based on the existing HTTP architecture of the Web. It is platform and language independent and aims to promote reuse of applications beyond the basic use in a web browser. WADL was submitted to the World Wide Web Consortium by Sun Microsystems on 31 August 2009, but the consortium has no current plans to standardize it. WADL is the REST equivalent of SOAP's Web Services Description Languages (WSDL), which can also be used to describe REST web services.
Web2py is an open-source web application framework written in the Python programming language. Web2py allows web developers to program dynamic web content using Python. Web2py is designed to help reduce tedious web development tasks, such as developing web forms from scratch, although a web developer may build a form from scratch if required.
A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current web page with new data from the web server, instead of the default method of loading entire new pages. The goal is faster transitions that make the website feel more like a native app.
XPath is an expression language designed to support the query or transformation of XML documents. It was defined by the World Wide Web Consortium (W3C) in 1999, and can be used to compute values from the content of an XML document. Support for XPath exists in applications that support XML, such as web browsers, and many programming languages.
Visual FoxPro is a programming language that was developed by Microsoft. It is a data-centric and procedural programming language with object-oriented programming (OOP) features.
AngularJS is a discontinued free and open-source JavaScript-based web framework for developing single-page applications. It was maintained mainly by Google and a community of individuals and corporations. It aimed to simplify both the development and the testing of such applications by providing a framework for client-side model–view–controller (MVC) and model–view–viewmodel (MVVM) architectures, along with components commonly used in web applications and progressive web applications.
Yesod is a web framework based on the programming language Haskell for productive development of type-safe, representational state transfer (REST) model based, high performance web applications, developed by Michael Snoyman, et al. It is free and open-source software released under an MIT License.
A uniform resource locator (URL), colloquially known as an address on the Web, is a reference to a resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifier (URI), although many people use the two terms interchangeably. URLs occur most commonly to reference web pages (HTTP/HTTPS) but are also used for file transfer (FTP), email (mailto), database access (JDBC), and many other applications.
The following outline is provided as an overview of and topical guide to web design and web development, two very related fields: