4.11.2013

QR Code dynamic URL working example using ColdFusion

Follows a simplified for better understanding Coldfusion webpage, a working example of how the trick is done:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

<cfchart name="myChart"
       format="png"
       scalefrom="0"
       scaleto="10"
       yaxistitle="Number of students"
       xaxistitle="Grade" chartwidth="620"
       chartheight="375"
       showlegend="true"
       databackgroundcolor="##C9DEFA"
       seriesplacement="default">
     
      <cfchartseries
          type="bar"  markerstyle="circle"
          serieslabel="Female"
          seriescolor="##FFC0FF">
        <cfchartdata item="A" value="121">
        <cfchartdata item="B" value="200">           
        <cfchartdata item="C" value="485">
        <cfchartdata item="D" value="60">
        <cfchartdata item="E" value="20">
        <cfchartdata item="F" value="15">
        <cfchartdata item="Absent" value="2">
        <cfchartdata item="Need assistency" value="9">
      </cfchartseries>

      <cfchartseries
          type="bar"  markerstyle="circle"
          serieslabel="Male"
          seriescolor="##3333FF">
        <cfchartdata item="A" value="321">
        <cfchartdata item="B" value="123">           
        <cfchartdata item="C" value="345">
        <cfchartdata item="D" value="43">
        <cfchartdata item="E" value="50">
        <cfchartdata item="F" value="20">
        <cfchartdata item="Absent" value="5">
        <cfchartdata item="Need assistency" value="2">
      </cfchartseries>
</cfchart>

<cfset myFile="#GetDirectoryFromPath(GetBaseTemplatePath())#">

<cfset myFile=myFile.concat("myChart.png")>

<cffile action="WRITE" file="#myFile#" output="#myChart#">

    <cfdocument format="pdf" filename="#GetDirectoryFromPath(GetBaseTemplatePath())#report.pdf" overwrite="true" name="fileContent">

    <center>
    <h2>Schoolar Performance by sex</h2>
   
    <img src="myChart.png">
   
    </center>
    </cfdocument>

<cfloop condition="#FileExists('#GetDirectoryFromPath(GetBaseTemplatePath())#report.pdf')# eq false">     
</cfloop>

<cflocation url="report.pdf">

</body>
</html>
</body>
</html>


Although there´s no query feeding the chart, it could. But for speeding up the availability of this post I decided to publish as it is.

The concept is really, really simple. You grab data from a database. Put it inside a PDF, waits for the PDF to be available on disk and then redirects the browser to it.

This web page will be resting in your web site ready to be triggered. Another step of the process is to get the URL address and make a QR Code from it. Then you publish the QR Code image somewhere.

When someone points a cell phone camera to it, it will deliver to the person consolidated data, always updated, because it is being generated dynamically.

Hope to have improved people´s lives with this.

Comments are very welcome!



QR Code dynamic generated report


In my last post I wrote about a different use for QR Codes. I proposed to generate a PDF report dynamically using a web application that grabs the data from a database and make it available to download on a cell phone through the use of a QR Code.

The idea is to trigger a web application routine by pointing our cell phone camera to the QR Code.
 
Following my last article I will now show a working example of the concept.
 
The image you see above is a QR Code that can be read by any cell phone. There´s nothing new on it.

The news is that when your cell phone reads this image, it will take you to a link that has a functionality. This link will run a program that queries a database, grabs some data, put it on a chart, saves everything into a PDF document and then sends it back to you.

But the concept can go far beyond that. QR Code dynamic generated report is just the beggining. You can perfectly make the program to do an insert in a database table, and then create two QR Codes, one representing and answer "yes" and the other representing the answer "no". Then you have the possibility to make a poll in a newspaper, for example, where the readers could participate by pointing their cellphone devices to one of the choices.

Ok, you might say that people could just log into a web site and click on some radio buttons and it would be equivalent. But see how much hassle was taken off the process: you wouldn´t have to open your cell phone browser. You wouldn´t have to type a web site address. There would be no need to log into the system also, neither you would have to click on the option of your choice.

It is far more natural and quick to scan a QR Code printed on the newspaper and by then getting your vote computed.

We could do elections with this. It is a totally new world, ready to be explored.

In my next post I will show you how it is done, in Coldfusion 8.

See you!
 

4.10.2013

A revolutionary approach in QR Code usage

Although widely adopted in product boxes on supermarket shelves, week magazines pages, outdoors, real state annoucement videos, tourist guides and so on, QR Code is still unknown to a large number of people.

