<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3962244806296778607</id><updated>2026-05-18T12:06:24.790+05:30</updated><category term="salesforce"/><category term="android"/><category term="google"/><title type='text'>It&#39;s full of code</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-1848545599328624786</id><published>2014-03-29T19:55:00.001+05:30</published><updated>2014-03-30T01:00:42.788+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="google"/><title type='text'>Show private documents to your users from google drive without sharing them</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
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&#39;s oAuth access to proxy the content through our server.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Implementation:&lt;/b&gt;&lt;br /&gt;
I am using google drive sdk for java in this code snippet:&amp;nbsp;&lt;a href=&quot;https://developers.google.com/drive/v2/reference/&quot;&gt;https://developers.google.com/drive/v2/reference/&lt;/a&gt;&lt;br /&gt;
Given the fileId of a file uploaded on google drive we can query google to get the following info about file:&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Alternate link:&lt;/u&gt; This is the link to file where the document can be accessed on google drive itself.&lt;br /&gt;
&lt;u&gt;Download url :&lt;/u&gt; 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.&lt;br /&gt;
&lt;u&gt;Export Links:&lt;/u&gt;&amp;nbsp;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.&lt;br /&gt;
&lt;br /&gt;
All of these links require google authentication and our end user doesn&#39;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&#39;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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:java&quot;&gt;URL url = new URL(contentUrl)
URLConnection connection = url.openConnection();
connection.setRequestProperty(&quot;Authorization&quot;, &#39;Bearer &#39; + 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)
&lt;/pre&gt;
Controller method to proxy the data and serve it on our page:

&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;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(&quot;application/pdf&quot;)
  if (downloadUrl) {
      contentUrl = downloadUrl
  } else {
      contentUrl = pdfUrl
  }
  
  URL url = new URL(contentUrl)
  URLConnection connection = url.openConnection();
  connection.setRequestProperty(&quot;Authorization&quot;, &#39;Bearer &#39; + 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)
}
&lt;/pre&gt;

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&#39;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 &amp;nbsp;properly but instead download a zip which contains raw structure of file.&lt;br /&gt;
&lt;div&gt;
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:&amp;nbsp;&lt;a href=&quot;https://docs.google.com/viewer&quot;&gt;https://docs.google.com/viewer&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
So if you are using iframe on your page to show the file content instead of pointing iframs&#39;s src to &lt;a href=&quot;http://viewgdoc/&quot;&gt;/viewGDoc&lt;/a&gt;&amp;nbsp;, point it to&amp;nbsp;&lt;a href=&quot;https://docs.google.com/viewer?url=%27serverName/viewGDoc%27&amp;amp;embedded=true&quot;&gt;https://docs.google.com/viewer?url=&#39;serverName/viewGDoc&#39;&amp;amp;embedded=true&lt;/a&gt;&amp;nbsp;. Please note that if you are using iframe the &#39;embedded=true&#39; 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).&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/1848545599328624786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2014/03/show-private-documents-to-you-users.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/1848545599328624786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/1848545599328624786'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2014/03/show-private-documents-to-you-users.html' title='Show private documents to your users from google drive without sharing them'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-1452059219885887977</id><published>2012-10-20T21:14:00.002+05:30</published><updated>2014-03-29T18:17:30.116+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="salesforce"/><title type='text'>Selenium Web Driver to test websites</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In this post I will write how to use selenium web driver to test the websites.Selenium &amp;nbsp;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.&lt;br /&gt;
&lt;br /&gt;
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&#39;s connection speed.On to the design now :&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Also I have overridden the selenium web driver&#39;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.&lt;br /&gt;
&lt;br /&gt;
&lt;script type=&quot;syntaxhighlighter&quot; class=&quot;brush: js&quot;&gt;&lt;![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(&quot;username&quot;));
        WebElement passwordTxt = driver.findElement(By.name(&quot;pw&quot;));
        userNameTxt.sendKeys(userName);
        passwordTxt.sendKeys(password);

        WebElement loginBtn = driver.findElement(By.name(&quot;Login&quot;));
        loginBtn.click();
    }

    /**
     * selects the given tab. Timeouts if the tab is not appeared before TIMEOUT
     * class variable
     * 
     * @param tab
     *            - text on tab
     */
    @SuppressWarnings(&quot;static-access&quot;)
    public void selectTab(String tab) {
        WebElement mTab = findElement(By.cssSelector(&quot;#tabBar&quot;).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(&quot;tsidLabel&quot;));
        if (currentApp.getText().equalsIgnoreCase(app))
            return;

        WebElement appBtn = findElement(By.id(&quot;tsid&quot;));
        appBtn.click();
        @SuppressWarnings(&quot;static-access&quot;)
        WebElement mApp = findElement(By.cssSelector(&quot;#tsid-menuItems&quot;)
                .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&lt;WebElement&gt; buttons = driver.findElements(By.className(&quot;btn&quot;));
        for (WebElement button : buttons) {

            if (button.getAttribute(&quot;value&quot;).trim()
                    .equalsIgnoreCase(btn.trim())) {
                timeOutCounter = 0;
                return button;
            }

        }

        mWait(&quot;TimeOut after waiting &quot; + TIMEOUT
                + &quot; sec. for the button with text &quot; + btn + &quot; to appear&quot;);

        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&lt;WebElement&gt; labels = driver.findElements(By.tagName(&quot;label&quot;));
        for (WebElement mLabel : labels) {
            if (mLabel.getText().trim().endsWith(label.trim())) {
                timeOutCounter = 0;
                String labelFor = mLabel.getAttribute(&quot;for&quot;);
                return findElement(By.id(labelFor));
            }
        }

        mWait(&quot;TimeOut after waiting &quot; + TIMEOUT
                + &quot; sec. for the input with label &quot; + label + &quot; to appear&quot;);

        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&lt;WebElement&gt;() {
                    @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 &gt;= @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&lt;WebElement&gt; findElements(By by,int minimumElements) throws TimeoutException, InterruptedException{
        List&lt;WebElement&gt; elements  = driver.findElements(by);
        int size = elements.size();
        if(size &gt;= minimumElements){
            timeOutCounter=0;
            return elements;
        }
        
        mWait(&quot;Timeout after waiting &quot;+TIMEOUT+&quot; secs. for required elements to load&quot;);
        
        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(&quot;TimeOut after waiting &quot; + TIMEOUT
                    + &quot; sec. for the frame at index &quot; + index + &quot; to appear&quot;);
            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(&quot;timed out after &quot;+TIMEOUT+&quot; sec&quot;);
                 assertPageTitleContains(title);
            }catch (TimeoutException e) {
                throw new AssertionError(&quot;expected page title to contain : &quot;
                        + title + &quot; , found : &quot; + 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(&quot;timed out after &quot;+TIMEOUT+&quot; sec&quot;);
                 assertPageTitleDoesNotContain(notInTitle);
            }catch (TimeoutException e) {
                throw new AssertionError(&quot;expected page title to not contain : &quot;
                        + notInTitle + &quot; , found : &quot; + 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+&quot; button was not visible&quot;);
        }
    }
    
    /**
     * 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 &gt; 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(&quot;#tabBar&quot;)).findElement(By.tagName(&quot;span&quot;));
        //get parent of span
        WebElement parent = span.findElement(By.xpath(&quot;..&quot;));
        //get link for the tab
        WebElement tabLink = parent.findElement(By.tagName(&quot;a&quot;)); 
        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&lt;WebElement&gt; rqdInputs = findElements(By.className(&quot;requiredInput&quot;), minimumFieldsToValidate);
        
        for(WebElement element : rqdInputs){
            List&lt;WebElement&gt; inputField = element.findElements(By.tagName(&quot;input&quot;));
            //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 &#39;.requiredInput&#39; div
                if(inputField.get(0).getText().equalsIgnoreCase(&quot;&quot;)){
                    //there must be error message
                    try{
                        if(!element.findElement(By.className(&quot;errorMsg&quot;)).getText().equalsIgnoreCase(&quot;Error: You must enter a value&quot;))
                            throw new Exception();
                    }catch (Exception e) {
                        //either the error msg was not there or
                        //it was not &quot;Error: You must enter a value&quot;
                        throw new AssertionError(&quot;Empty mandatory field did not show - &#39;Error: You must enter a value&#39;&quot;);
                    }
                }
            }
        }
        
    }
    /**
     * 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);
    }

    
}
]]&gt;&lt;/script&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/1452059219885887977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2012/10/selenium-web-driver-to-test-websites.html#comment-form' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/1452059219885887977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/1452059219885887977'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2012/10/selenium-web-driver-to-test-websites.html' title='Selenium Web Driver to test websites'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-6038277377897440232</id><published>2012-09-03T22:30:00.000+05:30</published><updated>2014-03-29T19:14:20.326+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="salesforce"/><title type='text'>salesforce lead conversion</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;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.&amp;nbsp; 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.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;Video Url&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;a href=&quot;http://www.screencast.com/users/vishesh91/folders/Default/media/5e12fd28-ba37-4e95-8eea-e3c89f0c1ad5&quot;&gt;http://www.screencast.com/users/vishesh91/folders/Default/media/5e12fd28-ba37-4e95-8eea-e3c89f0c1ad5&lt;/a&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
you can install the unmanaged package from :&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; line-height: 115%;&quot;&gt;&lt;a href=&quot;https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Q3Ww&quot;&gt;https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Q3Ww&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;App uses one visual force page and one controller :&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;VisualForce Page :&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: html&quot;&gt;
&lt;apex:page Controller=&quot;ConversionController&quot;&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
           //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(&quot;input&quot;); //get all input elements
            for(var i=0; i&lt;inputElem.length; i++)
            {    
                 if(inputElem[i].id.indexOf(&quot;searchFields&quot;)!=-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(&quot;input&quot;); //get all input elements
            for(var i=0; i&lt;inputElem.length; i++)
            {    
                 if(inputElem[i].id.indexOf(&quot;leadCheckBox&quot;)!=-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(&quot;label&quot;); //get all labels
            for(var i=0; i&lt;inputElem.length; i++)
            {    
                  var myCheckBoxId=inputElem[i].getAttribute(&quot;for&quot;);  //get Id of associated element
                  if(myCheckBoxId!=null &amp;&amp; myCheckBoxId.indexOf(&quot;leadCheckBox&quot;)!=-1)   //only change labels for lead select boxes                     
                          {  var leadId=document.getElementById(myCheckBoxId).getAttribute(&quot;value&quot;); //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 =&#39;&lt;apex:outputLink value=&quot;https://ap1.salesforce.com/&#39;+leadId+&#39;&quot; target=&quot;_blank&quot;&gt;&#39;+inputElem[i].innerHTML+&#39;&lt;/apex:outputLink&gt;&#39;;
                          }
            } 
          }
          
     &lt;/script&gt;
    
     &lt;apex:form &gt;
      &lt;apex:pageBlock mode=&quot;edit&quot; &gt;
         &lt;apex:pageMessages id=&quot;messages&quot; /&gt;  
         
         &lt;apex:pageBlockSection title=&quot;Search&quot; columns=&quot;3&quot;&gt;
            &lt;apex:outputLabel &gt;Enter Keyword&lt;/apex:outputLabel&gt;
            &lt;apex:inputText value=&quot;{!keyword}&quot; /&gt;
            &lt;br /&gt;
            &lt;apex:outputLabel &gt;Search Fields&lt;/apex:outputLabel&gt;
            &lt;apex:selectCheckboxes value=&quot;{!searchIn}&quot; id=&quot;searchFields&quot;&gt;
                           &lt;apex:selectOption itemValue=&quot;name&quot; itemLabel=&quot;Name&quot;/&gt;
                           &lt;apex:selectOption itemValue=&quot;street&quot; itemLabel=&quot;Address&quot;/&gt;
                           &lt;apex:selectOption itemValue=&quot;email&quot; itemLabel=&quot;Email&quot;/&gt;  
                           &lt;!-- more options can be added here without any other change in the code --&gt;
            &lt;/apex:selectCheckboxes&gt;
            &lt;br /&gt;
            &lt;apex:commandButton value=&quot;Search&quot; reRender=&quot;leadDisplay,messages&quot; status=&quot;waitMessage&quot;/&gt;
         
         &lt;/apex:pageBlockSection&gt;
         
         &lt;apex:pageBlockSection title=&quot;Leads&quot; columns=&quot;1&quot; id=&quot;leadDisplay&quot; &gt;
            &lt;apex:outputLabel escape=&quot;false&quot;&gt;&lt;I&gt;Lead Displayed as Name(Company) , Follow the link to go to lead&#39;s Details page&lt;/I&gt;&lt;/apex:outputLabel&gt;
            &lt;apex:inputCheckbox label=&quot;Select All&quot; onclick=&quot;checkAllLeads(this)&quot; /&gt;
           
            &lt;apex:actionstatus id=&quot;waitMessage&quot;&gt;
            &lt;!-- showing animation by searching and rendering search results --&gt;
               &lt;apex:facet name=&quot;start&quot;&gt;
               &lt;!-- custom controller &#39;loading&#39;,uses resource &#39;loading&#39; which is a gif image --&gt;
                    &lt;c:loading BackColor=&quot;#efefef&quot; borderColor=&quot;#336699&quot; 
                         borderSize=&quot;3&quot; height=&quot;50px&quot; width=&quot;120px&quot;
                         ImageUrl=&quot;{!$Resource.loading}&quot; Message=&quot;Loading...&quot;
                         messageStyle=&quot;color:darkred;font-size:11pt;
                         font-weight:bold;&quot;/&gt;
               &lt;/apex:facet&gt;
            
               &lt;apex:facet name=&quot;stop&quot;&gt;
                    &lt;apex:selectCheckboxes value=&quot;{!leadIdsToConvert}&quot; layout=&quot;pageDirection&quot; id=&quot;leadCheckBox&quot;&gt;
                        &lt;apex:selectOptions value=&quot;{!leads}&quot; /&gt;     
                    &lt;/apex:selectCheckboxes&gt;
                    
               &lt;/apex:facet&gt;
            &lt;/apex:actionstatus&gt;
            &lt;!-- render select boxes&#39; labels as links to corresponding leads --&gt;
            &lt;script&gt;makeLinks();&lt;/script&gt;
         &lt;/apex:pageBlockSection&gt;
         
         &lt;apex:pageBlockSection title=&quot;Convert Leads&quot;&gt;
            &lt;apex:outputLabel &gt;Enter Account Name&lt;/apex:outputLabel&gt;
            &lt;apex:inputText value=&quot;{!accountName}&quot;/&gt;
            &lt;apex:commandButton value=&quot;Convert Leads&quot; action=&quot;{!convertLeads}&quot; /&gt;
         &lt;/apex:pageBlockSection&gt;
         
      &lt;/apex:pageBlock&gt;
     &lt;/apex:form&gt;
     &lt;script&gt;
       checkAllFields(); //check all search fields on page load
     &lt;/script&gt;
   
&lt;/apex:page&gt;
&lt;/pre&gt;


&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;Controller :&lt;/span&gt;&lt;br /&gt;

&lt;script type=&quot;syntaxhighlighter&quot; class=&quot;brush: js&quot;&gt;&lt;![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&#39;t want any lead to be selected by default,so clear leadIdsToConvert array.   
      leadIdsToConvert.clear();
      return leadIdsToConvert;
    }
    
    public List&lt;SelectOption&gt; getLeads() { //returns leads based on search criteria
        
        String myQuery=&#39;Select Id,Name,Company From Lead where isConverted=false&#39;;  //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=&#39;&#39;) or no field to search in(searchIn.size()=0) 
        if(keyword!=null &amp;&amp; keyword!=&#39;&#39; &amp;&amp; searchIn.size()!=0)
         {  //we want to create myQuery like
            //Select Id,Name From Lead where isConverted=false and (name like &#39;%value%&#39; or email like &#39;%value%&#39; or..........) 
            String prefix=&#39; and (&#39;;  //to be prefixed with first filter to myQuery
           //now add all fields to search in
           for(String field:searchIn)
             {
              myquery=myquery+prefix+field+ &#39; like \&#39;%&#39;+keyword+&#39;%\&#39;&#39;;
              prefix=&#39;OR &#39;; //if a field has been added next field should be prefixed by OR
             }
           //all fields added,so close the parenthesis after and
           myquery+=&#39;)&#39;;
             
         }
         
        List&lt;SelectOption&gt; options = new List&lt;SelectOption&gt;(); //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+&#39;  (&#39;+l.Company+&#39;)&#39;)); //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, &#39;Select Some leads to convert&#39;));
            return null; //terminate
           }
        //we don&#39;t want to create new account for each lead so create a new account,and give its id to each lead conversion
        if(accountName==&#39;&#39;) //no account name given by user , give error
           {Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, &#39;Please give Account name&#39;));
            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, &#39;Error creating new account&#39;));
            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&lt;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&#39;s Id
        }
        try{
            Database.LeadConvertResult[] lcr = Database.convertLead(leadsToConvert); //convert leads
        }
        catch (Exception e) {
            Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, &#39;Error converting some leads&#39;));
            return null;//terminate
        }
        
        //if all good then redirect to newly created account&#39;s detail page
        PageReference accountDetailsPage = new PageReference(&#39;/&#39;+result.getId());
        //send redirect
        return accountDetailsPage.setRedirect(true);
       
    }
}
]]&gt;&lt;/script&gt;

&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/6038277377897440232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2012/09/salesforce-lead-conversion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/6038277377897440232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/6038277377897440232'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2012/09/salesforce-lead-conversion.html' title='salesforce lead conversion'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-1770785113983682798</id><published>2012-09-03T21:12:00.001+05:30</published><updated>2014-03-29T20:09:49.930+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="salesforce"/><title type='text'>Salesforce Mashup with google maps</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This app helps user to plot &amp;nbsp;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.&lt;br /&gt;
Final application looks like this :&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMrc2kxprNYX7_kqAIR6dh4gYdBqvEe0MeX9JirTqFVNlEaA4kdT2_ulv6q47LSbj1YOgyt30R7n0j2KDMgAhm_sFEAK0xuMFxVRFMsgLrQdU3YuToJcPVhuMEdawPhgt9ATlO3d0u4TVp/s1600/mockup.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMrc2kxprNYX7_kqAIR6dh4gYdBqvEe0MeX9JirTqFVNlEaA4kdT2_ulv6q47LSbj1YOgyt30R7n0j2KDMgAhm_sFEAK0xuMFxVRFMsgLrQdU3YuToJcPVhuMEdawPhgt9ATlO3d0u4TVp/s320/mockup.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
you can install the unmanaged apex package from &amp;nbsp;here :&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; 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;&quot;&gt;&lt;a href=&quot;https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Pyoa&quot;&gt;https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Pyoa&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Use the following doc for deployment instructions :&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/viewer?a=v&amp;amp;pid=sites&amp;amp;srcid=ZGVmYXVsdGRvbWFpbnxteWZpbGVzOTF8Z3g6NTJkN2U5YWU4ZTA3ZDZlMA&quot;&gt;https://docs.google.com/viewer?a=v&amp;amp;pid=sites&amp;amp;srcid=ZGVmYXVsdGRvbWFpbnxteWZpbGVzOTF8Z3g6NTJkN2U5YWU4ZTA3ZDZlMA&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Demo video:&lt;br /&gt;
&lt;a href=&quot;https://sites.google.com/site/myfiles91/home/files/salesmap.swf?attredirects=0&quot;&gt;https://sites.google.com/site/myfiles91/home/files/salesmap.swf?attredirects=0&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The app uses only one visual force page and one controller&lt;br /&gt;
&lt;br /&gt;
Visual Force page :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;!--&lt;script src=&quot;https://gist.github.com/3610124.js?file=salesmap page&quot;&gt;&lt;/script&gt;--&gt;
&lt;pre class=&quot;brush: html; white-space: pre-wrap&quot;&gt;
&amp;lt;apex:page sidebar=&quot;false&quot; Controller=&quot;salesData&quot; id=&quot;page&quot;&gt;

    &amp;lt;apex:includeScript value=&quot;{!URLFOR($Resource.jquery, &#39;jquery-1.3.2.min.js&#39;)}&quot;/&gt;
    &amp;lt;apex:includeScript value=&quot;{!URLFOR($Resource.jquery, &#39;jquery-ui-1.7.2.custom.min.js&#39;)}&quot;/&gt;
    &amp;lt;apex:stylesheet value=&quot;{!URLFOR($Resource.jquery,&#39;jquery-ui-1.7.2.custom.css&#39;)}&quot;/&gt;
    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://maps.google.com/maps/api/js?sensor=false&quot;&gt;&amp;lt;/script&gt;
    
    &amp;lt;script type=&quot;text/javascript&quot;&gt;    
        //This will load as soon as the page is ready and will setup slider
        $(document).ready(function(){
               
                //to setup slider
                $(&quot;#slider-range&quot;).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(&#39;{!$Component.page.form.block.values.size_low}&#39;).value = ui.values[0]; //hidden fields to pass slider values to controller 
                  document.getElementById(&#39;{!$Component.page.form.block.values.size_high}&#39;).value = ui.values[1];
                  $(&quot;#amountValue&quot;).html(ui.values[0] + &#39; - &#39; + ui.values[1]); //display slider value as text
                  
                }
                });
                
                //to display initial values of slider
                $(&quot;#amountValue&quot;).html($(&quot;#slider-range&quot;).slider(&quot;values&quot;, 0) + &#39; - &#39; + $(&quot;#slider-range&quot;).slider(&quot;values&quot;, 1));
                
        
        });
        
    &amp;lt;/script&gt;
    &amp;lt;style&gt;
        #map_canvas {
        font-family: Arial;
        font-size:12px;
        line-height:normal !important;
        height:500px;
        width:1000px;
        background:transparent;
        }
    &amp;lt;/style&gt;
                
                
     &amp;lt;apex:form id=&quot;form&quot;&gt;
         &amp;lt;apex:pageBlock mode=&quot;edit&quot; id=&quot;block&quot;&gt;
               &amp;lt;apex:pageMessages /&gt;
               
               &amp;lt;apex:pageBlockSection columns=&quot;7&quot; id=&quot;values&quot; &gt;
                
                  &amp;lt;apex:pageBlockSectionItem &gt;
                    &amp;lt;apex:outputlabel value=&quot;* Country&quot;/&gt;
                    &amp;lt;apex:selectList value=&quot;{!country}&quot; multiselect=&quot;false&quot; required=&quot;true&quot; size=&quot;1&quot;&gt;
                       &amp;lt;apex:selectOptions value=&quot;{!countries}&quot;/&gt;
                    &amp;lt;/apex:selectList&gt;
                 &amp;lt;/apex:pageBlockSectionItem&gt;
                  
                 &amp;lt;apex:pageBlockSectionItem &gt;
                   &amp;lt;apex:outputlabel value=&quot;State&quot;/&gt;
                   &amp;lt;apex:inputtext value=&quot;{!state}&quot;/&gt; 
                 &amp;lt;/apex:pageBlockSectionItem&gt;
                  
                 &amp;lt;apex:pageBlockSectionItem &gt;  
                   &amp;lt;apex:outputlabel value=&quot;City&quot;/&gt;
                   &amp;lt;apex:inputtext value=&quot;{!city}&quot;/&gt; 
                 &amp;lt;/apex:pageBlockSectionItem&gt;
                  
                 &amp;lt;apex:commandButton action=&quot;{! search}&quot; value=&quot;Search&quot; reRender=&quot;mymap&quot; /&gt;  
                  
                 &amp;lt;!-- pass slider values --&gt;
                 &amp;lt;apex:inputhidden value=&quot;{!size_low}&quot; id=&quot;size_low&quot; /&gt; 
                 &amp;lt;apex:inputhidden value=&quot;{!size_high}&quot; id=&quot;size_high&quot; /&gt;
                 &amp;lt;!-- pass address of clicked marker --&gt;
                 &amp;lt;apex:inputhidden value=&quot;{!addressParameter}&quot; id=&quot;addressParameter&quot; /&gt; 
                  
               &amp;lt;/apex:pageBlockSection&gt;
               
               &amp;lt;apex:pageBlockSection title=&quot;Filter Results&quot; columns=&quot;3&quot;&gt;
                     
                     &amp;lt;apex:pageBlockSectionItem &gt;
                        &amp;lt;apex:outputLabel value=&quot;Size&quot;/&gt;
                        &amp;lt;!-- This is where our slider will be --&gt;
                        &amp;lt;div id=&quot;slider-range&quot; style=&quot;font-size: 90%; margin-top: 0.5em;&quot;&gt;&amp;lt;/div&gt;
                        &amp;lt;div id=&quot;amountValue&quot; style=&quot;text-align: center;&quot;&gt;&amp;lt;/div&gt;
                     &amp;lt;/apex:pageBlockSectionItem&gt;
                     
                     &amp;lt;apex:pageBlockSectionItem &gt;
                        &amp;lt;apex:outputlabel value=&quot;Begining Year&quot;/&gt;
                        &amp;lt;apex:selectList value=&quot;{!b_year}&quot; multiselect=&quot;false&quot; required=&quot;true&quot; size=&quot;1&quot;&gt;
                           &amp;lt;apex:selectOptions value=&quot;{!years}&quot;/&gt;
                        &amp;lt;/apex:selectList&gt;
                     &amp;lt;/apex:pageBlockSectionItem&gt;
                     
                     &amp;lt;apex:pageBlockSectionItem &gt;
                        &amp;lt;apex:outputlabel value=&quot;End Year&quot;/&gt;
                        &amp;lt;apex:selectList value=&quot;{!e_year}&quot; multiselect=&quot;false&quot; required=&quot;true&quot; size=&quot;1&quot;&gt;
                           &amp;lt;apex:selectOptions value=&quot;{!years}&quot;/&gt;
                        &amp;lt;/apex:selectList&gt;
                     &amp;lt;/apex:pageBlockSectionItem&gt;
                     
                     &amp;lt;apex:pageBlockSectionItem &gt;
                        &amp;lt;apex:outputlabel value=&quot;Type&quot;/&gt;
                        &amp;lt;apex:selectCheckboxes value=&quot;{!type}&quot;&gt;
                           &amp;lt;apex:selectOptions value=&quot;{!items}&quot;/&gt;
                        &amp;lt;/apex:selectCheckboxes&gt;
                     &amp;lt;/apex:pageBlockSectionItem&gt;
                     
               &amp;lt;/apex:pageBlockSection&gt;
               
          &amp;lt;apex:pageBlockSection columns=&quot;2&quot;&gt;
                &amp;lt;apex:outputpanel id=&quot;mymap&quot;&gt;
                  &amp;lt;div id=&quot;map_canvas&quot;&gt;&amp;lt;/div&gt;
 
                  &amp;lt;script type=&quot;text/javascript&quot;&gt;
                     
                     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(&quot;map_canvas&quot;),myOptions);
                 
                    function putmarker(map,address,geocoder){
                       geocoder.geocode( { address: address}, function(results, status) {
                        if (status == google.maps.GeocoderStatus.OK &amp;&amp; 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, &#39;click&#39;, function() {
                                  //change addressParameter on click
                                    document.getElementById(&#39;{!$Component.page.form.block.values.addressParameter}&#39;).value=marker.title;
                                    refreshData(); //to rerender rightpane containing sales data of a location(invokes action function)
                         
                               });
                           }
                        }
                       })
                     }
                  &amp;lt;/script&gt;
                
                  &amp;lt;apex:repeat value=&quot;{! salesAddress}&quot; var=&quot;address&quot;&gt;
                      &amp;lt;script&gt; putmarker(map,&quot;{!address}&quot;,geocoder);&amp;lt;/script&gt;
                  &amp;lt;/apex:repeat&gt;
               
                &amp;lt;/apex:outputpanel&gt;
                
                &amp;lt;apex:dataList value=&quot;{! Sales}&quot; var=&quot;sale&quot; id=&quot;dataView&quot;&gt;
                    &amp;lt;!-- extract Record Id(15 character long from begining) to make link and Text to display(from 20th character to end of string) --&gt; 
                    &amp;lt;!-- Instance is auto corrected by force.com if it is not ap1 --&gt;
                        &amp;lt;apex:outputLink value=&quot;{!&#39;https://ap1.salesforce.com/&#39;+left(sale,15)}&quot; target=&quot;_blank&quot;&gt;
                            {!MID(sale,20,len(sale)-19)}
                        &amp;lt;/apex:outputLink&gt;
                 &amp;lt;/apex:dataList&gt;
                
          &amp;lt;/apex:pageBlockSection&gt;
          
         &amp;lt;/apex:pageBlock&gt;
               &amp;lt;!-- Rerender Right pane on marker click --&gt;
               &amp;lt;apex:actionFunction name=&quot;refreshData&quot; action=&quot;{!refreshData}&quot; rerender=&quot;dataView&quot;/&gt;
          
     &amp;lt;/apex:form&gt;
                 
&amp;lt;/apex:page&gt;
&lt;/pre&gt;

Controller :&lt;br /&gt;
&lt;script type=&quot;syntaxhighlighter&quot; class=&quot;brush: java; white-space: pre-wrap;&quot;&gt;&lt;![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&lt;SelectOption&gt; getcountries() {  //this function gives list of countries from country__c object
         
            List&lt;SelectOption&gt; options = new List&lt;SelectOption&gt;();
            
            for(country__c country :[SELECT name FROM country__c])
              options.add(new selectOption(country.name,country.Name));
              
            return options;
        }
    
    public List&lt;SelectOption&gt; getYears() {
        List&lt;SelectOption&gt; options = new List&lt;SelectOption&gt;();
        for(integer i=2012;i&gt;1974;i--)
         options.add(new selectOption(string.valueof(i),string.valueof(i)));
        return options;
    }

    public List&lt;SelectOption&gt; getItems() {
        List&lt;SelectOption&gt; options = new List&lt;SelectOption&gt;();
        options.add(new SelectOption(&#39;residential&#39;,&#39;Residential&#39;));
        options.add(new SelectOption(&#39;commercial&#39;,&#39;Commercial&#39;));
        options.add(new SelectOption(&#39;utility&#39;,&#39;Utility&#39;));

        return options;
    }

  
    public List&lt;String&gt; 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==&#39;&#39;)
          return null;
        else
        {
          List&lt;String&gt; parts = addressParameter.split(&#39;,&#39;);
      
          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, &#39;No Data Found for default display,Please Enter some Data. &#39;));
           return null;}
      
          //create query
          if(flag.equals(&#39;True&#39;))
            myquery=&#39;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&#39;;
          else
            myquery=&#39;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&#39;;
      
            //evaluate query
            if(flag.equals(&#39;True&#39;))
            { 
              for(Opportunity o:database.query(myquery))
                sales.add(o.Id+&#39;-&#39;+o.account.name+&#39;-&#39;+String.valueOf(o.CloseDate.year())+&#39;-&#39;+o.size__c+&#39;-&#39;+o.type);
            }
            else
            {
              for(salesOrder__c s:database.query(myquery))
                sales.add(s.Id+&#39;-&#39;+s.account_name__c+&#39;-&#39;+String.valueOf(s.Delivery_Date__c.year())+&#39;-&#39;+s.size__c+&#39;-&#39;+s.type__c);
            }
        
        return sales;
        }
    }
 
    public set&lt;String&gt; getSalesAddress() { //this function returns sddresses to put markers on
        string myquery,flag;
        country__c Search_opportunity; 
        set&lt;string&gt; salesAddress= new set&lt;String&gt;{}; //set is used to return Distinct addresses
        
        //initialize
        if(country==null)
          this.country=&#39;USA&#39;; //for default display
        if(state==null)
          this.state=&#39;&#39;;
        if(city==null)
          this.city=&#39;&#39;;
        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(&#39;Residential&#39;);
          this.type.add(&#39;Commercial&#39;);
          this.type.add(&#39;Utility&#39;);
          }
        
        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, &#39;No Data Found for default display,Please Enter some Data. &#39;));
        return null;}
        
        if(flag.equals(&#39;True&#39;))
          {myquery=&#39;SELECT Account.BillingStreet,Account.BillingCity,Account.BillingState,Account.BillingPostalcode,Account.BillingCountry from opportunity where Account.BillingCountry=:country&#39;;
           if(state!=&#39;&#39;)
               myquery=myquery+&#39; AND Account.BillingState=:state&#39;;
           if(city!=&#39;&#39;)
               myquery=myquery+&#39; AND Account.BillingCity=:city&#39;;
           //apply filters    
               myquery=myquery+&#39; AND size__c&gt;=:size_low AND size__c&lt;=:size_high AND CALENDAR_YEAR(CloseDate)&gt;=:b_year AND CALENDAR_YEAR(CloseDate)&lt;=:e_year AND type in(&#39;;
         }
        else
          {myquery=&#39;SELECT street__c,city__c,state__c,zipcode__c,country__c from SalesOrder__c where country__c=:country&#39;;
           if(state!=&#39;&#39;)
               myquery=myquery+&#39; AND state__c=:state&#39;;
           if(city!=&#39;&#39;)
               myquery=myquery+&#39; AND city__c=:city&#39;;
           //apply filters    
               myquery=myquery+&#39; AND size__c&gt;=:size_low AND size__c&lt;=:size_high AND CALENDAR_YEAR(Delivery_Date__c)&gt;=:b_year AND CALENDAR_YEAR(Delivery_Date__c)&lt;=:e_year AND type__c in(&#39;;
          }
         
         
          //apply type filter
          for(integer i=0;i&lt;type.size();i++)
            { 
              if(i!=type.size()-1)
               myquery=myquery+&#39;\&#39;&#39;+type[i]+&#39;\&#39;,&#39;;
              else
               myquery=myquery+&#39;\&#39;&#39;+type[i]+&#39;\&#39;)&#39;;
             }
        
        //evaluating query 
        
        if(flag.equals(&#39;True&#39;))
         { 
          for(Opportunity o:database.query(myquery))
               salesAddress.add(o.account.BillingStreet+&#39;,&#39;+o.account.BillingCity+&#39;,&#39;+o.account.BillingState+&#39;,&#39;+o.account.BillingPostalcode+&#39;,&#39;+o.account.BillingCountry);
         }
        else
         {
          for(salesOrder__c s:database.query(myquery))
               salesAddress.add(s.Street__c+&#39;,&#39;+s.City__c+&#39;,&#39;+s.State__c+&#39;,&#39;+s.ZipCode__c+&#39;,&#39;+s.Country__c);
         }
        
        return salesAddress;
    }

      
    Public void Search(){
    }
} //controller ends
]]&gt;&lt;/script&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/1770785113983682798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2012/09/salesforce-mashup-with-google-maps.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/1770785113983682798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/1770785113983682798'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2012/09/salesforce-mashup-with-google-maps.html' title='Salesforce Mashup with google maps'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMrc2kxprNYX7_kqAIR6dh4gYdBqvEe0MeX9JirTqFVNlEaA4kdT2_ulv6q47LSbj1YOgyt30R7n0j2KDMgAhm_sFEAK0xuMFxVRFMsgLrQdU3YuToJcPVhuMEdawPhgt9ATlO3d0u4TVp/s72-c/mockup.png" height="72" width="72"/><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-222446913827922506</id><published>2012-06-04T23:30:00.001+05:30</published><updated>2012-10-20T21:53:56.067+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><title type='text'>Country database android app</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
we created this app for &lt;a href=&quot;http://bitsmun.org/&quot;&gt;bitsmun&lt;/a&gt;&amp;nbsp;. The app has database for many countries which includes various country details like area,population,military,politics,constitution taken from &lt;a href=&quot;https://www.cia.gov/library/publications/the-world-factbook&quot;&gt;Cia-World factbook&lt;/a&gt;&amp;nbsp;. This is an Html5 app created using phonegap. you may find the source code &amp;nbsp;at&amp;nbsp;&lt;a href=&quot;http://munappbits.appspot.com/&quot;&gt;http://munappbits.appspot.com/&lt;/a&gt;&amp;nbsp;by viewing the source of webpage.&lt;br /&gt;
&lt;br /&gt;
Android installer : &amp;nbsp;&lt;a href=&quot;https://docs.google.com/open?id=0Bxag-fuMuJ3-RmNjMzlKcFZITUk&quot;&gt;https://docs.google.com/open?id=0Bxag-fuMuJ3-RmNjMzlKcFZITUk&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
let me know in comments , &amp;nbsp;if you want the source code of phonegap project and I will upload.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/222446913827922506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2012/06/country-database-android-app.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/222446913827922506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/222446913827922506'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2012/06/country-database-android-app.html' title='Country database android app'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-3761995169939715551</id><published>2012-04-29T21:31:00.000+05:30</published><updated>2014-03-29T19:46:53.816+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="salesforce"/><title type='text'>Dynamic SQL query when number of fields in where clause in not known</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
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.&lt;br /&gt;
A dynamic query for this case can be constructed using this trick:&lt;br /&gt;
&lt;br /&gt;
here fieldNames is the array containing names of all filters and fields is the array containing values provided by user.&lt;br /&gt;
&lt;br /&gt;
&lt;script type=&quot;syntaxhighlighter&quot; class=&quot;brush: js&quot;&gt;&lt;![CDATA[
String query=&quot;SELECT * from tableName&quot;;
String prefix=&quot; WHERE &quot;;  //notice spaces before and after WHERE
for(int i=0;i&lt;fields.length;i++){
      if(fields(i)!=null)
        {query=query+prefix+fieldNames(i)+&quot; = &quot;+fields(i);
          prefix=&quot; OR &quot;    //notice spaces before and after OR
         }
}
]]&gt;&lt;/script&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/3761995169939715551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2012/04/dynamic-sql-query-when-number-of-fields.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/3761995169939715551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/3761995169939715551'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2012/04/dynamic-sql-query-when-number-of-fields.html' title='Dynamic SQL query when number of fields in where clause in not known'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-4890571640289092984</id><published>2012-04-28T15:26:00.002+05:30</published><updated>2012-10-20T21:53:29.039+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="salesforce"/><title type='text'>Force.com Eclipse plugin installation problem</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Installation fails with error&amp;nbsp;&#39;Md5 hash not as expected&#39;&lt;br /&gt;
&lt;i&gt;original error message :&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; line-height: 18px;&quot;&gt;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.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
this happens due to corrupted download of jars by eclipse.To fix the problem follow these steps:&lt;br /&gt;
1. download all jars manually from&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.adnsandbox.com/tools/ide/install/features/&quot;&gt;http://www.adnsandbox.com/tools/ide/install/features/&lt;/a&gt; and&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.adnsandbox.com/tools/ide/install/plugins/&quot;&gt;http://www.adnsandbox.com/tools/ide/install/plugins/&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;you can use firefox plugin &#39;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/downthemall/&quot;&gt;download them all&lt;/a&gt;&#39; to download all links in one click.&lt;br /&gt;
2. put them in /features/ and /plugins/ directory of eclipse&lt;br /&gt;
3.run plugin installation again as you would do normally.It won&#39;t download the jars again and it will work without error.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;original post:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;a href=&quot;http://stackoverflow.com/a/9823562/1219463&quot;&gt;http://stackoverflow.com/a/9823562/1219463&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/4890571640289092984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2012/04/forcecom-eclipse-plugin-installation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/4890571640289092984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/4890571640289092984'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2012/04/forcecom-eclipse-plugin-installation.html' title='Force.com Eclipse plugin installation problem'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-6962512096273028804</id><published>2011-11-29T01:05:00.000+05:30</published><updated>2012-10-20T21:53:56.068+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><title type='text'>8 Puzzle,cool android game</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVgu-Z8UoALfRkmcoNvXwU2X-q3lGimyJpWqMmSIc7F85-JGpnAKkW2E_UNyGZ1icW3uh-FNTBDlAhlC_dXa8w7kt3EK1rOpEAmXZkW9U1QVQIAzKOK2lfvumz7tUgt-KFXAcRu5RZusQ/s1600/eightpuzzle.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVgu-Z8UoALfRkmcoNvXwU2X-q3lGimyJpWqMmSIc7F85-JGpnAKkW2E_UNyGZ1icW3uh-FNTBDlAhlC_dXa8w7kt3EK1rOpEAmXZkW9U1QVQIAzKOK2lfvumz7tUgt-KFXAcRu5RZusQ/s1600/eightpuzzle.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Here is a very basic puzzle created by me for android devices.Feel free to download and install..&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://sites.google.com/site/myfiles91/home/files/eight_puzzle.apk?attredirects=0&amp;amp;d=1&quot;&gt;&lt;span id=&quot;goog_253330282&quot;&gt;&lt;/span&gt;Download apk(android executable)&lt;/a&gt;&lt;span id=&quot;goog_253330283&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://sites.google.com/site/myfiles91/home/files/8puzzlecode.zip?attredirects=0&amp;amp;d=1&quot;&gt;Download source code&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/6962512096273028804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2011/11/8-puzzlecool-android-game.html#comment-form' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/6962512096273028804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/6962512096273028804'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2011/11/8-puzzlecool-android-game.html' title='8 Puzzle,cool android game'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVgu-Z8UoALfRkmcoNvXwU2X-q3lGimyJpWqMmSIc7F85-JGpnAKkW2E_UNyGZ1icW3uh-FNTBDlAhlC_dXa8w7kt3EK1rOpEAmXZkW9U1QVQIAzKOK2lfvumz7tUgt-KFXAcRu5RZusQ/s72-c/eightpuzzle.png" height="72" width="72"/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-4984188044960163640</id><published>2011-02-22T01:57:00.000+05:30</published><updated>2012-04-23T18:13:08.574+05:30</updated><title type='text'>Recover windows 7 after removing linux from a Dual boot system</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;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.&lt;br /&gt;To fix this just follow this steps and enjoy a clean windows booting.&lt;br /&gt;&amp;nbsp;&amp;nbsp;insert windows installation DVD and boot from it,select repair windows option and &amp;nbsp; then command prompt.&lt;br /&gt;&amp;nbsp;&amp;nbsp; now run the following commands&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;gt;diskpart&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;gt;select volume 0&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;gt;list volume&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; this will list the drive letter of your windows DVD.(for example G)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;gt;exit&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;gt;G: (or any other drive letter what you got)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;gt;cd boot&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;gt;dir&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;gt;bootsect /nt60 SYS /mbr&lt;br /&gt;now exit the command prompt and restart your computer,Enjoy.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/4984188044960163640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2011/02/recover-windows-7-after-removing-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/4984188044960163640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/4984188044960163640'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2011/02/recover-windows-7-after-removing-linux.html' title='Recover windows 7 after removing linux from a Dual boot system'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3962244806296778607.post-1140713687096358336</id><published>2011-02-08T17:34:00.000+05:30</published><updated>2014-03-29T19:49:08.648+05:30</updated><title type='text'>creating network applications in vb6(using winsock control)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoyCOS04jGM_g2Af4RRGH55RZcS0-uqy25ty4DHExLmKTDu7yj6UGrjcj_uar-k05iyb8VI0WDAy4NJrNZ36GuHZqvhOCFaap0zDb0wPhWp8XzTQozkK6tLsATKX4_g007y2_NWw7ua8/s1600/winsock.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoyCOS04jGM_g2Af4RRGH55RZcS0-uqy25ty4DHExLmKTDu7yj6UGrjcj_uar-k05iyb8VI0WDAy4NJrNZ36GuHZqvhOCFaap0zDb0wPhWp8XzTQozkK6tLsATKX4_g007y2_NWw7ua8/s1600/winsock.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;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&lt;b&gt;&lt;i&gt;s.&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoyCOS04jGM_g2Af4RRGH55RZcS0-uqy25ty4DHExLmKTDu7yj6UGrjcj_uar-k05iyb8VI0WDAy4NJrNZ36GuHZqvhOCFaap0zDb0wPhWp8XzTQozkK6tLsATKX4_g007y2_NWw7ua8/s1600/winsock.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSoyCOS04jGM_g2Af4RRGH55RZcS0-uqy25ty4DHExLmKTDu7yj6UGrjcj_uar-k05iyb8VI0WDAy4NJrNZ36GuHZqvhOCFaap0zDb0wPhWp8XzTQozkK6tLsATKX4_g007y2_NWw7ua8/s1600/winsock.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;To   interact with other computers vb provides a control called winsock.To   add it to your vb toolbox press &#39;CTRL+T&#39; and check the box before  &#39;Microsoft Winsock Control 6.0(SP6)&#39;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQz-oGLspMVG7omK6bsNg3coB6klYN13wVsJtVN0okR4K-7QxUGcl0fPKwZLeoq4znnyS3hAqLpIPGOsXkxQWiCiL-dD2Mf72MrYyBTv4v-DSPTdCe2369E4XDEAORWZFt1GzZ94gZF8w/s1600/winsock.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQz-oGLspMVG7omK6bsNg3coB6klYN13wVsJtVN0okR4K-7QxUGcl0fPKwZLeoq4znnyS3hAqLpIPGOsXkxQWiCiL-dD2Mf72MrYyBTv4v-DSPTdCe2369E4XDEAORWZFt1GzZ94gZF8w/s1600/winsock.jpg&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
This will add winsock control to your toolbox&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjK8uJXt7WlczPqWFq94wAaRDOk01BnYfaV3_TMbTnErJ-VVT9KdTHZO9IdyinA1xUQtCy1K_Ee5wJXZLQ_11imcmRMXPP_zrAydVFFR55Mnsr8E-pSj4Xw0nK-zwtbpdCdzG1PPyzTU4/s1600/wsck.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjK8uJXt7WlczPqWFq94wAaRDOk01BnYfaV3_TMbTnErJ-VVT9KdTHZO9IdyinA1xUQtCy1K_Ee5wJXZLQ_11imcmRMXPP_zrAydVFFR55Mnsr8E-pSj4Xw0nK-zwtbpdCdzG1PPyzTU4/s320/wsck.png&quot; height=&quot;320&quot; width=&quot;177&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;Now drag and drop this control to your form,name it ws.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;Add these controls to your form&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;CONTROL&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAPTION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;command button&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmdconnect&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connect&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;command button&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmddisconnect&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Disconnect&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;command button &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; cmdsend &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; send&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;command button &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; cmdclear &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Clear&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;command button &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; cmdserver&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Serve as server&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;listbox &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; list1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; chat window&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;textbox &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; txtip&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;textbox &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; txtdata &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;label &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; label1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Remote IP&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;label&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; label2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Enter Text below&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;your form should now look like this&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0TVf1V1zO0gT4b0a8IC0Y-b-L12AkHkmJLDyFPT7moc4jQNk5ieAyuqapxhyphenhyphenXtxNOcTUrlEvpJ9yUI2FS5HrucL9D1EqYxIa9quOEd5JIaKqfmQTLg4ORoMfDjnq4BY2NDuzWUWAqyhc/s1600/main.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0TVf1V1zO0gT4b0a8IC0Y-b-L12AkHkmJLDyFPT7moc4jQNk5ieAyuqapxhyphenhyphenXtxNOcTUrlEvpJ9yUI2FS5HrucL9D1EqYxIa9quOEd5JIaKqfmQTLg4ORoMfDjnq4BY2NDuzWUWAqyhc/s1600/main.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; 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;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Add following code to code window&lt;/span&gt;&lt;/span&gt;
&lt;script type=&quot;syntaxhighlighter&quot; class=&quot;brush: java&quot;&gt;&lt;![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 &quot;Local : &quot; + 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 &quot;Remote : &quot; + data
End Sub
]]&gt;&lt;/script&gt;

&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;save the project,make exe by &#39; FILE -&amp;gt; MAKE EXE &#39;,run two instance of exe, on first one click on &#39;serve as server&#39;,from another connect to first one by providing ip address as &#39;127.0.0.1&#39; &amp;amp; now both programs can chat.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;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.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;I am giving links to source files for ready code.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;a href=&quot;https://sites.google.com/site/myfiles91/home/files/mytuts.zip?attredirects=0&amp;amp;d=1&quot;&gt;simple chat program&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Here is a &#39;link to file transfer &amp;amp; remote file browser&#39; program.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;a href=&quot;https://sites.google.com/site/myfiles91/home/files/1ftp.7z?attredirects=0&amp;amp;d=1&quot;&gt;file transfer &amp;amp; remote file browser&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://visheshsinghal.blogspot.com/feeds/1140713687096358336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visheshsinghal.blogspot.com/2011/02/creating-network-applications-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/1140713687096358336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3962244806296778607/posts/default/1140713687096358336'/><link rel='alternate' type='text/html' href='http://visheshsinghal.blogspot.com/2011/02/creating-network-applications-in.html' title='creating network applications in vb6(using winsock control)'/><author><name>vishesh</name><uri>http://www.blogger.com/profile/10352133024644406093</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2MG6se-d_W3pdvzVHD4-E00vbMHTiL2GSw2qarSfpUlqTtWb1J8ok-TL_FeVr8zfoYCZwM-7Y9jtyoocQmk8UuXCcjlHXBGkXZoLUaC08WbpVOiEuEVcl33qg90gYaQ/s1600/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQz-oGLspMVG7omK6bsNg3coB6klYN13wVsJtVN0okR4K-7QxUGcl0fPKwZLeoq4znnyS3hAqLpIPGOsXkxQWiCiL-dD2Mf72MrYyBTv4v-DSPTdCe2369E4XDEAORWZFt1GzZ94gZF8w/s72-c/winsock.jpg" height="72" width="72"/><thr:total>1</thr:total></entry></feed>