08 December, 2012

Running PHP5 and PHP4 simultaneously on Windows

Running PHP5 and PHP4 simultaneously on Windows. Are we lazy ?

This is my rant about this topic ! Since the early days of PHP, I see regularly articles on this subject. Today I just read a new article about that, Reminder : You *Can* Run PHP4 And PHP5 On The Same Box At The Same Time. What’s the problem ?
When we write PHP scripts, we often want to know if our code runs well on other versions of PHP that the one installed on our system. Often this is to test PHP4 and PHP5, but not necessarily. I read many answers to this problem :
- Running one version as an Apache module for .php files and the other one as cgi for .php5 files (or vice versa for php4) : Install PHP5 and PHP4 on the same Apache server
- Install two Apache services : Switching Between Multiple php Versions Using Apache on Windows
- PHP as an Apache module for one php version and another one using CGI inside a VirtualHost Plusieurs versions de PHP sur un même serveur french
- Running one PHP version as an Apache module and the other one as CGI via mod_suphp, as Stuart Herbert article suggest (I never heard of “mod_suphp” before)
- Finally Stuart Herbert article point us to Configure Apache to work with PHP4 and PHP5 that sums up above methods as well as different more advanced ways to do it.
Do we really need to run simultaneously PHP4 and PHP5. I don’t think so. Yes we need to test with both versions, but when we start a coding session, we do not test every function or method with both versions as soon as we write them, but instead once we have added a new feature or something like that. Are we become so lazy that we can’t just change directory names and restart Apache ?
As powerful and genuine are the above tweaks, I feel they are over complicated for the goal they want to achieve, at least for a developement system. And I put aside drawbacks. Who want to change its php extension name from .php to .php5, just to run them in php5 ?! If so, how do you test third parties code with php5 ? Do you want to edit all their files, and yours once you want to change back PHP version ? Also if cgi is used for one php version and an Apache module for another php version, your script does not run exactly in the same environment. You’ll get better performance with PHP setup as a module. Not only you will not have to deal with the CGI performance hit, but you’ll be able to use PHP’s database connection pooling. Also if some or you scripts use basic http authentication, it does not work if you run PHP as a CGI.
Here is how I deal with this problem. I put these 6 lines in a batch file php5to4.bat :

then I build a php.ini file, one for each PHP version inside its directory, and set the PHPRC environment variable to point to H:\httpd\php so that the running version of PHP will always find its ini file.
Then I put a shortcut to this batch file in my quick launch bar. Same thing for php4to5.bat. So what ? It takes me 0.1 second to change php version ! There is also a problem that I never read in these articles, the PEAR files :
If you have installed PEAR and use it, you know some of the core files have paths to PHP hard coded and some of the PEAR config parameters point to PHP, not PEAR directory. If you installed PEAR with default settings, PEAR is a sub-directory of PHP. This is a problem because if you change PHP version using one of the aforementioned methods, PEAR files you just installed with PHPx won’t be available to PHP. You can copy all PEAR files installed with PHP4 to PHP5/PEAR directory, but this is a pain, and you will not be able to run PEAR command with PHP5 because pear.ini and pear registry will be out of sync with your installed packages and paths.
The solution is to copy your PEAR directory outside your PHP directory, then run PEAR config-set to update PEAR configuration. For example, my PEAR config-show looks like this (some lines removed) :

CONFIGURATION (CHANNEL PEAR.PHP.NET):
=====================================
PEAR executables directory     bin_dir          H:\httpd\php
PEAR documentation directory   doc_dir          H:\httpd\pear\docs
PHP extension directory        ext_dir          H:\httpd\php\ext
PEAR directory                 php_dir          H:\httpd\pear
PEAR Installer cache directory cache_dir        H:\httpd\pear\pear_cache
PEAR data directory            data_dir         H:\httpd\pear\data
PHP CLI/CGI binary             php_bin          H:\httpd\php\php.exe
PEAR test directory            test_dir         H:\httpd\pear\tests
User Configuration File        Filename         H:\httpd\pear\pear.ini
System Configuration File      Filename         H:\httpd\pear\pearsys.ini
If you use this method, only one PHP version running at a given time and always inside the same PHP directory, you will have only one PEAR installation directory to deal with, whatever PHP version you run. Nice and simple.

