Wednesday, 24 August 2016

what i need to be a developer best commands


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

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

============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">
            </div>
          </div>'
===============xxxx===================
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' .

=============

ALL ABOUT HTACCESS


how to clear varnish memcache

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

========
/etc/init.d/httpd
===

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 https://github.com/gica .



SubDOMAIN
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
127.0.0.1  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


CHANGE OWNER FILE PERMISSION
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.
Usage:
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.




default-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin sh.y@g.com
        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:
http://localhost:8983/solr/demo/query?
  q=title_t:black
  fl=author_s,title_t
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:
{"response":{"numFound":2,"start":0,"docs":[
    {
      "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!


http://yonik.com/solr-tutorial/


========================================

Url ENCODING WITH FUNCTION 

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

3>

<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]
</Directory>

4>
restart apache
=================================
BAD CODING

$i = 0;
  while ($row = db_fetch_array($query)) {
    $data[] = array($row[$i]);
    $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>
    </li>';

OTHER WAY


 $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>';
    }


=================================
E-MAIL OPTIONS

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

NEW SETTING
webform>>new webform
----------------------------------------------
HTML MAIL >> FULL HTML
admin/config/system/mailsystem

YOUR THEME
Select the theme that will be used to render

=======================
2.
admin/config/content/webform
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/webform.submissions.inc';
  $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>


admin/config/content/ckeditor/edit/Full
->
ADVANCED OPTIONS
->
Custom JavaScript configuration
->
Paste in:
config.allowedContent = true;
SAVE
=========================



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