Opensources Developer Guide

This blog is having some sort of guidelines about below technologies. Hoping this would be helpful to the people who want to gain knowledge on open sources web development.
Technologies: PHP, Drupal, Mysql, Ajax, JQuery, Wordpress, GIT, Selenium , PHP Unit, Linux, Nginx, HTML5, CSS3, Javascript, AngularJS, Backbone.Js, Node.JS etc.

For example, '/about-us' is a route. When Drupal receives a request, it tries to match the requested path to a route it knows about. If the route is found, then the route's definition is used to return content. Otherwise, Drupal returns a 404.

Create a Feature [git flow feature start "YOUR_FEATURE_NAME"] - Generally features will be used to accomplish a small tasks. If git flow feature start forces an error, please execute "git flow init" first

Thursday, 14 January 2016

Basic Configuration to test and solve this problem:Create a content type with One Image Field and Body Field (Those are needed to replicate it)

Successful Scenarios:Scenario 1:1. Add new content for the above content type with images upload by Image Tool only (Image Field)3. Select image from those uploaded images using Open Graph Configuration and saved the node.4. If we are sharing that article, whatever the image that we have shared, that will get shared in Facebook

Scenario 2:1. Add new content for the above content type with images upload by body field only (Through Text Editor Media / IMCE)3. Select image from those uploaded images using Open Graph Configuration and saved the node.4. If we are sharing that article, whatever the image that we have shared, that will get shared in Facebook

Unsuccessful Scenario:1. Add new content for the above content type with images upload by both image tool and body field (Editor).2. Select an image from those uploaded images using Open Graph Configuration and saved the node.3. If we are sharing that article, whatever the image that we are trying to share, will not get shared into Facebook.

The original problem behind this is opengraph_meta module will generate images array with URL, alt and title sort of text using a function called "harvest_images_from_node". this function definition is available in opengraph_meta.common.inc file. after forming the array of images, if we remove duplicate images and order them as needed by system, this image sharing issue will get resolved. To do that follow below steps.

Using Default Open graph Meta tags module, if we select an image from the list and trying to send to facebook, it tag og:image with thumbnail version. Facebook won't allow lesser dimension images while sharing. So, whatever that we want to display in facebook won't be shared in this case. It might take Logo or any image from Web Page.

STEP2:1. In the same opengraph_meta.common.inc file there is a function to extract image fields. change them to form image from file_create_url instead of image_style_url2. Search for a function "extract_image_fields"3. Change below line to specified one. Existing line: $url = image_style_url('thumbnail', $fields[$_uri_field]); Update to: $url = file_create_url($fields[$_uri_field]);4. Save Changes

STEP3:1. In opengraph_meta.module, there is a function which will be used to display thumbnails in admin panel while creating or updating node. we have to update that to take original URL and also update the function to taken first image as default one if nothing got selected.2. Open opengraph_meta.module file3. Change below code to specified one Existing Code foreach ($images as $image) { $image_selector_options[$image['url']] = OpenGraphMetaDrupalLayer::theme_selector_image($image); }Update to: foreach ($images as $url => $image) { $image_selector_options[$url] = OpenGraphMetaDrupalLayer::theme_selector_image($image); } $old_value = !empty($node->opengraph_meta) ? $node->opengraph_meta[OpenGraphMeta::IMAGE] : ''; $default = $old_value && isset($image_selector_options[$old_value]) ? $old_value : key($image_selector_options);

Now we can check from both frontend and backend whether images are sending with full width and height or not. After updating these also if you could not able to see changes in sharing image to FB, we have to clear cache from Facebook using Developer link.

# This section must be placed at the very end of sshd_config
Match Group sftpaccessonly
ChrootDirectory /home/%u
ForceCommand internal-sftp
AllowTcpForwarding no

STEP2:
Create a Group with the name "sftpaccessonly"$ groupadd sftpaccessonly

STEP3:
Go to HOME directory$ cd /home

Create a User in home directory

$ adduser <your_user_name>

It prompts you a screen to enter password of the user along with other details like their Full Name, Room Number etc.
Enter all details and Confirm that those details are correct.
Now user got created.

Thursday, 28 May 2015

Mostly Used Commands:

vi filename.extension - Open a file in editing mode.
:42 (or) vi +42 filename.extension - Move to a particular in a file
Ctrl-Shift-g - To check the line number where we are in.
/searchstring - Search for a string in a file [Next Occurance of String - Press 'n' , Previous Occurance of string - Press 'Shift-n']

Quitting

:x Exit, saving changes
:q Exit as long as there have been no changes
ZZ Exit and save changes if any have been made
:q! Exit and ignore any changes

Inserting Text

i Insert before cursor
I Insert before line
a Append after cursor
A Append after line
o Open a new line after current line
O Open a new line before current line
r Replace one character
R Replace many characters

Motion

