My first Apex trigger (The ‘Hello World’ approach)

I’m a programmer, a developer at heart. When I encounter a new programming environment and/or language, I want to ‘see’ it working. No manuals, no training, no nothing. Just get it working on my own. For this we have the ‘Hello World’ approach. The most simple ‘one-line’ code which works and by which you have touched the basic parts of the new environment to get things going.

Here I’m getting to know Apex, the programming language of Salesforce. As I start from zero, I know nothing. I heard someone talk about ‘triggers’. Apparently you can use Apex triggers to perform some stuff. A trigger, in this case, is an action which does something at the moment you make changes to the database (to a record).

Ok, how can I ‘see’ this working? Well, I simply try a very easy thing. In Salesforce there is the Contact object. I create an extra field on this Contact object. A ‘custom field’ which I call ‘Apextest’ (text(50)). And now I want this ‘Apextest’ field filled with the LastName of the Contact (a copy). So, I need a ‘trigger’ which does this copy action whenever I insert or update the Contact (record). And in this trigger I need to specify the ‘copy’ action. Below you will find the steps in shorthand:

– Create custom field Apextest (text(50)) on Contact
– Put it on a Page-layout for you to see it:)
– The Api name of that Apextest field comes out as Apextest__c

Now we need to create the trigger on Contact

– Setup > Build > Develop > Apex triggers
– Click ‘Developer Console’
– File > New > Apex Trigger

Paste the following code

