Wednesday, February 15, 2012

Choosing a mobile framework: Identify which critical functions you think it's OK to implement/write for yourself

This is a follow-up for Choosing mobile dev platform/framework and looks closer at the third step - Identify which critical functions you think it's OK to implement/write for yourself.


It should be fairly simple to narrow these elements down, if you still have something left on the list from the first step. You should always consider each function that you want to implement yourself, if it might be better to let the framework handle it (if it can...).

I need the following to functions in my current project:
  • Basic image manipulation
  • Drawing/Painting

Let's have a closer look:

Basic image manipulation: I need crop, rotate and zoom. These are fairly simple to implement. If the framework has image manipulation, I will weigh towards it, but it's not that critical. My current project can even survive without it.


Drawing/Painting: I need to be able to draw simple figures. I do have some SVG's that I do want to use for drawing some simple images, which should be possible to fill. I've added a google presentation below to show it. This can be implemented as a canvas (html5), opengl, some native drawing wrapper, or other options. I prefer if it has some built in 2d vector functionality, but falling back to opengl is also acceptable. (And would probably perform better as well)

As my app cannot function without drawing/painting, I do feel this is so critical, that it's worth using most of the development time on this area.

Here's what it should be able to do:



Note about the image: I've used images from google image search, so if you do have a copyright on any of the images, please let me know, and I'll be sure to mention you in the post, or remove the image if you don't want it in the sketch.


Some of these features might require quite an amount of work to implement, so always consider if you either learn a great deal about the framework, the platforms, programming techniques, and if you can reuse any of the code in a later project. Also consider if you can use any third party helper libraries to ease your development, and probably speed the development time up as well. However, you are in full control when you write from scratch.

Choosing a mobile framework: Identify critical functions, you don't want to implement yourself.


This is a follow-up for Choosing mobile dev platform/framework and looks closer at the second step - 
Identify critical functions, you don't want to implement yourself.

You need to identify which functionality you don't want to implement yourself, in order to figure out what framework to start with.

This is most likely core functionality of a framework or third party libraries for the framework. I prefer core functions over third party libraries, as you never know when a third party library might stop supporting newer versions of the framework or newer platforms. (Well, to be honest, you newer know this for a framework either, but is usually a risk worth taking.)

What are critical functions you don't want to implement? I mean functions that you shouldn't need to go into native code on each platform supported by the framework. For instance if you do want sound in your application, that is most likely a critical function.

From the list from step 1 I had three functions that the framework needed. As the application I'm working on is a bit larger, and I do want to "future-proof" myself, I expanded the list a bit to the same as in the original post.
  • Drag and Drop
  • Basic access to camera
  • HTTP(S) request support
  • JSON support
  • Custom user interface elements (Must be possible)
  • Custom user interface placement  (Must be possible)
  • Audio playback (simple)

Why I don't want to implement these functions myself?
Let me go through each function:

Drag and Drop: I've done drag and drop before Qt natively supported it, and it was a hassle. I've done drag and drop on the web before there was a properly cross-browser drag and drop javascript library. It wasn't worth the workload.

Basic access to camera: It will be diffcult and timeconsuming to make sure you are up to date on all platforms/devices for this one.

HTTP(S) request support: It's not that difficult to implement if the platform supports tcp sockets, but it's better if it's supported directly.

JSON support: There are tons of libraries for json, so that should be fairly simple to implement yourself, but since there are that many json libs, it's likely that one or another is built into the framework. It's easier and better to choose a framework that already has it.

Custom user interface elements and placement: I do need a bit more than push buttons and text fields. Who doesn't? There are enough text-box-push-button-radio-button apps out there. However for this step it's important to figure out how to implement it. Does it require OpenGL, are there core graphics functions for custom UI elements? Do you use HTML/CSS? How is the performance?

Audio playback: Should be fairly simple to playback a mp3/wav or similar file on the given platform. For this project it's non-critical when looking at latency, but I know already that if latency is critical, Android is currently not possible, however, I know that Google has this on their roadmap, so maybe later.

