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 : AXE

May 20nd

HOWTO: Install ActiveX Scripting Support in ActiveState Python

Filed Under: ASP, AXE, IIS, Python

In order to save me time in the future trying to figure out how to install ActiveX Scripting Support in ActiveState Python, here's a little reminder.

  1. Download Microsoft Visual C++ 2008 SP1 Redistributable Package http://www.microsoft.com/en-us/download/details.aspx?id=5582.
  2. Download ActiveState Python http://www.activestate.com/activepython.
  3. Download Python for Windows Extensions http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/.
  4. Install everything in the same order.
  5. Execute C:\Python27\Lib\site-packages\win32comext\axscript\client\pyscript.py

That's it! Enjoy!

Read More. No comments made.

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 18th

Fixing Classic ASP Request.QueryString Unicode (UTF-16) bypass

Filed Under: ASP, AXE, Javascript, Optimization

Thanks for the great power of Twitter and TweetDeck, yesterday I was pointed to a terrifying bug in Request.QueryString method in the standard Classic ASP installation. THIS BUG DOES NOT EXISTS IN MY AXE FRAMEWORK (see the tests in the end).

Only God knows why for some mystical reason and under certain conditions Request.QueryString method do some automatic homoglyph (like α→a, τ→t) and homophone (like π→p) transformations in the incoming Unicode (UTF-16) QueryString helping unoccupied folks to XSS and SQLI your beloved application. Basically this stupid transformation implies that there are a lot of potential Unicode characters that can be used as '<' and ''' making the life of exploiters easier. For more information about this bug, read NoScript New Bypass Method by Unicode in ASP and Lost in Translation (ASP’s HomoXSSuality).

Since Microsoft isn't very active in supporting ASP nowadays, I've no clue if they will move a finger to fix this (usually they still release security patches). So I'm giving you Classic ASP developers the chance and the knowledge to fix this issue. Create a file named base.asp in your project and put the following code inside:

function AXE_GET(k) {
    var v = "",
        q = Request.ServerVariables("QUERY_STRING");
    try {
        v = decodeURIComponent(q);
        v = Request.QueryString(k);
    } catch(Ex) {
        var c = String(q).split('&'),
            j = k + '=';
        for(var i = 0, len = c.length; i < len; i++) {
            if( c[i].indexOf(j) === 0 ) {
                v = c[i].substring(j.length);
            }
        }
    }
    return v;
}

Add this file to your application library (hope you made a request mapper):

<script runat="server" language="javascript" src="/lib/axe/base.asp"></script>

And replace all your Request.QueryString calls to AXE_GET:

dim name : name = Request.QueryString("name")' from this
dim name : name = AXE_GET("name")' to this

That's it, you are safer than before :D

Demo

Read More. 3 comments.

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 11th

Enable IIS6 gzip compression to maximum AXE performance

Filed Under: ASP, AXE, IIS, Optimization, Windows

I've recently configured a lot of Windows 2003 servers to run our e-commerce system and remembered that both the built-in configuration of IIS6 and the IIS6 GUI aren't friendly for a proper gzip/deflate compression of our modern file extensions. That's why I'm writing this tutorial which will make your box compress css, js, json, xml and aspx files the way you probably want it. This will also helpeful if a new type of file happen to appear in the future.

Changing the W2K3 interface for best performance

This guide gives a very straight forward step-by-step approach for W2K3 servers running with Classic Start Menu interface. Because I consider that "My Computer" icon incredible useful in a lot of single machine managing scenarios. To enable it, just right-click the Taskbar, click Properties, click Start Menu tab, select Classic Start menu radio button and click OK.

Set up the IIS Compress Service

  • Starting from a clean Desktop (WIN+D), right-click My Computer, click Manage
  • Expand Services and Applications, expand Internet Information Services (IIS) Manager, right-click Web Sites, click Properties
  • Click Service tab, select both Compress application files and Compress static files, select Limited to (in megabytes), set it's input text to 1024 and click OK.

Set up the metabase.xml

  • Open an console (WIN+R, type cmd and click OK)
  • Execute in the console the commands below:
iisreset /stop
notepad c:\windows\system32\inetsrv\metabase.xml
  • Search for "IIsCompression"
  • Set both deflate and gzip sections with the following properties:
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
html
xml
xslt
js
json
css
txt"

HcScriptFileExtensions="asp
aspx
dll
exe"
  • Execute in the console the commands below:
iisreset /start

That's it, your server should be compressing the files now! Enjoy the performance!

Read More. No comments made.

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.

May 29nd

Projects are now on GitHub

Filed Under: Application, AXE, Framework, GEdit, Miscellaneous, Optimization, Plugins

github/nagaozen screenshot

Better late than never! From now on, all my recent open-source contributions will be available at my github.com account. The current projects are:

  • ASP Xtreme Evolution (my ASP framework)
  • Exuberant-ctags (updates to make it's ASP parsing better)
  • Gedit-* (a lot of good things for gedit)
  • GTKSourceView-2.0 (updates to add/enhance language.specs)
  • jquery-vs-mootools (this one is an interesting article I translated)

Although this blog isn't being informative and updated as I think it should be, I'm currently very active and developing a lot of things but not writing much about it. Watching my git account will help you to keep the track of the latest updates in my software development. Enjoy!

Read More. 1 comment.

Jan 18th

Logomark and Icons for AXE

Filed Under: AXE, Design, Framework, Standards

Almost a year has been passed from the first release of AXE and from that to today the project still haven’t it’s own logomark or icons to be used as faveicon. But today, I spent my morning trying to solve this issue. Look, I’m no professional designer, but did my best in this task and liked the result. For the icons I tried to make it compatible with the Tango Icon Guidelines to guarantee a good contrast for both dark and bright backgrounds. I would love to know what you all like or dislike about it. Here’s the final art:

ASP Xtreme Evolution logo

Well, about the new version of AXE, I’m a bit busy working on another project and have no time to polish it. But the enhancements are huge and I hope to have a new version in the next 1 or 2 months.

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 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.

May 14th

A subversion system for ASP Xtreme Evolution

Filed Under: AXE, Framework, Optimization, Server

I’ve created a SVN for ASP Xtreme Evolution at DevjaVu so, everyone interested in this project can now use a subversion client like Tortoise to checkout the lastest version of the project. Users can also post new tickets and give suggestions through the trac. I hope that this initiative make a more Open Source face to ASP Xtreme Evolution Framework and make it ready for other developers to join the work.

Read More. 2 comments.

Jan 26nd

Meet ASP Xtreme Evolution

Filed Under: Application, ASP, AXE, Framework, IIS, Optimization, Standards, Server

ASP Xtreme Evolution

ASP Xtreme Evolution

This is a Classic ASP MVC URL-Friendly Framework based in some of the current best pratices like:

It also provides support for missing features that is commonly required:

  • Image manipulation
  • JSON support
  • Upload management
  • Zip management

Read More. 1 comment.