trigger Apextest on Contact (before insert, before update) {
for (Contact c : {
c.Apextest__c = c.LastName;

– Save

In the Apex Trigger list (after refresh) you will now see the trigger ‘Apextest’. And it is active

– Goto to Contacts
– Pick a Contact
– Probably the Apextest field is still EMPTY (because the record has not been changed/touched yet)
– Click Edit
– Click Save

Now the (update) triggers which are defined on Contact are activated

– Check the content of the Apextest field

It should hold a copy of the LastName of the Contact

Congratulations, and welcome to the world of Salesforce Apex programming :)

My first Apex trigger


Microsoft has to upgrade the Xbox One to support VR (Scorpio)

Microsoft insider Brad Sams wrote on, saying that he expects to see new hardware and a new controller at E3. So what hardware could that be? My guess (and hope) is that Microsoft announces a VR capable upgraded Xbox One. To support the Oculus Rift VR headset. I don’t think Microsoft has other options. If Xbox does not do VR, Microsoft will loose gamers who want to enjoy VR. They will switch to a VR platform, and probably stick with it. VR could be addictive as hell and truly the next step in gaming. I am a firm believer that VR indeed is this ‘next step’. It will take the First Person View to a level beyond what has been offered the last 20 years since Doom and Quake. From Doom in the mid 90’s to the latest Call of Duty and Battlefield, you look at a flat screen. 20 years gave us a bit more pixels, but that’s it. But in VR you turn your head. The immersion is on a completely other level. The adage will be ‘Once VR, never look back ~ Max Qubit’

VR is trippyThe problem for Microsoft is the price of the hardware to support the Oculus Rift. The lowest price for a ‘Oculus Rift pc’ I saw was around $900. Maybe in 6 months that drops to $750. So Microsoft faces the problem of announcing a $750 Xbox One VR … just to support the Oculus Rift.

A possible way to solve this might be to first announce an Xbox One VR upgrade (supporting Oculus Rift) but toy with the release date. Releasing later means the Xbox One VR can have a less expensive price tag. It might also benefit from a less expensive Oculus Rift, and it would give developers time to build VR support into the Xbox games. I think Microsoft could get away with a 2017 Q2 release of the Xbox One VR without losing an army of gamers to Sony (PSVR) or HTC/Valve (Vive). Most Xbox gamers interested in VR probably would argue ‘Well, I wait a bit longer for the Xbox One VR to arrive instead of switching platform’. My estimated price tag for an Xbox One VR releasing in 2017 Q2 is around $600. Perfectly acceptable for hard core Xbox gamers who want to go VR.

With above strategy, Microsoft would offer a VR upgrade path for Xbox gamers. Eclipsing Sony’s PSVR solution, which is cheaper but also less powerful, by releasing 6 months after Sony’s PSVR, an Xbox One VR system which can handle the Oculus Rift.

Microsoft needs an answer to VR. Above is my suggested move. It is Microsoft’s only option.

* * *

Edit (may 27, 2016): Kotaku and Polygon brought out the news that Microsoft indeed is working on an upgraded Xbox under the name ‘Scorpio’. To be expected inĀ  2017.

Microsoft is feeling pressure to announce the upgraded Scorpio at this year’s E3 ~ Polygon

In line with what I was suggesting in my post:)

Edit (aug 9, 2017): We now know Scorpio is coming Q4 2017, under the name Xbox X. Somewhat surprising is that Microsoft has stopped talking about VR on Xbox X. Sure they will say Xbox X is VR enabled, but there is no concrete VR available at launch in Q4 2017. Not like, plug in Rift and go. VR on Xbox X will come, but the wait will be longer than I expected.

VR here we come

I do not necessarily want to be the first to own VR glasses like Oculus Rift, but I’ll certainly look into it this year, probably around summer. I’m quite convinced that VR will become the next big thing in Gaming. This after previous big steps like gaming in general (80’s), 3d graphics (mid 90’s), network/internet/online gaming (around 2000) and mobile gaming (around 2010). Of course VR, to settle, will take some years. The first real VR game I buy will be Elite Dangerous. Space here I come.

For true VR shooters there has to be a change in the control scheme. In any standard shooter now, you aim and shoot in the direction your body is (in the direction you walk/run). However, in VR this needs to be addressed differently. You aim and shoot in the direction you LOOK, especially if you Aim Down Sights (ADS), while your body direction does not necessarily need to change.

With a controller it could be like this

No trigger : Gun is aligned forward with body (Hip fire mode)
Left trigger : Align gun with your head (Hip fire mode)
Left trigger + Right trigger (pulled half way) : Pull up gun. ADS
Right trigger (fully pulled) : Fire!

There will be further restrictions depending on the type VR is trippyof gun. With a handgun, looking and aiming left or right does not matter much. The handgun will quickly align with your head. With a rifle however things are different. Are you left or right handed? Suppose you carry the rifle right handed, you then can align your rifle with your head even when your head is 135+ degrees turned over your left shoulder. But to the right, you are more restricted in aligning. You can only align your rifle when your head is turned for 45 degrees or less in ADS mode (or maybe 60 degrees when in hip fire mode) towards your right shoulder. Check it yourself. A heavy machine gun will align with your head like the rifle, but without the ADS possibility and of course slower.

All this should be built into a REAL/NATIVE VR Shooter. The main purpose of VR is ‘immersion’. Things will be much more real than on a flat screen. And therefor the aiming can be excused for also being more real. And more real will mean more SLOW. The gameplay will be different, because of the immersion and because your head is more slow than a mouse or controller.

Above is how I see it (at this moment, now I have given the matter some thought)

I know practically for sure that once you play in ‘VR’ you can not go back to a flat screen. The early adopters among gamers are already stating this feeling. You just can’t go back. In the mid 90’s there was no turning back when 3D gfx cards were introduced (Doom/Quake) and a whole new world of First Person Shooters opened up. This time VR will become a point of no return. VR sets will rapidly become cheaper, better and lighter. Everybody is jumping on the VR train. And with reason! Did I say everybody? What about Microsoft and Xbox? Well, I expect some VR anouncement soon. Sony is playing their own VR card, and just announced a performance upgrade for the PS4 to support their own VR glasses (Morpheus). Microsoft simply has to follow. I expect them to at least upgrade the Xbox One to be able to handle the Oculus Rift.

Still to become trendy …

Record players, lp’s, analog photo camera’s with black & white 35 mm film … Sure, they are trendy. But what about this. I haven’t moved and might suddenly be outpacing the trendy people with my perfect analog Philips tv still going strong. I always have found the digital flatscreen tv’s cold and without life. Like watching a computer monitor. Well it is one isn’t it. Nothing against monitors, I use them for computer work, for gaming, for photography even. But … watching tv, it never feels the same on a digital screen. I doubted about plasma. Anyway, the analog feeling seems gone. So, I ended up postponing the switch to digital tv. Always with the excuses that ‘Once the old tv fails I will buy a flatscreen’ … but the monster simply doesn’t give in, and it won’t be stolen too because it weighs a ton:)

