Sunday, June 16, 2013

Google's Project Loon: Balloon-powered Internet access


The Google is introducing its new project named Project Loon to overcome the terrestrial challenges to Internet connectivity such as jungles, archipelagos, mountains, etc.

It is nothing but balloon-powered Internet access. A ring of balloons, flying around the globe on the stratospheric winds, provides Internet access to the earth below. These balloons are carried by the wind at altitudes twice as high as commercial planes and they beam Internet access to the ground at speeds similar to today’s 3G networks or faster. The team hopes that the balloons could become an option for connecting rural, remote, and under-served areas, and for helping with communications after natural disasters.

The major challenges include-
(1) Trying to keep the balloons in one place requires a system with major cost and complexity.
The idea they pursued was based on freeing the balloons and letting them sail freely on the winds. To control their path through the sky they use just wind and solar power- moving the balloons up or down to catch the winds they want them to travel in.

(2) How to manage a fleet of balloons sailing around the world so that each balloon is in the area we want it right when we need it.
This is solved with some complex algorithms and lots of computing power.



They say-
"We imagine someday you'll be able to use your cell phone with your existing service provider to connect to the balloons and get connectivity where there is none today. This is still highly experimental technology and we have a long way to go — we’d love your support as we keep trying and keep flying!"
Courtesy: Google Blog

Talend Equivalent for Index Function in Datastage

 
package routines;

public class UserString {

	public static int Index(String string, String substring, Integer instance) {
	    	int index = -1;
	    	if (string == null) {
	    		return 0;
	    	}
	    	if (substring == null) {
	    		return 0;
	    	}
	    	if (substring.equals("")) {
	    		return 1;
	    	}
	    	if (instance == null) {
	    		throw new UnsupportedOperationException("Instance is supposed to be NOT NULL!!");
	    	}
	    	if (!string.contains(substring)) {
	    		return 0;
	    	}
	    	
	    	index = string.indexOf(substring, 0);
	    	
	    	while (--instance > 0 && index != -1) {
	    		index = string.indexOf(substring, index + 1);
	    	}
	    	    	
	    	return ++index;
	}
}

Talend Equivalent for TRIM Function in Datastage

 
package routines;

public class UserString {

    /**
     * 
     * L Removes leading occurrences of character.
     * T Removes trailing occurrences of character.
     * B Removes leading and trailing occurrences of character.
     * R Removes leading and trailing occurrences of character, and reduces multiple occurrences to a single occurrence.
     * A Removes all occurrences of character.
     * F Removes leading spaces and tabs
     * E Removes trailing spaces and tabs
     * D Removes leading and trailing spaces and tabs, and reduces multiple spaces and tabs to single ones.
     */
    public static String TRIM(String str, String character, String option) {
    	String returnStr = "";
    	if (str == null) {
    		return null;
    	}
    	if (option.equals("L")) {
    		returnStr = str.replaceFirst("^" + character + "+", "");
    	} else if (option.equals("T")) {
    		returnStr = str.replaceAll("[" + character + "]+$", "");
    	} else if (option.equals("B")) {
    		returnStr = str.replaceFirst("^" + character + "+", "");
    		returnStr = returnStr.replaceAll("[" + character + "]+$", "");
    	} else if (option.equals("R")) {
    		returnStr = str.replaceFirst("^" + character + "+", "");
    		returnStr = returnStr.replaceAll("[" + character + "]+$", "");
    		returnStr = avoidMultipleOccurrence(returnStr, character);
    	} else if (option.equals("A")) {
    		returnStr = str.replaceAll(character, "");	
    	} else if (option.equals("F")) {
    		returnStr = TRIM(str, " ", "L");
    		returnStr = TRIM(returnStr, "\t", "L");
    	} else if (option.equals("E")) {
    		returnStr = TRIM(str, " ", "T");
    		returnStr = TRIM(returnStr, "\t", "T");
    	} else if (option.equals("D")) {
    		returnStr = TRIM(str, "", "F");
    		returnStr = TRIM(returnStr, "", "E");
    		returnStr = avoidMultipleOccurrence(returnStr, " ");
    		returnStr = avoidMultipleOccurrence(returnStr, "\t");
    	} 
    	return returnStr;
    }
    
    public static String TRIM(String str) {
    	return (str == null) ? null : TRIM(str, " ", "R");
    }
    
    public static String avoidMultipleOccurrence(String input, String character) {    	
    	if (input == null) {
    		return null;
    	}
    	if (input.length() == 0) {
    		return input;
    	}
    	StringBuilder output = new StringBuilder();
    	output.append(input.charAt(0));    	 
    	for (int idx = 1; idx < input.length(); idx++) {
    		if (Character.toString(input.charAt(idx)).equals(character)) {
	    	    if(input.charAt(idx) != input.charAt(idx-1)) {
	    	        output.append(input.charAt(idx));
	    	    }
    	    } else {
    	    	output.append(input.charAt(idx));
    	    }
    	}
    	return output.toString();
    }
}

Talend Equivalent for MatchField Function in Datastage

 
package routines;

import java.util.regex.*;

public class UserString {

	public static String MatchField(String sourceStr, String patternStr, Integer fieldNo) {
		String matchedStr = "";
		
		if (fieldNo == null) {
			throw new UnsupportedOperationException("fieldNo is supposed to be NOT NULL!!");
		}
		if (patternStr == null) {
			return "";
		}
		if (sourceStr == null) {
			return "";
		}
		
		patternStr = formatPatternDStoTld(patternStr);
		Pattern pattern = Pattern.compile(patternStr);
		Matcher matcher = pattern.matcher(sourceStr);
		if (matcher.find()) {        			
			matchedStr = matcher.group(fieldNo);
		} else {		
			matchedStr = "";
		}
		return matchedStr;
	}
	
	
	public static String formatPatternDStoTld(String input) {
		StringBuilder output = new StringBuilder();
		String outputStr = "";
		for (int i = 0 ; i < input.length() ; i++) {
			Character firstChar = input.charAt(i);
			if (Character.isDigit(firstChar)) {
				Character secondChar = input.charAt(i + 1);
				int occur = Integer.parseInt("" + firstChar);
				if (Character.isDigit(secondChar)) {
					occur = (occur * 10) + Integer.parseInt("" + secondChar);
					i++;
					secondChar = input.charAt(i + 1);    				
				} 
				if (Character.isLetter(secondChar)) {
					if (secondChar == 'A') {
						output.append("([a-zA-Z]");
					} else if (secondChar == 'N') {
						output.append("(\\d");
					} else if (secondChar == 'X') {
						output.append("([a-zA-Z0-9 ]");
					}
					if (occur == 0) {
						output.append("*)");
					} else {
						output.append("{" + occur + "," + occur + "})");
					}
					i++;
				} else {
					output.append("(" + firstChar + ")");
				}
			} else {
				output.append("(" + firstChar + ")");    			
			}
		}
		outputStr = output.toString();	
		return outputStr;
	}
}

Contact Form

Name

Email *

Message *