Tuesday, March 29, 2011

Latest earthquakes in the World

Very usefull online information tool to get info for latest earthquakes and volcanos in the world

Monday, March 28, 2011

How long does it take to drive through Riga city ?

I must say that this is not a story about THIS. My approach was more realistic and much safer :)I took my car to drive through city Riga from one city border to another simply to check how much time do i need to get through this city within legal limits.

Thursday, March 24, 2011

Get current SharePoint User with JavaScript

During the SharePoint form customization in many cases it is important to know the current user. So with JavaScript and SharePoint Designer this is how it's done:

var loginElement = document.getElementById("zz7_Menu").innerHTML;
var end = loginElement.indexOf("<");
var nameOnly = loginElement.substring(8, end);

note: I use this script in MOSS2007, but if you use this in WSS3 change "zz7_Menu" to "zz6_Menu".

My whole point using this script was to get the current username (in my case organization username format is: username14, username57 etc.) And based on that I need to get only numbers from this username. So there is my complete solution:

var loginElement = document.getElementById("zz7_Menu").innerHTML;
var end = loginElement.indexOf("<");
var nameOnly = loginElement.substring(8, end);
var number = nameOnly.replace (/[^\d]/g, "");
var k;

if (number != "") {
var elements = document.getElementsByTagName('select');
for (var i = 0; i < elements.length; i++) {
if (elements[i].title == 'YOUR DROPDOWN TITLE'){
var sel = elements[i].options.selectedIndex = number;
for (k=elements[i].options.length-1;k>=0;k--) {
if (k != sel) {
elements[i].remove(k);
        }
      }
    }
  }

}

Tuesday, March 22, 2011

How to get CRM grid View Id

If we add this piece of code to ISV.config we get the current View Id currently displayed in the CRM grid:

if (top.stage.crmGrid != null)
{
    var ViewID = top.stage.crmGrid.GetParameter('viewid');    

    alert(ViewID);
}

Train Tracking with GPS

Last Saturday I took a trip on a train from Riga to Saulkrasti (45km). Weather was pretty cloudy but I thought maybe I could get interesting info from this trip with my gps. This is my gps data report

Train model: ER2T