If Windows, Linux and OSX Opened Cafes

What if really… LOL! I found this from DaniWeb, it’s short and entertaining! Read on…

The New York Times reported today that Apple has opened its first Apple Store in Paris, underneath the Louvre no less, and just two weeks after Microsoft opened up a Windows 7 cafe in Paris in another location. The idea of these two companies competing in a retail environment, and especially a Windows-themed cafe, got me thinking about what would happen if three cafes opened each run in the same style of the operating system it was named for. I figure it might look something like this:

Windows Cafe

The Windows Cafe is in a bland store front. The furniture consists of straight wooden chairs with tables with sharp angles. Unfortunately, every so often when you sit in a chair it crashes the to the floor, but you get used to this and figure it’s just part of the experience of going to the Windows Cafe. (To be fair they have been testing chairs from a new manufacturer and they are reportedly less prone to breaking in this fashion.) Pictures of a smiling Bill Gates and Windows logos adorn the walls. The coffee tastes fine most of the time, but a surprising number of patrons get sick there, so that it’s become standard practice to use hand sanitizer before you go in to protect yourself. The coffee is expensive, and refills are definitely not free, but it’s a known quantity, and many people are comfortable going there.

Linux Cafe

The Linux Cafe is a funky place in an artsy neighborhood with eclectic furniture donated by the patrons. It doesn’t match, but it’s comfortable and the walls are covered with donated pictures and paintings by local artists. The coffee is free, served in black cups (or you can just bring your own), but you need to make it yourself. If you can’t do it yourself, the cafe has consultants available to help you for a fee. It’s great for people who know about coffee brewing, but many people are intimidated by the idea of making their own coffee and stay away, even though very few people ever get sick who go there.

Apple Cafe

The Apple Cafe is a modern, state-of-the-art facility. The tables are stainless steel and the chairs are ultra-contemporary. Shrines to Apple CEO Steve Jobs are dotted around the wide space. The cups are cool and come in a variety of bright colors. The coffee is well made by a highly trained staff, and even though it costs a lot more, people line up around the block for a chance to drink it. Just don’t ask the staff about their coffee-making techniques because they are extremely tight lipped about this. People occasionally get sick there, but it’s rare enough for the cafe to brag about its safety record.

So there you have it. Three cafes with three distinct personalities just like the operating systems they represent

Source: http://www.daniweb.com/news/story236836.html?urlhash=yp4q&trk=nus_ritm-title by Ron Miller

Quickie Visitors Country WP Plugin

This plugin is dependent on WP/GeoTrack by Johannes Lietz, this is NOT a stand-alone plugin, it won’t work if WP/GeoTrack is not installed anyway, so it’s safe.

And don’t look for it in WP Plugins repo, you won’t find it there :D