Source: http://www.thierryb.net/site/Running-PHP5-and-PHP4-simultaneously.html?lang=fr

 

16 October, 2012

New Firefox Developer Tools Help You Build Responsive Websites

Firefox 15 will offer web developers a couple of cool new tools when it arrives later this year, including a very handy new “Responsive Mode” for testing your responsive websites.

It took a while for mainstream websites to catch on, but these days even Google recommends using responsive design, and now Firefox is adding tools to help web developers do just that. Mozilla developer Paul Rouget recently added Responsive Mode to Firefox’s nightly builds channel.
If you’d like to see the new Responsive Mode in action, grab the Firefox and head to Tools >> Web Developer >> Responsive Mode.  (ctrl+shift+M)

Country list in Html Drop down with Arabic

Country list in Html Drop down with Arabic Name

country list in html Dropdown

country list in html Dropdown Select Option


Country Names in Arabic

Country Names in Arabic 


 English English Name Arabic Arabic Name - العربية Local Name
A
1 Afghanistan أفغانستان Afghanestan
2 Albania ألبانيا Shqiperia
3 Algeria الجزائر Al Jaza'ir
4 American Samoa ساموا-الأمريكي American Samoa
5 Andorra أندورا Andorra
6 Angola أنغولا Angola
7 Anguilla أنغويلا Anguilla
8 Antarctica أنتاركتيكا Antarctica
9 Antigua and Barbuda أنتيغوا وبربودا Antigua and Barbuda
10 Argentina الأرجنتين Argentina
11 Armenia أرمينيا Hayastan
12 Aruba أروبه Aruba
13 Australia أستراليا Australia
14 Austria النمسا Österreich
15 Azerbaijan أذربيجان Azarbaycan
B
16 Bahamas الباهاماس Bahamas
17 Bahrain البحرين Al Bahrayn
18 Bangladesh بنغلاديش Bangladesh
19 Barbados بربادوس Barbados
20 Belarus روسيا البيضاء Byelarus
21 Belgium بلجيكا Belgique/Belgie
22 Belize بيليز Belize
23 Benin بنين Benin
24 Bermuda جزر برمودا Bermuda
25 Bhutan بوتان Bhutan
26 Bolivia بوليفيا Bolivia
27 Bosnia and Herzegovina البوسنة و الهرسك Bosna i Hercegovina
28 Botswana بوتسوانا Botswana
29 Brazil البرازيل Brasil
30 Brunei Darussalam بروني Brunei
31 Bulgaria بلغاريا Bulgaria
32 Burkina Faso بوركينا فاسو Burkina Faso
33 Burundi بوروندي Burundi
C
34 Cambodia كمبوديا Kampuchea
35 Cameroon كاميرون Cameroon
36 Canada كندا Canada
37 Cape Verde الرأس الأخضر Cabo Verde
38 Cayman Islands
Cayman Islands
39 Central African Republic جمهورية أفريقيا الوسطى Republique
Centrafricaine
40 Chad تشاد Tchad
41 Chile شيلي Chile
42 China جمهورية الصين الشعبية Zhong Guo
43 Colombia كولومبيا Colombia
44 Comoros جزر القمر Udzima wa Komori
45 Democratic Republic
of the Congo
(Kinshasa)
جمهورية الكونغو الديمقراطية République
Démocratique du Congo
46 Congo, Republic of (Brazzaville) جمهورية الكونغو République du Congo
47 Cook Islands جزر كوك Kūki 'Āirani
48 Costa Rica كوستاريكا Costa Rica
49 Cote d'Ivoire ساحل العاج Cote d'Ivoire
50 Croatia كرواتيا Hrvatska
51 Cuba كوبا Cuba
52 Cyprus قبرص Kibris, Kypros
53 Czech Republic الجمهورية التشيكية Česká republika



