Wednesday, May 23, 2012

How @font-face Works

The great news about CSS3 support of the @font-face selector, is that - unlike work-a-round techniques - it's easy to use. Yay! Fonts without hoops!
Just upload the font file you want to use to your server - making sure that you're not violating any copyright rules
In example here I am using font name Ubuntu. you can download this font from here
 - then embed it, using the following CSS:
Code:
 <html>
    <head>
        <title>
            Test font embeded
        </title>
    <style type="text/css">
            @font-face {
              font-family: yourFontName ;
              src: url( /ubuntu_title/Ubuntu-Title.ttf ) format("truetype");
            }
    
            /* Then use it like you would any other font */
            .yourFontName { font-family: yourFontName , verdana, helvetica, sans-serif;
            }
    </style>
    </head>
    <body>
        <h1 class="yourFontName">ubuntu title</h1>
    </body>
</html>

The CSS code above defines a font called "yourFontName". You may use the actual font name - or - for testing purposes a unique, made-up name. Whichever you use, all you need to do is reference it again in the CSS, wherever you want to use it.
That's it! Note: the CSS3 specification provides for several font formats: "truetype" (ttf), "opentype" (ttf,otf), "truetype-aat (ttf), "embedded-opentype" (eot) and "scalable-vector-graphic" (svg,svgz).

The result:
more references here


Tuesday, May 22, 2012

Connecting to a Remote Oracle Database with PHP


1, Download Oracle Instant Client package that match with Oracle Database version
    Example: http://www.oracle.com/technetwork/topics/winsoft-085727.html
2, Unzip file to directory C:\Program Files\Oracle Instant
3, Create a new file in that same directory named tnsnames.ora
     This is an important configuration file that allows you to create kind of a local reference to a remote Oracle database server. Paste the following into that new file:
YourServiceName =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = YourHost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = YourServiceName)
    )
  )
4, Add Environment Variable to your system
-          User variable: variable name: Path , variable value:  C:\Program Files\Oracle Instant
-          System variable: add new variable name: TNS_ADMIN , variable value C:\Program Files\Oracle Instant
This environment variable ensures that PHP will be able to find your tnsnames.ora file when it tries to connect via oci_connect(), so it's important.
5, To get your PHP scripts talking to the remote Oracle server, you'll use the oci_connect() function. you'll need to enable support for the oci8 module. To do this, open up your php.ini file and uncomment (remove the leading semicolon from) the line that reads:
;extension=php_oci8.dll 
it might be possible to only restart Apache (or whatever web server you're running), so you might give that a shot first just to see if you're lucky.


Then try code connect
<?php
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = YourHost)(PORT = 1521)))(CONNECT_DATA=(SID=ServiceName)))";$conn = oci_connect("UserName","Password",$db);

if ($conn) {
            echo "Connected<br>\n";
} else {
            echo "Connected fail<br>\n";
}

Note: if you still see the message Fatal error: Call to undefined function oci_connect()
Copy all files from directory Oracle Instant to directory apache/bin

Reference:
http://www.bernzilla.com/item.php?id=784

How to create Virtual Host in Apache













The term Virtual Host refers to the practice of running more than one web site (such as company1.example.com and company2.example.com) on a single machine. Virtual hosts can be "IP-based", meaning that you have a different IP address for every web site, or "name-based", meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user.
Apache was one of the first servers to support IP-based virtual hosts right out of the box. Versions 1.1 and later of Apache support both IP-based and name-based virtual hosts (vhosts). The latter variant of virtual hosts is sometimes also called host-based or non-IP virtual hosts.

You can configure in your Apache server step by step below:

1, Enable LoadModule rewrite_module modules/mod_rewrite in file httpd.conf in apache/apache_v_x/conf directory

2, Enable Virtual hosts
Remove # in this line Include conf/extra/httpd-vhosts.conf in file httpd.conf in apache/apache_v_x/conf directory

3, Add virtual host in httpd-vhosts.conf in apache/apache_v_x/conf/extra directory
Add following script

<VirtualHost *:80>
ServerAdmin webmaster@angkordigitalsolutions.localhost
DocumentRoot "C:\wamp\www\angkordigitalsolutions"
ServerName angkordigitalsolutions.localhost
#ServerAlias www.dummy-host.localhost
#ErrorLog "logs/dummy-host.localhost-error.log"
#CustomLog "logs/dummy-host.localhost-access.log" common
</VirtualHost>

