Saturday, 23 September 2017

Tips for Email writting


1) Always have a proper subject
                                      
                Give a clear and brief subject line that showcase about the letter/message
                Ex : Parents meeting in school

2) Use simple sentences
                 Don't make your letter so fishy that people find it difficult to read and understand what                        you  have written,like using long difficult words or complex sentences etc.

3) Address the letter in formal or informal way
                 Before you write the letter to whom you are representing it to is important.
                  a friend or principle etc

4) Be careful with the language
                 Use English language while writing do not mix up your mother tongue,
                  don't  use short forms (like sms) you ( u ) would (wd) etc

5) Give a positive response
                  Whatever you write in the letter let that focus on positive points.   

Tuesday, 19 September 2017

c programs to add two numbers using cmd line arguments

-Write the code in the editors like vc edit in fedora

-Example add.c

-Save the file.

#include<stdio.h>
#include<stdlib.h>
int main(int argc, char * argv[]) {
       int i, sum = 0;

       if (argc != 3) {
              printf("You have forgot to specify two numbers.");
              exit(1);
       }
     printf("The sum is : ");
    sum= atoi(argv[1])+atoi(argv[2]);
     printf("%d", sum);
    return 0;

}


-execute the file like

C:bin> cc add.c

C:bin> ./a.out 10 20


output : 30
 

C program to add numbers and execute using cmd line arguments

-Write the code in the editors like vc edit in fedora
-Example add.c

#include<stdio.h>
void main(int argc , char * argv[])  
{
  int i,sum=0; if(argc!=3)  
{
printf("enter two numbers numbers.");  
exit(1);
  }
  printf("The sum is : ");
  for(i=1;i<argc;i++)
sum = sum + atoi(argv[i]);
printf("%d",sum);  
}

-Save the file.
-execute the file like
C:bin> cc add.c
C:bin> ./a.out 10 20

output : 30

 


Friday, 8 September 2017

wireless transfer of data from arduino to server using esp8266 with example of DHT11

#include "SoftwareSerial.h"
String ssid ="yourSSID";
String password="yourPassword";
SoftwareSerial esp(6, 7);// RX, TX

String data;
String server = "yourServer"; 
String uri = "yourURI";

int DHpin = 8;
byte dat [5];
String temp ,hum;


void setup() {
pinMode (DHpin, OUTPUT);
esp.begin(9600);
Serial.begin(9600);
reset();
connectWifi();
}

//reset the esp8266 module
void reset() {
esp.println("AT+RST");
delay(1000);
if(esp.find("OK") ) Serial.println("Module Reset");
}

//connect to your wifi network
void connectWifi() {
String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\"";
esp.println(cmd);
delay(4000);
if(esp.find("OK")) {
Serial.println("Connected!");
}
else {
connectWifi();
Serial.println("Cannot connect to wifi"); }
}

byte read_data () {
byte data;
for (int i = 0; i < 8; i ++) {
if (digitalRead (DHpin) == LOW) {
while (digitalRead (DHpin) == LOW); // wait for 50us
delayMicroseconds (30); // determine the duration of the high level to determine the data is '0 'or '1'
if (digitalRead (DHpin) == HIGH)
data |= (1 << (7-i)); // high front and low in the post
while (digitalRead (DHpin) == HIGH);
// data '1 ', wait for the next one receiver
}
} return data; }


void start_test () {
digitalWrite (DHpin, LOW); // bus down, send start signal
delay (30); // delay greater than 18ms, so DHT11 start signal can be detected
digitalWrite (DHpin, HIGH);
delayMicroseconds (40); // Wait for DHT11 response
pinMode (DHpin, INPUT);
while (digitalRead (DHpin) == HIGH);
delayMicroseconds (80);
// DHT11 response, pulled the bus 80us
if (digitalRead (DHpin) == LOW);
delayMicroseconds (80);
// DHT11 80us after the bus pulled to start sending data
for (int i = 0; i < 4; i ++)
// receive temperature and humidity data, the parity bit is not considered
dat[i] = read_data ();
pinMode (DHpin, OUTPUT);
digitalWrite (DHpin, HIGH);
// send data once after releasing the bus, wait for the host to open the next Start signal
}

void loop () {
start_test ();
// convert the bit data to string form
hum = String(dat[0]);
temp= String(dat[2]);
data = "temperature=" + temp + "&humidity=" + hum;// data sent must be under this form //name1=value1&name2=value2.
httppost();
delay(1000);
}

void httppost () {
esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection.
if( esp.find("OK")) {
Serial.println("TCP connection ready");
} delay(1000);
String postRequest =
"POST " + uri + " HTTP/1.0\r\n" +
"Host: " + server + "\r\n" +
"Accept: *" + "/" + "*\r\n" +
"Content-Length: " + data.length() + "\r\n" +
"\r\n" + data; String sendCmd = "AT+CIPSEND=";//determine the number of characters to be sent.
esp.print(sendCmd);
esp.println(postRequest.length() );
delay(500);
if(esp.find(">")) { Serial.println("Sending.."); esp.print(postRequest);
if( esp.find("SEND OK")) { Serial.println("Packet sent");
while (esp.available()) {
String tmpResp = esp.readString();
Serial.println(tmpResp);
}
// close the connection
esp.println("AT+CIPCLOSE");
}
}
}

Wednesday, 26 July 2017

SQL 2

SQL AND & OR Operators :

student table :

student name      Contact     Address City Country
Ayush 89045             Old Ib road Bagalkot India
Akshay 7899               GM road Belgaum India
Pavitra 8649               Hosur Belgaum India
Pooja 9978               Busstand road Gadag India

 

 

AND operator :

SELECT * FROM student
WHERE Country='India'
AND City='Bagalkot'; 


OR operator :

 
SELECT * FROM student
WHERE City='Hubli'
OR City='Belgaum';

 

Combination of AND and OR operator :

 

SELECT * FROM student
WHERE Country='India'
AND (City='Bagalkot' OR City='Hubli');

 

Monday, 6 March 2017

IoT

Raspberry Pi  :
                          It's a device of  size of  VISA card with some extension with GPIO pins along the boundary.Its acts as a server(Stand alone Pc's) or say Desktop pc,that can perform many activities like glowing the LED to Opening the doors automatically.

Raspberry works with "Raspbian OS"  which needs to be installed in the Storage device connected to Pendrive or memory card inserted in to the Pi.Your pi can excellently work with Python language.

Raspberry pi can be obtained from certain sites online,it has divisions of models :
-Raspberry Pi
-Raspberry Pi 2
-Raspberry Pi 3...
 with model B,B+ etc

                                                                    Fig 1.0 ( Pi 3 )


Details about raspberry pi :

> https://www.raspberrypi.org

Download Raspbian OS :

> https://www.raspberrypi.org/downloads/

 Quick start to Raspberry pi :
> https://www.raspberrypi.org/learning/software-guide/quickstart/











Wednesday, 8 February 2017

Big Data


What is Big Data?
                               Big data means really a big data itself,it is big collection of data that cannot be processed using normal techniques or say computing techniques.It has several tools or frameworks with it to handle the data.

 
Big data include big amount of data, it may be :

> Structured (Relational data set)
>Semi-Structured (XML data)
>UN-Structured (doc,text,PDF etc)


Tools or Frameworks used :

Hadoop :It is the Apache open source framework that will provide a option to process the data and also store the data from the clusters of computer using some programming constructs (Java).
Hadoop Map Reduce is the software that allows to write the application which processes huge amount of data in parallel.

The two key components of Hadoop :

>Hive and
>Pig.

Pig and Hive are the two tools that made ease the complexity of writing the programming using the java language.Pig allows to use query for operation on the data such as filter join etc.Hive is also similar to  query language but have some restrictions called hive query language (HQL) commands understood by itself.
   

This is just a brief of what is big-data and what it does use and how it is used to manipulate the data with various tools. One can learn big-data and use tools from different sites available .


Tuesday, 31 January 2017

Internet Of Things(IoT)

 

