Author Archives: danieru

FxOS app development is super easy!

Over the years I’ve setup several app development environments:

  1. Meamo
  2. Android
  3. Ubuntu Touch
  4. Blackberry

None of those compare to how pleasant Firefox OS’s dev environment is. This morning in viruses class I installed the Firefox OS simulator. Unlike the above platforms the simulator is not a full weight virtualized operating system. It is nothing more than a firefox addon!

The other platforms would take a full day or more to setup their virtual machine and the compile tool chain. Instead I was making real progress on my first FxOS app before my morning’s first class was over!

Now 12 hours after starting my app is live on the Firefox Marketplace!

The app itself is here: https://marketplace.firefox.com/app/my-ip-is/

The source is in this git repo: https://github.com/daniel-dressler/whatismyipaddress

Next I plan to port the html5 WordPress Update Assistant I wrote last year. The entire process is pure fun and I am surprised at how easy FxOS has made app creation.

myip_logo_128

The FxOS app icon style appears to be circles. This is in contrast to iOS’s rounded squares, and Android’s objects.

screenshot_1

I used Firefox’s “building blocks” which provide FxOS look and feel through css sheets. Other apps in the marketplace use bootstrap or jQuery Mobile. The high quality apps use the building blocks plus heavy themeing.

 

Linux Blackberry OS 10 Cordova plugin development setup

This semester I’m contributing towards HTML5 on BB10 with thanks to UCOSP and my team’s mentor Tim Windsor from Blackberry. We’re implementing and porting cordova (phonegap) plugins.

Setting up my development environment under linux (Ubuntu 13.04) took the full first day of our face-to-face sprint. I am thankful Tim was sitting across the table and was willing to  answer my many questions.

For this tutorial I am going to assume you are on Ubuntu 13.04 but other linux distros should be the a similar process.

For Ubuntu 13.10 you’ll need to take one extra step.

0. Install dependencies and linux tools

The non-BB10 specific tools we need can all be downlaoded through apt-get. Bring up a command line interface by pressing Ctrl + Alt + t.

In the command line run the following:

sudo apt-get install git ia32-libs openjdk-6-jre

That installs the BB10 IDE’s dependencies, java, and Git. Git being a version control tool we’ll use later to get the example Cordova plugin. Java is needed for the signing tools. If you are on 32bit linux you should not need ia32-libs

We also need a current vesrion of node.js for which we can use a ppa. Run the following commands:

sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Now install cordova through node.js’s package manager with the following commands:

sudo npm install -g cordova

1. Download the BB10 IDE, BB10 specific Cordova, and signing tools

We need to download the following:

  1. “QNX Momentics IDE for Linux”, which is the Blackberry OS 10 Native Development Kit: http://developer.blackberry.com/native/downloads/
  2. Community ported old BB10 Webworks SDK: https://github.com/badtoyz/BB10-WebWorks-SDK-Linux-Gold/archive/master.zip

We have many files to download so get those downloads started now and start reading ahead.

2. Install the IDE, which includes some Cordova tools

The IDE install file we downloaded is an installer binary which we must mark as executable and then execute, run the following in the command line:

chmod +x Downloads/bbndk-BB10_*
./Downloads/bbndk-BB10_2_0X-1155-106-201308081646.bin

The IDE installer will ask where to install the IDE into. For the purpose of the tutorial we’ll install in a folder called “bbndk”, the default suggested folder. If you feel comfortable with linux then we can install it elsewhere provided you know how to edit the below commands to use your desired install path.

installing_bbndk

Installing the IDE (QDE) into bbndk folder

3. Extract the signing tools

The signing tools we need can only be found in the community ported version of the old WebWorks tools. We downloaded them earlier and now we should extract them to the folder “bbndk-signing”. You can use the default Ubuntu unzipper or run the following on the command line:

unzip Downloads/BB10-WebWorks-SDK-Linux-Gold-master.zip -d bbndk-signing

