Skip to main content

Posts

Showing posts from 2017

iOS Dynamic Type

On iOS devices within accessibility section of general settings you can change the text size, making it (much) larger or smaller. I hadn't come across this before, but to get your application to work with the user's settings you use 'Dynamic Type'. These are "UIFontTextStyle" elements which will automatically size around the user's text size setting. The settings available and their relative sizes are:Large Title - 44ptTitle 1 - 38ptTitle 2 - 34ptTitle 3 - 31ptHeadline - 28ptBody - 28ptCallout - 26ptSubhead - 25ptFootnote - 23ptCaption 1 - 22ptCaption 2 - 20ptThese values can be set in "Text Stye" for relevant elements, in xCode click the 'T' for the font and select desired style from the list.Note: if you want your page to automatically resize existing elements if the user changes the text size whilst your app is open you can override 'awakeFromNib()' and set '.adjustsFontForContentSizeCategory' to 'true' for…

Saying yes to one thing is saying no to something else!

The one bit of advice I wish I'd received much earlier in my career is:Saying yes to one thing means that you are always saying no to something else!It seems pretty obvious when you think about it, as time is finite. So every little task you take on, is consuming a part of that finite resource. When you're starting out, you're probably 'time rich / cash poor' which is probably the worst combination as it almost always rewards taking too much on. You've got more time and you're still learning, so over committing a little won't hurt surely? The worst possible thing then probably happens, you're rewarded for your efforts with promotion and salary increases.....and the beginnings of a bad habit is quickly formed / re-enforced.In the beginning you are probably saying no to your leisure time:- I really want to get this done and I'd only be sitting at home and it's only this once / small thing. Slowly, as your career develops, you'll most…

Error updating SQLCipher

We recently encountered a bug when migrating an android application from Eclipse to Android Studio. As a part of this migration the reference to SQLCipher version was updated from a really old (several years old) version to 3.5.4. After the migration, for existing users, the application was falling over and using the log (below) we identified it was failing when trying to use the new version of SQLCipher to open a database that had been created / encrypted using the older legacy version.E/Database: file is encrypted or is not a database: , while compiling: select count(*) from sqlite_master; net.sqlcipher.database.SQLiteException: file is encrypted or is not a database: , while compiling: select count(*) from sqlite_master; at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method) at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91) at net.sqlcipher.database.SQLiteCompiledSql.(SQLiteCompiledSql.java:64) at net.sqlc…

Creating libraries and .NET Standard

As part of his fantastic 'What is .NET standard' presentation at DDD12, Adam Ralph provided an amazing amount of detail in such a short amount of time. One of the most valuable points, which is completely obvious when you think about it, is how you should work with .NET standard when creating libraries.NET standard now comes in a multitude of flavours: currently 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 and 2.0. When starting out with something new, we (as developers) often want to be as cutting edge as possible and probably haven't read the small print / finer details. So as a result, when creating our first .NET standard library a natural tendency is to create it targeting .NET Standard 2.0. Of course, that makes perfect sense - it's the newest so must be the best? It's definitely true, it is the latest and has the largest .NET framework coverage. BUT, and it is a big but. The library you are building can now only be used by other libraries targeting .NET Standard…

Know your frameworks, never stop learning!

Last year, as part of a series of posts, I asked "Are you investing in your own career?". This, in part, came about from a great quote that heard:Do you have 10 years experience, or 1 year's experience repeated 10 times?I think the majority of developers starting out are fired up and excited every day. Everything is new, everything is a challenge. Just getting something to work, no matter how, is a success.It can also be amazingly frustrating and tiring to be constantly learning and actively building your knowledge / skill-set. It's probably not a surprise therefore that it is so easy / appealing to back off a little bit for a break once you have learnt enough to satisfy the day job. Similar to over training in sport, it's probably even a good idea - no one can do anything flat out indefinitely.But what happens when you just continue backing off? The hard truth is, rather than continuing to build your experience, you do slowly start to fall into the trap o…

Accessing a "Class Library (.NET Standard)" from a "Console App (.NET Framework)"

If you're trying to access a class library (.NET Standard) from a traditional console application (in VS2017 those can be found under 'Windows Classic Desktop') you will run into problems; which can feel a little strange for something that was pretty simple in VS2015 and earlier. You can add a reference to the class library project (Resharper will even volunteer to add the dependency / namespace reference if you don't already have it). But the code won't then compile, it will complain that it can't find the namespace referenced in the using and it also won't be able to find any of the objects that you reference in the class library. Took me a bit of figuring out but you need to open up the properties for the class library project, look at the conditional compilation symbols in the build tab (it might be something like 'NETSTANDARD1_4'). You need to take this symbol and duplicate it in the build tab of the console application. You should now be…

Review of Bose QC35 Headphones

Working in software development, a decent pair of headphones is a must. I've lost count of all the pairs that I've owned over the years! I've had some really good wired pairs but they've tended to die an early death when kicking my chair back to scoot across the office to speak with a colleague and forgetting I have them on my head or round my neck. I did try wireless headphones once before, a pair of Sony's but the limited range, background noise, poor battery life and tendency to suffer from interference sadly had them quickly relegated to the cupboard. After trying a pair of QC-25's in the office and being impressed by their sound cancelling functionality I decided to splash out on the (at the time) newly released pair of QC-35's.So I've had them for a while now and have been meaning to write a review, which fits in nicely with a new year's resolution to update my blog a little more regularly than I've managed over the past couple of year…

Why do my Android Notification only appear in the status bar?

I'm definitely getting back into Android development, I'm remembering that feeling of 'Surely this should be easier than this!'. All I wanted to do was to schedule a local notification which behaved similar to a push notification pop-up. That is, as well as showing the small icon in the status bar I wanted it to pop up on screen to notify the end user. All seems fairly easily, I found this code for how to schedule a notification. That all worked perfectly, apart from the notification would only appear in the status bar. Searching around I found loads of different answers / solutions, mostly all saying the same thing:It only worked if you used 'NotificationCompat.Builder' in place of 'Notification.Builder', orYou had to set the priority to 'NotificationCompat.PRIORITY_HIGH'As usually happens, none of these solutions worked for me until I added in the missing piece of the jigsaw:- '.setDefaults(Notification.DEFAULT_ALL)'. For me this…

Links for starting out in Android development

A recent discussion at work made me realise that over the past few years learning Android development I've managed to build a short but very useful list of links for starting out. Not a really detailed post this time around, but hopefully these links help at least one person, let me know!Development environment: We started out using Eclipse, but now feel that there is only one IDE to learn, Android Studio 2.xHow to documentation: This has always been a big struggle, much of the information that you can find is quickly out of date and potentially incorrect. Luckily a team of volunteers have set up the Codepath Android Cliff-notes as a Github wiki. This team have also recognised the difficulty faced by many starting out with Android development and have put together a list of articles tackling everything to do with Android development and are maintaining that list to ensure it is regularly reviewed / updated to keep it relevant and useful. I really wish I'd found this when I…