Friday, September 29, 2006

Optimization Or Compatability ... Hard Choice!

I was reading an interview held with Shannon Hickey, the technical lead for the Swing toolkit team at Sun Microsystems. He was asked about his dream project which he would like to make one day. The answer was so impressive:

" ... As an engineer, I'd love to be able to clean up old and unused parts of the Swing toolkit and the Java programming language without having to worry about backward compatibility. It's just a dream though, because compatibility is very important to our customers and is something we take seriously. For instance, every time I fix a bug, even if I'm correcting completely wrong behavior, I must be careful not to break something for someone who is relying on that wrong behavior.

For example, I modified JTable a while back to ensure that the focused row was set to the first row whenever the table gained its first data and was then set back to -1 when the table became empty. The goal was to ensure that tables showed focus whenever possible but to correctly use -1 if they are empty. This solved numerous open bugs.

Unfortunately, within a couple of weeks, two bugs were filed against my change. It turned out that modifying the focused row fired events, and some existing client code wasn't prepared to deal with these events. Although I strongly want code to "do the right thing," I understood that we must try not to break existing code. Unfortunately, I had to pull this perfectly good code in favor of something less optimal. Now, the focused row always stays at -1, until either the developer or the user changes the selection. The funny thing is, I've seen bugs filed on this behavior since ..."

You see. It is really hard to take care of all this issues when you developing technologies others will widely use.

I like this Article - Digg it


RSS Feed Available Now!

You can keep uptodate with any post sent on this blog through the blog RSS feed. This is an XML-based file that you can use to display the blog posts in any RSS feed enabled softwares. Simply you add the blog RSS Feed to your software feeds and any new post will be displayed there.

For example, if you use Gmail, you will find a "Web Clip" bar in the top of your mail client, showing your favorites feeds. You can add all favorite feeds from different URLs and all will be dispayed in this web clip.



My Weblog RSS Feed is: http://mnour.blogspot.com/rss.xml


Microsoft Visual Studio 2005 SP1 Showing Up


Microsoft has released the Visual Studio 2005 Service Pack 1 (SP1) Beta. Visual Studio 2005 shipped in November of 2005 and this Service Pack incorporates fixes that Microsoft have addressed since that release. You can test this beta and inform Microsoft about any bugs you may find. The beta program will run until October 30th.

The fixes were mostly related to some reliability and security issues found in the last release of Visual Studio.

You can participate in the beta program by visiting: Click Here

For more information, visit: Microsoft Site


Tuesday, September 12, 2006

Google Code Jam 2006

Google Code Jam 2006 Qualification Round was started in the last 5th, September. This competition is supported by google and aims to create an international competition in programming and problem solving. Depending on the round, you got a set of problems and you will have to solve it in a certain time.

The qualification round consists of 2 problems - 250 point and 750 point problems - and you will have to solve these problems in 60 minutes. CodeJam gives you a great option to choose your favorite programming language to program with (Java, C#, VB.NET, C++ and Paython), which supports the idea of not giving much importance to the programming langauge and free the minds to solve the problem itself.

Qualification round will filter the participants to 1000 coders who will be qualified to continue to Round 1. The 1000 coders then will be filtered to be 100 who will get the prices and go to New York, USA to challenge again.

Egypt existance in Google Code Jam this year was not enough. I am sure we have so many skills out there who need to be encouraged to participate and challenge.


Thursday, July 27, 2006

Changing Web References in VS.NET 2005

.NET gives you the ability to call webservices methods within a web or desktop applications. The problem you may face is that the webservice URL can be changed and so your application may not be able to call the webservice correctly.

Each .NET project calls webservices methods will have a folder called "webreferences" which contains three files:

ServiceName.wsdl
ServiceName.disco
ServiceName.discomap

You will have to open these files with any editor, and update the URLs of the webservices with new URL or IP address.

Also, if your .NET project is web project, then you will need also to update the webservices URL in the web.config file.


Port Forwarding

If you have a server inside your LAN and you hope to access this server from WAN (ex: internet), unfortunatlly, you will not be able to access this server with out making some changes to your router configurations. So that, any requests comes from port 80 will be forwarded to the server LAN IP address.

For example, suppose you server local IP address is 198.65.1.144, and WAN address: 81.44.1.70. In your router configuration, forward any request comes on port 80 to 198.65.1.144. In this way, you will be able to access the server from the internet by addressing: http://81.44.1.70

Of course this not just for port 80, for example, you server may receives the HTTP requests on another port, say 8080. So, you do the previous steps as it is but with this port number. And you will be able to connect to server from the internet by addressing: http://81.44.1.70:8080


ASP Problem in IIS6 and Windows Server 2003

You may encounter a problem in running classic ASP in IIS6/Windows Server 2003. So you may try to test an ASP page on IIS6 and you get "Page Not Found" error. This is beacuase IIS6 by default doesn't enable any Scripting language. HTML is the only script enabled by default

To enable ASP Scripting, just open your IIS6 and on the left tree view. Click on "Web Service Extensions". The exiting extensions on the server will be listed. Click on “Active Server Pages” extension and enable it by clicking on “Allow” button. Then make a test ASP page and make sure that ASP scripting is working well.


Friday, July 21, 2006

Webservice Authentication

Suppose you have a collection of webservices resides in some server. You would like not to give a public access to these webservices. What shall you do?

Actually, you need some how an authentication mechanism to compromise the accessablity. One soultion would be to make an authentication webservice. Any client wants to access your webservices, should call it first. This webserice simply will take 2 parameters: username and password. The return value would be a hashcode.

This hash code could be used afterward in accessing any other webservice. The interfaces for example for your webservices could be something like that:

[C#]

string wsAuthenticate(string username, string password)
string wsAnyOtherWebservice(string accessCode, ... )

As you see, the returned hash code (access code) form wsAuthenticate will be used in accessing the other webservices and the client will not be able to get the service unless he have an account in your system.


Using SOAP Tool Kit 3.0 with VB Programs

Connecting to a webservice from a .NET desktop application is a piece of cake. But what about connecting to a webservice within unmanaged code - VB6/C++ programs? Actually SAOP Tool kit is the soultion. It is a Microsoft Tool used for calling webservices from unmanaged code.
You can download the kit from the Microsoft Official website:

http://www.microsoft.com/downloads/details.aspx?familyid=c943c0dd-ceec-4088-9753-86f052ec8450&displaylang=en

Here is a code snippt to call a webservice form inside VB6 program:



Dim soap As New SoapClient30
Dim serverURL as String
Dim hashCode as string

On Error GoTo ConnectionError

Public Sub WebServiceConnect

'Set Server URL
serverURL = "http://localhost/MyServiceName/Service.asmx?wsdl"

'Client is initialized
soap.MSSoapInit serverURL

'Calling the webservice
hashCode = soap.wsAuthenticate(txtUsername.Text, txtPassword.Text)

Exit Sub

ConnectionError:

MsgBox "Connection Error Encountered"

Exit Sub

The tool now is in its third version. Micorsoft declared that the SOAP tool kit 3.0 will not be supported after 31st March, 2008 because of the next generation of the Microsoft softwares will be .NET based. There will be no need to use SAOP tool kit as VS.NET gives already the ability to connect easily to webservices from the .NET desktop programs.


Wednesday, May 03, 2006

Spiders & Google Sitemaps

Internet Searching became one of the most popular services provided on the internet. Google, Yahoo, Altavista and AllTheWeb are all examples of search engines. Although, the simplicity of the searching, the inner technique used in searching is not easy as we think. Searh engines have to update their index regularlly and infiniatly.

Such engines use a special kind of softwares called “Spiders” or “Robots”. These softwares try to scan the whole internet to update their index with the new – or modified – locations, urls and contents. Depending on whatever algorithm or technqiue, “Spiders” will try extracts the keywords of the webpages content and restore the results on huge databases.

To comprehense its service, Google had provide an effective service for webmasters so that they can increase the traffic of their website. The idea is that each website will have an XML file called “sitemap.xml”, this file should be uploaded in the highest root of the FTP space of the web application. This file will include the informaton about the site pages and how they frequently changed. Here is a sample file for a small website:


<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">

<url>
<loc>http://mnour.blogspot.com</loc>
<lastmod>2006-05-01</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>

<url>
<loc>http://mnour.blogspot.com/2006/04/sql-injection-part-1.html</loc>
<lastmod>2006-05-01</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>

<url>
<loc>http://mnour.blogspot.com/2006/04/sql-injection-part-2.html</loc>
<lastmod>2006-05-01</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>

<url>
<loc>http://mnour.blogspot.com/2006/04/ajax-new-giant.html</loc>
<lastmod>2006-05-01</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>

</urlset>

While Google spiders scans the network, they will try to read this file – “sitemap.xml” – from a scanned domain. Then, it will check if any pages were modified after last time scanning this domain.

As you can notice, each “url” tag in the file contains how frequently the content of this URL will be updated. Actually, all of the webmasters will make there pages as updated hourly! thinking that this will increase there chances for being in the first results of Google. Actually, Google declared that this parameter is not taken as it’s. Maybe a URL declared as updated Montly, be indexed by Google Spiders more than another one declared as updated hourly!

This technqiue gives the benefits for the both sides: Webmasters and Google. Webmasters will be able to add their site to the serach results of most popular search engine on the net. On the other side, the technique will decrease the time needed for Google spiders to update their index.
The main drawback for this technique is for webmasters. They will have to update this file frequently after each update of their site content.