4, Create host in C:\Windows\System32\drivers\etc
127.0.0.1 angkordigitalsolutions.localhost

Last, you need to restart your server

Related post: How to increase web app performance better

Tuesday, February 14, 2012

Introduction to HeidiSQL 7.0.0.4053

Some infos around HeidiSQL Project website: http://www.heidisql.com/ Google Code: http://code.google.com/p/heidisql/ *** What is HeidiSQL? HeidiSQL is an easy-to-use interface and a "working-horse" for web-developers using the popular MySQL-Database. It allows you to manage and browse your databases and tables from an intuitive Windows® interface. With HeidiSQL you will also be able to * Manage Microsoft SQL Servers, with a reduced feature set * Generate nice SQL-exports * Synchronize tables between two databases * Manage user-privileges * Import text-files * Export grid-data as CSV, HTML, XML, SQL, LaTeX and Wiki style * Browse and edit table-data using a comfortable grid * Create and edit tables, views, stored routines, triggers and scheduled events * Bulk edit tables (move to db, change engine, collation etc.) * Batch-insert ascii or binary files into tables * Write queries with customizable syntax-highlighting and code-completion * Profile your queries * Pretty reformat disordered SQL * Monitor and kill client-processes * Connect to servers via commandline * Find specific text in all tables of all databases of one server * Optimize and repair tables in a batch manner * And much more *** Requirements: HeidiSQL runs fine on Windows 2000, XP, Vista and 7. Running HeidiSQL on Wine/Linux also works fine, apart from some minor graphical glitches, e.g. the transparent areas of all icons are displayed with black color. HeidiSQL does not run on Windows 95/98 or ME, as the Unicode extensions are not available on these systems. *** Command line switches Although HeidiSQL is a pure GUI application, it can be automated for connecting and opening files via command line parameters. Parameter names are case sensitive and are based on those used by the MySQL command line applications, e.g. mysqldump. -d, -description Session name -h, -host Host name -u, -user User name -p, -password Password -P, -port Port (defaults to 3306 if not given) -S, -socket Socket name (for connecting via named pipe) --psettings Custom filename for portable settings. Ignored if file does not exist. Examples: * Start over using stored settings from session "xyz": c:\path\to\heidisql.exe -d=xyz c:\path\to\heidisql.exe -description=xyz * Connect with different username or port: c:\path\to\heidisql.exe -d=xyz -u=OtherUser c:\path\to\heidisql.exe -d=xyz -P=3307 * Connect to a non-stored session: c:\path\to\heidisql.exe -h=localhost -u=root -p=Mypass -P=3307 * Open multiple .sql files in query tabs: c:\path\to\heidisql.exe fileA.sql path\to\fileB.sql fileC.sql ... * Use custom portable settings file: c:\path\to\heidisql.exe --psettings=c:\temp\p.txt *** License: HeidiSQL is OpenSource and released under GPL (GNU GENERAL PUBLIC LICENSE). Probably HeidiSQL saved you a lot of time and you like it. In this case you may make a donation here: http://www.heidisql.com/donate.php *** Credits: Ansgar Becker (project lead and development), David Dindorp (former development), Francisco Ernesto Teixeira (former development), Andrew Brampton (LaTeX export), Sven Lorenz (graphics), Mikkel M. Gerhardt-Pedersen (additional bugfixes), Mike Lischke + Timo Tegtmeier (VirtualTreeView, GLPL), Maël Hörz (SynEdit, MPL), Iztok Kacin (Cromis.DirectoryWatch, BSD License), Mark James (Silk icons, Creative Commons 2.5), Jordan Russell (Inno Setup) 1000 thanks to MySQL for great database software To download file install: heidisql.googlecode.com/files/HeidiSQL_7.0_Setup.exe Resource: file readme.txt content of heidisql

Friday, February 10, 2012

Introduction to iReport

iReport is the free, open source report designer for JasperReports. Create very sophisticated layouts containing charts, images, subreports, crosstabs and much more. Access your data through JDBC, TableModels, JavaBeans, XML, Hibernate, CSV, and custom sources. Then publish your reports as PDF, RTF, XML, XLS, CSV, HTML, XHTML, text, DOCX, or OpenOffice.