Tuesday, 8 November 2016

How to install ant tool in window OS

Before you install the Force.com Migration Tool you will need Java and Ant installed on your local machine. Then you can download the Force.com Migration Tool from a Salesforce organization. 1. Install Java and Ant, as described in Prerequisites for Using the Force.com Migration Tool.

Step 1 - Install java. For install java go to java download and download latest version of java.and install it. To verify the installation of java open cmd(command prompt) and run java -version command it will return the version of java if java successful install.

Step 2 - Install ant. Please download ant file here
apache-ant-1.9.7 Unzip file and paste in C drive
Ant Tool Unzip file and paste where you want to use ant

Set Path using Command
C:\>set ANT_HOME=C:\apache-ant-1.9.7

C:\>set JAVA_HOME=java path(Example - C:\Program Files\Java\jdk1.7.0_79)

C:\>set PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin

C:\>ant -version

Apache Ant(TM) version 1.9.7 compiled on April 9 2016
Enjoy with ant.

Sunday, 11 September 2016

Get difference between given date time and current date time

We have one date picker and one time picker. We want to compare these date and time with current date time. This is a big question for everyone how to compare two date and get difference.
We need some js and CSS file to include. All are available here :- CSS, font and JS file

Include following CSS in head
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-datetimepicker.min.css">

Include following JS in head
<script src='js/jquery.min.js'></script>
<script src="js/moment.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-datetimepicker.js"></script>

HTML for create date picker and time picker (Design is not good but i thing it's under-stable for all)
<div class="row">
<div class="col-sm-1" style="text-align:right;"><label class="form_label">Date</label></div>
<div class="col-sm-2">
<input type='text'  id="selectDate" class="form-control" readonly="readonly" placeholder="DD/MM/YYYY" />
</div>
<div class="col-sm-1" style="text-align:right;"><label class="form_label">Time</label></div>
<div class="col-sm-2">
<input type='text'  id="selectTime" class="form-control" readonly="readonly" placeholder="HH:MM AM/PM" />
</div>
<div class="col-sm-1">
<input type="button" id="compare" value="compare" />
</div>
<div class="col-sm-5">
<span id="printDiff"></span>
</div>
</div>

JS Code for show date picker and time picker
$(document).ready(function(){
$(function() {
$('#selectDate').datetimepicker({
format: 'DD/MM/YYYY',
ignoreReadonly: true
}).on('dp.show dp.update', function () {
$(".datepicker-years .picker-switch").removeAttr('title')
.on('click', function (e) {
e.stopPropagation();
});
});
$('#selectTime').datetimepicker({
format: 'LT',
ignoreReadonly: true
}).on('dp.show dp.update', function () {
$(".datepicker-years .picker-switch").removeAttr('title')
.on('click', function (e) {
e.stopPropagation();
});
});
});

JS Code for compare date and time
 $('#compare').on('click',function(){
var dateForCompare = $('#selectDate').val();
var timeForCompare = $('#selectTime').val();
var selectHour = 0;
var selectMinutes = 0;
var finalDateTimeForCompare = '';
if(timeForCompare != ''){
var startDateCheck = timeForCompare.split(':');
if(startDateCheck.length != 2){
$('#printDiff').text('Invalid start time format');
return false;
}else if(startDateCheck.length == 2){
var m  = startDateCheck[1], h = startDateCheck[0];
var m1 = m.substring(0,2);
var dateType = m.replace(m1,'');
if(dateType == 'PM'){
h = h + 12;
}
if(h > 24 || m1 > 59 ){
$('#printDiff').text('Invalid start time format');
return false;
}else{
selectHour = h;
selectMinutes = m1;
}
}
}
if(dateForCompare != ''){
var startDateCheck = dateForCompare.split('/');
if(startDateCheck.length != 3){
$('#printDiff').text('Invalid start date format');
return false;
}else if(startDateCheck.length == 3){
var y = startDateCheck[2], m  = startDateCheck[1], d = startDateCheck[0];
var daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31];
if ( (!(y % 4) && y % 100) || !(y % 400)) {
daysInMonth[1] = 29;
}
if(y < 1000 || y > 9999 || m > 12 || m < 1|| d > daysInMonth[--m] || d < 1){
$('#printDiff').text('Invalid start date format');
return false;
}else{
var currentTime = moment(new Date()).format("YYYY-MM-DD HH:mm:ss");
finalDateTimeForCompare = moment(new Date(y,m,d,selectHour,selectMinutes,0)).format("YYYY-MM-DD HH:mm:ss");
finalDateTimeForCompare = moment(finalDateTimeForCompare);
var difference = (finalDateTimeForCompare.diff(currentTime))/60000;
$('#printDiff').text('Difference is '+difference+'Min');
}
}
}
});
});
Demo snapshot
Select future date and time
Select past date and time

