Wednesday 24 August 2016

what i need to be a developer best commands

way to connect to chrome extion in ubuntu
DNS server
search domains
reconnect ntework

connect to other pc -- sftp://user@

============PHP CONCATINATION==============
'<div class="logo-wrapper">
           <div class="logo">
             <img src="'. $base_url .'/sites/all/themes/hdfc/images/popup-hdfc-logo.png" alt="hdfc-logo">
git reset --hard
git pull
This is how you can use dsm in watchdog.

watchdog('form', kprint_r($form, TRUE, NULL));


drush: watchdog-show (ws)

Rather than going to the watchdog page to see errors and warnings, you only have to run watchdog_show.
 drush watchdog-show
Search anything on server:
cd /var/www/html 
grep -irn 'your keyword' .



how to clear varnish memcache

/etc/init.d/varnish restart
/etc/init.d/memcached stop
/etc/init.d/memcached start


how to clone

import database by command
-----> mysql -h localhost -u root dara<daradb04112015.sql -p

user@user-1032:~$ cd ../..
user@user-1032:/$ cd var/www/html/
user@user-1032:/var/www/html$ mkdir gica
user@user-1032:/var/www/html$ cd gica/
user@user-1032:/var/www/html/gica$ git clone -b dev .

user@user-1032:~/Downloads$ cd
user@user-1032:~$ cd /etc/
user@user-1032:/etc$ sudo gedit hosts

cd /etc/apache2/sites-enabled
2. sudo gedit 000-default.conf

3. sudo gedit myconfig.conf
sudo service apache2 restart 

4. hosts file on first line add  ursit.local 
(as in myconfig file :-ursit.local  )

for permission to folder and file

go to folder 1 level Up(before)
1. cd /var/www/html/sites/all/themes/
2. sudo chmod -R 755 videos(folder name) OR sudo chmod -R 777 videos
To check permission ls -l

sudo chown www-data:www-data filename_like_footer_banner

===========Backup MySQL==========
$ mysqldump -u[username] -p[pass] -h[hostip] [dbname] > [backupfile.sql]
In above command,
  • -u specifies username to connect to MySQL,
  • -p as user password,
  • -h (optional, if on same machine) specific IP or hostname where MySQL is setup,
  • dbname is database to take backup,
  • backupfile.sql is your backup file name with .sql as ext.
To take backup of database named as "drupal" with root user, we need to run following command:
$ mysqldump -uroot -p "type_ur_pass" drupal > drupal_dbbackup.sql


        $img_uri = $node->field_thumbnail[LANGUAGE_NONE][0]['uri'];
        if ($img_uri) {
          $img_url = image_style_url('search_org_logo', ($img_uri));
        else {
          $img_url = get_default_image_url('organization', 'search_org_logo');

        global $base_url;
        $share = $base_url . '/' . drupal_get_path_alias('node/' . $nodeid);


SSL on localhost
If you want to enable HTTPS for your blog, you must first create or generate your server private certificate key. Then generate a certificate signing request and submit to a Certificate Authority or CA which will validate the server key and issue a trusted SSL certificate.
So, generate a certificate for your server. Then generate a certificate signing request or CSR using information of the server private key since you don’t want to submit your private key to external entities. Your server key is private and should always remain on the server.
After generating the CSR using information from the server private key, you’ll then submit that CSR file to a CA to be validated. The CA will then give your a SSL certificate to use on your sites.

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
        ServerName domain.local
        ServerAlias domain.local

DocumentRoot /var/www/html/ur_folder_name


How to run Solr  in background

Right now I start it by java -jar start.jar but I would like it to log to a file and run in the background on the server so that I can close the terminal window.
I'm sure there is some java config that I can't find.
I have tried java -jar start.jar > log.txt &

Your First Solr Search Request

Now let’s query our book collection! For example, we can find all books with “black” in the title field:
The fl parameter stands for “field list” and specifies what stored fields should be returned from documents matching the query. We should see a result like the following:
      "title_t":"The Black Company",
      "author_s":"Glen Cook"},
      "title_t":"The Black Cauldron",
      "author_s":"Lloyd Alexander"}]

