Ubuntu experience

February 2, 2010 palash Leave a comment

to install google chrome in ubuntu are given below: http://www.ubuntugeek.com/install-chromium-google-chrome-web-browser-in-ubuntu.html

First you need to edit the /etc/apt/sources.list file

sudo gedit /etc/apt/sources.list

Add one of the following

For ubuntu 9.10 (armic) Users add the following two lines

deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main

For ubuntu 9.04 (Jaunty) Users add the following two lines

deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main

For ubuntu 8.10 (Intrepid) Users add the following two lines

deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu intrepid main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu intrepid main

Save and exit the file

Now add the GPG key using the following command

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xfbef0d696de1c72ba5a835fe5a9bf3bb4e5e17b5

Update the source list using the following command

sudo apt-get update

Install chromium using the following command

sudo apt-get install chromium-browser

share file between host ubuntu linux and windows xp using virtual box:

http://maketecheasier.com/share-files-in-virtualbox-between-vista-guest-ubuntu-host/2008/11/12

Categories: Desktop Development Tags:

Generating SSH & RSA key in ubuntu operating system

February 1, 2010 palash Leave a comment

1. Generating a SSH public/private key in ubuntu operating system:

Command line: ssh-keygen -t dsa

2. RSA key generating command line

sudo ssh-keygen -t rsa

Categories: Desktop Development Tags:

The most common pitfalls for well-formed and valid XML

January 5, 2010 palash Leave a comment

The most common pitfalls for well-formed and valid XML are given below:

  • Have one and only one root element
  • Have closing tags for every element
  • Not have any overlapping elements
  • Have all attributes enclosed in quotes

There are two separate formats for schemas supported by .NET

  • XSD – XML Schema Definition language
  • SDR – XML Data Reduced schemas.

Find out age from given date in C#

December 30, 2009 palash Leave a comment

It’s really simple. Just follow the code

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
 {
 DateTime SD = DateTime.Parse(dateTimePicker1.Text);
 DateTime DOB = new DateTime(SD.Year,SD.Month,SD.Day);
 int y = 0, m = 0, d = 0;
 FindAge(DOB, out y, out m, out d);
 label1.Text = "Year: " + y.ToString() + "\n Month: " + m.ToString() + "\n Day: " + d.ToString();
 }

 private void FindAge(DateTime DOB, out int y, out int m, out int d)
 {
 DateTime CD = DateTime.Now;
 y = CD.Year - DOB.Year;
 m = CD.Month - DOB.Month;
 d = CD.Day - DOB.Day;

 if(d < 0)
 {
 d+= DateTime.DaysInMonth(DOB.Year, DOB.Month);
 m--;
 }
 if(m < 0)
 {
 m+=12;
 y--;
 }

 }
Categories: Desktop Development Tags: ,

Deep copy in C#

December 16, 2009 palash Leave a comment

Deep Copy: A deep copy copies all fields, and makes copies of dynamically allocated memory pointed to by the fields. To make a deep copy, you must use IClonable Interface.

// Program: Deep Copy
// Purpose: Training period
// By: H.M. Saiful Islam

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DeepCopy
{
    class Program
    {
        static void Main(string[] args)
        {
            Cloner mySource = new Cloner(5);
            Cloner myTarget = (Cloner)mySource.Clone();
            Console.WriteLine("value: {0}", myTarget.MyContent.Val);
            mySource.MyContent.Val = 10;
            Console.WriteLine("value: {0}", myTarget.MyContent.Val);
            Console.ReadKey();
        }

        public class Content
        {
            public int Val;
        }

        public class Cloner : ICloneable
        {
            public Content MyContent = new Content();

            public Cloner(int newVal)
            {
                MyContent.Val = newVal;
            }

            #region ICloneable Members

            public object Clone()
            {
                Cloner CC = new Cloner(MyContent.Val);
                return CC;
            }

            #endregion
        }

    }
}
Categories: Desktop Development Tags: ,

Shallow copy in C#

December 16, 2009 palash Leave a comment

Shallow Copy: A shallow copy of an object copies all of the member field values. This works well if the fields are values, but may not be what you want for fields that point to dynamically allocated memory. The pointer will be copied. but the memory it points to will not be copied — the field in both the original object and the copy will then point to the same dynamically allocated memory, which is not usually what you want. The default copy constructor and assignment operator make shallow copies.