/*
Plugin Name: Top Visitors Flag
Plugin URI: http://www.marvinmarcelo.com/
Description: This plugin displays visitors on sidebar as widget dependent on WP/GEO-Track plugin.
Author: Marvin Marcelo
Author URI: http://www.marvinmarcelo.com/
Version: 1.0.0
*/
function tvf_get_topvisits()
{
  global $wpdb, $table_prefix;
  $sql = "select count(*) as `rows` , `country` , `flagname` from `".$table_prefix."geotrack` group by `country` order by `rows` desc limit 0 , 12";
  $flagstats = $wpdb->get_results($sql);

  $html = "
  • Top Visiting Countries

    \n"; /* id string */ foreach ($flagstats as $cf) { $cf->rows = number_format($cf->rows, 0, "", ","); $html .= "flagname . ".png\" alt=\"Flag of $cf->country with $cf->rows visits\" title=\"$cf->country with $cf->rows visits\" />\n"; } $html .= "
  • "; echo $html; } function init_tvf_init(){ register_sidebar_widget("Top Visitors Flags", "tvf_get_topvisits"); } if (defined('GT_NOT_INSTALLED')) { echo ""; } else { add_action("plugins_loaded", "init_tvf_init"); }

    Also, you have to forgive the function, constants, and variables names, we all struggle for a better and sensible one :) Happy coding!

    Mastering CSS Coding: Getting Started (Smashing Magazine)

    I’ve been practicing strict CSS rules for years now, but it was only this year that I changed the way I fix floated containers inside another container, to stretch the height down to the bottom of the floated inner container. I guess almost everyone started with <br /> with ‘clear’ or the next element with CSS ‘clear’ in it to fix the issue, but we all know it’s ‘dirty’.

    I found this great tutorial that would make a ‘css nobody’ become a ‘big guy’ on CSS, and I myself is going to keep this page available when needed.

    6_b

    Mastering CSS Coding: Getting Started covers:

    1. Padding vs. Margin
      • What Is Padding and Margin?
      • Margin and Padding Values
      • Quick Tip
    2. Floats
    3. Center Alignment
      • Horizontal Alignment
      • Vertical Alignment
    4. Ordered vs. Unordered Lists
      • Customizing Unordered Lists
      • Using Unordered Lists for Navigation
    5. Styling Headings
    6. Overflow
      • What Is Overflow?
    7. Position
      • Adding Flavor With CSS
    8. Background Images
      • Using Large Backgrounds
      • Text Replacement
      • CSS Sprites
    9. Image Enhancement
    10. PSD to HTML

    List of verified relief centers for ‘Ondoy’ victims

    This is the list of verified relief centers where people can drop off their donations for the victims of “Ondoy:”

    MANILA

    De La Salle University

    Go to: 2401 De La Salle, Taft Avenue, Manila. Enter south gate near McDonald’s, people at the registration center will entertain you.

    Hotline: 524-4611 local 128; 523-6158; 526-5612

    Members of the academic community requiring immediate assistance may contact the following numbers:

    0906-4200732; 0919-8018121; 0922-8877495 for students, faculty, and staff

    0905-3603655 for alumni

    Look for: Paulo Mutuc, Bro. Bernie Oca, and Kat Regaladao

    Operations: 6:30 a.m. to 6 p.m. everyday until Saturday

    Web site: www.dlsu.edu.ph

    You can:

    • Donate food like rice, noodles, and canned goods; drinking water; toiletries; clothes and blankets; and medicines
    • Help through cash and check donations through:

    DLSU – Ondoy Relief Fund
    UCPB Vito Cruz Branch, Taft Ave., Manila 1104

    Peso Account No. 001201147119
    Dollar Account No. 011203000358
    Swift Code: UCPB PHMM

    Kindly remember to include all details listed above in your deposit slip, and send an e-mail to sc@dlsu.edu.ph confirming your donation.

    QUEZON CITY

    UP College of Arts and Letters

    Go to: College of Arts and Letters (CAL)
    University of the Philippines, Diliman, Quezon City

    Hotline: 09296454102 (Prof. Roselle Pineda)

    Look for: Guard on Duty (in UP CAL)

    Operations: 24 hours until Wednesday tentatively

    You can:

    • Donate medicines, clothes, blankets, food to be distributed by Citizens’ Disaster Response Center.

    Erica Paredes

    Go to: Katipunan Avenue, Quezon City
    (Call or text contact number for complete address) Contact #: 09174741930

    Look for: Erica Paredes

    Operations: Throughout the week tentatively, from 10 am to 6 pm

    You can:

    • Donate ready-to-eat foods like hard-boiled egg, bread, packed juice, sandwich filling
    • Volunteer to prepare sandwiches and distribute goods

    NoyMar Relief Operations – QC

    Go to: Balay Expo Center, Farmers Market, Cubao or in White Space, Pasong Tamo Ext., Near BMW, Makati

    Look for: Clare Amador or Jana Vicente

    Hotlines: 09285205508, 09285205499, 0908-6579998, 0939-3633436, 9137122

    Operations: 8 a.m. to 9 p.m. throughout the week until further notice.

    Website: www.marroxas.com

    You can:

    • Donate drinking water, old medicines, clothing, blankets, canned goods, noodles
    • Volunteer to man stations and repack food.

    Miriam Quiambao and World Vision Development Foundation

    Go to: One Orchard Road Building in Eastwood or at the World Vision office at 389 Quezon Avenue, corner West 6th St., Quezon City

    Hotline: 0917-8623209

    Look for: The guard in the lobby (on One Orchard Road)

    Website: http://www.twitter.com/miriamq, www.worldvision.org.ph

    Operations: Until Sept. 28, 2009 (Monday), 24-hour operation

    You can:

    • Donate goods like clothes, blankets, canned goods, crackers, mattress, hygiene kits, noodles, bottled water, oatmeal, instant coffee, sugar (for relief pack to be distributed by World Vision)
    • Volunteer to help repack relief goods for World Vision starting today at 7pm
    • Deposit cash donations to World Vision Development Foundation, BPI savings account number 4251002415 and BDO savings account number 270043411

    Philippine Army

    Go to: Philippine Army Gym inside Fort Bonifacio, Makati or General Head Quarter’s Gym in Camp Gen. Emilio Aguinaldo, EDSA, Quezon City

    Hotline: 892-3417 (direct line), 845-9555 (trunkline) local. 6464 and 6466

    Look for: Any personnel on duty

    Operations: Ongoing everyday for 24 hours until further notice

    You can:

    • Donate relief goods (no cash)
    • Call hotline for rescue, evacuation or relief assistance.
    • Call to report missing persons

    Papemelroti Gifts and Decorative Accessories

    Go to: 91 Roces Ave., Corner Scout Tobias, Quezon City or mall branches in Ali Mall Cubao, SM City North EDSA, SM Fairview, SM Megamall, Glorietta 3 in Makati, SM Centerpoint, SM Southmall

    Hotline: refer to website for individual branch numbers

    Website: www.papemelroti.com

    Operations: Mall hours (10am-9pm), ongoing everyday until further notice

    You can:

    • Donate goods like canned goods, clothings, blanket, cooking utensils and other relief goods EXCEPT cash.

    Ateneo de Manila University Disaster Response Group

    Go to: Ateneo de Manila University, Loyola Heights , Quezon City, Manuel V. Pangilinan Building Center for Student Leadership Lobby, University Dorm Cervini Hall

    Hotlines: 09089977166, 09178952792, 4266001 local 5050

    Look for: Gio Tiongson, President, Sanggunian ng mga Mag-aaral

    Website: www.ateneosanggu.com

    Operations: 24-hour operations for the entire week

    You can:

    • Donate goods like bottled water, sardines, canned goods, candles, cup noodles.
    • Volunteer to help repack relief goods, administer basic first aid.
    • Report missing persons.
    • Seek evacuation/temporary shelter at University Dorm Cervini Hall.

    Citizens Disaster Response Center (CDRC)

    Go To: 72-A Times St., West Triangle Homes, Quezon City.

    Hotlines: 9299820, 9299822

    Operations: 8 a.m. onwards.

    You can:

    • Donate money, old clothes, blanket, bigas, munggo.
    • Volunteer to help distribute goods.

    Radio Veritas

    Go To: Veritas Tower , West Ave. corner EDSA

    Look For: Karla Turingan

    Hotlines: 9257931 to 39, 0918VERITAS

    Operations: 24-hours, tentatively until Tuesday.

    You can:

    • Donate old clothes, food, assorted goods, bottled water, cash.

    Our Lady of Pentecost Parish

    Go to: 12 F. dela Rosa cor. C. Salvador Streets, Loyola Heights , Quezon City

    Hotlines: 632 4342397, 63 2 9290665

    Operations: 7 a.m. till 10 p.m. Sunday, until further notice.

    You Can:

    • Donate packed meals, bottled water.

    GMA Kapuso Foundation

    Go to: GMAKF warehouse at Charles Conrad St., Dona Faustina Village, Tandang Sora, QC

    Hotlines: 632 9317013

    You Can:

    • Help repack donated items, send donations.

    WARNING: Please ignore emails instructing you to send donations to various bank accounts. There have been fraudulent users who send emails instructing people to send donations to specific bank accounts not owned by GMA Kapuso Foundation. Here’s a list of legitimate bank accounts:

    METROPOLITAN BANK & TRUST COMPANY (METROBANK)

    Peso Savings
    Account Name : GMA Kapuso Foundation, Inc.
    Account Number : 3-098-51034-7

    Dollar Savings
    Account Name : GMA Kapuso Foundation, Inc.
    Account Number : 2-098-00244-2
    Code : MBTC PH MM

    UNITED COCONUT PLANTERS BANK (UCPB)

    Peso Savings
    Account Name : GMA Kapuso Foundation, Inc.
    Account Number : 115-184777-2
    : 160-111277-7

    Dollar Savings
    Account Name : GMA Kapuso Foundation, Inc.
    Account Number : 01-115-301177-9
    : 01-160-300427-6
    Code : UCPB PH MM

    BANCO DE ORO (BDO)

    Peso Savings
    Account Name : GMA Kapuso Foundation, Inc.
    Account Number : 469-0022189

    Dollar Savings
    Account Name : GMA Kapuso Foundation, Inc.
    Account Number : 469-0072135

    Code : BNORPHM

    PHILIPPINE NATIONAL BANK (PNB)

    Peso Savings
    Account Name : GMA Kapuso Foundation, Inc.
    Account Number : 121-0032000-17

    Dollar Savings
    Account Name : GMA Kapuso Foundation, Inc.
    Account Number : 121-0032000-25
    Code : PNB MPH MM

    MAKATI/TAGUIG/MUNTINLUPA

    Victory Fellowship – Fort Bonifacio

    Go to: Victory Fellowship, Every Nation Building , across Market-Market, Fort Bonifacio

    Look for: Pastor Bernard Marquez

    Hotlines: 813-FORT, 8171212

    Operations: Tentatively until 5pm, may may extend hours. Entire week until Friday.

    Website: www.twitter.com/VictoryFort

    You can:

    • Donate canned goods, milk, bottled water, clothes, cash.
    • Volunteer to help pack relief goods

    Sacred Heart of Jesus Chaplaincy

    Go to: Hillsborough Village, Cupang, Muntinlupa City, Metro Manila

    Hotline: 8428148, 8079847

    Look for: Genelyn Sembrano, Meanne Cuneta

    Website: www.sacredheartofjesus-alabang.org

    Operations: Tuesday-Sunday (Sept. 29-Oct 4). 8 am to 12 noon, 2 to 6 pm

    You can:

    • Donate water, blankets, shoes, clothes and other goods
    • Donate in cash

    PASIG CITY

    LUZON RELIEF: Volunteer / Donate / Pray

    Go to: Renaissance Fitness Center, 2nd Floor, Bramante Building, Renaissance Towers, Ortigas, Meralco Avenue, Pasig City

    Hotline: 0929-8713488

    Look for: Warren Habaluyas, co-founder

    E-mail: luzonrelief@gmail.com

    Operations: Monday to Saturday (Sept. 28-Oct. 3), 9am-7pm

    You can:

    • Donate non-perishable food items, beddings, pillows, blankets, clothes
    • You can donate cash but it is not encouraged

    - Compiled by Annalyn Ardona and Patricia Faustino, GMA NEWS AND PUBLIC AFFAIRS

    Source: List of verified relief centers for Ondoy victims

    PHP code block – bringing order to chaos

    I had to come up with this post because I’ve been working on an old CMS about 3 years old (or even more) and I had been wondering why the calendar links cuts off from 2001 to 2003.

    Task: List a year/month links from the present to the oldest published image sets.

    Sounds easy, and I believe it is.

    But when I checked on the existing script, this is what I got.

     $month_array = array("1"=>'January',"2"=>'February',"3"=>'March',"4"=>'April',"5"=>'May',"6"=>'June',"7"=>'July',"8"=>'August',"9"=>'September',"10"=>'October',"11"=>'November',"12"=>'December');
    	$smarty->assign('y2day',$y2day); $y=0;
    	for ($q=12; $q >= 1; $q--){
    			$month = $month_array[$q];
    			if( ($_GET[year] < '2000') && ($m2day ==$q ) ) $w_string = $week_string; else  $w_string ='';
    			if( ($_GET[year] == '2007') && ($_GET[month] == $q) ) $w_string = $week_string;
    
    		  if($m2day >= $q){
    			$tmp_cal_month_now_array = array(
    					'month' => $month,
    					'string' => $w_string,
    					'link' => $q
    					); $date_month_now_array[$y++] =  $tmp_cal_month_now_array;	 }
    		} //for
    
    	 $smarty->assign('calendar_now_month',$date_month_now_array);
    
    	$y=0;	$c_yeartoday = date("Y") -1; //echo $c_yeartoday;
    	for($q=0; $q < = 5; $q++){
    			$tmp =$c_yeartoday - $q; //echo $tmp;
    
    		 $tmp_cal_date_array = array(
    					  'year' => $tmp
    
    				 );  $date_year_array[$y++] =  $tmp_cal_date_array;
    	 } //for
    
    	$smarty->assign('calendar_year',$date_year_array);
    
    	    $y=0;
    		for($q=12; $q >= 1; $q--)
    		{
    			$month = $month_array[$q];
    			if( $_GET[month] == $q ) $w_string = $week_string; else $w_string='';
    			$tmp_cal_month_array = array(
    					'month' => $month,
    					'string' => $w_string,
    					'link' => $q
    					); $date_month_array[$y++] =  $tmp_cal_month_array;
    
    		}//for
    	 $smarty->assign('calendar_month',$date_month_array);
    
    	 $y=0;
    		for($q=12; $q >= 10; $q--)
    		{
    			$month = $month_array[$q];
    			if( ($_GET[year] == '2000') && ($_GET[month] == $q) ) $w_string = $week_string; else $w_string='';
    			$tmp_cal_month_old_array = array(
    					'month' => $month,
    					'string' => $w_string,
    					'link' => $q
    					); $date_month_old_array[$y++] =  $tmp_cal_month_old_array;
    
    		}//for
    	 $smarty->assign('calendar_month_old',$date_month_old_array);

    Continue reading

    iPhone Apps for review/install

    A list of iPhone Apps I find interesting

    • eBay Mobile Download
      iPhone version of eBay
    • Air Mouse Download
      This is a ‘wow’ app, actually thinking of upgrading Windows machine only for this and turn it into a media center
    • DropBox Download
      Put your files into your Dropbox on one computer, and they’ll be instantly available on any of your other computers that you’ve installed Dropbox on (Windows, Mac, and Linux too!)

    Variable, variables and lots of variables

    List of variable names, oddly named and other stuff I’m glad I bumped into :D . Found them in project about 5 or 6 yrs old that needs modification and I believe optimization too, yes really. So why glad? Because I realized the way I named my variables isn’t that bad at all.

    /**
     * This one is on top of a movie player page. Maybe 'he' wasn't so sure
     * that the parameters passed on to this page is for a 'video'. Just making
     * sure for the nth time I guess.
     */
    $videoistrue=0;
    /**
     * I think 'he' hate lines. And this one is good, page title is saved
     * in a session variable, so if another programmer writes a new page
     * and forgot to assign $_SESSION['pagetitle'] a new value for an FAQ
     * page, say faq.php, it'd show up
     */
    session_start();$_SESSION['pagetitle'] = "Show Series";
    /**
     * ... and it went on and on
     * $_SESSION['pagetitle'] = "Calendar";
     * session_start();$_SESSION['pagetitle'] = "Browse Model";
     *
     * Hmmmm, $ii as iteration variable, struggling with names? I often
     * use $i, $n or $x, sometime $c, hehehe! I've seen $i for many. And
     * have you noticed the class name 'smalleditnoline', can it be any
     * longer? Yes! and if he had enough time, it may have look like
     * 'smalleditnolinewitharialbold' or 'smalleditnolineFFFbgcolor333fgcolor'
     * crazy! This is CSS anyway, will surely post one for that, hahaha!
     */
    for ($ii=1;$ii< =$totalpages;$ii++)
    {
      if ($ii==$page) {
        echo "[$ii]";
      }
      else {
        echo "[$ii]";
      }
    }
    /**
     * more variables with default values, note that this is set just
     * before a loop starts
     */
    $thisCat = "";
    $firstrun = true;
    $firstrow = 0;
    $rowcount = 0;
    /**
     * "NO QUOTES" for key names in square brackets :(
     * if only my IDE could complain
     */
    $GLOBALS[catadded] = false;
    $GLOBALS[keywordadded] = false;
    $GLOBALS[modeladded] = false;
    /**
     * Consistent! Maybe 'He' doesn't want anybody to easily understand
     * the script that's why no new lines after semi-colon at least.
     */
    if ($seriesRow[seriesNo] < 10) $seriesNoTxt = "0".$seriesRow[seriesNo]; else $seriesNoTxt = $seriesRow[seriesNo];
    

    Ok, enough of grumbling here. I have released my frustration for today, going back to work. But if I am to start a project or even a simple script, I follow formatting conventions, consistent quotes and escapes, logical variable names and useful comments with links and samples. It doesn’t only make your code readable, it helps a lot for the next programmer to just add-in the stuff he needs to and keeping his sanity.

    PHPAnywhere – edit PHP from browser

    Found this post from Smash!ng Apps

    PHPanywhere is a new online service that’s changing the way people develop on the web. They enable users to develop and maintain their php/html projects online using any standard web browser.

    This is a web based free Integrated Development Environment or IDE for the PHP language, in other words it is an application that gives developers all the code editing capabilities they need to develop PHP applications online. It includes a real-time syntax code editor with support for all web formats and a powerful FTP editor.

    Because it works in a browser you can start coding right away, no need for installing anything and best of all you can work from anywhere, all you need is an internet connection and a web browser and you’re ready to go.

    You can develop and maintain multiple projects with ease using PHPanywhere, because as soon as you log in all your projects (FTP servers) are immediately accessible. PHPanywhere even remembers what files you were working on and reopens them as well.

    Real-time syntax code editor

    The real-time syntax code editor is really what PHPanywhere is all about, so here is a list of just some of the things it does:

    • Syntax highlighting
    • Smart indentation for each language
    • Code folding
    • Full internationalization
    • Unlimited undo/redo (now handled on client (browser) side, no more waiting for server response)
    • Unlimited tabs
    • Find and replace feature (New Feature)
    • Displays line numbers (New Feature)
    • Code auto completion, snippets (New Feature)
    • Displays line numbers (New Feature)
    • Code indention (TAB key) (New Feature)

    Continue reading

    Smarty Gravatar plugin

    I realize the need for this when working on an MVC based CMS especially with Smarty engine in it.

    Oh and in case you’re wondering why its sounds like the upcoming movie Avatar by James Cameron, I don’t know. What it has to do with internet term ‘avatar‘? I really don’t know. But in ‘www’, Gravatar is a short term for “Globally Recognized Avatar” assigned by a user as his/her default avatar in every places of the internet, same people behind WordPress. There are other similar services too.

    So, this plugin is based from its documentation

    /**
     * Gravatar
     *
     * @link http://www.marvinmarcelo.com
     *
     * @param array $params
     * @param Smarty $smarty
     */
    function smarty_function_gravatar($params, &$smarty)
    {
      /**
       * constant $gravatar_host
       */
      $gravatar_host = "http://www.gravatar.com/avatar/";
    
      if ( !isset($params['email']) )
      {
        $smarty->trigger_error("gravatar: email parameter not set");
        return;
      }
    
      if ( !eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $params['email']) )
      {
        $smarty->trigger_error("gravatar: {$params['email']} is not a valid email.");
        return;
      }
      /**
       * @link http://en.gravatar.com/site/implement/url
       */
      $hash = strtolower(md5(trim($params["email"])));
      $src = $gravatar_host . $hash . ".jpg?";
    
      if ( !isset($params["size"]) || !($params["size"] >= 1 && $params["size"] < =512 ))
      {
        $params["size"] = 32;
      }
      $src .= "s={$params["size"]}";
    
      if ( !isset($params["default"]) )
      {
        $params["default"] = "identicon";
      }
      $src .= "d={$params["default"]}";
    
      if ( !isset($params["rating"]) )
      {
        $params["rating"] = "G";
      }
      $src .= "r={$params["rating"]}";
    
      $extras = "";
    
      if ( isset($params["class"]) )
      {
        $extras .= " class=\"{$params["class"]}\"";
      }
    
      if ( isset($params["id"]) )
      {
        $extras .= " id=\"{$params["id"]}\"";
      }
      /**
       * @example http://www.gravatar.com/avatar/7023218434f12aee57f4b03454dadcaa?s=32&d=identicon&r=G
       */
      print "\"{$params["alt"]}\"$extras";
    }
    

    Simply extract function.gravatar.zip into your Smarty plugin directory. And use it in your template file like this

    {gravatar email='someemail@domain.com'}
    

    You’re done!