The monster being a Philips model 28PW9761/01


Shot with Lumia 930

Digitizing old negatives (third experiment)

NegativeImproving on my first experiment with the aid of a light table (Kaiser Slimlite LED Light Box 2447). Capture of a 35mm negative (In this picture I already inverted the tone so it becomes a positive). Photo taken by my father. I guess around 1967.

Equipment used: Nikon D5100 + Sigma 17-50mm F2.8 EX DC (OS) HSM, Kaiser Slimlite LED Light Box, Lightroom 5

Digitizing old slides (second experiment)

My mother, my sister and meImproving on my first experiment with the aid of a light table (Kaiser Slimlite LED Light Box 2447). Capture of a 6×6 (cm) slide. Photo taken by my father. I guess around 1970. And, as I said in the previous post … other slides are much more interesting. This one this a great shot. I’m happy to have it back in my possession.

Equipment used: Nikon D5100 + Sigma 17-50mm F2.8 EX DC (OS) HSM, Kaiser Slimlite LED Light Box, Lightroom 5

Digitizing old slides (first experiment)

My father was a fanatic amateur photographer. I’m now in the possession of a lot of negatives and slides. Amongst those are 6×6 (cm) slides. Nearly 100 of those are from a trip my parents made to Russia in 1970. They were one of the first westerners to visit Russia. So those slides are kind of special, showing classic communistic Russia still at the height of its power. I want to digitize those slides. Of course I could go pro and pay deerly, but I like to experiment and do it cheapo. I started with a very simple setup (yes, you may laugh:) just to see if there is any quality to get from this. I’m not disappointed. Using the D5100 with the Sigma 17-50 to take a RAW picture of the slide.

The slide itself is not worth much. I think my father’s finger is visible on the slide too:) I took this slide from the collection, which is still with my mother, just to experiment. Some other slides are much more interesting. Just saying:)

The setup (Lamp, white paper and slide)

Slide scan 1

Feeding the RAW into Lightroom, which has a very powerful straitening tool

Slide scan 2

The end result (I’m not disappointed)

Slide scan 3

Next I will experiment with a light table. I bought a cheap one (30 euros). To see if this is better.

Equipment used: Nikon D5100 + Sigma 17-50mm F2.8 EX DC (OS) HSM, Lightroom 5

Edit: Improved setup with Light table


My father

The art of programming

At the core, I am a programmer. But I hardly program. 90% of the time I do other things. I listen to people who want things to be done. I ask questions, basic question, starting from zero, to understand everything the people say. To see the large picture, to feel how the data flows. To mold all these things into an complex looking but elegantly simple solution. I don’t make notes. I sketch. Sketch the flow. We brainstorm. I ask and re-ask questions until everything becomes clear. Clear to me. And when it is clear to me and elegantly put into a flow it, seemingly by miracle, also becomes more clear to those people. By taking time and energy to understand the people I ‘get the picture’. And the people get what they want, wrapped in a nice sketch. The sketch I use as a reminder as the thing starts to become alive inside my head. Inside my head is the virtual picture of what the people want.

At the core I am a programmer. I did a lot today but I have yet to program a line of code:)


RPC server is unavailable

WindowsLiveID linkingI wanted to link my online ID with my Windows user account but I got the error ‘RPC server is unavailable‘. Something was wrong. But what? After some trial and error I found the solution

– (Although I already had my WindowsLiveID entry) I choose ‘Add an online ID provider’
– The program responded by downloading and installing Windows Live Essentials 2011 (Sign-in software sort off)

Apparently this was missing on my pc

