Update: Cloud Downloader 2.9.5

Cloud Downloader 2.9.5

Just a quick status update. Today I released the Cloud Downloader version 2.9.5. As might guess from the version number, the jump from 2.9 to 2.9.5 contains only minor changes.

So there are no new features included in the current release. Therefore I have worked on the stability of the entire application and fixed some bugs.

The current version can be found (as always) in the main blog post about the Cloud Downloader. Just follow the link below.

Download: Cloud Downloader 2.9.5


Best Practice: Convert 1 and 0 to true and false in Javascript

1 und 0 zu true und false in Javascript

Today there will be only a very short post. There are certainly many ways to convert 0 and 1 in Javascript to true and false.

The following way to reach the wanted result I’ve seen today. I think it is probably the shortest and most elegant way to go. In addition, it works not only for integer values, but also for the string representations of 0 to 1.

So this is the stuff I like to add to my personal “POP”-collection (pearls of programming)…

0 and 1 to true and false

To convert the integers 0 and 1 to boolean, it is sufficient to use the not-operator twice.

var thisIsFalse = !!0; //false
var thisIsTrue = !!1; //true

Why it works? Here is a short explanation. 1 is a valid value and thus true. When we write !1 now, then we create a false condition because 1 isn’t false. With a second ! (so !!1) we negate the resulting false and get thus true for the 1. For the 0 it looks the other way out. So 0 corresponds to false. Negate it !0 to get a true. Do it twice !!0 to get true.

“0”- and “1”-Strings to true and false

And what if 0 and 1 are represented as strings, for example if you have to handle bad formatted JSON string? Nothing could be easier. Using the + operator you can cast the strings to int. Then use the not-operator as shown above. So the solution for strings looks like this:

var thisIsFalse = !!+"0"; //false
var thisIsTrue = !!+"1"; //true

With three characters from string (with the value “0” or “1”) to Boolean. I think there aren’t much paths to get this effect in a more elegant way. But yes, you live and learn. So do you know a better solution? Then share it with me.


Open SAP GUI from HTML out of your webbrowser

SAP aus Browser aufrufenSome time ago I got into a discussion about whether it is possible to open transactions in the SAP GUI out of the browser. The opinion of the colleagues was unanimous – start SAP GUI from browser is something not be done.

However I have maintained and created a small proof-of-concept. Because it works. Ok, it’s not pretty, but it works. And that’s how to call the SAP GUI from the browser.

sapshcut.exe and what you can do with it

The solution works (among other things) using the sapshcut.exe (short for SAP Shortcut). This .exe file allows to start the SAP GUI parameterized. The possible parameters ranging from user via logon language up to the executed transaction. A complete list of possible parameters can be obtained by calling the sapshcut.exe with the parameter -?. (See screenshots below.)

sapshcut.exe - help from cmd  sapshcut.exe - Command list

To allow a jump from a Web browser into SAP GUI, only the sapshcut.exe with the appropriate parameters must be called. And that is also the reason, why I wrote in the introduction that it is not a nice solution. To run .exe files from the browser, there is only one, fairly “standardized” solution: ActiveX. And it works again – for security reasons – in almost no browser except Internet Explorer. (How could it be otherwise…)

Open SAP from the Internet Explorer

To execute the jump from a Web page into the SAP GUI the following, four-line Javascript function, which can be installed within any web page, is enough.