This raised a few questions for each functionality, which will be addressed when digging into each framework.



Tuesday, February 14, 2012

Choosing a mobile framework: Listing all the feature you need

This is a follow-up for Choosing mobile dev platform/framework and looks closer at the first step - Listing all the features you need.

To figure out what features you need, you need to sketch up your application and figure out what each screen/image does. How you create your sketches is really up to you. I usually use Google presentations, MS Powerpoint, Adobe Photoshop, a simple drawing program, a notepad or what feels right.

I've created a small small sketch one part of the app I'm working on. The rest of the sketches are with pen/paper.

Basic sketch for one of the parts in my project:


Note about the images: I've used images from google image search, so if you do have a copyright on any of the images, please let me know, and I'll be sure to mention you in the post, or remove the image if you don't want it in the sketch.


Basically this part consists of selecting something you want to do and, then you are given a drag-and-drop activity which again gives a reward. This is mostly used for training people with special needs in order to coordinate movement, and/or work with cognitive stimuli. Usually this kind of apps are fun for kids as well.

From these sketches I see that I need the following features:

  • Images
  • Buttons with text
  • Audio playback
  • Drag and Drop
  • Animation or video playback

Now I remove some features which I assume any framework supports, and if it doesn't, it's probably worth skipping that framework.
  • Images
  • Buttons with text

Then there are three functions which is needed:
  • Audio playback
  • Drag and Drop
  • Animation or video playback

The rest of the list from the original post also included : "Basic image manipulation, Basic access to camera, Drawing/painting, JSON support, HTTP(S)-request support, Custom user interface placement, Custom user interface elements."

You now have a feature list for your framework and you are ready to move on.




Monday, February 13, 2012

Choosing mobile dev platform/framework

After going through all the various frameworks, I'm close to finding which framework I will use for some projects, and which isn't really suited.

Here's some steps that will help you to identify which framework to start with for a project, and one example from me

1. List all the features you need
Figure out ALL the features you need for a project, not only the most important ones. Include anything that might be a function or feature.

My feature list for one project is:
  • Drag and Drop
  • Text to Speech
  • Basic image manipulation
  • Basic access to camera
  • Drawing/painting
  • JSON support
  • HTTP(S)-request support
  • Custom user interface placement
  • Custom user interface elements
  • Audio playback (simple)

Choose all the features that you cannot be bothered to implement yourself, which you feel the framework should handle and you . (Or a third party plugin to the framework)

The critical features for one of my current projects
  • Drag and Drop
  • Basic access to camera
  • HTTP(S) request support
  • JSON support
  • Custom user interface elements (Must be possible)
  • Custom user interface placement  (Must be possible)
  • Audio playback (simple)

Basically the opposite of 2. Critical functions that must exist in the app, but you do feel it's ok to write/implement these yourself.

Only 2 things I think I need to write for myself, and can accept doing.
  • Basic image manipulation
  • Drawing/Painting

Any features you think your app can be release without, but they should be there later, bonus for the framework if it's already in-there/supported

Basically the features from 1 that aren't in 2 or 3. For my project that would be:
  • Text to speech

Any platform you do need and/or your target audience uses.
I need to target:
  • Android (both phones and tablets)
  • iOS (both phones and tablets)
  • Windows Phone 7 (currently only phones, but most likely tablets in the autumn)

If there are any languages you don't want to learn, and therefore need to avoid, write them down so you don't end up choosing a framework that only supports a language you don't like.
I only have 1 language I prefer to never write software in, as it usually ends up limiting what you can do on a platform: (And the syntax sucks)
  • Visual Basic/Basic (I've used it way back, and it "does not compute...")

Any framework you think it's worth considering. Later on you will need to consider why you should choose a framework or why you should avoid it. There are many factors worth considering when choosing your framework.

The frameworks I consider for this project are:

This one isn't always easy, as you probably want both desktop, mobile, web-based and non web-based. Consider what your target audience is. Usually it's easy to combine web-based mobile app with an actual app or a desktop app with an web-based app, but making it to all three with one codebase is most likely going to be diffucult, or will require a lot of hacks in your code.

I needed an web-based app for integration in VLE's as well as a actual app in the appstore. As my current target audience are schools with VLE's, but they are moving fast forward into tablets, I found this difficult. I chose to target tablets and phones through the appstore first, then VLE's through web later.


This is the timeconsuming part. You probably want to use a few days for this one, and there are tons of articles to read up on various frameworks. 

Update 14/02/12: I missed a few features I need for the project I'm using as an example

I'll follow up on this post going through each step, and with some links to pages that are worth reading regarding frameworks, as well as how I narrowed down which frameworks I'm considering for this project.


Steps in details:

  1. Listing all the features you need.
  2. Identify critical functions, you don't want to implement yourself
  3. Identify which critical functions you think it's OK to implement/write for yourself
  4. Choose which features that isn't critical, but is "nice" if the framework handles
  5. Choose the platforms you need to target
  6. Any programming languages you want to avoid?
  7. Make a list over frameworks you do want to look into
  8. Choose if your app should be web-based or an actual app in the appstore or both, should it be mobile and desktop?
  9. Start investigating the features of each framework
    1. Marmalade SDK
    2. Appcelerator Titanium
    3. Moai SDK


Friday, February 3, 2012

Convert from svn to git

Time to convert all those old SVN repositories to GIT... I'm using bitbucket for everything now.. On ubuntu do "apt-get install git git-svn" first

Short script to do it all: (it's not perfect, but it does the job...)

#!/bin/bash
# variables:
# existing svn repository
SVNREPO=$1
# new git repository
GITREPO=$2
# username
# SVNUSERNAME=$3

# DO THIS FIRST TO CREATE USERLIST: (just do it manually, and add all users into one big file)
# for getting authors
# svn log $SVNREPO -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" quot;, "", $2); print $2" = "$2" <"$2">"}' | sort -u > ~/svn_convert/authors-transform.txt
#now edit ~/svn_convert/autors-transform.txt

#create temporary git folder
mkdir git_tmp_repo
cd git_tmp_repo
#clone repo to git
git svn clone --no-metadata -A ~/svn_convert/authors-transform.txt . -T $SVNREPO

#optimize repo
git gc
git fsck

# clean SVN sections from Git
git config --remove-section svn
git config --remove-section svn-remote.svn
rm -rf .git/svn .git/{logs/,}refs/remotes/svn/

# add remote
git remote add origin $GITREPO

# push to master
git push -u origin master

# remove temporary git folder

cd ..
rm -rf git_tmp_repo

Friday, May 27, 2011

Interesting SAPI TTS bug (windows)

After having trouble getting our SAPI voice to play "nice" on certain XP computers, I debugged a few installers of other SAPI voices.

They were all writing some keys to HKLM\SOFTWARE\Microsoft\Speech\PhoneConverters\Tokens\Universal

As for some XP systems the settings here aren't correct, and what happens is that voices which doesn't have language ID set to 409 doesn't work.

Who would have thought that PhoneConverters registry settings would affect TTS on Windows?

Basically here's the keys you need to add to your installer: (Wix example)
<registrykey action="create" id="REGMSUniversalPhoneConvFix" key="SOFTWARE\Microsoft\Speech\PhoneConverters\Tokens\Universal" root="HKLM">
  <registryvalue type="string" value="Universal Phone Converter">
    <registryvalue name="CLSID" type="string" value="{9185F743-1143-4C28-86B5-BFF14F20E5C8}">
      <registryvalue name="PhoneMap" type="string" value="I 0069 Y 0079 IX 0268 YX 0289 UU 026F U 0075 IH 026A YH 028F UH 028A E 0065 EU 00F8 EX 0258 OX 0275 OU 0264 O 006F AX 0259 EH 025B OE 0153 ER 025C UR 025E AH 028C AO 0254 AE 00E6 AEX 0250 A 0061 AOE 0276 AA 0251 Q 0252 EI 006503610069 AU 00610361028A OI 025403610069 AI 006103610069 IYX 006903610259 UYX 007903610259 EHX 025B03610259 UWX 007503610259 OWX 006F03610259 AOX 025403610259 EN 00650303 AN 00610303 ON 006F0303 OEN 01530303 P 0070 B 0062 M 006D BB 0299 PH 0278 BH 03B2 MF 0271 F 0066 V 0076 VA 028B TH 03B8 DH 00F0 T 0074 D 0064 N 006E RR 0072 DX 027E S 0073 Z 007A LSH 026C LH 026E RA 0279 L 006C SH 0283 ZH 0292 TR 0288 DR 0256 NR 0273 DXR 027D SR 0282 ZR 0290 R 027B LR 026D CT 0063 JD 025F NJ 0272 C 00E7 CJ 029D J 006A LJ 028E W 0077 K 006B G 0067 NG 014B X 0078 GH 0263 GA 0270 GL 029F QT 0071 QD 0262 QN 0274 QQ 0280 QH 03C7 RH 0281 HH 0127 HG 0295 GT 0294 H 0068 WJ 0265 PF 007003610066 TS 007403610073 CH 007403610283 JH 006403610292 JJ 006A0361006A DZ 00640361007A CC 007403610255 JC 006403610291 TSR 007403610282 WH 028D ESH 029C EZH 02A2 ET 02A1 SC 0255 ZC 0291 LT 027A SHX 0267 HZ 0266 PCK 0298 TCK 01C0 NCK 0021 CCK 01C2 LCK 01C1 BIM 0253 DIM 0257 QIM 029B GIM 0260 JIM 0284 S1 02C8 S2 02CC . 002E _| 007C _|| 2016 lng 02D0 hlg 02D1 xsh 02D8 _^ 203F _! 0001 _&amp; 0002 _, 0003 _s 0004 _. 2198 _? 2197 T5 030B T4 0301 T3 0304 T2 0300 T1 030F T- 2193 T+ 2191 vls 030A vcd 032C bvd 0324 cvd 0330 asp 02B0 mrd 0339 lrd 031C adv 031F ret 0331 cen 0308 mcn 033D syl 0329 nsy 032F rho 02DE lla 033C lab 02B7 pal 02B2 vel 02E0 phr 02E4 vph 0334 rai 031D low 031E atr 0318 rtr 0319 den 032A api 033A lam 033B nas 0303 nsr 207F lar 02E1 nar 031A ejc 02BC + 0361 bva 02B1 G2 0261 rte 0320 vsl 0325 LG 026B  NCK3 0297 NCK2 01C3 LCK2 0296 TCK2 0287 JC2 02A5 CC2 02A8 DZ2 02A3 TS2 02A6 JH2 02A4 CH2 02A7 SHC 0286 rhz 02B4 QOM 02A0 xst 0306 T= 2192 ERR 025D AXR 025A ZHJ 0293">
          
          <registrykey action="createAndRemoveOnUninstall" id="REGMSUniversalPhoneConvFixAttr" key="Attributes">
            <registryvalue name="Language" type="string" value="436;41c;401;801;c01;1001;1401;1801;1c01;2001;2401;2801;2c01;3001;3401;3801;3c01;4001;42b;42c;82c;42d;423;402;455;403;c04;1004;1404;41a;405;406;465;413;813;809;c09;1009;1409;1809;1c09;2009;2409;2809;2c09;3009;3409;425;438;429;40b;80c;c0c;100c;140c;180c;456;437;807;c07;1007;1407;408;447;40d;439;40e;40f;421;410;810;44b;457;412;812;440;426;427;827;42f;43e;83e;44e;450;414;814;415;416;816;446;418;419;44f;c1a;81a;41b;424;80a;c0a;100a;140a;180a;1c0a;200a;240a;280a;2c0a;300a;340a;380a;3c0a;400a;440a;480a;4c0a;500a;430;441;41d;81d;45a;449;444;44a;41e;41f;422;420;820;443;843;42a;">
          </registryvalue>
        </registrykey>
        </registryvalue>
      </registryvalue>
    </registryvalue>
  </registrykey>

It tells the SAPI tts what languages should be "accepted". The problem is that these keys might be correct on some computers, or even modified for other purposes, and then again rendering a voice non-functioning. (If you have old Voxit Budgie Pro versions with certain voices, you will experience this issue, as some of the installers write other settings to this area).
If you are developing SAPI voices and are experiencing this issue, please look at the Language code under the Attributes setting for your voice in the registry.
The path for your voice should be: (replace YourVoice with the proper name)

Tuesday, July 20, 2010

Using wix3 and heat to create a wxi through xls transform.

Here is a transform file which can be used with wix3 and heat if you want to create a wix include file (wxi) from a wxs fragment.

Update: Added CompnentGroupRef, CompnentGroup and CompnentRef incase -cg flag is used with heat on a fragment.
<xsl:stylesheet exclude-result-prefixes="wix" version="1.0" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output encoding="UTF-8" indent="yes" method="xml">
  <xsl:strip-space elements="*">
  <xsl:template match="/">
    <include>
      <xsl:apply-templates>
    </xsl:apply-templates></include>
  </xsl:template>


  <xsl:template match="wix:ComponentGroupRef">
    <xsl:element name="{name()}">
      <xsl:copy-of select="@*">
      <xsl:apply-templates>
    </xsl:apply-templates></xsl:copy-of></xsl:element>
  </xsl:template>


  <xsl:template match="wix:ComponentGroup">
    <xsl:element name="{name()}">
      <xsl:copy-of select="@*">
      <xsl:apply-templates>
    </xsl:apply-templates></xsl:copy-of></xsl:element>
  </xsl:template>


  <xsl:template match="wix:ComponentRef">
    <xsl:element name="{name()}">
      <xsl:copy-of select="@*">
      <xsl:apply-templates>
    </xsl:apply-templates></xsl:copy-of></xsl:element>
  </xsl:template>


  <xsl:template match="wix:DirectoryRef">
    <xsl:element name="{name()}">
      <xsl:copy-of select="@*">
      <xsl:apply-templates>
    </xsl:apply-templates></xsl:copy-of></xsl:element>
  </xsl:template>


  <xsl:template match="wix:Directory">
    <xsl:element name="{name()}">
      <xsl:copy-of select="@*">
      <xsl:apply-templates>
    </xsl:apply-templates></xsl:copy-of></xsl:element>
  </xsl:template>


  <xsl:template match="wix:Component">
    <xsl:element name="{name()}">
      <xsl:copy-of select="@*">
      <xsl:apply-templates>
    </xsl:apply-templates></xsl:copy-of></xsl:element>
  </xsl:template>


  <xsl:template match="wix:File">
    <xsl:element name="{name()}">
      <xsl:copy-of select="@*">
      <xsl:apply-templates>
    </xsl:apply-templates></xsl:copy-of></xsl:element>
  </xsl:template>


</xsl:strip-space>
</xsl:output>
</xsl:stylesheet>

If you need other elements it should just to copy the templates for File, Directory, Component or DirectoryRef and and rename the match. 

To use it, use the -t parameter when calling heat.exe
Example: (above saved as transform_fragment_to_inc.xsl)

heat.exe" dir "files\to\harvest" -gg -g1 -nologo -scom -sfrag -srd -sreg -svb6 -template:fragment -t:"transform_fragment_to_inc.xsl" -out "include_file.wxi"

Note: this xsl doesn't support registry entries or registering of com components when harvested by heat.