h Move left
j Move down
k Move up
l Move right
w Move to next word
W Move to next blank delimited word
b Move to the beginning of the word
B Move to the beginning of blank delimted word
e Move to the end of the word
E Move to the end of Blank delimited word
( Move a sentence back
) Move a sentence forward
{ Move a paragraph back
} Move a paragraph forward
0 Move to the begining of the line
$ Move to the end of the line
1G Move to the first line of the file
G Move to the last line of the file
nG Move to nth line of the file
:n Move to nth line of the file
fc Move forward to c
Fc Move back to c
H Move to top of screen
M Move to middle of screen
L Move to botton of screen
% Move to associated ( ), { }, [ ]

Deleting Text

Almost all deletion commands are performed by typing d followed by a motion. For example, dw deletes a word. A few other deletes are:
x Delete character to the right of cursor
X Delete character to the left of cursor
D Delete to the end of the line
dd Delete current line
:d Delete current line

Search for strings

/string Search forward for string
?string Search back for string
n Search for next instance of string
N Search for previous instance of string

Replace

The search and replace function is accomplished with the :s command. It is commonly used in combination with ranges or the :g command (below).
:s/pattern/string/flags Replace pattern with string according to flags.
g Flag - Replace all occurences of pattern
c Flag - Confirm replaces.
& Repeat last :s command

Regular Expressions

. (dot) Any single character except newline
* zero or more occurances of any character
[...] Any single character specified in the set
[^...] Any single character not specified in the set
^ Anchor - beginning of the line
$ Anchor - end of line
\< Anchor - begining of word
\> Anchor - end of word
\(...\) Grouping - usually used to group conditions
\n Contents of nth grouping

[...] - Set Examples [A-Z] The SET from Capital A to Capital Z

[a-z] The SET from lowercase a to lowercase z
[0-9] The SET from 0 to 9 (All numerals)
[./=+] The SET containing . (dot), / (slash), =, and +
[-A-F] The SET from Capital A to Capital F and the dash (dashes must be specified first)
[0-9 A-Z] The SET containing all capital letters and digits and a space
[A-Z][a-zA-Z] In the first position, the SET from Capital A to Capital Z
In the second character position, the SET containing all letters

Regular Expression Examples /Hello/ Matches if the line contains the value Hello

/^TEST$/ Matches if the line contains TEST by itself
/^[a-zA-Z]/ Matches if the line starts with any letter
/^[a-z].*/ Matches if the first character of the line is a-z and there is at least one more of any character following it
/2134$/ Matches if line ends with 2134
/\(21|35\)/ Matches is the line contains 21 or 35
Note the use of ( ) with the pipe symbol to specify the 'or' condition
/[0-9]*/ Matches if there are zero or more numbers in the line
/^[^#]/ Matches if the first character is not a # in the line
Notes:
1. Regular expressions are case sensitive
2. Regular expressions are to be used where pattern is specified

Counts

Nearly every command may be preceded by a number that specifies how many times it is to be performed. For example, 5dw will delete 5 words and 3fe will move the cursor forward to the 3rd occurence of the letter e. Even insertions may be repeated conveniently with thismethod, say to insert the same line 100 times.

Ranges

Ranges may precede most "colon" commands and cause them to be executed on a line or lines. For example :3,7d would delete lines 3-7. Ranges are commonly combined with the :s command to perform a replacement on several lines, as with :.,$s/pattern/string/g to make a replacement from the current line to the end of the file.
:n,m Range - Lines n-m
:. Range - Current line
:$ Range - Last line
:'c Range - Marker c
:% Range - All lines in file
:g/pattern/ Range - All lines that contain pattern

Files

:w file Write to file
:r file Read file in after line
:n Go to next file
:p Go to previos file
:e file Edit file
!!program Replace line with output from program

Select Edit option related to the Profile Which you are using in your application. In my case i am using Full Profile. So, clicking on Edit option related to Full Profile (admin/config/content/ckeditor/edit/Full)

Select Edit option
related to the Profile Which you are using in your application. In my
case i am using Full Profile. So, clicking on Edit option related to Full Profile (admin/config/content/ckeditor/edit/Full)

Expand CSS fieldset by clicking on CSS toggle set.

There you could able to see different options. We have to configure them.

Change Predefined styles toDefine path to ckeditor.styles.js

Set Predefined styles path to %tckeditor.styles.js?v1 (%t– path to current user theme. By Default Drupal 7 uses bartik theme. If you did not enable any other theme, your theme would be bartik only.)

Saturday, 1 March 2014

Compilation: When a browser asks for a JSP, the JSP engine
first checks to see whether it needs to compile the page. If the page
has never been compiled, or if the JSP has been modified since it was
last compiled, the JSP engine compiles the page.
The compilation process involves three steps:

Parsing the JSP.

Turning the JSP into a servlet.

Compiling the servlet.

Initialization: When a container loads a JSP it invokes the jspInit() method before servicing any requests

Execution: Whenever a browser requests a JSP and the page
has been loaded and initialized, the JSP engine invokes the
_jspService() method in the JSP.The _jspService() method of a JSP is
invoked once per a request and is responsible for generating the
response for that request and this method is also responsible for
generating responses to all seven of the HTTP methods ie. GET, POST,
DELETE etc.

Cleanup: The destruction phase of the JSP life cycle
represents when a JSP is being removed from use by a container.The
jspDestroy() method is the JSP equivalent of the destroy method for
servlets.