QR Code is a two dimensional black and white bar code. It was first developed to be used in printed media, being its main goal to take the reader to a web site. This way, someone may get more information on the subject that grabbed his attention on the first place.

QR Code is read by smartphones cameras. Any cheap smartphone nowadays comes embedded with a bar code reader application by default.

A QR Code in a product box, for example, can bring a customer to a website that describes the product features, shows a brief history about the manufacturer, the way it was developed, where they get their feedstock, in other words: a place where the consumer can get a deeper knowledge about what he is buying.


In some cases you may get the product itself from the QR Code. For example, it is now possible to get a pizza from a restaurant pamphlet delivered in your mail box.


Some historical monuments have QR Codes on informative metal plates through which people may get extra data about that tourist attraction.


There is a huge number of uses for QR Code. But what every one of them have in common is to take someone from the real, physical world to the virtual one, that is, make someone access a website related to the subject.


In a quick Google search it is easy to find lists of creative uses for QR Code. But generally speaking it is pratically considered common sense not to use QR Code on eletronic media. That would be against its main purpose.

Why show a QR Code in an eletronic media if its goal is to take the user there? The user is already there. So it is considered that there´s no point in this approach.


But on a second thought... What if QR Code was used do take the user, not to a website home page, but to a download link?


This way if the user points his cell phone camera to the computer monitor, a file would be automatically transferred to the device. This would cause a curious feeling that the file is "jumping" out of the monitor directly to the cell phone.  But that´s just the tip of the iceberg.

Just imagine url addresses that create PDF reports or Office documents, statistics, data consolidation, or any product which has the end user as a consumer. Through the use of this QR Code technology, allied to web systems and databases, it is now possible to offer to our clients to access information without even logging into a system.

It is like taking the data "for a walk outside". This way we are breaking the physical limits between the data and the end user, the consumer of the information.

An user could open an Excel sheet on his cellphone, just by pointing its camera to a QR Code. Even a printed one.

People on a meeting could get a presentation immediately  during an event, by pointing their devices to a QR Code on the projector big screen.


Imagination here is the limit. With a little creativity it is possible to invent great uses for this innovative idea.


A step by step explanation is shown in the picture below:















I think that what we see here is a paradigm shift. The explained idea creates a totally different approach in systems development, making possible for the user consume information without the need of a computer graphical interface. This way, we would be creating a new form of relationship in computer science.


It would be possible to offer to the user a kind of menu (printed, like a restaurant menu), where he would see the printed QR Codes, all labeled with subtitles, for example: List of downtown buildings with accessibility, quarterly results chart, John Smith´s presentation, company´s contact list. And the user would choose what he want to get on his cellphone.



About this last example, I highlight the fact that it would be possible to ally this new approach to colaborative work (as in the web 2.0 concept). That would be a form in which data that being produced on the fly, by many co-workers typing on computer systems, would generate a consolidated product, that could after be consumed by everyone in the organization.



We can use this idea to change radically the way we work, produce and also the way how our users consume our systems.


About the author: Luiz Milfont (IT Systems Specialist).


12.08.2012

The bottom line: avoid bootlenecks!



After a decade of experience working with fine tuning of web systems, I can say without a doubt that the phrase that titles this first blog post perfectly encapsulates the idea of which is the optimization of systems that require high availability and performance.

It happens that, like any service made available to a wide audience with finite channels, there is a tendency to formation of bottlenecks, which are the biggest enemy of the uninterrupted flow of the process.
 
During the 2012 London Olympic games, organizers took advantage of a philosophy known as "go with the flow", in which eventually gave up the collection in a train station, for example, if the process of buying tickets could cause a congestion at the station exits (worth clarifying that in London you inset a ticket to exit from the station). They prioritized (occasionally) the uninterrupted flow of passengers at the expense of revenue, but the idea was to avoid risky situations that would arise if it were a bottleneck been installed.

The same principles can (and should) be applied in web systems that need a high uptime.

Importantly, like the possible decrease in revenues in the train stations of London during the games of the general public, there will be situations where you need to choose what shall relinquish the process, rather than something of similar importance, considering the main goal the success of the process as a whole.

As the father of modern chemistry, Antoine Lavoisier, once said "in nature, nothing is created, nothing is lost, everything is transformed." In computer would be no different. So the question really is, ultimately, an art adjustment cost / benefit.

In future posts I will show various concepts and techniques that can be applied to any computer system that requires high availability, regardless of programming language (and that's the beauty of it).

Information that are worth gold.

Stay tuned!