Dynamic Web Pages With The Embedded Web Server. The Rabbit-Geek s AJAX Workbook
|
|
|
- Stanley Joseph
- 9 years ago
- Views:
Transcription
1 Dynamic Web Pages With The Embedded Web Server The Rabbit-Geek s AJAX Workbook (RabbitWeb, XML, & JavaScript) Version 1.1 By Puck Curtis 07/29/ P a g e
2 Table of Contents How to Use this Guide... 5 Prerequisites If You Can Ping, You Can Use This Thing!... 5 Getting Help with TCP/IP and Wi-Fi Setup... 5 The Study Guide or the Short Cut?... 5 Dynamic C Code... 6 HTML Code... 6 XML File... 6 Provide us with Your Feedback... 6 Chapter 1 - The Server-Client Relationship... 7 Example An Analogy for a Normal HTML page... 8 TIP: Auto-refreshing the Page is an Option... 8 Chapter 2 - Embedded Devices have a limited CPU budget... 9 Question How Much Can this Little Guy Handle?... 9 Answer Quite a Bit!... 9 Chapter 3 - Configure your Rabbit s TCP/IP Settings Chapter 4 - Serving a Basic Web Page Prep Work Libraries and Files The MIME Table Everyone Loves a Mime The Resource Table Mr. File, Meet My Associate, Mr. Web Server The Main Code TIP Don t Choke Your Embedded Web Server TIP - Using a Costate as a Throttle More Web Server Examples More Costate Examples Chapter 5 Introducing RabbitWeb Chapter 6 - RabbitWeb and the Amazing <?z> Tags The Echo The Conditional The Loop Chapter 7 - Using RabbitWeb in a Basic Web Page Dynamic C Code P a g e
3 TIP You Can Limit the Possible Values The HTML Code Still Not Dynamic! Chapter 8 - Our First Dynamic Web Page Updating the Dynamic C code Chapter 9 - Using a Conditional The Mighty IF Dynamic C Code HTML Code - Two Web Pages in One File Tip Want More? Chapter 10 - Interactive Web Pages Made Easy Adding a Submit Button Updating the Dynamic C code Want More? Chapter 11 - Detecting User Input from the Web Page Adding a Callback Function to the Dynamic C Code Other Possibilities? Chapter 12 - Creating Loops in RabbitWeb to Display Arrays The HTML Code TIP - A Sneaky RabbitWeb Trick for Arrays Want to Try More? Chapter 13 - Adding JavaScript with RabbitWeb to your HTML Pages Initializing JavaScript Variables with RabbitWeb How to Create the Most Annoying Pop-up Box in History The Annoying Pop-up Box Saving the Annoying Pop-Up Box Chapter 14 - Basic XML with the Rabbit Embedded Web Server Dynamic C Code Putting together a JavaScript to Read your XML data Scary Looking JavaScript Code Continued - The HTML body that works with the JavaScript Breaking down the Scary Looking Javascript HTML DOM Dynamic C Code P a g e
4 Let s See the Dog Tags Work! Where s the Magic? - AJAX Chapter 15 - RabbitWeb and XML The Holy Grail of Embedded Web Developers The Teeny-Tiny and yet Magical my_data.xml file Dynamic C code The Magic HTML file with Special Kung Fu JavaScript The Magic Page in Action! Is this Really Magic? Chapter 16 - Loopy JavaScript The Joy of the settimeout() Function Easy settimeout() Function Example Using the settimeout() Function to create an Infinite Loop Exiting the Loop Looking at the Page Chapter 17 - Using a JavaScript Loop to Pass Dynamic XML Data in Real-Time Dynamic C Code The Amazing JavaScript The HTML Body Watching it All Work Want more? Chapter 18 - Dynamic Web Interface to Hardware in Real-Time A Simple XML file for Our Little Switch Dynamic C Code The JavaScript The HTML Body How Does it Look? Chapter 19 - Monitoring Every Parallel Port Pin on the MiniCore P a g e
5 How to Use this Guide This Guide is not a user s manual in the traditional sense. Instead, it is an informal workbook for a variety of different embedded web server projects. Prerequisites If You Can Ping, You Can Use This Thing! This guide is not intended to teach a user basic Internet and TCP/IP networking skills. In order to use the information in this guide, you should be able to configure your Rabbit device for your network so that you can ping it with a PC connected to the same network. The first test program you should run before starting this guide is the PINGME.C sample program located in the C:\DCRABBIT_XX.XX\Samples\TCPIP\ICMP directory. Getting Help with TCP/IP and Wi-Fi Setup You have plenty of options if you need to get help with basic TCP/IP and Wi-Fi. 1. Rabbit has a guide named An Introduction to TCP/IP available here: 2. Rabbit has a guide named An Introduction to Wi-Fi available here: 3. In addition, your Rabbit device s User Manual should have a chapter dedicated to TCP/IP. 4. All of our most current documentation is on our web site: The Study Guide or the Short Cut? The chapters build on each other and one good approach would be to work from the beginning of the workbook to the end as a learning experience. Another equally valid approach would be to scan the chapter headings to find something similar to your project and use the example there as a starting point. 5 P a g e
6 Dynamic C Code A text box containing code written in Dynamic C will have a gray background. void main() printf( I am Dynamic C code ); HTML Code A text box containing HTML code will have a light green background. <html> <head></head> <body>i am HTML Code</body> </html> XML File A text box containing XML will have a blue background. <!-- My XML file --> <Stuff> <My_File>I am an XML File</ My_File > </Stuff> Provide us with Your Feedback If there is something that: Does not work Could be explained better You think is missing You like Please, let us know by ing [email protected] 6 P a g e
7 Chapter 1 - The Server-Client Relationship Web pages are not dynamic in nature. With some clever coding we can produce dynamic behavior, but first we should understand the inherent limitations of the relationship between the HTTP server and the client running a browser like Internet Explorer or Firefox. The important thing to notice is that there is no continuous connection between the client and the web server. (After the HTML page has been served, we could shoot the server with a shotgun, and the client would not notice because it already has the data.) 7 P a g e
8 Example An Analogy for a Normal HTML page If we pretend that I am the server and you are the client we can recreate this relationship. 0. You are in your car and I am home watching my TV. (No connection between client and server.) 1. If you want directions to the pizza parlor, you call me. (Client requests data.) 2. I tell you how to get there. (Server supplies data.) 3. We hang up. (No connection between client and server.) 4. You get there but now you can t find the parking so you call me back. (Client makes new request for data.) 5. I tell you where to park. (Server supplies data.) 6. We hang up. (No connection between client and server.) The key concept here is that there will be no fresh data without a new request to the server. This is how a web server typically works. An easy way to demonstrate this is to load a web page and then unplug your PC s Ethernet cable. The web page will not notice that it does not have access to the web server anymore because it has already been loaded. TIP: Auto-refreshing the Page is an Option With a bit of HTML code in the head element, you can have the page automatically refresh itself in a given time interval. <meta http-equiv="refresh" content="300" > The value in quotes after content is the number of seconds until the page automatically refreshes itself. If you want a different time interval, we could change the value of content in our refreshing meta tag. This example would refresh the page every 5 minutes (300 seconds). In an auto-refreshing example, you would call my phone every 5 minutes for new instructions to the pizza parlor. 8 P a g e
9 Chapter 2 - Embedded Devices have a limited CPU budget The PC viewing the web page typically has more resources than the Rabbit Web Server. You can use that to your advantage by pushing the heavy lifting out to the browser. By calling on the PC s memory and CPU, we can have very complicated script, code, or animation and still be very responsive as a web server without overly taxing our embedded device. You can create very complicated code in the browser using: HTML Java Applets JavaScript Flash Ajax Yahoo User Interface Canvas Plenty more to boot Server-side scripts are not an option. While these might work just fine on a Linux web server, the Rabbit won t be able to run them. Even if it could, the processing power required to handle them might make it a bad choice. A good rule of thumb to remember is that anything that runs on the server side won t work because it would require a special command interpreter from the Rabbit. You cannot use the following server-side scripting languages or programs: Java Servlets PHP SQL Apache MediaWiki WordPress Etc Question How Much Can this Little Guy Handle? Can the new Rabbit Wi-Fi Minicore serve interactive web pages with the Rabbit 5000 processor? Answer Quite a Bit! Rabbit has been serving scripts and animations since the Rabbit 2000 and you can see an example in the C:\DCRABBIT_9.62\Samples\OP7200\TCPIP\FLASH_XML.C program. That flash sample is running on the Rabbit 2000 at 22.1 MHz with 256K flash and 128K SRAM. The Wi-Fi Minicore runs at 75 MHz with 1 MB of flash and 1 MB of SRAM and it will knock the sockets off the Rabbit P a g e
10 Chapter 3 - Configure your Rabbit s TCP/IP Settings In Dynamic C you can configure all the TCP/IP settings in the main menu under Options Project Options Defines Here is one example used for an RCM5600W Wi-Fi MiniCore: The settings shown above were used at a tradeshow with an RCM5600W. Your own settings will be different depending on which Rabbit you choose (Wi-Fi or Ethernet) and the settings of your local network. Your network administrator should be able to help you configure your device for your network to avoid hidden pitfalls like proxies, blocked ports, and firewalls. Remember that you should test your settings with the PINGME.C sample program in the C:\DCRABBIT_XX.XX\Samples\TCPIP\ICMP\ directory. 10 P a g e
11 Chapter 4 - Serving a Basic Web Page Serving a web page with the Rabbit is very easy. Here is an example of a simple web page: <html> <head></head> <body> Hello World! </body> </html> The page generates the following in the browser: Hello World! If you have configured your TCP/IP settings you can serve the basic web page with a Rabbit device and the following Dynamic C code: #use "dcrtcp.lib" #use "http.lib" #ximport pages/hello_world.html" index_html SSPEC_MIMETABLE_START SSPEC_MIME(".html", "text/html") SSPEC_MIMETABLE_END SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/index.html", index_html) SSPEC_RESOURCETABLE_END void main() sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); 11 P a g e
12 Prep Work Libraries and Files The two #use statements link the software libraries necessary for TCP/IP and HTTP. #use "dcrtcp.lib" #use "http.lib" We use the #ximport keyword to bring the files we need onto the Rabbit for the web server. During compile time, these files will be copied from the PC running the compiler into the XMEM on the Rabbit. #ximport pages/hello_world.html" index_html The #ximport keyword expects a filename with a path on the PC running the compiler ( pages/hello_world.html") and a local filename which will provide the physical address in XMEM to the program (index_html). Notice that the local filename (or symbol) and the filename on the PC don t have to match. The MIME Table Everyone Loves a Mime Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of HTTP to support: Text in character sets other than ASCII Non-text attachments Message bodies with multiple parts Header information in non-ascii character sets The MIME table is where we describe the types of resources our web page will use. This page uses an HTML file, but we could also add other resource types like GIFs, JPEGs, or scripting files. You only need to define the resource type one time and then you may use as many of those items as you like. For example, with the MIME table below, I could serve as many different HTML pages as I like. If I added support for GIF images, I could have as many of those as I like as well. SSPEC_MIMETABLE_START SSPEC_MIME(".html", "text/html") SSPEC_MIMETABLE_END In the example above we pass in two arguments. The first is the file extension like.html,.htm, shmtl, or zhtml. Then I use an Internet standard MIME type for my html file to show that it is a text file and should be treated as html. You can find MIME types for all types of Internet files in the MIME specifications. Here are just a few of the file types you might work with. File Extension MIME Type File Extension MIME Type.html, htm text/html.xml text/xml.css text/css.js application/x-javascript.gif image/gif.pdf application/pdf.jpeg image/jpeg.doc application/msword 12 P a g e
13 The Resource Table Mr. File, Meet My Associate, Mr. Web Server. The Resource table is where we associate names of web server resources with references to items in actual memory. Here we show a file from extended memory identified as XMEMFILE. You could pull the file from root memory or a FAT file as well. The Resource Table expects a filename ( /index.html ) and an address in XMEM (index_html). SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/index.html", index_html) SSPEC_RESOURCETABLE_END Unlike the MIME table, I need to place every resource I plan on using in my web pages into this table. That means if I use 500 different.gif files, I need 500 different entries here. The Main Code Looking at the Dynamic C main code we only need four lines to get our server going. Most of these are simple initializations to get things up and running. void main() sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); The sock_init_or_exit() function initializes the TCP/IP device and attempts to bring it up. This function will print out the IP address of your server at startup if you pass it a non-zero parameter. (In our case, we are passing a 1 so that it displays the network settings when it connects successfully. If the web server doesn t come up, it will try to exit the program. While this function is good for debugging, it is not a great choice for a final application that may want to handle a failure in some way besides exiting the program. sock_init_or_exit(1); The http_init() function initializes the web server. Reserving port 80 for our embedded web server will yield a performance increase. (The tcp_reserveport() function is completely optional.) http_init(); tcp_reserveport(80); 13 P a g e
14 The HTTP handler drives the web server and you should repeatedly call the http_handler() function in a loop. It will also drive the TCP/IP stack which makes the more common tcp_tick() function unnecessary. The tcp_tick() function drives the TCP stack and just as with the tcp_tick() function, the faster you call the http_handler, the more responsive your TCP/IP performance will be. (For more information on tcp_tick() and programs that use it, read through the Dynamic C TCP/IP User s Guides Volume 1 and Volume 2.) http_handler(); TIP Don t Choke Your Embedded Web Server If you run into an issue with the web server being slow, you can add a timer to see how long it is between calls to the server. The code shown below is a little debugging trick you can use that will tell you how long your code is taking you between calls to the http_handler() function. void main() unsigned long time_0; //used to store a time from MS_TIMER time_0 = 0; //initialize to zero sock_init_or_exit(1); http_init(); tcp_reserveport(80); while(1) printf("time elapsed = %lu\r",(ms_timer - time_0)); http_handler(); time_0 = MS_TIMER; If your web server is not responsive, you may have a function that is blocking for too long and it could be strangling the web server. One way to solve this issue is to add occasional http_handler() function calls into your blocking functions to ensure that the web server is able to keep up. 14 P a g e
15 TIP - Using a Costate as a Throttle Another possibility is to use Dynamic C s costates to slow down other tasks in your primary while loop. The main code below shows one possibility. void main() int j; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); //Run as fast as possible! costate //Throttle back the C code so we can drive the web server waitfor (DelayMs(100)); printf("j = %d\r", j++); costate //Throttle back your function so we can drive the web server waitfor (DelayMs(400)); //Your special function here The code shown above uses costate cooperative multitasking with the DelayMS() function to restrict the printf() function so that it only executes once every 100 milliseconds and your special function executes every 400 milliseconds. That allows us to control the amount of time we dedicate to our web server. More Web Server Examples See the STATIC.C program in the C:\DCRABBIT_XX.XX\Samples\TCPIP\HTTP directory for another simple example. This directory is filled with different examples using the Rabbit embedded web server. More Costate Examples See the COSTATE1.C, COSTATE2.C, and COSTATE3.C example programs in the C:\DCRABBIT_XX.XX\Samples\TCPIP\HTTP directory for more cooperative multitasking examples. 15 P a g e
16 Chapter 5 Introducing RabbitWeb RabbitWeb takes HTML pages containing RabbitWeb tags and converts them into normal text, html, or data. That text could be HTML code or any other text file. We can use RabbitWeb to make a web browser into an interactive interface for our embedded controller. RabbitWeb makes displaying data from the Rabbit very easy. 1. When the client requests the HTML file, the Rabbit still has an HTML file with RabbitWeb tags included. When the server receives the request for the HTML file, it passes the file through the RabbitWeb pre-parser. 2. When the RabbitWeb pre-parser is finished, the RabbitWeb tags have been replaced with plain text. 3. The modified version of the file will be served to the client. 16 P a g e
17 Chapter 6 - RabbitWeb and the Amazing <?z> Tags The RabbitWeb scripting language has some basic functionality that allows easy integration with the embedded device. Rabbit uses a series of <?z> tags that will be interpreted and replaced before the page is served. Here are three basic functions of RabbitWeb: The Echo In order to display the value of a variable you will use the echo tag. <?z echo($my_data)?> This will replace the tag with the value of the My_Data variable on the Rabbit embedded device. The Conditional In order to test against the value in a variable you will use an if statement <?z if ($My_Data == 0)?> ALERT! ALERT! ALERT! (Could be any HTML code or text) <?z?> This can be used to add or remove text from a file depending on the value of a variable on the Rabbit embedded device. In the snippet above, when the My_Data variable is equal to zero the ALERT! message will be present in the file. When the My_Data variable is not equal to zero, the ALERT! message will be stripped out. The Loop This for loop can be used to repeat common text and is handy for displaying the value of an array. <?z for ($A = 0; $A < 5; $A++)?> <?z echo($my_data[$a])?><br> <?z?> This can be used to display all the elements of an array on the Rabbit device or just to repeat large blocks of text. In the snippet above, the first five elements of the My_Data array will be displayed in the file. (The <br> tag is normal HTML that indicates a new line on the web page.) 17 P a g e
18 Chapter 7 - Using RabbitWeb in a Basic Web Page Dynamic C code doesn t require many changes to use RabbitWeb. Dynamic C Code The code below demonstrates some minor changes for handling RabbitWeb. #define USE_RABBITWEB 1 #use "dcrtcp.lib" #use "http.lib" #ximport "samples/tcpip/http/pages/mypage.zhtml" mypage_zhtml SSPEC_MIMETABLE_START SSPEC_MIME_FUNC(".zhtml", "text/html", zhtml_handler) SSPEC_MIMETABLE_END SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/", mypage_zhtml), SSPEC_RESOURCE_XMEMFILE("/index.zhtml", mypage_zhtml) SSPEC_RESOURCETABLE_END int My_Data; //Create a global variable #web My_Data //Register it as a Web Variable void main() My_Data = 2009; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); Include the RabbitWeb pre-parser by putting this RabbitWeb macro into your code. #define USE_RABBITWEB 1 18 P a g e
19 The change to the MIME table runs the.zhmtl file through the ZHTML handler which are Rabbit functions to replace all the z-tags. Notice that we are using the SSPEC_MIME_FUNC option instead of SSPEC_MIME. SSPEC_MIMETABLE_START SSPEC_MIME_FUNC(".zhtml", "text/html", zhtml_handler) SSPEC_MIMETABLE_END You could also run any other text file through the.zhtml handler using the SSPEC_MIME_FUNC macro. This includes style sheets, JavaScripts, XML or other text files as well. We declare the My_Data variable globally and then register it using the #web statement. int My_Data; //Create a global variable #web My_Data //Register it as a Web Variable TIP You Can Limit the Possible Values You can also place limits on the variable to ensure that it falls within boundaries that you set. If you want your integer between 1 and 1000, you can enforce that limit in the #web statement by changing it to: //Restrict My_Data value to between #web My_Data (($My_Data > 1) && ($My_Data < 1000)) This could prevent your user from entering garbage data into your web interface. You might use this restriction to easily prevent a divide-by-zero error. The HTML Code Here is a simple web page with the RabbitWeb tag included that points back to the My_Data variable. (I have placed the RabbitWeb echo tag in bold green text.) <html> <head> </head> <body> My_Data = <?z echo($my_data)?> </body> </html> 19 P a g e
20 If the My_Data integer variable is equal to 2009 on the Rabbit, the RabbitWeb pre-parser will automatically edit the HTML file before it is served to a browser. (I have shown the new data in bold text.) <html> <head></head> <body> My_Data = 2009 </body> </html> The page generates the following in the browser: My_Data = 2009 Still Not Dynamic! Shouldn t RabbitWeb just make the page dynamic? RabbitWeb does not change the server and client relationship we demonstrated at the beginning of this workbook. RabbitWeb is just a tool for preparsing data in the HTML file and it doesn t do anything magical to the HTML file that makes it dynamic. After the modified HTML page is served to the client, it is stuck with that version of the page until the user refreshes the page. A request for a new page will send the HTML file back through the RabbitWeb pre-parser and that new copy will contain the most current value instead of the RabbitWeb tags. 20 P a g e
21 Chapter 8 - Our First Dynamic Web Page In order to show new data, we can include a meta tag to request that the page automatically reload. This has the advantage of being very easy to do with a single line of HTML code in the head element of the HTML file. Here is the same page with the meta tag in the header asking for an automatic refresh. A meta tag is an HTML tag with metadata or data about other data. The meta tags are placed in the head section of the HTML file.) When the page is loaded in the browser, the user s browser will automatically request a refresh from the server every 5 seconds. (You will see the automatic refresh request in bold text and the RabbitWeb tag in bold green text.) <html> <head> <meta http-equiv="refresh" content="5" > </head> <body> My_Data = <?z echo($my_data)?> </body> </html> Assuming the My_Data integer variable starts at 2009, after it passes through the RabbitWeb preparser it will look like this: <html> <head> <meta http-equiv="refresh" content="5" > </head> <body> My_Data = 2009 </body> </html> And the browser will display this: My_Data = P a g e
22 The page will still refresh every 5 seconds, and the Rabbit will still send a copy of fresh data even if it has not changed. If we assume that after 5 seconds the value of My_Data has changed to 1967 the file will change showing the new value as it passes through the RabbitWeb pre-parser. (I have placed the updated data in bold text.) <html> <head> <meta http-equiv="refresh" content="5" > </head> <body> My_Data = 1967 </body> </html> If the value on the Rabbit has changed, when the page refreshes it will display new data like this: My_Data = 1967 Updating the Dynamic C code If we change the main code in the previous example, we can watch the value of the My_Data variable change. (I have placed the new line of code in bold text.) void main() My_Data = 2009; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); My_Data++; //Update the value of My_Data continuously This example can work as a very simple dynamic web page for your embedded controller but it is wasteful when we consider the client and server relationship. If the web page is large with JavaScripts, cascading style sheets, and other resources, it is not an efficient way to pass our data. If your web page is small and simple this is a good solution, but if you only want to pass data there are better ways like XML which we will consider later. 22 P a g e
23 Chapter 9 - Using a Conditional The Mighty IF A lab technician looking at a simple refreshing web page with a changing value might not notice the numbers toggling back and forth. If we could radically change the text in the HTML page we could make an alert more noticeable. By creating a simple web page we can demonstrate how to display an interesting alert by completely changing the HTML code with RabbitWeb. Dynamic C Code If we tweak the main code again, we can set up our test alert to see how the HTML code will change. The code shown below leaves My_Data in the good state of 1 for 30 seconds. After 30 seconds, the value is toggled to 0 to trigger an alert. Every 30 seconds, the value in My_Data will alternate between 1 and 0. void main() My_Data = 1; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); costate //Costate to toggle between 1 and 0 every 30 seconds waitfor( DelaySec (30)); My_Data = My_Data ^ 1; //bitwise XOR My_Data (0 or 1) Notice that the web server is driven as fast as possible while I have restricted the execution of the My_Data toggle to once every 30 seconds by using the DelaySec() function with the costate. 23 P a g e
24 HTML Code - Two Web Pages in One File Knowing that the My_Data variable can equal either 1 or 0 we can use RabbitWeb s mighty IF statement to include or exclude blocks of code. Note that this page includes a refreshing meta tag in the header that will reload the page every 5 seconds. (I have placed the dynamic HTML code in bold text and the RabbitWeb code in bold green text.) <html> <head> <meta http-equiv="refresh" content="5" > </head> <body> </body> </html> <?z if ($My_Data == 0)?> ALERT! ALERT! ALERT! (Could be any HTML code) <?z?> <?z if ($My_Data == 1)?> HAPPY HAPPY JOY JOY!! (Could be any HTML code) <?z?> In our first operating condition, RabbitWeb will parse the HTML file and the served file will look like this: <html> <head> <meta http-equiv="refresh" content="5" > </head> <body> </body> </html> HAPPY HAPPY JOY JOY!! (Could be any HTML code) The browser will display the Happy message: HAPPY HAPPY JOY JOY!! (Could be any HTML code) 24 P a g e
25 When the alert condition occurs, we have to wait for the client s refresh request to occur. When the client requests the new page, it will be reparsed and the HTML file will look like this: <html> <head> <meta http-equiv="refresh" content="5" > </head> <body> </body> </html> ALERT! ALERT! ALERT! (Could be any HTML code) And the page will display the Alert message: ALERT! ALERT! ALERT! (Could be any HTML code) Tip Want More? You could also use this with any text file passed through the RabbitWeb pre-parser. This could include JavaScript files and XML files too. With a little creativity, you could create dynamic data files for any situation. 25 P a g e
26 Chapter 10 - Interactive Web Pages Made Easy Displaying data is great but in order to use a web page as a user interface, we need the ability to both display and change data from the web page. Fortunately, RabbitWeb makes this very easy as well. Adding a Submit Button Here is a variation on our web page with a Submit button added. By using an HTML form element we allow the user to enter information and we send this back to the web server as an HTTP post transaction. <form action="/index.zhtml" method="post"> The HTML code has an input element which is defined as a text box. The value attribute allows us to display an editable text string automatically when the page loads. The RabbitWeb echo tag shown in green bolded text copies the current value of the My_Data variable into the editable text field. <input type="text" name="my_data" value="<?z echo($my_data)?>"> We have also defined a submit button as input type and the submit button. You can change the text displayed on the submit button by editing the quoted text after the value attribute. <html> <head></head> <body> <input type="submit" value="submit"> <form action="/index.zhtml" method="post"> My_Data = <input type="text" name="my_data" value="<?z echo($my_data)?>"> <br> <input type="submit" value="submit"> <br> </form> </body> </html> With a submit button on the page any changes will be passed back to the server automatically using a post transaction when the user presses Submit. 26 P a g e
27 Updating the Dynamic C code If we change the main code in the previous example, we can watch the value of the My_Data variable change in Dynamic C s STDIO window in response to the changes entered by the user on the web page. (I have placed the new line of code in bold text.) void main() My_Data = 2009; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); printf("my_data = %d\r", My_Data); //Continously print My_Data s value Want More? For another examples that demonstrate how to update a variable on the embedded controller from a web interface, see the UPDATING.C example program in the C:\DCRABBIT_XX.XX\Samples\TCPIP\RabbitWeb directory. 27 P a g e
28 Chapter 11 - Detecting User Input from the Web Page With an embedded controller, it isn t unusual to want to trigger an interrupt service routine based on an external feedback. In a similar manner, RabbitWeb allows you to directly call a function when a user changes a value with the web interface. In order to demonstrate this, we can use the same HTML code with the Submit button as before. (I have left the RabbitWeb tag in green bold letters so it is easy to see.) <html> <head></head> <body> <form action="/index.zhtml" method="post"> My_Data = <input type="text" name="my_data" value="<?z echo($my_data)?>"> <br> <input type="submit" value="submit"> <br> </form> </body> </html> Adding a Callback Function to the Dynamic C Code Our previous code needs to be changed slightly to handle RabbitWeb. #define USE_RABBITWEB 1 #use "dcrtcp.lib" #use "http.lib" #ximport "samples/tcpip/http/pages/mypage.zhtml" mypage_zhtml SSPEC_MIMETABLE_START SSPEC_MIME_FUNC(".zhtml", "text/html", zhtml_handler) SSPEC_MIMETABLE_END SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/", mypage_zhtml), SSPEC_RESOURCE_XMEMFILE("/index.zhtml", mypage_zhtml) SSPEC_RESOURCETABLE_END int My_Data; //Create a global variable #web My_Data //Register it as a Web Variable 28 P a g e
29 int My_Data_update(void) //Callback function that prints the change printf("my_data changed to %d!\n", My_Data); #web_update My_Data My_Data_update void main() My_Data = 2009; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); Just as before we create a global variable and register it with the web server. int My_Data; //Create a global variable #web My_Data //Register it as a Web Variable Then, we create a function we would like to call when the web registered variable changes. This function is called a callback function. This function is simple, but it could be anything you like. int My_Data_update(void) //Callback function that prints the change printf("my_data changed to %d!\n", My_Data); Finally, we register our callback function to tie it to the state of the variable. This will cause our callback function to be called when the value changes. #web_update My_Data My_Data_update 29 P a g e
30 Here is a snapshot of the callback function printing in Dynamic C s STDIO window: Other Possibilities? See the WEB_UPDATE.C sample program in the C:\DCRABBIT_XX.XX\Samples\TCPIP\RabbitWeb directory for another example. Remember that you can create complicated behavior with your callback functions. When the client changes a value, the callback function could: Set a flag to trigger some behavior Send data from a serial port, TCP socket, or UPD socket Change the state of a digital output Set a pin as either a digital input or an output Anything else the Rabbit could do with a normal function call 30 P a g e
31 Chapter 12 - Creating Loops in RabbitWeb to Display Arrays We can create a web registered array in our code like this: #define USE_RABBITWEB 1 #use "dcrtcp.lib" #use "http.lib" #ximport "samples/tcpip/http/pages/mypage.zhtml" mypage_zhtml SSPEC_MIMETABLE_START SSPEC_MIME_FUNC(".zhtml", "text/html", zhtml_handler) SSPEC_MIMETABLE_END SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/", mypage_zhtml), SSPEC_RESOURCE_XMEMFILE("/index.zhtml", mypage_zhtml) SSPEC_RESOURCETABLE_END int My_Data[5]; #web My_Data //#web My_Data[0] //Create a global array //Register entire arrays as an array of web variables //Registers only element 0 in the array void main() My_Data[0] = 2009; My_Data[1] = 2010; My_Data[2] = 2011; My_Data[3] = 2012; My_Data[4] = 2013; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); You can register the entire array in one statement by using the array name. #web My_Data //Register the entire array of web variables If you prefer you can register individual elements in the array instead. #web My_Data[0] //Registers only element 0 in the array 31 P a g e
32 The HTML Code You have multiple options for displaying the values in your array. This example using an HTML table will work, but requires more code on your part. (Only the bold green text is related to RabbitWeb.) <html> <head> <meta http-equiv="refresh" content="5" > </head> <body> <table border= 1 > <tr> <td><?z echo($my_data[0])?> </td> <td><?z echo($my_data[1])?> </td> <td><?z echo($my_data[2])?> </td> <td><?z echo($my_data[3])?> </td> <td><?z echo($my_data[4])?> </td> </tr> </table> </body> </html> You could also use a RabbitWeb for loop to display the My_Data array. RabbitWeb scripting includes a series of canned loop-control indexes you can use in for loops like the one above. These cover the range of A to Z and assume an unsigned integer value. <html> <head> <meta http-equiv="refresh" content="5" > </head> <body> <table border= 1 > <tr> <?z for ($A = 0; $A < 5; $A++)?> <td><?z echo($my_data[$a])?> </td> <?z?> </tr> </table> </body> </html> These two pages are functionally identical and both will refresh the page every five seconds as well using the refreshing meta tag we discussed earlier. 32 P a g e
33 TIP - A Sneaky RabbitWeb Trick for Arrays Another advantage is that even if I don t know the array size, RabbitWeb can detect it automatically by using the count() RabbitWeb scripting function in my for loop. The code shown below will automatically loop through any size array when parsing the file. (The <td> tags are part of the HTML table.) <?z for ($A = 0; $A < count($my_data, 0); $A++)?> <td><?z echo($my_data[$a])?> </td> <?z?> I have set the second parameter of count() to 0 because My_Data is a one dimensional array. What if My_Data was a multi-dimensional array like My_Data[5][5][5]? If I wanted to get to my second dimension I would pass a 1 and a 2 to get to the third dimension into count() instead of the 0. Here is the HTML page created by the RabbitWeb loop and it will be identical for all the examples I described above. Want to Try More? This is a good example of how you can list a large number of values from the controller very easily, however you can also combine this with a conditional if statements to produce different effects. For example, you can set the background of each table cell to green when the My_Data value is good and change it to red when there is an alarm. Take a look at the ARRAYS.C program in the C:\DCRABBIT_XX.XX\Samples\TCPIP\RabbitWeb directory for another example using arrays. 33 P a g e
34 Chapter 13 - Adding JavaScript with RabbitWeb to your HTML Pages It is important to remember that RabbitWeb is not restricted to parsing HTML code and it can also be useful when working with JavaScript. Initializing JavaScript Variables with RabbitWeb This Javascript shown below doesn t do anything but initialize variables; however it does provide a useful demonstration. (JavaScript items are in bold black text and the RabbitWeb is in bold green text.) <html> <head> <script type="application/x-javascript"> function my_script() var Analog_input1 = <?z echo($my_data[0])?>; var Analog_input2 = <?z echo($my_data[1])?>; var Analog_input2 = <?z echo($my_data[2])?>; var Analog_input3 = <?z echo($my_data[3])?>; var Analog_input4 = <?z echo($my_data[4])?>; </script> </head> <body onload="my_script();"> Some HTML CODE </body> </html> If we use the same Dynamic C program as before, the RabbitWeb pre-parser would create this new file with a changed JavaScript function. (I have shown the changes to the JavaScript in bold text.) <html> <head> <script type="application/x-javascript"> function my_script() var Analog_input1 = 2009; var Analog_input2 = 2010; var Analog_input2 = 2011; var Analog_input3 = 2012; var Analog_input4 = 2013; </script> </head> <body onload="my_script();"> Some HTML CODE </body> </html> 34 P a g e
35 How to Create the Most Annoying Pop-up Box in History You can combine RabbitWeb with Javascript code to make a pop-up box that is shown every time the page loads. Because we have a refreshing meta tag in the HTML head element, this pop-up will reappear every 5 seconds. Why is this interesting? Our alert box is showing the value of our My_Data variable. (JavaScript items are in bold text and the RabbitWeb in bold green text.) <html> <head> <meta http-equiv="refresh" content="5" > <script type="application/x-javascript"> function disp_alert() alert("my_data = <?z echo($my_data)?>"); </script> </head> <body onload="disp_alert();"> Some HTML code here </body> </html> The Annoying Pop-up Box This Pop-up is guaranteed to be terribly annoying, but it is also terribly interesting to see data from the Rabbit appear in the alert box of your browser. With a little more work, we might be able to make this more useful. 35 P a g e
36 Saving the Annoying Pop-Up Box Using the RabbitWeb if statement you can dramatically change the behavior of a web page very easily. You can add or remove large chunks of code based on the value of a variable on the embedded controller. If I reuse this Dynamic C main code from our previous example to toggle the value of My_Data, we should be able to trigger my alert pop-up box. void main() My_Data = 0; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) costate http_handler(); //Costate to drive the web server costate //Costate to toggle between 1 and 0 every 30 seconds waitfor( DelaySec (30)); My_Data = My_Data ^ 1; //bitwise XOR My_Data 36 P a g e
37 Then I can add a simple if statement to my Javascript and trigger the alert based on the value of my RabbitWeb variable. (JavaScript items are in bold text and the RabbitWeb in bold green text.) html> <head> <meta http-equiv="refresh" content="5" > <script type="application/x-javascript"> function disp_alert() if ( <?z echo($my_data)?> ); alert("my_data = <?z echo($my_data)?>"); </script> </head> <body onload=" disp_alert();"> Some HTML Code Here </body> </html> As the page refreshes every 5 seconds, RabbitWeb will insert the value of the My_Data variable into the file creating either this non-alerting Javascript which hits an if (0) and does nothing. (Changes are in bold text.) html> <head> <meta http-equiv="refresh" content="5" > <script type="application/x-javascript"> function disp_alert() if (0); alert("my_data = 0"); </script> </head> <body onload=" disp_alert();"> Some HTML Code Here </body> </html> 37 P a g e
38 Or this alerting Javascript which hits an if (1) and creates the pop-up box: html> <head> <meta http-equiv="refresh" content="5" > <script type="application/x-javascript"> function disp_alert() if (1); alert("my_data = 1"); </script> </head> <body onload=" disp_alert();"> Some HTML Code Here </body> </html> With just a bit of imagination, you can do almost anything. 38 P a g e
39 Chapter 14 - Basic XML with the Rabbit Embedded Web Server XML is a method of transmitting and presenting data in an organized way. It uses XML tags the same way you or I might use the handles on a suitcase to grab onto it. If you know the XML tag, you can get to the data very easily and the best thing is you will create your own tags for your file. (I have put the data in bold text.) For example: <!-- My XML file --> <Famous_Animals> <Dogs> <Scoobie_Doo>Great Dane</Scoobie_Doo> <Lassie>Collie</Lassie> <Rin_Tin_Tin>German Sheppard</Rin_Tin_Tin> <Stimpy>Chihuahua</Stimpy> </Dogs> </Famous_Animals> Each defined tag must have a closing tag with a / like this: <my_nifty_xml_tag >some nifty data</my_nifty_xml_tag> With this understanding, we can add an XML data file into our embedded web server by editing the MIME table and the Resource table. Note that we have also imported the dogs.xml file into extended memory with the #ximport keyword. (I have placed the changes in bold text.) Dynamic C Code #class auto #memmap xmem #use "dcrtcp.lib" #use "http.lib" #ximport "C:/Pux Dyn C Files/Webinar/dogs.xml" SSPEC_MIMETABLE_START SSPEC_MIME(".xml","text/xml") SSPEC_MIMETABLE_END SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/dogs.xml", dogs_xml) SSPEC_RESOURCETABLE_END dogs_xml //Here is my XML MIME type! //Here is my XML file! 39 P a g e
40 This Dynamic C code doesn t do anything but serve the XML file. void main() sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); If we assume my web server has an IP address of , I should be able to access the XML file from a browser by typing the following URL into my browser: This demonstrates that the Rabbit can serve up an XML file in a way that makes some sense to the browser. Now we need a web page that can do something with it. 40 P a g e
41 Putting together a JavaScript to Read your XML data Different browsers will handle an XML file in different ways, but the process will break down into four basic steps: 1. Create an XML document. 2. Do you want your read to be synchronous or asynchronous? 3. Load the XML file. 4. Grab a specific piece of data from the file. Scary Looking JavaScript Code I have put together a small HTML file with Javascript code to access the dogs.xml file. This may look intimidating so we re going to break it down piece by piece. (You will notice the XML tag in bold blue text and the ID attribute referenced in bold red text.) <html> <head> <script type="text/javascript"> function Get_XML_Dog() var Breed; //Store the Breed of the dog here try //Test for Internet Explorer xmldoc=new ActiveXObject("Microsoft.XMLDOM"); catch(err) //If ActiveX isn't going to work, so we use a more codified standard try //Every browser but Internet Explorer xmldoc=document.implementation.createdocument("","",null); catch(err) //If that doesn't work, we produce an error mocking our user. alert("no XML for you!"); return; xmldoc.async=false; //We want a synchronous connection xmldoc.load("dogs.xml"); //Load the XML file //Get the XML data from Scoobie_Doo tag and stash it in the Breed variable Breed = xmldoc.getelementsbytagname("scoobie_doo")[0].childnodes[0].nodevalue; //Write the contents of Breed at the span tag with the id="dog_breed" document.getelementbyid("dog_breed").innerhtml=breed; </script> </head> 41 P a g e
42 Continued - The HTML body that works with the JavaScript <body> <b>what Kind of Dog is Scoobie Doo?</b> <p>scoobie Doo is a <span id="dog_breed"></span></p> <p><button onclick="get_xml_dog()">snag an XML Dog Tag!</button></p> </body> </html> Breaking down the Scary Looking Javascript HTML DOM First, we are going to store the breed of the dog in a Javascript variable. If we wanted to manipulate the data with our Javascript, this is useful. If we just want to output the data, we might not need this variable. var Breed; //Store the Breed of the dog here In this document, I am going to treat the complicated topic of the HTML Document Object Model (DOM) as we would a hammer. I m going to show you a basic method of using these tools and I m not going to get into extensive detail about what makes them work. If we use the hammer analogy, we are interested in hitting our nails into a board, but we don t need to know equations for kinetic energy or how Newtonian physics explains a lever. If you want more information on HTML DOM, you can find a tutorial here: We need to have a plan for handling different web browsers. As usual, Microsoft s Internet Explorer wants to go off in its own direction so we can look at their case first. If we are using Internet Explorer, our xmldoc will be created by this code. If we are not using Internet Explorer it will produce an error. try //Test for Internet Explorer xmldoc=new ActiveXObject("Microsoft.XMLDOM"); 42 P a g e
43 The error will be handled by our catch statement. Inside the catch statement, we try creating the xmldoc again using a more common method. If that doesn t work, it will throw another error and we hand it off to another catch statement. In the final catch statement, we mock people using outdated browsers with a message that taunts them. catch(err) //If ActiveX isn't going to work, so we use a more codified standard try //Every browser but Internet Explorer xmldoc=document.implementation.createdocument("","",null); catch(err) //If that doesn't work, we produce an error mocking our user. alert("no XML for you!"); return; If your XML file is very large, you may want the code in the Javascript to wait until the XML file is completely loaded. You can make the Javascript wait for the file to load by specifying that you don t want an asynchronous load. xmldoc.async=false; //We want a synchronous connection Now you can load the XML file into your xmldoc object and the Javascript will wait for you to finish. xmldoc.load("dogs.xml"); //Load the XML file With the XML file loaded, we can use the XML tag to latch onto a key piece of data by specifying the tag name. (I have placed the unique XML tag in bold blue text to make it easy to spot.) //Get the XML data from Scoobie_Doo tag and stash it in the Breed variable Breed = xmldoc.getelementsbytagname("scoobie_doo")[0].childnodes[0].nodevalue; An HTML element can have attributes. You can recognize an attribute because it will be in quotes. Here you can see an HTML paragraph with a unique ID. You can add an ID attribute to any HTML element. (I have placed the ID attribute in bold red text to make it easy to see.) <p id= my_unique_paragraph_id >Some Stuff</p> Attributes allow us to provide additional information about the element and we can use these as handles for plugging things into our page with XML. In the HTML code for handling our XML file, I have included an ID. <span id="dog_breed"></span> 43 P a g e
44 If I wanted to directly set the value between my two span tags, I could use the following Javascript statement: document.getelementbyid("dog_breed").innerhtml="some Dog"; By using our Breed Javascript variable, we can set this value with data from the XML file. //Write the contents of Breed at the span tag with the id="dog_breed" //(See the HTML body below.) document.getelementbyid("dog_breed").innerhtml=breed; We could skip the Breed variable completely and use a single line of code to assign the XML data to the ID attribute just as easily if we wished. (I apologize for the small font.) document.getelementbyid("dog_breed").innerhtml=xmldoc.getelementsbytagname("scoobie_doo")[0].childnodes[0].nodevalue; I chose to break this single line up, because it s easier to read and explain if we take it in smaller steps. In the body of the HTML there are two lines that are important. The first is our span element with its ID attribute. <p>scoobie Doo is a <span id="dog_breed"></span></p> The last key piece is HTML code to add a button. When the button is clicked, our Javascript function Get_XML_Dog() will execute. <p><button onclick="get_xml_dog()">snag an XML Dog Tag!</button></p> 44 P a g e
45 Dynamic C Code The only real changes to the Dynamic C code are the additions of the HTML file. #class auto #memmap xmem #use "dcrtcp.lib" #use "http.lib" #ximport "C:/Pux Dyn C Files/Webinar/basic_xml.html" #ximport "C:/Pux Dyn C Files/Webinar/dogs.xml" SSPEC_MIMETABLE_START SSPEC_MIME(".html", "text/html"), SSPEC_MIME(".xml","text/xml") SSPEC_MIMETABLE_END index_html dogs_xml //Here is my XML MIME type! SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/", index_html), SSPEC_RESOURCE_XMEMFILE("/index.html", index_html), SSPEC_RESOURCE_XMEMFILE("/dogs.xml", dogs_xml) SSPEC_RESOURCETABLE_END //Here is my XML file! void main() sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); 45 P a g e
46 Let s See the Dog Tags Work! When the page is loaded initially the browser will display this text: When the user clicks the button the Get_XML_Dog() Javascript function will execute and our magic XML code will produce this: Where s the Magic? - AJAX The important thing to notice is that all this occurred without a page refresh! This is a method of web programming known as Asynchronous JavaScript and XML or AJAX. 46 P a g e
47 Chapter 15 - RabbitWeb and XML The Holy Grail of Embedded Web Developers Any text file can be passed through the RabbitWeb pre-parser and an XML file is no exception. With XML and RabbitWeb we can create a powerful combination. As an example, our embedded web server might have the following web resources that it needs to serve to a browser: HTML file - 500k 3 jpegs - 250k each JavaScript file Style sheet XML file - 100k - 50k - 1k We want a dynamic page and we could use this HTML code in the <head> to force the entire page to refresh every 5 seconds. <meta http-equiv="refresh" content="5" > Unfortunately, in this case a single page refresh requires 1401k of data! That s not efficient at all! If we use the previous option of manually refreshing the entire page every 5 seconds with a meta tag we place a serious burden on the web server. If we could refresh only the XML file, we create the ability to update only the data in the web page without refreshing the entire page. The Teeny-Tiny and yet Magical my_data.xml file Consider this simple XML file using a RabbitWeb echo tag. (I have placed the RabbitWeb tag in bold green text.) <!-- RabbitWeb XML file --> <RabbitWeb> <My_Data1> <?z echo($my_data1)?> </My_Data1> </RabbitWeb> This file is very small and our embedded web server can serve this up much more quickly than the entire page with all the supporting files. Best of all, the HTML pages do not completely reload and the data will change before our eyes like magic! 47 P a g e
48 Dynamic C code This Dynamic C code will serve up our HTML file and our RabbitWeb-enabled XML file. Notice that we are using the SSPEC_MIME_FUNC type for our MIME table to pass the XML file through the RabbitWeb pre-parser. We are also continuously changing the value of the My_Data variable so we can see a change on our page. #class auto #define USE_RABBITWEB 1 #memmap xmem #use "dcrtcp.lib" #use "http.lib" #ximport "C:/Pux Dyn C Files/Webinar/Dynamic_W01.html" #ximport "C:/Pux Dyn C Files/Webinar/my_data.xml" index_html my_data_xml int My_Data; #web My_Data SSPEC_MIMETABLE_START SSPEC_MIME(".html", "text/html"), SSPEC_MIME_FUNC(".xml","text/xml", zhtml_handler) SSPEC_MIMETABLE_END SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/", index_html), SSPEC_RESOURCE_XMEMFILE("/index.html", index_html), SSPEC_RESOURCE_XMEMFILE("/my_data.xml", my_data_xml) SSPEC_RESOURCETABLE_END void main() My_Data1 = 1; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); My_Data++; //Keep changing My_Data 48 P a g e
49 The Magic HTML file with Special Kung Fu JavaScript This looks almost the same as the previous HTML file. (You will notice the XML tag in bold blue text and the ID attribute referenced in bold red text.) <html> <head> <script type="text/javascript"> function Read_XML_File() var XML_Data; //Storage for the value of My_Data from the XML file try //Test for Internet Explorer xmldoc=new ActiveXObject("Microsoft.XMLDOM"); catch(err) //If ActiveX isn't going to work we use a more codified standard try //Every browser but Internet Explorer xmldoc=document.implementation.createdocument("","",null); catch(err) //If that doesn't work, we produce an error mocking our user. alert("no XML for you!"); return; xmldoc.async=false; //We want a synchronous connection xmldoc.load("my_data.xml"); //Load the XML file //Store the value of My_Data tag in the XML_Data variable XML_Data = xmldoc.getelementsbytagname("my_data")[0].childnodes[0].nodevalue; //Write the value of XML_Data into the body document.getelementbyid("my_data_id").innerhtml=xml_data; </script> </head> <body> <p><b>my_data1:</b><span id="my_data_id"></span></p> <button onclick="read_xml_file()">get XML</button> </body> </html> 49 P a g e
50 Clicking on the button will execute the Read_XML_File() JavaScript function which requests a fresh copy of the XML file every time the user clicks the Get XML button. Unlike our previous example, the XML file will be run through the RabbitWeb pre-parser each time the client requests the file and as the value of the My_Data variable changes, so will the XML file. Every time the user clicks the button, the data will be updated! The Magic Page in Action! Here is the page before the button is pressed: Here is the page after the button is pressed the first time without any page refresh: 50 P a g e
51 Here is the page after the button is pressed the second time without any page refresh: Is this Really Magic? Each click of the button requests a new copy of the XML file which is updated by RabbitWeb. It s fast and effective! Can we make it more interesting? 51 P a g e
52 Chapter 16 - Loopy JavaScript Updating the data on a button press is interesting, but it would be more impressive to continually refresh the data behind the scenes with an infinite loop. JavaScript has a mechanism for this called a timing event. The Joy of the settimeout() Function The settimeout() function can be used to execute a JavaScript after an interval has expired. It accepts two parameters: 1. A JavaScript statement 2. A time interval in milliseconds The function returns a unique ID number that will allow you to shut down the timed process. You can think of this as a way of putting a C-code style break into your infinite loop as an escape hatch. A call to the settimeout() might look like this: var t =settimeout( c=c+1;,5000); //increment c in 5 seconds Easy settimeout() Function Example Here is a short HTML file that uses the settimeout() Function to display an alert box 5 seconds after the user presses a button on the web page. <html> <head> <script type="text/javascript"> function Delayed_Pop_Up() var timer_id = settimeout("alert('tada!')",5000); </script> </head> <body> <button onclick="delayed_pop_up ()">Trigger Delayed Pop Up</button> </body> </html> 52 P a g e
53 Using the settimeout() Function to create an Infinite Loop A more interesting construction would be to use the settimeout() to call another function in an infinite loop. Here we are using the same ID attribute from the previous examples as a mechanism for creating an infinite loop that continues to update the value of the c variable as displayed on the web page twice per second. <html> <head> <script type="text/javascript"> var c = 0; var timer_id; //Simple counter //Global timeout ID so we can exit later if we wish function Inc_C() c = c +1; document.getelementbyid( c_variable ).innerhtml=c; timer_id = settimeout( Inc_C(),500); //Calling the function again to loop! </script> </head> <body> <p>c = <span id="c_variable"></span></p> <p><button onclick="inc_c()">start C up!</button></p> </body> </html> 53 P a g e
54 Exiting the Loop If we wanted to exit the infinite loop, we could use the cleartimeout() function like this: cleartimeout(timer_id); For example, we could create another button that exits the loop. (I have placed the code used to exit the loop in bold text below.) <html> <head> <script type="text/javascript"> var c = 0; //Simple counter var timer_id; //Global timeout ID so we can exit later if we wish function Inc_C() document.getelementbyid("c_variable").innerhtml=c; c = c +1; timer_id = settimeout("inc_c()",500); //Calling the function again to loop! function Done() cleartimeout(timer_id); </script> </head> <body> <p>c = <span id="c_variable"></span></p> <p><button onclick="inc_c()">start C up!</button></p> <p><button onclick="done()">stop C!</button></p> </body> </html> Looking at the Page Here is a screenshot of how the page will look: 54 P a g e
55 Chapter 17 - Using a JavaScript Loop to Pass Dynamic XML Data in Real- Time Now that we understand how to start and stop loops in JavaScript, we can apply this to our Dynamic XML files. Here is a more interesting XML file. Each request for the file will automatically pass it through the RabbitWeb pre-parser. (I have placed the RabbitWeb tags in bold green text.) <!-- RabbitWeb XML file --> <RabbitWeb> <My_Data1> <?z echo($my_data1)?> </My_Data1> <My_Data2> <?z echo($my_data2)?> </My_Data2> <My_Data3> <?z echo($my_data3)?> </My_Data3> <My_Data4> <?z echo($my_data4)?> </My_Data4> </RabbitWeb> Dynamic C Code Here is the pre-main code: #class auto #define USE_RABBITWEB 1 #memmap xmem #use "dcrtcp.lib" #use "http.lib" #ximport "C:/Pux Dyn C Files/Webinar/Dynamic_W02.html" #ximport "C:/Pux Dyn C Files/Webinar/my_data2.xml" index_html my_data2_xml SSPEC_MIMETABLE_START SSPEC_MIME(".html", "text/html"), SSPEC_MIME_FUNC(".xml","text/xml", zhtml_handler) SSPEC_MIMETABLE_END int My_Data1, My_Data2, My_Data3, My_Data4; //Create Global Variables #web My_Data1 //Register Global Variables With RabbitWeb #web My_Data2 #web My_Data3 #web My_Data4 SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/", index_html), SSPEC_RESOURCE_XMEMFILE("/index.html", index_html), SSPEC_RESOURCE_XMEMFILE("/my_data2.xml", my_data2_xml) SSPEC_RESOURCETABLE_END 55 P a g e
56 And the main code: void main() My_Data1 = 1; My_Data2 = 10; My_Data3 = 100; My_Data4 = 1000; sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); costate //Only update the data every 500 ms waitfor(delayms(500)); My_Data1++; My_Data2++; My_Data3++; My_Data4++; This code doesn t do much that is different from our previous examples with the exception that it has four variables and we are only updating the My_Data variables every 500 ms. Our goal is to request a refreshed version of this file from the embedded web server in an infinite loop. We can use the settimeout() function to achieve this goal by combining it with the XML code we have already used. 56 P a g e
57 The Amazing JavaScript I have created four buffer variables to make the code easier to read. In practice, I would set the id with the tag in a single line without using a buffer variable. (The looping statement is shown in bold text.) <html> <head> <script type="text/javascript"> var My_Data1_var; var My_Data2_var; var My_Data3_var; var My_Data4_var; function Get_XML() try //Test for Internet Explorer xmldoc=new ActiveXObject("Microsoft.XMLDOM"); catch(err) //If ActiveX isn't going to work we use a more codified standard try //Every browser but Internet Explorer xmldoc=document.implementation.createdocument("","",null); catch(err) //If that doesn't work, we produce an error mocking our user. alert("no XML for you!"); return; xmldoc.async=false; xmldoc.load("my_data2.xml"); My_Data1_var = xmldoc.getelementsbytagname("my_data1")[0].childnodes[0].nodevalue; My_Data2_var = xmldoc.getelementsbytagname("my_data2")[0].childnodes[0].nodevalue; My_Data3_var = xmldoc.getelementsbytagname("my_data3")[0].childnodes[0].nodevalue; My_Data4_var = xmldoc.getelementsbytagname("my_data4")[0].childnodes[0].nodevalue; document.getelementbyid("my_data1").innerhtml=my_data1_var; document.getelementbyid("my_data2").innerhtml=my_data2_var; document.getelementbyid("my_data3").innerhtml=my_data3_var; document.getelementbyid("my_data4").innerhtml=my_data4_var; settimeout("get_xml()",500); </script> </head> (The second part of the HTML file is on the next page.) 57 P a g e
58 The HTML Body This is very similar to the previous example with the exception that we are accessing four variables. <body> <h1>dynamic XML Test!</h1> <p> <b>my_data1:</b> <span id="my_data1"></span><br /> <b>my_data2:</b> <span id="my_data2"></span><br /> <b>my_data3:</b> <span id="my_data3"></span><br /> <b>my_data4:</b> <span id="my_data4"></span><br /> </p> <p><button onclick="get_xml()">get XML</button></p> </body> </html> Watching it All Work Here is the page before the button is pressed: 58 P a g e
59 When the button is pressed, the client requests the XML file from the server and the page is automatically updated: Every 500 milliseconds, it will continue to update automatically without any button presses. 59 P a g e
60 And again: Want more? With the ability to swap data in real-time with your embedded controller you have the potential to create dynamic charts, graphs, and other animations with Flash or extensions to the JavaScript language like the Yahoo User Interface and Canvas. 60 P a g e
61 Chapter 18 - Dynamic Web Interface to Hardware in Real-Time The next natural step is to move from an abstract variable like My_Data to a value defined by the hardware itself. The RCM5700 MiniCore and the RCM5600W MiniCore both have access to a push button switch on the prototyping board connected to pin 1 on Parallel Port D. You will find the push button labeled SW1 near the jumper array on the edge of the prototyping board. If we assume I have created an integer named Switch_1, we can read the value of the switch with this statement: Switch_1 = BitRdPortI(PDDR, 1); //Read S1 We can then use the same method as before to create a dynamic web page to display the status of the hardware. 61 P a g e
62 A Simple XML file for Our Little Switch Here is our dynamic XML file. Each request for the file will automatically pass it through the RabbitWeb pre-parser. (I have placed the RabbitWeb tags in bold green text.) <!-- RabbitWeb XML file --> <RabbitWeb> <Switch_1> <?z echo($switch_1)?> </Switch_1>> </RabbitWeb> Dynamic C Code Our Dynamic C code registers our Switch_1 integer variable with the web server and passes our XML file through the ZHTML handler before we get to the main code. (Notice also that I have included the RCM56XX.LIB file.) #class auto #define USE_RABBITWEB 1 #memmap xmem #use "dcrtcp.lib" #use "http.lib" #use "rcm56xxw.lib" #ximport "C:/Pux Dyn C Files/Webinar/Dynamic_W04.html" #ximport "C:/Pux Dyn C Files/Webinar/my_data3.xml" index_html my_data3_xml SSPEC_MIMETABLE_START SSPEC_MIME(".html", "text/html"), SSPEC_MIME_FUNC(".xml","text/xml", zhtml_handler) SSPEC_MIMETABLE_END int Switch_1; //Create Global Variable #web Switch_1 //Register Global Variable with RabbitWeb SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/", index_html), SSPEC_RESOURCE_XMEMFILE("/index.html", index_html), SSPEC_RESOURCE_XMEMFILE("/my_data3.xml", my_data3_xml) SSPEC_RESOURCETABLE_END 62 P a g e
63 In the main code, we poll the value of our switch and drive the web server. Notice that we include a brdinit() function which is specific for the RCM5600W from the rcm56xxw.lib we included earlier. void main() Switch_1 = 0; brdinit(); sock_init_or_exit(1); http_init(); tcp_reserveport(80); while (1) http_handler(); Switch_1 =!BitRdPortI(PDDR, 1); //Read S1 The JavaScript Our JavaScript should merely be a variation on what we have already done. In this case, I am skipping the buffer variable in order to assign the ID attribute to the value from the XML tag in a single statement. (I have placed the single line of code that assigns the value in bold text.) <html> <head><script type="text/javascript"> function Get_XML () try //Test for Internet Explorer xmldoc=new ActiveXObject("Microsoft.XMLDOM"); catch(err) //If ActiveX isn't going to work we use a more codified standard try //Every browser but Internet Explorer xmldoc=document.implementation.createdocument("","",null); catch(err) //If that doesn't work, we produce an error mocking our user. alert("no XML for you!"); return; xmldoc.async=false; //We want a synchronous connection xmldoc.load("my_data3.xml"); //Load the XML file //Set the ID attribute with the data from the XML file in a single line document.getelementbyid("switch_1").innerhtml=xmldoc.getelementsbytagname("switch_1")[0].childnodes[0].nodevalue; //Infinite Loop every 500 milliseconds settimeout("get_xml ()",500); </script></head> 63 P a g e
64 <body> The HTML Body The HTML body is again merely a variation on the same theme. <h1>press Switch 1 on the Protoboard!</h1> <p><b>switch_1:</b> <span id="switch_1"></span><br /></p> <p><button onclick="get_xml ()">Start Dynamic Data</button></p> </body> </html> How Does it Look? Here is the page before we turn on the infinite loop in our JavaScript. ] 64 P a g e
65 After we press the Start Dynamic Data button, we begin updating the page every 500 milliseconds by repeatedly calling the Get_XML() function. The page below shows our page automatically refreshing after the Start Dynamic Data button press, but I have not pressed down on Switch 1 on the prototyping board. When I press down on Switch 1 on the prototyping board, the continuously refreshing stream of XML data updates the data on the web page to show the change. 65 P a g e
66 Chapter 19 - Monitoring Every Parallel Port Pin on the MiniCore We have already seen that we can monitor the status of a single pin. There is nothing preventing us from taking the idea further and getting the state of every parallel port pin on the Rabbit 5000 microprocessor. You can make this table update in real-time using the same principles outlined earlier. 66 P a g e
Dynamic Web Pages With The Embedded Web Server. The Digi-Geek s AJAX Workbook
Dynamic Web Pages With The Embedded Web Server The Digi-Geek s AJAX Workbook (NET+OS, XML, & JavaScript) Version 1.0 5/4/2011 Page 1 Table of Contents Chapter 1 - How to Use this Guide... 5 Prerequisites
MASTERTAG DEVELOPER GUIDE
MASTERTAG DEVELOPER GUIDE TABLE OF CONTENTS 1 Introduction... 4 1.1 What is the zanox MasterTag?... 4 1.2 What is the zanox page type?... 4 2 Create a MasterTag application in the zanox Application Store...
JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK
Programming for Digital Media EE1707 JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK 1 References and Sources 1. DOM Scripting, Web Design with JavaScript
TCP/IP Networking, Part 2: Web-Based Control
TCP/IP Networking, Part 2: Web-Based Control Microchip TCP/IP Stack HTTP2 Module 2007 Microchip Technology Incorporated. All Rights Reserved. Building Embedded Web Applications Slide 1 Welcome to the next
WIRIS quizzes web services Getting started with PHP and Java
WIRIS quizzes web services Getting started with PHP and Java Document Release: 1.3 2011 march, Maths for More www.wiris.com Summary This document provides client examples for PHP and Java. Contents WIRIS
Working with forms in PHP
2002-6-29 Synopsis In this tutorial, you will learn how to use forms with PHP. Page 1 Forms and PHP One of the most popular ways to make a web site interactive is the use of forms. With forms you can have
Further web design: HTML forms
Further web design: HTML forms Practical workbook Aims and Learning Objectives The aim of this document is to introduce HTML forms. By the end of this course you will be able to: use existing forms on
CS412 Interactive Lab Creating a Simple Web Form
CS412 Interactive Lab Creating a Simple Web Form Introduction In this laboratory, we will create a simple web form using HTML. You have seen several examples of HTML pages and forms as you have worked
Fireworks 3 Animation and Rollovers
Fireworks 3 Animation and Rollovers What is Fireworks Fireworks is Web graphics program designed by Macromedia. It enables users to create any sort of graphics as well as to import GIF, JPEG, PNG photos
SUBJECT CODE : 4074 PERIODS/WEEK : 4 PERIODS/ SEMESTER : 72 CREDIT : 4 TIME SCHEDULE UNIT TOPIC PERIODS 1. INTERNET FUNDAMENTALS & HTML Test 1
SUBJECT TITLE : WEB TECHNOLOGY SUBJECT CODE : 4074 PERIODS/WEEK : 4 PERIODS/ SEMESTER : 72 CREDIT : 4 TIME SCHEDULE UNIT TOPIC PERIODS 1. INTERNET FUNDAMENTALS & HTML Test 1 16 02 2. CSS & JAVASCRIPT Test
Web Server Lite. Web Server Software User s Manual
Web Server Software User s Manual Web Server Lite This software is only loaded to 7188E modules acted as Server. This solution was general in our products. The Serial devices installed on the 7188E could
Internet Technologies
QAFQAZ UNIVERSITY Computer Engineering Department Internet Technologies HTML Forms Dr. Abzetdin ADAMOV Chair of Computer Engineering Department [email protected] http://ce.qu.edu.az/~aadamov What are forms?
Example. Represent this as XML
Example INF 221 program class INF 133 quiz Assignment Represent this as XML JSON There is not an absolutely correct answer to how to interpret this tree in the respective languages. There are multiple
Novell Identity Manager
AUTHORIZED DOCUMENTATION Manual Task Service Driver Implementation Guide Novell Identity Manager 4.0.1 April 15, 2011 www.novell.com Legal Notices Novell, Inc. makes no representations or warranties with
Script Handbook for Interactive Scientific Website Building
Script Handbook for Interactive Scientific Website Building Version: 173205 Released: March 25, 2014 Chung-Lin Shan Contents 1 Basic Structures 1 11 Preparation 2 12 form 4 13 switch for the further step
PHP Tutorial From beginner to master
PHP Tutorial From beginner to master PHP is a powerful tool for making dynamic and interactive Web pages. PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.
Website Development Komodo Editor and HTML Intro
Website Development Komodo Editor and HTML Intro Introduction In this Assignment we will cover: o Use of the editor that will be used for the Website Development and Javascript Programming sections of
SysPatrol - Server Security Monitor
SysPatrol Server Security Monitor User Manual Version 2.2 Sep 2013 www.flexense.com www.syspatrol.com 1 Product Overview SysPatrol is a server security monitoring solution allowing one to monitor one or
Client-side Web Engineering From HTML to AJAX
Client-side Web Engineering From HTML to AJAX SWE 642, Spring 2008 Nick Duan 1 What is Client-side Engineering? The concepts, tools and techniques for creating standard web browser and browser extensions
LabVIEW Internet Toolkit User Guide
LabVIEW Internet Toolkit User Guide Version 6.0 Contents The LabVIEW Internet Toolkit provides you with the ability to incorporate Internet capabilities into VIs. You can use LabVIEW to work with XML documents,
Front-End Performance Testing and Optimization
Front-End Performance Testing and Optimization Abstract Today, web user turnaround starts from more than 3 seconds of response time. This demands performance optimization on all application levels. Client
Advanced Tornado TWENTYONE. 21.1 Advanced Tornado. 21.2 Accessing MySQL from Python LAB
21.1 Advanced Tornado Advanced Tornado One of the main reasons we might want to use a web framework like Tornado is that they hide a lot of the boilerplate stuff that we don t really care about, like escaping
HTML Forms and CONTROLS
HTML Forms and CONTROLS Web forms also called Fill-out Forms, let a user return information to a web server for some action. The processing of incoming data is handled by a script or program written in
Xtreeme Search Engine Studio Help. 2007 Xtreeme
Xtreeme Search Engine Studio Help 2007 Xtreeme I Search Engine Studio Help Table of Contents Part I Introduction 2 Part II Requirements 4 Part III Features 7 Part IV Quick Start Tutorials 9 1 Steps to
Performance Testing for Ajax Applications
Radview Software How to Performance Testing for Ajax Applications Rich internet applications are growing rapidly and AJAX technologies serve as the building blocks for such applications. These new technologies
Web Programming with PHP 5. The right tool for the right job.
Web Programming with PHP 5 The right tool for the right job. PHP as an Acronym PHP PHP: Hypertext Preprocessor This is called a Recursive Acronym GNU? GNU s Not Unix! CYGNUS? CYGNUS is Your GNU Support
Getting Started Guide with WIZ550web
1/21 WIZ550web is an embedded Web server module based on WIZnet s W5500 hardwired TCP/IP chip, Users can control & monitor the 16-configurable digital I/O and 4-ADC inputs on module via web pages. WIZ550web
It is highly recommended that you are familiar with HTML and JavaScript before attempting this tutorial.
About the Tutorial AJAX is a web development technique for creating interactive web applications. If you know JavaScript, HTML, CSS, and XML, then you need to spend just one hour to start with AJAX. Audience
RabbitWeb. To Web-Enable Embedded Applications. 1.0 Getting Started: A Simple Example
RabbitWeb To Web-Enable Embedded Applications This document explains the ease with which you can now create a web interface to your Rabbit-based device. An add-on module available starting with Dynamic
CSCI110: Examination information.
CSCI110: Examination information. The exam for CSCI110 will consist of short answer questions. Most of them will require a couple of sentences of explanation of a concept covered in lectures or practical
JavaScript Basics & HTML DOM. Sang Shin Java Technology Architect Sun Microsystems, Inc. [email protected] www.javapassion.com
JavaScript Basics & HTML DOM Sang Shin Java Technology Architect Sun Microsystems, Inc. [email protected] www.javapassion.com 2 Disclaimer & Acknowledgments Even though Sang Shin is a full-time employee
«W3Schools Home Next Chapter» JavaScript is THE scripting language of the Web.
JS Basic JS HOME JS Introduction JS How To JS Where To JS Statements JS Comments JS Variables JS Operators JS Comparisons JS If...Else JS Switch JS Popup Boxes JS Functions JS For Loop JS While Loop JS
An Introduction To Simple Scheduling (Primarily targeted at Arduino Platform)
An Introduction To Simple Scheduling (Primarily targeted at Arduino Platform) I'm late I'm late For a very important date. No time to say "Hello, Goodbye". I'm late, I'm late, I'm late. (White Rabbit in
Short notes on webpage programming languages
Short notes on webpage programming languages What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is a markup language A markup language is a set of
LAB MANUAL CS-322364(22): Web Technology
RUNGTA COLLEGE OF ENGINEERING & TECHNOLOGY (Approved by AICTE, New Delhi & Affiliated to CSVTU, Bhilai) Kohka Kurud Road Bhilai [C.G.] LAB MANUAL CS-322364(22): Web Technology Department of COMPUTER SCIENCE
Debugging JavaScript and CSS Using Firebug. Harman Goei CSCI 571 1/27/13
Debugging JavaScript and CSS Using Firebug Harman Goei CSCI 571 1/27/13 Notice for Copying JavaScript Code from these Slides When copying any JavaScript code from these slides, the console might return
AJAX The Future of Web Development?
AJAX The Future of Web Development? Anders Moberg (dit02amg), David Mörtsell (dit01dml) and David Södermark (dv02sdd). Assignment 2 in New Media D, Department of Computing Science, Umeå University. 2006-04-28
12Planet Chat end-user manual
12Planet Chat end-user manual Document version 1.0 12Planet 12Planet Page 2 / 13 Table of content 1 General... 4 1.1 How does the chat work?... 4 1.2 Browser Requirements... 4 1.3 Proxy / Firewall Info...
Using The HomeVision Web Server
Using The HomeVision Web Server INTRODUCTION HomeVision version 3.0 includes a web server in the PC software. This provides several capabilities: Turns your computer into a web server that serves files
Fortigate SSL VPN 3.x With PINsafe Installation Notes
Fortigate SSL VPN 3.x With PINsafe Installation Notes Table of Contents Fortigate SSL VPN 3.x With PINsafe Installation Notes... 1 1. Introduction... 2 2. Overview... 2 2.1. Prerequisites... 2 2.2. Baseline...
Web Development CSE2WD Final Examination June 2012. (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?
Question 1. (a) Which organisation is primarily responsible for HTML, CSS and DOM standards? (b) Briefly identify the primary purpose of the flowing inside the body section of an HTML document: (i) HTML
Fortigate SSL VPN 4 With PINsafe Installation Notes
Fortigate SSL VPN 4 With PINsafe Installation Notes Table of Contents Fortigate SSL VPN 4 With PINsafe Installation Notes... 1 1. Introduction... 2 2. Overview... 2 2.1. Prerequisites... 2 2.2. Baseline...
E-Blocks Easy Internet Bundle
Page 1 Cover Page Page 2 Flowcode Installing Flowcode Instruction for installing Flowcode can be found inside the installation booklet located inside the Flowcode DVD case. Before starting with the course
Animated Lighting Software Overview
Animated Lighting Software Revision 1.0 August 29, 2003 Table of Contents SOFTWARE OVERVIEW 1) Dasher Pro and Animation Director overviews 2) Installing the software 3) Help 4) Configuring the software
07 Forms. 1 About Forms. 2 The FORM Tag. 1.1 Form Handlers
1 About Forms For a website to be successful, it is important to be able to get feedback from visitors to your site. This could be a request for information, general comments on your site or even a product
HTML Tables. IT 3203 Introduction to Web Development
IT 3203 Introduction to Web Development Tables and Forms September 3 HTML Tables Tables are your friend: Data in rows and columns Positioning of information (But you should use style sheets for this) Slicing
Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence
Web Development Owen Sacco ICS2205/ICS2230 Web Intelligence Introduction Client-Side scripting involves using programming technologies to build web pages and applications that are run on the client (i.e.
Intell-a-Keeper Reporting System Technical Programming Guide. Tracking your Bookings without going Nuts! http://www.acorn-is.
Intell-a-Keeper Reporting System Technical Programming Guide Tracking your Bookings without going Nuts! http://www.acorn-is.com 877-ACORN-99 Step 1: Contact Marian Talbert at Acorn Internet Services at
Implementing Specialized Data Capture Applications with InVision Development Tools (Part 2)
Implementing Specialized Data Capture Applications with InVision Development Tools (Part 2) [This is the second of a series of white papers on implementing applications with special requirements for data
By Glenn Fleishman. WebSpy. Form and function
Form and function The simplest and really the only method to get information from a visitor to a Web site is via an HTML form. Form tags appeared early in the HTML spec, and closely mirror or exactly duplicate
HP LoadRunner. Software Version: 11.00. Ajax TruClient Tips & Tricks
HP LoadRunner Software Version: 11.00 Ajax TruClient Tips & Tricks Document Release Date: October 2010 Software Release Date: October 2010 Legal Notices Warranty The only warranties for HP products and
Your First Web Page. It all starts with an idea. Create an Azure Web App
Your First Web Page It all starts with an idea Every web page begins with an idea to communicate with an audience. For now, you will start with just a text file that will tell people a little about you,
Real-time Device Monitoring Using AWS
Real-time Device Monitoring Using AWS 1 Document History Version Date Initials Change Description 1.0 3/13/08 JZW Initial entry 1.1 3/14/08 JZW Continue initial input 1.2 3/14/08 JZW Added headers and
Hypercosm. Studio. www.hypercosm.com
Hypercosm Studio www.hypercosm.com Hypercosm Studio Guide 3 Revision: November 2005 Copyright 2005 Hypercosm LLC All rights reserved. Hypercosm, OMAR, Hypercosm 3D Player, and Hypercosm Studio are trademarks
SA-9600 Surface Area Software Manual
SA-9600 Surface Area Software Manual Version 4.0 Introduction The operation and data Presentation of the SA-9600 Surface Area analyzer is performed using a Microsoft Windows based software package. The
MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC
MyOra 3.0 SQL Tool for Oracle User Guide Jayam Systems, LLC Contents Features... 4 Connecting to the Database... 5 Login... 5 Login History... 6 Connection Indicator... 6 Closing the Connection... 7 SQL
CIS 467/602-01: Data Visualization
CIS 467/602-01: Data Visualization HTML, CSS, SVG, (& JavaScript) Dr. David Koop Assignment 1 Posted on the course web site Due Friday, Feb. 13 Get started soon! Submission information will be posted Useful
Spectrum Technology Platform
Spectrum Technology Platform Version 8.0.0 SP2 RIA Getting Started Guide Information in this document is subject to change without notice and does not represent a commitment on the part of the vendor or
Konica Minolta s Optimised Print Services (OPS)
Konica Minolta s Optimised Print Services (OPS) Document Collection Agent (DCA) Detailed Installation Guide V1.6 Page 1 of 43 Table of Contents Notes... 4 Requirements... 5 Network requirements... 5 System
HTML Form Widgets. Review: HTML Forms. Review: CGI Programs
HTML Form Widgets Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back to the web server Forms allow web servers to generate
EZblue BusinessServer The All - In - One Server For Your Home And Business
EZblue BusinessServer The All - In - One Server For Your Home And Business Quick Start Guide Version 3.8 1 2 3 EZblue Server Overview EZblue Server Installation EZblue Server Configuration 4 EZblue Magellan
Application Note: AN00141 xcore-xa - Application Development
Application Note: AN00141 xcore-xa - Application Development This application note shows how to create a simple example which targets the XMOS xcore-xa device and demonstrates how to build and run this
Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner
1 vk» Java 7 Recipes (,\['«** - < g!p#«josh Juneau Carl Dea Freddy Guime John O'Conner Contents J Contents at a Glance About the Authors About the Technical Reviewers Acknowledgments Introduction iv xvi
Apple Applications > Safari 2008-10-15
Safari User Guide for Web Developers Apple Applications > Safari 2008-10-15 Apple Inc. 2008 Apple Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system,
Introduction to XHTML. 2010, Robert K. Moniot 1
Chapter 4 Introduction to XHTML 2010, Robert K. Moniot 1 OBJECTIVES In this chapter, you will learn: Characteristics of XHTML vs. older HTML. How to write XHTML to create web pages: Controlling document
Smoking and any food or drinks are not permitted in the Applications Lab!
220 Lab C Introduction to Cisco IP Telephony Pre-Lab Activities: None Purpose of the experiment: To explore the Cisco IP Telephony System configuration options, and its use. Smoking and any food or drinks
Introduction to Web Design Curriculum Sample
Introduction to Web Design Curriculum Sample Thank you for evaluating our curriculum pack for your school! We have assembled what we believe to be the finest collection of materials anywhere to teach basic
jquery Tutorial for Beginners: Nothing But the Goods
jquery Tutorial for Beginners: Nothing But the Goods Not too long ago I wrote an article for Six Revisions called Getting Started with jquery that covered some important things (concept-wise) that beginning
EZblue BusinessServer The All - In - One Server For Your Home And Business
EZblue BusinessServer The All - In - One Server For Your Home And Business Quick Start Guide Version 3.11 1 2 3 EZblue Server Overview EZblue Server Installation EZblue Server Configuration 4 EZblue Magellan
Introduction. How does FTP work?
Introduction The µtasker supports an optional single user FTP. This operates always in active FTP mode and optionally in passive FTP mode. The basic idea of using FTP is not as a data server where a multitude
Hello World RESTful web service tutorial
Hello World RESTful web service tutorial Balázs Simon ([email protected]), BME IIT, 2015 1 Introduction This document describes how to create a Hello World RESTful web service in Eclipse using JAX-RS
Web Development on the SOEN 6011 Server
Web Development on the SOEN 6011 Server Stephen Barret October 30, 2007 Introduction Systems structured around Fowler s patterns of Enterprise Application Architecture (EAA) require a multi-tiered environment
The purpose of jquery is to make it much easier to use JavaScript on your website.
jquery Introduction (Source:w3schools.com) The purpose of jquery is to make it much easier to use JavaScript on your website. What is jquery? jquery is a lightweight, "write less, do more", JavaScript
Dynamic Web-Enabled Data Collection
Dynamic Web-Enabled Data Collection S. David Riba, Introduction Web-based Data Collection Forms Error Trapping Server Side Validation Client Side Validation Dynamic generation of web pages with Scripting
Building a Multi-Threaded Web Server
Building a Multi-Threaded Web Server In this lab we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous
Chapter 14: Links. Types of Links. 1 Chapter 14: Links
1 Unlike a word processor, the pages that you create for a website do not really have any order. You can create as many pages as you like, in any order that you like. The way your website is arranged and
Fig (1) (a) Server-side scripting with PHP. (b) Client-side scripting with JavaScript.
Client-Side Dynamic Web Page Generation CGI, PHP, JSP, and ASP scripts solve the problem of handling forms and interactions with databases on the server. They can all accept incoming information from forms,
Term Paper. P r o f. D r. E d u a r d H e i n d l. H o c h s c h u l e F u r t w a n g e n U n i v e r s i t y. P r e s e n t e d T o :
Version: 0.1 Date: 20.07.2009 Author(s): Doddy Satyasree AJAX Person responsable: Doddy Satyasree Language: English Term Paper History Version Status Date 0.1 Draft Version created 20.07.2009 0.2 Final
Portals and Hosted Files
12 Portals and Hosted Files This chapter introduces Progress Rollbase Portals, portal pages, portal visitors setup and management, portal access control and login/authentication and recommended guidelines
How to test and debug an ASP.NET application
Chapter 4 How to test and debug an ASP.NET application 113 4 How to test and debug an ASP.NET application If you ve done much programming, you know that testing and debugging are often the most difficult
TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO
TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO some pre requirements by :-Lohit Jain *First of all download arduino software from www.arduino.cc *download software serial
DiskPulse DISK CHANGE MONITOR
DiskPulse DISK CHANGE MONITOR User Manual Version 7.9 Oct 2015 www.diskpulse.com [email protected] 1 1 DiskPulse Overview...3 2 DiskPulse Product Versions...5 3 Using Desktop Product Version...6 3.1 Product
An Introduction to MPLAB Integrated Development Environment
An Introduction to MPLAB Integrated Development Environment 2004 Microchip Technology Incorporated An introduction to MPLAB Integrated Development Environment Slide 1 This seminar is an introduction to
How To Understand The History Of The Web (Web)
(World Wide) Web WWW A way to connect computers that provide information (servers) with computers that ask for it (clients like you and me) uses the Internet, but it's not the same as the Internet URL
SiteCelerate white paper
SiteCelerate white paper Arahe Solutions SITECELERATE OVERVIEW As enterprises increases their investment in Web applications, Portal and websites and as usage of these applications increase, performance
CEFNS Web Hosting a Guide for CS212
CEFNS Web Hosting a Guide for CS212 INTRODUCTION: TOOLS: In CS212, you will be learning the basics of web development. Therefore, you want to keep your tools to a minimum so that you understand how things
Andover Continuum Remote Communication Configuration Guide
Andover Continuum Remote Communication Configuration Guide 2010, Schneider Electric All Rights Reserved No part of this publication may be reproduced, read or stored in a retrieval system, or transmitted,
ThinPoint Quick Start Guide
ThinPoint Quick Start Guide 2 ThinPoint Quick Start Guide Table of Contents Part 1 Introduction 3 Part 2 ThinPoint Windows Host Installation 3 1 Compatibility... list 3 2 Pre-requisites... 3 3 Installation...
V.I.P. Kit. Video Insight Pilot Kit. (Video Insight Pilot Kit).
V.I.P. Kit (Video Insight Pilot Kit). Video Insight Pilot Kit Please follow these instructions and everything should go very smoothly. Before you begin, you will need to establish (or obtain from your
LICENSE4J AUTO LICENSE GENERATION AND ACTIVATION SERVER USER GUIDE
LICENSE4J AUTO LICENSE GENERATION AND ACTIVATION SERVER USER GUIDE VERSION 1.6.0 LICENSE4J www.license4j.com Table of Contents Getting Started... 2 Server Roles... 4 Installation... 9 Server WAR Deployment...
GreenEye Monitor Setup Guide V1.0 Brultech Research Inc.
GreenEye Monitor Setup Guide V1.0 Brultech Research Inc. Latest GEM Software and Manuals: - http://www.brultech.com/gem/files/gem_files.zip - NOTE: To run GEM Setup, the JRE (Java Run-Time Engine) must
JISIS and Web Technologies
27 November 2012 Status: Draft Author: Jean-Claude Dauphin JISIS and Web Technologies I. Introduction This document does aspire to explain how J-ISIS is related to Web technologies and how to use J-ISIS
CPSC 226 Lab Nine Fall 2015
CPSC 226 Lab Nine Fall 2015 Directions. Our overall lab goal is to learn how to use BBB/Debian as a typical Linux/ARM embedded environment, program in a traditional Linux C programming environment, and
Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1
Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1 1 Contents Accessing the SAI reports... 3 Running, Copying and Pasting reports... 4 Creating and linking a report... 5 Auto e-mailing reports...