function openSAPGui(sid, client, user, password, transaction){
    var shell = new ActiveXObject("WScript.Shell");
    shell.run('sapshcut.exe -system="'+sid+'" -client='+client+' -user="'+user+'" -pw="'+password+'" -language=DE -Command="'+transaction+'"');

Theoretically you can even further summarize the whole code, in practice and in terms of reusability you shouldn’t, because the encapsulation within a small javascript function makes sense.

If you do not want to build a test page to include and run the javascript function now, just simply copy the following code, paste it into a text file, save it as [filename] .html and open it in Internet Explorer.

	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>


<input id="transaktion" type="text"></input>
<input id="usr" type="text"></input>
<input id="pass" type="password"></input>
<input id="sid" type="text"></input>
<input id="mand" type="text"></input>

	<button id="go" type="button">Absprung!</button>

			var trans = $('#transaktion').val();
			var usr = $('#usr').val();
			var pass = $('#pass').val();
			var sid = $('#sid').val();
			var mand = $('#mand').val();
			openSAPGui(sid, mand, usr, pass, trans);			
	function openSAPGui(sid, client, user, password, transaction){
		var shell =  new ActiveXObject("WScript.Shell");
		shell.run('sapshcut.exe -system="'+sid+'" -client='+client+' -user="'+user+'" -pw="'+password+'" -language=DE -Command="'+transaction+'"');			

Should you know a more elegant or even cross-browser compatible solution, just tell me! I look forward to your comments and suggestions.


How to make remote IPs available on OS X’ PPTP VPN connections

OSX VPN RoutingLet me describe the initial situation: I connect my Macbook via PPTP VPN with an remote network using the standard OSX VPN client. While the VPN connection is established, however, there is the following problem.

All devices on the remote network get IP addresses within the range assigned. However, the local IP range on the external network is A server, which (as local user of the remote network) can be reached via for example, now (via VPN connection) has the IP Unfortunately it is not clear which server got what IP from the block of adresses.

Add routing rule for PPTP VPN connection on OSX

The solution is quite simple in this case. The only condition so that subsequent workaround will be successful is that the IP range in which the Macbook is, is an other than the local range of the external network. If the Macbook is therefore also in a network, subsequent solution may not work properly.

To make the remote computers available under their well-known IPs, a new routing rule (=route) must be added. This can be done via the terminal of OSX system.
With the command

ifconfig -a

you can show all network interface. In the output of the ifconfig command you should find the VPN interface’ name. (Therefore the PPTP connection logically should be established before executing the command, otherwise there might be no VPN interface which can be shown by ifconfig.).

Zugriff auf externe IPs im VPN in Mac OSX (1)Zugriff auf externe IPs im VPN in Mac OSX (2)

With the knowledge of the name of the interface, you can add the routing rule now.

sudo route add -net -interface ppp0

In the above command you only need to replace the by the destination network of your VPN connection and the ppp0 with the name of your VPN interface. After execution of the command the computers from the remote network should be reachable under their well-known IP addresses.

Zugriff auf externe IPs im VPN in Mac OSX (3)Zugriff auf externe IPs im VPN in Mac OSX (4)


Change “View Source” editor in Internet Explorer and Edge

Switch Editor in Internet Explorer

Those of you, who create websites do well to ensure that these are displayed correctly in all major browsers. But as most of you should know, due to differences between Internet Explorer, Firefox, Chrome and Safari this succeeds only in the rarest cases right away.

Thus, as a developer you’ll frequently have a look to the source code of a website, which in most cases just hurts in Internet Explorer, because the default editor of the “View source code” function is just a new window in IE instead of a good editor. Maybe it’s ok for a quick look, but not for getting work done.

Anyone who prefers to use Notepad++, SublimeText or another editor of choice to display the source code of a webpage in Internet Explorer, should give me his attention for the next minutes. In the following article I want to show you, how you can adjust the default editor in different Internet Explorer (IE) versions.

Change “View Source” editor in Internet Explorer 8-10

In Internet Explorer versions 8 to 10 the default source code editor can be modified easily via a menu setting. For this purpose, first the developer tools must be opened. This can be done either by pressing the F12 key or via the following menu path: Tools -> Developer Tools.

Internet Explorer 8-10 Sourcecode-Editor setzen - Step 1  Internet Explorer 8-10 Sourcecode-Editor setzen - Step 2

If the Developer Tools windows is shown, the settings can be accessed via the File menu. In the File menu click the “Customize Internet Explorer View Source”. That’s the point where the default source code editor can be set. By clicking the “Other …” button, you can choose any text editor you want.

Change the “View Source” editor in Internet Explorer 11

Unfortunately in Internet Explorer 11 this comfortable way of setting the default editor no longer exists. (Hey, this wasn’t done to annoy you, but to show you, that it’s an original Microsoft product. If it would have become easier it wouldn’t be a Microsoft product…)  In IE 11 the only way to change the “View Source” editor is an intervention in the Registry. Therefore open the Registry over the Start menu or via the Run dialogue (Win + R) and the command “regedit”. The necessary adjustments must be made below the following key:

HKEY_CURRENT_USERSoftwareMicrosoftInternet Explorer

First, a new key called “View Source Editor” must be created. Then another key named “Editor Name” must be created below the first key.

Internet Explorer 11 Sourcecode-Editor - Step 1  Internet Explorer 11 Sourcecode-Editor - Step 2

If both keys are created, the default value of the second key has to be adjusted. Here you enter the full path to your editor of choice.

Internet Explorer 11 Sourcecode-Editor - Step 3  Internet Explorer 11 Sourcecode-Editor - Step 4

Unfortunately this setting also brings an unsightly disadvantage, which is related to Microsoft’s Edge browser…

How to change the “View Source” editor in Microsoft Edge

Let’s talk about Microsoft’s latest browser – Edge. For this “browser” I’ve not found any solution to replace the default editor. Clicking on the “View Source” button will automatically open the Developer Tools – no ifs and buts. Also in the Microsoft forum there has been no solution until today.

However the following fact is just more worse. So Edge not only will not accept the registry settings for Internet Explorer 11 (see section above) , but also it gets broken by this settings. That means in plain text – one uses the above workaround to change the default editor for IE 11 and at the same time loses the opportunity in Edge to use the “View Source” button. Hey Microsoft, if the settings done work for Edge, please ignore them completely! Hopefully this will be fixed in the future!

Page 1 of 35