– Restarted the pc
– And now I could link my WindowsLiveID

Problem solved:)

FRITZ!Box 7390 telephone disconnects

Fritz!box 7390Last year I got a fiber connection to my home (FTTH), and now I have internet and my phone running over this, using a FRITZ!Box 7390 modem/router. Everything works fine and the FRITZ is a very nice modem/router. However, when making long(er) telephone calls (typically over 10 minutes) my wife (I don’t phone that long;) experiences random disconnects. So, last night I had a look at this problem. Seems like more people experience this, and I also found a entry describing the problem at It says a.o. that the problem would be resolved in the upcoming firmware upgrade. Now I was behind with my FW upgrades, so I decided to upgrade my FRITZ to FRITZ!OS 05.51, Firmware version: 84.05.51. First signs are promising. My wife did a 30+ minute telephone call, with no disconnects;)

Edit: Second test, this evening (may 29th) my wife phoned for over 1h15m, again with no disconnects. I’d say, mission success.

— Max

Lightroom 4 – Restoring my dream to glory

Some pictures are valuable treasures. I said this in another post. Old photo’s with people long forgotten or as in this picture ‘the girl of my dreams’. Such pictures deserve a special treatment and loving care trying your best to get the most out of it. To restore glory. In this case I had a color print of 45x30cm. I just took a picture with my Nikon D5100 and kit lens and processed it in Lightroom 4. The trick is to optimize the histogram, without losing any details. I decided to go black & white, which often give a more ‘photo feel’.


Dream original

Processing with Lightroom 4 (check the histogram and sliders)

Dream Lightroom

The final result, my ‘dream’, an eternal smile, shot 20 years ago, transported to and remastered in 2013. Beautiful as ever.

Eternal Dream

— Max

Lightroom 4 – The ‘Adjustment Brush’

Lightroom 4 has different tools for applying local tweaks. I use the ‘Graduated Filter’ tool a lot. I like it. It can improve a picture in a subtle manner so you won’t notice it (if you do notice it, the effect is ‘overdone’). But sometimes a ‘gradient’ is not enough because you really need a more precise local tweak. Enter the ‘Adjustment Brush’ tool.

Below I have a picture of my family in New York, eating a ‘hot dog’. This is a ‘must have’ picture but unfortunately it was shot while my wife and kids where in the shadows. Difficult to improve with global tweaks. Here you can use the local ‘Adjustment Brush’ tool to your advantage. Select it, ‘paint’ the desired objects (in this case my wife and kids), and apply the desired local tweak (in this case I up the shadows, see sliders). You will notice that my family is now much better visible, but, because the tweak is not ‘overdone’, the picture in total is still correct. A pleasing result. And the ‘must have’ picture is improved for keeps;)




The final result below. ‘Hot dogs in New York’ :)

Hot Dogs in New YorkShot with Nikon D5100 AF-S DX NIKKOR 18-55 mm f/3.5-5.6G VR, 22 mm, f/8, ISO 100, 1/160 sec, -0.67 eV, RAW (2012, New York)

— Max

StockLite custom mod greatly extends battery life of my Samsung Galaxy Ace

SC20130211-173207It like to get rid of stuff I don’t need. Very pratical. Less things to ‘worry about’. This pratice works especially well with devices like a PC. Keep the installed stuff to a minimum and the thing has less to ‘worry about’ and will perform better. Same for a smartphone. I have a Samsung Galaxy Ace smartphone, running Android. When you buy this phone it comes with a lot of Samsung and Android stuff preloaded … some of which I do not use. But, how to remove the stuff I don’t need? It is my first smartphone, so I was not directly able to tidy up the device because that preloaded stuff can’t be deleted. Unless … you hack the thing. Hacking means ‘rooting’ the device and perhaps even installing ‘custom mods’.

I learned both tricks in the past few months and ‘rooted’ AND ‘modded’ my Ace. In my search for a way to get rid of as much stuff as possible I stumbled on the StockLite custom mod amongst the myriad of custom mods available. I installed the mod, and after a short time of getting used to it (first day, I was not convinced) I really do love this mod and other ‘root’ apps like Link2SD.

