a brief about me

My avatar
Fabio Zendhi Nagao

is an applied mathematician from IME - USP - Brazil currently working as CTO at Lojcomm Internet, a company specialized in e-commerce. + info

fields of interest: E-commerce, Collective Intelligence, Interoperability, Web 2.0, Web Design, Mathematical Programming, Pattern Recognition.

contacts: Twitter and nagaozen @hotmail.com, @gmail.com and @yahoo.com

out of date goodies

In order to help the large amount of people looking for my old widgets everyday, I'm putting below a list of the most wanted. Note that the others are still accessible at http://zendold.lojcomm.com.br/.

support my projects

If you like my free products and want to support their advancement, please consider making a small (or large!) donation or buying me a book from my Amazon wishlish.

Category : VBScript

Aug 22nd

JSON to XML

Filed Under: ASP, AXE, Javascript, VBScript

Today I'm officially augmenting my JSON2.ASP class with a toXML method which takes a Javascript object with JSON notation and returns it's XML version. My algorithm is a very fast implementation of the prof. Stefan Gössner bijective transformation between JSON and XML exposed in this article.

Example

This javascript:

var nagaozen = {
    full_name:"Fabio Zendhi Nagao",
    nickname: "nagaozen",
    gender: "male",
    age: 27,
    title: "Founder & CTO - Evolved",
    education: {
        "@active": true,
        technical: {
            location: "Federal Technique School of Sao Paulo",
            degree: "Technical data processing",
            final_work: "E-commerce framework"
        },
        undergraduate: {
            location: "University of Sao Paulo",
            degree: "BSc. Applied and Computational Mathematician",
            thesis: "Mathematical Modeling of Collective Intelligence"
        },
        graduate: {
            location: "University of Sao Paulo",
            degree: "MSc. Computing Science",
            thesis: "unknown"
        }
    },
    likes: ["Manoela", "Family (dogs included)", "Internet", "Programming", "Design", "Philosophy"],
    dislikes: [],
    a_few_aliens_i_know: {},
    contact: "nagaozen[at]evolved.com.br"
};
 

is converted into this XML:

<?xml version="1.0"?>
<human>
    <full_name>Fabio Zendhi Nagao</full_name>
    <nickname>nagaozen</nickname>
    <gender>male</gender>
    <age>27</age>
    <title>Founder &amp; CTO - Evolved</title>
    <education active="true">
        <technical>
            <location>Federal Technique School of Sao Paulo</location>
            <degree>Technical data processing</degree>
            <final_work>E-commerce framework</final_work>
        </technical>
        <undergraduate>
            <location>University of Sao Paulo</location>
            <degree>BSc. Applied and Computational Mathematician</degree>
            <thesis>Mathematical Modeling of Collective Intelligence</thesis>
        </undergraduate>
        <graduate>
            <location>University of Sao Paulo</location>
            <degree>MSc. Computing Science</degree>
            <thesis>unknown</thesis>
        </graduate>
    </education>
    <likes>Manoela</likes>
    <likes>Family (dogs included)</likes>
    <likes>Internet</likes>
    <likes>Programming</likes>
    <likes>Design</likes>
    <likes>Philosophy</likes>
    <dislikes/>
    <a_few_aliens_i_know/>
    <contact>nagaozen[at]evolved.com.br</contact>
</human>
 

Download

  • Get JSON2.ASP from inside the ASP Xtreme Evolution repository.

Read More. 1 comment.

Aug 13th

Classic ASP Orderly compiler

Filed Under: ASP, AXE, Framework, Javascript, VBScript

I believe that with today's release the ASP Xtreme Evolution Framework reaches a real maturity to handle JSON. ORDERLY.ASP leverages the power of the Orderly descriptors to your Classic ASP application. Although it's bundled with the AXE, it's modularized enough to work alone for the Orderly.parse method, which returns the JSONSchema subset, or in ensemble with JSON2.ASP which enables Orderly.compile to stringify the JSONSchema representation.

The name behind this release is Zach Carter which made Orderly.js some months ago and keep updating the project since then. The only effort from my part was to document it in the AXE way and write some examples.

Here are some examples of how to use it:

Retriving the JSONSchema subset from an orderly source

<script language="javascript" runat="server" src="/lib/axe/Parsers/orderly.asp"></script>
<%

dim source : source = join(array( _
    "object {", _
    "  string name;", _
    "  string description?;", _
    "  string homepage /^http:/;", _
    "  integer {1500,3000} invented;", _
    "}*;" _
), vbNewline)

