Tuesday, September 27, 2011

Syntaxhighlightning 3.0

I like blogger, it allows me to change the html template which in turn allows me to add custom javascript. I looked for a way to highlight code in a blog. For me the obvious way is to use the client i.e. javascript to do the job to highlight code. And of course there are dedicated folks that has done the job -  alex.gorbatchev@gmail.com is one of them that has created SyntaxHighlighter. Thanx to him this task is a peace of cake to achieve.

An example, I have imported CSS and javascript that Alex so kindly shared on Amazon S3, use and donate, it is worth it. Then wrap the code in PRE tags with a style that define the language in use. Following code example actually uses Alexs syntax highlighting for Javascript:

    /**
     * SyntaxHighlighter
     */
    function foo()
    {
        if (counter <= 10)
            return;
        // it works!
    }

Monday, September 26, 2011

Opt-in, not opt-out!

The SMTP protocol don't have any concept of opt in or opt out. The serious companies that want to inform their presumptive customer of their products and services use an opt-out policy that enables the process for recipients to kindly ask the sender to not send any more mail to them. The not so serious companies use this opt-out mechanism to confirm that the mail address is active and send even more spam to the recipient.

This is one of many reasons that leaves the ISP and mail providers to only one solution, to use RBL and other automatically spam filter mechanism to remove unwanted mails from the users mailboxes. For example there are several solution that uses blacklist technologies (real time blacklists) that blocks out domain and IP-addresses that has been marked as suspected origins of SPAM.

Unfortunately this removes and stops wanted mail as well, i.e. false positives. And this is the main problem and utterly the end of SMTP as an mail distributing protocol. A mail sent with SMTP is not deterministic. As long as the operators of the infrastructure of SMTP uses non deterministic mail filters SMTP will not be a good enough protocol to send important mail that need to delivered to the recipient, note that even if the spam filter did not remove wanted mail, SMTP is not a fail safe protocol, but it could be good enough to prevail it's death.

If the mail operators had a white list, or opt-in-list, and the mail-infrastructure always guaranteed that white listed addresses never where removed, it may have been a little better world, but this does not solve the problem, the sender address can be faked, there is no mechanism in the SMTP protocol (that I know of and is widely spread) that authenticate the sender. So we are back to squere one, to use RBL and "smart" filters.

But if there is a way of authenticate the user? Yhe, the problem is who is the best fit organization to authenticate you, and what technologies shall we use? There is one thing to be authenticated and an other thing to be the guy you claim to be. Thawte, Verisign ans such, has the muscles, and the technology to give all people a certificate that proves that you are you. It would be allot more job to send spam to a server that white list public keys, you have to either fool Verisign that you are some else or hack a certificate. But this has a major flaw, people don't want to register a certificate at Verisign, it's to expensive, to abstract and to much work to keep track of your personal ID just to send a mail!

But there is other means to communicate through internet! Is there a network where people are white-listed and authenticated and large enough to manage to send message all around the globe? Yes there is, and it may come more of them, the first is Facebook. The authentication mechanism is there, you have to log in, and the best part is that the mechanism that proves that you are you, is your friends and not Verisign. Facebook has many clever things and one of them is the culture at Facebook that encourage people to use their real name, and not a random alias, this makes it easier for peoples to confirm your legitimacy, the second thing is that you opt-in peoples to your network i.e. whit liest your friends to communicate with you.

Other network that has this features is LinkedIn and Google+

My question is when do Facebook, Google+ or LinkedIn realize this, that they can be a distribution mechanism for mail, that grantee mail delivery without the side effect of SPAM?
(If you don't see mail from your friends as SPAM :)

One problem with this is that neither Google+ or Facebook is considered as a professional networks, but LinkedIn are.. Who knows who is going to be the first?

A vision of this could be a plugin to popular mail clients, like Outlook and phone apps where you can "Seal" mail or "Guarantee deliver" to recipients that you chose. The plugin use their API to prove and deliver the mail to the recipient, in transition Facebook and such network can use SMTP at the recipient end to deliver a mail that force the recipient to confirm that he/she has received the mail and at the same time suggest that they also use the plugin to make this process easier.

Eventually SMTP will not be used anymore for serious mail delivery, and all SMTP mail will be considered as suspected spam if the mail is not delivered from one of the "Sealed distribution networks", i.e. LinkedIn, Facebook or Google+

Thank SMTP for your time, you have been a good friend, and your intention were always good.

Monday, September 12, 2011

ASP.net inline tags

Here is short reference of the inline tags in ASP.net.  I had to type them down, now that Razor has been introduced in ASP.net MVC3 I’m start to get confused.. I did go crazy when I tried to find the reference for the <%: %> tag … I decided to write them all down..

Thanx Mike Banavige
I Copy parts from http://forums.asp.net/post/1828702.aspx

<% %>An embedded code block is server code that executes during the page’s render phase. The code in the block can execute programming statements and call functions in the current page class.
http://msdn2.microsoft.com/en-gb/library/ms178135(vs.80).aspx

<%= %> most useful for displaying single pieces of information.
http://msdn2.microsoft.com/en-us/library/6dwsdcf5(VS.71).aspx

<%# %> Data Binding Expression Syntax.
http://msdn2.microsoft.com/en-us/library/bda9bbfx.aspx

<%$ %> ASP.NET Expression.
http://msdn2.microsoft.com/en-us/library/d5bd1tad.aspx

<%@ %> Directive Syntax.
http://msdn2.microsoft.com/en-us/library/xz702w3e(VS.80).aspx

<%– –%>Server-Side Comments.
http://msdn2.microsoft.com/en-US/library/4acf8afk.aspx

<%: %> Like <%= %> But HtmlEncodes the output (new with Asp.Net 4).
http://weblogs.asp.net/scottgu/archive/2010/04/06/new-lt-gt-syntax-for-html-encoding-output-in-asp-net-4-and-asp-net-mvc-2.aspx

<!– #include file|virtual=”filename” –>  Server side include.
http://msdn.microsoft.com/en-us/library/3207d0e3.aspx

@ directive Text template directive.
http://msdn.microsoft.com/en-us/library/xz702w3e.aspx

Sunday, September 4, 2011

ASP.net web form – a decade of wasted web crafting.


I have been around the web business since the beginning of the commercial web era i.e. 1995 and I have been making web pages and application with the most of the web tools since then. From the day ASP.net web forms were released I could not help it but I did not like it, it had an approach that gave less control to the programmer and a attitude that I should not care about the client, the framework will handle the pluming that is necessary for delivering the content to the client.
From the beginning I try to code around the framework and each time it took allot of energy and allot of time from me, the framework was supposed to help me not be in the way for me. The server event driven idea is and was the most annoying part of the framework. To pass the clients event to the server and reinvent the event there so I could use an event driven model for the client events on the server??. I don’t have anything against the event driven model in particular, just the dumb idea to send the clients event over a stateless protocol to the server. And to overcome the stateless protocol, lets serialize the state and pass it around, wow that is a good idea, not…
The main problem is that the ASP.net web form framework don’t recognize the web client as an worthy component to handle the state and UX capabilities it self. If you accept that the web client can handle the state, and use XHR to let the client call services and get a response back that can change it’s state, then the server is only a simple service that that provides simple functions. That server don’t need a complex framework of junk to be a good service to the client. God dam Microsoft invented XHR why could they not embrace it them self!