4. Add the tools into our PATH

When you run things from the command line the shell looks for the program in the list of directories in your PATH. We need to add the directory with the IDE, the signing tools, and the BB10 specific Cordova tools.

Open the hidden file ‘.bashrc’ by running:

gedit ~/.bashrc

We must add the following lines at the bottom of .bashrc:

export PATH="${HOME}/bbndk:${PATH}" # The IDE 'qde'
export PATH="${HOME}/bbndk-signing/BB10-WebWorks-SDK-Linux-Gold-master/dependencies/tools/bin:${PATH}" # signing tools
export PATH="${HOME}/bbndk/host_10_2_0_15/linux/x86/usr/bin:${PATH}" # BB10 Cordova

Now you must close your terminal window and re-open it so that the new PATH setting will take effect.

bbndk_in_PATH

Once the additional directories to the PATH have been added the bottom of .bashrc should look like the above

 

5. Download an SDK through the IDE

Now that your PATH variable is set correct you may launch the IDE by running the following command:

qde

The IDE will open a window asking you to connect a device and download an SDK. For our purposes you do not yet need to setup your device for the SDK. As such select the “No Device” option and uncheck the “Download Simulator”, then click next until the download starts.

qde_download_sdk_no_device_or_simulator

We shall be using the Cordova tools to package and push the complete application but we’ll still add the device later on for different reasons.

The SDK download may take a while, I have found the Blackberry servers to be slower than one might expect. It is safe to perform step 6 & 7 SDK is downloading but we shall need the SDK for steps 8 and onwards.

6. Request a signed development key

Before we can sign and push our applications we need a special signed key from Blackberry. We can request such a key through https://www.blackberry.com/SignedKeys/codesigning.html

Select the second option as we’ll be signing with the Blackberry WebWorks tools. Request the key now as it takes upto 2 hours for it to arrive. The two files we’ll need shall be emailed to you.

7. Find your phone’s IP address

Since BB10 simulator requires a paid license to proprietary software I will only be able to cover how to use a real BB10 device. Blackberry was gracious enough to provide my team members each with a “Dev Alpha C”, a cooler looking model of the Q10.

The IP address we need is the one associated with your WiFi network, not the usb connection, nor your mobile data connection. The exact path through the menus is non-obvious so we’ll go over board on the photo guide for this section.

bb10_1_network_connections

Open the Settings app and select “Network Connections”

bb10_2_wifi_network

Select your WiFi network

bb10_3_wifi_network_settings

Now find the settings tab in the bottom right

bb10_4_dropdown

We need to switch the type of details shown by using the dropdown list

bb10_5_internet_connection

From the dropdown select “Internet Connection”

bb10_6_ip_address

Now the IP address should be the first detail shown

In my case the IP address of my development phone is 192.168.1.199

Make note of your phones address as we shall use it later on.

8. Clone the community plugin repository

Now we must get the example cordova plugin. We can find said plugin in the community plugin git repository hosted on github: https://github.com/blackberry/WebWorks-Community-APIs

The exact commands we must run are:

git clone https://github.com/blackberry/WebWorks-Community-APIs.git

That will clone the git repository. From now on we should issue all commands from the example plugin which is called “Template”. Navigate to “Template” plugin with the following command:

cd ~/WebWorks-Community-APIs/BB10-Cordova/Template/sample

With the “Template” plugin the “sample” folder contains the cordova app which acts as an example for the plugin’s usage. We’ll use this sample as our hello world.

9. Enable development mode on your device

bb10_9_1_privacy_and_security

From the main settings screen select “Security & Privacy”

bb10_9_2_navigate_to_dev_settings

Scroll to the bottom and select “Development Mode”

 

bb10_9_3_turnon_dev_mode

Now turn on “Devlopment Mode”. The phone will set Development Mode to off after every restart so you’ll have to redo these steps if you restart the phone.

Your phone should now be in development mode. It might also be flashing a red light, the flashing will go away in time. Notice that the IP address listed does not match the one we wrote down earlier. That is because this IP address is for the usb connection.

 

10. Generate an author .csk

Now let us register our signing key. This will generate a author .csk key store which we’ll later use to generate the debug token which gets push to the device. You must edit the following command with your own password and the pin you selected when registering for the signing key:

blackberry-debugtokenrequest -register -storepass PASSWORD -csjpin PIN Downloads/client-PBDT-*-.csj Downloads/client-RDK-*-.csj

Notice that this command assumes you downloaded the two signing key files into your Downloads folder. Edit the paths if this is not the case.

register_signing_key

What it looks like when after registering the signing key. Notice when I registered for my key I used a very weak password, please use a stronger password.

11. Generate a debug token

Now we must use the IDE to generate the debug token. Then we must move a copy of this debug token to where the cordova tools expect. To do this we must add the device to the IDE.

add_device_step1

From the “No Device Selected” dropdown select “Manage Devices”

add_device_step2

Click the “Set up new bb10 device” button

add_device_step3

Use the IP address we wrote down earlier and the password you have set on your phone.

Now click next until it asks if you would like to generate a new debug token or import one. Please do generate a new token and follow the on screen instructions. Once the debug token has been pushed to the device the IDE will ask you if you would like to download debug symbols. We do not need them but there is no harm in downloading the symbols anyway.

Now run the following command to move the debug token to where cordova can use it:

cp .rim/debugtoken1.bar .cordova/blackberry10debugtoken.bar

The filenames are important so please do not change them.

12. Add device to cordova

Since it is cordova which does the heavy lifting we must tell cordova how to connect to your device. Since cordova remembers devices on a project by project basis you must navigate to Template’s sample cordova app.

cd WebWorks-Community-APIs/BB10-Cordova/Template/sample

Now edit the following command with our device’s IP address and password:

./platforms/blackberry10/cordova/target add dev_phone 192.168.1.199 --password PASSWORD

13. Build the native binaries

We must use the IDE for compiling the native binaries. We must add the plugin to QDE and then use a non-obvious build command so please follow the screenshot guide:

import_template_step1

Select Import from the main dropdown menu

import_template_step2

Select import from existing project

import_template_step3

Select the root directory of the plugin’s project.

import_template_step4

The plugin’s project directory is the one which contains the hidden .project file. It is the following folder: ~/WebWorks-Community-APIs/Template/plugin/src/blackberry10/native

import_template_step5

Now click finish and you’ll have the plugin project in the IDE

import_template_step6

Now before we build we must set the active target profile to build. We want to build for the regular “device” profile.

import_template_step7

Once the active build configuration has been set to “device” we can build by selecting the “Build Selected” option.

import_template_step8

14. Use cordova to build and run the plugin sample

Now the fun!

Run the following commands to copy the plugin’s native binaries into the plugin sample and then build and run the sample on our device!

cd ~/WebWorks-Community-APIs/BB10-Cordova/Template/sample
cordova plugin rm community.template
cordova plugin add ../plugin/
cordova run

15. You’re done!

You should see the sample app runing on your device. It should look something like thus:

sample_app_running

When developing your plugin whenever you make changes to the native files you must use the IDE to build new binaries as we did in ste 13 and then use step 14 to test them.

Congratulations!

Microsoft Internship Final Week

It took the entire month of august and much of September to understand what I think of my last week at Microsoft. I hope this post can explain why I am encouraging my friends to apply for Microsoft yet made the decision I did.

 

Sunday I finished writing a blog post. In said blog post you’ll notice I am optimistic in getting a job offer from Microsoft.

 

Monday I programmed extra features for OCASE BCDE. As BCDE’s framework and sub-systems were all complete features were easy to implement. Also on this day I received a cold email from a Google recruiter. She invited me to “Discuss opportunities at Google” so we arranged a phone call on the next Monday. At this time I took the request at face value and assumed the discussion would cover Google, their recruiting process, and an invitation to apply for a position. In reality the phone call was a phone screening, I’ll cover the results later. My guess is the cold email was triggered by my blog post.

 

