Showing posts with label how to. Show all posts
Showing posts with label how to. Show all posts

Saturday, 27 October 2012

How to root Samsung Galaxy i9100 S2


Galaxy S2 is one of the real success of Samsung's leading devices based on the Android platform. And how it is a very powerful phone that has sold so fast, the hackers did not spent much thought and have root-ed it. There are 2 tutorials on rooting , I will write the easiest for beginners. So let's start.


  1. Download Odin and extract the files from the archive, saving them on your computer
  2. Download XWKDD but not extract any files from it
  3. Download SuperOneClick
  4. Download Samsung Kies and install you phone drivers
  5. After you install the Samsung Kies restart PC
  6. Put your phone in USB debugging mode. Go to Settings, Applications, Development and start USB Debugging
  7. Turn off the phone and turn it back on holding the power, home and volume down buttons
  8. Start Odin and connect your phone to the PC with a USB cable
  9. Wait until Odin will recognize your phone and shows it is connected. On Odin window, except "F.Reset Time" and "Auto Rebot", NO other option should be checked 
  10. Press PDA and select the file that you downloaded at step 2 and press Start
  11. Odin will start flash-ing the kernel. When you are finished, your phone will automatically restart
  12. After the phone will reset start SuperOneClick, click root, the phone will root,  restart the phone and you're done.

Monday, 16 January 2012

Sugarcrm custom chart

Creating a sugar chart dashlet is done the same way as you would create a simple dashlet, just extending 2 functions, for this reason I will not cover the way a sugar dashlet is created. Notes: The dashlets will be named  "CustomLineDashlet" and "CustomPieDashlet" and the module is "abc_Sample". You can use the predefined sugar chart definitions for parsing data (modules\Charts\chartdefs.php) or you can create your own to meet any custom demands. This is done by editing(creating if dose not exist) "custom\Charts\chartDefs.ext.php". For CustomPieDashlet : custom\Charts\chartDefs.ext.php:
$chartDefs['custom_pie_chart'] = array('type' => 'code',
 'id' => 'custom_pie_chart',
 'label' => 'custom_pie_chart label',
 'chartUnits' => 'The unit definition',
 'chartType' => 'pie chart',
 // important value that will be used to group the data
 'groupBy' => array( 'name' ), 
 'base_url'=> 
  array(  'module' => 'abc_Sample',
   'action' => 'index',
   'query' => 'true',
   'searchFormTab' => 'advanced_search',
   )   
);
custom\modules\abc_Sample\Dashlets\CustomPieDashlet\CustomPieDashlet.php
....
public function display() {
 $currency_symbol = $GLOBALS['sugar_config']['default_currency_symbol'];
 require ("modules/Charts/chartdefs.php");
 // here we load the chart definition (custom\Charts\chartDefs.ext.php)
 $chartDef = $chartDefs['custom_pie_chart'];
 require_once ('include/SugarCharts/SugarChart.php');
 $sugarChart = new SugarChart();
 $sugarChart -> setProperties('', translate('LBL_OPP_SIZE', 'Charts') . ' ' . currency_symbol . '1' . translate('LBL_OPP_THOUSANDS', 'Charts'), $chartDef['chartType']);
 $sugarChart -> base_url = $chartDef['base_url'];
 $sugarChart -> group_by = $chartDef['groupBy'];
 $sugarChart -> url_params = array();
 $sugarChart -> getData($this -> constructQuery());
 $xmlFile = $sugarChart -> getXMLFileName($this -> id);
 $sugarChart -> saveXMLFile($xmlFile, $sugarChart -> generateXML());
 return $this -> getTitle('
') . '
' . $sugarChart -> display($this -> id, $xmlFile, '100%', '480', false) . '
'; } protected function constructQuery() { // this is the query used to get data and create the xml // for pie chart we have a simple query $query = " SELECT count(*) as total, name FROM table GROUP BY name ORDER BY name"; return $query; }
For CustomLineDashlet : custom\Charts\chartDefs.ext.php:
$chartDefs['custom_line_chart'] = array(  'type' => 'code',
 'id' => 'custom_line_chart',
 'label' => 'custom_line_chart label',
 'chartUnits' => 'The unit definition',
 'chartType' => 'line chart',
 // the legend will be the name and the x intervals will be the date
 'groupBy' => array( 'date','name' ), 
 'base_url'=> 
  array(  'module' => 'sam_Sample',
   'action' => 'index',
   'query' => 'true',
   'searchFormTab' => 'advanced_search'
 )   
);
custom\modules\abc_Sample\Dashlets\CustomLineDashlet\CustomLineDashlet.php
....
public function display() {
 $currency_symbol = $GLOBALS['sugar_config']['default_currency_symbol'];
 require ("modules/Charts/chartdefs.php");
 // here we load the chart definition (custom\Charts\chartDefs.ext.php)
 $chartDef = $chartDefs['custom_line_chart'];
 require_once ('include/SugarCharts/SugarChart.php');
 $sugarChart = new SugarChart();
 $sugarChart -> setProperties('', translate('LBL_OPP_SIZE', 'Charts') . ' ' . currency_symbol . '1' . translate('LBL_OPP_THOUSANDS', 'Charts'), $chartDef['chartType']);
 $sugarChart -> base_url = $chartDef['base_url'];
 $sugarChart -> group_by = $chartDef['groupBy'];
 $sugarChart -> url_params = array();
 $sugarChart -> getData($this -> constructQuery());
 $xmlFile = $sugarChart -> getXMLFileName($this -> id);
 $sugarChart -> saveXMLFile($xmlFile, $sugarChart -> generateXML());
 return $this -> getTitle('
') . '
' . $sugarChart -> display($this -> id, $xmlFile, '100%', '480', false) . '
'; } protected function constructQuery() { // this is the query used to get data and create the xml // for pie chart we have a simple query $query = " SELECT count(*) as total, name, date FROM table GROUP BY date,name ORDER BY name"; return $query; }
the meta files ( custom\modules\abc_Sample\Dashlets\CustomLineDashlet\CustomPieDashlet.meta.php and custom\modules\abc_Sample\Dashlets\CustomLineDashlet\CustomLineDashlet.meta.php) will look like this:
$dashletMeta['CustomSamplePieCart'] = array('module'  => 'abc_Sample',
            'title'       => 'Custom Pie Chart', 
                                          'description' => 'Custom description',
                                          'icon'        => 'themes/default/images/icon_sam_Sample_32.gif',
                                          'category'    => 'Charts');
and
$dashletMeta['CustomSampleLineCart'] = array('module'  => 'abc_Sample',
            'title'       => 'Custom Chart', 
                                          'description' => 'Custom description',
                                          'icon'        => 'themes/default/images/icon_sam_Sample_32.gif',
                                          'category'    => 'Charts');


Notes:
custom\Charts\chartDefs.ext.php is the place where you will define your chart type, important fields:
'groupBy' => array( 'date','name' ) (the x and legend fields)
'chartType' => 'line chart', (the swf name, php will capitalize and add .swf, so it will be lineChar.swf)

in the sql your x values will have to coincide (be the same) for all lines