Mar 26, 2012

Mobile: Html meta data and headers

Sample Mobile Meta and headers

<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no' name='viewport'/>

Magento: Hack - Nested addAttributeToFilter.

I already waste my one whole working day to look on this problem but still can file the solution. So I decide to modify the the magento core.

Here's the condition I want to do in addAttributeToFilter function.

(condition1) OR ((condition2) and (condition3) ..... )

To solve this Fucking problem I modify this class Mage_Eav_Model_Entity_Collection_Abstract.

public function addAttributeToFilter($attribute, $condition=null, $joinType='inner')
....Some Code here
if (is_array($attribute)) {
$sqlArr = array();
foreach ($attribute as $condition) {
$sqlArr[] = $this->_getAttributeConditionSql($condition['attribute'], $condition, $joinType);
$conditionSql = '('.join(') OR (', $sqlArr).')';
... your other code here.

Here my modify version.

public function addAttributeToFilter($attribute, $condition=null, $joinType='inner')
....Some Code here
if (is_array($attribute)) {
$sqlArr = array();
$myAND = array();
$andSqlArr = array();
* @ win mode to support (x=a) or (y=1 and z=0)
* array(
* array(condition)
* 'and' =>
* array(
* array(condition)
* array(condition)
* ),
* )
* Output expected
* cond1 OR (cond2 and cond3)
foreach ($attribute as $key => $condition) {
if ($key === "and"){
$myAND = $condition;
$sqlArr[] = $this->_getAttributeConditionSql($condition['attribute'], $condition, $joinType);
foreach ($myAND as $key => $andCond ){
$andSqlArr[] = $this->_getAttributeConditionSql(
$conditionSql = '('.join(') AND (', $andSqlArr).')';
if ($andSqlArr){
$sqlArr[] = $conditionSql;

$conditionSql = '('.join(') OR (', $sqlArr).')';
... your other code here.

In your product collection.

array("attribute"=>"your_attribute1", "in"=>array(1,2,3,)),
"and" => array(
array("attribute"=>"your_attribute2", "eq"=>1,),
array("attribute"=>"your_attribute3", "eq"=>1,),

Happy Coding. :)

Mar 22, 2012

SVN: SSL handshake failed: Secure connection truncated

I experience this error in my fedora 14 with svn version

svn --version
svn, version 1.6.17 (r1128011)
compiled Jun 2 2011, 15:23:50

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
- handles 'http' scheme
- handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
- with Cyrus SASL authentication
- handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
- handles 'file' scheme

Here my command

$ svn export mycode --username


svn: OPTIONS of '': SSL handshake failed: Secure connection truncated (

From Jan's Blog instructed to install libneon27 However before in install I check /usr/lib/ and exist to my filesystem so I just issue.

sudo ln -s /usr/lib/ /usr/lib/

Cheers.. :)

Magento: Deleting Product

A simple way to delete product is:
$productId = 1;
If you want to delete product by category
$collection = Mage::getSingleton('catalog/category')

// If you want to filter by attribute
$collection->addAttributeToFilter('YOUR_ATTRIBUTE_CODE', 'ATTRIBUTE_VALUE')
foreach($collection as $product){
   $product =Mage::getSingleton('catalog/product')
   try {
   // Im not sure what is the use of this part
     array('product' => $product));
   // Finally we not able to delete the product
   }catch (Exception $e) {
     echo "Can't delete product w/ id: $product";
Reference: Delete magento Product

Mar 15, 2012

Android: Handling of Content-Disposition header on the android browser.

As part web development, something we need to create one script file to handle all download request from your server but, suddenly I try to work on android browser and get an issue on download name.

Scripname download.php
Download name: download.apk which not correct

To fix the issue:

header("Content-Disposition: attachment; filename=\"fast-and-the-furios.apk\"");
header("Content-Type: application/");

* Besure to put SPACE between attachment; and filename
* Also be sure to quote the filename with double-quote

Content-Disposition: attachment; filename="fast-and-the-furios.apk"

If you want to upload on android try to read this one multipart form upload on android. PS. I did now test his code yet, check in you own either. :)

Happy reading. :)

Mar 13, 2012

Mar 12, 2012

Mysql: How to recover mysql table.

One time I get real problem about mysql table. It was crashed and I don't have any back up on it.

After I get on an internet connected pc I googled it and this helpfull resources.

My Pick pickup line and emo sentence

Pag namatay ako wag ka pupunta, bka pag nakita kita, tumibok uli puso ko. :)

Wla lang gusto ko lang itago. Most data from monster program (The Morning Rush)

Mar 5, 2012

Mar 4, 2012

AppEngine - Guestbook sample

GWT - Php support

For PHP developer want to use appengine, try this out.

Mar 2, 2012

GWT - Login Manager

Just a recording refernce yet. Sorry I cant get one yet. :(

Mar 1, 2012

GWT - How to build multiple or another page.

As a beginner in playing GWT. I don't know to create another page after I done the Getting Stated on GWT documention.
GWT Getting start

While looking on the to this stuff, I found that there was no mutiple page on GWT instead it use widget to display another view on you page.

Read the Alen Post here GWT Concepts No Multiple Pages

Here another reference