If this post helpful for you please share and give your suggestion.

Tuesday, 30 August 2016

Robin hood army completed two year

Yesssssssss we have food
Jaipur team
Uncle aap khana acha late ho : Child
Ha tum sab ke liye laye h. Ab tum bhukhe(Hungry) nhi sovoge : Naren (Robin)
I am a part of RHA, Feel proud.
Thank you from #TeamRHAJaipur to the Angels whose contributions for the distribution drive of 21st Aug 2016 helped more than 300 people fill their stomach. #RobinHoodArmy #WarOnHunger
Love the way you interact with kids. We'll miss you : Jaipur RHA team
Hey, khana mil gya kya ? : Priyanka
I miss you guys : Vincent

We would like to express gratitude to all our restaurant partners and contributors to make #Mission500k a big success.

We made 11k+ souls in Jaipur smile on this Independence Day by not letting them sleep hungry. A vote of thanks to all our restaurant partners contributing to this Noble cause.

We look forward towards this relationship and make this world a better place #Mission500k #RHAJaipur #Jaipurites

Its give me an immense pleasure to be a part of this amazing team and work towards a common Enemy i.e. HUNGER.

Happiness is build upon small efforts.

We completed two years yesterday, and just realised the RHA has served a MLLION people till date!
It's amazing how fast time flies when you are having fun building something. Happy birthday to every person in the RHA family, thank you for making it so awesome.

Robin Hood Army Jaipur Team

Read about robin hood army - click here
Want to join us spread smiles, www.robinhoodarmy.com

Tuesday, 5 July 2016

Java program to display date and time, print date and time using java program

import java.util.*;

class GetCurrentDateAndTime
{
   public static void main(String args[])
   {
      int day, month, year;
      int second, minute, hour;
      GregorianCalendar date = new GregorianCalendar();

      day = date.get(Calendar.DAY_OF_MONTH);
      month = date.get(Calendar.MONTH);
      year = date.get(Calendar.YEAR);

      second = date.get(Calendar.SECOND);
      minute = date.get(Calendar.MINUTE);
      hour = date.get(Calendar.HOUR);

      System.out.println("Current date is  "+day+"/"+(month+1)+"/"+year);
      System.out.println("Current time is  "+hour+" : "+minute+" : "+second);
   }
}

Friday, 10 June 2016

Jquery date picker

jQuery is very powerful library in javascript. javascript giving lots of functionality. Here is a date functionality with validation. Here is example of jQuery date picker. Two date picker one is have id from and second is have id to.

In this example we set min date of second calendar from first calendar, and max date of first calendar from second calendar. When you select date from first calendar min date automatically set of second calendar as well as when you select date from second calendar max date automatically set in first calendar.

CSS and js file for include

<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

Html code :-
From <input type="text" id="first" placeholder="Start Date"/>
to <input type="text" id="second" placeholder="End Date"/>

