Thursday, August 25, 2011

Cloud Computing

Hi All,

Today I am going to explain some basic Amazon Cloud service theories what i have learned by browsing hundreds of web pages [May be more than 200 ;) ].

As you know, simply cloud computing is a way of sharing services (such as Processing power, Storage, Applications etc  ) by thousands or millions of computers. advantages are vast extensibility, scalability , cost effective and many more when it consider with other technologies.

Amazon, AT&T are the most famous and top cloud computing service providers in the IT market. Amazon provides following Cloud services for their customers.
  1. Amazon S3 - (Simple Storage Service) as storage service
  2. Amazon EC2 - (Elastic Compute Cloud) as computing service to share, manage, speed-up the computing power
  3. Amazon SQS - (Simple Queue Service) for messaging purposes
  4. Amazon SDB - (Simple DB) to store simple data sets

To manage and communicate with above services it provides API for each and every service. To access the above services it is required to sign up on http://aws.amazon.com/cloudfront/ .  you can compare prices and rates of these services on http://aws.amazon.com/cloudfront/pricing/ link. You can pick up the services according to your requirement and continue the sign up. after successful registration process they provide you a control panel to manage your services what you have picked up as services. this is all about the basic explanation about cloud computing.

Have a nice day !

Wednesday, August 10, 2011

Mongodb couldn't connect to server 127.0.0.1 shell/mongo.js:79

Hi all again,

You may familiar with the following error message if you have used mongodb.

couldn't connect to server 127.0.0.1 shell/mongo.js:79


The thing happened their is, the mongodb has not started. there are several reasons not starting the mongodb.
 1. crashing the mongodb - Mongodb has not properly shutdown by the User who used.
 2. Mongodb does not own advanced crashing mechanism on the system.
 3. Permission - There will not be permission to run the Mongodb for the current user.

First of all verify the proper reason why it is not starting. open a terminal and try the following steps
 1.  Open a terminal
 2.  Type status mongodb 
            - if it shows "mongodb stop/waiting" - try following
                 - Type on terminal
                         sudo start mongodb
                         status mongodb
                         If it says still "mongodb stop/waiting" means you need to proceed step 3. Other than that                                              
                         if it says "mongodb start/running" means the mongodb is running and you can simply
                         type "mongo" on same terminal and have fun.
 3. Check the log file of the mongodb which is located on /var/log/mongodb/mongodb.log. check
      whether you have
      "  old lock file: /var/lib/mongodb/mongod.lock.  probably means unclean shutdown
          recommend removing file and running --repair
         see: http://dochub.mongodb.org/core/repair for more information  " text at the end of the file. it says    
      it is required to repair the mongodb
 4. remove the file located on /var/lib/mongodb/mongod.lock as below.
     sudo rm /var/lib/mongodb/mongod.lock
 5.  Try the following lines on the terminal.
     sudo -u mongodb mongod  -f /etc/mongodb.conf --repair
 6. type status mongodb and this time it should displays
     mongodb start/running, process XXX
 7. It says mongodb has started and ready to run. type mongo on terminal and it should be connected now!

Thanks !

Asoka

Thursday, June 9, 2011

Visual Studio 2010 does not support in Crystal reports ?

I was working on a Project and we used Visual Studio 2010 Ultimate release for the dev environment. Our basic requirement is making  windows app which can communicate over SOAP and the plan was to use C#.NET, MS SQL Server 2008,  IIS, and VS integrated Crystal report for reporting purpose.

Several teams work on the project and and I was in R n D division. we develop some tools and requirements parallel  way and the most important components including.

When the time comes for the reporting side and there were many complaints raised regrading the the Crystal report. The problem was VS 2010 doesn't provide crystal report anymore with same package. but it says it can be downloaded from the crystal supporting site and they have done as it says and nothing happened !

The story behind the Crystal report and the VS 2010 is something like this. CR hasn't meet the deadlines and they didn't provide the deliverable stuff when the MS asked !

MS and CR all must understand what they are doing and which thing to do and which to not ! We did not expect the service like this from CR either MS. specially MS must responsible to even announce what they have and what the do not ! Utilities taken from the CR download page totally a mess. it even didn't run on developers PC.(they use Win 7)see how many people waste their time and helpless for want of enough support ! I have experience on MS technologies for 4 years. but I have frustrated about the support from both parties. (I guess this is why I love LAMP dev environment so much !) . so think twice before implementing something specially a Company like MS !

Thanks!

Asoka

Tuesday, May 10, 2011

Creating a Web site on LAMP environment


Hi guys,

I am using Zend studio as my development environment and I would like to show you how to configure your local environment to run a web site on your local machine. I assume you have install Apache as web server, php and mysql on your machine. ;) oky here we go....

First of all create your php project in your local path. On may computer my path is/home/asoka/Zend/workspaces/Defaultworkspaces/testwebsite

now add a index.php file and add below code in the file . Echo “Hi.. my test web site is working....” . Now the index.php page should looks like below.

<?php
echo “Hi.. my test web site is working....”;
?>

now open a (linux) terminal. In my environment it locates Applications > Accessories > Terminal. Type the below command on terminal.

vi /etc/apache2/sites-available/testwebsite

