Tuesday, March 17, 2009

utf8_unicode_ci vs utf8_general_ci

utf8_general_ci is a very simple collation. What it does - it just
- removes all accents
- then converts to upper case
and uses the code of this sort of "base letter" result letter to compare.

For example, these Latin letters: ÀÁÅåāă (and all other Latin letters "a"
with any accents and in any cases) are all compared as equal to "A".

utf8_unicode_ci uses the default Unicode collation element table (DUCET).

The main differences are:

1. utf8_unicode_ci supports so called expansions and ligatures, for example:
German letter ß (U+00DF LETTER SHARP S) is sorted near "ss"
Letter Π(U+0152 LATIN CAPITAL LIGATURE OE) is sorted near "OE".

utf8_general_ci does not support expansions/ligatures, it sorts
all these letters as single characters, and sometimes in a wrong order.

2. utf8_unicode_ci is *generally* more accurate for all scripts.
For example, on Cyrillic block:
utf8_unicode_ci is fine for all these languages:
Russian, Bulgarian, Belarusian, Macedonian, Serbian, and Ukrainian.
While utf8_general_ci is fine only for Russian and Bulgarian subset of Cyrillic.
Extra letters used in Belarusian, Macedonian, Serbian, and Ukrainian
are sorted not well.

The disadvantage of utf8_unicode_ci is that it is a little bit
slower than utf8_general_ci.

So when you need better sorting order - use utf8_unicode_ci,
and when you utterly interested in performance - use utf8_general_ci.

Wednesday, March 11, 2009

Rounded corners with CSS3

W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items.

border-radius: 6px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border: 1px #cccccc solid;
padding: 10px;




Monday, March 9, 2009

Difference between Sub domain,Parked Domain and Add-on domain

Sub domain

  • Lets say your domain is mysite.com.
  • You install a Message Board and put in in a directory called mysite.com/board/.
  • You can turn the directory board into a sub-domain by adding it as a sub-domain from your Control Panel.
  • Now you can access your Message board as either mysite.com/board OR board.mysite.com

Parked Domain

  • You have two domains mysite.com and my-other-site.com.
  • mysite.com is the domain of your website and you want to add my-other-site.com.
  • You want them both to go to the same place. In other words, when someone types either www.mysite.com or www.my-other-site.com they will go to the same page(s) on your website.
  • In order to have additional parked domains you need to purchase them from a registry.

Add-On Domains

  • You have two domains mysite.com and my-other-site.com.
  • You want the two domains to be totally separate/independent websites.
  • In order to have additional add-on domains you need to purchase them from a registry.

Saturday, March 7, 2009

URL read in PHP

file_get_contents with proxy server:
$context = array (
'http' => array (
'proxy' => 'hostIP:hostPort', 'request_fulluri' => true,
$context = stream_context_create ($context);
$data = file_get_contents("http://www.fevoxtech.com",0,$context);
echo $data;

file_get_contents without proxy server:

$data = file_get_contents("http://www.fevoxtech.com",0);
echo $data;

cURL with proxy server:

$url = "http://www.fevoxtech.com";
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_PROXY, IP Address);
curl_setopt($ch, CURLOPT_PROXYPORT, Port No);
$file_contents = curl_exec($ch);

cURL without proxy server:

$url = "http://www.fevoxtech.com";
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);

Friday, March 6, 2009

Basic Cryptography

Cryptography means that process of data encryption and decryption method for communicate on unsafe media. Using these cryptographic methods such as encryption techniques, algorithms we can protect our data against hackers, criminals and etc.
In day-today life
cryptographic methods use for privacy, trust, electronic payments, access control and etc. For a examples if someone wants to send information to another location, he should use plain text.

to be cont...

Thursday, March 5, 2009

JProgressBar Constructors

These are five different constructors for JProgressBar:

public JProgressBar()
JProgressBar aJProgressBar = new JProgressBar();

public JProgressBar(int orientation)
JProgressBar aJProgressBar = new JProgressBar(JProgressBar.VERTICAL);
JProgressBar bJProgressBar = new JProgressBar(JProgressBar.HORIZONTAL);

public JProgressBar(int minimum, int maximum)
JProgressBar aJProgressBar = new JProgressBar(0, 500);

public JProgressBar(int orientation, int minimum, int maximum)
JProgressBar aJProgressBar = new JProgressBar(JProgressBar.VERTICAL, 0, 1000);

public JProgressBar(BoundedRangeModel model)
// Data model, initial value 0, range 0-250, and extent of 0
DefaultBoundedRangeModel model = new DefaultBoundedRangeModel(0, 0, 0, 250);
JProgressBar aJProgressBar = new JProgressBar(model);

Monday, March 2, 2009

How to install, configure and start SAMBA Server

For debian based distributions at the prompt enter the following command to install the SAMBA server applications:

sudo apt-get install samba smbfs

You can configure SAMBA server by editing /etc/samba/smb.conf file. Also by using

man smb.conf

command, can view the SAMBA Manual.

To start the SAMBA Server,

sudo /etc/init.d/samba start
sudo /etc/init.d/samba restart
sudo /etc/init.d/samba stop

Sunday, March 1, 2009

How to add an image in a Swing Component

This is the simplest way to add image in your swing component, because we have tried lot of alternative methods and finally we realize that this is the best way to go ahead.
Normally, If you want to add image to your swing component you can use javax.swing.ImageIcon class and use like this,

ImageIcon icon = new ImageIcon("logo.png");

But the thing is when you create the Java Archive (JAR) file or Applet, sometimes image will disappear from your swing component, because the executable file lost the image path.
To skip this vulnerability, we have used the java.net.URL class and loaded the resource file using java.lang.ClassLoader.getResource() Method. Then you can use URL file naming convention for locating files in your application.

package fvx.swing;

import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class IconButton extends JPanel {
public IconButton() {
URL imageUrl = getClass().getResource("logo.png");
ImageIcon icon = new ImageIcon(imageUrl);

JButton btn = new JButton(icon);

public static void main(String[] args) {
JFrame frame = new JFrame();
frame.getContentPane().add(new IconButton());

frame.setSize(250, 250);

Please, feel free to add your comment about this article.