Monday, April 30, 2018

Integration of salesforce in Drupal

In this Blog we are going to see how to integrate Salesforce in Drupal, prerequistes  are Salesforce developer account, Salesforce module installed in Drupal CMS.The integration of Salesforce with your Drupal has so many benefits as it helps sales and marketing to work efficiently, 
below are the integration steps. Step 1 Login your Salesforce account.Step 2 Follow the steps:
           Setup->Apps->App manager->New connected App
Follow the steps as shown in the screenshot:

Step 3 Now you can see connected app form, select required fields.
3.1 Basic information: Provide basic information about your app. 
3.2 API (Enable OAuth setting): OAuth (Open Authorization) gives access to resources without revealing user credentials to apps and end user's account information can be used by third-party services. Select setting checkbox. 


Step 4 Check whether the setting is selected or not as it toggles a form with some other required fields. 

Step 5 Enter the callback URL “https://www.yourdomain.com/salesforce/oauth_callback”.
Step 6 Select other fields as per your requirement and process it. Wait for 2-10 minutes before using your app. Now continue the process. Here you will get the consumer key and secret key (these keys are required to connect Drupal to Salesforce). Now you can use the connected app on your Drupal website.

Salesforce module:

Download Salesforce module and install it on your Drupal website. Also, download and install dependent modules like key & encrypt.
Let’s check out the submodules in Salesforce and what they do: 
  • Salesforce: OAUTH2 authorization, wrapper around REST API.
  • Salesforce Mapping: Maps Drupal entities to Salesforce fields, including field level mapping.
  • Salesforce Push: Pushes Drupal entity updates in to Salesforce.
  • Salesforce Pull: Pulls Salesforce object updates into Drupal on cron run.
  • Salesforce Encrypt: This module is dependent on two other module Encrypt & Key so make sure these are installed. Module required for access and refresh token with security.

Setting up Salesforce on Drupal website: 

Step 1 Go to Configuration->Salesforce->Salesforce Authorization 
Step 2 Add the oAuth configuration setting here


Create Salesforce mapping: 
Before Salesforce mapping, make sure what exactly are you looking for. 
Scenario:
Let’s map out basic information, like first name, last name, email of Drupal users to Salesforce and push them to CRM tool. 
Follow this path (admin/structure/salesforce/mappings) to get a form similar to the shown below.

Now fill the list of values: 
  • Label: Label of the mapping.
  • Drupal Entity: Select users in both of the fields “Drupal Entity Type” and “User Bundle” in order to map out Drupal users. 
  • Salesforce object: Here the selected value should be contacted only.
  • Action Trigger: Ones you create a user on Drupal site, use that as a contact in Salesforce tool. For this, select all the data push actions, like insert, update, delete.
Now select Upsert key and Mapped fields.

Upsert key: By setting Upsert key on Salesforce, you can prevent data duplicacy.Mapped fields: Fill the following columns. Property: Listed Drupal fieldsSalesforce field: Listed Salesforce fieldsDirection: There are three directions on the radio button. Here you can see the mapped data that will be updated on Salesforce or on your Drupal site or will synchronize on both. Your mapped field data depends on this setting. Operations: If you don’t want to map this field then delete it by selecting the ‘delete field option’.I have added Email as an Upsert key and for direction field, select “Drupal to Salesforce”.
Testing Proccess As follows:
Steps 1 Create a user from admin.Note: Salesforce module will automatically push the data on CRM with contacts.  Step 2 Run cron directly to update data with Salesforce contact by using the following path: /admin/config/system/cron 

Wednesday, April 4, 2018

How to choose best content management systems for web development

