Search

11 February, 2016

Linux command

Change file permission:
sudo chmod -R 777 /var/www

04 February, 2016

Python

Class object:
file name media.py
##############
import webbrowser


class Movie():
    def __init__(self, movie_title, movie_storyline, poster_image,                  
                 trailer_youtube):
        self.title = movie_title
        self.storyline = movie_storyline
        self.poster = poster_image
        self.trailer = trailer_youtube

    def show_trailer(self):
        webbrowser.open(self.trailer)
#############
trailller.py
import class_object

movie_story = class_object.Movie("Toy story", "something missing", "image url ", 
                                 "youtube.com")

print(movie_story.storyline)
movie_story.show_trailer()

###################

Read from url:
def read_web_page():
    connection = urllib.request.urlopen(
                 "http://manozbiswas.blogspot.com/2016/02/nice-drawing-in-python.html")
    output = connection.read()
    print(output)
    connection.close()


read_web_page()
#################
Read from file:
def readText():
    quotes = open(r"C:\Users\manoz debnath\Desktop\py\hello.txt")
    contents = quotes.read()
    print(contents)
    quotes.close()


readText()
######################
Drawing image:
import turtle


def drawSquare(some_turtle):
    for i in range(1, 5):
        some_turtle.forward(100)
        some_turtle.right(90)

def drawArt():
    window = turtle.Screen()
    window.bgcolor("red")
    # Create the turtle Brad -Draws square    brad = turtle.Turtle()
    brad.shape("turtle")
    brad.color("yellow")
    brad.speed(2)
    for i in range(1,37):
        drawSquare(brad)
        brad.right(10)
    #Create turtle Angie - Draws a circle 
    # angie = turtle.Turtle() 
    # angie.shape("arrow") 
    # angie.color("blue") 
    # angie.circle(100)
    window.exitonclick()

drawArt()

#######################


Draw a square with a circle:

#################
import turtle


def drawSquare():
    window = turtle.Screen()
    window.bgcolor("red")

    brad = turtle.Turtle()
    brad.shape("turtle")
    brad.color("yellow")
    brad.speed(2)

    brad.forward(100)
    brad.right(90)
    brad.forward(100)
    brad.right(90)
    brad.forward(100)
    brad.right(90)
    brad.forward(100)
    brad.right(90)

    angie = turtle.Turtle()
    angie.shape("arrow")
    angie.color("blue")
    angie.circle(100)

    window.exitonclick()

drawSquare()

###################




03 February, 2016

Challenge and Mistakes in ERP Implementation

 7 Common Challenges Faced in ERP Implementation :
It is very important, that implementation is done in stages. Trying to implement everything at once will lead to a lot of confusion and chaos.
  1. Appropriate training is very essential during and after the implementation. The staff should be comfortable in using the application or else, it will backfire, with redundant work and functional inefficiencies.
  2. Lack of proper analysis of requirements will lead to non-availability of certain essential functionalities. This might affect the operations in the long run and reduce the productivity and profitability.
  3. Lack of Support from Senior Management will lead to unnecessary frustrations in work place. Also, it will cause delay in operations and ineffective decisions. So, it is essential to ensure that the Senior Management supports the transformation.
  4. Compatibility Issues with ERP Modules lead to issues in integration of modules. Companies associate different vendors to implement different ERP modules, based on their competency. It is very essential that there is a way to handle compatibility issues.
  5. Cost Overheads will result, if requirements are not properly discussed and decided during the planning phase. So, before execution, a detailed plan with a complete breakdown of requirements should be worked out.
  6. Investment in Infrastructure is very essential. ERP applications modules will require good processing speed and adequate storage. Not allocating suitable budget for infrastructure will result in reduced application speed and other software issues. Hardware and Software Security is also equally important.
13 Common ERP Mistakes and How to Avoid Making Them
  1. RP Mistake #1: Poor planning 
  2.  ERP Mistake #2: Not properly vetting ERP vendors.
  3. ERP Mistake #3: Not understanding or using key features.
  4. ERP Mistake #4: Underestimating the time and resources required.
  5. ERP Mistake #5: Not having the right people on the team from the start
  6.  ERP Mistake #6: Not setting priorities
  7.  ERP Mistake #7: Not investing in training and change management. 
  8.  ERP Mistake #8: Underestimating the importance of accurate data
  9.  ERP Mistake #9: Taking the kitchen sink approach.
  10.  ERP Mistake #10: Not decommissioning legacy applications.
  11. ERP Mistake #11: Not having an active load testing environment
  12. ERP Mistake #12: Ignoring third-party support alternatives 
  13.  ERP Mistake #13: Not having a maintenance strategy.

 

