Tuesday, October 7, 2014

Nexus 6: Android Flagship of 2014 in detail

Latest news about the new Google Nexus 6 talk about Motorolas Turbo-Charging Mode and QHD display with 5.9 inch.

Rumors collected during the last few weeks now form a pretty clear image about the specification of the latest smartphone branded as Nexus. According to its name Nexus 6 the phone will have a 5,9 inch screen. This QHD screen (2.560 x 1.440 pixel) covers the majority of the front design.

Monday, August 25, 2014

App Script Form to add a Calender Event

Google App Script allows you to automate work flows and create Add-ons with Google Sheets, Docs and Forms. It is also possible to integrate external Google Apps.

One example is to create a Google Calender Entry or Event with an App Script. The following code snipped gives you the idea how it works:

The function doget() is responsible to define the form to enter data needed to create the event. It defines the clickhandler of the submit button.

 function doGet() {  
  var app = UiApp.createApplication();  
  var form = app.createFormPanel();  
  var grid = app.createGrid(5, 3).setId('gridForm');  
  var eventTitle= app.createTextBox().setName("eventTitle").setTitle("Event Title");  
  var descr= app.createTextBox().setName("descr").setTitle("Description");  
  var lbFromDate = app.createDateBox().setName("lbFromDate").setFormat(UiApp.DateTimeFormat.DATE_TIME_SHORT).setTitle("From");  
  var lbToDate = app.createDateBox().setName("lbToDate").setFormat(UiApp.DateTimeFormat.DATE_TIME_SHORT).setTitle("To");  
  var btnSubmit = app.createButton("Create");  
  var titleRequired= app.createLabel("*").setId('titleRequired');  
  var lblFromDateRequired = app.createLabel("*").setId('lblFromDateRequired');  
  var lblToDateRequired = app.createLabel("*").setId('lblToDateRequired');  
  grid.setWidget(0, 0, app.createLabel("Titel"));  
  grid.setWidget(1, 0, app.createLabel("Description"));  
  grid.setWidget(2, 0, app.createLabel("Von"));  
  grid.setWidget(3, 0, app.createLabel("Bis"));  
  grid.setWidget(0, 1, eventTitle);  
  grid.setWidget(1, 1, descr);  
  grid.setWidget(2, 1, lbFromDate);  
  grid.setWidget(3, 1, lbToDate);  
  grid.setWidget(4, 1, btnSubmit);  
  grid.setWidget(0, 2, titleRequired);  
  grid.setWidget(2, 2, lblFromDateRequired);  
  grid.setWidget(3, 2, lblToDateRequired);  
  form.add(grid);  
  app.add(form);  
  //Controles and click handler  
  var submitHandler = app.createServerClickHandler('validateAndCreate');  
  submitHandler.addCallbackElement(eventTitle)  
   .addCallbackElement(descr)  
   .addCallbackElement(lbFromDate)  
   .addCallbackElement(lbToDate);  
  btnSubmit.addClickHandler(submitHandler);  
   return app;  
  }  

