Friday, October 27, 2017

What are git commands are essential for developer?[SOLVED]

Hey Guys,

I am Bikash Ranjan Nayak , if some one confusion in GIT command as a developer . I am  trying to explore you what are these command in git for regular wise required.


Before you use the git command in terminal just to confirm the configure for your user name and email address from IT team who have done it.
Note : it is one time required when you start first terminal for git.

1.Once you confirmed your user name and email which was create for git access user by IT team.

Command terminal will ask you the credentials like below
git config --global user.bikash "Bikash ranajn nayak"
git config --global user.nayakr.bikash@gmail.com
2.Clone live application from repository in your local
git clone git+ssh://bikash@127.0.0.1/home/repository/applicationName

3.Created branches by IT team Like : Dev ,Stage,master(As live App) server.
  As a developer can checkout add,commit,push within the Dev barnch
 Lets start how developer can doing while developing.

Need to follow below step to push you updated code into dev branch.

Step 1 : Run command in terminal before you start work on you application
git checkout <Dev>
Step 2: Take update from dev branch using below command
git pull origin <Dev>
Step 3: Create your task related branch within dev branch
        git checkout -b <features/bikash_RequestNo_date>

Step 4: before you start work, please ensure in which branch you are in . run the below command to know which branch you are in , current branch will highlited as green.
git branch -a

Step 5: If you are in your branch then start your work now , after completed your updates in page or created add new file.

if you added new file then first run below command.
        git add .
Step 6: Now commit your branch in local
         git commit -am <"message write what you have done for understing">

Step 7: Now we need to upload our updated code into Dev server.
git checkout <Dev>
Step 8: please take update from dev , other resource which they have done
        git pull origin <dev>

Step 9 : Then mere your branch into dev which you have earlier you worked on
git merge --no-commit <features/bikash_RequestNo_date>
Step 10 :Now commit your update  on dev server
git commit -am <"message write what you have done for under sting">
Finally upload into dev server using below command
git push origin <dev>
Now come back to you branch or create new branch for new task


Hope you are achieved those git commands as developer end








 

How to Google re-captcha client and server validation [SOLVED]

Hey Guys ,

I have integrated the validation of google re captcha in form with server side and client validation . you can learn from here , how we can use in simple web form .

Please follow the below step to achieved google re-captcha  robot integration Api
Create a index.php form page
Step 1 : in you index.php form page include the js file
                         <script src='jquery-ui.js'></script>
                         <script src='https://www.google.com/recaptcha/api.js'></script>
Step 2 : for client side validation include below js
                       <script type="text/javascript" src="jquery.validate.min.js"></script>
Step 3: add below code to render the google robot captcha

<!-- Recaptcha -->
<form class="form-validate" name="frmAdd" id="frmAdd" method="post" enctype="multipart/form-data">
<div class="form-group frm-grp">
<div class="controls">
<div class="g-recaptcha" id="rcaptcha" data-sitekey="XXXXXXXXXXXXXXXXXX"></div>
<input type="hidden" class="hiddenRecaptcha" name="hiddenRecaptcha" id="hiddenRecaptcha">
<?php echo (isset($this->errorMsg['captcha_code_error'])) ? '<label for="hiddenRecaptcha" generated="true" class="error">' . $this->errorMsg['captcha_code_error'] . '</label>' : ''; ?>
</div>
</div>
</form>
<!-- Recaptcha -->

Step 4: validation in client side js inline or separate the below code

jQuery("#frmAdd").validate({
ignore:":disabled",
ignore: ".ignore",
errorElement: 'label',
   rules: {
hiddenRecaptcha:{
required: function() {
if(grecaptcha.getResponse() == ''){
return true;
}else{
return false;
}
  }
}

            },          
            messages: {            
             
hiddenRecaptcha:{
  required: "Please select captcha."
}              
                         
            },
            submitHandler: function (form){
form.submit();
            }
        });

Step 4: check server side as well if CSFR submit from like validation.php include the file in index.php

$captcha_code = JRequest::getVar('g-recaptcha-response');
$secret = 'XXXXXXXXXXXXXXXXXX'; //live
$responseUrl = "https://www.google.com/recaptcha/api/siteverify?secret=" . $secret . "&response=" . $captcha_code;
$verifyResponse = file_get_contents($responseUrl, false);
$responseData = json_decode($verifyResponse);
if (empty($responseData->success)) {
     $validatesmg['captcha_code_error'] = " Please select captcha.";
}

Hopefully you can done all those things to google re-captcha, Please let me know if any difficulty on this. 


Thursday, October 26, 2017

What is Promise in NodeJs and example

NodeJs
Promises are a compelling alternative to callbacks when dealing with asynchronous code. Unfortunately, promises can be confusing and perhaps you’ve written them off. However, significant work has been done to bring out the essential beauty of promises in a way that is interoperable and verifiable.

You can make the function  that provide both a promise and callback interface. For example, let’s . how to deal with the real call back function to avoid call hell with Promise object.

var goal=false;
var youGol=new Promise(
function(resolve,reject ){

if(goal){
var myGoal={status:"Bikash is carrier Oriented"};
resolve(myGoal);
}else{
var reson=new Error('Bikash Nothing set his carrier');
reject(reson);
}

}
);

var goalstatu=function(){
youGol.then(function (answers){
console.log(answers);
}).catch(function (error){
console.log(error.message);
});

}



goalstatu();