Warning: base64_decode() has been disabled for security reasons in /home/entroduc/public_html/wp-content/plugins/easy-adsenser/easy-adsenser.php on line 44

Warning: Cannot modify header information - headers already sent by (output started at /home/entroduc/public_html/wp-content/plugins/easy-adsenser/easy-adsenser.php:44) in /home/entroduc/public_html/wp-includes/feed-rss2.php on line 8
entroducing.com http://www.entroducing.com to prove that i have too much time Sat, 11 Jun 2011 10:45:41 +0000 en hourly 1 http://wordpress.org/?v=3.3.1 Fix Magento Connect Manager 404 error by resetting the folder permission http://www.entroducing.com/view/fix-magento-connect-manager-404-error-by-resetting-the-folder-permission http://www.entroducing.com/view/fix-magento-connect-manager-404-error-by-resetting-the-folder-permission#comments Sun, 15 May 2011 06:00:20 +0000 Benny http://www.entroducing.com/?p=361 If you encounter 404 error when you connect to Magento Connnect Manager (System-> Magento Connect Manager), it is probably due to your folder permission not set up correctly.

Fortunately, there is a quick fix for this.

Download the magento clean up tool (a php file) and upload to your store root folder.

Once done, browse to the clean up tool (http://www.yourstore.com/magento-cleanup.php) and you will see a list of messages that it has reset the folder permission.

]]>
http://www.entroducing.com/view/fix-magento-connect-manager-404-error-by-resetting-the-folder-permission/feed 0
Install chinese locale for Magento Admin 1.5 http://www.entroducing.com/view/install-chinese-locale-for-magento-admin-1-5 http://www.entroducing.com/view/install-chinese-locale-for-magento-admin-1-5#comments Sun, 15 May 2011 05:06:22 +0000 Benny http://www.entroducing.com/?p=356 Unfortunately, the default Magento does not comes with all the languages installed. Changing the language dropdown at the bottom of the page will not change the interface.

Here’s how to install chinese language for the admin

1. go to magento connect and install the below 2.0 extension key


http://connect20.magentocommerce.com/community/Locale_Mage_community_zh_CN

2. Once installed, check your app\locale and you will see a lot of csv files in the folder. Those files are created by the extension… in the wrong folder!

3. Create a folder ‘zh_CN‘ in app\locale and move all the csv files in app\locale to app\locale\zh_CN

4. Once done, go back to admin page and flush your cache (system -> cache management -> flush magento cache)

5. Change the language to chinese (china) and you should be able to view it in chinese (hopefully)

]]>
http://www.entroducing.com/view/install-chinese-locale-for-magento-admin-1-5/feed 0
Fix google anlaytics in magento custom template http://www.entroducing.com/view/fix-google-anlaytics-in-magento-custom-template http://www.entroducing.com/view/fix-google-anlaytics-in-magento-custom-template#comments Sun, 15 May 2011 03:56:48 +0000 Benny http://www.entroducing.com/?p=353 If you have turned on your google analytics in admin console and you are using custom design template but the google analytics is not showing up in your html codes, look at the below steps to check if the codes are in your custom design are in placed.

1. check page.xml in app\design\frontend\default\[yourtemplate]\layout and verify if the following line is in place.

\\app\design\frontend\default\[yourtemplate]\layout\page.xml

2. open *.phtml in app\design\frontend\default\magikjewellery\template\page and verify if the following line is after the tag

\\app\design\frontend\default\[yourtemplate]\template\page\1column.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\1columnhome.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\2columns-left.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\2columns-right.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\print.phtml

...

<!--?php echo $this--->getChildHtml('after_body_start') ?&gt;
...

3. clear your cache by going to admin -> system -> cache management and flush magento cache

4. open your home page, right click on it and select view source and check if the following codes are generated.

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
    })();

    var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-1234567-7']);
_gaq.push(['_trackPageview']);

//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
]]>
http://www.entroducing.com/view/fix-google-anlaytics-in-magento-custom-template/feed 0
symfony conditional validation http://www.entroducing.com/view/symfony-conditional-validation http://www.entroducing.com/view/symfony-conditional-validation#comments Sun, 27 Feb 2011 10:52:54 +0000 Benny http://www.entroducing.com/?p=348 Below are the snippets on how to implement a conditional validation in the form. i.e. validate field A if field B is true

As discussed in this tutorial (though it is for symfony 1.2, it will works in 1.4), the key thing is to set a post validator to validate values after the initial validation.

Assuming you have two fields – one checkbox and one textfield.
And you want the textfield to be filled in if the checkbox is ticked.

Here’s how you do it.

// lib\form\doctrine\MyForm.class.php

class MyForm extends BaseContestForm
{
  public function configure()
  {

    // add a post validator
    $this-&gt;validatorSchema-&gt;setPostValidator(
      new sfValidatorCallback(array('callback' =&gt; array($this, 'validateTextField')))
    );

  }

  public function validateTextField($validator, $values)
  {
    if ($values['myCheckbox'])
    {
      $this-&gt;validatorSchema['myTextField'] = new sfValidatorString(array(
          'required'   =&gt; true,
          'max_length' =&gt; 50,
          'min_length' =&gt; 1
        ));
    }

    return $values;
  }

}
]]>
http://www.entroducing.com/view/symfony-conditional-validation/feed 0
sf_guard_user_profile id and user_id are messed up http://www.entroducing.com/view/sf_guard_user_profile-id-and-user_id-are-messed-up http://www.entroducing.com/view/sf_guard_user_profile-id-and-user_id-are-messed-up#comments Sat, 26 Feb 2011 10:53:57 +0000 Benny http://www.entroducing.com/?p=341 If you use symfony’s sfDoctrineApply plugin and for some reason, the ‘id’ and ‘user_id’ in sf_guard_user_profile are messed up, you can try the below SQL.

The SQL would update sf_guard_user’s id to match the sf_guard_user_profile’s id.

Take note that this is provided that your other application tables are using sf_guard_user_profile‘s id and not the sf_guard_user‘s id.

-- drop constraints
ALTER TABLE `sf_guard_forgot_password`
  DROP FOREIGN KEY `sf_guard_forgot_password_user_id_sf_guard_user_id`;

ALTER TABLE `sf_guard_remember_key`
  DROP FOREIGN KEY `sf_guard_remember_key_user_id_sf_guard_user_id`;

ALTER TABLE `sf_guard_user_group`
  DROP FOREIGN KEY `sf_guard_user_group_user_id_sf_guard_user_id`;

ALTER TABLE `sf_guard_user_permission`
  DROP FOREIGN KEY `sf_guard_user_permission_user_id_sf_guard_user_id`;

ALTER TABLE `sf_guard_user_profile`
  DROP FOREIGN KEY `sf_guard_user_profile_user_id_sf_guard_user_id`;  

-- remove auto increment
ALTER TABLE `sf_guard_user` CHANGE `id` `id` BIGINT( 20 ) NOT NULL;

-- update id in sf_guard_user
update `sf_guard_user` set id = id - 1;

-- add auto increment
ALTER TABLE `sf_guard_user` CHANGE `id` `id` BIGINT( 20 ) NOT NULL AUTO_INCREMENT;

-- update sf guard user profile
update `sf_guard_user_profile` set user_id = user_id - 1;

-- reset session
TRUNCATE TABLE `sf_guard_remember_key`;

-- reset user group
TRUNCATE TABLE `sf_guard_user_group`;

-- add back constraints
ALTER TABLE `sf_guard_forgot_password`
  ADD CONSTRAINT `sf_guard_forgot_password_user_id_sf_guard_user_id` FOREIGN KEY (`user_id`) REFERENCES `sf_guard_user` (`id`) ON DELETE CASCADE;

ALTER TABLE `sf_guard_remember_key`
  ADD CONSTRAINT `sf_guard_remember_key_user_id_sf_guard_user_id` FOREIGN KEY (`user_id`) REFERENCES `sf_guard_user` (`id`) ON DELETE CASCADE;

ALTER TABLE `sf_guard_user_group`
  ADD CONSTRAINT `sf_guard_user_group_user_id_sf_guard_user_id` FOREIGN KEY (`user_id`) REFERENCES `sf_guard_user` (`id`) ON DELETE CASCADE;

ALTER TABLE `sf_guard_user_permission`
  ADD CONSTRAINT `sf_guard_user_permission_user_id_sf_guard_user_id` FOREIGN KEY (`user_id`) REFERENCES `sf_guard_user` (`id`) ON DELETE CASCADE;

ALTER TABLE `sf_guard_user_profile`
  ADD CONSTRAINT `sf_guard_user_profile_user_id_sf_guard_user_id` FOREIGN KEY (`user_id`) REFERENCES `sf_guard_user` (`id`) ON DELETE CASCADE;
]]>
http://www.entroducing.com/view/sf_guard_user_profile-id-and-user_id-are-messed-up/feed 0
symfony backend: displaying thumbnail or photo in listing http://www.entroducing.com/view/symfony-backend-displaying-thumbnail-or-photo-in-listing http://www.entroducing.com/view/symfony-backend-displaying-thumbnail-or-photo-in-listing#comments Sun, 09 Jan 2011 06:19:31 +0000 Benny http://www.entroducing.com/?p=330 if you are using the admin generator to generate your backend application and want to show thumbnail or photo in your listing, you can try the following steps.

Here’s an example of how it will looks like when the thumbnail is showing on the listing page.

Before you add it in, you need to check the variable name of the row that the admin generator uses.

To check the variable name, go to the cache folder for the module and open the _list.php file with a notepad.
Take note of the row

\\cache\backend\dev\modules\autoContestphoto\templates\_list.php
...
        <?php foreach ($pager->getResults() as $i => $contest_photo): $odd = fmod(++$i, 2) ? 'odd' : 'even' ?>
          <tr class="sf_admin_row <?php echo $odd ?>">
            <?php include_partial('contestphoto/list_td_batch_actions', array('contest_photo' => $contest_photo, 'helper' => $helper)) ?>
            <?php include_partial('contestphoto/list_td_tabular', array('contest_photo' => $contest_photo)) ?>
            <?php include_partial('contestphoto/list_td_actions', array('contest_photo' => $contest_photo, 'helper' => $helper)) ?>
          </tr>
        <?php endforeach; ?>
...

In my case, the variable name for the row is $contest_photo

Next, create a partial call _thumbnail.php in the template folder of the module.
In this partial, echo the path of the thumbnail or the photo with a img html tag

\\apps\backend\modules\contestphoto\templates\_thumbnail.php
<img src="<?php echo $contest_photo->getThumbnailPath() ?>"/>

Then, edit the generator file to include the _thumbnail column for your list

\\apps\backend\modules\contest\config\generator.yml

...

      list:
        title: Contest Photo Management
        display: [=title, contest, category, user, title, isDeleted, _thumbnail]
        sort: [created_at, desc]
        max_per_page: 50

...

Clear your cache and see if the thumbnail loads.

]]>
http://www.entroducing.com/view/symfony-backend-displaying-thumbnail-or-photo-in-listing/feed 1
Symfony error : Call to undefined method myUser::setReferer. http://www.entroducing.com/view/call-to-undefined-method-myusersetreferer http://www.entroducing.com/view/call-to-undefined-method-myusersetreferer#comments Mon, 27 Dec 2010 13:53:52 +0000 Benny http://www.entroducing.com/?p=324 If you have this error

Call to undefined method myUser::setReferer.

and if you are using sfGuard plugin, go to

apps\[project]\lib\myUser.class.php

and change


class myUser extends sfBasicSecurityUser
{
}

to


