RSS

Monthly Archives: July 2013

Compare Two URL Strings

URL String Compare

What is the best approach to compare two URLs and determine if they are the same or not?

For example:
https://stack247.wordpress.com and stack247.wordpress.com are the same URL.
https://stack247.wordpress.com and stack247.wordpress.com are the same URL.
https://stack247.wordpress.com/tag/interview-question/ and stack247.wordpress.com/tag are NOT the same URL.

 
Leave a comment

Posted by on July 31, 2013 in General

 

Tags: , , ,

Introducing technophile.co

Stay Up-to-date With Web Technologies

Home Slide

We are launching technophile.co today! It’s a new way to stay up-to-date with web technologies. We are adding more and more technologies to our library everyday, so check it out!

What is it?

tech·no·phile (noun) \ˈtek-nə-ˌfī(-ə)l\

One who has a love of or enthusiasm for technology, especially computers and high technology.

Technophile helps developers stay up-to-date with web technologies. That is, framework, library, plug-in or language of your technology stack.

It’s a directory of web technologies that you can browse and search. Technophile is still in Beta but we are actively developing new features to provide better user experience.

The Problem We’re Trying to Solve

When it comes to web technologies, developers are facing with choices far more than our needs.

For front-end / client-side alone, there are countless JavaScript frameworks available in open source projects. A developer is also expected to master few server-side technologies, be it database, back-end, service layer and presentation. To top it all, even in our own technology stack, .Net, Java or JavaScript, there are enormous choices of framework, library and plug-in. With this excessive alternatives in web technologies, it’s next to impossible to keep up with all of them.

Then, there is a decision to be made.

We all hope to make a good decision if not a smart one. Reality is, with choices far more than we can grasp, it becomes a immensely difficult decision. It’s a decision to be made, nonetheless.

In short, we want to equip developers with knowledge of vastly-available web technologies out there to help them make a smart decision when it comes to choosing web technologies.

 
Leave a comment

Posted by on July 29, 2013 in General

 

Tags:

Denormalization

The process of attempting to optimize the read performance of a database by adding redundant data or by grouping data.

For online analytical processing (OLAP – primarily read operation) databases, redundant or “denormalized” data may facilitate business intelligence applications. In many cases, the need for denormalization has waned as computers and RDBMS software have become more powerful, but since data volumes have generally increased along with hardware and software performance, OLAP databases often still use denormalized schemas.

Source: Wikipedia: Denormalization

 
Leave a comment

Posted by on July 29, 2013 in General

 

Tags: ,

New Series of Keeping Up with The Cartesian

The Series Never Exists

Why would a programming blog care about the new series of “Keeping Up with The Kardashians”, you may ask. Well, we don’t. And, it’s actually the Cartesian, not the Kardashians. The new series never exists.

Keeping Up

When it comes to web technologies, developers are facing with choices far more than our needs. A developer is expected to master few server-side technologies, be it database, back-end, service layer and presentation. Take an example, .Net stack, there are enormous choices of framework, library and plug-in for .Net framework. It’s next to impossible to keep up with all of them. Until Now… Well, Monday, July 29, 2013 to be exact. We are introducing a new site that will help developers to keep up with all web technologies out there. Stay tune!

And yes, the title of the post has nothing to do with the content. If you happen to be curious about the Cartesion: here you go: The Cartesian Product

 
Leave a comment

Posted by on July 26, 2013 in General

 

HttpWebRequest x WebRequest x WebClient (x HttpRequest)

Differences

What are all the differences? Well, first off, let’s look at the inheritance hierarchy for each one of them.

HttpWebRequest

System.Object
    System.MarshalByRefObject
        System.Net.WebRequest
            System.Net.HttpWebRequest

WebRequest

System.Object
    System.MarshalByRefObject
        System.Net.WebRequest

WebClient

System.Object
    System.MarshalByRefObject
        System.ComponentModel.Component
            System.Net.WebClient

HttpRequest

System.Object
    System.Web.HttpRequest

Based on that findings, we know that HttpWebRequest inherits from WebRequest. They both have general purposes of sending and receiving data through a network connection. There are also FileWebRequest and FtpWebRequest classes that inherit from WebRequest. Normally, you would use WebRequest to, well, make a request and convert the return to either HttpWebRequest, FileWebRequest or FtpWebRequest, depend on your request. Below is an example:


var _request = (HttpWebRequest)WebRequest.Create("https://stack247.wordpress.com");
var _response = (HttpWebResponse)_request.GetResponse();

WebClient

WebClient provides common operations to sending and receiving data from a resource identified by a URI. Simply, it’s a higher-level abstraction of HttpWebRequest. This ‘common operations’ is what differentiate WebClient from HttpWebRequest, as also shown in the sample below:

var _client = new WebClient();
var _stack247Content = _client.DownloadString("https://stack247.wordpress.com");</code>

There are also DownloadData and DownloadFile operations under WebClient instance. These common operations also simplify code of what we would normally do with HttpWebRequest. Using HttpWebRequest, we have to get the response of our request, instantiate StreamReader to read the response and finally, convert the result to whatever type we expect. With WebClient, we just simply call DownloadData, DownloadFile or DownloadString.

However, keep in mind that WebClient.DownloadString doesn’t consider the encoding of the resource you requesting. So, you would probably end up receiving weird characters if you don’t specify and encoding.

HttpRequest

Unlike any other classes mentioned in this post, HttpRequest has nothing to do with sending and receiving data. Well, sort of. When a request is made from a client to your application, you can access this request through HttpRequest class.

In short, it’s kind of like this: HttpWebRequest, WebRequest and WebClient are client-classes which mean they are the one making a request to a resource, or a server. HttpRequest is sitting on that resource’s (or server’s) side, interpreting the request by reading its HttpRequest object.

 
Leave a comment

Posted by on July 26, 2013 in General

 

Tags:

 
%d bloggers like this: