11 Mar

How Indian service providers can survive new downfall in Indian Outsourcing Industry…

Articles, Best Practices

There are number of reports which claim that Indian Outsourcing industry is coming to its end. This might not be the case, but you can expect a great downfall in coming years.

The report analyzed the rolling out of global delivery centres by the UK’s 20 largest IT services suppliers – Accenture, Capgemini, IBM and HP among them - and found that of the 21 centres opened since January 2007, just two were in India. Findings that offer further evidence of the threat to India’s traditional dominance.

Source: http://blog.europeanleaders.net/procurement-blog/2008/3/11/indian-offshoring-dominance-under-threat.html
At this point, people associated with this industry are likely to have some sufferings. However, you can do something to help your career and minimize the effect of this downfall. Here are seven things which small companies or freelancers should consider:

  1. Select an Industry & Business domain to serve.
    Indian Outsourcing was growing since last a few years, and it is pretty matured by now, but there are more countries like China, Morocco and Hungary, which are joining this global market and they might even have lesser prices than where we stand right now. This would result us in failing to compete over price. You can no more expect yourself to serve in multiple business domains or technologies, rather you’ll have to check for the market imbalances and then exploit them. A PHP developer might be easily available in other countries, but if you present yourself as an experienced Python developer – and if there is a demand, then you can charge your regular prices.
  2. Public Exposure of your skills.
    This might be obvious; you might not have got time to write or blog about your technical expertise. But now as more competition enters the market, you’ll need yourself to differentiate from others in some way. People like to buy from an expert not a follower. You need to show how your expertise can help them or their businesses. If you follow the point above, and target to selected industry only – that might even produce better results.
  3. Develop passion or leave the Industry.
    If you are not passionate about the industry, just quit and search for another Industry. Get yourself involved into an open source and let other people benefit from your passion. In long run, you will be the one who gets more benefits and success.
  4. Stretch your skills to your limit.
    I see a problem with many Indian programmers – they are not willing to learn new things. Many programmers I’ve worked with are satisfied with their present skill-set and don’t want to grow skills. They are happy with the pay-checks and increments they are getting. Some of these increments, if we look into depth are because of the boost in industry, not because a particular guy started working better or effectively. When this boom goes down, you will get lesser than what you are getting now. By continuously growing your technical skill-set you can survive.
  5. Automate Automate Automate.
    In order to work more effectively, we have to work more effectively than ever. To do so, you cannot increase time in a day – but what you can do is take advantage of the automation. Write your own code generators, reusable classes, or focus on automating and task you would do repetitively. If you spend even 1 hour daily on this – chances are you will achieve more for your clients in less time.
  6. Start some side projects.
    This might be a difficult one for many teams or individuals, but developing a side project (like a web app) can be turned as your asset – which should provide you not only money but the value to your customers. If you can create success from your own app, then you surely can help them out. Think building your services as a famous brand.
  7. Learn to communicate with your clients in their own words.
    Being too technical with clients sometimes helps, but when you learn their businesses and talk in their business terms it makes them more comfortable in dealing with you.

Why you need to do all this?

  • The cost advantage for offshoring to India used to be at least 1:6. Today, it is at best 1:3.
  • As the 1:3 cost structure becomes 1:1.5, it will soon become inefficient to use Indian labor.
  • Jobs that are low value-added and easily automatable should and will disappear over the next decade.
  • The Indians don’t do the thinking. The customers do. India executes.
  • India’s $30 billion IT/ITES services industry, meanwhile, is slowly and surely losing its competitive advantage.
  • Assuming a 15% year-to-year salary hike rate, and a 2007 cost advantage of 1:3 in favor of India, if U.S. wages remain constant, India’s cost advantage disappears by 2015.

- According to a report by Sramana Mitra

Still need another reason..?

- Abhimanyu Grover

14 Dec

CakePHP Tutorial - How to create an administrator panel in CakePHP

Articles, CakePHP

My new programmer wanted to know how to create administrator panel using CakePHP, so I thought to share my written tutorial with the community. Here it goes:

1. First, lets tell CakePHP that we need an admin panel to use for this app. Open config/core.php

PHP:
  1. define('CAKE_ADMIN', 'admin');   // uncomment this line if its commented already

2. Now all the controller functions prefixed with "admin_" are admin functions and will be accessible with URL's such as:

PHP:
  1. /admin/posts/add
  2. This URL will trigger Posts::admin_add()

You can define multiple function prefixed with 'admin_'. Remember all the views have to be with the same name i.e. admin_add.thtml

3. Now lets create a new layout for the admin in /app/views/layouts directory. Lets call it admin.thtml

PHP:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <?php echo $html->css('cake.generic');?>
  5. </head>
  6. <body>
  7. <div id="content"><? echo $content_for_layout; ?></div>
  8. </div>
  9.  
  10. <?php echo $cakeDebug?>
  11. </body>
  12. </html>

4. Now we have the URL's for admin, we also have the controller functions for admin. Now we need to create a functionality which will automatically use the above layout for all of our admin functions. To do this, create a file app_controller.php in 'app' directory. Or you can also copy it from /cake.

PHP:
  1. <?php
  2. class AppController extends controller
  3. {
  4.     // this is a cool function which comes useful in many cases
  5.     function beforeFilter()
  6.     {
  7.         // if its the administrator/manager - change the layout
  8.         $pos = strpos($_SERVER['REQUEST_URI'], CAKE_ADMIN);
  9.         if($pos == true)
  10.         {
  11.             $this->layout='admin';
  12.         }
  13.     }
  14. }
  15. ?>

AppController::beforeFilter() function will assign admin.thtml immediately by checking the URL being called, and this will be reflected in all controllers of your application. Now you can access URL's like /admin/posts/add, /admin/posts/edit/1 or similar, but not /admin alone which carries out authorization.

That's all you need to do. Next step is adding a simple authorization for administrators, which I'll explain in my other tutorial.

- Abhimanyu Grover

13 Feb

Finally a practical solution: Joomla with CakePHP together - JAKE

Articles, CakePHP, Latest Developments

For all those who liked my previous post where we integrated Joomla and CakePHP together, will surely love this one. There were some problems and limitations with the previous system, the major one was - The users who are already running Joomla couldn't take advantage of Cake as the setup involved in changing paths and all. Thanks to Dr. Tarique Sani for suggesting me that.

Ok, so lets start with the setup. Here the concept is, to install CakePHP as any other Joomla component and lets not modify anything with the present setup of Joomla. This is how we will start writing our component, com_cake [You can skip this part if you are interested in getting ready to use component] :

1. Lets install CakePHP in '\components\com_cake' of Joomla directory.

2. As we did before, lets create triggers for Cake... which are actual part of the components too: cake.php and cake.html.php

Here is cake.php

PHP:
  1. <?php
  2. defined( '_VALID_MOS' ) or die( 'Restricted access' );
  3.  
  4. require_once($mainframe->getPath('front_html'));
  5. $mainframe->setPageTitle("com_cake: Ultimate Joomla Component");
  6.  
  7. $joomla_path=dirname(dirname(dirname(__FILE__)));
  8.  
  9. // As this component (cakephp) will need database access, lets include Joomla's config file
  10. require_once($joomla_path.'/configuration.php');
  11.  
  12. // Constants to be used later in com_cake
  13. define(JOOMLA_PATH,$mosConfig_live_site);
  14. define(DB_SERVER,$mosConfig_host);
  15. define(DB_USER,$mosConfig_user);
  16. define(DB_PASSWORD,$mosConfig_password);
  17. define(DB_NAME,$mosConfig_db);
  18.  
  19. $controller=mosGetParam( $_REQUEST ,'module'); //option passed is treated as a controller in cake
  20. $action=mosGetParam( $_REQUEST ,'task'); //task passed is treated as a controller in cake
  21. $param=mosGetParam( $_REQUEST ,'id');
  22.  
  23. HTML_cake::requestCakePHP('/'.$controller.'/'.$action.'/'.$param);
  24.  
  25. ?>

cake.html.php

PHP:
  1. <?php
  2. defined( '_VALID_MOS' ) or die( 'Restricted access' );
  3.  
  4. class HTML_cake {
  5.  
  6. function requestCakePHP($url)
  7. {
  8.     $_GET['url']=$url;
  9.     require_once 'app\webroot\index.php';
  10. }
  11.  
  12. }
  13. ?>

Edit Cake's database.php