By pressing the submit button the function validateAndCreate will be executed. This function implements a simple check of the input data an creates the Google Calender Event within the given Calendar (defined by the Calendar ID).

  function validateAndCreate(eventInfo) {  
   var app = UiApp.getActiveApplication();  
   var flag = 0;  
   var currentTimestamp = new Date();  
   app.getElementById('eventTitle').setText("*");  
   app.getElementById('lblFromDateRequired').setText("*");  
   app.getElementById('lblToDateRequired').setText("*");  
   if (eventInfo.parameter.eventTitle== ''){app.getElementById('titleRequired').setText("* Title Required").setStyleAttribute("color", "#F00");flag = 1;}  
   if (eventInfo.parameter.lbToDate < eventInfo.parameter.lbFromDate){app.getElementById('lblToDateRequired').setText("* To Date must be later than From Date").setStyleAttribute("color", "#F00");flag = 1;}  
   if (eventInfo.parameter.lbFromDate == ''){app.getElementById('lblFromDateRequired').setText("* From Date required").setStyleAttribute("color", "#F00");flag = 1;}  
   if (eventInfo.parameter.lbToDate == ''){app.getElementById('lblToDateRequired').setText("* To date required").setStyleAttribute("color", "#F00");flag = 1;}  
   if (flag == 0){  
    var calendarId = "PUT_IN_HERE_YOUR_CALENDERID";  
    var startDt = eventInfo.parameter.lbFromDate;  
    var endDt = eventInfo.parameter.lbToDate;  
    var desc = eventInfo.parameter.desc + " created: " + currentTimestamp;  
    var title = eventInfo.parameter.eventTitle;  
    //Run the Crete event Function  
    createEvent(calendarId,title,startDt,endDt,desc);  
    app.getElementById('gridForm').setVisible(false);  
    app.add(app.createLabel("Event Created.");  
   }  
   return app;  
  }  
 function createEvent(calendarId,title,startDt,endDt,desc) {  
  var cal = CalendarApp.getCalendarById(calendarId);  
  var start = new Date(startDt);  
  var end = new Date(endDt);  
 //Manually set the Location, this can be modified to be dynamic by modifying the code if need be  
  var loc = 'YOUR LOCATION';  
 //Set the Options, in this case we are only using Description and Location, as we do not need Guests or sendInvites  
  var event = cal.createEvent(title, start, end, {  
    description : desc,  
    location : loc  
  });  
 }  

Then you can embed the App Script within your Google Sites page to visualize the form.

Tuesday, June 17, 2014

Install a Nest Thermostat in Europe

Currently the NEST thermostat is only available in the USA and Canada. But is it possible to install the Thermostat in also on the other site of the ocean? Recently the distribution was extended to the UK also, but on mainland Europe there is no official support.
Nevertheless it is possible to install the NEST thermostat in the rest of Europe. With the update to NEST software version 4.0 it is now possible to set postal codes in Europe. With this setting time zones are set correctly. More info on the update can be found here.

Sunday, April 13, 2014

Android 4.5 Screenshots leaked - Codename Lollipop

Android 4.4.3 will be the next Android release. This release will only include bug fixes but no new features. The next big version of Android will be Android 4.5 and probably called Lollipop. It is very likely that this new version is introduces at Google I/O in June 2014.
We are looking forward for the new and improved features of Android 4.5.

New Multitasking with Project "HERA"

According to several leaks Google is working to improve its multitasking by combining Chrome and Google Search. It will execute tasks through the web. HTML 5 will be used as technology to show the actions being taken in a multitasking menu, where the users will be able to switch between tasks.

Android 4.5 other new features

Many other features are leaked a few days ago. the new Gmail app will introduce a completely new interface. As Android 4.5. will integrate HTML 5 directly to the operating system we can expect even more exciting features. This is also proved by some screenshots of the calender app.
Android Lollipop will probably com with the Google Nexus 8 in June or July. Stay tuned.

Tuesday, April 1, 2014

Leaflet and CartoDB - The perfect combination

What is currently the most easy and convenient way to publish geographic data stored within a database via the web? One easy way doing so is the combination from Leaflet and CartoDB.

Leaflet is an open source library for publishing online maps. The JS library is lightweight (just 33 KB), and has all the features most developer expect from interactive maps. Furthermore functionalities can be extended via plug-ins developed by the open source community around leaflet.

CartoDB is a online database which can also be published on an own web server. The database allows to store geographic entities with geometry type point, lines and polygon. The database provides several APIs including an SQL API where it is possibly to execute native SQL queries. In addition CartoDB provides a leaflet JS plug in to access data directly as layer.

Some basic example to start with:

1) Create sample Data within CartoDB
2) Include Leaflet and CartoDB JS libraries within your HTML page.
3) Create a Leaflet map object and link it to a DIV object within the HTML page:

HTML part:
<div id="map" ></div>
JavaScript part:

// create a map in the "map" div, set the view to a given place and zoom var map = L.map('map').setView([51.505, -0.09], 13);

4) add a basemap Layer (e.g. Openstreetmap) to the map)

// add an OpenStreetMap tile layer L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map);

4) add sample data stored witin Cartodb to the map

// add an Cartodb layer var cartodb_leaflet = new L.CartoDBLayer({
        map: map,
        user_name: "user_name",
        table_name: "table_name",
        query: "SELECT * FROM {{table_name}}",
        tile_style: "#{{table_name}}{polygon-fill:blue;  polygon-opacity: 0; line-color: yellow;  line-width: 5;  line-opacity: 0.7}",
        interactivity: "cartodb_id",
        featureClick: function(ev, latlng, pos, data) { },
        featureOver: function(){},
        featureOut: function(){},
        attribution: "CartoDB",
        auto_bound: true
      });
map.addLayer(cartodb_leaflet);


5) finnished.