dim Schema : set Schema = Orderly.parse(source)
Response.write( typename( Schema ) & vbNewline )
set Schema = nothing

%>

prints:

JScriptTypeInfo
 

Checking the JSONSchema stringified representation

<script language="javascript" runat="server" src="/lib/axe/Parsers/orderly.asp"></script>
<script language="javascript" runat="server" src="/lib/axe/Parsers/json2.asp"></script>
<%

dim source : source = join(array( _
    "object {", _
    "  string name;", _
    "  string description?;", _
    "  string homepage /^http:/;", _
    "  integer {1500,3000} invented;", _
    "}*;" _
), vbNewline)

Response.write( Orderly.compile(source) & vbNewline )

%>

prints:

{
    "type": "object",
    "properties": {
        "name": {
            "type": "string"
        },
        "description": {
            "type": "string",
            "optional": true
        },
        "homepage": {
            "type": "string",
            "pattern": "^http:"
        },
        "invented": {
            "type": "integer",
            "minimum": 1500,
            "maximum": 3000
        }
    },
    "additionalProperties": true
}
 

Download & Source

Read More. 1 comment.

Aug 6th

Classic ASP JSON Revisited

Filed Under: ASP, AXE, Framework, Javascript, VBScript

UPDATE: Kate Osipova kindly made a Polish version of this article. Thanks Kate.

Hi everybody! I'm currently working on three projects using AXE (ASP Xtreme Evolution) Framework and because of their high dependency on JSON I've revisited the topic Classic ASP JSON support. The great news about it is that I found Troy Forster JSON2.ASP a really promising way to work with it. Despite the work being incomplete in terms of functionality, it used a really elegant way to READ the JSON in a fancy native looking way. Plus, the library was based on the Douglas Crockford json2.js meaning it's engine is really strict to the standards.

Because of the AXE philosophy of embrace and use the great ideas born around the world in a real collaboration environment of all languages, I felt really tempted to adopt the original work of the JSON author himself and augment the AXE Framework functionality with this little piece of gold. But I couldn't replace, also it wasn't a smart move in terms of compatibility, my old full featured JSON.ASP class with other that would restrict the freedom to manipulate the Javascript object by my own will.

And that's why I coded my own version of JSON2.ASP which instantly became an integrated piece of AXE. It provides all the functionalities from the Troy Forster work but goes beyond enabling developers to augment the object with booleans, numbers, strings, arrays (using ASP safeArrays notation) and even another objects. Plus I implemented a keys method in the Object.prototype which allows the enumeration of the object keys (this modification is fine and it's also standard in ECMAScript 5) which means that it doesn't matter in which language you are programming (Ruby, Python, VBScript etc) you can use the for each loop in same way that it's available for the language in ASP.

Here are some examples of how to use it:

Reading data from JSON

<script language="javascript" runat="server" src="/lib/axe/Parsers/json2.asp"></script>
<%

dim Info : set Info = JSON.parse(join(array( _
    "{", _
    "  ""firstname"": ""Fabio"",", _
    "  ""lastname"": ""Nagao"",", _
    "  ""alive"": true,", _
    "  ""age"": 27,", _
    "  ""nickname"": ""nagaozen"",", _
    "  ""fruits"": [", _
    "    ""banana"",", _
    "    ""orange"",", _
    "    ""apple"",", _
    "    ""papaya"",", _
    "    ""pineapple""", _
    "  ],", _
    "  ""complex"": {", _
    "    ""real"": 1,", _
    "    ""imaginary"": 2", _
    "  }", _
    "}" _
)))
 
Response.write(Info.firstname & vbNewline) ' prints Fabio
Response.write(Info.alive & vbNewline) ' prints True
Response.write(Info.age & vbNewline) ' prints 27
Response.write(Info.fruits.get(0) & vbNewline) ' prints banana
Response.write(Info.fruits.get(1) & vbNewline) ' prints orange
Response.write(Info.complex.real & vbNewline) ' prints 1
Response.write(Info.complex.imaginary & vbNewline) ' prints 2
 
' You can also enumerate object properties ...
 
dim key : for each key in Info.keys()
    Response.write( key & vbNewline )
next
 
' which prints:
 
' firstname
' lastname
' alive
' age
' nickname
' fruits
' complex
 
set Info = nothing

%>

Building a JSON

<script language="javascript" runat="server" src="/lib/axe/Parsers/json2.asp"></script>
<%

dim Info : set Info = JSON.parse("{""firstname"":""Fabio"", ""lastname"":""Nagao""}")
Info.set "alive", true
Info.set "age", 27
Info.set "nickname", "nagaozen"
Info.set "fruits", array("banana","orange","apple","papaya","pineapple")
Info.set "complex", JSON.parse("{""real"":1, ""imaginary"":1}")
 
Response.write( JSON.stringify(Info, null, 2) & vbNewline ) ' prints the text below:
'{
'  "firstname": "Fabio",
'  "lastname": "Nagao",
'  "alive": true,
'  "age": 27,
'  "nickname": "nagaozen",
'  "fruits": [
'    "banana",
'    "orange",
'    "apple",
'    "papaya",
'    "pineapple"
'  ],
'  "complex": {
'    "real": 1,
'    "imaginary": 1
'  }
'}
 
set Info = nothing

%>

Download & Source

Read More. 13 comments.

Jan 2nd

Lack of updates apologize

Filed Under: ASP, Miscellaneous, VBScript

I've received emails asking me about the rest of my ASP articles and the only thing I can say for now is: "They will arrive...". Sorry I couldn't put a deadline for them 'cause while I know exactly what I want to write, it costs me a lot of time to search for the references I want to cite and currently time is not an available asset. I'm working hard on some Collective Intelligence based algorithms and documents and I must finish it until 2010.02.12, so the blog updates will be minimal. But don't worry, the articles are in the 2010 TODO queue for sure XD

Read More. 2 comments.

Jun 22nd

TDD (Test Driven Development) in ASP/VBScript

Filed Under: ASP, IIS, Standards, Server, VBScript

Introduction

This article deals with an idea that I believe to be one of the key concepts of modern programming. When I say modern, I'm referencing to methodologies that re-appeared with hype names and excessive power during the second half of the 90's and the beginning of the 21st century as an answer to the bureaucratic, slow and heavy regulated methods in use at the time. As some of their examples are: ASD(Adaptive Software Development), DSDM (Dynamic Systems Development Method), Scrum, XP(Extreme Programming) among others...

These methodologies, that were known as lightweight methods until year 2001 and then became the Agile Software Development, have some aspects in common. At first, they were "born" from the developers necessity to focus more on the product in which they're working on than in hard processes related to development. It means that, unlike the classic long-term strategies and specifications that predict and document the entire project from the beginning to the end, the development is made in small iterations, with minimal planning. Another important factor is that these methodologies are in favour of face-to-face communication rather than written documentation among the team members (which are small, around 5-9 people). Third and most important to all programmers, in my humble opinion, is the constant execution of automated tests in all steps to ensure the quality of each small unit of code they generate.

Despite being an interesting topic, I'll stop my wondering here, because it's not my goal to teach techniques to manage software teams, but to teach one of the things that all of those techniques will be require you to do. Before anything, I want to remind you that a programmer will always program, so that doesn't matter too much what methodology is adopted by the company where you are working on. For fun, below is a strip from Geek Hero Comic that was kindly provided by the author Salvatore Iovene for this article:

Agile Development Explained from Geek Hero Comic

