Search the Blog

Showing posts with label Processing. Show all posts
Showing posts with label Processing. Show all posts

Monday, September 7, 2020

SQL server Upgrade

 

When you upgrade to a new version of SQL Server, there are some critical things you should do to help avoid any surprise SQL Server performance issues. I mean new version  of SQL Server is 2016,2017 or 2019, Because Microsoft  closed its support up to some extent to older version


Why need the Requirement to upgrade the Version?

Basically it is because Microsoft ended Its support of some versions.

There are two type of Support

1- MainStream Support

2- Extended Support


SQL Server Versions

MainStream Support

Extended Support

SQL Server 2005

April 12, 2011

April 12, 2016

SQL Server 2008 or R2

July 8, 2014

July 9,2019

SQL Server 2012

July 11, 2017

July 12, 2022

SQL Server 2014

July 9, 2019

July 9, 2024

SQL Server 2016

July 13, 2021

July 14, 2026

SQL Server 2017

Oct 11, 2022

Oct 12, 2027

SQL Server 2019

July 1, 2025

Aug 1, 2030


For Upgrading any Version there are some preparations which need to be taken care.

1- Find the Upgrade Blockers. 

2- Clear Understanding of Version and Editions.

3- Clear Understanding of Features introduced and obsolete

3- Make a List of objects which use the features which  are obsolete from the newer version and currently in use.

4- Clear Hardware Requirement for newer Versions. 






















For this Activity i am upgrading the Server from 2012 to 2017.


Process to Upgrade the SQL Server Version.

There are 3 ways to upgrade

  1. - In-Place Upgrade

  2. - Side-by-Side Upgrade

  3. - Rolling Upgrade


Steps for an In-Place Upgrade 

In-place upgrades are the easiest to perform, but the most difficult to rollback should there be any issues. The steps involved in an in-place upgrade are as follows:

  1. Verify that backups exist for all databases (user and system). 

  2. Review the list of requirements for SQL server 2017 and install whatever is needed.

  3. Install SQL Server 2017 

  4. Restore the Backup

Side-by-Side Upgrade

  • 1- Backup all the database

  • 2-Script out any and all necessary system objects.

            3-Review the list of requirements for SQL server 2017 and install whatever is needed.

  • 4- Run the script to create the Object

  • 5-Select database(s) to migrate and it take offline. 

  • 6-Migrate database to new instance. Repeat for each database.

  •  

 

 

 

Rolling Upgrade


1- Select any High-Availability 

2- Install new Server instance 2017 and make it  as a Secondary node

3- Fail the Primary Node now New Instance will be active and will be Primary Node

 

Checklist need to Perform Before Planning to Upgrade about version of Server


1-Checking of Deprecated Features  in new version

SELECT * FROM sys.dm_os_performance_counters   WHERE object_name  = 'MSSQL$JFT:Deprecated Features   

2- Get the List top indexes which are in use maximum times in the current version.

SELECT OBJECT_NAME(IX.OBJECT_ID) Table_Name

      ,IX.name                     AS Index_Name

      ,IX.type_desc                 AS Index_Type

      ,SUM(PS.[used_page_count]) * 8     IndexSizeKB

      ,IXUS.user_seeks AS             NumOfSeeks

      ,IXUS.user_scans AS             NumOfScans

      ,IXUS.user_lookups AS             NumOfLookups

      ,IXUS.user_updates AS             NumOfUpdates

      ,IXUS.last_user_seek AS         LastSeek

      ,IXUS.last_user_scan AS         LastScan

      ,IXUS.last_user_lookup AS         LastLookup

      ,IXUS.last_user_update AS         LastUpdate

FROM sys.indexes IX

INNER JOIN sys.dm_db_index_usage_stats IXUS 

ON IXUS.index_id = IX.index_id AND IXUS.OBJECT_ID = IX.OBJECT_ID

INNER JOIN sys.dm_db_partition_stats PS 

on PS.object_id=IX.object_id

WHERE OBJECTPROPERTY(IX.OBJECT_ID,'IsUserTable') = 1

GROUP BY 

OBJECT_NAME(IX.OBJECT_ID) ,

IX.name ,

