Monday, 14 March 2022

एक शायरी लिखी है कभी मिलोगी तो सुनाऊंगा | Munawar Faruqui Ki Shayari

 एक शायरी लिखी है कभी मिलोगी तो सुनाऊंगा। 

तेरी सीरत साफ़ सीसे की तरह है मेरे दामन में दाग हज़ारों है 

तू नायब किसी पत्थर की तरह मेरा उठना बैठना बाजारों में है 

तेरी मौजुदगी का एहतराम कर भी लूँ 

जब तू होगा रुबरु मैं अपना जज्बात कहाँ छुपाऊंगा 

एक शायरी लिखी है कभी मिलोगी तो सुनाऊंगा 


एक उम्र लेकर आना 

मैं खाली किताबें लेकर आऊंगा 

तोड़कर लाने के वादे नहीं 

मैं अपनी कलम से सितारें सजाऊंगा 

इस जमी पे खास नहीं है कोई मेरा

अगर तू एक बार कुबूल करे 

मैं अपने गवाहों को आसमान से बुलाऊंगा

एक शायरी लिखी है कभी मिलोगी तो सुनाऊंगा। 


कई रात गुजारी है इस अँधेरे में 

तूम थोड़ा सा नूर ले आओगे 

मेरे तकिये गीले है आसुंओ से 

क्या तुम अपनी गोद में सुलाओगे 

सुना है बाग़ है तुम्हारे आगन में 

मेरे लाहसल बचपन को वो झूला दिखाओगे

मैंने खोया है अपनी हर प्यारी चीज को 

मैं अपनी किस्मत फिर आजमाऊँगा 

एक शायरी लिखी है कभी मिलोगी तो सुनाऊंगा। 


Saturday, 27 October 2018

Basic Of Python

                                             Python_Basic



Que. How to assign value in python?
In Python, there is no need to assign data type. It automatically detects the data type.
For Example:
2+3
a=10
b=10
c=10
var=10
name="amit"
height= "5.86"

Que.  What is Token in Python?

  • Python Tokens (Identifier, Keywords, Literals, Operators)
  • In Python Identifier always start with an underscore (_)
          For Example:
                               _12key=10

  • Literals
  1. String Literals
name1 = "John"

name2 = "Rohit"
print name1
print name2
print name1+name2
print name1+" "+name2

Output

John
Rohit
JohnRohit
John Rohit

multiline = ' ' ' First Line
Second Line
Third Line
Fourth Line ' ' '
print multiline

Output
First Line
Second Line
Third Line
Fourth Line

2. Numeric Literals

Numeric Literals are Int, Long, Float, Complex

3. Boolean Literals
   True, False (Both are also keywords)
4. Special Literals
   None (It specify that the field is not created)

  • Operators
1. Arithmetic Operator
2. Logical Operator
3. Assignment Operator
4. Logical Operator
5.Membership Operator




Thursday, 23 August 2018

तेरे इश्क मे

थोड़ी रहम कर ऐ जिन्दगी,
तेरे इश्क में,
मजबूर हूँ, मजदूर नहीं।

Wednesday, 18 April 2018

Stop and Wait Protocol in WSN

# stop and wait protocol in normal situation
# features : labeling, annotation, nam-graph, and window size monitoring
set ns [new Simulator]

set n0 [$ns node]
set n1 [$ns node]

$ns at 0.0 "$n0 label Sender"
$ns at 0.0 "$n1 label Receiver"

set nf [open A1-stop-n-wait.nam w]
$ns namtrace-all $nf
set f [open A1-stop-n-wait.tr w]
$ns trace-all $f

$ns duplex-link $n0 $n1 0.2Mb 200ms DropTail
$ns duplex-link-op $n0 $n1 orient right
$ns queue-limit $n0 $n1 10

Agent/TCP set nam_tracevar_ true

set tcp [new Agent/TCP]
$tcp set window_ 1
$tcp set maxcwnd_ 1
$ns attach-agent $n0 $tcp

set sink [new Agent/TCPSink]
$ns attach-agent $n1 $sink

$ns connect $tcp $sink

set ftp [new Application/FTP]
$ftp attach-agent $tcp

$ns add-agent-trace $tcp tcp
$ns monitor-agent-trace $tcp
$tcp tracevar cwnd_

$ns at 0.1 "$ftp start"
$ns at 3.0 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n1 $sink"
$ns at 3.5 "finish"

$ns at 0.0 "$ns trace-annotate \"Stop and Wait with normal operation\""

$ns at 0.05 "$ns trace-annotate \"FTP starts at 0.1\""

$ns at 0.11 "$ns trace-annotate \"Send Packet_0\""
$ns at 0.35 "$ns trace-annotate \"Receive Ack_0\""
$ns at 0.56 "$ns trace-annotate \"Send Packet_1\""
$ns at 0.79 "$ns trace-annotate \"Receive Ack_1\""
$ns at 0.99 "$ns trace-annotate \"Send Packet_2\""
$ns at 1.23 "$ns trace-annotate \"Receive Ack_2  \""
$ns at 1.43 "$ns trace-annotate \"Send Packet_3\""
$ns at 1.67 "$ns trace-annotate \"Receive Ack_3\""
$ns at 1.88 "$ns trace-annotate \"Send Packet_4\""
$ns at 2.11 "$ns trace-annotate \"Receive Ack_4\""
$ns at 2.32 "$ns trace-annotate \"Send Packet_5\""
$ns at 2.55 "$ns trace-annotate \"Receive Ack_5    \""
$ns at 2.75 "$ns trace-annotate \"Send Packet_6\""
$ns at 2.99 "$ns trace-annotate \"Receive Ack_6\""

$ns at 3.1 "$ns trace-annotate \"FTP stops\""

proc finish {} {
 global ns nf
 $ns flush-trace
 close $nf


 puts "running nam..."
 exec nam A1-stop-n-wait.nam &
 exit 0
}

$ns run


Sliding Window Protocol in Wireless Sensor Network

set ns [new Simulator]
set n0 [$ns node]
set n1 [$ns node]

$ns color 1 red

$ns at 0.0 "$n0 label Host-1"
$ns at 0.0 "$n1 label Host-2"
set nf [open out.nam w]
$ns namtrace-all $nf
set f [open out.tr w]
$ns trace-all $f

$ns duplex-link $n0 $n1 1Mb 200ms DropTail
$ns duplex-link-op $n0 $n1 orient right
$ns queue-limit $n0 $n1 10

Agent/TCP set nam_tracevar_ true
set tcp [new Agent/TCP]
$tcp set windowInit_ 4
$tcp set maxcwnd_ 4
$tcp set fid_ 1
$ns attach-agent $n0 $tcp

set sink [new Agent/TCPSink]
$ns attach-agent $n1 $sink

$ns connect $tcp $sink

set ftp [new Application/FTP]
$ftp attach-agent $tcp

$ns add-agent-trace $tcp tcp
$ns monitor-agent-trace $tcp
$tcp tracevar cwnd_

$ns at 0.1 "$ftp start"
$ns at 3.0 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n1 $sink"
$ns at 3.0 "finish"

$ns at 0.0 "$ns trace-annotate \"Sliding Window with window size 4 (normal operation)\""

$ns at 0.52 "$ns trace-annotate \"Send Packet_0,1,2,3\""
$ns at 0.92 "$ns trace-annotate \"Receive Ack_0,1,2,3\""
$ns at 0.93 "$ns trace-annotate \"Send Packet_4,5,6,7\""
$ns at 1.32 "$ns trace-annotate \"Receive Ack_4,5,6,7\""
$ns at 1.33 "$ns trace-annotate \"Send Packet_8,9,10,11\""
$ns at 1.72 "$ns trace-annotate \"Receive Ack_8,9,10,11 \""

$ns at 1.73 "$ns trace-annotate \"Send Packet_12,13,14,15\""
$ns at 2.14 "$ns trace-annotate \"Receive Ack_12,13,14,15\""
$ns at 2.15 "$ns trace-annotate \"Send Packet_16,17,18,19\""
$ns at 2.55 "$ns trace-annotate \"Receive Ack_16,17,18,19\""
$ns at 2.56 "$ns trace-annotate \"Send Packet_20,21,22,23\""
$ns at 2.96 "$ns trace-annotate \"Receive Ack_20,21,22,23\""
$ns at 2.97 "$ns trace-annotate \"FTP stops\""

proc finish {} {

        global ns
        $ns flush-trace
        exec nam out.nam &
        exit 0
}

$ns run

BLACK HOLE ATTACK IN WSN

#===================================
#     Simulation parameters setup
#===================================
set val(chan)   Channel/WirelessChannel    ;# channel type
set val(prop)   Propagation/TwoRayGround   ;# radio-propagation model
set val(netif)  Phy/WirelessPhy            ;# network interface type
set val(mac)    Mac/802_11                 ;# MAC type
set val(ifq)    Queue/DropTail/PriQueue    ;# interface queue type
set val(ll)     LL                         ;# link layer type
set val(ant)    Antenna/OmniAntenna        ;# antenna model
set val(ifqlen) 50                         ;# max packet in ifq
set val(nn)     7                          ;# number of mobilenodes
set val(rp)     AODV                       ;# routing protocol
set val(x)      800                        ;# X dimension of topography
set val(y)      541                        ;# Y dimension of topography
set val(stop)   100.0                      ;# time of simulation end

#===================================
#        Initialization       
#===================================
#Create a ns simulator
set ns [new Simulator]

#Setup topography object
set topo       [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)

#Open the NS trace file
set tracefile [open blackhole.tr w]
$ns trace-all $tracefile

#Open the NAM trace file
set namfile [open blackhole.nam w]
$ns namtrace-all $namfile
$ns namtrace-all-wireless $namfile $val(x) $val(y)
set chan [new $val(chan)];#Create wireless channel

#===================================
#     Mobile node parameter setup
#===================================
$ns node-config -adhocRouting  $val(rp) \
                -llType        $val(ll) \
                -macType       $val(mac) \
                -ifqType       $val(ifq) \
                -ifqLen        $val(ifqlen) \
                -antType       $val(ant) \
                -propType      $val(prop) \
                -phyType       $val(netif) \
                -channel       $chan \
                -topoInstance  $topo \
                -agentTrace    ON \
                -routerTrace   ON \
                -macTrace      OFF \
                -movementTrace ON

#===================================
#        Nodes Definition       
#===================================
#Create 7 nodes
set n0 [$ns node]
$n0 set X_ 99
$n0 set Y_ 299
$n0 set Z_ 0.0
$ns initial_node_pos $n0 20
set n1 [$ns node]
$n1 set X_ 299
$n1 set Y_ 297
$n1 set Z_ 0.0
$ns initial_node_pos $n1 20
set n2 [$ns node]
$n2 set X_ 499
$n2 set Y_ 298
$n2 set Z_ 0.0
$ns initial_node_pos $n2 20
set n3 [$ns node]
$n3 set X_ 700
$n3 set Y_ 299
$n3 set Z_ 0.0
$ns initial_node_pos $n3 20
set n4 [$ns node]
$n4 set X_ 199
$n4 set Y_ 350
$n4 set Z_ 0.0
$ns initial_node_pos $n4 20
set n5 [$ns node]
$n5 set X_ 599
$n5 set Y_ 350
$n5 set Z_ 0.0
$ns initial_node_pos $n5 20
set n6 [$ns node]
$n6 set X_ 600
$n6 set Y_ 200
$n6 set Z_ 0.0
$ns initial_node_pos $n6 20


# Node 5 is given RED Color and a label- indicating it is a Blackhole Attacker
$n5 color red
$ns at 0.0 "$n5 color red"
$ns at 0.0 "$n5 label Attacker"

# Node 0 is given GREEN Color and a label - acts as a Source Node
$n0 color green
$ns at 0.0 "$n0 color green"
$ns at 0.0 "$n0 label Source"

# Node 3 is given BLUE Color and a label- acts as a Destination Node
$n3 color blue
$ns at 0.0 "$n3 color blue"
$ns at 0.0 "$n3 label Destination"

#===================================
#    Set node 5 as attacker   
#===================================
$ns at 0.0 "[$n5 set ragent_] hacker"

#===================================
#        Agents Definition       
#===================================
#Setup a UDP connection
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set null1 [new Agent/Null]
$ns attach-agent $n3 $null1
$ns connect $udp0 $null1
$udp0 set packetSize_ 1500

#===================================
#        Applications Definition       
#===================================
#Setup a CBR Application over UDP connection
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
$cbr0 set packetSize_ 1000
$cbr0 set rate_ 0.1Mb
$cbr0 set random_ null
$ns at 1.0 "$cbr0 start"
$ns at 100.0 "$cbr0 stop"

#===================================
#        Termination       
#===================================
#Define a 'finish' procedure
proc finish {} {
    global ns tracefile namfile
    $ns flush-trace
    close $tracefile
    close $namfile
    exec nam blackhole.nam &
    exit 0
}
for {set i 0} {$i < $val(nn) } { incr i } {
    $ns at $val(stop) "\$n$i reset"
}
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "finish"
$ns at $val(stop) "puts \"done\" ; $ns halt"
$ns run

Thursday, 5 April 2018

PCA IN MATLAB

clc;
clear;

R =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band1.gif'));
G =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band2.gif'));
B =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band3.gif'));
I =im2double(imread('C:\\Users\\STUDENT1\\Desktop\\364\\band4.gif'));

[a b]=size(R);

Image=zeros(a*b,4);

k=1;
for i=1:a
    for j=1:b
     Image(k,1)=R(i,j);
     Image(k,2)=G(i,j);
     Image(k,3)=B(i,j);
     Image(k,4)=I(i,j);
     k=k+1;
    end
end

Mean=mean(Image);
Covariance=cov(Image);

[V D]=eig(Covariance);


k=1;
for i=1:512
    for j=1:512
        Final1(i,j)=V(:,1)'*Image(k,:)';
        Final2(i,j)=V(:,2)'*Image(k,:)';
        Final3(i,j)=V(:,3)'*Image(k,:)';
        Final4(i,j)=V(:,4)'*Image(k,:)';
        k=k+1;
    end
end

subplot(2,2,1);
imshow(histeq(double(Final1)));
subplot(2,2,2);
imshow(histeq(double(Final2)));
subplot(2,2,3);
imshow(histeq(double(Final3)));
subplot(2,2,4);
imshow(histeq(double(Final4)));