Javascript code :-
 $( "#first" ).datepicker({
  changeMonth: true, 
  changeYear:true,
  maxDate:0,
  dateFormat: 'yy-mm-dd',
  onSelect: function( selectedDate ) {
   $( "#second" ).datepicker( "option", "minDate", selectedDate );
  }
 });
 $( "#second" ).datepicker({
  changeMonth: true,
  changeYear:true,
  maxDate:0,
  dateFormat: 'yy-mm-dd',
  onSelect: function( selectedDate ) {
   $( "#first" ).datepicker( "option", "maxDate", selectedDate );
  }
 });

How to use bootstrap -3 Date time picker


Include following file in following sequence :-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.2/css/font-awesome.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>

HTML code of date time picker :-
<div class="container">
<div class='col-md-5'>
<div class="form-group">
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class='col-md-5'>
<div class="form-group">
<div class='input-group date' id='datetimepicker2'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>

Validation code for date time picker :-
<script type="text/javascript" >
$(document).ready(function(){
var startDate = new Date();
var endDate = startDate.setMinutes(startDate.getMinutes() + 30);
$(function () {
$('#datetimepicker1').datetimepicker({
icons: {
time: "fa fa-clock-o",
date: "fa fa-calendar",
up: "fa fa-arrow-up",
down: "fa fa-arrow-down"
},
defaultDate : startDate,
ignoreReadonly: true
});

$('#datetimepicker2').datetimepicker({
icons: {
time: "fa fa-clock-o",
date: "fa fa-calendar",
up: "fa fa-arrow-up",
down: "fa fa-arrow-down"
},
defaultDate : endDate,
ignoreReadonly: true
});

$('#datetimepicker1').data("DateTimePicker").minDate(startDate);
$('#datetimepicker2').data("DateTimePicker").minDate(endDate);

$("#datetimepicker1").on("dp.change", function (e) {
var mindate = new Date(e.date);
mindate.setMinutes(mindate.getMinutes() + 30);
$('#datetimepicker2').data("DateTimePicker").minDate(mindate); });
$("#datetimepicker2").on("dp.change", function (e) {
var maxdate = new Date(e.date);
maxdate.setMinutes(maxdate.getMinutes() - 30);
$('#datetimepicker1').data("DateTimePicker").maxDate(maxdate); });

});
});
</script>
Snapshot of date time picker :-
It's example of how to apply default, minimum and maximum date-time. Here only one example you can see more example in bootstrap date-time picker doc.
Resource :-
https://eonasdan.github.io/bootstrap-datetimepicker/
https://github.com/Eonasdan/bootstrap-datetimepicker

Monday, 16 May 2016

Secret WhatsApp tricks you probably didn't know

Did you know WhatsApp has over 1 billion active users, but not all of them are curious enough to explore all the features that the app has offer. In fact, many users are just happy with sending and responding to messages on WhatsApp.

From disabling the blue ticks to reading messages without going online, there are plenty of not-so-obvious tricks that you can learn to make your favourite app more useful than ever.

Be sure to know, that these tricks will most definitely turn you into a messaging pro.
  1. Change Fonts

  2. You wouldn’t believe this but WhatsApp comes along with a few editing options. You can actually make text bold, add italics, or strike through. All you have to do is:
    1. For bold, you just have to place an asterisk (*) at the starting and ending of a word to make it appear bold.
    2. For italics, the process is similar but you have to place an underscore (_) in place of asterisk.
    3. For strikethrough, users need to add (~) at the beginning and end of the word.
  3. Read a message without going online
  4. As sneaky as that sounds, you can actually get away with this! Yes, there’s a way for that and it’s very easy. So after the message has arrived, simply turn off mobile data or turn on airplane mode on your device and then, open WhatsApp and see the message.
    Once you’re done, come back to the homescreen and turn on your mobile data. Yup! The trick is in details!

  5. How to know when someone has read your message
  6. Here’s how you do this, just go to the conversation and keep the message pressed for few seconds. You can see an i symbol on the top. What you need to do is to click on that symbol. Once you do that, you will be able to see the time when your message was delivered and read.
    In Group chat
  7. Turn off blue ticks

  8. Ever since the concept of blue trick came in play they have been nothing but the cause for some serious fights. If you are wondering how to turn off the blue tricks, its really easy.
    What you can do is to go to Settings->Account->Privacy. In the Privacy page, you will find a toggle to turn off “Read Receipts“.
  9. Send all your conversation to your email

  10. Most of us wanted to view media and chats on their computer, but what we don’t know is that this is actually possible. All you need to do is to just go to WhatsApp and click on conversation that you want on mail click on three vertical dot button > more > Email Chat. A pop up menu will appear then you need to click on email conversation.
  11. Hide your profile picture, Status and Last seen from others

  12. Most of people don’t know and don’t care for this useful settings. But in case you want to know, you can actually hide profile picture from public view.
    What you need to do is to first click on 3 vertical dots on home screen of WhatsApp. Then you need to Go to settings > Account > Privacy > Profile photo, Status and Last seen or Choose your privacy.

