ExtJS 4 Loading data into form panel from store/model or via form.load

by on May 14th, 2013

var contactModel = component.contactDetails;
Ext.getCmp('EditContact_Form').getForm().loadRecord( contactModel );


var form = this.getWebItemForm().getForm();
var data = this.getStore('WebItemsForm').getAt(0);


     success:function(form,action) {
                var res = action.result;
    failure:function(response) {

sencha loading icon before app startup screen

by on May 9th, 2013

In the index.html,  add a div in the body:

 <style type="text/css">
 #loading-mask {
 position: absolute;
 left: 0;
 top: 0;
 width: 100%;
 height: 100%;
 background: url(resources/img/indicator.gif) no-repeat;
 text-align: center;
 <div id="loading-mask"></div>
 <script type="text/javascript" src="app.js"></script>


In app.js, in the launch function, once all the app initialization is finished I remove the load mask with a fade animation:

if (Ext.get('loading')) {
 var loadmask = Ext.get('loading');
 Ext.Anim.run(loadmask, 'fade', {
 easing: 'out',
 duration: 500,
 after: function() {

 xtype: 'loadmask',
 message: 'Please wait...'

Create some view here and call


condition in find function cakephp

by on May 8th, 2013

How to get data on condition that start time only have current year data:

$event = $this->Event->find('first', array(
 'conditions' => array(
 'Event.id' => $targetEvent['Eventtarget']['event_id'],
 'Event.stage' => 'created',
 'year(Event.startTime)' => date('Y') ), //this is the condition we have to check
 'fields' => array('Event.startTime', 'Event.city', 'Event.zip', 'Event.employee_id')

How to running Chrome with –allow-file-access-from-files ( Same origin policy )

by on March 26th, 2013

Close all your chrome browser.

Run this cmd:

C:\Users\admin\AppData\Local\Google\Chrome\Application>chrome --allow-file-access-from-files --disable-web-security

then use chrome for accessing webservices,

PHP xml to array

by on March 6th, 2013

 $xml = simplexml_load_string($data);
 $json = json_encode($xml);
 $response = json_decode($json,TRUE);

How to print the sql dump in cake php

by on February 27th, 2013

$db = ConnectionManager::getDataSource('default');

How to Setup Adobe Media Server 5 for Recording

by on February 7th, 2013

It is a common seen requirement to use Flash to record audio from browser, like the famous singing search site midomi. These days I did a little survey about this, write down some memo here.

There are a lot of resources introducing how to program in ActionScript to send video/audio stream via RTMP protocol. One particular page I found very useful is this. It gives you out-of-box sample application and full source codes, also with complete related JavaScript sample codes. However the author seems using Red5 server, which I found not maintained as well as AMS(Adobe Media Server). Here are some steps to setup AMS5 to work:

Download AMS5 and install it. An Adobe member account is required. I used Windows version.
Open AMS start page and play with it, default location. Test if video streaming is working.
Open AMS admin console and play with it, default location. Here you can view active connections to the server and log.
Replace the application “live” with an unsigned version: backup all contents under path \applications\live\, then delete them; copy all contents under path \samples\applications\live\ to \applications\live. This is based on instructions in \applications\live\readme.txt.
Open \conf\ams.ini, change the line starting with “LIVE_DIR” to
# LIVE_DIR = C:\Program Files\Adobe\Adobe Media Server 5\applications\live
LIVE_DIR = C:\Program Files\Adobe\Adobe Media Server 5\webroot\live_recorded.
Restart AMS5 service: run “Stop Adobe AMS5″ then “Start Adobe AMS5 in start shortcut group of AMS5.
Open the demo page OR click here mentioned above on the AMS5 machine. Use the “Want to test your Red5 install?” part to test your own FMS setup. Fill in “rtmp://localhost/live” and click “Load” button. It should be able to record and play, the file should be saved under \webroot\live_recorded\ as an .flv file.

Using CURLOPT_CAINFO with updated CA bundle causes certificate verify failed

by on February 1st, 2013

1. Open this link : Click Here.

2. Save the file on your coputer with cacert.pem name.

2. use

curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . ‘/cacert.pem’);


curl_setopt($ch, CURLOPT_CAINFO, '/path/to/cacert.pem');

How to add symlinks windows 7

by on January 31st, 2013

Symlinks via Command Prompt

1. First of all run your command prompt as administrator.

2. type mklink and press enter. and you can see the options.

3. if we choose /D (means directory) then use below command

C:\Windows\system32>mklink /D C:\xampp\htdocs\videorepo “C:\
Program Files\Adobe\Adobe Media Server 5\webroot\live_recorded”

For Referer link: Click Here

CakePHP cake bake command

by on January 8th, 2013

step 1: set path to environment variable. like:


step 2: open command prompt and type

cd C:\xampp\htdocs\yourproject\app  and press enter.

step 3: now type cake bake

now you can see the options there. you can continue accordingly.