Showing posts with label Ports. Show all posts
Showing posts with label Ports. Show all posts

Friday, March 16, 2012

An Intoduction into FreeBSD ports

Under Linux Platform we usually use rpm ,up2date ,yum or apt-get command to install a package.
Under FreeBSD you can use pkg_add command or ports system.

The FreeBSD Ports Collection is a package management system that provides an easy and consistent way of installing software packages on the FreeBSD. Usually ports is located at /usr/ports directory.

The FreeBSD Ports and Packages Collection offers a simple way for users and administrators to install applications. There are currently 23322 ports available.
Installing an application is as simple as downloading the port, unpacking it and typingmakein the port directory. However, the most convenient (and common) method is to download the framework for the entire list of ports by installing the entire ports hierarchy at FreeBSD installation time, and then have thousands of applications right at your fingertips.

Task: Find out FreeBSD port name or package name

There are 3 different methods available to search a port name. Use any one of the following method only.

#1 : Using whereis command

If you know the exact name of the port, but just need to find out which category it is in, you can use the whereis(1) command. Simply type whereis file, where file is the program you want to install.
# whereis php5
Output:
php5: /usr/ports/lang/php5
# whereis lighttpd
Output:
lighttpd: /usr/ports/www/lighttpd

#2: Using make command

Change directory to /usr/ports
# cd /usr/ports
To search type the command as follows:
# make search name="package-name"
For example search a package called lighttpd or php
# make search name="php"
OR
# make search name="lighttpd"
Output:
Port:   lighttpd-1.4.13_2
Path:   /usr/ports/www/lighttpd
Info:   A secure, fast, compliant, and very flexible Web Server
Maint:  mnag@FreeBSD.org
B-deps: autoconf-2.59_2 libtool-1.5.22_4 m4-1.4.8_1 pcre-7.0_1 perl-5.8.8
R-deps: pcre-7.0_1
WWW:    http://www.lighttpd.net/

#3: Using locate command

You can also use locate command:
# locate php
# locate php | grep php5

Task: Install FreeBSD port

Above output displays port Path - /usr/ports/www/lighttpd. Just change directory to /usr/ports/www/lighttpd
# cd /usr/ports/www/lighttpd
Now install a port:
# make; make install
Clean the source code tree:
# make clean
 Thanks & HAppp Porting..............!

Monday, May 9, 2011

Flipping of image with another using JavaScript

Below is very simple snippet code for flipping of two images using JavaScript. If possible you guys can make it generic snippet code. This code will help in mainly for showing / hiding of div’s, for example if he clicks on ‘Show Image’ it will automatically changes to ‘Hide Image’. Its a simple snippet code.


Below is the div, in div – Initially I am showing the hide image, when user clicks on this image, the image as well as the title of the img will be swapped with show image and the title will be ‘Maximize’… and Vice-Versa.

The below function should be placed in <script></script>.
//This Function is for Flipping of 'Show Image' to 'Hide Image' and Vice-Versa
function flip(imageID) {
var img = document.getElementById(imageID);
if (img.src.indexOf('images/hide.gif') > -1) {
img.src = 'images/show.gif';
img.title='Maximize';
} else {
img.src = 'images/hide.gif'
img.title='Minimize';
}
}
 below div should be placed in <body>.
<div><a href="#" onClick="flip('hide'); return false;" title="Minimize" style="padding:0px"><img src="images/hide.gif" id="hide" border="0"></a></div>

Javascript to strip special characters from a string


 <script language="JavaScript"><!--
var temp = new String('This is a te!!!!st st>ring... So??? What...');
document.write(temp + '<br>');
temp =  temp.replace(/[^a-zA-Z 0-9]+/g,'');
document.write(temp + '<br>');
//--></script>


Remove duplicates from an array using JavaScript

Here is a simple and easily understandable snippet code, to remove duplicates from an existing array using JavaScript. You guys! might have come across in some situation where in which the array has got some duplicates and want to remove those duplicates to show up unique ones. Below simple JavaScript code does the same, initially the respective array has got some value like below:

var sampleArr=new Array(1,1,1,1,1,2,2,3,3,3,4,4,4);

javascript code:

var sampleArr=new Array(1,1,1,1,1,2,2,3,3,3,4,4,4); //Declare array
document.write(uniqueArr(sampleArr)); //Print the unique value
 
//Adds new uniqueArr values to temp array
function uniqueArr(a) {
 temp = new Array();
 for(i=0;i<a.length;i++){
  if(!contains(temp, a[i])){
   temp.length+=1;
   temp[temp.length-1]=a[i];
  }
 }
 return temp;
}
 
//Will check for the Uniqueness
function contains(a, e) {
 for(j=0;j<a.length;j++)if(a[j]==e)return true;
 return false;
}

Saturday, December 4, 2010

PHP Programming Language

PHP ( Hypertext Preprocessor ) was released in the 1995PHP was originally known as Personal Home Page written as a set of Common Gateway Interface (CGI) in C Language byDanish/Greenlandic programmer Rasmus Lerdorf. Lerdorf initially created these Personal Home Page Tools to replace a small set of Perl scripts he had been using to maintain his personal homepage and was originally designed to replace a set of Perl scripts to maintain his Personal Home Pages (also known as PHP) in 1994. He combined these with his Form Interpreter to create PHP/FI, which had more functionality. PHP/FI included a larger implementation for the C programming language and could communicate with databases, enabling the building of simple, dynamic web applications. Lerdorf released PHP publicly on June 8, 1995 to accelerate bug location and improve the code.This release was named PHP version 2 and already had the basic functionality that programming php has today.
Mainly , PHP was designed to create dynamic and more interactive web pages. It is a server-side scripting language embed with HTML. Now a days , it is the most widely-used open-source and general-purpose scripting language. PHP code in a script can interect with databases, create images, read and write files and talk to remote servers. So the output from PHP code is combined with HTML in script and the result is sent to the user as a web page.

All major operating systems including LinuxMicrosoft Windows, Mac OS X, and RISC OS , you can use PHP in all these operating systems. As you know there are procedural programming or object oriented programming. PHP uses either procedural programming or object oriented programming. Also you can mix them and use both ( procedural programming or object oriented programming ). As i mention above, PHP is used mainly in server-side scripting,command line interface and writing desktop applications. PHP also supports ODBC, theOpen Database Connection standard which allows you to connect to other databasessupporting this world standard. For database , phpMyAdmin is most widely used for PHP developement. Server-side scripting is the most traditional one for PHP development. In order to use PHP for server-side scripting you need
1. PHP parser
2. Web server
3. Web browser.

The PHP codes entered with the parser on a web server will be translated into a PHP page that can be viewed on your web browser. Main reason behind popularity of PHP language is , it can be embedded directly into HTML coding. It has more benefits such as the following

1. It can be used on all major operating systems.
2. It can be supported by most of the web servers.
3. The latest version of PHP development is a very stable and grown-up language used for web programming like Java and C#.

Friday, November 26, 2010