Cannon.js – Want to steer a car?? Then you need to make the HingeConstraint update-able

Hi…

 

I am playing around with Three.js and Cannon.js. Making my little car steerable needed to be able to update the characteristics of the hinge constraint during the runtime. What you need to do is the following:

Within the cannon.js file, locate the HingeConstraint constructor and add the follwoing lines of code:

With this, you can steer your car around…

CU

0xff

 

Rotating a Vector by means of a Quaternion

Hi…

using cannon.js I needed to rotate some bodies (otherwise the wheels fly onto the body of a car during the first few moments of your scene)… the following code rotates a vector by using a quaternion. More insights into quaternions you can find here

http://math.stackexchange.com/questions/40164/how-do-you-rotate-a-vector-by-a-unit-quaternion

Have fun…

CU

0xff

Worklight Demo Setup – MySQL JDBC driver

Hi…

when installing your IBM Worklight developer machine to use the adapter for SQL databases, you may find it difficult to get the MySQL driver running. At least, I did. The official way is to store the MySQL Connector/J in the lib directory of your server (see here for details).

I was just doing a setup for demo machines that have – as a special trap – to work on the T-Systems managed machines we have here at Telekom. So, if you have the idea that you will setup (and delete) projects rather frequently and do not want to feedle around with the MySQL files, you can do the following:

(1) Find the appropriate MySQL COnnector/J file, best to download it from Oracle. Use the platform independent version as a ZIP file. Open the ZIP and find the jar file in there.

(2) Copy the jar file to a known place, e.g. into the WorklightServerConfig directory in the Eclipse Workspace where Worklight resides.

(3) Under WorklightServerConfigserversworklight you can find the server.xml config file. Within the <library id=”apps-common”>, add the following line:

Make sure the connector version and the path fits.

Now, you don’t need to copy the driver in the lib anymore and build, deploy, and hope it finds it on the first time 😉

CU

0xff

 

Accessing mySQL from within Worklight

Hi…

If you want to access a mySQL database from within Worklight, you can add an SQL adapter. Here is a step by step guide:

(1)    Add a database connector by right clicking on your project and selecting New-Worklight Adapter.

Wizzard

(2)    In the requester choose Project Name. Adapter Type is SQL Adapter. Give it a name. If you choose to Create procedures, it will do Javascript stubs in your project.

(3)    You can find the mySQL adapters here http://dev.mysql.com/downloads/connector/ You want to get the J Connector. Download the platform independent version and store it in the server/lib directory. NOTE: You need to restart the server / Eclipse Worklight Studio for the server to recognize the file.

(4)    In the directory adapters in your project you should find your new adapter. Within it carries its configuration.

SuccessWithin the JS files, you find the stubs provided by the wizzard. You need to change the stubs (SQL and JavaScript) according to your needs. Looks like this:

If you right-click on your adapter, you can choose Run as – Invoke Worklight Procedure and test your stuff.

CU

0xff

Conference call with Telekom Tropo and node.js …

Hi..

 

we recently had a support request on Telekom Tropo conferencing and node.js . Our colleague Daniel Roth (you can find his pretty black website here :-) ) solved it. He did not use the Tropo package but did it rather from scratch. Well, customer’s wish is our command…

The exact same thing if you are using Telekom Tropo scripting:

The world famous 3 lines of code…

Thanks to Daniel… you: Have fun!!!

CU

0xff

 

Global SMS – Sending SMSes in node.js

Hi…

here is a short intro into how to send a SMS by using Global SMS service of Developer Garden. I already gave a short intro to our OAuth service. You might want to have a look there to find how to resolve the credentials. Also, if you want to extend or play around, have a look at the documentation.

Update: Please be aware that there are different plans available (aka BASIC and Premium). They offer different services, as you can see in the table below.

 

 

As you can see, not all features are available in the BASIC model.

I made basically two files for node.js. The first one takes care on the OAuth part. You can find the source here (please see also update below):

All it does is to provide a functionality to acquire a client access token from the OAuth server. I am using callbacks here since we have to wait for the server to answer.
The rest is pretty straight forward.

What this file does is, first of all to get the OAuth handler described in the source above assigned. We are calling then and using the OAuth client token to build a valid header. We then build the JSON body which is shaped in an interesting fashion but at least GSMA conform (adhere global standards whenever you can). All in all, I think the code is quite self-explanatory.

The answer is something like this:

Some remarks:

  • If you have no validated sender number, use 0191011. You do not need to use the tel: prefix then.
  • In the documentation the environment is called basic. This is a bug, you need to give budget instead (we are currently fixing that).

 Update:

On some Windows implementations, the options of the request need some additional parameters (as marked below):

The first one is to switch off the global HTTPS agent, the second is to accept any SSL certificate which by the way is requested by the last new line.

We made the experience that node.js uses different default protocols. Therefore, by explicitly asking for SSLv3 you make sure it uses the right one. This was necessary on our Windows Vista based test system.

Have fun.

CU

0xff

 

OAuth beim Developer Garden

Hi…

wenn man die Developer Garden APIs nutzen möchte, muss sich per OAuth anmelden. Wie das mit node.js funktioniert, will ich im Folgenden kurz zeigen.

Zunächst braucht man drei Credentials: Die Client ID, Scope und Secret. Die finden sich im Developer Garden->My Account->Application Managent. Dort legt man eine neue Applikation an und wählt DG APIs. Im nächsten Dialog gebe ich dem Kind einen Namen und wähle welche APIs im Rahmen dieser Applikation verwendet werden können. Hier finde ich die drei Credentials:

ManageApplications

Die Credentials in die entsprechenden Lücken hier kopieren und los gehts…

Viel Spaß…

CU

0xff

Send SMS via Telekom Tropo

Hi…

 

da ich gerade gefragt wurde zum Thema Send SMS mit Telekom Tropo:

1. Man braucht keine überprüfte Absender-Nummer und man kann aus dem Sandbox-Mode SMS verschicken.

2. Hier ist ein Node.JS Script, das zeigt wie es geht. Es verwendet Express (installieren per npm install express) und Tropo WebAPI (installieren per npm install tropo-webapi). Ich habe in einer seperaten JS-Datei meine Telefonnummern und das App-Secret.

CU

0xff

Neue Tropo Demo – Nachrichten-Ansage

Hi…

hier mal vorab den Code zu meinem letzten Demo (auf der CeBIT nebenher gebastelt). Ich muss nochmal drüber gehen und die Variablen sauber benennen etc und tralala… Aber mal vorab…

CU

0xff

Source code on two-way-authentication

Hi…

 

CU

0xff