IX.type_desc ,

IXUS.user_seeks ,

IXUS.user_scans ,

IXUS.user_lookups,

IXUS.user_updates ,

IXUS.last_user_seek ,

IXUS.last_user_scan ,

IXUS.last_user_lookup ,

IXUS.last_user_update

3- Current Used Space at current instance and Available Space in the new instance.

4- Current OS Hardware Configuration.

5- Scripting of all user defined Objects.

 

Thursday, August 15, 2019

Arduino code ultrasonic sensor with processing code


Ultrasonic RADAR Demo Project

Ultrasonic Sensor:


An ultrasonic sensor is an instrument that measure the distance to an object using ultrasonic sound waves.
An ultrasonic sensor uses a transducer to send and receive ultrasonic pulses that relay back information about an object’s proximity.
High-frequency sound waves reflect from boundaries to produce distinct echo patterns and return in varoius direction
Arduino code ultrasonic sensor with processing code


Processing Application :

Processing is a flexible software sketchbook
application and a language for learning how
to code within the context of the visual arts.
Since the, Processing has promoted software
literacy within the visual arts and visual
literacy within technology. There are tens
of thousands of students, progrmmers, artists,
designers, researchers, and hobbyists who use
Processing for learning and prototyping.

Please Visit this for more Information
#define echoPin 7
#define trigPin 8
#define LEDPin 13
int maximumRange = 200; // Maximum range needed
int minimumRange = 0; // Minimum range needed
long duration, distance; // Duration used to calculate distance via some mathmatical formuls

void setup() {
 Serial.begin (9600);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
 pinMode(LEDPin, OUTPUT); // Use LED indicator (if required)
}

void loop() {
/* The following trigPin/ echoPin cycle is used to determine the
 distance of the nearest object  by bouncing the soundwaves off of it. */
 digitalWrite(trigPin, LOW);
 delayMicroseconds(2);

 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);

 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);

 //Calculate the distance (in cm) based on the speed of sound and time.
 distance = duration/58.2;

 if (distance >= maximumRange || distance <= minimumRange){
 /* Send a negative number to computer and Turn LED ON
 to indicate "out of range" */
 Serial.println("-1");
 digitalWrite(LEDPin, HIGH);
 }
 else {
 /* Send the distance to the computer using Serial protocol, and
 turn LED OFF to indicate successful reading. */
 Serial.println(distance);
 digitalWrite(LEDPin, LOW);
 }

 //Delay 50ms before next reading.
 delay(50);
}

Arduino UNO Board



Please See- In this Project i use 5 Ultrsonic Sensor








Processing code Application Code :-



import processing.serial.*;


int numOfShapes = 60; // Number of squares to display on screen
int shapeSpeed = 2; // Speed at which the shapes move to new position
 // 2 = Fastest, Larger numbers are slower

//Global Variables
Square[] mySquares = new Square[numOfShapes];
int shapeSize, distance;
String comPortString;
Serial myPort;

/* -----------------------Setup ---------------------------*/
void setup(){
 size(displayWidth,displayHeight); //Use entire screen size.
 smooth(); // draws all shapes with smooth edges.

 /* Calculate the size of the squares and initialise the Squares array */
 shapeSize = (width/numOfShapes);
 for(int i = 0; i<numOfShapes; i++){
 mySquares[i]=new Square(int(shapeSize*i),height-40);
 }

 /*Open the serial port for communication with the Arduino
 Make sure the COM port is correct - I am using COM port 8 */
 myPort = new Serial(this, "COM8", 9600);
 myPort.bufferUntil('\n'); // Trigger a SerialEvent on new line
}

/* ------------------------Draw -----------------------------*/
void draw(){
 background(0); //Make the background BLACK
 delay(50); //Delay used to refresh screen
 drawSquares(); //Draw the pattern of squares
}