class myUser extends sfGuardSecurityUser
{
}
]]>
http://www.entroducing.com/view/call-to-undefined-method-myusersetreferer/feed 1
You are not allowed to access this file. Check frontend_dev.php for more information. http://www.entroducing.com/view/you-are-not-allowed-to-access-this-file-check-frontend_dev-php-for-more-information http://www.entroducing.com/view/you-are-not-allowed-to-access-this-file-check-frontend_dev-php-for-more-information#comments Sat, 23 Oct 2010 05:26:24 +0000 Benny http://www.entroducing.com/?p=319 If you had deployed to production/LIVE environment and encounter this error message when you tried to access fontend_dev.php, it is due to a security IP check in fontend_dev.php to check for 127.0.0.1 before it continue.

Thus, you need to add your public IP address in fontend_dev.php to tell symfony to let you through in the production environment. Here’s how to do it

In your fontend_dev.php file, put in the below line to print out your public ip address

echo $_SERVER['REMOTE_ADDR']. &quot;&lt;br/&gt;&quot;

Access frontend_dev.php and copy the IP address as shown.

Edit frontend_dev.php and change the line

if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))

to

if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1', '111.222.333.444')))

Where 111.222.333.444 is the IP address you copied.

Upload back the frontend_dev.php and try again

]]>
http://www.entroducing.com/view/you-are-not-allowed-to-access-this-file-check-frontend_dev-php-for-more-information/feed 0
Non-Unicode program displaying Chinese characters as box/square in Windows 7 http://www.entroducing.com/view/non-unicode-program-displaying-chinese-characters-as-boxsquare-in-windows-7 http://www.entroducing.com/view/non-unicode-program-displaying-chinese-characters-as-boxsquare-in-windows-7#comments Sun, 10 Oct 2010 08:43:03 +0000 Benny http://www.entroducing.com/?p=308 If you have a chinese/non-unicode program that is displaying funny/box/square/garbage characters in Windows 7, you may want to try this method to display it properly.

AppLocale is a free download from Microsoft that allows you to run non-unicode applications without changing the entire system’s locale to another language. In short, it acts as a ‘wrapper’ for the non-unicode program and force the program to display the correct locale properly.

1. Once you install AppLocale, go to Start -> Program -> Microsoft AppLocale -> Applocale and the wizard will popup as shown below. Click Next

2. Click browse and select the chinese program exe file and click Next

3. Check if the language of the application is detected properly. if not, select the correct lanaguage and click Next

4. Tick the checkbox if you want to create a shortcut. The shortcut will be place under Start->Program->Microsoft AppLocale

5. Run the program by going to Start->Program->Microsoft AppLocale

And now the program is able to display the correct unicode

]]>
http://www.entroducing.com/view/non-unicode-program-displaying-chinese-characters-as-boxsquare-in-windows-7/feed 1
building new app with symfony : week 1 http://www.entroducing.com/view/building-new-app-with-symfony-week-1 http://www.entroducing.com/view/building-new-app-with-symfony-week-1#comments Thu, 30 Sep 2010 02:48:25 +0000 Benny http://www.entroducing.com/?p=301 Going to build a new photography website which will be maintain by my friend and myself.

Am looking at the current popular PHP frameworks which need to fufil the following requirement

  1. rapid development
  2. easy maintainance
  3. user account management
  4. file upload
  5. able to integrate easily with image manipulation library (GD lib)
  6. Suitable for a shared-hosting environment

Currently shortlisted

  1. CakePHP (which I have some experience with version 1.2)
  2. Symfony

Had do some googling and below are the pros and cons for each frameworks

CakePHP

Pro

  1. easy to code
  2. built in security access
  3. access of data via arrays

Cons

  1. Quite new as compare to Symony
  2. No (or little?) test functionality?

Symfony

Pros

  1. able to build an enterprise app (otherwise why would yahoo use it?)
  2. access of data via propel or doctrine (i.e. object oriented) as they are well supported
  3. Able to reload data easily
  4. Able to create test cases

Cons

  1. steep learning curve
  2. Complicated?

I decided to give myself a week to learn Syfmony before I decide which framework to use.

]]>
http://www.entroducing.com/view/building-new-app-with-symfony-week-1/feed 0