// Program: Shallow Copy
// Purpose: Training period
// By: H.M. Saiful Islam

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ShallowCopy
{
    class Program
    {
        static void Main(string[] args)
        {
            Cloner mySource = new Cloner(5);
            Cloner myTarget = (Cloner)mySource.GetCopy();
            Console.WriteLine("value: {0}", myTarget.MyContent.Val);
            Console.ReadKey();
        }

        public class Content
        {
            public int Val;
        }

        public class Cloner
        {
            public Content MyContent = new Content();

            public Cloner(int newVal)
            {
                MyContent.Val = newVal;
            }

            public object GetCopy()
            {
                return MemberwiseClone();
            }
        }

    }
}
Categories: Desktop Development Tags: ,

Principle of Xtreme programming

December 16, 2009 palash Leave a comment

There are some principles of extreme programming

  • Incremental planning
  • Small release
  • Simple design
  • Test-first development
  • Re factoring
  • Pair programming
  • Collective ownership
  • Continuous integration
  • Sustainable pace
  • On-site customer

Introduction of pair programming in Agile methods

December 16, 2009 palash Leave a comment

Pair programming has become popular word among software developers recently. As the name suggests, pair programming is a software development activity (writing code) which is done by two programmers. There will be only one of them writes the code and the other programmer thinks whether the code written satisfy their goals. The idea is similar with rallying where in one car there are two people. They are the driver and co-driver. The driver will drive the car and the co-driver will guide the driver to drive accurately.

Pair programming is a programming technique adopted by extreme programming or any agile software development methodologies. Some people argue that this method is a good practice. On the other hand, there are many people say that it is sorrowful. In this blog, the benefits and drawbacks of pair programming will be analyzed, to understand whether pair programming is painful or not.

Some benefits of pair programming are efficiency and increase in performance. In term of efficiency, we can cut the number of workstations as well as software licenses since we need only one workstation every two developers. However, the main advantage that people looking for in this programming approach is an improvement in developer performance. This includes an increase on the number of line of codes and reduced number of bugs or defects in the written code. This can be achieved, because one of the programmers can concentrate to write the code and another one analyzes the code which is written on the screen. If there is something wrong with the code, there is a big chance that it will be spotted during the development phase.

Although pair programming promises wonderful benefits for developers, it has some drawbacks. I believe most people will feel awkward, if they are watched by someone else when they are working. That is why we can find cubicles in many working places. Some people find that it is hard to work under tight supervision. The other problem is every human has their own style and way of thinking. This is also applied in coding style and logical flow within our source code. In my opinion, it is difficult to understand other programmer’s code or adopt their styles, especially if there is a big different in the experience and programming skills.

All of the drawbacks of pair programming are most likely caused by unmatched programmer being paired. I believe this can be solved if both programmer can get a long together and have the same level of programming skills. It will be better if both programmers come from the same programming language background since there is a big probability they will have same programming styles. It is not an easy task to pair up developers in a project.

Principles of agile methods

December 16, 2009 palash Leave a comment

Principles of agile methods are given below:

  • Customer Involvement
  • Incremental Delivery
  • People not process
  • Embrace change
  • Maintain simplicity

The Math Object of JavaScript

December 15, 2009 palash Leave a comment

There are some math objects of JavaScript are given below:

  • Math.PI: If we want use the value of PI (3.14159) in mathematical operation then we can use simply Math.PI.
var area=(Math.PI)*radious*radious;
  • abs() : The abs() method returns the absolute value of the number passed as its parameter. Essentially, this means that it returns the positive value of the number. So, -1 is returned as 1.
var num=-101;
num=Math.abs(num);
  • cell() : The cell() method always rounds a number up to the next largest whole number or integer. Ao, 10.01 becomes 11, and -9.99 becomes -9. Using ceil() is different from using the parseInt() function, because parseInt() simply chops off any numbers after the decimal point to leave a whole number, whereas cell() rounds the number up. parseInt() is a native JavaScript function and not a method of the Math object.
var num=101.01;
num=Math.ceil(num);
num= parseInt(num);
  • floor() : The floor() method removes any numbers after the decimal point, and returns a whole or integer.
  • round() : The round() method rounds up only if the decimal part is .5 or greater, and rounds down otherwise.
  • random() : The random() method returns a random floating-point number in the range between 0 and 1, where 0 is included and 1 is not. This can be very useful for displaying random banner images or for writing a JavaScript game. If we wanted a random number between 1 and 100, we would just change the code so the Math.random() is multiplied by 100.
  • pow() : The pow() method raises a number to a specified power. Math.pow(2,8)
Categories: Web Development Tags: