Saturday, August 30, 2008

Failed to Access IIS Metabase

I have created a web setup application for an ASP.NET web application. It installs the application fine in my computer but when I try to run the installed web application the following error message appeared.

System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase. The process account used to run ASP.NET must have read access to the IIS metabase (e.g.
IIS://servername/W3SVC). For information on modifying metabase permissions, please see
http://support.microsoft.com/?kbid=267904.

For some reason IIS do not give read access to ASP.NET to its metabase.

What was the reason?

And then I remembered that I have installed IIS after installing Visual Studio 2005. So that meant there was a good possibility that IIS and ASP.NET didn't register each other properly. Now I had to find out a way to do that.

Well, back to the good old Internet for that. I gave abit of a search and found out what to do for the matter. The solution turned out to be a pretty straigh forword one.

This is what you do

  • Go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  • Then find "aspnet_regiis.exe"
  • Go to Start > Run
  • Type "cmd" and press Enter to go to the command prompt
  • Type cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and Enter
  • Type "aspnet_regiis -i" and Enter
  • Give it a moment to install
  • And that's it. Your web application will run without the above error.

Thursday, July 31, 2008

A Problem When Running a Java Program

I had recently installed Java 6. And it compiled the source file fine. Then when I tried to run the compiled file it gave the following error.

D:\Java\Examples>javac HelloWorld.java

D:\Java\Examples>java HelloWorld
Exception in thread "main" java.lang.NoClassDe fFoundError: HelloWorld
Caused by: java.lang.ClassNotF oundException: HelloWorld
at java.net.URLClassLo ader$1.run( Unknown Source)
at java.security. AccessController .doPrivileged( Native Method)
at java.net.URLClassLo ader.findClass( Unknown Source)
at java.lang.ClassLoad er.loadClass( Unknown Source)
at sun.misc.Launcher$ AppClassLoader. loadClass( Unknown Source)
at java.lang.ClassLoad er.loadClass( Unknown Source)
at java.lang.ClassLoad er.loadClassInte rnal(Unknown Source)

Now I was wondering what went wrong? I mean, I know that it compiled fine. But it refused to run. So what to do? I tried compiling and running a different source file. Nope the answer is the same. And then I compiled and tried to run a source file that I was really sure that was error free which happens to be HelloWorld.java. The same error occured.

What is the point of being a programmer if you can't run HelloWorld in java?

Then I thought I would need some expert advice on the matter. So I posted the matter to a lecturer at the institute where I study for BIT. This is the reply that I got.

To immediately solve this problem, you can delete the "classpath" variable in Environment variables list. Try in this manner, System properties--> Advanced --> Environment Variables --> Select "classpath" and Delete it.

So I did exactly that and all the java programs are running fine since then.

Monday, June 23, 2008

Classes

A class is the fundamental element of OOP.

So what is a class?

Well, Object Oriented Programming (OOP) is based on creating and manipulating objects. To create these objects classes are used. A class is basically a definition for an object. It will define the characteristics of the object that will be created using that class. In other words a class is a mould that is used to create an object.

A class consists of attributes and methods. Attributes will hold data and methods will process those data to give the required output.

Basically OOP has three fundamentals when defining classes.
  • Encapsulation
  • Inheritance
  • Polymorphism


Encapsulation

This means hiding or restricting access to certain data within the class by the outside world. This is done by using access modifiers. These access modifiers will define what part of the program has access to that specific data and what is not. Access modifiers will differ slightly according to the programming language. “Public” and “Private” are two access modifiers that you can find in almost all OOP languages.

When you define a method or an attribute as public it means that methods outside the class can also access those methods or attributes. When you give the private modifier to an attribute or a method, it means that only methods inside the class can have access.


Inheritance

Inheritance normally means one class inheriting the attributes and methods of another class. So when you create an object from the class that object will have attributes of the inherited class as well as the attributes of the class that is used to create that object.


Polymorphism

Polymorphism means many forms. In classes this is exactly what is done using this concept. Polymorphism is used to manipulate methods. And there are two basic ways of dealing with polymorphism.

Overloading
This means that you can define many methods with the same name but with different method
signatures. Remember, OOP doesn’t allow two methods with the same signature to be in the
same class.

Overriding
When you inherit a class and create another, you can define methods with the same signature
as the methods in the inherited class, in the class you define. This will override the
functionality of the method in the inherited class.

Tuesday, June 17, 2008

Object Oriented Programming

Object Oriented Programming or shortly known as OOP is a programming concept, in which the structure of the program is designed as objects representing real life objects in the business case.

OK, here is what it really means.

When you create programs using OOP what you do is that you categorize the logic of the whole program into objects.

Think that you are building a program for registering students for courses. Then you can define objects such as Student, Registration Officer and Course. The important thing to remember when you define objects is that they should actively participate in the program.

In OOP programming, logic is handled by objects. When you take an object it consists of following categories.

  • Properties - Define how the object will look.
  • Methods - Define how the object will behave.

Take the above student registration system. If you take the Student object it has properties such as

  • Name
  • Age
  • Gender
  • Date of Birth

And it has methods such as

  • Select Course
  • Pay Money
  • Get Balance


OOP is easier to implement because it normally represent the real world inside the computer. After defining objects it is a matter of manipulating them in a logical manner to achieve the desired output.

How do you define objects?

Well how do you create a ceramic vase if you given the job?

You would first create a mould to create the vase. Won’t you?

The same applies to creating objects.

The mould for an object is called a Class.

Monday, May 26, 2008

Databases

Databases are an intricate part of many programs. It is essential for a programmer to learn about databases. Databases are used to store and manage large volumes of data. When it comes to business applications a database is a must.

Choosing a database software depends on your application. A simple data driven application such as an Address Book can be completed using Access. But when it comes to handling data with larger volume and complexity you will have to turn to an enterprise level database.

When it comes to enterprise level databases there are many database software that can be used. Following are a few of them.


Microsoft SQL Server





This is one of the databases that most of programmers use due to its ease of use. SQL Server has several versions to suit the need of the programmer. And there is also a Free SQL server 2005 Express Edition that can be downloaded from SQL Server official site.



Oracle



One of the most powerful database software that is available. And also one of the most expensive. And configuration can be a bit difficult unless you are an Oracle DBA. Oracle Enterprise Manager is not that user friendly either.

You can use a third party software to manage Oracle.






MySQL



This is the most affordable database for all users. It's free. MySQL is great to work with PHP to create web enabled applications and web sites.

There are also several third party tools to manage the database.

Wednesday, May 14, 2008

Programming Languages

To do programming there are few things that you need.

First of all you need a programming language.
(That is the wh
ole point. Isn't it?)
A compiler or an interpreter. This depends on the approach you take. Or in other words what programming language that you are going to use and for what purpose.

There is a wide selection of programming languages to go for. Following are some significant ones.


Microsoft Visual Studio 2005





This is a widely used IDE for programming. It supports an array of programming languages such as C#,VB,C++,J# and ASP.NET for web development. Notice that this is an IDE(Integrated Development Environment) so it is made to do programming faster and make the life easier for programmers.
It has drag and drop user interface design,
Easier database connectivity,
Easier API(Application Programming Interface) integration and
Easier management of source files.
One more thing that I like about VS 2005 is it's debugger that allows you to view a complete profile of an object while in the debug mode and the ability to view inside dataset objects while debugging the code.
VS 2005 is meant to be used with the .NET Framework. The .NET Framework consists of an assortment of libraries that can be directly used for coding. Using the .NET Framework save time and gives the ability to create programs with a little amount of code. But the downside is that in order to run programs using the .NET Framework you need to have it installed in the computer.
These features are great but keep in mind these are intended for easing up the programming work. To really learn you have to get down and do the coding by your self. Auto generated code means a little when you come to learning.


Java



Java is the preferred language for web developers and for cross platform development. Java do not compile the program to machine language right away. Instead it compile the source file into an intermediate file called Java Byte Code. This byte code is then executed using the JVM(Java Virtual Machine) or the JRE(Java Runtime Environment).

OK now, what is JVM and JRE?
These are used to interpret java byte code into machine code of the computer . It can be defined as a computer within a computer. All java programs run on top the virtual machine. Only the virtual machine can understand the java byte code. And here is the thing. When you want to run the program in a different platform you don't need to recompile the code. The java virtual machine of that platform will execute the java byte code without much problem. Notice that only the virtual machine is changed according to the platform and once compiled java code can run platform independently. JVM and JRE differs slightly. The JVM is the virtual machine that runs java byte code and the JRE consists of the JVM and some additional libraries for support.

When using java there are some IDEs that can be used.








PHP



This language is used for programming web applications. PHP is a scripting language and requires a web server with php module to execute the code. It is a very powerful and an easy to use language. And best of all it's free.

Thursday, May 8, 2008

Exploring and Expanding

Exploring for new stuff and expanding the realm of your knowledge is very important for a programmer as well as anyone else.

You have to be updated constantly and I think the best place for that is the Internet. It is an ocean of knowledge. The only problem is "Where to look for?".


Well the best place to start is a Search Engine. Type in your question and give it a search.

When you want to learn something try looking for Books and Video Tutorials. Video tutorials are one of the best ways to learn.

And look for Forum Posts.

When you keep searching you'll find easy ways, shortcuts to find what you need. Don't give up because the answer you wanted didn't appear in the first page of the search engine results. Most of the time the problem is that you haven't asked the right question. Keep on searching. Shuffle the words around a bit and do the search again.

When you are searching for technical things use technical details and wordings to do the search. When you are searching for errors use the error code instead of the error message. This can give better results.

And when you find something that is valuable in the Internet keep a bookmark. This is very important, otherwise you will have to do the search again when you want to find it at a later time.


Keep up the good work and keep surfing.

Wednesday, May 7, 2008

The Learning Curve

Everyone has to start somewhere. Don't they?
Well yeah...

The learning goes on and on when it comes to IT industry. The problem is that it keep growing and changing in an alarming rate. Some times faster than the speed that someone can catch up with it.

Well for an example, consider that there is a new software that you are dying to try out. But before having a go at it you have to learn how it works, what are the functionalities and what are the potentials. You may spend some quality time learning these and when you are done and finally ready to take the plunge, the software company rolls out a newer version of the software.

DARN!!!

It is the same story when it comes to Programming languages, APIs and even Games

So what on earth is there to do about this?

Well there are few things that can be done.

First of all don't go for the coolest high end features at the beginning. Instead learn the basics. Because whether it is a software or a language there are fundamentals, and fundamentals don't change frequently. So dig deep and find the foundation of the program. That is to say find the very basic things that you can do with it. I know those things are nothing compared to the full potential of the program. But remember learning the basics is the most important thing. After you master the basics you can easily move on to more advanced stuff.
For programming don't go for a heavily facilitated IDE at the beginning. IDEs are made to do work easily and efficiently. It is something like a wrapper around a programming language. When you are using an IDE you are interfacing with the IDE instead of the language. So the true nature of the programming language is overlooked.
So when you are learning a programming language learn the core functionalities of it. Compile and run using a command prompt for some time instead of using a one click compile and run method. It can be difficult at the beginning, but the final result will justify the effort you put into it.

After you get to know the basics the learning process will get easier. Now you will understand the behavior of the programming language or the software for that matter. Now you are on a solid foundation and you can start learning the rest. Try using an IDE to ease up your work load and keep learning.

The field of programming is always full of new and fascinating events. Search the web to gain more knowledge. Read books. Share your knowledge with others and most of all enjoy what you are doing.

Tuesday, May 6, 2008

Welcome

Hello there and WELCOME to my blog space.

I will be posting valuable things that I have learned during my work as a Programmer.
I'm working as one for nearly 2 years now, developing web based financial applications.

Pretty BORING, don't you think?
It was for me too at the beginning.

Actually it's not that boring. OK there is a ton of business logic to handle, which still after 2 years makes little sense to me. But nevertheless there is programming and that is something I understand. And it is fun to solve a problem or two in programming. It is like winning a war and trust me it is winning a war when you come across a nag in code.