E-R Diagram

E-R Diagram: Best Design
An entity–relationship diagram using Chen's notation
Symbols:

Derived attributes are depicted by dashed ellipse.


 Cardinality Relationship:


Relationship with foreign key



Participation Constraints

  • Total Participation − Each entity is involved in the relationship. Total participation is represented by double lines.
  • Partial participation − Not all entities are involved in the relationship. Partial participation is represented by single lines.




Generalization:Generalization is a bottom-up approach in which two lower level entities combine to form a higher level entity. In generalization, the higher level entity can also combine with other lower level entity to make further higher level entity
Specialization:Specialization is opposite to Generalization. It is a top-down approach in which one higher level entity can be broken down into two lower level entity. In specialization, some higher level entities may not have lower-level entity sets at all.

Aggregration: Aggregration is a process when relation between two entity is treated as a single entity. Here the relation between Center and Course, is acting as an Entity in relation with Visitor.

31 January, 2016

Connection Class in c# windows form

//Method one

using System.Data.SqlClient;
 
class myConnection
    {
        public static SqlConnection GetConnection()
        {
            string str = "Data Source=MANOZ\\SQLEXPRESS;Initial Catalog=softworksbd;Integrated Security=True;";
 
            SqlConnection con = new SqlConnection(str);
            con.Open();
            return con;
        }
    }

30 January, 2016

Flow chart and code to find the largest number among three integer




#include <iostream>
using namespace std;

int main() {
    
    float n1, n2, n3;
    cout << "Enter three numbers: ";
    cin >> n1 >> n2 >> n3;
    if (n1 >= n2) {
        if (n1 >= n3) {
            cout << "Largest number: " << n1;
        }
        else {
            cout << "Largest number: " << n3;
        }
    }
    
    else {
        if (n2 >= n3) {
            cout << "Largest number: " << n2;
        }
        else {
            cout << "Largest number: " << n3;
        }
    }

    return 0;
}

29 January, 2016

Why RAM is Faster than Hard Disk

Hard Drive requires the sequential translation of information from an electro-mechanical
medium to a logical medium

RAM requires a sequential read from one logical medium to another logical medium to another.


Performance of hard disk is specified by the time required to move the heads to a track or cylinder (average access time) plus the time it takes for the desired sector to move under the head (average latency, which is a function of the physical rotational speed in revolutions per minute), and finally the speed at which the data is transmitted (data rate). In RAM the time required to read and write data items varies depending on their physical locations on the recording medium, due to mechanical limitations such as media rotation speeds and arm movement delays.

Every time you open a program, it gets loaded from the hard drive into the RAM. This is because reading data from the RAM is much faster than reading data from the hard drive. Running programs from the RAM of the computer allows them to function without any lag time. The more RAM your computer has, the more data can be loaded from the hard drive into the RAM, which can effectively speed up your computer. In fact, adding RAM can be more beneficial to your computer’s performance than upgrading the CPU. 

27 January, 2016

Generation of prime number in c

#include<stdio.h>
#include<conio.h>

int main()
{
 int num, n, div, p;
 printf("Enter any number: ");

 scanf("%d", &num);

 for(n = 2; n <= num; n++)
 {
  for(div = 2; div < n; div++)
  {
   if(n % div == 0)
   {
     p = 0;
     break;
   }
   p = 1;
  }
  if(p)
    printf("%d ",n);
 }
 return 0;
}

Generation of prime number in c

#include<stdio.h>
#include<conio.h>

int main()
{
 int num, n, div, p;
 printf("Enter any number: ");

 scanf("%d", &num);

 for(n = 2; n <= num; n++)
 {
  for(div = 2; div < n; div++)
  {
   if(n % div == 0)
   {
     p = 0;
     break;
   }
   p = 1;
  }
  if(p)
    printf("%d ",n);
 }
 return 0;
}

Generation of prime number in c

#include<stdio.h>
#include<conio.h>