Tuesday was my meeting with my Microsoft recruiter for the final recruiter meeting. The normal process has this meeting on Friday. My meeting was on Tuesday due to time conflicts with a presentation my mentor arranged for BCDE to the OCASE team to take place early morning Friday.

 

Prior to Tuesday’s final meeting I had prepared myself for my first real salary negotiation ever. Over launch I asked my co-workers about their negotiations. None of them appeared comfortable talking about the issue. The general impression I got being the whole idea of negotiating was just not a thing polite engineers did. I think part of the issue was me being a junior engineer. One co-worker suggested that “When your a new graduate you don’t really have any leverage”. You’ll notice he was being polite and holding back the obvious “Daniel, stop being uppity and accept the generous offer, if given!”.

 

In truth I was surprised at their reactions. Over the years Hacker News has drilled into my head that programming on a salary is business trade. The company is not family, coworkers can be family, but the company is a business partner. Now consider that Microsoft uses stack ranking to allocate raises. This makes raises a zero sum game. What dollar of raise you get is one a guy down the hall did not get. Managers thus only have control over the relative allocation of a pot set by upper management. Or to put another way: upper management decides how much they would like to spend and you will have no practical recourse to object. Even more annoying is that Steve Ballmer congratulated himself in the 2012 shareholders letter on managing cost increases. As software companies are labor cost dominate he was in effect bragging to the shareholders about suppressing salaries. Of course this is the same CEO responsible for losing billions on bad business decisions. Thus I was not looking forward to having a boss who suppressed my salary so he could look good to the investors as he lost massive quantities of money chasing the competition.

 

Now we know at this same time Steve Ballmer was being pushed out of Microsoft. He still has a year but the knowledge he’ll leave does make me feel better about Microsoft’s future. In either case Microsoft could survive for an eternity on Windows, Office, Azure, and Dynamics. Rather my concerns were about the culture. Microsoft risks becoming yet another Oracle or SAP.

 

It is with these worries and annoyances I approached the final meeting. If I was to accept an offer it needed to be generous enough as to make Microsoft employment worthwhile for the money along. You’ll recognize that working some-place only for the money is a very bad decision. If I had to specify my dream job criteria it would be (1) in japan, (2) contributing to open source, (3) high profitability. The offer I received qualified under (3). For others Microsoft might work on things they want to contribute towards so don’t fret if you are not me.

 

I must apologize to my recruiter and coworkers for taking so long to decide. I waited one week before making my final decision official. I did not want to say no while still working, it would have been too hard to see my mentor and boss afterwards.

 

I have no remembrance of Wednesday. I can only assume it was a productive day.

 

Thursday was a big day being my second last day and having the big summer intern event. This event was a trip to the Boeing Museum of Flight plus a concert. Boeing had a All Nippon Airways 787, the new airplane, parked as a backdrop for the evening. Prior years had events at parks with country bands. This concert’s final act was DeadMou5. In truth his music does not lend itself to concert format. Towards the night’s end the songs started rolling together. After the concert we formed a mob like line and group by group received the night’s gift, a 256GB Surface Pro. A fantastic looking device.

 

Friday was spent on one last attempt at adding concurrency to BCDE. This would mark the third attempt at such. BCDE relies on dbgeng, the windows debugging engine behind Windbg. To the best of my knowledge dbgeng was not intended to debug multiple binaries in parallel. Either that or I could not identify the undocumented correct mix of COM APIs.

 

Saying goodbye to my mentor and boss was hard. I think they knew I was not going to accept the offer but they did not challenge me on the issue. That night I stayed late trying for concurrency. Once I decided to stop working the building’s receptionist had already left. Since I still had my badge to return I walked to the my boss’s boss’s office, then my boss’s boss’s boss’s office, then my boss’s boss’s boss’s boss’s office. At this point I had exhausted my WinSE boss hierarchy. Two or three more boss levels and I would be at Ballmer. This being 7pm I headed back to my area of the building and found a still present coworker and asked him to hand in the badges for me.

 