PHP:
  1. <?php
  2.  
  3. class DATABASE_CONFIG
  4. {
  5.     var $default = array(
  6.         'driver' => 'mysql',
  7.         'connect' => 'mysql_connect',
  8.         'host' => DB_SERVER,
  9.         'login' => DB_USER,
  10.         'password' => DB_PASSWORD,
  11.         'database' => DB_NAME
  12.     );
  13. }
  14. ?>

Ok, now we can see that URL like:
http://localhost/joomla/index.php?option=com_cake
will open Cake's homepage in Joomla layout. Make sure you have edited your default.thtml file so that CSS and HTML tags do not mess up.

http://localhost/joomla/index.php?option=com_cake&module=names&task=add
will call CakePHP's 'names' controller and 'add' function.
(Please dont confuse 'module' variable in URL with Joomla's module !!)
It will work great but we need even more. We also need scafollding/bake and more things which Cake can give... In my case, I loved baking than any other thing, so as to support bake process. Lets do next step.

3. Since Cake baked code uses helpers to output links, images or any other URL. So, lets hack Cake helper to output Joomla's URL in this formats:

index.php?option=com_cake&module=names&task=add
index.php?option=com_cake&module=names&task=index
index.php?option=com_cake&module=names&task=view&id=12

So, I wrote a small function for this, as we all love our HTML helper in Cake:
Write this function on bootstrap.php

PHP:
  1. <?php
  2.   function reform_url($url)
  3.     {
  4.         $temp=explode('/',$url);
  5.         $controller=$temp[1];
  6.         $action=$temp[2];
  7.         $param=$temp[3];
  8.         $url=JOOMLA_PATH.'/index.php?option=com_cake&module='.$controller.'&task='.$action;
  9.         if($param)
  10.             $url=$url.'&id='.$param;
  11.         return $url;
  12.     }
  13. ?>

Now we need to integrate this function with the helper functions so that it takes input in same format but output Joomla URL.

Copy HTML Helper (html.php) to your views/helpers folder and edit the following functions:

PHP:
  1. function url($url = null, $return = false) {
  2.  
  3.         if (isset($this->plugin)) {
  4.             $base = strip_plugin($this->base, $this->plugin);
  5.         } else {
  6.             $base = $this->base;
  7.         }
  8.  
  9.         if (empty($url)) {
  10.             return $this->here;
  11.         } elseif($url{0} == '/') {
  12.             $url=reform_url($url)//Lets change the URL
  13.             $output = $base . $url;
  14.         } else {
  15.             $url=reform_url($url)//Lets change the URL
  16.             $output = $base . '/' . strtolower($this->params['controller']) . '/' . $url;
  17.         }
  18.  
  19.         return $this->output($output, $return);
  20.     }

Similar changes were done in HTML::link(), HTML::image() and Controller:flash()

PHP:
  1. function flash($message, $url, $pause = 1) {
  2.         $this->autoRender = false;
  3.         $this->autoLayout = false;
  4.         $this->set('url', reform_url($this->base . $url));
  5.         $this->set('message', $message);
  6.         $this->set('pause', $pause);
  7.         $this->set('page_title', $message);
  8.  
  9.         if (file_exists(VIEWS . 'layouts' . DS . 'flash.thtml')) {
  10.             $flash = VIEWS . 'layouts' . DS . 'flash.thtml';
  11.         } elseif ($flash = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . "layouts" . DS . 'flash.thtml')) {
  12.         }
  13.         $this->render(null, false, $flash);
  14. }

4. We are all done, and our Cake is waiting for us....!!!
I did one more mod so that you people can still bake on using bake.php... Edit com_cake\cake\scripts\bake.php and on starting lines add this:

PHP:
  1. $joomla_path=dirname(dirname(dirname(dirname(dirname(__FILE__)))));
  2. require_once($joomla_path.'/configuration.php');

Most of your small applications developed with Cake will still work with Joomla using this component, as we have modified the helpers too. You dont even have to change Cake's conding conventions to use this plus you can still use bake.php anytime.

You can download the component here.

See it in action:
CakePHP Homepage in Joomla
Names::index()
Names::add()

Please post your feedback if you like this, good feedback on my previous article inspired me to do this.. I will post more interesting stuff soon.

UPDATE - 16, Feburary: Mariano Iglesias is extending this project further. Here's the Jake Homepage

Thanks
- Max

Hire us

Contact us to get a free quote on your project.