Archive for the ‘General Knowledge’ Category

oliverm

The Gist of Code Sharing

Wednesday, April 17th, 2013

Agile development teams often need to share code while in the heat of battle.

At the high end of the scale, there are publicly-accessible repositories, such as GitHub. Creating a GitHub project is obviously overkill for those wishing to simply pass a few key lines of code to their buddy in the next seat.

For stand-alone, runnable demo code, sites like Plunker and JSFiddle  are great. You will see references to these sites wherever HTML, CSS and JavaScript bugs are reported; for example stackoverflow and the AngularJS Google Group.

But again, maybe overkill for just a few lines.

So what are the other options for code sharing?

  • Email – I suppose, but there may be delays in receiving the email if your server is slow.
  • Skype or other messaging service – Alright, but you lose history eventually.
  • USB Key (sneaker-net) – It works, but it is hard to share it with a lot of people and history is also an issue.
  • Gist – This has been around a couple of years but I’ve only just discovered it since it is baked into IntelliJ/WebStorm. Gist is a GitHub sub-project and is associated with your GitHub account. For example, my GitHub account is at https://github.com/oliverm2112 and my Gists are at https://gist.github.com/oliverm2112. Gist allows developers to post snippets of code in various languages and features in-place editing and syntax highlighting.

Here is a Gist home page and a code sample:

 

 

 

 

Here is a shot of IntelliJ/WebStorm’s abilitity to create a Gist from within the IDE:

Hopefully you will find this a useful way to share information.

oliverm

Favourite Windows Utilities

Tuesday, November 27th, 2012

By Oliver Merk – principal consultant

I recently had the pleasure of setting up a new laptop and had to remember all the utilities I had on the old one. Most are free, the rest are well worth the cost. So I’ll never forget again, here’s a list of some of my faves:

DesktopOK

Save and organize icon layouts for different resolutions. Remember to select the little British flag in the lower left unless you sprechen sie deutsch.
http://www.softwareok.com/?seite=Freeware/DesktopOK

allSnap

Snap all windows to the edge of the screen and to each other… I miss Gnome!
http://ivanheckman.com/allsnap/

Direct Folders

Quickly access favourite folders from the desktop or from within dialogs.
http://codesector.com/directfolders
Here’s a demo: http://codesector.com/directfolders-demo

TeraCopy

Copy and move files with hash checking, queueing and pause/resume.
http://codesector.com/teracopy

Win7TaskbarMasher

Move windows on top of the Windows 7 task bar. Luxury!
http://www.csparks.com/Win7TaskbarMasher/

Unlocker

Remove file locks and optionally delete locked files on next re-boot.
http://www.emptyloop.com/unlocker/

QTTabBar

Add tabs to Windows File Explorer. What a concept!
http://qttabbar.sourceforge.net/

StartupControlPanel

Prevent those pesky programs from starting up with your system, especially those that didn’t ask your permission.
http://www.mlin.net/StartupCPL.shtml

T-Clock

Style that ugly Windows clock!
http://www.stoicjoker.com/tclock/

 

Enjoy, and let me know if you have any that you’d add to the list!

 

alaint

AndroidTO – 2012

Friday, October 26th, 2012

By Alain Thibodeau – Consultant

A few of us attended AndroidTO yesterday. This full day event was full of exciting talks in three different tracks: developer, designer and business. I stayed in the developer track for most of the day; for me there were a few sessions that stood out.

 

Peter O’Blenis: Rethinking Mobile UX – The Era of the Natural User Interface (NUI)

I’ve always been interested in the area of UX and out-of-the-box designs. Peter’s presentation was about the Natural User Interfaces and how to implement them properly. His company and team developed a product called Flick Virtuoso. They take the application’s design right out of Adobe After Effects with a custom plugin. They then add on the business logic and compile for all platforms. Peter explained that they wrote everything in C++ to bypass the OS layer. Dealing with the chipsets is apparently easier than dealing with the different operating systems because most of them are the same and there are less to deal with. It also helps achieve the best possible performance and experience on any device of any platform.

Here are a few videos and more information:
http://www.freakinawesomeapps.com/
http://vimeo.com/49760532

 

Matthew Patience & Greg Carron: The Multi-Screen Experience

Having seen these two guys’ NFC talk last year, I was excited to see what they had up their sleeves. This time, they focused on Smart TVs and the multi-screen experience. Matthew explained that the Android’s capabilities for making your phone talk to your Android TV was not up to his standards yet. So he created his own free, Open Source SDK .  Matthew and Greg proceeded to demo this with a GoogleTV multiplayer game. The game starts with a QR code that both phones used to identify each other. Once the game knew of its participants, Matthew and Greg played the game and saved the city of Toronto…

There were a few things that stood out for me at this presentation: GoogleTV is alive and thanks to Matthew, it is easier now to connect your device to it. Exciting times.

Vicinity:
http://www.matthewpatience.com/vicinity/
https://github.com/MatthewPatience/Vicinity

GoogleTV:
http://www.google.com/tv/

 

Andrew Rybak

Webinar Reminder

Thursday, May 31st, 2012

A reminder about our upcoming webinar on June 13th at 1pm EST. During this webinar NTG and Appcelerator will discuss mobile development strategies. We are particularly excited that Appcelerator’s Mike King will be joining us to share his thoughts and insight. Prior to joining Appcelerator, Mike was Research Director for Mobile at the Gartner Group. He has authored Gartner’s Magic Quadrants for MCAP (Mobile Consumer Application Platforms) and MEAP (Mobile Enterprise Application Platforms), as well as the Magic Quadrants for Wireless LAN, U.S. Wireless Carriers, and the Packaged Mobile Applications Market Scope.

This event promises to be highly informative. We invite you to join us; you can register at: https://ntg.adobeconnect.com/_a164689/mobile-dev-strategy/event/registration.html

oliverm

What’s Your Backup Plan?

Wednesday, February 29th, 2012

As developers, people assume that we’ve got some bullet-proof backup system for all of our code, documents and media. In most cases, nothing could be farther from the truth.

Ask yourself these questions: If your computer blew up right now, how long would it take to restore, recreate or re-download all the files that it currently contains? How long would it take until you’re productive again?

If your honest answer is more than “a couple of hours”, read on…

If you use a computer regulary, take note: it will happen. It may be while you’re working on an important document, or when you’re trying to boot up in the morning. And it will happen at the worst possible time. Your system will be toast.

So how can you shield yourself from this impending disaster? The following is a description of my backup routine. Feel free to take the parts you need to build your own.

  1. All code I write goes into a repository, such as SVN or GIT, typically several times a day. Whether it’s for work or a personal project, I have no interest in re-writing code. I’m a developer, so I’m more interesting in writing *new* code;)
  2. I own a small FTP device which has two mirrored 2TB drives. After a year of use, I’ve still got 1.6TB remaining, so I’ll be OK for a few more years with this capacity.
  3. I purchased the Linux/Windows version of Beyond Compare which allows you to compare files and folders on your local machine, across the network or over FTP. I love the ability so set up different comparison sessions so I can quickly see what’s out of sync between two folders. During a typlical work day, I might sync up two or three times, depending on how many bits I’m generating.
  4. Found a good YouTube video or legally-aquired MP3? Don’t make these files part of your backup. If they’re worth keeping, burn them onto a DVD and free up your hard disk space. I do the same with the plethora of Linux Live CDs that I download as ISOs.
  5. Discipline. It took a few data disasters before I finally woke up and became obsessed with backing up my stuff. Today I’ve actually got four copies of my important data: the FTP device, two desktops (home and work) and a laptop. If any one of these fails I can use one of the other three to get back to business.

Reply to this post if you have any other great backup strategies to share!

Chad Upton

NFC vs QR Codes

Sunday, December 4th, 2011

By Chad Upton – senior consultant

Smart phones brought the productivity of computers to our pockets, but their tiny size didn’t make any improvements to the full-size keyboards we leave at our desks. Smart phone users want quicker ways to enter text or website URLs.

QR Codes

Square bar codes, or QR codes are an easy way to “scan” text into your phone. This makes it easy for you to visit a website or copy useful text, such as phone numbers or contest entry codes into your phone without touching the keyboard.

QR codes have been around since they were invented by a Japanese company in 1994. Originally used to track products in warehouses, QR codes were designed to replace traditional “vertical line” bar codes. Traditional bar codes just represent numbers, which can be looked up in a database and translated into something meaningful. QR, or “Quick Response” bar codes were designed to contain the meaningful info right in the bar code.

They’ve been a successful marketing tool in Asia and Europe, but they’ve had limited success in North America. A recent survey of college students found that 81% of college students owned smart phones, but only 22% were able to successfully scan the QR code. Many students didn’t know a third party app was required on most platforms (iOS, Android, BlackBerry). Windows Phone is the only mobile platform that supports QR codes natively, and it has one of the smallest market shares.

Data types supported:

  • URL
  • Text
  • Phone Number
  • SMS Message

The support for Phone Numbers and SMS Messges is great, it allows you to scan a QR code and have that info pre-populated for you.

NFC

Near Field Communication (NFC) is a technology that offers similar use cases to QR codes, but through a different medium. While QR codes require a camera to “scan” the code, NFC uses a low powered magnetic field to send and receive data. That’s right, NFC has a peer to peer mode that allows bi-directional communication.

NFC is supported in the latest versions of Android, BlackBerry OS and Symbian. iPhone and Windows Phone support is expected next year. Although it has a lot of superior capabilities to QR codes, it does require specialized hardware in the phone. NFC is still fairly young and a little over a dozen handsets are currently available with the technology, but that number is expected to grow quickly.

Data types supported:

  • URL
  • Text
  • Phone Number
  • SMS Message
  • Email Message
  • Business Card/VCard
  • Signature
  • Bluetooth or Wifi connection parameters

As you can see, NFC supports a few more data types than QR codes. The vcard support is great, bump your phone with someone else’s to exchange contact info.

Comparison

QR codes and NFC offer some overlap in uses, but each one has fundamental advantages over the other for certain situations. If you’re running a contest and you want users to enter via text message, QR codes could be scanned from TV, magazines, newspapers, billboards, transit ads, etc. It would be more costly to put an NFC tag in every magazine or newspaper, so QR might be the right choice here.

But, lets say you were attending a large event and wanted to connect to the secure wifi network. You could flip through all the event info to find the SSID and password for the network, but you’d much prefer tapping your phone as you enter and have it automatically connect in seconds. This is how technology is supposed to work.

Both technologies help you get small amounts of info into your phone without typing it, but each one has pros and cons.

Technology Pros Cons
QR Codes inexpensive, print/display anywhere, all phones have the hardware, scan pre-composed SMS messages can be difficult or time consuming to scan, not always weatherproof
NFC good native device support, weatherproof, quick and easy to scan, two way communication possible more costly, cannot be used in as many ways as QR codes, limited phones supported at this time

Be sure to “like” us on facebook to stay in the loop.

bslack

Objective-C Debugging Overview

Friday, November 18th, 2011

By Brandon Slack – Consultant

This is a simple guide that goes over some of the basics one should know when debugging Objective-C. Over the six years that I have spent working with Objective-C I have noticed some patterns and learned some tricks that have helped me to debug some really hard issues. I will be publishing various entries going forward on debugging tips and tricks. Starting first with the basics (console output) and moving onto more advanced techniques both in objective-c (posing, zombies, etc.) to gdb (how to use it, how to move your instruction pointer etc.) to using instruments. So check back often for further updates. Without further ado, I introduce Part I.

Part I: Console Output (The Basics)

This section walks you through the basics of using console output to debug. It starts off with a review of standard out and standard error, and explains the difference between buffered and unbuffered output, in particular, how that could effect your debugging output. It ends with a description of how to customize the logging output of an objective-c method through the overriding of the ‘description’ method.

Simplicity is usually the answer when it comes to debugging. Sometimes the quickest and easiest approach to debugging a problem is log statements. Whether you use a logger, or printf, or NSLog, getting output on what is happening is one of the most simple and powerful tools that can be used to solve problems.

For creating console output you would typically use one of the following functions:

void NSLog(NSString *format, …);
int printf(const char * __restrict, …);
int fprintf(FILE * __restrict, const char * __restrict, ...);

There are of course many other functions that would allow you to output to console, but those are the three big ones I often use. If you are working on a bigger project, you might even have developed your own that will output to both console and a log file, and perhaps even format the output for you.

Typically you would output to a file or console or to some other stream. There are two very common streams that are predefined in stdio for you.

stdout (Standard Out) – This stream usually outputs all text to the console or terminal that you are working in. One thing to keep in mind with this stream is that it is typically a buffered stream, sometimes line buffered, sometimes buffered by size. The point is that you might write to stdout and not see anything appear on the console. You may write several lines to stdout and only see the first three or four. This is an important thing to understand that this stream will not output until its buffer is full or has reached a threshold. You can however force output of this stream prematurely by using the ‘fflush’ function which is also defined in ‘stdio.h’. Calling this will immediately force everything in the buffer to be outputted. You should try to avoid calling this function when possible however as it does involve a small amount of overhead and could therefore be a small point of performance loss. When debugging an application that uses output to stdout, I typically have a fflush(stdout) command at the end of my run-loop.

stderr (Standard Error) – This is the other pre-defined stream. It also typically outputs to console and is typically used to output diagnostics or error reporting information. A big difference between stdout and stderr is that stderr is unbuffered unlike stdout. This is again platform specific, and you should always double check, but scenario is that stdout is buffered and stderr is not. This means that anything you output to stderr should appear right away at the output terminal. This can cause some confusion for some people. As you could have a scenario like the following:

"Hello World" --> stdout
"Error Message" --> stderr
"Hello Again" --> stdout

Typically, at the output terminal, you would expect to see:

Hello World
Error Message
Hello Again

But what they might actually end up seeing is:

Error Message
Hello World
Hello Again

It also goes back to the fact that stdout might be buffered, and therefore will not be outputted right away, where as stderr is typically unbuffered and therefore outputted immediately. This is something important to keep in mind when debugging and outputting data.

One other important aspect to stdout and stderr is that there output locations can be redirected. Typically, they both go to terminal or console. However a user has the ability to pipe their contents to a file. Further, a user could pipe stdout to one file and all the stderr statements to another file if they so desire.

<stdio.h> Output

The printf, and fprintf functions are both defined in stdio.h and is therefore part of the C standard library. The printf function will output to console on stdout all the time, where as fprintf, allows you to specify the file that you wish to output to. So typically you might find:

1) printf("Hello World\n");
2) fprintf(stdout, "Hello World\n");
3) fprintf(stderr, "Hello World\n");

Lines 1 and 2 are equivalent. Both go to standard out, where as line 3 is directed to standard error instead (and as previously explained might be unbuffered). Another important thing to note is that we have a ‘\n’ at the end. This ‘\n’ indicates that we want to start a ‘newline’. The printf family of outputting does not automatically output to a new line each time you use it. You need to tell it when you want to start a new line.

The printf family of functions also allows you to output other information such as numbers, strings etc. You can output a number by doing:

printf("My number is %d\n", 14);

This will output

"My Number is 14"

The ‘%d’ is a format specifier that dictates where the number should be positioned. A string would have a different format specifier as would characters and pointers etc. If you need a refresher on this, you should probably take a read of this:

http://www.cplusplus.com/reference/clibrary/cstdio/printf/

The same format specifiers will work in fprintf that work in printf.

NSLog Output
NSLog is an output function provided by the foundation framework which is typically included when you are building most Objective-C projects. It is very similar to the printf family of functions and can use the same format specifiers to output information from variables. There are however four differences:

1) NSLog is set to output to stderr (in contrast to printf).
2) NSLog always appends a ‘\n’ (newline) to the end of your log statement for you. Therefore you no longer need to use ‘\n’ at the end of your log statements to drop down to a new line. This is done automatically for you. Therefore, if you do add a ‘\n’ at the end of your log statement you will drop down two lines instead of one.
3) NSLog accepts NSString objects as the format string as opposed to CStrings. E.g.

printf("Hello World\n");
NSLog(@"Hello World");

Notice the ‘@’ symbol in objective-c means that we want this to be a NSString object. Also notice that no ‘\n’ is needed.

4) A format specifier has been added, the ‘%@’ format specifier. The ‘%@’ format specifier is the specifier that you use to output Objective-C objects that inherit from NSObject (typically most objects). There are ways to output objects that do not inherit from NSObject, but thats beyond the scope of this introduction.

EDIT: The NSLog format specifiers can be found here:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html

The most interesting part is the new format specifier ‘%@’. This allows us to print an object out to console. Say we have the following:

@interface Foo : NSObject {
     int x;
}
@end

@implementation Foo

- init {
    if((self = [super init])) {
        …
    }
    return self;
}

- (void)dealloc {
    …
    [super dealloc];
}
@end

A typical object, and then we have:

Foo *f = [[Foo alloc] init];
NSLog(@"Output: %@", f);

What we would typically see go to the console is this:

Output: <Foo: 0x10036d5e0>

That is the name of the object, plus is memory address. This is a nice way of uniquely identifying a reference to an object, but nothing more, and it could be hard to follow. What you can do is add more information by overriding the NSOjbect’s ‘description’ method. The description method accepts no parameters and always returns a NSString. Here is an improved version of Foo that will give us more output:

@interface Foo : NSObject {
    int x;
}
@end

@implementation Foo
- init {
    if((self = [super init])) {
        …
    }
    return self;
}

- (void)dealloc {
    …
    [super dealloc];
}

- (NSString*)description {
    return [NSString stringWithFormat:@"%@ - X: %d", [super description], x];
}
@end

Now when we do the following:

Foo *f = [[Foo alloc] init];
NSLog(@"Output: %@", f);

What we will see in the console is something like this:

Output: <Foo: 0x10013caf0> – X: 0

Notice how we now have information on the ‘x’ variable and its value. You will notice if you look at my override that I call ‘super description’ as well and put that at the begging of the string. This is not strictly required, but I have found when making subclasses, it is always nice to output the super classes description. You never know what it might have and what information it might add.

There is another ‘special’ method you can override that is often overlooked. It is called ‘debugDescription’. This will get called, before ‘description’ when the print-object function is called. It can be useful when debugging, especially in the debugger where you might print out more detailed information then you might log. This will be discussed more in a future update.

alaint

Publishing your Air app on Amazon Appstore for Android

Wednesday, November 9th, 2011

By Alain Thibodeau – Consultant

If you are thinking about publishing your Adobe Air Mobile application on the Amazon Appstore, there is one gotcha you must know.  The actual publishing process is about the same as on the Android Market, if not easier. But, if you miss this step, you will waste time and get an email back from Amazon refusing your app.

Amazon wants you to point the Adobe Air download to their Appstore, and not leave it to the default Android Market. What this means is that, if the user does not have Adobe Air installed, they will be pointed to the Android Market to install it. Makes sense that Amazon wants to bring traffic back to them and not the Android Market. So, there is one change you need to do in order to make this happen.

When you export a build release, on the “Packaging Settings” window, there is a Deployment tab. Under Application Store Settings, change the value of the AIR download URL to the Amazon Appstore.

You can also use the command line compiler and use the airDownloadURL option. Make sure you have the latest URI, it seems to change once in a while.

-airDownloadURL http://www.amazon.com/gp/mas/dl/android?p=com.adobe.air

Example Ant target:

...
<property
    name="amazon.uri"
    value="http://www.amazon.com/gp/mas/dl/
    android?p=com.adobe.air"/>

<target name="package.amazon">
    <exec executable="${ADT}" dir="${android.dir}">
    <arg value="-package"/>
    <arg line="-target apk"/>
    <arg line="-airDownloadURL ${amazon.uri}"/>
    <arg line="-storetype pkcs12"/>
    <arg line="-keystore ${cert}" />
    <arg line="-storepass ${cert.password}" />
    <arg value="${app.name}_amazon"/>
    <arg value="${app.name}-app.xml"/>
    <arg value="${app.name}.swf"/>
</exec>
...

For more information about Amazon Appstore for Android and Adobe Air, click here.

 

 

oliverm

Links roundup

Friday, November 4th, 2011

Here are a few unrelated links I’d like to pass on for your reading pleasure.

  1. Opportunistic Refactoring by Martin Fowler, author of the best programming book ever (Refactoring).  I’ve been preaching this one for a long time: “while you’re in there, refactor any smelly code, but don’t get caught in a death spiral”.
    http://martinfowler.com/bliki/OpportunisticRefactoring.html 

  2. jQuery4u – lots of great jQuery plug-in round-ups. I’m starting to visit this almost daily now.
    http://www.jquery4u.com/ 

  3. Finally, for you old KDE 3 fans, the beast is still alive and well. I loaded this onto a VM and started feeling very sentimental for the old days when KDE didn’t suck and I didn’t have to settle for Gnome.
    http://www.osnews.com/story/25283/KDE_3_5_Fork_Trinity_Releases_Third_Major_Update 

As usual, I look forward to your comments on any of these.

Oliver

Andrew Rybak

Enterprise Mobile App Survey

Thursday, October 13th, 2011

New Toronto Group recently participated in a global Enterprise Mobile App Survey where we shared our perspective on the issues around developing and deploying enterprise apps on mobile devices.

The survey results have been released and they provide some excellent food for thought. In many cases they echoed what we have been hearing from our clients and prospects. One of the areas that I found particularly insightful was around the barriers to increased usage of mobile enterprise apps. Here are the top barriers listed and the percentage of survey participants that mentioned them as a concern.

  • security issues (e.g. integrating personal devices, data wiping ) 68%
  • fragmentation of mobile platforms/devices 40%
  • increased administration & management costs 37%
  • lack of sophisticated app solutions for the enterprise market 31%
  • mobile network capacity limitations 25%
  • lack of internal app store solution for companies incl. billing and fulfillment 19%
  • lack of app management know-how 18%
  • resistance from partners & customers (externally) 10%
  • resistance from employees (internally) 6%

What do you think? Are these concerns similar in your organization?