11 Feb

Business Processes using Artificial Intelligence

Best Practices, Latest Developments

Business growth and expansion is in every entrepreneur’s soul. Most of them come out with good ideas and suggestions to grow their businesses, but in today’s competitive world, one can not rely on man to perform all the tasks. Automation of the industries is a very genuine step to fulfill the dreams of expansion of the business. I have seen numerous cases, where the business, with lot of help from automation, grows at a very fast pace.

The automated industries are getting the fruits, in a long term, in following ways

• Time saving
• Higher Efficiency
• No human error
• Low operational cost

The use of artificial intelligence is one of the most unconventional thought in today’s world. Artificial Intelligence leads the industry to get the boom in production and output is maximized in least inputs.

The cases of automation can be seen in today’s world in most reputed organizations. We recently helped a data entry company, in automating their data entry process. Before automation, they faced lots of problems with the human errors, low efficiency, high operating costs, in form of salaries. The pitfall deteriorates the working conditions and leads the organization into defalcation.

We came up with an excellent idea to import the concept of artificial intelligence by the means of automating the data entry process and achieved the output by 10 times with no extra costs and no labor costs.

Another case of artificial intelligence is used in Maruti Udyog Pvt Ltd, for providing the colors to the body parts with help of robotic arms. This provides the uniform color to the body parts and a higher quality has been achieved in it.

Artificial Intelligence is now days used in many companies and all of them are diverting their processes to make the best output and hence, best profits.

The concept will rock the world with its leverage and provide large profits to entrepreneurs in all perspectives. The pros of the process are much higher than the cons. The only limitation in the process is its high initial cost.

“The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge”. Daniel J Boorstin.

The quote explains the whole dilemma of the today market growth, where we are running behind every illusionary idea to get the success without seeking for the available option in form of Artificial Intelligence.

- Sandeep Sinha

11 Dec

A better way to send emails than CakePHP’s default Email Component ?

Best Practices, CakePHP, Latest Developments

While working on a big project today, I had to use this default Email component. I was disappointed when I had to create two views for every singly mail... This is really bugging.. Plus, It is not fast as it can be.
At the same time, I've always loved the magic Model functions: findAllby

Today, I realized how productive it would make us if there's some similar magic functions for email as well. Say to send a user approval letter, you just have to write following in your controllers:

PHP:
  1. $this->Email->send_UserApproval($email, $verification_code)// to send user approval mail
  2. $this->Email->send_UserWelcome($email)//welcome mail
  3. $this->Email->send_AdminPaymentNotification($from);   // payment notification to admin

This does not only increases the speed of writing code, but also makes code look beautiful.

While I was thinking about the idea, I dugg into model class of CakePHP to find how its done, I found the source of magic:

PHP:
  1. function __call($method, $params, &$return) {
  2. $db =& ConnectionManager::getDataSource($this->useDbConfig);
  3. $return = $db->query($method, $params, $this);
  4. if (isset($this->__backAssociation)) {
  5. $this->__resetAssociations();
  6. }
  7. return true;
  8. }

This is the function which creates all Model:findAllby functions. So I decided to write my own component which will definately save time in many of the projects.

One good way of developing this would be creating a language/email file like emails.php with something like this:

PHP:
  1. 'user'=>array(
  2. 'Approval'=>'Hi user, You are about to get approved.',
  3. 'Welcome'=>'Welcome user, you can now play with our system.'
  4.  
  5. ),

This file will be read by Email::__call() and our magic functions will be created on the run.

What do you think of this method ? Is it better than current Email component ? I'll blog again as soon as my email component is ready..

23 Oct

How to add attractive ‘file type’ icons on your webpage using jQuery

Best Practices, jQuery

Many times we need to show different icons for different files - mostly when files are being uploaded from various members.
Here's what we are trying to do:

Normally, it can be done with PHP, i.e. assign CSS classes dynamically, but that is way too inefficient after jQuery showed me the new method.
So, how to do it with jQuery ?

Given this snippet:

HTML:
  1. <div class="attachment"><a href="http://www.gigapromoters.com/blog/file.doc">mydocument.doc</a> <a href="http://www.gigapromoters.com/blog/file.pdf">mypdf.pdf</a> <a href="http://www.gigapromoters.com/blog/file.png">myimage.png</a> <a href="http://www.gigapromoters.com/blog/file.txt">mytext.txt</a></div>

1. Lets define CSS, and put icons in required directory.
Here's the css which I'll be using:

CSS:
  1. div.attachment a
  2. {
  3. color: black;
  4. font-weight: bold;
  5. padding-left: 32px;
  6. display: block;
  7. height: 25px;
  8. padding-top: 6px;
  9.  
  10. }
  11. .pdf
  12. {
  13. background: url('pdf.png') no-repeat;
  14. background-position: 5px 50%;
  15. }
  16. .doc
  17. {
  18. background: url('doc.gif') no-repeat;
  19. background-position: 5px 50%;
  20. }
  21. .txt
  22. {
  23. background: url('text.gif') no-repeat;
  24. background-position: 5px 50%;
  25. }
  26. .img
  27. {
  28. background: url('img.png') no-repeat;
  29. background-position: 5px 50%;
  30. }

2. Now, we need to write Javascript using jQuery so our files get their respective class names in order to assign different icon for different file types.

$('div.attachment a[@href$=pdf]').attr('class','pdf');

using selector to find all the 'a' tags where attribute 'href' end with 'pdf'.. simple enough ? as soon as selector does it work and return the matched elements, we assign to 'class' attribute, the value 'pdf'.. and done..! So, we can complete this for the rest of file types.

JavaScript:
  1. $(document).ready(function() {  //as soon as jQuery is initialized after page load
  2.  
  3. $('div.attachment a[@href$=pdf]').attr('class','pdf');
  4. $('div.attachment a[@href$=doc]').attr('class','doc');
  5. $('div.attachment a[@href$=txt]').attr('class','txt');
  6. $('div.attachment a[@href$=png]').attr('class','img');
  7. }

Here's the demo

$('div.attachment a[@href$=png]').attr('class','img');

This can improved to support multiple file types like jpg, jpeg and others, but I didnt go into much depth... If anyone already knows, I would love to see that trick.

- Abhimanyu Grover