Our schema has some common dynamicField patterns defined for use:
Field SuffixMultivalued SuffixTypeDescription
_t_txttext_generalIndexed for full-text search so individual words or phrases may be matched.
_s_ssstringA string value is indexed as a single unit. This is good for sorting, faceting, and analytics. It’s not good for full-text search.
_i_isinta 32 bit signed integer
_l_lslonga 64 bit signed long
_f_fsfloatIEEE 32 bit floating point number (single precision)
_d_dsdoubleIEEE 64 bit floating point number (double precision)
_b_bsbooleantrue or false
_dt_dtsdateA date in Solr’s date format
_plocationA lattitude and longitude pair for geo-spatial search

 if you want to customize your search results is look at the search-results.tpl.phpand search-result.tpl.php template files (note the singular in the second one).
You can find copies of those in the core search module, and I'd just copy and paste those entire files (no need to even rename them) and put them in your custom theme's /templates/ folder. After clearing your cache, they should get picked up since they will have precedence now.
The search-results.tpl.php file controls how the entire search results page looks, while the search-result.tpl.php file controls who an individual search result is displayed (which fields, in which order, etc). Now that you have copies in your own custom theme, modify them any way you want!



function slugify($text) {
  // replace non letter or digits by -
  $text = preg_replace('~[^\\pL\d]+~u', '-', $text);

  // trim
  $text = trim($text, '-');

  // transliterate
  $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);

  // lowercase
  $text = strtolower($text);

  // remove unwanted characters
  $text = preg_replace('~[^-\w]+~', '', $text);

  if (empty($text)) {
    return 'n-a';

  return $text;


Clean URL:-

1> cd etc/apache2/sites-enabled/

2>sudo nano gedit 000-default.conf


<Directory /var/www/html/drupal_test>
  RewriteEngine on
  RewriteBase /drupal_test
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

restart apache

$i = 0;
  while ($row = db_fetch_array($query)) {
    $data[] = array($row[$i]);
That is just REALLY bad coding!
db_fetch_array returns an array. When you write row[i] you actually fetch the first column/value from the first record on the first iteration, second column/valute on the second record, third column/valute on third record, and so on.
Just keep it simple:
  while ($row = db_fetch_array($query)) {
    $data[] = array_values($row);

=========> same code written in 2 diff way

 if ($quarterly_reports) {
      $foreign_contributor .='<li class="dasra-quarterly">
        <div class="report-title">' . $financial_year_title . '</div>
        <div class="annual-report-title">' . $annual_report_pdf . '</div>
        <div class="foreign-contributor">' . $report_title . '</div>
        <div class="download-quarterly-reports">' . $quarterly_reports . '</div>


 $quarterly_reports = $pdf_link;
    if ($quarterly_reports || $annual_report_pdf) {
      $foreign_contributor .='<li class="dasra-quarterly">';
      $foreign_contributor .= '<div class="report-title">' . $financial_year_title . '</div>';
      if ($annual_report_pdf) {
        $foreign_contributor .= '<div class="annual-report-title">' . $annual_report_pdf . '</div>';
      if ($quarterly_reports) {
        $foreign_contributor .= '<div class="foreign-contributor">Foreign Contributions</div>';
        $foreign_contributor .= '<div class="download-quarterly-reports">' . $quarterly_reports . '</div>';
      $foreign_contributor .= '</li>';


Checking this box will allow Html formated e-mails to be sent with the SMTP protocol

webform>>new webform

Select the theme that will be used to render

in module>>webform

The default subject line of any e-mailed results.
Sends all e-mail from the domain of the default address above and sets the "Reply-To" header to the actual sender. Helps prevent e-mail from being flagged as spam.
Whether the mail system configured for webform is capable of sending mail in HTML format.

The default format for new e-mail settings. Webform e-mail options take precedence over the settings for system-wide e-mails configured in MIME mail.

Force all webform e-mails to be sent in the default format.


Hidden filed using TOKEN

Hidden field ---->ref Hidden %get[ref]

include_once drupal_get_path('module','webform') . '/includes/';
  $submission[data] = webform_get_submission($node->nid, $sid);
  foreach ($submission['data']->data as $data) {
    $submitted_data[] = $data[value][0];    
   //echo '<pre>'; print_r($submitted_data); echo '</pre>'; exit();
   if (in_array('facebook', $submitted_data)) {

CKEDITOR strip classes or print &lt;div insted of <div>

Custom JavaScript configuration
Paste in:
config.allowedContent = true;

Sunday 15 May 2016

how to write an official formal business email

Some commonly used sentences for starting an email:
  • Thank you for contacting us. -- If someone writes an email to ask for the service of the company, you can use this sentence to start.
  • Thank you for your prompt reply. -- When a client or colleague replies your email very fast, remember to thank him/her. If they don't reply in time, just remove the prompt, You can say "Thank you for getting back to me".
  • Thank you for providing the requested information. -- If you ask somebody for some information and he/she spends some time on finding the information, you can use this sentence to thank him/her.
  • Thank you for all your assistance. -- If someone gives you some special help, them you must thank them. If you want to express your special thanks, use " I truly appreciate your help in resolving the problem" .
  • Thank you for your feedback --Even if someone gives some criticisms, you still need to thank him/her.
At the end of an email : At the beginning of an email, you thank others for what they did in the past. While at the end of the email, you thank others for what the will do in the future.
Some commonly used sentences for ending an email::
  • Thank you for your kind cooperation. -- If you ask the reader for help.
  • Thank you for your attention to the matter.
  • Thank you for your understanding
  • Thank you for your consideration
  • Thank you again for everything you've done.
Expressions in 10 situations
1. Greeting message
  • Hope you have a good trip back
  • How are you?
  • How is the project going?
2. Initiate a meeting
  • I suggest we have a call tonight at 9:30pm with you and Brown. Please let me know if the time is okay for you and Brown.
  • I would like to hold a meeting in the afternoon about our development planning for the project A
  • We'd like to have the meeting on Thu Oct 30. Same time
  • Let's have a meeting next Monday at 5:80 pm SLC time
  • I want to talk to you over the phone regarding issues about report development and the XXX project
3. Seeking for more information/feedback/suggestions/
  • Should you have any problem accessing the folders, please let me know
  • Thank you and look forward to having your opinion on the estimation and schedule
  • Look forward to your feedback and suggestions soon
  • What is your opinion on the schedule and next steps we proposed?
  • What do you think about this?
  • Feel free to give your comments
  • Any question, please don't hesitate to let me know
  • Any question, please let me know
  • Please contact me if you have any questions
  • Please let me know if you have any questions on this
  • Your comments and suggestions are welcomed
  • Please let me know what you think.
  • Do you have any idea about this?
  • It would be nice if you could provide a bit more information on the user's behavior
  • At your convenience, I would really appreciate you looking into this matter/issue.
4. Give feedback
  • Please see comments below
  • My answers are in blue below
5. Attachment
  • I enclose the evaluation report for your reference
  • Attached please find today's meeting notes
  • The attachment is the design document, please review it.
  • For other known issues related to individual features, please see attached release notes
Point listing
  • We would like to finish following tasks by the end of day: 1....2.....
  • Some known issues in this release: 1....2....
  • Our team here reviewed the newest SCM policy and has following concerns:1....2....
  • Here are some more questions/issues for your team:1....2....
  • The current status is as following: 1....2....
  • Some items need your attention: 1....2.....
7. Raise question
  • I have some questions about the report XX-XXX
  • For the assignment ABC, I have the following questions
8. Proposal
  • For the next step of platform implementation, I am proposing...
  • I suggest we can have weekly project meeting over the phone call in the near future
  • Achievo team suggest to adopt option A to solve outstanding issue...
9. Thanks note
  • Thank you so much for the cooperation
  • Thanks for the information
  • I really appreciate the effort you all made for the sudden and tight project
  • Thank you for your attention
  • You kind assistance on this are very much appreciated
  • Really appreciate your help
10. Apology
  • I sincerely apologize for the misunderstanding
  • I apologize for the late asking but we want to make sure the correctness of our implementation ASAP

Sunday 21 February 2016

Drupal 7 Advance tutorial

$sq_visitors = db_select('ab_visitors', 'a')->fields('a', array('nid'));
$sq_visitors->addExpression('COUNT(ref)', 'count');    
// sub query 2
$sq_clicks = db_select('ab_actions', 'a')->fields('v', array('nid'));
$sq_clicks->join('ab_visitors', 'v', 'v.ref = a.ref');
$sq_clicks->addExpression('COUNT(', 'clicks');    
// sub query 3
$sq_details = db_select('ab_visitors', 'a')->fields('a', array('nid'));
$sq_details->addExpression('COUNT(ref)', 'details');    
// main query
$query = db_select('node', 'n')
 ->fields('n', array('nid', 'title'))
 ->fields('a', array('field_a_or_b_value'))
 ->fields('s', array('field_sister_page_target_id'))
 ->fields('x', array('count'))
 ->fields('y', array('clicks'))
 ->fields('z', array('details'))
 ->condition('n.type', 'landing_page');
$query->join('field_data_field_a_or_b', 'a', 'a.entity_id = n.nid');
$query->join('field_data_field_sister_page', 's', 's.entity_id = n.nid');
$query->addJoin('LEFT OUTER', $sq_visitors, 'x', 'x.nid = n.nid');
$query->addJoin('LEFT OUTER', $sq_clicks, 'y', 'y.nid = n.nid');
$query->addJoin('LEFT OUTER', $sq_details, 'z', 'z.nid = n.nid');
$result = $query->execute()->fetchAll();

Automatically add a field to every new webform created

I recently had a need for users to be able to attach webforms to some node types to allow users to give feedback.
Each webform could be attached to multiple nodes.
When the webform data was submitted it needed to record which node it was attached to.
This was easy enough by adding a hidden field with the default value of %get[q] to record the nid.
However I didn’t want users to have to do this manually every time a webform was created, instead I wanted this field to be automatically included on every new webform added.
To do this I needed to act on the webform node after it had been inserted into the database so hook_node_submit was out of the question.
Instead I added an additional submit function on the webform_node_form to fire after the node module and webform module had finished doing their bit:
function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id) {
 if($form_id=='webform_node_form') $form['actions']['submit']['#submit'][] = 'misc_webform_form_submit';
Now in the new submit handler we simply add the new field to the webform and save the node (which is why the node had to be already created).
function misc_webform_form_submit($form, &$form_state) {
 $node = node_load($form_state['build_info']['args'][0]->nid);
 $node->webform['components'][] = array(
  'nid' => $node->nid,
  'cid' => 1,
  'pid' => 0,
  'form_key' => 'related_document',
  'name' => 'Related Document',
  'type' => 'hidden',
  'value' => '%get[q]',
  'extra' => array(
   'hidden_type' => 'value',
   'conditional_operator' => '=',
   'private' => 0,
   'conditional_component' => '',
   'conditional_values' => ''
  'mandatory' => 0,
  'weight' => 0,
  'page_num' => 1


Sunday 20 December 2015

Notion-softronics web designing,application,ecommerce,software.






 coin 1 service


Saturday 12 December 2015

how to make currency exchange rates in jquery php

  Google Finance Currency Converter

    $from_currency    = 'USD';
    $to_currency    = 'INR';
    $amount            = 1;
    $results = converCurrency($from_currency,$to_currency,$amount);
    $regularExpression     = '#\<span class=bld\>(.+?)\<\/span\>#s';
    preg_match($regularExpression, $results, $finalData);
    echo $finalData[0];

 function converCurrency($from,$to,$amount){
 $url = "$amount&from=$from&to=$to";
 $request = curl_init();
 $timeOut = 0;
 curl_setopt ($request, CURLOPT_URL, $url);
 curl_setopt ($request, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt ($request, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
 curl_setopt ($request, CURLOPT_CONNECTTIMEOUT, $timeOut);
 $response = curl_exec($request);
 return $response;


Saturday 24 October 2015

session example in php very easy to understand beginner must read


if(!isset($_SESSION['userID']) || (trim($_SESSION['userID']) == '')){

$session_id = $_SESSION['userID'];
$session_id = $_SESSION['username'];

$_SESSION :-   userID and username is a DATABASE NAME  as shown in dig

Session variables are used to store individual client’s information on web server for later use,  as web server does not know which client’s request to be respond because, HTTP address does not maintained state.

>>Cookies and Session diff
  1. Cookies are returned and stored in the user's browser, session data is stored on your web server.
  2. The life span of a cookie can be set to almost any duration of your choosing. PHP sessions have a predetermined short life. The exact life span depends on how your web host has configured PHP on your server.
  3. Depending on how your web server is configured, session data is often stored in a public temporary directory on the server. As such it is possible that other users on the server may be able to peek at the data you store there.

A session creates a file in a temporary directory on the server where registered session variables and their values are stored. This data will be available to all pages on the site during that visit.
The location of the temporary file is determined by a setting in the php.ini file called session.save_path. Bore using any session variable make sure you have setup this path.
When a session is started following things happen −
  • PHP first creates a unique identifier for that particular session which is a random string of 32 hexadecimal numbers such as 3c7foj34c3jj973hjkop2fc937e3443.
  • A cookie called PHPSESSID is automatically sent to the user's computer to store unique session identification string.
  • A file is automatically created on the server in the designated temporary directory and bears the name of the unique identifier prefixed by sess_ ie sess_3c7foj34c3jj973hjkop2fc937e3443.


 <table align="center" border="1" cellspacing="0" width="500">
                    <th>First Name</th>
                    <th>Last Name</th>
                    $sql = "SELECT * FROM info_tbl";
                    $result = $conn->query($sql);
                    if($result->num_rows > 0){
                    while($row = $result->fetch_array()){
                            <td align="center"><?php echo $row['firstName'];?></td>
                            <td align="center"><?php echo $row['lastName'];?></td>
                            <td align="center"><a href="edit.php?infoID=<?php echo md5($row['infoID']);?>">Edit
                            </a>/<a href="delete.php?infoID=<?php echo md5($row['infoID']);?>">Delete</a></td>
                            echo "<center><p> No Records</p></center>";


include 'conn.php';
include 'session.php';

$id = $_GET['infoID'];
$view = "SELECT * from info_tbl where md5(infoID) = '$id'";
$result = $conn->query($view);
$row = $result->fetch_assoc();


    $ID = $_GET['infoID'];

    $fn = $_POST['fname'];
    $ln = $_POST['lname'];

    $insert = "UPDATE info_tbl set firstName = '$fn', lastName = '$ln' where md5(infoID) = '$ID'";
    if($conn->query($insert)== TRUE){

            echo "Sucessfully update data";

        echo "Ooppss cannot add data" . $conn->error;


Thursday 4 June 2015

how to use graph api in facebook developers for searching


Access Token

Access Token are two types : 1. Client Access Token(you can get by making FACEBOOK APP)
                                              2. Application Access Token

Facebook API Search Types

We support search for the following types of objects:

 GET Application Access Token  to avoid this type of error

   "error": {
      "message": "Invalid OAuth access token.",
      "type": "OAuthException",
      "code": 190


"error": { "message": "(#200) Must have a valid access_token to access this endpoint", "type": "OAuthException", "code": 200 }


   "error": {
      "message": "(#803) Some of the aliases you requested do not exist: me&access_token=mytokenhere",
      "type": "OAuthException",
      "code": 803


type this in browser url: or userid

1.fb api

Saturday 21 February 2015

all about web services for beginners

STATEFUL SERVICES :-Want to store data or Data send from  one form to another.

STATELESS SERVICES :-No storing of data or No data send from  one form to another.

Stateless means that HTTP doesn't have built in support for states. i.e. you can't store.
A stateless service is one that provides a response after your request, and then requires no further attention. To make a stateless service highly available, you need to provide redundant instances and load balance them. OpenStack services that are stateless include nova-api, nova-conductor, glance-api, keystone-api, neutron-api and nova-scheduler.
A stateful service is one where subsequent requests to the service depend on the results of the first request. Stateful services are more difficult to manage because a single action typically involves more than one request, so simply providing additional instances and load balancing will not solve the problem. For example, if the Horizon user interface reset itself every time you went to a new page, it wouldn't be very useful. OpenStack services that are stateful include the OpenStack database and message queue.

The basic web services platform is XML + HTTP. All the standard web services work using the following components.


1. SOAP :- WSDL and XML


A web service consists of several methods that are advertised for use by the general public. To make it possible for every application to access a web service, these services use web service protocols, including REST, SOAP, JSON-RPC, JSON-WSP, XML-RPC, and so on. A web service can exchange data in any format, but two formats are the most popular for data exchange between applications:
  • XML. Standard format for data exchange among applications, in order to avoid datatype-mismatch problems.
  • JavaScript Object Notation (JSON). Text-based open standard for representing data. Uses characters such as brackets ([]), braces ({}), colons (:), and commas (,) to represent data.

Monday 16 February 2015

genuine seo to get quick top ranking in search engine

use this site for quick seo 



Well you might have heard of it before when trying to search a ppt presentation or a pdf document. Slideshare is place with enormous amount of slides. Whenever you search for any slides on Google you will get whole page loaded with results from Slideshare only.


People use Flicker to share photos and there are list of stunning photos which twitches our eyes. But we can use Flicker ad a medium of traffic by using comments below each photos. Choose a photo which suites or matches your niche and then write a comment having link back to your blog. But make sure you comment on the photo which relates to your niche only. 

7.Google images:


1) Content is king: Whenever you will create a single link then be sure that you have good, well-written and unique content which is focus on your primary keyword or keyword phrase.

2) If content is king, then links are queen: Be sure the link whatever you are creating should be good quality with high PR Links. So that you can get a better link juice from that site.
3) Be sure that your every page should have focused unique Title Tag: Whenever you will insert the title tag on every page of the website then keep in mind that your website have unique title on every page and also if you want to promote your company then you can add your company name at the end of the page.
4) Use a Blog Page: In a blog page you can always update some fresh content related to your business because fresh content can help to improve your website ranking. The Crawler always look your website and your rank will increase very soon.
5) Always use keyword to link your site : In other words if you are targeting the Keywords "Moving Toronto" then always use link to "Moving Toronto" instead of "click here" link.
6) Focus on Phrase not on the Keywords: Whenever you will use the keywords anywhere then convert that keywords with a phrase mixed with keywords and your location which helps in your local searches too.
7) Website should be SEO Friendly: Please Please Please don't design your Website without Consult with SEO Guys. Make sure that your Web designer should have knowledge of Organic SEO and never use flash on your site.
8) Use your keywords on everywhere: If you want to rank your site properly then you should be keywords and keywords phrase in text link, image alt tag attribute and even though in your domain too.
9) Check canonical issue: Check which url you want on your website whether it is with www or without www and then redirect the same with 301 redirect. In other words if you will not solve this issue then crawler will check both the link and thought that you have different - different website with same content. Which is really harm for your website.
10) Create Quality Link not Quantity: Whenever you will create link to your website always think quality not for quantity. When you create a high PR relevant link with your site then your site will suck allots of link juice with high PR Website which is really benefited for you.
11) Website should have Unique and quality Content: Every Search Engine Crawler like unique and quality content. So your website should have unique and high quality content. you can check your content uniqueness with double quote. Like put your content between double quote and search it if your content is copied then search engine will give you a bold sign.
12) Never used a paid link: you should never used any single paid link on your site because whenever you will create a paid link with your website then you will lose your website authority as well as money too.
13) Link from .edu or .gov domain: Always try to create some link with .edu or .gov domain because these domains give you nice weight by any search engine.

14) Targeted the Page with Keywords: Try to Optimized a single keywords phrase on single page. Don't try to optimize multiple keywords on single page which is not benefit for you.

15) Always Used Social Marketing: Social Media Marketing Is a part of SEO. So be sure to make link with the site like Digg, Yelp,, Face book, etc. Which is useful for website promotion as well as create better link juice?