Archive for category Code

Redirect domain.com to www.domain.com in .htaccess or virtual host file

Just Add:

RewriteEngine on RewriteCond %{HTTPHOST} !^www.domain.com [NC] RewriteCond %{HTTPHOST} !^$ RewriteRule ^/?(.*) http://www.domian.com/$1 [L,R=301,NE]

Country Codes in PHP Array

A PHP array list of all of the countries.
$options["AF"] = "Afghanistan";  
$options["AX"] = "Åland Islands";  
$options["AL"] = "Albania ";  
$options["DZ"] = "Algeria ";  
$options["AS"] = "American Samoa";  
$options["AD"] = "Andorra";  
$options["AO"] = "Angola ";
$options["AI"] = "Anguilla ";
$options["AQ"] = "Antarctica ";
$options["AG"] = "Antigua and Barbuda ";
$options["AR"] = "Argentina";
$options["AU"] = "Australia ";
$options["AT"] = "Austria ";
$options["AZ"] = "Azerbaijan";
$options["BS"] = "Bahamas ";
$options["BH"] = "Bahrain ";
$options["BD"] = "Bangladesh ";
$options["BB"] = "Barbados ";
$options["BY"] = "Belarus";
$options["BE"] = "Belgium ";
$options["BZ"] = "Belize ";
$options["BJ"] = "Benin ";
$options["BM"] = "Bermuda ";
$options["BT"] = "Bhutan";
$options["BO"] = "Bolivia ";
$options["BA"] = "Bosnia and Herzegovina ";
$options["BW"] = "Botswana ";
$options["BV"] = "Bouvet Island ";
$options["BR"] = "Brazil";
$options["IO"] = "British Indian Ocean Territory ";
$options["BN"] = "Brunei Darussalam ";
$options["BG"] = "Bulgaria ";
$options["BF"] = "Burkina Faso ";
$options["BI"] = "Burundi";
$options["KH"] = "Cambodia ";
$options["CM"] = "Cameroon ";
$options["CA"] = "Canada ";
$options["CV"] = "Cape Verde ";
$options["KY"] = "Cayman Islands ";
$options["CF"] = "Central African Republic ";
$options["TD"] = "Chad ";
$options["CL"] = "Chile ";
$options["CN"] = "China ";
$options["CX"] = "Christmas Island";
$options["CC"] = "Cocos (Keeling) Islands ";
$options["CO"] = "Colombia ";
$options["KM"] = "Comoros ";
$options["CG"] = "Congo ";
$options["CD"] = "Congo, the Democratic Republic of the";
$options["CK"] = "Cook Islands ";
$options["CR"] = "Costa Rica ";
$options["CI"] = "Côte D'Ivoire";
$options["HR"] = "Croatia ";
$options["CU"] = "Cuba ";
$options["CY"] = "Cyprus ";
$options["CZ"] = "Czech Republic ";
$options["DK"] = "Denmark";
$options["DJ"] = "Djibouti ";
$options["DM"] = "Dominica ";
$options["DO"] = "Dominican Republic ";
$options["EC"] = "Ecuador ";
$options["EG"] = "Egypt";
$options["SV"] = "El Salvador ";
$options["GQ"] = "Equatorial Guinea ";
$options["ER"] = "Eritrea ";
$options["EE"] = "Estonia ";
$options["ET"] = "Ethiopia ";
$options["FK"] = "Falkland Islands (Malvinas) ";
$options["FO"] = "Faroe Islands ";
$options["FJ"] = "Fiji ";
$options["FI"] = "Finland ";
$options["FR"] = "France";
$options["GF"] = "French Guiana ";
$options["PF"] = "French Polynesia ";
$options["TF"] = "French Southern Territories ";
$options["GA"] = "Gabon ";
$options["GM"] = "Gambia ";
$options["GE"] = "Georgia ";
$options["DE"] = "Germany ";
$options["GH"] = "Ghana ";
$options["GI"] = "Gibraltar ";
$options["GR"] = "Greece";
$options["GL"] = "Greenland ";
$options["GD"] = "Grenada ";
$options["GP"] = "Guadeloupe ";
$options["GU"] = "Guam ";
$options["GT"] = "Guatemala";
$options["GG"] = "Guernsey ";
$options["GN"] = "Guinea ";
$options["GW"] = "Guinea-Bissau ";
$options["GY"] = "Guyana ";
$options["HT"] = "Haiti";
$options["HM"] = "Heard Island and Mcdonald Islands ";
$options["VA"] = "Holy See (Vatican City State) ";
$options["HN"] = "Honduras ";
$options["HK"] = "Hong Kong ";
$options["HU"] = "Hungary";
$options["IS"] = "Iceland ";
$options["IN"] = "India ";
$options["ID"] = "Indonesia ";
$options["IR"] = "Iran, Islamic Republic of ";
$options["IQ"] = "Iraq ";
$options["IE"] = "Ireland ";
$options["IM"] = "Isle of Man ";
$options["IL"] = "Israel ";
$options["IT"] = "Italy ";
$options["JM"] = "Jamaica";
$options["JP"] = "Japan ";
$options["JE"] = "Jersey ";
$options["JO"] = "Jordan ";
$options["KZ"] = "Kazakhstan ";
$options["KE"] = "KENYA";
$options["KI"] = "Kiribati ";
$options["KP"] = "Korea, Democratic People's Republic of ";
$options["KR"] = "Korea, Republic of ";
$options["KW"] = "Kuwait ";
$options["KG"] = "Kyrgyzstan";
$options["LA"] = "Lao People's Democratic Republic ";
$options["LV"] = "Latvia ";
$options["LB"] = "Lebanon ";
$options["LS"] = "Lesotho ";
$options["LR"] = "Liberia";
$options["LY"] = "Libyan Arab Jamahiriya ";
$options["LI"] = "Liechtenstein ";
$options["LT"] = "Lithuania ";
$options["LU"] = "Luxembourg ";
$options["MO"] = "Macao";
$options["MK"] = "Macedonia, the Former Yugoslav Republic of ";
$options["MG"] = "Madagascar ";
$options["MW"] = "Malawi ";
$options["MY"] = "Malaysia ";
$options["MV"] = "Maldives";
$options["ML"] = "Mali ";
$options["MT"] = "Malta ";
$options["MH"] = "Marshall Islands ";
$options["MQ"] = "Martinique ";
$options["MR"] = "Mauritania";
$options["MU"] = "Mauritius ";
$options["YT"] = "Mayotte ";
$options["MX"] = "Mexico ";
$options["FM"] = "Micronesia, Federated States of ";
$options["MD"] = "Moldova, Republic of";
$options["MC"] = "Monaco ";
$options["MN"] = "Mongolia ";
$options["ME"] = "Montenegro ";
$options["MS"] = "Montserrat ";
$options["MA"] = "Morocco";
$options["MZ"] = "Mozambique ";
$options["MM"] = "Myanmar ";
$options["NA"] = "Namibia ";
$options["NR"] = "Nauru ";
$options["NP"] = "Nepal";
$options["NL"] = "Netherlands ";
$options["AN"] = "Netherlands Antilles ";
$options["NC"] = "New Caledonia ";
$options["NZ"] = "New Zealand ";
$options["NI"] = "Nicaragua";
$options["NE"] = "Niger ";
$options["NG"] = "Nigeria ";
$options["NU"] = "Niue ";
$options["NF"] = "Norfolk Island ";
$options["MP"] = "Northern Mariana Islands";
$options["NO"] = "Norway ";
$options["OM"] = "Oman ";
$options["PK"] = "Pakistan ";
$options["PW"] = "Palau ";
$options["PS"] = "Palestinian Territory, Occupied";
$options["PA"] = "Panama ";
$options["PG"] = "Papua New Guinea ";
$options["PY"] = "Paraguay ";
$options["PE"] = "Peru ";
$options["PH"] = "Philippines";
$options["PN"] = "Pitcairn ";
$options["PL"] = "Poland ";
$options["PT"] = "Portugal ";
$options["PR"] = "Puerto Rico ";
$options["QA"] = "Qatar";
$options["RE"] = "Réunion ";
$options["RO"] = "Romania ";
$options["RU"] = "Russian Federation ";
$options["RW"] = "Rwanda ";
$options["SH"] = "Saint Helena";
$options["KN"] = "Saint Kitts and Nevis ";
$options["LC"] = "Saint Lucia ";
$options["PM"] = "Saint Pierre and Miquelon ";
$options["VC"] = "Saint Vincent and the Grenadines ";
$options["WS"] = "Samoa";
$options["SM"] = "San Marino ";
$options["ST"] = "Sao Tome and Principe ";
$options["SA"] = "Saudi Arabia ";
$options["SN"] = "Senegal ";
$options["RS"] = "Serbia";
$options["SC"] = "Seychelles ";
$options["SL"] = "Sierra Leone ";
$options["SG"] = "Singapore ";
$options["SK"] = "Slovakia ";
$options["SI"] = "Slovenia";
$options["SB"] = "Solomon Islands ";
$options["SO"] = "Somalia ";
$options["ZA"] = "South Africa ";
$options["GS"] = "South Georgia and the South Sandwich Islands ";
$options["ES"] = "Spain";
$options["LK"] = "Sri Lanka ";
$options["SD"] = "Sudan ";
$options["SR"] = "Suriname ";
$options["SJ"] = "Svalbard and Jan Mayen ";
$options["SZ"] = "Swaziland";
$options["SE"] = "Sweden ";
$options["CH"] = "Switzerland ";
$options["SY"] = "Syrian Arab Republic ";
$options["TW"] = "Taiwan, Province of China ";
$options["TJ"] = "Tajikistan";
$options["TZ"] = "Tanzania, United Republic of ";
$options["TH"] = "Thailand ";
$options["TL"] = "Timor-Leste ";
$options["TG"] = "Togo ";
$options["TK"] = "Tokelau";
$options["TO"] = "Tonga ";
$options["TT"] = "Trinidad and Tobago ";
$options["TN"] = "Tunisia ";
$options["TR"] = "Turkey ";
$options["TM"] = "Turkmenistan";
$options["TC"] = "Turks and Caicos Islands ";
$options["TV"] = "Tuvalu ";
$options["UG"] = "Uganda ";
$options["UA"] = "Ukraine ";
$options["AE"] = "United Arab Emirates";
$options["GB"] = "United Kingdom ";
$options["US"] = "United States ";
$options["UM"] = "United States Minor Outlying Islands ";
$options["UY"] = "Uruguay ";
$options["UZ"] = "Uzbekistan";
$options["VU"] = "Vanuatu ";
$options["VA"] = "Vatican City State ";
$options["VE"] = "Venezuela ";
$options["VN"] = "Viet Nam ";
$options["VG"] = "Virgin Islands, British ";
$options["VI"] = "Virgin Islands, U.S. ";
$options["WF"] = "Wallis and Futuna";
$options["EH"] = "Western Sahara ";
$options["YE"] = "Yemen ";
$options["CD"] = "Zaire ";
$options["ZM"] = "Zambia ";
$options["ZW"] = "Zimbabwe ";