The Internet Of Things is the inter-working of physical devices.they are mainly used in the physical devices,moving vehicles and others devices,which are embedded with some sensors or software etc that will enable the communication between the devices or say exchange of data between the devices.The IoT devices are integrated with the smart city development.These are capable of solving the Real world problems.

For Ex: Family members moving out of the house and the lighting inside should get shutdown automatically or person entering the house should be recognized(Owner or family member) and the door should open automatically etc is possible from IoT.

The IoT is nothing but all about the sensors.There are many sensors available in the present era.lets go through them one by one:

Temperature sensors: These are used to sense the temperature from machine to down to earth. If we consider the machines which needs to kept cool,here the sensors will report to the user if it is overheated.Even for water heaters can be used to know weather the water is heated up to the level.

Pressures sensors: These sensors are used for water flow or water leakages etc.For ex: the Domestic purpose make use of water in frequent time intervals.If there is leakage of water per house then around 20-30% of water is wasted,which is the major disadvantage.In such situation the sensor immediately inform the user about the leakage etc and user take appropriate action.

Chemical/Gas Sensors: These are used to control the quality of air in the city.It warns if more amount of CO2 is increased which effect the health etc.

 Level Sensors:These are used to sense the level of area.i.e. the level of water filled in the tanks,the level of waste within the dustbins etc.

There are many others sensors,the above mentioned are the most useful and are also used for the applications of day to day life.These senors can be made use for the projects.

The others thing we focus on is how to compute the data and process it and send it to the user?

Yes ,to read the data we need some technologies and hardware components.There are two boards available for these.Raspberry Pi and Aurdino.   

   

 

Tuesday, 19 January 2016

SQL

Introduction


What is SQL?

  • SQL stands for Structured Query Language
      you can access and manipulate(build) the database.


What Can SQL do?

SQL can execute queries against a database
SQL can retrieve data from a database
SQL can insert records in a database
SQL can update records in a database
SQL can delete records from a database
SQL can create new databases
SQL can create new tables in a database
SQL can create stored procedures in a database
SQL can create views in a database
SQL can set permissions on tables, procedures, and views




Database Tables

A database most often contains one or more tables. Each table is identified by a name (e.g. "Student" or "Employee"). Tables contain records (rows) with data.

>rows are also know as tuples.


 Student ID     Student name     contact     age
1                       Ash                    890          21
2                      Anny                  789           22
3                      Stain                   465           20
4                      Harry                  769            25
5                       Dev                    899            23


Some of The Most Important SQL Commands

SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index
DROP INDEX - deletes an index





 

The SQL SELECT Statement :

The SELECT statement is used to select data from a database.

SQL SELECT Syntax
 
SELECT column_name,column_name
FROM table_name;

and
 
SELECT * FROM table_name;
 
Example:
 
 SELECT * FROM Student;
 

The SQL SELECT DISTINCT Statement

In a table, a column may contain many duplicate values; and sometimes you only want to list the different (distinct) values.
 
 SELECT DISTINCT column_name,column_name
FROM table_name;
 
 
Example:
select distinct Student name from Student ;


The SQL WHERE Clause 

The WHERE clause is used to extract only those records that specifies the needs .

SQL WHERE Syntax

SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;
 
Example 
 
SELECT * FROM Student
WHERE name='Ash';
 

Operators in The WHERE Clause

The following operators can be used in the WHERE clause:
Operator   Description
=         Equal
<>         Not equal. 
>         Greater than
<         Less than
>=         Greater than or equal
<=         Less than or equal
BETWEEN         Between an inclusive range
LIKE         Search for a pattern
IN       To specify multiple possible values for a column
 
 
 
 

Monday, 11 January 2016

Java script 7

Function Declarations

 function functionName(parameters)

 {
  code to be executed
} 

Example

function myFunction(a, b)
 {
    return a + b;
}

Function Expressions

A function expression can be stored in a variable:

Example

var x = function (a, b) {return a + b}; 
 
 

Functions Can Be Used as Values

 

Example

function myFunction(a, b)
 {
    return a + b;
}

var x = myFunction(4, 3);
 

Function Parameters and Arguments

  

functionName(parameter1, parameter2, parameter3)

 {
    code to be executed
}  

Java script 6

JavaScript Form Validation

 

If the form submitted is Empty,the function should return alert message and prevent from submitting the form.

JavaScript Example

function validateForm()
 {
    var x = document.forms["myForm"]["fname"].value;
    if (x == null || x == " ")
 {
        alert("Name must be filled out");
        return false;
    }
}

 After filling out the fname the form will be submitted. 

 

Typical validation tasks are:
  • has the user filled in all required fields?
  • has the user entered a valid date?
  • has the user entered text in a numeric field?

End of the basic Java script.

Friday, 8 January 2016

Java script 5

JavaScript Loops

 

  •  for

  • while

  •  do while 

    The for loop has the following syntax:

     
          for (statement 1; statement 2; statement 3)
          {
               code block to be executed
          }

 Example

for (i = 0; i < 5; i++) 
{
    text += "The number is " + i + "<br>";
}

The While Loop Syntax

while (condition) 
{
    code block to be executed
}

Example

In the following example, the code in the loop will run, over and over again, as long as a variable (i) is less than 5:

Example

while (i < 5) 
{
    text += "The number is " + i;
    i++;
}

The Do/While Loop Syntax

The do/while loop is a variant of the while loop.

do {
    code block to be executed
}
while (condition);

Example

The example below uses a do/while loop. The loop will always be executed at least once, even if the condition is false, because the code block is executed before the condition is tested:

Example

do {
    text += "The number is " + i;
    i++;
}
while (i < 10);


 

 

Java script 4

Conditional Statements 

JavaScript we have the following conditional statements:

  • if

  • else

  • else if 

  • switch 

     

    The if Statement

    Syntax

    if (condition) 
    {
        block of code to be executed if the condition is true
    } 
     
     Example : 
     <hmtl>
    <script>
    var age=20;
    if(age>18)
    {
    document.write("Qualifies for driving");
    }
    </scritp>
    </html>

    The else Statement

    if (condition)
     {
        block of code to be executed if the condition is true
    } 
    else
     {
        block of code to be executed if the condition is false
    }
     
    Example : 
     <hmtl>
    <script>
    var age=20;
    if(age>18)
    {
    document.write("Qualifies for driving");
    } 
    else
    {
    document.write("doesnt qulify for driving");
    }
    </scritp>
    </html>

    The else if Statement

    Use the else if statement to specify a new condition if the first condition is false.

    Syntax

    if (condition1) 
    {
        block of code to be executed if condition1 is true
    }
     else if (condition2) 
    {
        block of code to be executed if the condition1 is false and condition2 is true
    }
     else
     {
        block of code to be executed if the condition1 is false and condition2 is false
    }
     
     
    Example:Simillar to if else.

    The JavaScript Switch Statement

     
    Syntax 
     
     switch(expression)
     {
        case n:
            code block
            break;
        case n:
            code block
            break;
        default:
            default code block
    }
     
     

Wednesday, 6 January 2016

Java script 3

JavaScript Arithmetic Operators

Operator Description
 +                  Addition
 -                 Subtraction
 *                 Multiplication
 /                 Division
 %                 Modulus
 ++                 Increment
 --                 Decrement

 

JavaScript Assignment Operators

Operator Example
=                  x = y
+=                  x += y
-=                  x -= y
*=                  x *= y
/=                  x /= y
%=                 x %= y

 

JavaScript  Logical Operators

OperatorDescription
= =                            equal to
= = =                              equal value and equal type
!=                            not equal
!==                            not equal value or not equal type
>                            greater than
<                            less than
>=                            greater than or equal to
<=                            less than or equal to
?                             ternary operator

 

JavaScript Function Syntax

 function name(parameter1, parameter2, parameter3)

 {
    code to be executed
} 

 

 Example:

var x = myFunction(5, 2);        // Function is called, return value will end up in x
function myFunction(a, b)

 {
    return a * b;                // Function returns the product of a and b }

 






















































































































 
































































Sunday, 3 January 2016

Java script 2

JavaScript Syntax


Java script statements  are separated by semicolons (;)

Ex:

var x = 2; var y = 3; var z = x + y; 

the values (fixed) are also known as literals are written directly instead of putting them in a qoutes

20.2

03

string are written as

"Google"

"Blackfacers"

 

Variables can be assigned values using = operator :

var x;

x=50;

Arithmetic operators :
 

(5*2)+5

 The values can be of string type can also be joined using operator + like

"Black" + "  " + "facers"

Blackfacers will be the output.


Java script comments :

Code after double slashes  //  or between      /*  and  */     is treated as a comment.

  Javascript program ex:

 var x = 10;
var y =5;
var z = x + y;
document.getElementById("sample").innerHTML = z;

JavaScript Code Blocks :

JavaScript statements can be grouped together in code blocks, inside curly brackets {...}.

 function myFunction()
{
    document.getElementById("demo").innerHTML = "Hello CODERS.";
    document.getElementById("sample").innerHTML = "How are you?";
}

Here function is a keyword.
 

Thursday, 31 December 2015

Java Script

Last Post was done with HTML,CSS .

Let Begin with Java Script


JAVA SCRIPT
 
 Why we need to study java script ?

 We learnt about HTML which is used to define the content of web pages
 And  CSS to specify the layout of web pages,now
 JavaScript to program the behavior of web pages
 This tutorial is about JavaScript.

 > Method to use Javascript in HTML : getElementById().

In This example uses the method to "find" an HTML element (with id="demo"), and changes the element content (innerHTML) to "Hello JavaScript":

Example

document.getElementById("demo").innerHTML = "Hello JavaScript";

 ( Notice the capital and small letters)


> Method to use Javascript in HTML,form of CSS: getElementById().

Example

document.getElementById("demo").style.fontSize = "20px";
 
 
 
 
The SCRIPT Tag :
 
 
In HTML, JavaScript code must be inserted between <script> and </script> tags.

Example

<script>
document.getElementById("demo").innerHTML = "My First JavaScript";
</script>
 
 
The next part will be continued in the next session of the blog...!!

Thursday, 15 October 2015

Html part3

Html #part3 

  CSS Tutorial

 CSS is a stylesheet language that describes the presentation of an HTML (or XML) document.

 

Example

body {
    background-color: #d0f5fs;
}

h1 {
    color: orange;
    text-align: center;
}

p {
    font-family: "Times New Roman";
    font-size: 30px;
}

 

What is CSS?

  • CSS stands for Cascading Style Sheets
  • CSS describes how HTML elements are to be displayed on screen, paper, or in other media.
  • CSS also saves lot of work. 

     CSS Syntax

    A CSS rule set consists of a selector and a declaration block:

    H1 {color:blue; font-size:12px;}

    Selector : H1
    Declaration: Color:blue, font-size:12px

    The selector points to the HTML element you want to style.
    The declaration block contains one or more declarations separated by semicolons.
    Each declaration includes a property name and a value, separated by a colon.


    Three Ways to Insert CSS

    There are three ways of inserting a style sheet:
  • External style sheet
  • Internal style sheet
  • Inline style

    External Style Sheet

    With an external style sheet, you can change the look of an entire website by changing just one file!
    Each page must include a reference to the external style sheet file inside the <link> element. The <link> element goes inside the head section:

    <head>
    <link rel="stylesheet" type="text/css" href="mystyle.css">
    </head>
     
    An external style sheet can be written in any text editor. The file should not contain any html tags. The style sheet file must be saved with a .css extension. An example of a style sheet file called "myStyle.css", is shown below:
     
    body {
        background-color: lightblue;
    }

    h1 {
        color: navy;
        margin-left: 20px;
    }
     

    Internal Style Sheet

    An internal style sheet may be used if one single page has a unique style.
    Internal styles are defined within the <style> element, inside the head section of an HTML page:

    <head>
    <style>
    body
    {
        background-color: linen;
    }

    h1 {
        color: maroon;
        margin-left: 40px;
    }
    </style>
    </head>
     
     

    Inline Styles

    An inline style may be used to apply a unique style for a single element.
    An inline style loses many of the advantages of a style sheet (by mixing content with presentation). Use this method sparingly!
    To use inline styles, add the style attribute to the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a <h1> element:

    <h1 style="color:blue;margin-left:30px;">This is a heading.</h1>
     
    include this code in html file itself.

Saturday, 26 September 2015

Html #part2:

HTML Text Color

The color property defines the text color to be used for an HTML element:

<h1 style="color:blue">This is a heading</h1>


HTML Fonts

The font-family property defines the font to be used for an HTML element:

<h1 style="font-family:verdana">This is a heading</h1>

HTML Text Size

The font-size property defines the text size to be used for an HTML element:

<h1 style="font-size:200%">This is a heading</h1>

HTML Text Alignment

The text-align property defines the horizontal text alignment for an HTML element:

<h1 style="text-align:center">Centered Heading</h1>
 <h1 style="text-align:left">Left Heading</h1 
><h1 style="text-align:right">Right Heading</h1>


HTML  Formatting : 

Subscript

The HTML <sub> element defines subscripted text.

 <p>This is <sub>subscripted</sub> text.</p>


Superscript:

<p>This is <sup>superscripted</sup> text.</p>

HTML <q> for Short Quotations

The HTML <q> element defines a short quotation.

<p>WWW.: <q>Tihs is text from www.blackfacers.blogspot.com.</q></p>

HTML <abbr> for Abbreviations

The HTML <abbr> element defines an abbreviation or an acronym.

<p>The <abbr title="End Of  File">EOF</abbr></p>
 
 

HTML Comment Tags

<!-- Write your comments here -->


 

 




Friday, 25 September 2015

Learning HTML: #part 1


What is HTML?

HTML is a markup language for describing web documents (web pages).
  • HTML stands for Hyper Text Markup Language
  • A markup language is a set of markup tags
  • HTML documents are described by HTML tags
  • Each HTML tag describes different document content

HTML Tags

HTML tags are keywords (tag names) surrounded by angle brackets:
<tagname>content</tagname>
  • HTML tags normally come in pairs like <p> and </p>
  • The first tag in a pair is the start tag, the second tag is the end tag
  • The end tag is written like the start tag, but with a slash before the tag name
The tags used in above example are explained here:
Open the Notepad++ file
type the following code

<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

</body>
</html>


save the file with .html extension
for example: sample.html


HTML can be edited by using professional HTML editors like:
  • Microsoft WebMatrix
  • Sublime Text
For learning HTML we recommend a text editor like Notepad (PC) or TextEdit (Mac).

The DOCTYPE declaration defines the document type to be HTML
The text between <html> and </html> describes an HTML document
The text between <head> and </head> provides information about the document
The text between <title> and </title> provides a title for the document
The text between <body> and </body> describes the visible page content
The text between <h1> and </h1> describes a heading
The text between <p> and </p> describes a paragraph


HTML Headings

HTML headings are defined with the <h1> to <h6> tags:
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
so on.....

HTML Links

HTML links are defined with the <a> tag:
<a href="www.blackfacers.blogspot.com">This is a link</a>

HTML Images

HTML images are defined with the <img> tag.
<img src="blackfacers.jpg" alt="blogspot.com" width="104" height="142">

 

 

Saturday, 14 March 2015

Pyhton



Python can be easy to pick up whether you're a first time programmer or you're experienced with other languages. The following pages are a useful first step to get on your way writing programs with Python!

The community hosts conferences and meetups, collaborates on code, and much more. Python's documentation will help you along the way, and the mailing lists will keep you in touch.

The Python Package Index (PyPI) hosts thousands of third-party modules for Python. Both Python's standard library and the community-contributed modules allow for endless possibilities.

Python is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use. Python's license is administered by the Python Software Foundation.


To download:
https://www.python.org/about/ 
(Direct link)
https://www.python.org/downloads/