D
54 Denmark الدانمارك Danmark
55 Djibouti جيبوتي Djibouti
56 Dominica دومينيكا Dominica
57 Dominican Republic الجمهورية الدومينيكية Republica Dominicana
E
-- East Timor Timor-Leste تيمور الشرقية Timor
58 Ecuador إكوادور Ecuador
59 Egypt مصر Misr
60 El Salvador إلسلفادور El Salvador
61 Equatorial Guinea غينيا الاستوائي Guinea Ecuatorial
62 Eritrea إريتريا Hagere Ertra
63 Estonia استونيا Eesti Vabariik
64 Ethiopia أثيوبيا Ityop'iya
F
65 Falkland Islands
Islas Malvinas
66 Faroe Islands جزر فارو Foroyar
67 Fiji فيجي Fiji
68 Finland فنلندا Suomen Tasavalta
69 France فرنسا France
70 French Guiana غويانا الفرنسية Guyane
71 French Polynesia بولينيزيا الفرنسية Polynésie Française
G
72 Gabon الغابون Gabon
73 Gambia غامبيا The Gambia
74 Georgia جيورجيا Sak'art'velo
75 Germany ألمانيا Deutschland
76 Ghana غانا Ghana
77 Gibraltar جبل طارق Gibraltar
78 Greece اليونان Ellas or Ellada
79 Greenland جرينلاند Kalaallit Nunaat
80 Grenada غرينادا Grenada
81 Guadeloupe جزر جوادلوب Guadeloupe
82 Guam جوام Guam
83 Guatemala غواتيمال Guatemala
84 Guinea غينيا Guinee
85 Guinea-Bissau غينيا-بيساو Guine-Bissau
86 Guyana غيانا Guyana



H
87 Haiti هايتي Haiti
88 Honduras هندوراس Honduras
89 Hong Kong هونغ كونغ Xianggang
90 Hungary المجر Magyarorszag
I
91 Iceland آيسلندا Lyoveldio Island
92 India الهند Bharat
93 Indonesia أندونيسيا Indonesia
94 Iran إيران Iran
95 Iraq العراق Iraq
96 Ireland إيرلندا Éire
97 Israel إسرائيل Yisra'el
98 Italy إيطاليا Italia
J
99 Jamaica جمايكا Jamaica
100 Japan اليابان Nippon, Nihon
101 Jordan الأردن Al Urdun
K
102 Kazakhstan كازاخستان Qazaqstan
103 Kenya كينيا Kenya
104 Kiribati كيريباتي Kiribati, (Kiribas)
105 Korea, (North Korea) كوريا الشمالية Choson
106 Korea, (South Korea) كوريا الجنوبية Han-guk
107 Kuwait الكويت Al Kuwayt
108 Kyrgyzstan قيرغيزستان Kyrgyz Respublikasy
L
109 Lao, PDR لاوس Lao
110 Latvia لاتفيا Latvija
111 Lebanon لبنان Lubnan
112 Lesotho ليسوتو Lesotho
113 Liberia ليبيريا Liberia
114 Libya ليبيا Libiyah
115 Liechtenstein ليختنشتين Liechtenstein
116 Lithuania لتوانيا Lietuva
117 Luxembourg لوكسمبورغ Letzebuerg
M
118 Macao ماكاو Aomen
119 Macedonia, Rep. of مقدونيا Makedonija
120 Madagascar مدغشقر Madagascar
121 Malawi مالاوي Malawi
122 Malaysia ماليزيا Malaysia
123 Maldives المالديف Dhivehi Raajje
124 Mali مالي Mali
125 Malta مالطا Malta
126 Marshall Islands جزر مارشال Marshall Islands
127 Martinique مارتينيك Martinique
128 Mauritania موريتانيا Muritaniyah
129 Mauritius موريشيوس Mauritius
130 Mexico المكسيك México
131 Micronesia مايكرونيزيا Micronesia
132 Moldova مولدافيا Moldova
133 Monaco موناكو Monaco
134 Mongolia منغوليا Mongol Uls
135 Montenegro الجبل الأسو
136 Montserrat مونتسيرات Montserrat
137 Morocco المغرب Al Maghrib
138 Mozambique موزمبيق Mocambique
139 Myanmar, Burma ميانمار Myanma



N
140 Namibia ناميبيا Namibia
141 Nauru نورو Nauru
142 Nepal نيبال Nepal Adhirajya
143 Netherlands هولندا Nederland
144 Netherlands Antilles جزر الأنتيل الهولندي Nederlandse Antillen
145 New Caledonia كاليدونيا الجديدة Nouvelle-Calédonie
146 New Zealand نيوزيلندا Aotearoa
147 Nicaragua نيكاراجوا Nicaragua
148 Niger النيجر Niger
149 Nigeria نيجيريا Nigeria
150 Niue ني Niue
151 Northern Mariana Islands جزر ماريانا الشمالية Northern Mariana
Islands
152 Norway النرويج Norge
O
153 Oman عُمان Saltanat Uman