int main()
{
 int num, n, div, p;
 printf("Enter any number: ");

 scanf("%d", &num);

 for(n = 2; n <= num; n++)
 {
  for(div = 2; div < n; div++)
  {
   if(n % div == 0)
   {
     p = 0;
     break;
   }
   p = 1;
  }
  if(p)
    printf("%d ",n);
 }
 return 0;
}

Generation of Prime Number in c++ according to sieve algorithm


/*
Name: Manoz Kumar Biswas
E-mail: manozcsejust@gmail.com
Start Date: 08-03-2015
Date Update:
Purpose: TO generate a long list of prime number by dynamic programming approach
Input: a list of integer numbers
Output: a list of prime numbers among the integers

*/

#include <iostream>
#include <cmath>

using namespace std;

#define SIZE 121

long int primeList[SIZE];

int main()
{
    //cout << sizeof primeList;
    for(long int i = 2; i < SIZE; i++)
    {
        primeList[i] = 1; //at first we assume all is prime and all the position is marked by 1
    }

    for(long int i = 2; i <= sqrt(SIZE); i++)
    {
        if(primeList[i] == 1)
        {
            for(long int j = i + i; j < SIZE; j = j + i)
            {
                if(primeList[j] != 0){
                      primeList[j] = 0; //all the multiples of i are set to 0 to indicate not prime
                }
            }
        }
    }

    cout << "The list of prime numbers till 121 is" << endl;

    for(long int i = 2; i <= SIZE; i++)
    {

        if(primeList[i] == 1)
        {
            cout << i << " "; //shows only the position that are prime indicated by 1
        }
    }
    return 0;
}

Factorial in c++

#include <iostream>
using namespace std;

int main() {
    int i, n, factorial = 1;

    cout<<"Enter a positive integer: ";
    cin>>n;

    for (i = 1; i <= n; ++i) {
        factorial *= i;   // factorial = factorial * i;
    }

    cout<< "Factorial of "<<n<<" = "<<factorial;
    return 0;
}
 //Using recursion
#include<iostream>
#include<conio.h>

using namespace std;

//Function
long factorial(int);

int main()
{

     // Variable Declaration
     int counter, n;

     // Get Input Value
     cout<<"Enter the Number :";
     cin>>n;

     // Factorial Function Call
     cout<<n<<" Factorial Value Is "<<factorial(n);

     // Wait For Output Screen
     getch();
     return 0;
 }

// Factorial recursion Function
long factorial(int n)
{
  if (n == 0)
    return 1;
  else
    return(n * factorial(n-1));
}
 

Fibonacci series in c++

#include<iostream>
using namespace std;

int main(){

 int n, first = 0, second = 1, third;

 cout<< "enter the number of terms " << endl;
 cin >> n;

 cout << "first "<< n << " fibonaccy series"<< endl;

 for(int i = 1; i <= n ; i++){
    if(i <= 1){
        third = i;
    }
    else{
      third = first + second;
      first = second;
      second = third;

    }
cout << third << " ";
 }

return 0;
}


First 6 fibonacci series are 

1 1 2 3 5 8

25 January, 2016

Friend functions

In principle, private and protected members of a class cannot be accessed from outside the same class in which they are declared. However, this rule does not apply to "friends".

Friends are functions or classes declared with the friend keyword.

A non-member function can access the private and protected members of a class if it is declared a friend of that class. That is done by including a declaration of this external function within the class, and preceding it with the keyword friend:


// friend functions
#include <iostream>
using namespace std;

class Rectangle {
    int width, height;
  public:
    Rectangle() {}
    Rectangle (int x, int y) : width(x), height(y) {}
    int area() {return width * height;}
    friend Rectangle duplicate (const Rectangle&);
};

Rectangle duplicate (const Rectangle& param)
{
  Rectangle res;
  res.width = param.width*2;
  res.height = param.height*2;
  return res;
}

int main () {
  Rectangle foo;
  Rectangle bar (2,3);
  foo = duplicate (bar);
  cout << foo.area() << '\n';
  return 0;
}



The duplicate function is a friend of class Rectangle. Therefore,
 function duplicate is able to access the members width and height 
(which are private) of different objects of type Rectangle. 
Notice though that neither in the declaration of duplicate nor 
in its later use in main, function duplicate is considered a member 
of class Rectangle. It isn't! It simply has access to its private 
and protected members without being a member.
}