Queuing Models in NS2

M/M/1 is a system with poisson arrival time, servicing exponentially and a queue of unlimited capacity and type of FIFO Queue. This is the simplest queuing system.  NS2 supports various distributions like pareto, exponential, constant, unifrom, etc to handle the network dynamics and metrics. So it is very easy to test the given network link to monitor a given queue using any of these queuing models. The listing 3 and 4 are monitoring the link when DropTail queue is used with a capacity of finite and infinite. Listing 13.3 uses infinite capacity and Listing 13.4 uses Finite capacity The output screen shot is shown below the scripts for further understanding
Listing 3 – M/M/1 Queuing Model #new Simulator creation set ns [new Simulator] #trace file creation for capturing the UDP data set tf [open out.tr w] $ns trace-all $tf
#setting the exponential distribution param set lambda 30.0 set mu     33.0
#creation of nodes set n1 [$ns node] set n2 [$ns node] #The queue limit is 1Lakh as the capacity is infin…

youtube-dl (Command Based Youtube Downloader)

Downloading youtube.com videos to local machine is always a challenge as the streaming sites keep on updating their policies in blocking the videos.
But there is a tool that is available in the command line (Terminal based) on Linux Operating Systems.
That is youtube-dl, this is a python based code and can be executed in linux OS without any hassles.

youtube-dl in windows or Mac OS can be achieved by installing python interpreter and try it.

for installing in linux, the command is
$prompt] sudo yum install youtube-dl (in redhat or centos or fedora)
$prompt] sudo apt-get install youtube-dl (ubuntu or linux mint)
See the image for downloading in Fedora 20
Youtube-dl in Fedora 20

In ubuntu, you can update the sudo package before installing the youtube-dl.
sudo apt-get update

To download videos 
$prompt] youtube-dl http://www.youtube.com/watch?v=D980jXvyKUY

the above command will download the video in the best possible format. See the image below.
The video downloaded is of the format webm (Its a Web Movie format from Google for optimized view in web browsers)
To view all formats, use the following command,
$prompt] youtube-dl -F http://www.youtube.com/watch?v=D980jXvyKUY
[youtube] Setting language
[youtube] D980jXvyKUY: Downloading webpage
[youtube] D980jXvyKUY: Downloading video info webpage
[youtube] D980jXvyKUY: Extracting video information
[info] Available formats for D980jXvyKUY:
format code extension resolution  note
139         m4a       audio only  DASH audio , audio@ 48k (worst)
140         m4a       audio only  DASH audio , audio@128k
160         mp4       192p        DASH video
133         mp4       240p        DASH video
17          3gp       176x144  
36          3gp       320x240  
5           flv       400x240  
18          mp4       640x360     

43          webm      640x360     (best)

The above is output and to download the corresponding video format, then here is the command
$prompt] youtube-dl -f 18 http://www.youtube.com/watch?v=D980jXvyKUY
The above command will download the file in the mp4 format as specified in the option obtained in the previous command.

if you need any help on the commands, you can use the following command 
$prompt] youtube-dl --help

Often, youtube-dl is updated, it can be easily updated as given below,
$prompt] sudo youtube-dl -U

Also now youtube-dl supports various other video streaming sites also, to name a few, vimeo.com, dailymotion.com, etc.

If you are behind the proxy, type the command in the terminal  
export http_proxy= 
or copy the above line in /etc/profile.d/proxy.sh (this will be set for all the users of the computer, also need root password)

Download and Enjoy!!!

 T S Pradeep Kumar

Popular posts from this blog

AWK Scripts for NS2 to process data from Trace Files


ns2 installation in Ubuntu 14.04