For those who don't know yet, this is the third article of a series that I committed myself to write. Here is the list of articles:

  1. ASP, a misinterpreted technology
  2. Event-Driven-Programming and lambda function in ASP/VBScript.
  3. TDD (Test Driven Development) in ASP/VBScript.
  4. Languages: Based on Objects and Object Oriented.
  5. Object Oriented in ASP/VBScript "Hackers way".
  6. "Scripting Components", the ace in the role.
  7. Caching: the concept of DRY (Don't Repeat Yourself) applied to ASP.

If you're reading one of my articles for the first time, I strongly recommend that you read the previous ones first, because I'm trying to lead you into a great abstraction, presenting the topics incrementally.

Read More. 2 comments.

May 7th

Event-Driven-Programming and lambda function in ASP/VBScript

Filed Under: ASP, IIS, Javascript, Server, VBScript

Introduction

In this article, I'll speak a little about some issues that I believe are relevant to all modern programmers. However the examples will be written in ASP/VBScript+JScript, so I'll be coherent with the purpose of these articles, which will showcase ASP as an extremely versatile and efficient environment. Here is the list of articles:

  1. ASP, a misinterpreted technology
  2. Event-Driven-Programming and lambda function in ASP/VBScript.
  3. TDD (Test Driven Development) in ASP/VBScript.
  4. Languages: Based on Objects and Object Oriented.
  5. Object Oriented in ASP/VBScript "Hackers way".
  6. "Scripting Components", the ace in the role.
  7. Caching: the concept of DRY (Don't Repeat Yourself) applied to ASP.

If you're reading one of my articles for the first time, I strongly recommend that you read the previous ones first, because I'm trying to lead you into a great abstraction, presenting the topics incrementally.

Read More. 4 comments.

Jan 5th

Reserved Words in ASP

Filed Under: ASP, Javascript, Python, Server, VBScript

First of all, HAPPY NEW YEAR! Finally, the first entry in 2009! I’ve been working really hard in the latest days, hoping to get a release version of AXE with tons of new features like: Events, XSession, Markdown and Textile parsers and a lot lot more.

This entry is about reserved words in ASP. My current main languages to code ASP are VBScript, Javascript and Python and they are interacting perfectly under the god damn awesome Microsoft CLI. Enough talk, let’s start! The post is about the boring fact that when developing low-level code, you inevitably fall in the task of recreating something important that you feel is missing or is lacking features. You go for it, start a project and everything goes fine until you need to baptize your new child. Spent a little time thinking, you knows the perfect name, try to assign it and Bang! An error happen. This is usually related to reserved words and the devil lives in the ones that you never used and forgot about their existance because they are simply reserved words don’t have any meaning to the compiler! For a quick reference, see below a list of the reserved words of the cited languages. Rare words are in strong.

Read More. 1 comment.

Jun 10th

ASP Xtreme Evolution has been updated!

Filed Under: Application, ASP, AXE, Framework, Optimization, Server, VBScript

After some months working, finding and fixing bugs in the earlier version of ASP Xtreme Evolution, I’m proud to release the version 1.0.1.0. This is a very stable version. It comes with snippets to increase the productiveness and has some minor changes to help you to organize the code. I suggest those using the v.1.0.0.0 to upgrade as soon as possible. If you can’t upgrade, check the CHANGES in the Read More to fix your old version against the critical issues.

Read More. 8 comments.

May 30rd

String Template Class for Classic ASP

Filed Under: ASP, Server, VBScript

While I’m working with Classic ASP I always miss a lot of features that other languages provide. Sometimes it even happens between the Visual Basic and ASP, like the Mid statement, optional keyword and StrConv function. This Class provides some methods I miss more and also gives me the possibility to work with strings in a OO(Object Oriented) way. The main goal of this Object is to enable placeholders and replacements for human readable strings. Other methods are merely natural derivations from the process of work with Strings.

For more information and a lot of examples read the documentation or download the code

Read More. 2 comments.

May 16th

Tutorial: Starting with ASP Xtreme Evolution

Filed Under: Application, ASP, AXE, Framework, Mootools, Server, VBScript

One week ago Digitarald released the version 2.0 beta 4 of his very good FancyUpload component. Unfortunately I’ve noticed that many ASP and ASP.NET users were falling in trouble to implement it. In this tutorial I’ll try to cover the key things to get it working. I’ll be also using this guide to introduce new comers to ASP Xtreme Evolution development process.

Read More. 12 comments.

Mar 19th

An Akismet interface to Classic ASP

Filed Under: ASP, Server, Services, VBScript

Ok, this is the scenario: You gave your best making a beauty and useful comment form to increase your site interactiveness but like 90% of the posts are f…… spams. What to do?

Read More. 6 comments.

Feb 28nd

Encrypting data in ASP 3.0

Filed Under: ASP, Encryption, Server, VBScript

Today I’m releasing three ASP 3.0 classes to encrypt data. They are based on the Phil Fresle from Frez Systems Limited work and the algorithms available are MD5, SHA256 and Rijndael. Feel free to get’em and start encoding your passwords and other secret things.

Read More. No comments made.

Feb 18th

Improving String Performance in ASP Applications

Filed Under: ASP, Optimization, Server, VBScript

After reading http://msdn2.microsoft.com/en-us/library/ms972323.aspx and Why String Operations are so Slow, possessed by a deep feeling of duty, I’ve wrote a class that would help developers to handle their string concatenation processes in a smart way.

Read More. 3 comments.

Jan 31st

Clear Sale Web Service ASP 3.0 Integration

Filed Under: ASP, Optimization, Server, VBScript

Our business partner Clear Sale is a company specialized in behavior scoring. They withhold the major brazilian e-commerce shops as their customers. With their system, you can share a risk database with players like Submarino, Americanas and others. This database only goal is to be a source for an assertive score about the risk of a received order from your shop be or not a fraud.

The class.clearsale.asp is a Classic ASP class which provides a complete integration with their current web service. It’s licensed under the MIT License and anyone interested in using it is welcome.

Read More. No comments made.