Sunday, September 17, 2017

Show meeting attendees in organizational chart

Introduction


In this post I will show how to generate an organisational chart from Outlook, like displayed in the video below:



View the video below for installation instructions:


The Tools and data



The code

You need code below to import your adress book / active directory data:

Code to load the active directory users in Neo4J:
  
LOAD CSV FROM 'file:///AD.csv' AS line
CREATE (:Person { name: line[0], department: line[1], title: line[2], manager: line[3] })

The code below will create the relationship between person and manager:
  
USING PERIODIC COMMIT 500
LOAD CSV FROM 'file:///AD.csv' AS line
MATCH (p { name: line[0]}),(m { name: line[3]})
CREATE (p)-[:HAS_MANAGER]->(m)

Code for the webpage required script1, and script2.
  


Organizational Chart























Code to paste in Outlook.
  


Public Function URLEncode( _
StringVal As String, _
Optional SpaceAsPlus As Boolean = False _
) As String

Dim StringLen As Long: StringLen = Len(StringVal)

If StringLen > 0 Then
ReDim result(StringLen) As String
Dim i As Long, CharCode As Integer
Dim Char As String, Space As String

If SpaceAsPlus Then Space = "+" Else Space = "%20"

For i = 1 To StringLen
Char = Mid$(StringVal, i, 1)
CharCode = Asc(Char)
Select Case CharCode
Case 97 To 122, 65 To 90, 48 To 57, 45, 46, 95, 126
result(i) = Char
Case 32
result(i) = Space
Case 0 To 15
result(i) = "%0" & Hex(CharCode)
Case Else
result(i) = "%" & Hex(CharCode)
End Select
Next i
URLEncode = Join(result, "")
End If
End Function

Sub open_webpage()

Dim objApp As Outlook.Application
Dim objItem As Object
Dim objAttendees As Outlook.Recipients
Dim strNames As String
Dim chromePath As String