Convert DVD to mp4 for Free with HandBrake

If you need to convert videos to mp4, mkv or avi. Use HandBrake: http://handbrake.fr/?article=download

Its great for getting those videos converted.

Open Source Video Compression w/ Film Redux

The need to compress video continues to grow.However so does the number of programs that help you do this… but why pay. Open source is your friend.

Instructions for the future, as there is a problem right now : Follow this blog to see about updates and progress.

http://forums.macrumors.com/showthread.php?t=584869&page=3

If you own a mac and have xcode installed. Go here: http://transcoderredux.svn.sourceforge.net/viewvc/ then click film redux, scroll to the bottom, download the tar ball.

After that extract the contents. Navigate to /transcoderreduc/FilmRedux/FilmReduc.xcoderproj

Double click it, let XCode start. Then click build and Go.

You will then find the program @ ( /transcoderreduc/FilmRedux/build/Release/filmredux) which you can then move to your applications directory.

CakePHP: ACL Menu Component

Once again Mark Story saves the day: ACL Menu Component

Share your code = Good Karma

So GitHub is a place for people upload share and collaborate on code: http://github.com/

CakePHP – Configuring ACL, Setting User Groups integration with Auth

I started with Cake about a year ago and was mostly just playing around with it. Well i ended up building a website using it, but of course i didn’t understand a lot about Cake. So i am now needing to retrofit it with all the pieces i should have initially configured.

I recently got Sessions working which was pretty simple just following [FUTURE POST].

Now, i am in the process of Configuring the ACL component and getting it to work with the Auth Component. [FUTURE POST]

So of course where do i start: Always IRC. irc.freenode.net #cakephp. From inside there i was pointed to a few resources.

I decided to go with Mark Story’s version as his simple enough and would suffice and I had no clue about which one was better to go with.

At this point i learn about Baking. I can’ t believe how simple life can be with Cake. Wish i would have know about that earlier. Sad thing is that i will have to do a bunch of work to update all the things that were not done correctly the first time.

More Soon

Using the Cake Console to Assing ARO’s. So to set my self to have the same access as Admin: ./cake acl create aro Admins User.4

Installing a Code Syntx Highlighter for Word Press

I started to play with Syntax Highlighting today: I came across this : http://wordpress.org/extend/plugins/wp-syntax/ Seems to work nicely but you have to be in HTML Mode and if you switch back and forth you can loose your code snippet.

I ended up disabling the Visual Editor, which of course i can re enable for future posts. Below is a Test:

<div id="foo">
<?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>