I must congratulate Microsoft on fantastic work-life balance. People have time in the morning to do things like drop their children off at school before coming in to work. In only rare cases were coworkers forced to stay late to pass a critical security bug off to india based coworkers.

 

The flight home on Saturday was peaceful and I got home without issue. Monday I had the phone call with the Google recruiter I mentioned earlier. Before I told her I was not accepting the Microsoft offer she was suggesting interviewing within the week. Since I still want to explore all my options that would have been inconvenient.

 

It is now a month into my second last semester. After this semester I will start the job hunt. Until then I’ll work on projects and encourage friends to push themselves. I think pushing yourself now is important as it will put yourself in a position to push yourself throughout life.

IMG_20130725_211504

Deadmou5 on stage in front of an ANA 787

IMG_20130727_110504

MS recruiting gave out a $10 starbucks giftcard for completing a survey.

 

Calgary in view at last!

Calgary in view at last! Nice to be home.

Update 2013-10: If you are still interested please consider reading through the overview of my internship.

Microsoft Internship days 63 to 70

Second last week! Or atleast it would have been if I had not fallen behind on blogging. I am writing this entry over a month later. My second last week was a peaceful week of programming on my major commitments. The bugs I was assigned earlier in the month were fixed and it was too late for new bugs. I presented my project to the team and explored how they could use the software.

On friday I went kayaking with my manager as part of a WinSE team building exercise for interns and their managers. I was nice talking with my manager about microsoft, life, and his programming career. Altogether it was a nice day yet the kayaking was tiring.

IMG_20130719_103444

The morning’s clouds soon burned off and ample sunshine was enjoyed by all.

IMG_20130719_131315

After the kayaking they fed us delicious mexican food. To finish the day off all the interns received a hoody.

Update 2013-10: If you are still interested please consider reading through the overview of my internship.

 

Microsoft Internship days 55 to 62

After PPSSPP shipped my key mapping commit I transitioned to more relaxed weekends. A bit too relaxed in that my blog posts have fallen three weeks behind. I am writing this 5 days away from my final day and two days from my final meeting with the recruiter. I am 90% sure they will have an offer for me. I have not made up my mind about accepting so it will depend on the offer and how far I can negotiate. Operating systems programming is what I think I want to do for the next five years but I will have to see how I can fit that into my life plan.

As per usual I have nothing unusual to report. Work was progressing well and I focused on my second project. This second project is largish and coolish, I am not sure if I have mentioned it yet. No intern events that I remember.

What I can report are these various photos I got over the week.

IMG_20130701_104534

Redmond was enduring a heatwave so I took an alternative route through a forest to work. Said forest is in Microsoft campus’s centre and is next to the visitor centre. The visitor centre is where my new employee orientation was held.

IMG_20130701_195613

I went shopping the day before and bought a box of 100 freezes. I resorted to making freeze “salads”. After microwaving the salad I decided things were getting a bit silly and had some tea.

After a long 6 week wait my SSN card arrived. My roommate says his SSN only took 2 weeks and my recruiter had never heard of such a long wait. It was worrying but did arrive with plenty of time so no harm no foul. Still combined with my missed flight caused by US immigration all my interactions with the US government have been worse than hoped for.

IMG_20130703_100134

On the way to work I stopped by the bank to register my SSN. Microsoft was holding a take your child to work day and the commons (Microsoft’s largest cafeteria) was packed with families. On the soccer field in front of the commons they arranged these kid attractions. The guy in the lower left was being interviewed and appeared to be talking about university recruitment and work life balance.

IMG_20130710_092224

New Microsoft cups! No functional changes just a new color scheme.

Update 2013-10: If you are still interested please consider reading through the overview of my internship.