Indeed, there are great content management systems (CMS) available. The process of selecting an apt CMS that best suits one Business prospective is de facto a tedious task to carry out. Every Business requires a solution that addresses the challenges in present and is better aligned to ever changing dynamic business needs to make it future proof. There are a number of major factors and aspects that equip us with to take an informed decision from the available open source solutions.
The major aspects that are considered and come very frequently de facto are:
Support & Stability
The massive community size of the open source vendor is one of the best factors; we should look forward to before making a decision. There are other factors that add up to the decision making are; how large are their forums, how well are there documentation and what are the support options available.
The proprietary systems are preferred over open source just because of the fact that they offer 24/7 support and thereby is most considerable aspects among the folk. There is another prospect of open source which we are not aware of, that some of them offer similar support as proprietary systems do. There are popular proprietary systems like Jahia, Hippo and Magnolia which offer open source versions of their products as well.
The large community of Open Source and their large forums provides thousands of advanced functionalities, documentation, technical articles and people help us to fix the issues and extending the functionalities.
The large community of open source system and availability of code to outside world; helps developers around the world in extending and improving it. This helps identifying the anomalies and rectifying it for being used by the community. It leads to production of innovative tools, technologies, solutions, infrastructure and benchmarking best practices. Which is not in case of proprietary systems as it is motivated by a single owner.
Flexibility and Customization
Expanding a proprietary system is de facto more difficult due to the unavailability of freely available code. Using an Open Source System one can do Research & Development to produce Products & Services that can facilitate and support mission-critical business functions.
Before making a selection to any open source systems, we should analyze their documentation, best practices and coding standards they follow. What is the release process they follow before publishing any plugins or modules to the community? How frequently the products and services are being updated. Changelogs of the product blogs are another parameter for it as less updated products and services may have potential risk of making the system vulnerable.
Security
Security is the first and foremost factor, which the industry folk emphasize the most. It’s a common perception that Open Source systems have potentially risk to security threats by an adversary.
AugusteKerckhoff’s Principle in late 19th century gave his opinion in context of design principles for cipher, one of the most important was:
The cipher method must not be required to be secret, and it must be able to fall into the hands of the enemy without inconvenience.
Today, Kerckhoff’s Principle is understood advocating the published designs as it go public scrutiny and are therefore likely to be stronger. Thereby security is much higher after it has been extensively studied and has withstood may attack attempts and known publicly. As it is better that security flaws are revealed by ethical hackers and made public than having the flaws known only to malicious parties.
Public design enables the establishment of standards. It may be dangerous to use a proprietary system as it is designed in secret by some organization. Thus it is easy to find exploits in Open Source and becomes a strong point advocating that it is less likely to be attacked as there are frequent security updates and patches by the community.
Cost
It is one of the most important factors along with security in making a selection. It is also a common misconception while giving preference to Open source over proprietary system that it may cost less. It depends as the cost solely doesn’t depend on mere selection of Open Source system. Cost depends on development, design, management and deployment costs as well.
Open Source system provide a basic infrastructure on top which it requires customization, whereas proprietary system comes up with on the go solution and requires less customization. The major cost associated with Open source system is that having well versed developers and support costs and most of the training activities can be learnt online at reasonable cost or at no cost.
 In Proprietary system the cost lies in licensing, training, development and support. 

Not only Proprietary systems should be given preference but also Open Source systems may fit the business needs and will remain an apt alternative to it.


Why use Drupal over Wordpress?


  • Wordpress was designed only to be a blog with some easy add-ons.
  • Drupal was designed to be more of a generalist: it’s for making ‘anything’ and is far more robust.
  • Wordpress could be the better choice for blogs since it is better at being a blog than Drupal.  This is something of debate.
  • Wordpress is still a sound choice of CMS for SEO and security; so if wordpress satisfies a simpler project’s requirements then by all means use it- it is easier and faster to set up than Drupal.
  • Wordpress is not designed to be highly scalable to many simultaneous users, nor does it have flexible roles, permissions, extensible content types, nor does it have plentiful well-tested, quality add-ons.  It has a few and a lot of really poor plugins.
  • Caveat: Trying to force Wordpress to do something it cannot do easily with very popular plug-ins can be worse than suffering the learning curve of Drupal.
  • It has superior session handling for a CMS.
  • It has superior security.
  • It is a more consistent, reliable and flexible framework for development.
  • It is considered better for SEO from our research.
  • It uses a ‘separation of concerns’ architecture to cleanly and consistently separate structure, function, form, and presentation in layers (ie: php from data as db/xml, layout and presentation as html and css).  
  • It heavily uses ‘defaults overrides’ in code in the form of hooks and in themes in the form of templates.  This makes it extremely flexible.
  • Other CMS’es do a very very bad job of at least one of the above.
  • Drupal has a steeper learning curve than wordpress or Joomla.
  • Drupal and it’s developers make no excuse for this fact- it is a robust, flexible tool
  • That said, the drupal community is constantly addressing usability and user-experience issues because they want the industry market share.

