Pages

Friday, October 30, 2015

Deploy your webworks produced bar file to Blackberry Enterprise Server, then go to the bar


  1. Define your app id (e.g. config.xml... widget id="my.company.appname")
  2. Define your app version (e.g. config.xml ... version="1.0.0"...)
  3. Change the in-app version, automated via a hook, or manually
  4. Change the uri whitelist to e.g. <access uri="https://bladieblah.full.path.com/leading?to=wherever&use_a_wildcard=*" subdomains="true" />
  5. Build. e.g. webworks build --release -k <the password you used to do signing> -b 1
  6. Pray

Thursday, October 15, 2015

Install a bar file to your blackberry10 device in debug mode using node / webworks

How to install a bar file (e.g. blackberry application package) to your blackberry10 device:

I'm assuming you're using node and already did: npm -g install webworks, also you already have a blackberry id. To make this work you have to make a debug token (filename: bbidtoken.csk) request via the website.

To make this work you need two files: author.p12, bbidtoken.csk

Both should be copied to $HOME/.rim where webworks can find it by default on Linux;
~/Library/Research\ In\ Motion/
on a mac.
author.p12 can be generated using bbidtoken.csk with the following commands:
blackberry-keytool -genkeypair -storepass [The passphrase you used to request the debug token] -dname "CN=[Company name]"
blackberry-deploy -installDebugToken bbidtoken.csk -device [ipv4 address] --password [The passphrase to access the device internals]

Finally to install your app (assumingly made with cordova/webworks):
webworks --verbose run --devicepass [The passphrase to access the device internals] --keystorepass [The passphrase you used to request the debug token]

Tuesday, September 8, 2015

Generate a self-signed certificate for your azure subscription


  1. Create a new certificate (public)
    makecert -sky exchange -r -n "CN=<certificatename>" -pe -a sha1 -len 2048 -ss "<certificatename>.cer"
    
  2. Run certmgr.exe, locate
    <certificatename>
    , export it
  3. Add the certificate to azure's subscription settings, locate and copy the subscription id
  4. Create a subscription with visual studio
  5. Profit!

Tuesday, June 23, 2015

Get your mac device's (iPhone/iPad) UDID from the command line

Add this to your .bashrc or .bash_aliases
alias udid="system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | tail -n1 | sed 's/Serial Number: //'"
Then hit
udid
.

Monday, February 16, 2015

Musings on libnodejs (or libiojs) on Android

What can you do with nodejs on android?

Here are some examples:

  • Run your own server in nodejs on your android device, using the same code you would use for a nodejs x86/x86_64 back end! (e.g. udp/tcp/ip, http, websocket, bit/webtorrent server, webrtc client/STUN/TURN/ICE server);
  • Use existing libraries and code for nodejs and run them in your pocket; (which reminds me NPM (not-paid monkey) is on my TODO list)
  • Connect to other android devices running nodejs;
  • Run nodejs on wearables (ehhh... run a server on your watch?);
  • Use the same javascript client code for testing/production on android;
  • Connect to android sensors/instruments/services via unix domain sockets. (e.g. bluetooth);
  • Connect nodejs with android.webkit.WebView and recreate cordoba/phonegap (wretch);
    • Run cordova-cli on your android device directly;
    • Create stunningly fast mockups with (local) back end code in nodejs
I feel that my hobby/job is coming to full circle, I started out coding in C/C++/javascript/java at the uni. Now I'm still coding in the same languages, but with one more in the mix, Xtend(lang).

I'll clean up my code and release a POC (piece of crap) on the android app store.

Friday, February 13, 2015

Progress report: nodejs / iojs on android

I set out to embed node in an android application and I have succeeded in doing so. It's not an earth-shattering accomplishment, but I'm happy all the same.

I'm exploring ways of passing state between an embedded nodejs instance on android and an android zygote process, via unix domain sockets and http sockets. If the unix domain socket method works, then JNI calls to pass state to and fro can be eliminated completely, except for setting up a nodejs instance.

