How to Use External Font

Using External Font is very Easy

1.Download the font

2.If the Downloaded font is in ttf format convert it into eot format by a tool which you have to search and download or use this online convertor    http://www.kirsle.net/wizards/ttf2eot.cgi

3.If the Downloaded file is in otf format convert it into ttf format and then convert it into eot

4. Both ttf and eot is need. ttf is supported by most browser but IE didn’t support ttf so we need eot format

5.In your css just do the follwing

@font-face {
font-family: “family:androidfont”;
font-style: normal;
src: url(foldername/filename.eot); /*if IE */
src: local(“font-name”), url(“foldername/filename.ttf”) format(“truetype”); /* non-IE */
6. Use the font in your file like below
body{
font-family:androidfont; Notes:Note the word androidfont this is the font-name i used in the above code it is user defined one so what you defined in the above code that you can use here
font-size:13px;
color:black;
}

Permanent link to this article: https://blog.openshell.in/2011/01/how-to-use-external-font/

Execute PHP Script from command line in Ubuntu

Some times there is a great requirement to execute some codes of PHP immediately, but for that we have to format the output according to HTML format since generally PHP scripts are executed using LAMP.

For example if we want to fetch some data from a table of RDB using PHP and need to see the value then we will have to code lots to see the data in HTML browsers.

There is a way by which we can execute a PHP script directly without using web browser in Ubuntu.

Steps are as below –

  1. Be conform that PHP5 is installed and configured in your Linux Box.

    Install php5-cli by the following command

    sudo apt-get install php5-cli

  2. Now we need to change the file mcrypt.ini, for that use the following command.

    sudo gedit /etc/php5/cli/conf.d/mcrypt.ini

    and change the line

    # configuration for php MCrypt module

    to

    ; configuration for php MCrypt module

    sudo gedit /etc/php5/cli/conf.d/imap.ini

    and change the line

    # configuration for php Imap module

    to

    ; configuration for php Imap module

  3. Now to test our work create a file file_name.php from anywhere. now we are ready to test our PHP scripts by executing from command line!! and then go to file location in the terminal and type

    php file_name.php

Permanent link to this article: https://blog.openshell.in/2011/01/execute-php-script-from-command-line-in-ubuntu/

How to Install and Use TeamViewer on Linux

TeamViewer is one of the most popular remote desktop software because it is really easy to use and it has support for different operating systems. Although its main function is to remote control a desktop for technical support, it also has file sharing and presentation features.

If you are using Linux, you can easily install TeamViewer and use it to connect to remote machines that are also running TeamViewer be it Windows, Mac OS X, or Linux.

Installing TeamViewer:

The full version of TeamViewer for Linux has packages for several major distributions, such as Debian, Red Hat, Fedora, Mandriva, Suse, and Ubuntu. You can download them from HERE.

Using TeamViewer:
When you run TeamViewer, make sure that it is also running on the remote (partner) machine that you would like to control or connect to, and close it only after you have ended your session. You can immediately connect by getting and entering your partner’s ID and password.

TeamViewer-Linux

TeamViewer

Permanent link to this article: https://blog.openshell.in/2011/01/how-to-install-and-use-teamviewer-on-linux/

How to Crack Password-protected Zip Files Using Linux

In case you or your friend has forgotten the password of your password-protected .zip file that may contain important documents, music, there is really no need to worry as there are plenty of password crackers available out there. If you are using Linux, I highly recommend you download and use FCrackZip.

FCrackZip is a simple, fast, free, and easy-to-use zip cracker that is similar to fzc and zipcrack. Partially written in assembler, it uses brute force or dictionary based attacks to find the password. Although you will need the Linux terminal to use FCrackZip, a simple command is actually required to crack the zip password.

If you are using any popular or major Linux distribution, FCrackZip should be available on the software repository, and you could download it using the package manager. You may also download the latest version from HERE.

Since I’m using Ubuntu, I quickly installed FCrackZip from the command line using this command:

$ sudo apt-get install fcrackzip

After installing FCrackZip, you can either use brute force or dictionary mode to crack the password.

Here is a sample FCrackZip command one-liner using brute force:

$ fcrackzip -v -b -p aaaaaa -u your_zip_file.zip

Permanent link to this article: https://blog.openshell.in/2011/01/how-to-crack-password-protected-zip-files-using-linux/

How to Open/Extract RAR files in Ubuntu Linux

How to Open/Extract RAR files in Ubuntu Linux

If you happen to download a file that contains .rar extension, you will have to unpack or extract it first in order to view or use its content since it is a compressed or archived file. RAR is a proprietary documented archive file format that supports data compression, error recovery, and file spanning. RAR files are often created using the commercial software called WinRAR.

If you are using Ubuntu Linux and want to extract or unpack .rar files, there are several free and open-source applications that can help you get the job done.

Installing and Using Unrar:

For those of you who prefer a quick and lightweight RAR unarchiver, you may use Unrar. You can easily install it using the Ubuntu Software Center or from the Linux terminal:

$ sudo apt-get install unrar

After installing Unrar, you can immediately unpack or extract a .rar file (in current directory) using this command:

$ unrar e your_file.rar

If you only want to view the list of files the RAR archive contains, use this command:

$ unrar l your_file.rar

Permanent link to this article: https://blog.openshell.in/2011/01/how-to-openextract-rar-files-in-ubuntu-linux/

Flash Effect Image Loading with Jquery

Load images with flash effect using jquery. It is very useful script to loading images with nice effect on your web projects and also simple just seven lines of code.

CODE

<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script>
<script type=”text/javascript”>
$(document).ready(function()
{
var i = 0;
$(‘#imagesdiv img’).clone().appendTo($(‘#imagesdiv’));
$(‘#imagesdiv img’).each(function()
{
var me = this;
$(this).hide()
var j = i;
setTimeout(function()
{
$(me).fadeIn(1000);
}, i)
i += 100
});
});
</script>

//HTML Code
<div id=”imagesdiv”>
<img src=”1.jpg” alt=”” />
<img src=”2.jpg” alt=”” />
<img src=”3.jpg” alt=”” />
<img src=”4.jpg” alt=”” />
</div>

Permanent link to this article: https://blog.openshell.in/2011/01/flash-effect-image-loading-with-jquery/

Permanent link to this article: https://blog.openshell.in/2011/01/searching-techniques-with-sql/

Reset Forgotten MySQL Root Password

Reset MySQL Root Password in Linux:

You can reset forgotten MySQL database server password with following five easy steps in ubuntu.

Step 1: Stop the MySQL server process.

/etc/init.d/mysql stop

Step 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password.

mysqld_safe –skip-grant-tables

Step 3: Connect to mysql server as the root user.

mysql -u root

Step 4: Setup new mysql root account password i.e. reset mysql password.

mysql> use mysql;
mysql> update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit

Step 5: Exit and restart the MySQL server.

/etc/init.d/mysql restart

Reset MySQL Root Password in Windows:

If you are using a new version of MySQL Server, such as 5.0, the methods here might not work for you, or slightly different actions may need to be applied.

Step 1. Stop your MySQL server completely. This can be done by accessing the Services window inside Windows XP and Windows Server 2003, where you can stop the MySQL service.

Step 2. Open your MS-DOS command prompt using “cmd” inside the Run window. Inside it navigate to your MySQL bin folder, such as C:MySQLbin using the cd command.

Step 3. Execute the following command in the command prompt.

mysqld.exe -u root –skip-grant-tables

Step 4. Leave the current MS-DOS command prompt as it is, and open a new MS-DOS command prompt window.

Step 5. Navigate to your MySQL bin folder, such as C:MySQLbin using the cd command.

Step 6. Enter “mysql” and press enter.

Step 7. You should now have the MySQL command prompt working. Type “use mysql;” so that we switch to the “mysql” database.

use mysql;

Step 8. Execute the following command to update the password:

UPDATE user SET Password = PASSWORD(‘NEW_PASSWORD’) WHERE User = ‘root’;

However, you can now run any SQL command that you wish.

After you are finished close the first command prompt and type “exit;” in the second command prompt windows to disconnect successfully. You can now start the MySQL service.

Please note that the 8 step process above can differ depending on the MySQL version you are using, how you configured your server, etc. However, many times you can still easily work around a problem that you experience in any of the steps

Permanent link to this article: https://blog.openshell.in/2011/01/reset-forgotten-mysql-root-password/

CSS Tricks (Minimum Width for a Page)

Minimum Width for a Page

A very handy CSS command that exists is the min-width command, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page.

Unfortunately, IE doesn’t understand this command, so we’ll need to come up with a new way of making this functionality work in this browser. First, we’ll insert a  <div> under the   <body> tag, as we can’t assign a minimum width to the <body> :

<body>
<div class=”container”>

Next, we create our CSS commands, to create a minimum width of 600px:

#container
{
min-width: 600px;
width:expression(document.body.clientWidth < 600? “600px”: “auto” );
}

The first command is the regular minimum width command; the second is a short JavaScript command that only IE understands. Do note, though, that this command will cause your CSS document to become invalid; you may prefer to insert it into the head of each HTML document to get around this.

You might also want to combine this minimum width with a maximum width:

#container
{
min-width: 600px;
max-width: 1200px;
width:expression(document.body.clientWidth < 600? “600px” : document.body.clientWidth > 1200? “1200px” : “auto”);
}

Permanent link to this article: https://blog.openshell.in/2011/01/css-tricks-minimum-width-for-a-page/

Enable curl for PHP

We come across web applications which are written in PHP and require curl extension. PHP curl functions can used through use of libcurl. The libcurl was create by Daniel Sternberg. With the help of libcurl you can connect and communicate with webserver using different protocols. cURL stands for Client for URLs. It allows us to transfer files having URL syntax. It supports FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE.

Enable Curl in Ubuntu:

Once you have Lamp setup ready just type in following command in terminal to install curl library,

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

After installing libcurl you should  restart the web server with following command,

sudo /etc/init.d/apache2 restart

Enable Curl in Windows (XAMPP):

To enable curl library with Windows (XAMPP) we need to modify the php.ini files in our folder.

1) Locate the following files:
Installed Location phpphp.ini
Installed Location phpphp4php.ini

2) Uncomment the following line on your php.ini file by removing the semicolon.

;extension=php_curl.dll

3) Restart your apache server.

Now, you can check your phpinfo if curl was properly enabled.

Permanent link to this article: https://blog.openshell.in/2011/01/enable-curl-for-php/