So I’ve splashed out the 600euro and got me a SIM free Samsung Galaxy S4 Android phone.
Well I find myself doing more and more JAVA these days (as if I wasn’t busy enough keeping up to speed on .NET and iOS too) and I’ll admit it’s starting to win a place in my heart, not the language as such as it’s IMO inferior to C#, but the framework has lots little gems, there are some pretty nice external frameworks e.g. Drools, JBPM etc, and the application servers are interesting (I'm focusing mainly on JBoss AS7 these days); what I’m trying to say is that I’m starting to feel that Android may be a home away from home.
Well I’ve previously two timed my iPhone with a Windows Phone 7, this lasted for about 10 months before I moved back to iPhone, I guess one of the biggest reasons for doing this was I’d invested in a few iOS apps like the very expensive TomTom Worldwide and I kept finding a need for it (I travel with work and don’t always have roaming data). Also the lack of apps was disappointing, even though I contributed to the ecosystem with a WP7 app for Grass Management. I know the app situation is improving especially with Microsoft buying them up but I see too many complaints on social feeds to make me think they are a little shaky (is it the fault of the developers? … maybe!). When I moved back from WP7 to iPhone I complained for a few days over little nuisances, but I stayed there. Until now….
Android a week on
I’ll admit I was a little apprehensive at first thinking I’d like only the big screen and the ability to write and deploy some droid apps on a real device (i don’t include the Samsung Galaxy Y that’s lying about the office as a real device :-) )
But I’ve been very surprised, the Android apps appear to be better, the experience appears to be better, notifications are better. Why do i think this is? well maybe because the API allows the developers to do more, iOS does really lock things down which has it merits (we’ve all heard about the apps that silently call premium numbers).
- The screen is large and beautiful
- Camera is fantastic
- Have all the apps I had on iPhone (not yet paid for TomTom again but will)
- I don’t have the ability to have widgets on the lock screen when I have a PIN active.
- The screen is too large! Contradiction I know, but I’ve hands like shovels and I need two of them for this device, apple has a great argument but it won’t win out.
Am I going back
Well never say never, but apple needs to up it’s game with a bigger screen, I always thought it was fine until I look back on my iPhone now and think it’s tiny
I’ve been looking at a c++ application that uses ACE library, now I’ve never used this library myself, I used to love BOOST when I was 100% c++ (way back in the day sniff sniff). C++ 11 has drastically improved life sure but it’s not got everything I need.
I decided to do a bit of googling to see what I’ll be dealing with and below was the first post I came across on StackOverflow…. oh dear! not a great start for my motivation :-(
Do yourself a favor and steer clear of ACE. It's a horrible, horrible library that should never have been written, if you ask me. I've worked (or rather HAD to work with it) for 3 years and I tell you it's a poorly designed, poorly documented, poorly implemented piece of junk using archaic C++ and built on completely brain-dead design decisions ... calling ACE "C with classes" is actually doing it a favor. If you look into the internal implementations of some of its constructs you'll often have a hard time suppressing your gag reflex. Also, I can't stress the "poor documentation" aspect enough. Usually, ACE's notion of documenting a function consists of simply printing the function's signature. As to the meaning of its arguments, its return value and its general behavior, well you're usually left to figure that out on your own. I'm sick and tired of having to guess which exceptions a function may throw, which return value denotes success, which arguments I have to pass to make the function do what I need it to do or whether a function / class is thread-safe or not.
Boost on the other hand, is simple to use, modern C++, extremely well documented, and it just WORKS! Boost is the way to go, down with ACE!
Good evening, I’d like to share my solution for using MVC5 Owin security with VS2013 Update 1.
I wanted to have my own DBContext contain both my own DBSets and also the security tables.
Now I could find zero documentation on this and I actually walked away from the bleeding edge last week and reverted to MVC4. Tonight I had some free time and like a dog with a bone I wanted to figure this out. I’m not saying I came up with the nicest or correct solution, but alas I came up with something that appears to be working for me.
Please feel free to give me any feedback I’d appreciate it.
I wanted one single database containing my own entities and also the security entities.
I wanted to use the latest MVC5 built on the OWIN (open web interface for .net).
I wanted to use code first migrations to keep my database up to date.
I could find no documentation..
- Create my own entity class
- Create my own DBContext and IdentityStoreContext (the secret sauce)
The SiteCertDbContext derives from the IdentityDbContext used by default in MVC5 Update1.
- Tell the account controller use this new DbContext
That’s pretty much it, hope it helps someone else out you can now open the Nuget package manager and Enable-Migrations.
I’ve been shown a lovely little utility for testing with JUnit 4.11 whereby one can have a list of items performed as part of the single unit test.
First set add the annotations you see below and set your inputs and expected outputs. (Arrange and Assert)
Then create a constructor and some static variables to store each Tuple
Then define your single unit test (the business logic is your Action)
That’s it, a really nice way to have a single unit test that can be run multiple times with different parameters.
If you would like to do the same sort of testing in .net you have some choices to make.
you could use NUnit and use the TestCaseAttribute
Of if like me you prefer MSTest then you can opt for a data driven unit test.
See this vs2013 page (has worked at least since vs2010) :
- I’ve gotten my hands dirty,
- I’ve published v1.0 to the store
- I’ve gotten the best support I’ve ever seen from Xamarin
- I’ve gone back to Objective-C, BOOM!
Bindings drove me daft
The reason I walked away was that I found some nice Objective-C widgets I wanted to use. In order to use these in Xamarin I needed to either
- Port the source to c# (estimated 1 day)
- Create a library in XCode and a component binding in Xamarin Studio
The first option seemed like an approach I could achieve but did I really want to do this every time I found a nice new control.
The second option proved painful, there were some tools that didn’t work (beta tools of course), I wasn’t quite clear about the multi targeted library I was building etc. It was the straw that broke this camel’s back.
Now I’ve previously indicated that I’m not a seasoned ObjectiveC developer, but I’ve written a few app and some of them even made it to the app store, so for me it didn’t seem daunting…
I had a few obstacles to overcome:
Basic Auth: I’ve posted before when I started my Xamarin rants that it was a little painful to do Basic Auth, I wanted to use blocks as I like this approach and not the delegate approach, but this was a little painfully or at least it meant that I had to write my own classes, what I did in the end was revert to my old friend AFNetworking that supported exactly what I needed.
KeyStore: The Obj-C code is bloated and verbose and not intuitive, the Xamarin approach is so much easier.
Too many options or being a polyglot can be a PIA (and i’m not talking primary interop assembly), If I didn’t know objectiveC then I would have just figured out the Bindings faster and been happy.
What would I recommend to my fellow C# programmers…. Use Xamarin! I haven’t, but I’ve already invested many hours/days/weeks the language and 3rd party libraries, the mono stack gives you a lot of
this for free and you will be familiar with it from your .net background.
Also the app I’m currently working on is just collecting Json and displaying it, so it’s not very code intensive on the client. If when an Android version is done it will be in Java because I’ve programmed in Java for years too (hey I’m looking for an excuse (and the time) to try this new Android Studio).
Given a different use case I we may well have an even more compelling reason for using C# for both platforms with something like MVVM Cross and achieve a more DRY approach.
I was releasing an app to the the Apple App store tonight (actually two apps, I've done an Atley Hunter ;-) )
One of my apps encountered a problem when I tried to upload my archive:
"This bundle is invalid. The UIDeviceFamily key must be present when requiring a MinimumOSVersion of at least 3.2."
This did confuse me for a while, I did a bit of research and this information is supposed to be set automatically with XCode when I set the target platform.
Given I was using Xamarin Studio I was a little unsure where I stood so i took a shot in the dark.
I changed the platform in Xamarin to Universal and then back to iPhone/iPod problem solved,
hope this tip helps someone
Xamarin vs XCode
- Html5 Desktop Client
- iOS native client
- Droid native client (I’ve never strictly speaking done one, unless you include my hello world post two years back)
- PhoneGap/KendoUi iPad/Droid apps (I’m doing the phone apps for my Expenses service with these technologies).
My first instinct was to go the PhoneGap with KendoUI, I actually did the initial layout and had a look in the Android Emulator and it was pretty nice (as I was in London I didn’t have my MacBookAir with me and I didn’t have the Visual Studio Phone Tools installed either so eclipse/android it was with that painfully slow emulator). The problem I encountered with this approach was that CORS was not enabled by default and I use visual studio to develop design debug (PhoneGap can do CORS once the site is white listed).
My next option was to write the native clients, when I arrived back home I quickly ensured I could connect to the server with basic authentication, I used objective-C firstly, I didn’t use any 3rd party libraries and the end result appears a little verbose (a better iOS developer will probably cry when they look at these screenshots and tell me use AFNetworking or blocks etc (which I used in my BrianKeating.net companion app).
Make the initial request and delegate to the view class.
Here i set the username and password for the request when/if challenged.
Here i allocate a place to store the response if it’s was a success and save to data into urlData.
Here I list all the key value pairs in the JSON returned (something I don’t actually show in the c# version.
The attraction of XCode/Objective-C to me is that it’s a different toy to play with.
C# is just a fantastic language it’s RAD and Xamarin have done a fantastic job of bringing it to the iOS and Android Platforms. This screen shot shows the same request to the server as done in XCode, the difference is that this took me about 1 minute where the objective-c version took me about 25 (although i did reuse the storyboard).
You said Decision?
So how will I proceed? I’m going to ditch the objective-C approach for sure:
- It’s so much faster! I love C++ but can’t get myself to use it for app dev these days simply because C# kicks it to touch for rapid application development, same goes for Objective-C
- Because I don’t expect to continue this POC myself and will have to hand it over to someone, and I don’t know anyone else on the team that knows objective-C.
I’m actually still leaning towards the PhoneGap/KendoUI option, I just need to get my grubby hands on the server so i can add the CORS headers (again because I don’t want to do the bulk of my debugging with Phone gap but rather IE/Chrome and I quite like my browser stack (jQuery/Knockout/Breeze etc) but the main advantage is that the the same source can then be used for the Android platform. Sure Facebook/LinkedIn etc have all been moving away from html5 because of the tooling, but I feels it’s the best solution for getting to both markets quickly.
So that is my reasoning, I expect everyone with be faced with much the same decisions and will have to weight the pros and cons themselves.
I wish to follow up on my previous post Uploading a file in MVC4 C#5 .NET 4.5
I promised a few things here, an Ajax client, WinRT, iOs, Droid, This post addresses the ajax upload.
First some background, I’m working on an expense tracking system at the moment, the core technologies involved in this Single Page Application are:
- ASP MVC4 WebApi
- Html5 SPA
A fundamental part of this system is the ability to upload receipts.
When the user browses to an image file, it gets converted to base64 and uploaded via a MVC4 Api controller.
Here are the important parts:
First we create an image where we can display either the previously selected image or the newly selected image.
Secondly we bind the html5 input file with a knockout binding.
The important parts are the image and imageType properties, there also exists a computed property that joins these two so it can be displayed in an image tag. The reason i keep these separated is that I can’t post the source as is without further encoding.
In knockout.js you are not limited to the built in bindings like, click and value, you can create your own,
I’ve taken https://github.com/khayrov/khayrov.github.com/blob/master/jsfiddle/knockout-fileapi/ko_file.js as my start point, this pretty much does what I want, however I made a slight tweak in that i wanted base64. (basically because I’ve written some of the objective-C iOS app already and didn’t fancy changing it).
All source can be viewed @ https://github.com/brianbruff/Expenses
So I’ve had a problem uploading a file using a HTML5 input of type file field.
For love nor money could I see a problem with the code above (in my defence I’m working on this project late in the evening and have my First dose of Man Flu this year, I’m a 2012 survivor see: www.manfluanonymous.com )
When i get into my server code an exception was getting thrown when i read the multipart post.
All the Googling in the world didn’t help me, I saw lots of people adding “\r\n” which I’m still scratching my head over to be honest, I saw others complain about the MVC4 beta..
But hang on: I’ve done this before: So what has changed? actually something really silly ,
I simply forgot to set the input name attribute!!!
Hope this helps somebody …
There are two steps, the first step is to register a facebook application, after you register you will have a key and password. The next step will be to insert these into you application.
Enable OAuth login using Facebook, Twitter
Steps to get keys for Facebook
That’s it, you can no log in with facebook, see the placeholder template below.