I managed to build shared libraries and executables for arm-android using either libnodejs.so and libiojs.so. I can load it using an activity-bound sticky android.app.Service and load an http-stream repl script.

I documented how I got there here.

Also, see this commit on how to build the shared lib.

I have a working http-stream REPL via an android device's localhost:8000. Any machine can connect to it.

I'm currently working on a way to expose a node CLI/REPL to the user using android.widget.{EditText, TextView} combined with an android domain socket REPL.

After experimenting with node's domain socket server creating abilities on x86-linux and arm-android, I came to the conclusion that android.net.LocalSocket and nodejs domain socket server will not play nice with each other.

After a lot of pacing and some hair-loss, I realized that I have to determine whether bionic is being called properly by libnodejs (on android).

Right now I have two options:
  • Determine that node's C++ code is calling bionic properly to create a domain socket;
  • turn it around: let android create a android.net.LocalServerSocket, let node connect bind/connect with a domain socket client and start the REPL on the client. I'll have to see if this even works on x86-linux.
I also put some effort into stdio redirection, in the hope that the built-in REPL in nodejs would kick in, but that sort of magical thinking usually leads to nowhere, and it didn't.

Update 14-feb-2015:

Next step: fix libuv; I suspect that pipe.c is not properly coded for android; I suspect that android.net.Local bind/connect fails due to a bad addrlen. According to the code in Pro Android with the NDK page 267-268, a socket that is not in the linux abstract namespace and its addrlen must comply to certain rules, the most important rule is the address length.

Update (same day):

Inserted #if defined(__ANDROID__) ... statements to pipe.c and reused libcutils code instead of libuv socket code, that is shared with android.net.Local(Server)Socket's native methods.

Still not connecting.

Update 16-02-2015:

Mission accomplished. My modified libuv can connect with android.net.LocalSocket over a filesystem-based domain unix socket.

In theory my modification supports abstract domain unix sockets, but I don't know if libuv even supports this.

This means that I have IPC over domain sockets on android, between the main thread and the thread running nodejs.

I have tcp/udp/unix domain socket communication, between android and nodejs!

Woohoo!

Sunday, November 2, 2014

Initial experience with Xtend + RoboVM

Setting stuff up


I woke up feeling like doing something for Xtend developers, so I decided to check out RoboVM.

RoboVM is a project sponsored by Trillian Mobile AB, Gothenborg, Sweden.


I had so much fun contributing to the Xtendroid, I thought I could pull the same trick for the RoboVM project; the trick being writing massively intelligent boilerplate killers for common coding tasks.

I plan to use Xtend and its active annotations to cut away RoboVM boilerplate.

I set up the following things:
  • Installed java 8; (\o/ yea for lambdas)
  • Installed Xcode, installed the command-line tools (you must have a mac);
  • Installed Eclipse (version Luna, updated it);
  • Installed Xtend on eclipse via the update site;
  • Installed RoboVM on eclipse via the update site;
  • Cloned (via git) and imported (eclipse) the official RoboVM sample projects;
  • Cloned an imported the Xtend+RoboVM sample project
Also checkout these RoboVM bindings, they might be useful later.

Caveat emptor!

Beware buyer! I immediately got the feeling that the samples aren't being maintained much after the recent release; some of the method names declared in the official RoboVM samples are slightly fubar. Eclipse will complain that certain @Override declarations are not required. You will have to find the correct method and rename the borken method to that correct one. Most of the work requires matching method signatures.

If you feel generous, you can do a pull-request via github where the samples are hosted; that's what I'm planning on doing too.

The other thing that bothered me is the following error that occurs after you push the compile button, on certain sample projects:

Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/ref/FinalReference

After I filtered through the noise on StackOverflow and some additional mucking around with java and eclipse.ini, it dawned on me, that I should use "compile as..." build option instead of trusting the default compilation settings.

Everything went smoothly afterwards.

Watch this space

Like I said, I plan on doing a Xtendroid on RoboVM. I think I'll call it XtendRobo, because it sounds cute.

Cheerio.