/* ---------------------serialEvent ---------------------------*/
void serialEvent(Serial cPort){
 comPortString = cPort.readStringUntil('\n');
 if(comPortString != null) {
 comPortString=trim(comPortString);

 /* Use the distance received by the Arduino to modify the y position
 of the first square (others will follow). Should match the
 code settings on the Arduino. In this case 200 is the maximum
 distance expected. The distance is then mapped to a value
 between 1 and the height of your screen */
 distance = int(map(Integer.parseInt(comPortString),1,200,1,height));
 if(distance<0){
 /*If computer receives a negative number (-1), then the
 sensor is reporting an "out of range" error. Convert all
 of these to a distance of 0. */
 distance = 0;
 }
 }
}
Arduino code ultrasonic sensor with processing code




/* ---------------------drawSquares ---------------------------*/
void drawSquares(){
 int oldY, newY, targetY, redVal, blueVal;

 /* Set the Y position of the 1st square based on
 sensor value received */
 mySquares[0].setY((height-shapeSize)-distance);

 /* Update the position and colour of each of the squares */
 for(int i = numOfShapes-1; i>0; i--){
 /* Use the previous square's position as a target */
 targetY=mySquares[i-1].getY();
 oldY=mySquares[i].getY();

 if(abs(oldY-targetY)<2){
 newY=targetY; //This helps to line them up
 }else{
 //calculate the new position of the square
 newY=oldY-((oldY-targetY)/shapeSpeed);
 }
 //Set the new position of the square
 mySquares[i].setY(newY);

 /*Calculate the colour of the square based on its
 position on the screen */
 blueVal = int(map(newY,0,height,0,255));
 redVal = 255-blueVal;
 fill(redVal,0,blueVal);

 /* Draw the square on the screen */
 rect(mySquares[i].getX(), mySquares[i].getY(),shapeSize,shapeSize);
 }
}

/* ---------------------sketchFullScreen---------------------------*/
// This puts processing into Full Screen Mode
boolean sketchFullScreen() {
 return true;
}

/* ---------------------CLASS: Square ---------------------------*/
class Square{
 int xPosition, yPosition;

 Square(int xPos, int yPos){
 xPosition = xPos;
 yPosition = yPos;
 }

 int getX(){
 return xPosition;
 }

 int getY(){
 return yPosition;
 }

 void setY(int yPos){
 yPosition = yPos;
 }
}

More than 20 aurduino Project

Wednesday, August 14, 2019

Arduino Uno board code for moving bridge with for rail road and river

Arduino Uno board code for moving bridge fro railway , Road, and River Project. This kind of project is generally used in all over the world and live running. So this is good project for Science and Engineeing Students, For Submitting the educational project.





#include <Servo.h>
Servo myservo;


int val,val2,val3;
int m; 

void setup()
{
  Serial.begin(9600);
  myservo.attach(9);
}

void loop()
{sawan:
  val = analogRead(A0);
  val2 = analogRead(A1);
  val3 = analogRead(A2);
 
  Serial.println(val);
   Serial.println(val2);
    Serial.println(val3);
    if((val>val2)&&(val>val3))
    {
      m=val;
      }
      else
      {

        if(val2>val3)
        m=val2;
        else
        m=val3;
        }
  int c=m/50;
  Serial.println(c);
  if(c>10&&c<12)
  {
    goto sawan;
    }
  else
  {
  switch(c)
  {
    case 1:
myservo.write(180);
delay(2000);
break;
    case 2:
myservo.write(180);
delay(2000);
break;

     case 3:
myservo.write(180);
delay(2000);
break;
    case 4:
myservo.write(180);
delay(2000);
break;
    case 5:
myservo.write(180);
delay(2000);
break;
   case 6:
myservo.write(180);
delay(2000);
break;
   case 7:
myservo.write(180);
delay(2000);
break;
   case 8:
myservo.write(180);
delay(2000);
break;
   case 9:
myservo.write(180);
delay(2000);
break;
   case 10:
myservo.write(90);
delay(2000);
break;
   case 11:
myservo.write(90);
delay(2000);
break;
   case 12:
myservo.write(90);
delay(2000);
break;
   case 13:
myservo.write(180);
delay(2000);
break;
   case 14:
myservo.write(180);
delay(2000);
break;
   case 15:
myservo.write(180);
delay(2000);
break;
   case 16:
myservo.write(180);
delay(2000);
break;
   case 17:
myservo.write(180);
delay(2000);
break;
   case 18:
myservo.write(180);
delay(2000);
break;
   case 19:
myservo.write(180);
delay(2000);
break;
   case 20:
myservo.write(180);
delay(2000);
break;
default :
myservo.write(90);
}
  }
}