Set objApp = CreateObject("Outlook.Application")
Set objItem = Outlook.Application.ActiveExplorer.Selection.Item(1)
Set objAttendees = Outlook.Application.ActiveExplorer.Selection.Item(1).Recipients
chromePath = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"""

For x = 1 To objAttendees.Count
strNames = strNames & objAttendees(x).Name & ";"
Next

strNames = URLEncode(strNames)

Dim stradres As String
stradres = "http://localhost/orgchart.html?Names=" & strNames
Shell (chromePath & " -url " & stradres)


Set objApp = Nothing
Set objItem = Nothing
Set objAttendees = Nothing

End Sub


Sunday, September 3, 2017

Inkomens analyse (deel 3)

Dit is het laatste deel van de serie over inkomensanalyse. Klik hier voor deel 1, en hier voor deel 2. Hieronder volgen weer dashboards per onderzoeksvraagn.
Welke gemeenten hebben een hoge correlatie tussen stijging inkomen en stijging ongelijkheid.


Hoge groei en correlatie tussen groei gem. inkomen en ongelijkheid.


Saturday, September 2, 2017

Inkomens ontwikkeling (deel 2)


Dit is deel 2, van de serie over inkomensanalyse in Nederland. In deze serie beantwoorden we een aantal onderzoeksvragen. Hieronder volgt weer per onderzoeksvraag een dashboard.
Waar was de groei het grootst?




In welke gemeente is de inkomens ongelijkheid toegenomen?

Klik hier om naar deel 3 van de serie te gaan.

Sunday, August 20, 2017

Inkomens ontwikkeling bekeken per gemeente

Inleiding

Recentelijk heb ik enkele dashboards gedeeld waarmee je ontwikkeling in rentestanden kunt analyseren. Hierdoor krijg je hopelijk een beter beeld van de hypotheekmarkt.

Het bedrag dat je moet lenen hangt af van de prijs die je betaalt voor de betreffende woning. Wat is nu een realistich aankoop bedrag en hoe zal die prijs zich in de toekomst ontwikkelen? Over het algemeen wordt gesteld: 'Prediction is difficult, especially about the future', waardoor adviezen over dit onderwerp sterk uiteenlopen. 

Persoonlijk leek het mij zinvol trends aan zowel de vraagkant als aanbod kant in kaart te krijgen. Funda.nl geeft je verschillende mogelijkheden om de aanbodkant te analyseren. Hoe zit het echter aan de vraagkant? We hebben gezien dat de hoogte van de rente invloed heeft op de vraagkant. Er zijn volgens mij veel indicatoren beschikbaar die een meer fundamenteel beeld van de vraagkant geven. Om die reden leek het mij zinvol om in kaart te brengen hoe de inkomens zich in Nederland hebben ontwikkeld in de periode van 2008 t/m 2014. 

De data

De ruwe data heeft het CBS ter beschikking gesteld. Deze dataset bevat uit twee meetwaarden;
- Gemiddeld gestandaardiseerd (obv gezinssamenstelling) inkomen.
- Median gestandaardiseerd inkomen. 
En dit per jaar, per gemeente. 

Helaas is de variantie of standaard deviate niet beschikbaar. Gelukkig kan je met de median en het gemiddelde wel iets zeggen over de inkomens(on)gelijkheid. Liggen de mediaan en het gemiddelde ver uit elkaar dan kan je stellen dat de inkomensongelijkheid groot is. Als het gemiddelde veel groter is dan de mediaan, dan is er een grote kans dat er bijv. enkele rijke gezinnen het gemiddelde omhoog trekt. 

Onderzoeksvragen

Met deze dataset kan je een aantal vragen beantwoorden.

- Welke gemeentes hebben momenteel gemiddeld het hoogste inkomen.
- Welke gemeentes zijn het meest hetrogeen qua inkomen?
- Welke gemeentes zijn het meest homogeen qua inkomen?
- Met hoeveel procent is het gemiddeld inkomen gestegen in de periode van 2008-2014.
- Waar was de inkomensgroei het grootst?
- In welke gemeente is de inkomens(on)gelijkheid gestegen of gedaald.
- Welke gemeenten hebben een hoge correlatie tussen stijging inkomen en stijging ongelijkheid.




Hieronder toon ik per onderzoeksvraag een dashboard.

Welke gemeentes hebben momenteel gemiddeld het hoogste inkomen.





Welke gemeentes zijn het meest hetrogeen qua inkomen in 2014?



Welke gemeentes zijn het meest homogeen qua inkomen in 2014?





Klik hier om naar deel 2 van de serie te gaan.

Plug and Play formula for correlation in DAX

As you might have seen, I wrote a blog article to calculate correlation in DAX. This was done by defining multiple measures that were used in the final correlation formula. The drawback of this approach was that it was quite time consuming to create a new correlation formula with other columns, the number of calculated measures increased and performance was not optimal.

I tried to tacle the above drawbacks and this resulted in the following formula:


Correlation = 
var cv = VALUES ( Data[Perioden] )
var cas = ALLSELECTED ( Data[Perioden] )
var x_sd = CALCULATE (STDEVX.P ( cv, [x]), cas )
var y_sd = CALCULATE (STDEVX.P ( cv, [y]), cas )
var SD_Product = CALCULATE ( x_sd * y_sd )
var x_mean = CALCULATE ( AVERAGEX ( cv, [x] ), cas )
var y_mean = CALCULATE (AVERAGEX ( cv, [y] ), cas )
var vDiff_Mean_Product =
CALCULATE ( AVERAGEX (
cv,
( [y] - y_mean ) * ([x] - x_mean )
),
cas
)
return
CALCULATE ( vDiff_Mean_Product / SD_Product)

All you need to do is replace X and Y with the (calculated) measures for which you would like to know the correlation.

The first two variables cs and cas represent the dimension that define the array of values used to calculate the correlation. So your slicers could result in subset for a certain product, geo location, etc. Then with that selection made you would like to know the correlation over a selected period. In that case period is respresented by 'Data[Perioded]'.

By using variables, performance might be improved because the number of times that specific calculation is done will be limited.

I hope you find this calculation usefull. Suggestions and feedback are much appreciated.

Monday, June 5, 2017

Boerderijwinkels regio Eindhoven

Op zoek naar verse producten van het land? Ik heb een kaart gemaakt waarop de boerderijwinkels in de regio Eindhoven zichtbaar zijn. Met name ten weste en zuiden van Eindhoven.

Bron: http://www.bijteun.nl , http://www.krentjesuitdepap.nl en google.nl



Sunday, May 28, 2017

Ontwikkelingen in de hypotheekmarkt

In deze post toon ik enkele analyse mogelijkheden mbt de hypotheek markt.

In februari heb ik de rente standen van http://www.actuelerentestanden.nl/pages/rente/hypotheekrente-overzicht/1-jaar-rente-vast.asp opgeslagen. Dit heb ik in mei weer gedaan.

Dit maakt het mogelijk om veranderingen in kaart te brengen. Het onderstaande dashboard laat dit zien voor de rentes met een looptijd van 10 jaar. De hypotheken hebben een ranking gekregen zodat je de positie verschuiving van februari naar mei in kaart kunt brengen.

De parameter rechts stelt je in staat het financieringspercentage te kiezen.

Het bovenstaande overzicht is echter beperkt tot een looptijd van 10 jaar. In het onderstaande overzicht zie je voor alle looptijden de ranking in febuari.



Hieronder zie je het overzicht van de ranking in mei.



Vervolgens kan je de positieverschuiving analyseren. Welke observaties maak jij? Je reactie in het commentaar gedeelte wordt op prijs gesteld!


Nieuw:
Selecteer de looptijden naar wens en de hypotheken met de meest gunstige rente verschijnen bovenaan!!





Friday, May 26, 2017

Netto Maandlasten berekenen

Deze post is in het Nederlands omdat deze betrekkening heeft op de Nederlandse regelgeving.

Met dit dashboard kun je je Netto maandlasten (over de tijd) berekenen. Dit begint bij de totale kosten (1), om vervolgens te bepalen wat het financieringsbedrag bedraagt (2), ten slotte worden de netto maandlasten berekend o.b.v. de rente (3).

Ter info: standaard staan alle sliders op dit dashboard op de minimale waarde. De netto maandlasten geven dus niet de persoonlijke situatie van iemand weer.

1. Totale kosten
De totale kosten worden berekend als de som van:
A: Kavelprijs.
B: Totale M3 prijs.
Vanzelfsprekend kun je voor een bestaande woning A en B zo zetten dat het totaal correspondeert met het aankoopbedrag.

2. Financieringsbedrag.
Deze wordt bepaald door:
Totale kosten minus
a. Spaarsaldo
b. Verkoopwaarde huidige huis - resthypotheek.
Financieringsbedrag + overdrachtsbelasting (2%) + extra kosten

3. Netto Maandlasten.
Het bepalen van de netto maandlasten hang af van:
a. Verdeling aflossingsvrij, bankspaar en annuiteit.
b. Rentes.

3a.
Ik ga uit van een bestaande hypotheek met een deel aflossingsvrij en een deel bankspaar. Ik neem aan dat je deze wil meenemen naar de nieuwe lening om nog van de oude regeling gebruik te kunnen maken: hypotheekrente aftrek van bijv. 52% gedurende de resterende periode van de lening.
Je kunt met de sliders het totale leningsbedrag voor zowel aflossingsvrij als banksparen instellen. Te financieren minus deze twee bedragen geeft het annuiteitsbedrag. Deze is in de komende jaren beperkt aftrekbaar.
https://www.belastingdienst.nl/wps/wcm/connect/bldcontentnl/belastingdienst/prive/woning/uw_hypotheek_of_lening/tariefsaanpassing_aftrek_kosten_eigen_woning/tariefsaanpassing_aftrek_kosten_eigen_woning
Voor het annuiteitsdeel worden de netto bedragen volgens deze regeling bepaald.

3b.
Je kunt per rente deel de rente instellen. De rente die je kunt krijgen is afhankelijk van het financieringspercentage. Deze is boven weergegeven.

Zie ik iets over het hoofd? Kan je deze post waarderen? Schroom niet om feedback achter te laten op deze post of de linkedin share. Bedankt!

p.s. Je kunt het dashboard op volledige schermweergave zetten, rechts onder. De waarden instellen en vervolgens een pdf van je situatie downloaden.




Sunday, May 7, 2017

Analyze mortgage rates in Netherlands (March 2017)

In this post I would like to share the dashboard I created to Analyze the Analyze mortgage rates in Netherlands (March 2017). I built the dashboard very quickly. Drop a comment to get a copy so you can improve it yourself.



I tried Qlik Sense Qloud, but it turns out you need the enterprise license to embed the dashboard. This is a quick video get an impression.


Saturday, May 6, 2017

Parcel (Kavel) analysis for Eindhoven region -> Veldhoven -> Oerle Zuid

Hi,

In this post, I would like to share a dashboard which I created to analyze parcel pricing, parcel dimensions, and square meter prices.

The steps I did:
- parse data from http://www.kavelsveldhoven.nl/oerle-zuid
- Create a Synoptic map https://synoptic.design/
- Create the dashboard.

I hope this Dashboard is of use to you:

Saturday, April 1, 2017

AWS, R, RStudio, Parallel processing

In this post I will share my experiences with using a spot AMI instance for heavy parallel processing of R scripts.

Fist we start a Rstudio AMI:



Start a spot instance:




Request:

Search AMI:


Search for Rstudio:


select the needed compute power:



Its recommended to look at the pricing history:



In this case, we select a General Purpuse 16 CPU machine, which has a fair price per hour. Since we only use the machine for some heavy processing, we will decommission it in a few hours.



Leave the other settings as is.

select next, be sure to create a new key pair, in case you do not have the original key pair.
Its also good to add a new security group which has port 80 open:



open the ports:


The click 'Launch' instance, and then click op the capacity link;

Look up the public IP:

You should now be able to log on:

Log on credentials can be found here:
http://www.louisaslett.com/RStudio_AMI/

Now that the server is up and running we can start using R packages to allow parallel processing:
  
install.packages("doParallel",dependencies=TRUE)
install.packages("doMC",dependencies=TRUE)

We use the package
  
library(doParallel)
library(foreach)
library(doMC)

In order to initialize we;
- set the number of cores.
- initialize a cluster
-and we need to export our functions, variables and datasets to the clusters:
  
#prep parralel processing
# Calculate the number of cores
no_cores <- detectCores() - 1
# Initiate cluster
cl <- makeCluster(no_cores)
registerDoMC(no_cores)
clusterExport(cl=cl, varlist=c("splitter", "create_ngram_table"))

There are a number of options for parralel processing roughly speaking you can choose from ParLapply and forEach. When you would like to split your dataset in multiple subsets and want to have a worker node perform an operation this can easily be done with a forEach, see example below. In both cases a list is returned. While we usualy would like to have a full dataset in return. In order to achieve this result I used the code do.call("rbind", result).

Many more examples can be found on: http://gforge.se/2015/02/how-to-go-parallel-in-r-basics-tips/
  
result = foreach(j=seq(1,nl, by=(nl/parts))) %dopar% {
}
}
}
do.call("rbind", result)
}

Monday, March 27, 2017

Build your custom Geo solution for QlikView in 5 minutes

In this post I will show how to build a Geo plot without the need for GeoAnalytics or Indevio. It will be way more limited functionality wise, you will be able to plot your data on a map. The result will look like this:


First you need a map of which you need to know the lat and long coordinates of the square corners. For this navigate to:
https://www.darrinward.com/lat-long/?id=2778191

Enter a set of coordinates for the corners:


Take a screen capture starting and ending on the specified corners:



In QlikView add a new scatter chart:

Add the lat and long dimensions:



Specify the axis:

Enter next untill this screen. Deselect 'forced 0' and enter the x and y axis ranges, by using the values you used on lat-long website:

As background image to the chart load the screen capture of the lat-long website:

Press finish and your result will look like this:


Obviously, you need to geo code your adress data. This can easily be done by most ETL tools.

Hope this is usefull.

Sunday, March 19, 2017

BI and Analytics on your action cam video (GoPro, TomTom Bandit, etc)

In this post I will show some tips and tricks to add BI to your action cam video, specifically the TomTom Bandit, on Windows 10 with Dashware.

The result looks like this:






To start with the really tricky part, getting Dashware to work on Windows 10.

I also tried to use Racerender, but Dashware proved to be the tool of choice for me. Unfortunately, the latest version does not work on windows 10. I did get it to work with version 1.7. Which can be downloaded here: http://dashware.software.informer.com/1.7/

In order to get it working you first need to remove MFPLat.dll and then run the executable from the program folder:


Since I am using the TomTom Bandit, I will also extract the GPX information from the video. This can be done from TomTom Bandit Studio:


Right click the video to export the GPS data.

Then we start a new project in Dashware, remember to start the application by running the exe from the program folder. Select 'None'  as project template.


Click the plus to add a video:

We choose not to extract the GPS data:


Then we add the data file:

Select to synch the GPS file:


Now the fun part, we add our BI components:

And start customizing!


Enjoy!


Copy Paste Images from Clipboard in Blogger / Blogspot

I have always found it a bit annoying that it's necessary to upload images to Blogspot before being able to display them:
For this reason, I started looking for a windows application with a paste from clipboard option for images. Unfortunately, I was not able to find a free/open source solution. For this reason, I decided to build a workaround.

In this post I will explain how this works.

The basic idea is to use GreenShot for image capturing, an AWS server that hosts the images, a PuTTY pscp script to upload the file, and to copy a HTML text to the clipboard which you can paste into blogger.

This shows how the final solution works:

First start a screen capture with Greenshot:



And then select the option "upload". The script will then kick off and upload the screen capture to the AWS Server and return the HTML code that needs to be copied into Blogger:


This code is then copied into the HTML part of blogger:
Within Greenshot its possible to specify external commands. With this option a Bach file is started:

In here we configure the pointer to the batch file:
Also, in the settings, set the file format of the capture to hh mm to make sure the file names do not have spaces.



The batch file looks like this:


This script takes the path of the screen capture as a parameter and then uploads the file to the AWS Webserver. Unfortunately, the clip.exe command turned out the be buggy so I pasted the html code in a text document and then open this document with Notepad.

The webserver is a default (free of charge web-hosting AWS AMI):
First navigate to EC2 for elastic cloud options:

Launch an instance:

Search for the Wordpress AMI:

Select the free hosting option;

Then press next untill you get the option 'launch', press this as well. You will the see the screen to select a key pair, this is important:

Download the PEM file, we need this is the next step:
Use this file to create a pkk file, these steps have been described here:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html

Then, build the transfer script as described in the manual:

This script in part of the upload script: