tag:blogger.com,1999:blog-39622448062967786072024-03-13T21:14:52.696+05:30It's full of codevisheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-3962244806296778607.post-18485455993286247862014-03-29T19:55:00.001+05:302014-03-30T01:00:42.788+05:30Show private documents to your users from google drive without sharing them<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
In this post I will write how we can use google api to show content on our page from google drive, without actually changing the sharing settings for the document. We will use owner's oAuth access to proxy the content through our server.<br />
<br />
<b>Implementation:</b><br />
I am using google drive sdk for java in this code snippet: <a href="https://developers.google.com/drive/v2/reference/">https://developers.google.com/drive/v2/reference/</a><br />
Given the fileId of a file uploaded on google drive we can query google to get the following info about file:<br />
<br />
<u>Alternate link:</u> This is the link to file where the document can be accessed on google drive itself.<br />
<u>Download url :</u> Link to download the original file. This is available only for the contetn uploaded on google drive. It is not available for the content created on google drive like google doc, google spreadsheet, google drive etc.<br />
<u>Export Links:</u> links to export the documents in different formats. These links are only available for the content created on google drive like google doc, google spreadsheet, google drive etc. and are not available for content uploaded on google drive.<br />
<br />
All of these links require google authentication and our end user doesn't have access to these documents. We are considering that our web application has been authorized(using oAuth) to access these documents by the document owner. Given these links we can make authenticated get request to these links on owner's behalf(by using access token) and serve this content to our end user by writing it to output stream. To make the authenticated get call we will use following code:
Note that we are not reading all content in controller method in one go and then serving it, but we are actually buffering it in 8k chunks.<br />
<br />
<br /></div>
<pre class="brush:java">URL url = new URL(contentUrl)
URLConnection connection = url.openConnection();
connection.setRequestProperty("Authorization", 'Bearer ' + accessToken);
// this will actually buffer/stream the file in 8k chunks instead of reading the entire file into memory.
org.apache.commons.io.IOUtils.copy(connection.getInputStream(), response.outputStream)
</pre>
Controller method to proxy the data and serve it on our page:
<br />
<pre class="brush:java">private static HttpTransport httpTransport = new NetHttpTransport()
private static JacksonFactory jsonFactory = new JacksonFactory();
//This is a controller method in our web-app
def viewGDOC(){
String fileId = params.fileId
String accessToken // read this from database using session
String refreshToken // read this from database using session
GoogleCredential gCredentials = new GoogleCredential.Builder()
.setClientSecrets(CLIENT_ID, CLIENT_SECRET)
.setJsonFactory(jsonFactory).setTransport(httpTransport).build()
.setRefreshToken(refreshToken).setAccessToken(accessToken);
Drive driveService = new Drive.Builder(httpTransport, jsonFactory, credentials).build();
com.google.api.services.drive.model.File file = driveService.files().get(chapter.gDriveFileId).execute()
String contentUrl
def downloadUrl = file.getDownloadUrl()
def pdfUrl = file.getExportLinks()?.get("application/pdf")
if (downloadUrl) {
contentUrl = downloadUrl
} else {
contentUrl = pdfUrl
}
URL url = new URL(contentUrl)
URLConnection connection = url.openConnection();
connection.setRequestProperty("Authorization", 'Bearer ' + googleCredential.accessToken);
// this will actually buffer/stream the file in 8k chunks instead of reading the entire file into memory.
org.apache.commons.io.IOUtils.copy(connection.getInputStream(), response.outputStream)
}
</pre>
Once we get the content stream the next task is to show it to user. Since browsers can display only some mime types like image, video, pdf, we can't directly show many file other types like MS word documents. To better understand this upload a office format file like ppt to google drive and use the above code to proxy the content. You will see that the browser will not render proxied content properly but instead download a zip which contains raw structure of file.<br />
<div>
The solution is to use some kind of viewer that takes this type of content and converts it to html so that browser can display it. Think how google shows word file when you view it in google drive ? There are many web apps which take the url of file and gives back the html. e.g. : viewer.js, crocodoc, google viewer. We will use the google viewer here: <a href="https://docs.google.com/viewer">https://docs.google.com/viewer</a></div>
<div>
So if you are using iframe on your page to show the file content instead of pointing iframs's src to <a href="http://viewgdoc/">/viewGDoc</a> , point it to <a href="https://docs.google.com/viewer?url=%27serverName/viewGDoc%27&embedded=true">https://docs.google.com/viewer?url='serverName/viewGDoc'&embedded=true</a> . Please note that if you are using iframe the 'embedded=true' option is necessary in the url as without this the content that google viewer returns is non iframable(X Frame Options is sameorigin in that case).<br />
<br /></div>
</div>
visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com0tag:blogger.com,1999:blog-3962244806296778607.post-14520592198858879772012-10-20T21:14:00.002+05:302014-03-29T18:17:30.116+05:30Selenium Web Driver to test websites<div dir="ltr" style="text-align: left;" trbidi="on">
In this post I will write how to use selenium web driver to test the websites.Selenium web driver allows us to drive the browser from the code supporting many languages like java , python etc.While it takes a little setup for chrome and ie,it works with firefox without any setup.I am using java to drive firefox browser.<br />
<br />
The main goal of this post is to share code on how to design the test suite to make the code most reusable and also to make the testing reliable irrespective of user's connection speed.On to the design now :<br />
<br />
The basic approach to design a test suite should be to create methods which automate elementary tasks and then to use these methods from the testing class and assert the results.This way the code developed for automating elementary tasks can be used by any potential testing client.For example : for website testing, tasks like logging in,logout,using various features of site like create post in blogger etc. can be put in a common class.<br />
<br />
The test suite I developed is to test a salesforce app , so I will provide methods which helps doing login,selecting apps from the top right,selecting tabs,asserting page title etc.<br />
<br />
Also I have overridden the selenium web driver's default methods like findElement() and some others to wait them for given time for page to load before throwing element not found kind of exceptions resulting from incomplete page load.<br />
<br />
<script type="syntaxhighlighter" class="brush: js"><![CDATA[
package com.vishesh.salesforceTests;
/**
* @author vishesh
*
* This class contains methods which can be used
* to automate actions for force.com apps
*
*/
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchFrameException;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
public class TestHelper{
public WebDriver driver;
int timeOutCounter; // to have count on timeout
/**
* Timeout in sec. after which methods in this class should timeout while
* waiting for a WebElemnet to load. Defaults to 60 sec.
*/
public int TIMEOUT = 60;
/**
* supported drivers are : firefox driver
*
* @param driver
* - WebDriver
*
*/
public TestHelper(WebDriver driver) {
this.driver = driver;
this.driver.manage().window().maximize();
}
/**
* opens the given url in browser,blocks any action until page is fully
* loaded
*
* @param url
*
*/
public void openUrl(String url) {
driver.get(url);
}
/**
* perform the log in actions.
*
* @param userName
* @param password
*
*/
public void login(String userName, String password) {
WebElement userNameTxt = driver.findElement(By.name("username"));
WebElement passwordTxt = driver.findElement(By.name("pw"));
userNameTxt.sendKeys(userName);
passwordTxt.sendKeys(password);
WebElement loginBtn = driver.findElement(By.name("Login"));
loginBtn.click();
}
/**
* selects the given tab. Timeouts if the tab is not appeared before TIMEOUT
* class variable
*
* @param tab
* - text on tab
*/
@SuppressWarnings("static-access")
public void selectTab(String tab) {
WebElement mTab = findElement(By.cssSelector("#tabBar").linkText(tab));
mTab.click();
}
/**
* select the given application.
*
* Timeouts if the application list in top right is not appeared before
* TIMEOUT class variable
*
* @param app
* - application name
*/
public void selectApp(String app) {
WebElement currentApp = findElement(By.id("tsidLabel"));
if (currentApp.getText().equalsIgnoreCase(app))
return;
WebElement appBtn = findElement(By.id("tsid"));
appBtn.click();
@SuppressWarnings("static-access")
WebElement mApp = findElement(By.cssSelector("#tsid-menuItems")
.linkText(app));
mApp.click();
}
/**
* clicks the button with the given label.
*
* It waits for the given button to load and timeouts after the value of
* TIMEOUT class variable
*
* @param btn
* - label on button
* @throws InterruptedException
* @throws TimeoutException
*/
public void clickBtn(String btn) throws TimeoutException, InterruptedException {
getBtn(btn).click();
}
/**
* gets the button with the specified label.
*
* It waits for the given button to load and timeouts after the value of
* TIMEOUT class variable
*
* @param btn
* - label on button
* @return - WebElement : button with the given label
* @throws InterruptedException
* @throws TimeoutException
*
*/
public WebElement getBtn(String btn) throws TimeoutException, InterruptedException {
List<WebElement> buttons = driver.findElements(By.className("btn"));
for (WebElement button : buttons) {
if (button.getAttribute("value").trim()
.equalsIgnoreCase(btn.trim())) {
timeOutCounter = 0;
return button;
}
}
mWait("TimeOut after waiting " + TIMEOUT
+ " sec. for the button with text " + btn + " to appear");
return getBtn(btn);
}
/**
* gets any Input with the given label. e.g. text boxes, dropdowns.
*
* It waits for the given element to load and timeouts after the value of
* TIMEOUT class variable
*
* @param label
* - label for input
* @return WebElement - input element for given label
* @throws InterruptedException
* @throws TimeoutException
*/
public WebElement getInputWithLabel(String label) throws TimeoutException, InterruptedException {
List<WebElement> labels = driver.findElements(By.tagName("label"));
for (WebElement mLabel : labels) {
if (mLabel.getText().trim().endsWith(label.trim())) {
timeOutCounter = 0;
String labelFor = mLabel.getAttribute("for");
return findElement(By.id(labelFor));
}
}
mWait("TimeOut after waiting " + TIMEOUT
+ " sec. for the input with label " + label + " to appear");
return getInputWithLabel(label);
}
/**
* finds a WebElement based on By selector.
*
* This method will wait for the element to load and will timeout after the
* value of TIMEOUT class variable.
*
* use this method instead of driver.findElement(By) to wait for the element
* to load till TIMEOUT class variable
*
* @param by
* - selector
* @return - WEbElement
*/
public WebElement findElement(final By by) {
WebElement element = (new WebDriverWait(driver, TIMEOUT))
.until(new ExpectedCondition<WebElement>() {
@Override
public WebElement apply(WebDriver d) {
return d.findElement(by);
}
});
return element;
}
/**
* finds all elements based on By selector
* It willl wait for the @minimumElements to load which matches selection criteria
* will timeout after TIMEOUT if it does not find elemnets >= @minimumElements that matches selection criteria
*
* @param by - By Selector
* @param minimumElements - min number of matching elements,for which method should wait to load
* @return - list of web elemnts matching criteria
* @throws TimeoutException
* @throws InterruptedException
*/
public List<WebElement> findElements(By by,int minimumElements) throws TimeoutException, InterruptedException{
List<WebElement> elements = driver.findElements(by);
int size = elements.size();
if(size >= minimumElements){
timeOutCounter=0;
return elements;
}
mWait("Timeout after waiting "+TIMEOUT+" secs. for required elements to load");
return findElements(by, minimumElements);
}
/**
* switches to latest opened window.
*
* further methods will execute on the latest opened window.
*
* @return - Window handle for the current window.
*
* call driver.switchTo.window(@return) to switch to original window
*/
public String switchToNewlyOpenedWindow() {
// get the handle of latest window
String oldWinHandle = driver.getWindowHandle();
String latestWinHandle = null;
for (String winHandle : driver.getWindowHandles())
latestWinHandle = winHandle;
driver.switchTo().window(latestWinHandle);
return oldWinHandle;
}
/**
* switches to frame at given index.
*
* It waits for the given frame to load and timeouts after the value of
* TIMEOUT class variable.
*
* @param index
* - Zero based index of frame
* @throws InterruptedException
* @throws TimeoutException
*/
public void switchToFrame(int index) throws TimeoutException, InterruptedException {
try {
driver.switchTo().frame(index);
timeOutCounter = 0;
} catch (NoSuchFrameException e) {
mWait("TimeOut after waiting " + TIMEOUT
+ " sec. for the frame at index " + index + " to appear");
switchToFrame(index);
}
}
/**
* asserts page title
* waits till TIMEOUT for the title to load
*
* @param title
* @throws AssertionError
* @throws InterruptedException
*/
public void assertPageTitleContains(String title) throws AssertionError,InterruptedException{
if(!driver.getTitle().trim().toLowerCase().contains(title.trim().toLowerCase())){
//wait for page load
try{
mWait("timed out after "+TIMEOUT+" sec");
assertPageTitleContains(title);
}catch (TimeoutException e) {
throw new AssertionError("expected page title to contain : "
+ title + " , found : " + driver.getTitle());
}
}else
//reset timeoutCounter
timeOutCounter=0;
}
/**
* asserts page title not to contain a string
* waits till TIMEOUT for title to load
*
* @param notInTitle
* @throws AssertionError
* @throws InterruptedException
*/
public void assertPageTitleDoesNotContain(String notInTitle) throws AssertionError,InterruptedException{
if(driver.getTitle().trim().toLowerCase().contains(notInTitle.trim().toLowerCase())){
//wait for page load
try{
mWait("timed out after "+TIMEOUT+" sec");
assertPageTitleDoesNotContain(notInTitle);
}catch (TimeoutException e) {
throw new AssertionError("expected page title to not contain : "
+ notInTitle + " , found : " + driver.getTitle());
}
}else
//reset timeoutCounter
timeOutCounter=0;
}
/**
* asserts if a button with given label is visible on the page
* waits till TIMEOUT for the btn to load
* @param btnLabel
* @throws AssertionError
* @throws InterruptedException
*/
public void assertBtnIsVisible(String btnLabel) throws AssertionError, InterruptedException{
try{
getBtn(btnLabel);
}catch (TimeoutException e) {
assertCondition(false,btnLabel+" button was not visible");
}
}
/**
* waits for 1 second.Timeouts if it has already waited
* TIMEOUT sec. in the calling function, and fails with @timeoutMessage
*
* @param timeoutMessage
* @throws TimeoutException
* @throws InterruptedException
*/
public void mWait(String timeoutMessage) throws TimeoutException,InterruptedException{
if (timeOutCounter > TIMEOUT) {
timeOutCounter = 0;
throw new TimeoutException(timeoutMessage);
}
Thread.sleep(1000);
timeOutCounter++;
}
/**
* returns the label of selected tab
*
* @return
*/
public String getSelectedTabLabel(){
//only selected tab contains span element in tab bar
WebElement span = findElement(By.cssSelector("#tabBar")).findElement(By.tagName("span"));
//get parent of span
WebElement parent = span.findElement(By.xpath(".."));
//get link for the tab
WebElement tabLink = parent.findElement(By.tagName("a"));
return tabLink.getText().trim();
}
/**
* checks if all empty mandatory fields gives error
* after form submit
* works for input tag only,ignores picklists as they always
* have a value
*
* @throws InterruptedException
* @throws TimeoutException
*
*/
public void assertMandatoryFieldsValidated(int minimumFieldsToValidate) throws TimeoutException, InterruptedException,AssertionError{
List<WebElement> rqdInputs = findElements(By.className("requiredInput"), minimumFieldsToValidate);
for(WebElement element : rqdInputs){
List<WebElement> inputField = element.findElements(By.tagName("input"));
//I used findElements and not findElement,as later could throw
//NoSuchElementException if there is no input tag but a picklist
if(inputField.size()==0)
continue;
else{
//there is at most one input field per '.requiredInput' div
if(inputField.get(0).getText().equalsIgnoreCase("")){
//there must be error message
try{
if(!element.findElement(By.className("errorMsg")).getText().equalsIgnoreCase("Error: You must enter a value"))
throw new Exception();
}catch (Exception e) {
//either the error msg was not there or
//it was not "Error: You must enter a value"
throw new AssertionError("Empty mandatory field did not show - 'Error: You must enter a value'");
}
}
}
}
}
/**
* quits the test and closes all browser windows
*/
public void cleanUp() {
driver.quit();
}
public void assertCondition(boolean condition,String failureMsg) throws AssertionError{
if(!condition)
throw new AssertionError(failureMsg);
}
}
]]></script>
Please set the variable TIMEOUT according to connection speed.The logic behind waiting till timeout is the recursive call of the methods each after 1 sec.The methods exit after TIMEOUT if the desired elements are not found.<br />
<br />
</div>visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com20tag:blogger.com,1999:blog-3962244806296778607.post-60382773778974402322012-09-03T22:30:00.000+05:302014-03-29T19:14:20.326+05:30salesforce lead conversion<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
<span style="font-size: 12.0pt; line-height: 115%;">This
application allows user to search leads based on a keyword and giving fields to
search in. User can then go to details page of returned leads, can select
multiple leads and then can convert selected leads by providing an account
name. The Outcome will be an account, a
contact for each lead and an opportunity for each lead. After successful
conversion user will be redirected to newly created account’s detail page.<o:p></o:p></span></div>
<div class="MsoNormal">
<i><span style="font-size: 12.0pt; line-height: 115%;"><br /></span></i></div>
<div class="MsoNormal">
<i><span style="font-size: 12.0pt; line-height: 115%;">Video Url</span></i><span style="font-size: 12.0pt; line-height: 115%;">:<o:p></o:p></span></div>
<div class="MsoNormal">
<a href="http://www.screencast.com/users/vishesh91/folders/Default/media/5e12fd28-ba37-4e95-8eea-e3c89f0c1ad5">http://www.screencast.com/users/vishesh91/folders/Default/media/5e12fd28-ba37-4e95-8eea-e3c89f0c1ad5</a><span style="font-size: 12.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
you can install the unmanaged package from :</div>
<div class="MsoNormal">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; line-height: 115%;"><a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Q3Ww">https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Q3Ww</a></span></span></div>
<div class="MsoNormal">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">App uses one visual force page and one controller :</span></div>
<div class="MsoNormal">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">VisualForce Page :</span><br />
<pre class="brush: html">
<apex:page Controller="ConversionController">
<script type="text/javascript">
//user can select which all fields to search like name,address,email
//All fields will be selected by default
function checkAllFields(){ //to select all fields on page load
var inputElem = document.getElementsByTagName("input"); //get all input elements
for(var i=0; i<inputElem.length; i++)
{
if(inputElem[i].id.indexOf("searchFields")!=-1) //check for inputBoxes to select search fields
inputElem[i].checked = true; //check all fields initially
}
}
function checkAllLeads(cb){ //to implement select all function for all leads returned by search
//cb is the select all check box,which will be passed to this function
var inputElem = document.getElementsByTagName("input"); //get all input elements
for(var i=0; i<inputElem.length; i++)
{
if(inputElem[i].id.indexOf("leadCheckBox")!=-1) //check for inputBoxes to select leads
inputElem[i].checked = cb.checked; //check or uncheck according to select all checkBox
}
}
function makeLinks(){ //to render labels of lead select boxes as links for corresponding leads
var inputElem = document.getElementsByTagName("label"); //get all labels
for(var i=0; i<inputElem.length; i++)
{
var myCheckBoxId=inputElem[i].getAttribute("for"); //get Id of associated element
if(myCheckBoxId!=null && myCheckBoxId.indexOf("leadCheckBox")!=-1) //only change labels for lead select boxes
{ var leadId=document.getElementById(myCheckBoxId).getAttribute("value"); //get the lead Id from corresponding checkBox
//change the inner html of label accordingly
//links will be like https://ap1.salesforce.com/leadId
//instance is auto corrected by Force.com if not ap1
inputElem[i].innerHTML ='<apex:outputLink value="https://ap1.salesforce.com/'+leadId+'" target="_blank">'+inputElem[i].innerHTML+'</apex:outputLink>';
}
}
}
</script>
<apex:form >
<apex:pageBlock mode="edit" >
<apex:pageMessages id="messages" />
<apex:pageBlockSection title="Search" columns="3">
<apex:outputLabel >Enter Keyword</apex:outputLabel>
<apex:inputText value="{!keyword}" />
<br />
<apex:outputLabel >Search Fields</apex:outputLabel>
<apex:selectCheckboxes value="{!searchIn}" id="searchFields">
<apex:selectOption itemValue="name" itemLabel="Name"/>
<apex:selectOption itemValue="street" itemLabel="Address"/>
<apex:selectOption itemValue="email" itemLabel="Email"/>
<!-- more options can be added here without any other change in the code -->
</apex:selectCheckboxes>
<br />
<apex:commandButton value="Search" reRender="leadDisplay,messages" status="waitMessage"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Leads" columns="1" id="leadDisplay" >
<apex:outputLabel escape="false"><I>Lead Displayed as Name(Company) , Follow the link to go to lead's Details page</I></apex:outputLabel>
<apex:inputCheckbox label="Select All" onclick="checkAllLeads(this)" />
<apex:actionstatus id="waitMessage">
<!-- showing animation by searching and rendering search results -->
<apex:facet name="start">
<!-- custom controller 'loading',uses resource 'loading' which is a gif image -->
<c:loading BackColor="#efefef" borderColor="#336699"
borderSize="3" height="50px" width="120px"
ImageUrl="{!$Resource.loading}" Message="Loading..."
messageStyle="color:darkred;font-size:11pt;
font-weight:bold;"/>
</apex:facet>
<apex:facet name="stop">
<apex:selectCheckboxes value="{!leadIdsToConvert}" layout="pageDirection" id="leadCheckBox">
<apex:selectOptions value="{!leads}" />
</apex:selectCheckboxes>
</apex:facet>
</apex:actionstatus>
<!-- render select boxes' labels as links to corresponding leads -->
<script>makeLinks();</script>
</apex:pageBlockSection>
<apex:pageBlockSection title="Convert Leads">
<apex:outputLabel >Enter Account Name</apex:outputLabel>
<apex:inputText value="{!accountName}"/>
<apex:commandButton value="Convert Leads" action="{!convertLeads}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script>
checkAllFields(); //check all search fields on page load
</script>
</apex:page>
</pre>
</div>
<div class="MsoNormal">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Controller :</span><br />
<script type="syntaxhighlighter" class="brush: js"><![CDATA[
public with sharing class ConversionController {
public String[] searchIn =new String[]{}; //array containing field names to search like name,address,email
public String keyword { get; set; } //keyword to search in given fields
public String[] leadIdsToConvert =new String[]{}; //Ids of leads checked by user to convert
public String accountName{get; set;} //name of the account to be created,given by user
public void setSearchIn(string[] searchIn) {
this.searchIn=searchIn;
}
public String[] getSearchIn() {
return searchIn;
}
public void setleadIdsToConvert(string[] leadIdsToConvert) {
this.leadIdsToConvert=leadIdsToConvert;
}
public String[] getleadIdsToConvert() {
//We don't want any lead to be selected by default,so clear leadIdsToConvert array.
leadIdsToConvert.clear();
return leadIdsToConvert;
}
public List<SelectOption> getLeads() { //returns leads based on search criteria
String myQuery='Select Id,Name,Company From Lead where isConverted=false'; //only give leads which can be converted
//filter according to search criteria
//show all convertible leads on first load or
//If user gives no keyword(keyword='') or no field to search in(searchIn.size()=0)
if(keyword!=null && keyword!='' && searchIn.size()!=0)
{ //we want to create myQuery like
//Select Id,Name From Lead where isConverted=false and (name like '%value%' or email like '%value%' or..........)
String prefix=' and ('; //to be prefixed with first filter to myQuery
//now add all fields to search in
for(String field:searchIn)
{
myquery=myquery+prefix+field+ ' like \'%'+keyword+'%\'';
prefix='OR '; //if a field has been added next field should be prefixed by OR
}
//all fields added,so close the parenthesis after and
myquery+=')';
}
List<SelectOption> options = new List<SelectOption>(); //leads will be returned as select options,which will be displayed as checkBoxes
for(Lead l:database.query(myquery))
options.add(new selectOption(l.Id,l.Name+' ('+l.Company+')')); //add all queried leads to SelectOption array
return options;
}
public PageReference convertLeads() { //converts selected leads and redirects to newly created account
if(leadIdsToConvert.size()==0) //give error if no lead selected to convert
{Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'Select Some leads to convert'));
return null; //terminate
}
//we don't want to create new account for each lead so create a new account,and give its id to each lead conversion
if(accountName=='') //no account name given by user , give error
{Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'Please give Account name'));
return null; //terminate
}
Account leadAccount = new Account();
leadAccount.name=accountName;
Database.SaveResult result;
try{
result =Database.insert(leadAccount); //create account,result will be used to retreive Id
}
catch (Exception e) {
Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'Error creating new account'));
return null;//terminate
}
//LeadConvert[] array to convert leads by api
Database.LeadConvert[] leadsToConvert=new Database.LeadConvert[leadIdsToConvert.size()];
//get status of converted lead from database itself,instead of hardcoading
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
//fill leadsToConvert array
for(integer i=0;i<leadsToConvert.size();i++){
leadsToConvert[i] = new Database.LeadConvert();
leadsToConvert[i].setLeadId(leadIdsToConvert[i]); //required field
leadsToConvert[i].setConvertedStatus(convertStatus.MasterLabel); //required field
leadsToConvert[i].setAccountId(result.getId()); //setting to newly created account's Id
}
try{
Database.LeadConvertResult[] lcr = Database.convertLead(leadsToConvert); //convert leads
}
catch (Exception e) {
Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'Error converting some leads'));
return null;//terminate
}
//if all good then redirect to newly created account's detail page
PageReference accountDetailsPage = new PageReference('/'+result.getId());
//send redirect
return accountDetailsPage.setRedirect(true);
}
}
]]></script>
</div>
</div>visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com0tag:blogger.com,1999:blog-3962244806296778607.post-17707851139836827982012-09-03T21:12:00.001+05:302014-03-29T20:09:49.930+05:30Salesforce Mashup with google maps<div dir="ltr" style="text-align: left;" trbidi="on">
This app helps user to plot sales on the google map.The sales to be plotted can be filtered based on various criteria like location,size,type,date etc.Clicking on a sale on the map redirects to the corresponding account.<br />
Final application looks like this :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMrc2kxprNYX7_kqAIR6dh4gYdBqvEe0MeX9JirTqFVNlEaA4kdT2_ulv6q47LSbj1YOgyt30R7n0j2KDMgAhm_sFEAK0xuMFxVRFMsgLrQdU3YuToJcPVhuMEdawPhgt9ATlO3d0u4TVp/s1600/mockup.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMrc2kxprNYX7_kqAIR6dh4gYdBqvEe0MeX9JirTqFVNlEaA4kdT2_ulv6q47LSbj1YOgyt30R7n0j2KDMgAhm_sFEAK0xuMFxVRFMsgLrQdU3YuToJcPVhuMEdawPhgt9ATlO3d0u4TVp/s320/mockup.png" width="320" /></a></div>
you can install the unmanaged apex package from here :<br />
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Pyoa">https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Pyoa</a></span><br />
<br />
Use the following doc for deployment instructions :<br />
<a href="https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxteWZpbGVzOTF8Z3g6NTJkN2U5YWU4ZTA3ZDZlMA">https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxteWZpbGVzOTF8Z3g6NTJkN2U5YWU4ZTA3ZDZlMA</a><br />
<br />
Demo video:<br />
<a href="https://sites.google.com/site/myfiles91/home/files/salesmap.swf?attredirects=0">https://sites.google.com/site/myfiles91/home/files/salesmap.swf?attredirects=0</a><br />
<br />
The app uses only one visual force page and one controller<br />
<br />
Visual Force page :<br />
<br />
<br />
<!--<script src="https://gist.github.com/3610124.js?file=salesmap page"></script>-->
<pre class="brush: html; white-space: pre-wrap">
<apex:page sidebar="false" Controller="salesData" id="page">
<apex:includeScript value="{!URLFOR($Resource.jquery, 'jquery-1.3.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery, 'jquery-ui-1.7.2.custom.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.jquery,'jquery-ui-1.7.2.custom.css')}"/>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
//This will load as soon as the page is ready and will setup slider
$(document).ready(function(){
//to setup slider
$("#slider-range").slider({ //This line creates a slider on the DIV specified, options are passed arguments,comma separated below
range: true,
min: 0, //Min value for slider
max: 400, //Max value for slider
values: [0,250], //initial values of slider
slide: function(event, ui){ //function to execute on slide event
document.getElementById('{!$Component.page.form.block.values.size_low}').value = ui.values[0]; //hidden fields to pass slider values to controller
document.getElementById('{!$Component.page.form.block.values.size_high}').value = ui.values[1];
$("#amountValue").html(ui.values[0] + ' - ' + ui.values[1]); //display slider value as text
}
});
//to display initial values of slider
$("#amountValue").html($("#slider-range").slider("values", 0) + ' - ' + $("#slider-range").slider("values", 1));
});
</script>
<style>
#map_canvas {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:500px;
width:1000px;
background:transparent;
}
</style>
<apex:form id="form">
<apex:pageBlock mode="edit" id="block">
<apex:pageMessages />
<apex:pageBlockSection columns="7" id="values" >
<apex:pageBlockSectionItem >
<apex:outputlabel value="* Country"/>
<apex:selectList value="{!country}" multiselect="false" required="true" size="1">
<apex:selectOptions value="{!countries}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputlabel value="State"/>
<apex:inputtext value="{!state}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputlabel value="City"/>
<apex:inputtext value="{!city}"/>
</apex:pageBlockSectionItem>
<apex:commandButton action="{! search}" value="Search" reRender="mymap" />
<!-- pass slider values -->
<apex:inputhidden value="{!size_low}" id="size_low" />
<apex:inputhidden value="{!size_high}" id="size_high" />
<!-- pass address of clicked marker -->
<apex:inputhidden value="{!addressParameter}" id="addressParameter" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Filter Results" columns="3">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Size"/>
<!-- This is where our slider will be -->
<div id="slider-range" style="font-size: 90%; margin-top: 0.5em;"></div>
<div id="amountValue" style="text-align: center;"></div>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputlabel value="Begining Year"/>
<apex:selectList value="{!b_year}" multiselect="false" required="true" size="1">
<apex:selectOptions value="{!years}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputlabel value="End Year"/>
<apex:selectList value="{!e_year}" multiselect="false" required="true" size="1">
<apex:selectOptions value="{!years}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputlabel value="Type"/>
<apex:selectCheckboxes value="{!type}">
<apex:selectOptions value="{!items}"/>
</apex:selectCheckboxes>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection columns="2">
<apex:outputpanel id="mymap">
<div id="map_canvas"></div>
<script type="text/javascript">
var myOptions = {
zoom:15,
mapTypeControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var geocoder = new google.maps.Geocoder();
//create map
var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
function putmarker(map,address,geocoder){
geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
//center map
map.setCenter(results[0].geometry.location);
//create marker
var marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title:address
});
//add click listener on marker
google.maps.event.addListener(marker, 'click', function() {
//change addressParameter on click
document.getElementById('{!$Component.page.form.block.values.addressParameter}').value=marker.title;
refreshData(); //to rerender rightpane containing sales data of a location(invokes action function)
});
}
}
})
}
</script>
<apex:repeat value="{! salesAddress}" var="address">
<script> putmarker(map,"{!address}",geocoder);</script>
</apex:repeat>
</apex:outputpanel>
<apex:dataList value="{! Sales}" var="sale" id="dataView">
<!-- extract Record Id(15 character long from begining) to make link and Text to display(from 20th character to end of string) -->
<!-- Instance is auto corrected by force.com if it is not ap1 -->
<apex:outputLink value="{!'https://ap1.salesforce.com/'+left(sale,15)}" target="_blank">
{!MID(sale,20,len(sale)-19)}
</apex:outputLink>
</apex:dataList>
</apex:pageBlockSection>
</apex:pageBlock>
<!-- Rerender Right pane on marker click -->
<apex:actionFunction name="refreshData" action="{!refreshData}" rerender="dataView"/>
</apex:form>
</apex:page>
</pre>
Controller :<br />
<script type="syntaxhighlighter" class="brush: java; white-space: pre-wrap;"><![CDATA[
public with sharing class salesData {
public PageReference refreshData() {
return null;
}
public String country{get; set;}
public String state{get; set;}
public String city{get; set;}
public integer b_year{get; set;}
public integer e_year{get; set;}
public String[] type= new String[]{};
public integer size_low{get;set;}
public integer size_high{get;set;}
public string addressParameter{get;set;}
public String[] gettype() {
return type;
}
public void settype(String[] type) {
this.type = type;
}
public List<SelectOption> getcountries() { //this function gives list of countries from country__c object
List<SelectOption> options = new List<SelectOption>();
for(country__c country :[SELECT name FROM country__c])
options.add(new selectOption(country.name,country.Name));
return options;
}
public List<SelectOption> getYears() {
List<SelectOption> options = new List<SelectOption>();
for(integer i=2012;i>1974;i--)
options.add(new selectOption(string.valueof(i),string.valueof(i)));
return options;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('residential','Residential'));
options.add(new SelectOption('commercial','Commercial'));
options.add(new SelectOption('utility','Utility'));
return options;
}
public List<String> getSales() { //this function returns sales data for a particilar location,called on marker click
string[] sales= new String[]{};
country__c Search_opportunity;
string myquery,flag;
string streetName,cityName,stateName,countryName;
if(addressParameter==null || addressParameter=='')
return null;
else
{
List<String> parts = addressParameter.split(',');
streetName=parts[0];
cityName=parts[1];
stateName=parts[2];
countryName=parts[4]; //parts[3] is zipcode
try{
Search_opportunity=[SELECT search_opportunities__c from country__c where name=:countryName];
flag=Search_opportunity.search_opportunities__c; //to determine which object to search
} catch (Exception e) {
Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'No Data Found for default display,Please Enter some Data. '));
return null;}
//create query
if(flag.equals('True'))
myquery='SELECT Id,Account.Name,closeDate,size__c,type from opportunity where account.Billingstreet=:streetName AND account.Billingcity=:cityName AND account.Billingstate=:stateName AND account.Billingcountry=:countryName';
else
myquery='Select Id,account_name__c,Delivery_Date__c,size__c,type__c from salesOrder__c where street__c=:streetName AND city__c=:cityName AND state__c=:stateName AND country__c=:countryName';
//evaluate query
if(flag.equals('True'))
{
for(Opportunity o:database.query(myquery))
sales.add(o.Id+'-'+o.account.name+'-'+String.valueOf(o.CloseDate.year())+'-'+o.size__c+'-'+o.type);
}
else
{
for(salesOrder__c s:database.query(myquery))
sales.add(s.Id+'-'+s.account_name__c+'-'+String.valueOf(s.Delivery_Date__c.year())+'-'+s.size__c+'-'+s.type__c);
}
return sales;
}
}
public set<String> getSalesAddress() { //this function returns sddresses to put markers on
string myquery,flag;
country__c Search_opportunity;
set<string> salesAddress= new set<String>{}; //set is used to return Distinct addresses
//initialize
if(country==null)
this.country='USA'; //for default display
if(state==null)
this.state='';
if(city==null)
this.city='';
if(b_year==null)
this.b_year=1975;
if(e_year==null)
this.e_year=2012;
if(size_low==null)
this.size_low=0;
if(size_high==null)
this.size_high=250;
//If no type is checked type filter is not applied i.e. all types are added
if(type.size()==0)
{
this.type.add('Residential');
this.type.add('Commercial');
this.type.add('Utility');
}
try {
Search_opportunity=[SELECT search_opportunities__c from country__c where name=:country];
flag=Search_opportunity.search_opportunities__c; //to determine which object to search
} catch (Exception e) {
Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'No Data Found for default display,Please Enter some Data. '));
return null;}
if(flag.equals('True'))
{myquery='SELECT Account.BillingStreet,Account.BillingCity,Account.BillingState,Account.BillingPostalcode,Account.BillingCountry from opportunity where Account.BillingCountry=:country';
if(state!='')
myquery=myquery+' AND Account.BillingState=:state';
if(city!='')
myquery=myquery+' AND Account.BillingCity=:city';
//apply filters
myquery=myquery+' AND size__c>=:size_low AND size__c<=:size_high AND CALENDAR_YEAR(CloseDate)>=:b_year AND CALENDAR_YEAR(CloseDate)<=:e_year AND type in(';
}
else
{myquery='SELECT street__c,city__c,state__c,zipcode__c,country__c from SalesOrder__c where country__c=:country';
if(state!='')
myquery=myquery+' AND state__c=:state';
if(city!='')
myquery=myquery+' AND city__c=:city';
//apply filters
myquery=myquery+' AND size__c>=:size_low AND size__c<=:size_high AND CALENDAR_YEAR(Delivery_Date__c)>=:b_year AND CALENDAR_YEAR(Delivery_Date__c)<=:e_year AND type__c in(';
}
//apply type filter
for(integer i=0;i<type.size();i++)
{
if(i!=type.size()-1)
myquery=myquery+'\''+type[i]+'\',';
else
myquery=myquery+'\''+type[i]+'\')';
}
//evaluating query
if(flag.equals('True'))
{
for(Opportunity o:database.query(myquery))
salesAddress.add(o.account.BillingStreet+','+o.account.BillingCity+','+o.account.BillingState+','+o.account.BillingPostalcode+','+o.account.BillingCountry);
}
else
{
for(salesOrder__c s:database.query(myquery))
salesAddress.add(s.Street__c+','+s.City__c+','+s.State__c+','+s.ZipCode__c+','+s.Country__c);
}
return salesAddress;
}
Public void Search(){
}
} //controller ends
]]></script>
</div>visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com9tag:blogger.com,1999:blog-3962244806296778607.post-2224469138279225062012-06-04T23:30:00.001+05:302012-10-20T21:53:56.067+05:30Country database android app<div dir="ltr" style="text-align: left;" trbidi="on">
we created this app for <a href="http://bitsmun.org/">bitsmun</a> . The app has database for many countries which includes various country details like area,population,military,politics,constitution taken from <a href="https://www.cia.gov/library/publications/the-world-factbook">Cia-World factbook</a> . This is an Html5 app created using phonegap. you may find the source code at <a href="http://munappbits.appspot.com/">http://munappbits.appspot.com/</a> by viewing the source of webpage.<br />
<br />
Android installer : <a href="https://docs.google.com/open?id=0Bxag-fuMuJ3-RmNjMzlKcFZITUk">https://docs.google.com/open?id=0Bxag-fuMuJ3-RmNjMzlKcFZITUk</a><br />
<br />
let me know in comments , if you want the source code of phonegap project and I will upload.</div>visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com0tag:blogger.com,1999:blog-3962244806296778607.post-37619951699397155512012-04-29T21:31:00.000+05:302014-03-29T19:46:53.816+05:30Dynamic SQL query when number of fields in where clause in not known<div dir="ltr" style="text-align: left;" trbidi="on">
suppose we have a front end where user can select different filters to narrow down the query results.In this case it is not already known which all fields user will select.<br />
A dynamic query for this case can be constructed using this trick:<br />
<br />
here fieldNames is the array containing names of all filters and fields is the array containing values provided by user.<br />
<br />
<script type="syntaxhighlighter" class="brush: js"><![CDATA[
String query="SELECT * from tableName";
String prefix=" WHERE "; //notice spaces before and after WHERE
for(int i=0;i<fields.length;i++){
if(fields(i)!=null)
{query=query+prefix+fieldNames(i)+" = "+fields(i);
prefix=" OR " //notice spaces before and after OR
}
}
]]></script>
<br /></div>visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com1tag:blogger.com,1999:blog-3962244806296778607.post-48905716402890929842012-04-28T15:26:00.002+05:302012-10-20T21:53:29.039+05:30Force.com Eclipse plugin installation problem<div dir="ltr" style="text-align: left;" trbidi="on">
Installation fails with error 'Md5 hash not as expected'<br />
<i>original error message :</i><br />
<i><br /></i><br />
<span style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px;">An error occurred while collecting items to be installed session context was:(profile=SDKProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). Problems downloading artifact: osgi.bundle,com.salesforce.ide.api,23.0.2.201201091635. MD5 hash is not as expected. Expected: 97a6329f82c422a61e9b1bc28be7cace and found ef8b1c2b63c7d04acaa6bf41f4b8570c.</span><br />
<span style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px;"><br /></span><br />
this happens due to corrupted download of jars by eclipse.To fix the problem follow these steps:<br />
1. download all jars manually from<br />
<a href="http://www.adnsandbox.com/tools/ide/install/features/">http://www.adnsandbox.com/tools/ide/install/features/</a> and<br />
<a href="http://www.adnsandbox.com/tools/ide/install/plugins/">http://www.adnsandbox.com/tools/ide/install/plugins/</a><br />
you can use firefox plugin '<a href="https://addons.mozilla.org/en-US/firefox/addon/downthemall/">download them all</a>' to download all links in one click.<br />
2. put them in /features/ and /plugins/ directory of eclipse<br />
3.run plugin installation again as you would do normally.It won't download the jars again and it will work without error.<br />
<br />
<i>original post:</i><br />
<i><a href="http://stackoverflow.com/a/9823562/1219463">http://stackoverflow.com/a/9823562/1219463</a></i></div>visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com0tag:blogger.com,1999:blog-3962244806296778607.post-69625120962730288042011-11-29T01:05:00.000+05:302012-10-20T21:53:56.068+05:308 Puzzle,cool android game<div dir="ltr" style="text-align: left;" trbidi="on"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVgu-Z8UoALfRkmcoNvXwU2X-q3lGimyJpWqMmSIc7F85-JGpnAKkW2E_UNyGZ1icW3uh-FNTBDlAhlC_dXa8w7kt3EK1rOpEAmXZkW9U1QVQIAzKOK2lfvumz7tUgt-KFXAcRu5RZusQ/s1600/eightpuzzle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVgu-Z8UoALfRkmcoNvXwU2X-q3lGimyJpWqMmSIc7F85-JGpnAKkW2E_UNyGZ1icW3uh-FNTBDlAhlC_dXa8w7kt3EK1rOpEAmXZkW9U1QVQIAzKOK2lfvumz7tUgt-KFXAcRu5RZusQ/s1600/eightpuzzle.png" /></a></div>Here is a very basic puzzle created by me for android devices.Feel free to download and install..<br /><br /><a href="https://sites.google.com/site/myfiles91/home/files/eight_puzzle.apk?attredirects=0&d=1"><span id="goog_253330282"></span>Download apk(android executable)</a><span id="goog_253330283"></span><br /><br /><a href="https://sites.google.com/site/myfiles91/home/files/8puzzlecode.zip?attredirects=0&d=1">Download source code</a></div>visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com11tag:blogger.com,1999:blog-3962244806296778607.post-49841880449601636402011-02-22T01:57:00.000+05:302012-04-23T18:13:08.574+05:30Recover windows 7 after removing linux from a Dual boot system<div dir="ltr" style="text-align: left;" trbidi="on">If you install linux on a hard disk partition after windows,it changes MBR(Master boot record), and then if you remove the linux ,it will result in a non bootable windows.<br />To fix this just follow this steps and enjoy a clean windows booting.<br /> insert windows installation DVD and boot from it,select repair windows option and then command prompt.<br /> now run the following commands<br /> >diskpart<br /> >select volume 0<br /> >list volume<br /> this will list the drive letter of your windows DVD.(for example G)<br /> >exit<br /> >G: (or any other drive letter what you got)<br /> >cd boot<br /> >dir<br /> >bootsect /nt60 SYS /mbr<br />now exit the command prompt and restart your computer,Enjoy.</div>visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com0tag:blogger.com,1999:blog-3962244806296778607.post-11407136870963583362011-02-08T17:34:00.000+05:302014-03-29T19:49:08.648+05:30creating network applications in vb6(using winsock control)<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"></span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoyCOS04jGM_g2Af4RRGH55RZcS0-uqy25ty4DHExLmKTDu7yj6UGrjcj_uar-k05iyb8VI0WDAy4NJrNZ36GuHZqvhOCFaap0zDb0wPhWp8XzTQozkK6tLsATKX4_g007y2_NWw7ua8/s1600/winsock.jpg" style="margin-left: 1em; margin-right: 1em;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"></span></span></a></span></span></span></span></div>
<div style="margin: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoyCOS04jGM_g2Af4RRGH55RZcS0-uqy25ty4DHExLmKTDu7yj6UGrjcj_uar-k05iyb8VI0WDAy4NJrNZ36GuHZqvhOCFaap0zDb0wPhWp8XzTQozkK6tLsATKX4_g007y2_NWw7ua8/s1600/winsock.jpg" style="margin-left: 1em; margin-right: 1em;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">Hi friends,in this post I will show you how to create network apps in vb6,which will help you make chat programs and trojan like app<b><i>s.</i></b></span></span></a></span></span></span></span></div>
<div style="margin: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoyCOS04jGM_g2Af4RRGH55RZcS0-uqy25ty4DHExLmKTDu7yj6UGrjcj_uar-k05iyb8VI0WDAy4NJrNZ36GuHZqvhOCFaap0zDb0wPhWp8XzTQozkK6tLsATKX4_g007y2_NWw7ua8/s1600/winsock.jpg" style="margin-left: 1em; margin-right: 1em;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><br /></span></span></a></span></span></span></span></div>
<div style="margin: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoyCOS04jGM_g2Af4RRGH55RZcS0-uqy25ty4DHExLmKTDu7yj6UGrjcj_uar-k05iyb8VI0WDAy4NJrNZ36GuHZqvhOCFaap0zDb0wPhWp8XzTQozkK6tLsATKX4_g007y2_NWw7ua8/s1600/winsock.jpg" style="margin-left: 1em; margin-right: 1em;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">To interact with other computers vb provides a control called winsock.To add it to your vb toolbox press 'CTRL+T' and check the box before 'Microsoft Winsock Control 6.0(SP6)'</span></span></a></span></span></span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQz-oGLspMVG7omK6bsNg3coB6klYN13wVsJtVN0okR4K-7QxUGcl0fPKwZLeoq4znnyS3hAqLpIPGOsXkxQWiCiL-dD2Mf72MrYyBTv4v-DSPTdCe2369E4XDEAORWZFt1GzZ94gZF8w/s1600/winsock.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span class="Apple-style-span" style="text-align: left;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQz-oGLspMVG7omK6bsNg3coB6klYN13wVsJtVN0okR4K-7QxUGcl0fPKwZLeoq4znnyS3hAqLpIPGOsXkxQWiCiL-dD2Mf72MrYyBTv4v-DSPTdCe2369E4XDEAORWZFt1GzZ94gZF8w/s1600/winsock.jpg" /></span></a></span></span></span></span></span></div>
</div>
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"></span></span></span></span><br />
This will add winsock control to your toolbox</span></span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjK8uJXt7WlczPqWFq94wAaRDOk01BnYfaV3_TMbTnErJ-VVT9KdTHZO9IdyinA1xUQtCy1K_Ee5wJXZLQ_11imcmRMXPP_zrAydVFFR55Mnsr8E-pSj4Xw0nK-zwtbpdCdzG1PPyzTU4/s1600/wsck.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjK8uJXt7WlczPqWFq94wAaRDOk01BnYfaV3_TMbTnErJ-VVT9KdTHZO9IdyinA1xUQtCy1K_Ee5wJXZLQ_11imcmRMXPP_zrAydVFFR55Mnsr8E-pSj4Xw0nK-zwtbpdCdzG1PPyzTU4/s320/wsck.png" height="320" width="177" /></a></div>
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">Now drag and drop this control to your form,name it ws.</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">Add these controls to your form</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">CONTROL NAME CAPTION</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">command button cmdconnect connect</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">command button cmddisconnect Disconnect</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">command button cmdsend send</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">command button cmdclear Clear</span></span><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"> </span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">command button cmdserver Serve as server</span></span><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"> </span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">listbox list1 chat window</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">textbox txtip</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">textbox txtdata </span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">label label1 Remote IP</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">label label2 Enter Text below</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"> </span></span><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><br /></span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"> </span></span><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><br /></span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;">your form should now look like this</span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0TVf1V1zO0gT4b0a8IC0Y-b-L12AkHkmJLDyFPT7moc4jQNk5ieAyuqapxhyphenhyphenXtxNOcTUrlEvpJ9yUI2FS5HrucL9D1EqYxIa9quOEd5JIaKqfmQTLg4ORoMfDjnq4BY2NDuzWUWAqyhc/s1600/main.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0TVf1V1zO0gT4b0a8IC0Y-b-L12AkHkmJLDyFPT7moc4jQNk5ieAyuqapxhyphenhyphenXtxNOcTUrlEvpJ9yUI2FS5HrucL9D1EqYxIa9quOEd5JIaKqfmQTLg4ORoMfDjnq4BY2NDuzWUWAqyhc/s1600/main.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"> </span></span><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="text-align: left;"><br /></span></span><br />
<div style="text-align: left;">
<span style="font-size: small;"><span style="font-family: inherit;">Add following code to code window</span></span>
<script type="syntaxhighlighter" class="brush: java"><![CDATA[
Private Sub cmdclear_Click()
List1.Clear
End Sub
Private Sub cmdconnect_Click()
ws.Close
ws.RemoteHost = txtip.Text
ws.RemotePort = 2011
ws.Connect
End Sub
Private Sub cmddisconnect_Click()
ws.Close
End Sub
Private Sub cmdsend_Click()
ws.SendData txtdata.Text
List1.AddItem "Local : " + txtdata.Text
End Sub
Private Sub Command1_Click()
ws.LocalPort = 2011
ws.Listen
End Sub
Private Sub Form_Load()
End Sub
Private Sub ws_ConnectionRequest(ByVal requestID As Long)
ws.Close
ws.Accept requestID
End Sub
Private Sub ws_DataArrival(ByVal bytesTotal As Long)
Dim data As String
ws.GetData data
List1.AddItem "Remote : " + data
End Sub
]]></script>
</div>
<div style="text-align: left;">
<br /></div>
<span style="font-size: small;">save the project,make exe by ' FILE -> MAKE EXE ',run two instance of exe, on first one click on 'serve as server',from another connect to first one by providing ip address as '127.0.0.1' & now both programs can chat.</span><br />
<span style="font-size: small;"></span><br />
<br />
<span style="font-size: small;">You can chat with remote computers by running the exe on two different computers,serving as server on one and connecting to this from another.</span><br />
<span style="font-size: small;"><br /></span>
<span style="font-size: small;">I am giving links to source files for ready code.</span><br />
<span style="font-size: small;"><a href="https://sites.google.com/site/myfiles91/home/files/mytuts.zip?attredirects=0&d=1">simple chat program</a></span><br />
<span style="font-size: small;">Here is a 'link to file transfer & remote file browser' program.</span><br />
<span style="font-size: small;"><a href="https://sites.google.com/site/myfiles91/home/files/1ftp.7z?attredirects=0&d=1">file transfer & remote file browser</a> </span><br />
<span style="font-size: small;"><br /></span>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
</div>
visheshhttp://www.blogger.com/profile/10352133024644406093noreply@blogger.com1