P
154 Pakistan باكستان Pakistan
155 Palau بالاو Belau
156 Palestine فلسطين Filastin
157 Panama بنما Panama
158 Papua New Guinea بابوا غينيا الجديدة Papua Niu Gini
159 Paraguay باراغواي Paraguay
160 Peru بيرو Peru
161 Philippines الفليبين Pilipinas
162 Poland بولونيا Polska
163 Portugal البرتغال Portugal
164 Puerto Rico بورتو ريكو Puerto Rico

Q
165 Qatar قطر Dawlat Qatar
R
166 Reunion Island ريونيون Ile de la Réunion
167 Romania رومانيا Romania
168 Russia روسيا Rossiya
169 Rwanda رواندا Rwanda
S
170 Saint Kitts and Nevis سانت كيتس ونيفس
171 Saint Lucia سانت لوسيا Saint Lucia
172 Saint Vincent and the
Grenadines
سانت فنسنت وجزر غرينادين
173 Samoa المناطق Samoa
174 San Marino سان مارينو San Marino
175 Sao Tome and Príncipe ساو تومي وبرينسيبي Sao Tome e Principe
176 Saudi Arabia المملكة العربية السعودية Arabiyah as Suudiyah
177 Senegal السنغال Sénégal
178 Serbia جمهورية صربيا Srbija
179 Seychelles سيشيل Seychelles
180 Sierra Leone سيراليون Sierra Leone
181 Singapore سنغافورة Singapore
182 Slovakia سلوفاكيا Slovensko
183 Slovenia سلوفينيا Slovenija
184 Solomon Islands جزر سليمان Solomon Islands
185 Somalia الصومال Somalia
186 South Africa جنوب أفريقيا South Africa
187 Spain إسبانيا España
188 Sri Lanka سريلانكا Sri Lanka
189 Sudan السودان As-Sudan
190 Suriname سورينام Suriname
191 Swaziland سوازيلند Umbuso weSwatini
192 Sweden السويد Sverige
193 Switzerland سويسرا Schweiz, Svizzera
194 Syria سوريا Suriyah



T
195 Taiwan تايوان T'ai-wan
196 Tajikistan طاجيكستان Tojikiston
197 Tanzania تنزانيا Tanzania
198 Thailand تايلندا Prathet Thai
199 Tibet تبت Bod
200 Timor-Leste (East Timor) تيمور الشرقية Timor
201 Togo توغو Togo
202 Tokelau
Tokelau
203 Tonga تونغا Tonga
204 Trinidad and Tobago ترينيداد وتوباغو Trinidad, Tobago
205 Tunisia تونس Tunis
206 Turkey تركيا Turkiye
207 Turkmenistan تركمانستان Turkmenistan
208 Tuvalu توفالو Tuvalu
U
209 Uganda أوغندا Uganda
210 Ukraine أوكرانيا Ukrayina
211 United Arab Emirates الإمارات العرب Al Imarat al Arabiyah
al Muttahidah
212 United Kingdom
المملكة المتحدة United Kingdom
213 United States الولايات المتحدة United States
214 Uruguay أورغواي Uruguay
215 Uzbekistan أوزباكستان Uzbekiston
V
216 Vanuatu فانواتو Vanuatu
217 Vatican City State الفاتيكان Vatican
218 Venezuela فنزويلا Venezuela
219 Vietnam فيتنام Viet Nam
220 Virgin Islands (British) الجزر العذراء البريطانية BVI
British Virgin Islands
221 Virgin Islands (U.S.) الجزر العذراء الأمريكي Virgin Islands

W
222 Wallis and
Futuna Islands
والس وفوتونا Wallis et Futuna
223 Western Sahara الصحراء الغربية

Y
224 Yemen اليمن Al Yaman

Z
225 Zambia زامبيا Zambia
226 Zimbabwe زمبابوي Zimbabwe

  Source: http://www.nationsonline.org/oneworld/countrynames_arabic.htm