I now have a Galaxy Ace which is ultra tidy. Just to my liking.

The insufficient memory problem has gone (Link2SD) and the battery life has greatly improved (StockLite). Last week it did run out of battery juice only after 6.5(!) DAYS … where 1 day is the normal situation with most smartphone users.

The secret not only lies in the StockLite custom mod (Iirc this mod has some battery enhancer or something) but also in sensible use of the phone. I only use Wifi when I need it. I only use the Phone when I need it. I only use Data when I need it. So, e.g. at night I put the Ace in ‘Airplane mode’ etc.

But … 6.5 DAYS?? Well done, my little ‘Ace’:)

StockLite review score: 10/10

— Max

SC20130210-125822 SC20130211-173214 SC20130210-125828

The classic way

My photography talents, if any, took off with the age of digital camera’s, say after 2000. Before that time, I did take pictures but I wasn’t a fanatic. I wasn’t into developing pictures myself, although I did do a few ‘doka’ sessions (doka = donkere kamer (dutch) = dark room). I guess the whole analog photo stuff was just to slow for me. There was no direct feedback between taking a picture and seeing the result. But you also could say I was just plain lazy:) Nope, analog photography wasn’t my cup of tea.

Anyway, while I perhaps was not into analog photography, my father (now 79) was a fanatic amateur photographer. A baker, but with many hobbies of which photography was the most time consuming. He had his own ‘dark room’, and he even owned THE camera of all times, a Hasselblad. He also owned a Leica … not too shabby. He was the guy who always took a family portrait when there was an occasion. And he took off on sundays with friends to shoot. I guess also the developing side of analog photography was a joy for him. I remember one time he and friends were busy constructing a giant developing bath of several square meters (perhaps even 2m x 3m) to create enormous prints, with the lamp hanging high above to expose the paper.

But in the end the hobby faded away. Not only because of his age, but also because of the changing nature of photography. The introduction of color photography was part of this. Color photography being more cumbersome to do yourselve then the relatively simple and straightforward black and white developing process. Also the rise of simple consumer camera’s and much faster processing of photo’s in photo labs etc, made the whole photography less special. Finally, with the advent of the digital era my father kind of stopped. Digital photography is completely different. A much faster world. As I said, there now is direct feedback between taking a picture and seeing the result. Also with digital photography you need to be at ease with computers and software. Memory cards, files, Lightroom (fantastic name for the software btw;) mouse and screen took over from film, dark room, chemicals and paper … and so, where my father stopped with analog, I started with digital:)

Needless to say, that the talent of shooting a good photo still stays the same. You need an eye for a good shot. But afterwards comes the second phase, which was analog in the old days but now is digital.

My father

I found this photo in an album. My father, busy developing a photo, still with his bakers clothes on. A true dedicated photographer.

— Max

Lightroom 4 – Restoring an old family picture to glory

Some pictures are valuable treasures. E.g. old photo’s with people long forgotten. They deserve a special treatment and loving care. When you hit upon a really special picure you try your best to get the most out of it. To restore glory. Here I have a digital photo made years ago, taken from a family picture found in an old album. The camera used (by my father) was not high spec’d. 3 MP, and the quality of the shot in JPG, is not optimal. But with the aid of Lightroom 4 I could revive the picture and boost it to former glory.

The trick is to optimize the histogram, without losing any details. Luckily the shot wasn’t too overexposed so with the help of reducing the highlights, and on the dark side of the histogram upping the black levels, the picture becomes alive. I decided to leave a trace of sepia to retain the ‘old’ feeling. I also applied some gradient. Check how much the faces are improved.


Family (original)

Before procressing with Lightroom 4 (check the histogram)

Lightroom (original)

After procressing with Lightroom 4 (check the histogram and the sliders)

Lightroom (processed)

The final result

Family (processed)

— Max

Samsung Galaxy Ace – Insufficient internal memory (Problem) – Link2SD (Solution)

Internal Memory StorageI’m quite happy with my Samsung Galaxy Ace. However, the internal memory storage (‘phone memory’) is very limited. A few apps like Facebook, Twitter, Whatsapp and the phone starts to complain about ‘insufficient memory’. But I have a 16GB microSD card?? And still not enough memory?? That is because apps will install themselves in the precious ‘phone memory’ (limited to 181 MB). Which is logical if you think of the situation where you have no SD card in the phone. You can still use that phone, with apps, but only a handfull of apps can be installed before the ‘phone memory’ is full.

The problem can be solved by adding a SD card and moving your apps from the internal ‘phone memory’ to the external SD storage. This ‘moving’ can be done with apps like App 2 SD. A good and free app, however it (and many similar apps) wont move all apps to SD. Some, like Whatsapp, Twitter, Facebook, etc. are just not moveable. Weird! So, what about an app which will let you move ALL (user) apps from ‘phone memory’ to SD memory? Does such an app exist?

I have googled around and yesterday I have found that app. It is Link2SD (also free). There is a catch because this app requires your phone to be rooted. Luckily ‘rooting’ is not too difficult. Find multiple method/ways to ‘root’ your smartphone, see how to root galaxy ace. (Edit oct 13th, 2013: But sometimes the forces are against you. I tried to root the Ace of my stepfather, but it stubbornly refused to work, and always came with the error “There is no SU binary installed, and superSU cannot install it. This is a problem!”. Made me crazy. Nearly gave up. But with my zillionst search I did hit on a post from a guy named Vaivai and in his tutorial he spoke of UNROOT first. It is what I tried and now it worked. So take note if you have trouble rooting your device with said error message … try to unroot first). You also need to have a second partition on your SD memory card. This is where Link2SD will store/move the apps. Link2SD is a fantastic little app and did everything I have wished for. Highly recommended!

Link2SD review score: 10/10

So the receipt for this problem is as follows:

Device: Samsung Galaxy Ace
Problem: Internal memory storage full
Solution: Move apps to SD storage with Link2SD
Root (required):
Second partition on SD card (required):
More tips (battery saving): StockLite custom mod greatly extends battery life of my Samsung Galaxy Ace
Unroot and root

– Max

Samsung Galaxy Ace – How to improve pictures

I have a Samsung Galaxy Ace. It can take decent pictures, especially (outdoors) with enough light. But more often then not the pictures are a bit ‘misty’. Not optimal. Of course one can say, use a ‘proper’ camera. True, but well, it happens that the only camera at hand is my Ace, so I have to do with that. Then it is good to know you can much improve the Galaxy Ace pictures with Lightroom 4 (other software will do this too but I use LR4). The problem of ‘mist’ is mostly a problem of the ‘blacklevels’. Tweak the ‘blacklevel’ and the picture will come to life:)


Processed with Lightroom 4 (mostly ‘blacklevels’)

The quality has improved dramatically, and this by using only a few sliders, of which the ‘blacklevel’ is the most important. Look at the pictures below. Original and processed and check the histogram and the sliders (esp. ‘black’) You will see that the histogram is correted for the ‘blacklevels’ (left part of the histogram) which was too much to the right (meaning no blacks, resulting in the ‘misty’ pictures). Moving the ‘black’ slider into the negative moves the histogram to the left, enhancing the blacks and removing the ‘mist’.

Some other improvments were done, just experiment a bit, but don’t overdo it. Just ‘repair’ or ‘optimze’ the histogram and the picture will be a lot prettier.


Processed with Lightroom 4 (watch the ‘black’ slider)

So, with a bit of work the Galaxy Ace can produce useful pictures. Always good to know when there is a special moment and the only camera at your disposal is a Galaxy Ace smartphone. Make the shot(s) and postprocess the picture with Lightroom 4. Good luck.

Tip: But of course you would like to process the picture on your smartphone, e.g. because after that you want to put it on Facebook or want to email the picture. I have tested some apps, and found Photo Editor (Android) to be a very good tool to do the trick. In this app, use the function ‘Color (levels)’ to manipulate the histogram.

— Max