Friday, 6 May 2016

HashSet in java util package

	import java.util.*;
	class HashSetDemo
	{
		public static void main(String args[])
		{
			// Create a hash set.
			HashSet hs = new HashSet();
			// Add elements to the hash set.
			hs.add("B");
			hs.add("A");
			hs.add("D");
			hs.add("E");
			hs.add("C");
			hs.add("F");
			System.out.println(hs);
		}
	}

Wednesday, 4 May 2016

HashMap in java util package

	import java.util.*; 
	class HashMapDemo
	{
		public static void main(String args[])
		{
			// Create a hash map.
			HashMap hm = new HashMap(); 
			// Put elements to the map 
			hm.put("Devesh",new Double(1000.00)); 
			hm.put("Rahul",1500.00); 
			hm.put("Rakesh",1200.00); 
			hm.put("Manohar",900.00); 
			hm.put("Prateek",1300.00); 
			// Get a set of the entries.
			Set set = hm.entrySet(); 
			// Display the set.
			Iterator i = set.iterator();
			while(i.hasNext())
			{
				Map.Entry me = (Map.Entry) i.next();
				System.out.print(me.getKey() + ": "); 
				System.out.println(me.getValue()); 
			} 
			System.out.println(); 
			// Deposit 1000 into Prateek's account.
			double balance = (Double) hm.get("Prateek");
			hm.put("Prateek", balance + 1000); 
			balance = (Double)hm.get("Prateek");
			System.out.println("Prateek's new balance: " + balance); 
		} 
	}

Thursday, 21 April 2016

Google recaptcha using javascript

Register your web site at Google recaptcha platform to get keys needed to code the form. Click here to go to Google reCAPTCHA website.
After signing in, add your website details.

Recaptcha
After registration Google will provide you following :
  • Site key
  • Secret key
Creating Google reCAPTCHA form in HTML
Here is our HTML code to generate simple form with Google reCAPTCHA.

<form action="" method="POST" id="loginform" onsubmit=" return verifyCaptcha()">

<input id="email" maxlength="80" name="email" size="20" type="text" placeholder="Enter Your Email" style="margin-bottom: 30px;"/><br>
<div id="captchadiv">
<div class="g-recaptcha" data-sitekey="<!-- your site key here -->"></div>
<noscript>
<div>
<div style="width: 302px; height: 422px; position: relative;">
<div style="width: 302px; height: 422px; position: absolute;">
<iframe src="https://www.google.com/recaptcha/api/fallback?k=<!-- your site key here -->"
frameborder="0" scrolling="no"
style="width: 302px; height:422px; border-style: none;">
</iframe>
</div>
</div>
<div style="width: 300px; height: 60px; border-style: none;
bottom: 12px; left: 25px; margin: 0px; padding: 0px; right: 25px;
background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px;">
<textarea id="g-recaptcha-response" name="g-recaptcha-response"
class="g-recaptcha-response"
style="width: 250px; height: 40px; border: 1px solid #c1c1c1;
margin: 10px 25px; padding: 0px; resize: none;" >
</textarea>
</div>
</div>
</noscript>
</div>

<button type="submit" value="Submit" />Sign in</button>
</form>

Client Side code


function verifyCaptcha(){
var captcha_response = grecaptcha.getResponse();

if(captcha_response.length == 0 || grecaptcha == undefined )
{
return false;
}else{
$.get('/captchaTest',{'response':captcha_response},function(response){
console.log(response);
if(response == undefined && response.responseCode == undefined && response.responseDesc == undefined && response.responseCode !== 0 && response.responseDesc !== 'Sucess' ){
return false;
}
grecaptcha.reset();
});

return true;
}
}

Server Side code


app.get('/captchaTest',function(req,res){
var requestQuery = req.query;
if( requestQuery != undefined && requestQuery != '' && requestQuery != null && requestQuery.response != undefined && requestQuery.response != '' && requestQuery.response != null ){
var response = requestQuery.response;
var verificationUrl = "https://www.google.com/recaptcha/api/siteverify?secret="+ secret_key +"&response=" +response;
// Hitting GET request to the URL, Google will respond with success or error scenario.
request(verificationUrl,function(error,response,body) {
body = JSON.parse(body);
// Success will be true or false depending upon captcha validation.
if(body.success !== undefined && !body.success) {
res.send({"responseCode" : 1,"responseDesc" : "Failed captcha verification"});
}else{
res.send({"responseCode" : 0,"responseDesc" : "Sucess"});
}
});
}else{
res.send({"responseCode" : 1,"responseDesc" : "Failed captcha verification"});
}
});
 

Tuesday, 22 March 2016

ArrayList Demo 2

import java.util.*;
class ArrayListDemo
{  public static void main(String[] args)
   { ArrayList al=new ArrayList();
System.out.println("Initial size of al : "+ al.size());
al.add("C");
al.add("A");
al.add("E");
al.add("B");
al.add("D");
al.add("F");
al.add(1,"A2");
al.add(new Integer(5));
System.out.println("Size of al after additions:"+al.size());
System.out.println("Contents of al:"+al.toString());
al.remove("F");
al.remove(2);
System.out.println("Size of al after deletions:"+al.size());
System.out.println("Contents of al:"+al);
  }
}

Thursday, 17 March 2016

ArrayList Demo 1

import java.util.*;
class ArrayListDemo1
{  public static void main(String[] args)
   { ArrayList<String> al=new ArrayList<String>();
System.out.println("Initial size of al : "+ al.size());
al.add("C");
al.add("A");
al.add("E");
al.add("B");
al.add("D");
al.add("F");
al.add(1,"A2");
//al.add(new Integer(5)); //will not compile
System.out.println("Size of al after additions:"+al.size());
System.out.println("Contents of al:"+al);
al.remove("F");
al.remove(2);
System.out.println("Size of al after deletions:"+al.size());
System.out.println("Contents of al:"+al);
  }
}

Friday, 11 March 2016

ArrayList To Array conversation 2

import java.util.*;
class ArrayListToArray
{ public static void main(String[] args)
{ ArrayList al=new ArrayList();
al.add(new Integer(1));
al.add(new Integer(2));
al.add(new Integer(3));
al.add(new Integer(4));
System.out.println("Contents of al : "+al);
System.out.println("Contents of al using iterator:");
Iterator itr = al.iterator();
while(itr.hasNext())
{
int x = (Integer)itr.next();
System.out.print(x + " ");
}
}
}

Thursday, 3 March 2016

ArrayList To Array conversion 1

import java.util.*;
class ArrayListToArray
{ public static void main(String[] args)
{ ArrayList al=new ArrayList();
al.add(new Integer(1));
al.add(new Integer(2));
al.add(new Integer(3));
al.add(new Integer(4));
System.out.println("Contents of al : "+al);
System.out.println("Contents of al using iterator:");
Iterator itr = al.iterator();
while(itr.hasNext())
{
int x = (Integer)itr.next();
System.out.print(x + " ");
}
System.out.println();
Object ia[]= al.toArray();
int sum=0;
for(int i=0; i < ia.length; i++)
sum = sum + (Integer)ia[i];
System.out.println("Sum is "+sum);
}
}

Wednesday, 2 March 2016

Generic ArrayList

import java.util.*;
class GenericArrayList
{ public static void main(String[] args)
{ ArrayList<Integer> al=new ArrayList<Integer>();
al.add(1); //Auto Boxing
al.add(2); //Auto Boxing
al.add(3); //Auto Boxing
al.add(4); //Auto Boxing
System.out.println("Contents of al : "+al) ;
System.out.println("Iterating using for-each loop");
for(int i : al) //Auto Unboxing
{
System.out.print(i + " ");
}
}
}

Friday, 26 February 2016

Software as a Service (SaaS) definition

Software as a Service (SaaS) is a software distribution model in which applications are hosted by a vendor or service provider and made available to customers over a network, typically the Internet.

SaaS is becoming an increasingly prevalent delivery model as underlying technologies that support Web services and service-oriented architecture (SOA) mature and new developmental approaches, such as Ajax, become popular. Meanwhile, broadband service has become increasingly available to support user access from more areas around the world.

SaaS is closely related to the ASP (application service provider) and on demand computing software delivery models. IDC identifies two slightly different delivery models for SaaS. The hosted application management (hosted AM) model is similar to ASP: a provider hosts commercially available software for customers and delivers it over the Web. In the software on demand model, the provider gives customers network-based access to a single copy of an application created specifically for SaaS distribution.

Benefits of the SaaS model include:

  • easier administration
  • automatic updates and patch management
  • compatibility: All users will have the same version of software.
  • easier collaboration, for the same reason
  • global accessibility.



The traditional model of software distribution, in which software is purchased for and installed on personal computers, is sometimes referred to as software as a product.

Friday, 12 February 2016

Platform as a Service (PaaS) definition

Platform as a service (PaaS) is a cloud computing model that delivers applications over the Internet. In a PaaS model, a cloud provider delivers hardware and software tools -- usually those needed for application development -- to its users as a service. A PaaS provider hosts the hardware and software on its own infrastructure. As a result, PaaS frees users from having to install in-house hardware and software to develop or run a new application.

PaaS does not typically replace a business' entire infrastructure. Instead, a business relies on PaaS providers for key services, such as Java development or application hosting. For example, deploying a typical business tool locally might require an IT team to buy and install hardware, operating systems, middleware (such as databases, Web servers and so on) the actual application, define user access or security, and then add the application to existing systems management or application performance monitoring (APM) tools. IT teams must then maintain all of these resources over time. A PaaS provider, however, supports all the underlying computing and software; users only need to log in and start using the platform – usually through a Web browser interface.

Most PaaS platforms are geared toward software development, and they offer developers several advantages. For example, PaaS allows developers to frequently change or upgrade operating system features. It also helps development teams collaborate on projects.

Wednesday, 3 February 2016

Salesforce.com definition

Salesforce.com is a cloud computing and social enterprise software-as-a-service (SaaS) provider based in San Francisco. It was founded in March 1999, in part by former Oracle executive Marc Benioff.

Of its cloud platforms and applications, the company is best known for its Salesforce customer relationship management (CRM) product, which is composed of Sales Cloud, Service Cloud, Marketing Cloud, Force.com, Chatter and Work.com.  Sales Cloud manages contact information and integrates social media and real-time customer collaboration through Chatter. Service Cloud includes a call center-like case tracking feature and a social networking plug-in for conversation and analytics. Marketing Cloud offers Radian6, a social media monitoring and marketing application. Force.com, the company's platform-as-a-service (PaaS) product, allows software developers to create Salesforce.com add-on applications. Work.com offers Rypple, a social human resource (HR) performance management platform.

In addition to its products and platforms, Salesforce.com created AppExchange, a custom application building and sharing platform. The company also has consulting, deployment and training services.