Friday, March 30, 2018

Regular Expressions in Python

Regular Expressions in Python are very important in programming, Python "re" module provides regular expression support.

The re.search() method takes a regular expression pattern and a string and searches for that pattern within the string. If the search is successful, search() returns a match object or None otherwise. Therefore, the search is usually immediately followed by an if-statement to test if the search succeeded, as shown in the following example which searches for the pattern 'word:' followed by a 3 letter word (details below):

str = 'an example word:cat!!'
match = re.search(r'word:\w\w\w', str)
# If-statement after search() tests if it succeeded
  if match:                      
    print 'found', match.group() ## 'found word:cat'
  else:

    print 'did not find'

The code match = re.search(pat, str) stores the search result in a variable named "match". Then the if-statement tests the match -- if true the search succeeded and match.group() is the matching text (e.g. 'word:cat'). Otherwise if the match is false (None to be more specific), then the search did not succeed, and there is no matching text.


The 'r' at the start of the pattern string designates a python "raw" string which passes through backslashes without change which is very handy for regular expressions (Java needs this feature badly!). I recommend that you always write pattern strings with the 'r' just as a habit.

str = 'an example word:cat!!' match = re.search(r'word:\w\w\w', str) # If-statement after search() tests if it succeeded   if match:                           print 'found', match.group() ## 'found word:cat'   else:     print 'did not find'
str = 'an example word:cat!!' match = re.search(r'word:\w\w\w', str) # If-statement after search() tests if it succeeded   if match:                           print 'found', match.group() ## 'found word:cat'   else:     print 'did not find'
str = 'an example word:cat!!' match = re.search(r'word:\w\w\w', str) # If-statement after search() tests if it succeeded   if match:                           print 'found', match.group() ## 'found word:cat'   else:     print 'did not find'
str = 'an example word:cat!!' match = re.search(r'word:\w\w\w', str) # If-statement after search() tests if it succeeded   if match:                           print 'found', match.group() ## 'found word:cat'   else:     print 'did not find'


Thursday, March 29, 2018

Artificial Intelligence

AI (artificial intelligence) is the simulation of human intelligence processes by machines, especially computer systems. These processes include learning, reasoning  and self-correction.

Particular applications of AI include expert systems, speech recognition and machine vision.

Artificial intelligence can be implemented in the doamins like,

Healthcare:
The biggest bets are on improving patient outcomes and reducing costs. we can apply machine learning to make better and faster diagnoses than humans. AI applications may include chatbots, a computer program used online to answer questions and assist customers, to help schedule follow-up appointments or aiding patients through the billing process, and virtual health assistants that provide basic medical feedback.

Busines:
Robotic process automation is being applied to highly repetitive tasks normally performed by humans. Machine learning algorithms are being integrated into analytics and CRM platforms to uncover information on how to better serve customers.

Education:
AI can automate grading, giving educators more time. AI can assess students and adapt to their needs, helping them work at their own pace. AI tutors can provide additional support to students, ensuring they stay on track. AI could change where and how students learn, perhaps even replacing some teachers.

Finance:
AI applied to personal finance applications, such as Mint or Turbo Tax, is upending financial institutions. Applications such as these could collect personal data and provide financial advice. Other programs, IBM Watson being one, have been applied to the process of buying a home. Today, software performs much of the trading on Wall Street.

Law:
The discovery process, sifting through of documents, in law is often overwhelming for humans. Automating this process is a better use of time and a more efficient process. Startups are also building question-and-answer computer assistants that can sift programmed-to-answer questions by examining the taxonomy and ontology associated with a database.

Manufacturing: This is an area that has been at the forefront of incorporating robots into the workflow. Industrial robots used to perform single tasks and were separated from human workers, but as the technology advanced that changed.

Setting up local developement instance for Drupal 8