Second Program For the Same Problem

#define motor 9
#define e1 7
#define e2 6
void setup()
{
  pinMode(8,INPUT);
  Serial.begin(9600);
  pinMode(motor,OUTPUT);
  pinMode(e1,OUTPUT);
  pinMode(e2,OUTPUT);
  }


  void loop()
  {   delay(1000);
    int sensor=digitalRead(8);
 
    Serial.println(sensor);
    if(sensor==1)
    {
          analogWrite(motor,1000);
          analogWrite(e1,0);
          analogWrite(e2,0);
    }
     else
       {
           for(int i=1;i<=10;i++)
               {
                   analogWrite(motor,1000);
                   analogWrite(e1,0);
                   analogWrite(e2,255);
                   delay(100);
              }
                   analogWrite(motor,0);
                   analogWrite(e1,0);
                   analogWrite(e2,0);
 
                   sawan();
       }
   
   
       delay(1000);
   
  }
void train()
    {

           for(int i=1;i<=17;i++)
               {
                   analogWrite(motor,1000);
                   analogWrite(e1,0);
                   analogWrite(e2,255);
                   delay(100);
              }
           analogWrite(motor,0);
           analogWrite(e1,0);
                   analogWrite(e2,0);
             vivek();
      }

void vivek()

{
  delay(10000);
         for(int i=1;i<=27;i++)
               {
                   analogWrite(motor,1000);
                   analogWrite(e1,255);
                   analogWrite(e2,0);
                   delay(100);
              }
           analogWrite(motor,0);
           analogWrite(e1,0);
                   analogWrite(e2,0);
               

  }
   void sawan()
         {
          int s=100;
          while(s<3000)
          {
            delay(100);
          int sensor=digitalRead(8);
          Serial.println(sensor);
          if(sensor==0)
          {
          train();
          }
          else
          {
          s=s+100;
          }
       
          delay(100);
          }
          delay(7000);
          for(int i=1;i<=10;i++)
               {
                   analogWrite(motor,1000);
                   analogWrite(e1,255);
                   analogWrite(e2,0);
                   delay(100);
              }
                   analogWrite(motor,0);
                   analogWrite(e1,0);
                   analogWrite(e2,0);
                   loop();
        }



Arduino Uno Code for E- Dustbin

E - Dustibin is the future of world, So every developing country is now finding the ways of collecting the garbage according to their category, like plastic garbage , metallic garbage, or biodegardable and not degradable items saparately.
So to have this thing in mind we have develop a science project of moving and auto open close and E- dustbin. Which will move at predefine path and collect the garbage and also automatically opens when user comes in near to that. 


#include <Servo.h>

Servo myservo;
int arr[9];

int punnu; 

void setup()
{
  Serial.begin(9600);
  myservo.attach(9);
  pinMode(8,INPUT);
   pinMode(10,INPUT);
    pinMode(11,INPUT);
}
int sawan()
{
int sensorValue1 = analogRead(A0);
int sensorValue2 = analogRead(A1);
int sensorValue3 = analogRead(A2);
return sensorValue1+sensorValue2+sensorValue3/6;

  }
void loop()
{
  int sum=0;

  for(int i=0;i<9;i++)
    {
         arr[i]=sawan();
    }
     for(int i=0;i<9;i++)
      {
         sum=sum+arr[i];
         sum=sum/9;
         punnu=sum;
    }
 chauhan: 
  int sensorValue1 = analogRead(A0);
  int sensorValue2 = analogRead(A1);
  int sensorValue3 = analogRead(A2);
    if((sensorValue1>punnu)||(sensorValue2>punnu)||(sensorValue3>punnu))
    {
      for (int pos = 0; pos <= 180; pos += 1)
      {
        myservo.write(180);           
        delay(500);                     
      }
    }
  else
   {
     for (int pos = 180; pos >= 0; pos -= 1)
     {
       myservo.write(pos);           
      delay(5000);                   
     }
   }
goto chauhan;
}

Translate