Sriram Krishnan (Moved to http://www.sriramkrishnan.com/blog)

Search. Usability. Virtual machines.Geek stuff

<October 2008>
SuMoTuWeThFrSa
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678


Navigation

Subscriptions

News

Link blog
Technorati Profile
The Blogs I read
Creative Commons Licence
This work is licensed under a Creative Commons License.


Sunday, July 18, 2004 - Posts

PHP vs ASP.NET

This has to be the funniest article that I've ever read - comparing PHP 5 and ASP.NET. I was tempted to comment on it - but I thought I'd let people read it for themselves. But I couldn't resist the following -

The author has given a code sample comparing database access in PHP and ASP.NET to show  how much easier PHP coding is (he feels the multi-language support in ASP.NET makes it more complex)

Here are his code samples

 

class oracle_object {
  protected $theDB;
  protected $user;
  protected $pass;
  protected $db;

  function __construct($u, $p, $d) {
    $this->user = $u;
    $this->pass = $p;
    $this->db = $d;
  }

  function db_open () {
    $theDB  =  @OCILogon($this->user,  $this->pass,  $this->db);
    db_check_errors($php_errormsg);
  }

  function db_close() {
    @OCILogoff($theDB);
    db_check_errors($php_errormsg);
  }

  function __destruct () {
    print ("so long...");
  }

}
And the ASP.NET code -

 

Imports System
Imports System.Data
Imports System.Data.OracleClient
Imports Microsoft.VisualBasic

Class Sample

  Public Shared Sub Main()

    Dim oraConn As OracleConnection = New OracleConnection("Data Source=MyOracleServer;Integrated Security=yes;")

    Dim oraCMD As OracleCommand = New OracleCommand("SELECT CUSTOMER_ID, NAME FROM DEMO.CUSTOMER", oraConn)

    oraConn.Open()

    Dim myReader As OracleDataReader = oraCMD.ExecuteReader()

    Do While (myReader.Read())
      Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", myReader.GetInt32(0), myReader.GetString(1))
    Loop

    myReader.Close()
    oraConn.Close()
  End Sub
End Class
Just wondering - the ASP.NET actually does some work like querying the database - and it has almost the same number of lines of code! Somebody needs to come up with better code comparisons!

posted Sunday, July 18, 2004 11:11 PM by sriram

An early exploiter

On the topic of my early websites, what you see in the previous post is a cleaned-up version of my site. My real first site was a monster with tons of Javascript which abused IE to try and make you set my site as the homepage as well as add it to the favorites. It did this on loading and unloading - making it a big pain. Another nasty piece of JavaScript that I had put in was something like this

window.open(document.location);

Now, a piece of code like this in the unload event handler can make sure that no one leaves your website (almost). I remember people battling with over 50-60 windows trying to shut down my website!

After finishing my masterpiece work in HTML, I posted a message on the www.webpagesthatsuck.com forum,asking people to evaluate my website. I posted the message and forgot to check it for 2 days - I was so sure that no one would bother commenting on my site.

When I actually *did* check the forum, I got the shock of my life - my post was at the top of the forum with a flaming icon next to it - it had gotten over 100 replies. Overnight, my site counter jumped from around 35 to around 2500. Reading through the replies, I wanted to go hide somewhere. With my website (and its JavaScript code), I had managed to crash around 25 computers not to mention causing a lot of people a LOT of pain.

One comment I remember really well is from a guy who had viewed my website on a Mac. I had a childish piece of JavaScript which tried to disable right-click (I thought this act would protect my source code - what did I know back then?). This guy said something like this -

..I can understand why you might want to disable right click - but please do realize that the Mac doesn't have a concept of a right mouse button. No amount of damn clicking works on your site! Thanks to you, I lost over 3 hours of Photoshop work...

As you can probably imagine, I silently cleaned up my site and prayed that no body from that forum would find my house :-)

 

Another Disclaimer : All this happened around 4 years ago when I was first learning computers - my web development efforts are a lot better nowadays.:-)

posted Sunday, July 18, 2004 10:32 PM by sriram

My first site

While playing around with the Wayback machine, on a whim I typed in the URL of my first-ever website - back in the days when I was trying to grok the complex inticacies of HTML and Javascript. I was pleasantly surprised to see that the home page has been archived - but none of the links work though :-(

Anyway, a nice peek into my past

http://web.archive.org/web/20011004144349/www.geocities.com/sriram_2001/

 

Disclaimer : I was a real kid back then - as you can probably make out. But this didn't a lot of people from actually mailing me about the site back then

posted Sunday, July 18, 2004 10:20 PM by sriram




Powered by Dot Net Junkies, by Telligent Systems