This blog is about set up a local developement instance for Drupal 8 on Pantheon server and the best use of drush.


Let’s follow the step-by-step process  to set up our own local developement instance:

I)

To set up local developement instancefor Drupal 8 ,  Click on git and copy below command
git clone ssh://devserver.dev.463157b8-419d-482f-b571-xxxxxxxxx@deveserver.dev.463157b8-419d-482f-b571-3504bb893903.drush.in:2222/~/repository.git mkrishnapriya-drupal

II)
Then go to your web root i.e. /var/www/html/ and paste the copied command
git clone ssh://devserver.dev.463157b8-419d-482f-b571-xxxxxxxxx@devserver.dev.463157b8-419d-482f-b571-3504bb893903.drush.in:2222/~/repository.mkrishnapriya-drupal
III)

Meanwhile, create a database for the site in local
mysql -u root -p Enter the username and administrator password you set-up during installation

CREATE DATABASE drupal8;
IV)
Download the Pantheon Drush alias from Pantheon Dashboard (https://dashboard.pantheon.io) and place that file to .drush folder
i.e. /home//.drush/

Place below code in .drush folder file name as local.aliases.drushrc.php
--------------------------------------------------------------------------

$local_sites = '/var/www/html/';
$scan = scandir($local_sites);
unset($scan[0]);
unset($scan[1]);
foreach($scan as $projects){
 $aliases[$projects] = array(
 'root' => $local_sites . $projects,
 'path-aliases' => array(
   '%dump-dir' => $local_sites . 'drush.dbdumps',
   '%files' => $local_sites . $projects . '/sites/default/files'
   )
 );
}
?>

V)
After clone is done, go to /var/www/html/drupal8/sites/default/
Create new settings.local.php should be an settings.local.php of Drupal 8 Note: Add below code snippet

/**
* @file
* settings.local.php.
*/
// Local development configuration.
if (!defined('PANTHEON_ENVIRONMENT')) {
 // Database.
 $databases['default']['default'] = array (
   'database' => Drupal8,
   'username' => '*****',
   'password' => '****',
   'prefix' => '',
   'host' => '******',
   'port' => '3306',
   'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
   'driver' => 'mysql',
 );
 $config_directories['sync'] = 'sites/default/config';
 $settings['hash_salt'] = '$HASH_SALT';
}
ini_set('max_execution_time', -1); // add if required
ini_set('memory_limit', '512M'); // add if required
ini_set('upload_max_filesize , 1024M'); // add if required
ini_set('post_max_size , 1024M'); // add if required

Step 6

Create files folder in sites/all/default/
Give permission to file folder Chmod 777 -R files/
Go to ./drush folder through terminal and type drush cc drush
Now on terminal, type drush sa
You will get all local aliases, dev aliases, test aliases and live aliases

Friday, July 20, 2012

Best website development Recommendations


There are literally millions of web sites on the Internet today, with thousands more being added every day. One of the most important aspects of your success online is with your web site.

Websites vary from the simple to the complex. The individual features and characteristics of your website is what make it distinct from the other sites .

When creating a functional, dynamic and attractive web site, the following features should be kept in mind at all times:

  • Your main page should be specific.
  • Aways keep adding new content to your site. It gives your clients a reason o keep coming back.
  •  Make sure you create a page that clearly displays your 'Privacy Policy' with regards to the personal information you collect from your visitors. You can also explain your reasons for collecting the information and let them know how and if the information will be used. Also display your copyright information at the bottom of each page.
  • Create an 'About Us' page
  •  Make sure you include good navigational links on every page. Also use tables to
  • Neatly align your links and maintain a nice organized and uniform appearance throughout your website.
  • Use caution when selecting colors for your background and text. A busy background makes it difficult to read the text and draws attention away from it.
  • Also remember to use colors based upon the effect you are trying to achieve. Additionally, always be consistent with your background theme and colors on each page of your site.
  • If you are using JavaScript on your site, make sure it is used appropriately, as it can slow a site down. Try and view your site through different browsers and screen resolutions so you will know how other people will view your site.
  • Try to avoid frames in your website as it can make your site look unprofessional.
  • Lastly make sure that your site has no grammar or spelling errors.