- Requirements:
Firstly, we must have Netbeans, Xdebug, Chromium (or Google Chrome) installed.How to check if Xdebug installed?user@ubuntu:~$ php -v PHP 5.3.6-13ubuntu3.6 with Suhosin-Patch (cli) (built: Feb 11 2012 02:17:16) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
- Install Xdebug helper extension
Visit this URL using Chromium (or Google Chrome).
Press [Add To Chrome] button to install the Xdebug helper extension. - Configure Xdebug helper options
Under Chrome extensions, Xdebug helper, press Options.
Select Netbeans for IDE key.
Add domains to the domain filter whitelist. - Configure Netbeans
Tools > Options > General > Web Browser, press [Edit] button.
Press [Add] button to add a new browser, set configuration as below:Process:
/usr/bin/chromium-browser
or
/usr/bin/google-chromeArguments:
-remote “{URL}” –user-data-dir=~/.cache/chromium
or
-remote “{URL}” –user-data-dir=~/.cache/google-chrome[OK] - Debugging
You can now debug a project (Ctrl+F5) or debug a file (Ctrl+Shift+F5)To control debugger session
Finish Debugger Session (Shift+F5)
Continue (F5)
Step Over (F8)
Step Into (F7)
Step Out (Ctrl+F7)
Run to Cursor (F4)
or use the buttons in Debug Toolbar
April 3, 2012
Debugging PHP application with Netbeans, Xdebug, and Chromium (or Google Chrome) in Ubuntu
March 24, 2012
Web Development Environment in Ubuntu Linux
PART 1 – Ubuntu
Ubuntu is a computer operating system based on the Debian Linux distribution and distributed as free and open source software, using its own desktop environment.
- Download & install Ubuntu Linux.
- Update package index and upgrade OS.
To update package indexsudo apt-get update
To upgrade all installed packages
sudo apt-get upgrade
- Installing software packages
To install a packagesudo apt-get install <package-name>
To remove a package
sudo apt-get remove <package-name>
PART 2 – LAMP
LAMP is an acronym for a solution stack of free, open source software, referring to the first letters of Linux (operating system), Apache HTTP Server, MySQL (database software) and PHP (or sometimes Perl or Python), principal components to build a viable general purpose web server.
- Install LAMP
To install Apache 2, MySQL 5, PHP 5, Apache PHP5 module, PHP MySQL package.sudo apt-get install apache2 sudo apt-get install mysql-server sudo apt-get install mysql-client sudo apt-get install php5 sudo apt-get install libapache2-mod-php5 sudo apt-get install php5-mysql
or simply
sudo apt-get install lamp-server^
to install all packages below:
perl-modules apache2 mysql-server-core-5.1 mysql-client-core-5.1 perl libmysqlclient16 libdbi-perl apache2-mpm-prefork apache2.2-common apache2.2-bin apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libcap2 ssl-cert libwrap0 mysql-server libapache2-mod-php5 php5-common php5-cli libclass-isa-perl libdbd-mysql-perl libplrpc-perl libhtml-template-perl mysql-common libnet-daemon-perl libpod-plainer-perl libswitch-perl tcpd mysql-client-5.1 mysql-server-5.1 php5-mysql
PART 3 – Optional Packages
- Zend Framework Zend Framework is an open source, object oriented web application framework for PHP 5.
To install Zend Framwork CLIsudo apt-get install zend-framework-bin
- PHPUnit PHPUnit is a unit testing software framework for PHP.
To install PHPUnitsudo apt-get install php-pear sudo pear channel-update pear.php.net sudo pear channel-discover pear.phpunit.de sudo pear channel-discover pear.symfony-project.com sudo pear update-channels sudo pear upgrade-all sudo pear install --alldeps phpunit/PHPUnit sudo apt-get install phpunit
or
sudo apt-get install php-pear sudo pear update-channels sudo pear config-set auto_discover 1 sudo pear install --alldeps pear.phpunit.de/PHPUnit sudo apt-get install phpunit
- Xdebug
Xdebug is a PHP extension which provides debugging and profiling capabilities.
To install Xdebugsudo apt-get install php5-xdebug
Add the following lines into etc/php5/conf.d/xdebug.ini if it does not exist.
zend_extension = “/usr/lib/php5/20090626-lfs/xdebug.so” xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_port=9000
- Optional PHP extensions
To install PHP extensionssudo apt-get install php5-cgi php5-cli php5-curl php5-gd php5-idn php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-mysql php5-pgsql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
* install only which needed.
- MySQL GUI tools
- Install MySQL Administrator and MySQL Query Browser
sudo apt-get install mysql-admin sudo apt-get install mysql-query-browser
and/or
- Install MySQL Workbench
sudo apt-get install mysql-workbench sudo apt-get install mysql-query-browser
and/or
- Install phpMyAdmin
sudo apt-get install phpmyadmin
Add the following line into /etc/apache2/apache2.conf
Include /etc/phpmyadmin/apache.conf
- Install MySQL Administrator and MySQL Query Browser
- Integrated Development Environment
- Eclipse
Install Eclipse IDEsudo apt-get install eclipse
Install PHP Development Tools (PDT)
sudo add-apt-repository ppa:yogarine/eclipse/ubuntu sudo apt-get update sudo apt-get install eclipse-pdt
and/or
- Netbeans IDE
Download & install Netbeans IDE
Install Javasudo apt-get install sun-java6-jdk sun-java6-jre
Download & install Netbeans
sudo sh ./netbeans-7.1.1-ml-php-linux.sh
Install Netbeans
sudo apt-get install netbeans
Or download & install the Java SE and NetBeans Cobundle
sudo sh ./jdk-7u3-nb-7_1_1-linux-ml.sh
- Eclipse
- Web browser debugging tool
- Firebug Install Firebug. or
- Developer tools in Chromium Browser Install Chromium Browser
sudo apt-get install chromium-browser
Press Ctrl+Shift+I to open Developer Tools
- Install version control system
- Subversion
Subversion (SVN) is a software versioning and revision control system distributed under an open source license.
Install Subversionsudo apt-get install subversion sudo apt-get install libapache2-svn
- Git
Git is a distributed revision control and source code management (SCM) system with an emphasis on speed.
Install Gitsudo apt-get install git-core sudo apt-get install git-doc sudo apt-get install git-svn sudo apt-get build-dep git-core git-doc git-svn
- Subversion
PART 4 – Packages version
To check installed packages version
apache2 -v php -v mysql -V phpunit --version git --version svn --version java -version zf show version
February 3, 2012
Duplicated placeholder output
Issue:
- Zend Framework placeholder (headTitle, headMeta, headLink, headScript, headStyle, inlineScript) creates twice or multiple title/meta/link/script tags in HTML.
- Duplicated title/meta/link/script tags generated from Zend Framework placeholder.
- e.g.:
source:
<?php echo $this->headScript()->appendFile("/scripts/global.js") ?> <?php echo $this->headScript()->appendFile("/scripts/main.js") ?>
output:
<script src="/scripts/global.js" type="text/javascript"></script> <script src="/scripts/global.js" type="text/javascript"></script> <script src="/scripts/main.js" type="text/javascript"></script>
Reason:
- Echo will output all elements in a placeholder.
Solution:
- Echo only once for each placeholder.
- e.g.:
<?php $this->headLink()->appendStylesheet('/styles/global.css') ?> <?php $this->headLink()->appendStylesheet('/styles/main.css') ?> <?php echo $this->headLink() ?> <?php $this->headScript()->appendFile("/scripts/global.js") ?> <?php $this->headScript()->appendFile("/scripts/main.js") ?> <?php echo $this->headScript() ?>
Resource matching “view” not found
Issue:
-
[error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource matching "view" not found' in /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php:694 Stack trace: #0 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(629): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('view') #1 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap('view') #2 /home/user/ZendFramework-1.11.11/bin/jquery/application/Bootstrap.php(7): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap('view') #3 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(669): Bootstrap->_initDoctype() #4 /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php(622): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('doctype') #5 /home/user/ZendFramework-1.11.11/library/Zend/Appli in /home/user/ZendFramework-1.11.11/library/Zend/Application/Bootstrap/BootstrapAbstract.php on line 694
Reason:
- Resource matching “view” not found.
Solution:
- Add the following line to application.ini
resources.view[] =
January 15, 2012
Double/Multiple execute of bootstrap
Issue:
- bootstrap is being executed twice.
- specified action is being called twice.
- counter increased twice per hit.
Reason:
- Web browser loads a file which is not exist, either through src or href attribute with invalid or empty value (e.g. favicon.ico, global.css, & etc.), web server treats it as “Page not found” error (404).
- Default configuration for Zend application, the default application (index.php) will handle error 404, an error message “Invalid controller specified” will be displayed, indirectly causing code in bootstrap.php also being executed.
Solution:
- Create a favicon.ico in DocumentRoot. and
- Prevent loading any file which is not exist. or
- Modify web server configuration (httpd.conf or .htaccess),
rewrite rule to exclude paths for specified file type.RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} (.*).(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt|swf)$ RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L]
It is not safe to rely on the system’s timezone settings
Issue:
- Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘8.0/no DST’ instead in ___.php on line ___
- Warning: strtotime() [function.strtotime]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘8.0/no DST’ instead in ___.php on line ___
- ERROR: date.timezone not set in php.ini.
Reason:
- Timezone must be defined for PHP.
Solution:
- set timezone within your php code
date_default_timezone_set("___");
or
set timezone in your application php.ini
date.timezone = "___"
-
Options:
Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara Africa/Asmera Africa/Bamako Africa/Bangui Africa/Banjul Africa/Bissau Africa/Blantyre Africa/Brazzaville Africa/Bujumbura Africa/Cairo Africa/Casablanca Africa/Ceuta Africa/Conakry Africa/Dakar Africa/Dar_es_Salaam Africa/Djibouti Africa/Douala Africa/El_Aaiun Africa/Freetown Africa/Gaborone Africa/Harare Africa/Johannesburg Africa/Juba Africa/Kampala Africa/Khartoum Africa/Kigali Africa/Kinshasa Africa/Lagos Africa/Libreville Africa/Lome Africa/Luanda Africa/Lubumbashi Africa/Lusaka Africa/Malabo Africa/Maputo Africa/Maseru Africa/Mbabane Africa/Mogadishu Africa/Monrovia Africa/Nairobi Africa/Ndjamena Africa/Niamey Africa/Nouakchott Africa/Ouagadougou Africa/Porto-Novo Africa/Sao_Tome Africa/Timbuktu Africa/Tripoli Africa/Tunis Africa/Windhoek America/Adak America/Anchorage America/Anguilla America/Antigua America/Araguaina America/Argentina/Buenos_Aires America/Argentina/Catamarca America/Argentina/ComodRivadavia America/Argentina/Cordoba America/Argentina/Jujuy America/Argentina/La_Rioja America/Argentina/Mendoza America/Argentina/Rio_Gallegos America/Argentina/Salta America/Argentina/San_Juan America/Argentina/San_Luis America/Argentina/Tucuman America/Argentina/Ushuaia America/Aruba America/Asuncion America/Atikokan America/Atka America/Bahia America/Bahia_Banderas America/Barbados America/Belem America/Belize America/Blanc-Sablon America/Boa_Vista America/Bogota America/Boise America/Buenos_Aires America/Cambridge_Bay America/Campo_Grande America/Cancun America/Caracas America/Catamarca America/Cayenne America/Cayman America/Chicago America/Chihuahua America/Coral_Harbour America/Cordoba America/Costa_Rica America/Cuiaba America/Curacao America/Danmarkshavn America/Dawson America/Dawson_Creek America/Denver America/Detroit America/Dominica America/Edmonton America/Eirunepe America/El_Salvador America/Ensenada America/Fort_Wayne America/Fortaleza America/Glace_Bay America/Godthab America/Goose_Bay America/Grand_Turk America/Grenada America/Guadeloupe America/Guatemala America/Guayaquil America/Guyana America/Halifax America/Havana America/Hermosillo America/Indiana/Indianapolis America/Indiana/Knox America/Indiana/Marengo America/Indiana/Petersburg America/Indiana/Tell_City America/Indiana/Vevay America/Indiana/Vincennes America/Indiana/Winamac America/Indianapolis America/Inuvik America/Iqaluit America/Jamaica America/Jujuy America/Juneau America/Kentucky/Louisville America/Kentucky/Monticello America/Knox_IN America/Kralendijk America/La_Paz America/Lima America/Los_Angeles America/Louisville America/Lower_Princes America/Maceio America/Managua America/Manaus America/Marigot America/Martinique America/Matamoros America/Mazatlan America/Mendoza America/Menominee America/Merida America/Metlakatla America/Mexico_City America/Miquelon America/Moncton America/Monterrey America/Montevideo America/Montreal America/Montserrat America/Nassau America/New_York America/Nipigon America/Nome America/Noronha America/North_Dakota/Beulah America/North_Dakota/Center America/North_Dakota/New_Salem America/Ojinaga America/Panama America/Pangnirtung America/Paramaribo America/Phoenix America/Port-au-Prince America/Port_of_Spain America/Porto_Acre America/Porto_Velho America/Puerto_Rico America/Rainy_River America/Rankin_Inlet America/Recife America/Regina America/Resolute America/Rio_Branco America/Rosario America/Santa_Isabel America/Santarem America/Santiago America/Santo_Domingo America/Sao_Paulo America/Scoresbysund America/Shiprock America/Sitka America/St_Barthelemy America/St_Johns America/St_Kitts America/St_Lucia America/St_Thomas America/St_Vincent America/Swift_Current America/Tegucigalpa America/Thule America/Thunder_Bay America/Tijuana America/Toronto America/Tortola America/Vancouver America/Virgin America/Whitehorse America/Winnipeg America/Yakutat America/Yellowknife Antarctica/Casey Antarctica/Davis Antarctica/DumontDUrville Antarctica/Macquarie Antarctica/Mawson Antarctica/McMurdo Antarctica/Palmer Antarctica/Rothera Antarctica/South_Pole Antarctica/Syowa Antarctica/Vostok Arctic/Longyearbyen Asia/Aden Asia/Almaty Asia/Amman Asia/Anadyr Asia/Aqtau Asia/Aqtobe Asia/Ashgabat Asia/Ashkhabad Asia/Baghdad Asia/Bahrain Asia/Baku Asia/Bangkok Asia/Beirut Asia/Bishkek Asia/Brunei Asia/Calcutta Asia/Choibalsan Asia/Chongqing Asia/Chungking Asia/Colombo Asia/Dacca Asia/Damascus Asia/Dhaka Asia/Dili Asia/Dubai Asia/Dushanbe Asia/Gaza Asia/Harbin Asia/Hebron Asia/Ho_Chi_Minh Asia/Hong_Kong Asia/Hovd Asia/Irkutsk Asia/Istanbul Asia/Jakarta Asia/Jayapura Asia/Jerusalem Asia/Kabul Asia/Kamchatka Asia/Karachi Asia/Kashgar Asia/Kathmandu Asia/Katmandu Asia/Kolkata Asia/Krasnoyarsk Asia/Kuala_Lumpur Asia/Kuching Asia/Kuwait Asia/Macao Asia/Macau Asia/Magadan Asia/Makassar Asia/Manila Asia/Muscat Asia/Nicosia Asia/Novokuznetsk Asia/Novosibirsk Asia/Omsk Asia/Oral Asia/Phnom_Penh Asia/Pontianak Asia/Pyongyang Asia/Qatar Asia/Qyzylorda Asia/Rangoon Asia/Riyadh Asia/Saigon Asia/Sakhalin Asia/Samarkand Asia/Seoul Asia/Shanghai Asia/Singapore Asia/Taipei Asia/Tashkent Asia/Tbilisi Asia/Tehran Asia/Tel_Aviv Asia/Thimbu Asia/Thimphu Asia/Tokyo Asia/Ujung_Pandang Asia/Ulaanbaatar Asia/Ulan_Bator Asia/Urumqi Asia/Vientiane Asia/Vladivostok Asia/Yakutsk Asia/Yekaterinburg Asia/Yerevan Atlantic/Azores Atlantic/Bermuda Atlantic/Canary Atlantic/Cape_Verde Atlantic/Faeroe Atlantic/Faroe Atlantic/Jan_Mayen Atlantic/Madeira Atlantic/Reykjavik Atlantic/South_Georgia Atlantic/St_Helena Atlantic/Stanley Australia/ACT Australia/Adelaide Australia/Brisbane Australia/Broken_Hill Australia/Canberra Australia/Currie Australia/Darwin Australia/Eucla Australia/Hobart Australia/LHI Australia/Lindeman Australia/Lord_Howe Australia/Melbourne Australia/North Australia/NSW Australia/Perth Australia/Queensland Australia/South Australia/Sydney Australia/Tasmania Australia/Victoria Australia/West Australia/Yancowinna Brazil/Acre Brazil/DeNoronha Brazil/East Brazil/West Canada/Atlantic Canada/Central Canada/East-Saskatchewan Canada/Eastern Canada/Mountain Canada/Newfoundland Canada/Pacific Canada/Saskatchewan Canada/Yukon CET Chile/Continental Chile/EasterIsland CST6CDT Cuba EET Egypt Eire EST EST5EDT Etc/GMT Etc/GMT+0 Etc/GMT+1 Etc/GMT+10 Etc/GMT+11 Etc/GMT+12 Etc/GMT+2 Etc/GMT+3 Etc/GMT+4 Etc/GMT+5 Etc/GMT+6 Etc/GMT+7 Etc/GMT+8 Etc/GMT+9 Etc/GMT-0 Etc/GMT-1 Etc/GMT-10 Etc/GMT-11 Etc/GMT-12 Etc/GMT-13 Etc/GMT-14 Etc/GMT-2 Etc/GMT-3 Etc/GMT-4 Etc/GMT-5 Etc/GMT-6 Etc/GMT-7 Etc/GMT-8 Etc/GMT-9 Etc/GMT0 Etc/Greenwich Etc/UCT Etc/Universal Etc/UTC Etc/Zulu Europe/Amsterdam Europe/Andorra Europe/Athens Europe/Belfast Europe/Belgrade Europe/Berlin Europe/Bratislava Europe/Brussels Europe/Bucharest Europe/Budapest Europe/Chisinau Europe/Copenhagen Europe/Dublin Europe/Gibraltar Europe/Guernsey Europe/Helsinki Europe/Isle_of_Man Europe/Istanbul Europe/Jersey Europe/Kaliningrad Europe/Kiev Europe/Lisbon Europe/Ljubljana Europe/London Europe/Luxembourg Europe/Madrid Europe/Malta Europe/Mariehamn Europe/Minsk Europe/Monaco Europe/Moscow Europe/Nicosia Europe/Oslo Europe/Paris Europe/Podgorica Europe/Prague Europe/Riga Europe/Rome Europe/Samara Europe/San_Marino Europe/Sarajevo Europe/Simferopol Europe/Skopje Europe/Sofia Europe/Stockholm Europe/Tallinn Europe/Tirane Europe/Tiraspol Europe/Uzhgorod Europe/Vaduz Europe/Vatican Europe/Vienna Europe/Vilnius Europe/Volgograd Europe/Warsaw Europe/Zagreb Europe/Zaporozhye Europe/Zurich Factory GB GB-Eire GMT GMT+0 GMT-0 GMT0 Greenwich Hongkong HST Iceland Indian/Antananarivo Indian/Chagos Indian/Christmas Indian/Cocos Indian/Comoro Indian/Kerguelen Indian/Mahe Indian/Maldives Indian/Mauritius Indian/Mayotte Indian/Reunion Iran Israel Jamaica Japan Kwajalein Libya MET Mexico/BajaNorte Mexico/BajaSur Mexico/General MST MST7MDT Navajo NZ NZ-CHAT Pacific/Apia Pacific/Auckland Pacific/Chatham Pacific/Chuuk Pacific/Easter Pacific/Efate Pacific/Enderbury Pacific/Fakaofo Pacific/Fiji Pacific/Funafuti Pacific/Galapagos Pacific/Gambier Pacific/Guadalcanal Pacific/Guam Pacific/Honolulu Pacific/Johnston Pacific/Kiritimati Pacific/Kosrae Pacific/Kwajalein Pacific/Majuro Pacific/Marquesas Pacific/Midway Pacific/Nauru Pacific/Niue Pacific/Norfolk Pacific/Noumea Pacific/Pago_Pago Pacific/Palau Pacific/Pitcairn Pacific/Pohnpei Pacific/Ponape Pacific/Port_Moresby Pacific/Rarotonga Pacific/Saipan Pacific/Samoa Pacific/Tahiti Pacific/Tarawa Pacific/Tongatapu Pacific/Truk Pacific/Wake Pacific/Wallis Pacific/Yap Poland Portugal PRC PST8PDT ROC ROK Singapore Turkey UCT Universal US/Alaska US/Aleutian US/Arizona US/Central US/East-Indiana US/Eastern US/Hawaii US/Indiana-Starke US/Michigan US/Mountain US/Pacific US/Pacific-New US/Samoa UTC W-SU WET Zulu
Call to undefined function token_get_all()
Issue:
- Unable to create action using Zend Framework Command Line Tool.
Fatal error: Call to undefined function token_get_all() in C:Program FilesZend ZendServershareZendFrameworklibraryZendReflectionFile.php on line 301
Reason:
- PHP tokenizer extention has not been enabled.
Solution:
- If PHP compiled without tokenizer (–disable-tokenizer), recompile it with tokenizer (–enable-tokenizer).
- If PHP configuration has not enabling tokenizer, edit php.ini, add or uncomment the tokenizer extension.
extension=tokenizer.so
or
extension=php_tokenizer.dll
October 23, 2010
Roots in dynamic and input text field
This is a solution for using Square root (SQRT), cube root, nth root, and other roots formula in dynamic and input text field, extended from the article How to use subscript & superscript in dynamic and input text field.
- Download & install GG Root Sans N, GG Root Sans Radical, GG Root Sans Radicand fonts.
- Create a dynamic text field with Arial font embeded. Set the HTML property to true.
- Create a dynamic text field with GG Root Sans N font embeded.
- Create a dynamic text field with GG Root Sans Radical font embeded.
- Create a dynamic text field with GG Root Sans Radicand font embeded.
- Use HTML tag to set text to roots formula like below:
my_txt.html = true; my_txt.htmlText = "GG Root Sans<br>"; my_txt.htmlText += "<font face="GG Root Sans Radical"> </font><font face="GG Root Sans Radicand">2</font>"; my_txt.htmlText += "<font face="GG Root Sans Radical">n</font><font face="GG Root Sans Radicand">x</font>"; my_txt.htmlText += "<font face="GG Root Sans Radical">2</font><font face="GG Root Sans Radicand">3</font>"; my_txt.htmlText += "g = <font face="GG Root Sans N">f(d+e</font><font face="GG Root Sans Radical">)</font><font face="GG Root Sans Radicand">(ax+by)(ax-by)</font>";
Demo:
Download:
December 9, 2009
Hello, Google Chrome World! Log for my first Google Chrome extension test.
Google Chrome now has extensions, and GG now want to have create some Google Chrome extensions ^^
By referring to the Getting Started tutorial and samples on Google Code Labs, I’ve created my first Google Chrome “Hello, World!” extension. It was much easier than expected.
Steps:
- Create a folder called mygc_ext01.
- Create a text file called manifest.json inside mygc_ext01 folder, contains code:
{ "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "browser_action": { "default_icon": "icon.png" }, "permissions": [ "http://api.flickr.com/" ] }
- Prepare an PNG icon called icon.png put into the same folder.
I’ve tested it with .ico file in my Windows 7, it works.
If we use a .ico icon, we should also change the value for default_icon to our .ico filename (e.g. filename.ico). - Now load the extension into Google Chrome.
Click on Tools menu and choose Extensions.
Enable Developer Mode.
Click Load unpacked extension…
Browse for the mygc_ext01 folder, and press OK.
My icon successfully displayed as an extension button on Google Chrome . - Edit manifest.json, add popup parameter below default_icon
... "browser_action": { "default_icon": "icon.png", "popup": "mypage.html" }, ...
- Create a new file called “mypage.html” put into the same folder.
Display something in the html page body. - On Google Chrome Extensions Developer Mode, press the Reload link behind My First Extension. And now if I click on my extension button, mypage.html will be displayed in a popup.
I’m planning to create some Google Chrome extension, but for now still need to sort my bunch of idea.
Below is an working example mygc_ext01 where mypage.html contains code to retrieve and display some picture from flickr.
Download:
Google Chrome extension sample code
Reference:
Getting Started: Building a Chrome Extension