hit enter and the terminal displays empty file and hit insert button on your keyboard and add the below lines in the file.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName testwebsite.loc
ServerAlias www.testwebsite.loc
DocumentRoot /home/asoka/Zend/workspaces/Defaultworkspaces/testwebsite
<Directory /home/asoka/Zend/workspaces/Defaultworkspaces/testwebsite/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
hit shift+: and type wq. Hit enter. Now type the below command in terminal.
a2ensites testwebsite. It will create link to sites-enabled folder.

Again type the below few lines on your terminal. (lot of commands right? I love terminal so much. :D)

cd /etc/ hit enter
vi hosts
it should looks like below


101.2.188.6 sobiz5 # Added by NetworkManager
127.0.0.1 localhost.localdomain localhost
::1 sobiz5 localhost6.localdomain6 localhost6
127.0.1.1 asoka-Aspire-4741
127.0.1.1 sobiz10.loc www.sobiz10.loc
127.0.1.1 emobile.loc www.emobile.loc
127.0.1.1 testwebsite.loc www.testwebsite.loc
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

in that file I have added below line. (it has bolded)

127.0.1.1 testwebsite.loc www.testwebsite.loc

hit shift+: and type wq. Hit enter. Now again on terminal enter the below few lines

/etc/init.d/apache2 restar. If it fails to restart saying Failed, log in to the terminal as a root by typing su
enter. Enter the root password and try to restart the apache by typeing /etc/init.d/apache2 restart.

We have almost done the configuration part. Now open your browser and type www.testwebsite.loc. If the browser displays “Hi.. my test web site is working....” means your web site is working. If it doesn't happen drop an email to edussooriya.a@gmail.com to assist you. Happy coding !

Sunday, May 1, 2011

Mounting Disk Partition in Linux Shell


cd /media/
mkdir testDrive
cd /dev/disk/
ls
it will list by-id by-path by-uuid
here I choose to list disk drives by-uuid. (note : all the disk partitions are listed in /dev/disk/ and those partitions can be listed according to by-id, by-path, by-uuid [which has assigned by Kernel itself].)
cd by-uuid/ hit enter
type “ls” and hit enter.
it will list partitions similer way to following

0a35d9f2-d2d0-4e3e-8f93-226ec5c10f3c
2ce1f005-ca67-41a5-92f0-55db859c0f6b
c519dea0-3ceb-41a1-97a1-1971ed5eacf5
c8291cf2-39a8-4e1e-9067-e03f804baf76

in my PC 3 partitions I have. One partition is for Kernel reserved file system.
Now we are going to mount a partition to the /media/testDrive which we created at beginning.
mount 2ce1f005-ca67-41a5-92f0-55db859c0f6b /media/testDrive/

now type cd [space] and hit enter

again cd /media/ testDrive/

type ls and it will list the files on the mounted partition. Have fun !

Tuesday, February 8, 2011

Process and Child process in C

When understanding the very basic concepts of Computer hardware and operating systems it is really required to get good knowledge about Process. It is required to know the difference between Process, Child process even what is the process really called.
First of all I am going to explain about the process. "A Process is a execution of a Program or a Task". If you simply create a Hello world application it has a Process. when the program executes the process begins and it end when the program close or force to stop.
Child process is also an execution of a Program but it's generated by a Process not a Program. You have generated because of your parents. so you are child and they are parents of your. like wise the child process same as the above example. child process generates it because of a Process.

Hope this post will be a help for you. in next post i am going to show you the basic logic behind creating Process and child Process

Thanks!
.NET Guru

Wednesday, November 17, 2010

Modeling an Object

Today i am going to model a simple object using C#.NET. first i stated that object is a physical thing that has properties and methods. Now i am going to model a Car object as follow.

1. First Define the object

class Car
{

      // this is the body of the Car object

}

 2. Define class members

class Car
{
      private string _model = string.Empty();    // model of the car
      private string _engine_capacity=string.Empty();    // engine capacity of the car
      private string _year=string.Empty()   // year of the manufacture

}


  3. Define properties - to get the details and set them to the above defined members

 class Car
{
      private string _model = string.Empty();    // model of the car
      private string _engine_capacity=string.Empty();    // engine capacity of the car
      private string _year=string.Empty()   // year of the manufacture 
      

      // 1. Model Property
      public string Model
      {
            get{ return _model;}
            set{ _model = value;}
       }
    
     // 2. Capacity Property
     
      public string EngineCapacity
      {
            get{ return _engine_capacity;}
            set{ _engine_capacity= value;}
       }
     
     //3. Year Property

      public string Year
      {
            get{ return _year;}
            set{ _year= value;}
       }

}

  4. We have defined Properties of the Car object. now i am going to add some methods / actions which can perform by Car Object




 class Car
{
      private string _model = string.Empty();    // model of the car
      private string _engine_capacity=string.Empty();    // engine capacity of the car
      private string _year=string.Empty()   // year of the manufacture 
      

      // 1. Model Property
      public string Model
      {
            get{ return _model;}
            set{ _model = value;}
       }
    
     // 2. Capacity Property
     
      public string EngineCapacity
      {
            get{ return _engine_capacity;}
            set{ _engine_capacity= value;}
       }
     
     //3. Year Property

      public string Year
      {
            get{ return _year;}
            set{ _year= value;}
       }

      public void Drive()
      {
           Console.WriteLine("Drive the Car");
      }

      public void ChangeGear()
      {
           Console.WriteLine("Change the gear");
      }

      




}