Categories
Blog

Lockdown craziness!

Well, throughout all this lockdown, a lot has changed, and a lot more is about to change too! So currently, hold your horses, they’ll be like a real blog coming soon! ūüėú

Categories
Blog

iPad Pro Keyboard

So a while ago I decided to buy the iPad Pro 9.7″. Now as a developer, especially using Visual Studio so much, I spend a lot of time in Windows, you’re probably wondering why I went for the iPad over the Surface.

Well, it’s a good point! But I thought about it, and realised I wouldn’t really be using it for much developing and I really wanted an Apple Pencil. The price of the iPad with the Pencil is still cheaper than the mediocre Surface Pro, and then I was drawn to whether I’d want or need the keyboard.

But, I love the iPad Pro and the Apple Pencil in combination with the Microsoft OneNote App. It’s a fantastic note taking app and works beautifully with the Pencil, and then to be able to still see all my pencil notes on my PC or Mac is awesome.

But, I’ve been happy with both and decided I’d give the Keyboard a while. Now as a developer, I really don’t think I’ll be using it much for writing Websites and Apps, but I’ll certainly use it for quick bug fixing, commenting (if I ever do any!) and e-mails!

So, to start off, I love the design, because of the 3 splits, even though the keyboard goes over 2, it still allows you to put the iPad in all the positions it would normally go in with the Smart Cover. This, I especially like, as I like the iPad at a slight angle when I’m using it, rather than flat on the desk and I also like how you can stand it up with the keyboard still hidden behind.

It does make the iPad a little heavier, but nothing really to whinge about. Still much lighter than the Surface Pro.

When it comes to typing on it. It’s a dream! I’m really shocked how quickly I’ve been writing this blog using it. It almost reminds me of my old Sinclair ZX81! But they’ve got a nice, pressed, feeling when you press them, they are nicely spaced apart too, so no mistypes. I’m impressed. It types very well on a flat surface, but can be a bit bouncy on your lap, but it’s bearable.

But, when it comes to working in Windows, well unfortunately Microsoft need to do a little work with their Remote Desktop App. Everything works perfectly, apart from all the Ctrl, Alt, and Windows Keys. Which just makes it next to impossible to program! But, I’m hoping this is just a little bug, and will be fixed soon, as it just looks like the keys aren’t mapped, and it’s a pain to keep pressing the screen to get the keys. With regards to actually programming though, it’s not too bad! All the keys are where you expect them, especially if you’re a Mac owner! So you can still get all those lovely ()’s, {}’s and []’s! Along with # \ and ~, which I also find can be a pain to find sometime! Octothorp for example is a pain in the neck to find! Option 3 of course!

Altogether though, it works well, the Cmd + Tab shortcut works to switch between Apps, and even the good old Mac Shortcuts, like Cmd + W, to close Window, works. Safari is nice to navigate around and all the Office Apps work beautifully with the combination of Keyboard and Pencil. There is 1 really, really disappointing thing that has really bugged me. It doesn’t have and Escape key!!! It has a pointless ¬Ī¬ß Key, that I’ve never in my life used! But I clearly never press Escape!? This is the only disappointment to me, things like editing a cell in Excel, and I just want to get out without writing that change, press Escape, oh wait! No, tap the little red x on the Input bar. It’s a little annoying, but I suppose it’s something I can live with. Another useful set of keys that are kind of missing are Page Up and Page Down, there’s an End and Home, by using Ctrl + Up and Down, but no page up or down, again, I’ll live with it!

So overall, I think the Keyboard turns your iPad Pro into, quite a usable little, almost PC! It does make browsing the Internet a lot quicker, writing blogs like this, it’s a dream. Only other downer, is the price, when you spend a ton for a pencil, and then a ton and a half for the keyboard! Not to mention over ¬£50 for a back cover too, it can also turn you’re lovely iPad into a money draining machine!

Categories
Blog

hangfire

I’ve stumbled across an amazing ASP.NET / ASP.NET Core Background Job Scheduler called hangfire.

I cannot believe how amazing this is, how simple it is to use and how easy it was to implement it in my existing ASP.NET Core Web App.

One of the issues I stumble across quite a lot is handling the response timeout issue if I’m dealing with, either an incredible large amount of data, or waiting for another task to finish first. ASP.NET defaults to 90 seconds then disconnects the request, but the process still continues and may provide the response, but it’s been disconnected ūüôĀ

So, one quick way to resolve this is use hangfire! There is a cool configuration option to turn your controllers into Services, so as long as you make the methods public that you wish to call in the background, it all runs as if it’s part of the same process.

So after a very quick configuration change, you simply tweak your controllers so the calls, actually just Enqueue the job the call would normally make! I.e. The Get() method becomes the DoGet() method and the new Get() method just Enqueues DoGet()!

You can pass in the parameters as well, but remember to pass in the type in your Enqueue command, e.g. Enqueue<InfoController>(p => p.Id == id).

Next problem is actually getting the response! Well 2 ways of doing this, 1 polling and 2. SignalR. I opted for the polling option as SignalR for ASP.NET Core is still beta, but when it is released, I will definitely switch to that option. I use a static variable to¬†check on the progress of the job and return the data when it’s complete, but you could use the Database.

Handling errors is fantastic too! If the process Throws an exception it is visible via the Dashboard, which is a great debug tool, and hangfire automatically tries the process again. So if you don’t want it to try again, don’t throw an exception! Otherwise, it’s a good idea to keep track of where you are in the process, as the process will always start again, and if the problem is at 99% you’ll be gutted that it’s doing all of it again for no reason to fail at that point again, or if it does continue this time, do all of it again to only do the last 1%!

My next job is automating these jobs, and hangfire can do all that for me too! Seems simple enough, just having the time to implement it! Oh! Remember if you are hosting it on IIS to make sure the Application Pool is set to Keep Alive.

Other than that, check it out, can’t believe it’s free too, and there’s a Pro license if you wish to have greater control over Batch jobs and get more support.

Categories
Blog

Windows 10 Anniversary Update

Well it’s finally out, and it’s massive! I mean crazy big. It requires 16GB to update, and well it’s lying! It really requires about 22GB! Why? Because it won’t let you start the update until you have 16GB, and when it starts downloading the update, you obviously then have less than 16GB, so the installation fails, and then worse still, once it’s downloaded it can’t expand it!

Now, I don’t know about you, but I bet at least one of your Windows 10 or 8.1 devices you upgraded to 10 only has 32GB of eMMC. So I decided to wipe my Toshiba Mini Click to post Windows 10 upgrade, but refreshed. It left me with 16GB of free space. Started the download and fails.

So, I was looking at the partition layout, and decided to remove the additional 5GB recovery partition, as, well, I need the space, and don’t want to ever go back to Windows 8.1 anyhow.

So, tried to remove the partition but can’t as it’s 1. A recovery partition and 2. it wouldn’t matter anyhow, as I’d still have to move the other 500MB Recovery partition to the end, or just delete that too, and hopefully Windows will re-create it?!

But, then an added problem! It’s BitLocker encrypted! So finding the right freebie to do my re-partitioning and delete it! I normally use AOMEI, as it’s quick, doesn’t install junk and isn’t any better than any of there others! But only to discover it does not support BitLocker ūüôĀ So my next freebie is EaseUS, now I personally don’t like¬†this, as it installs all kind of other junk you never asked for, and that really annoys me. But, it’s free and it does the job! Just remove it all after, as it’s a clean installation of Windows anyhow!

So, I now have 21GB and away it downloads, and then starts to unpack and fails, as it runs out of disk space! Aaaaaarrrrggh! So head scratching here, realise it downloads the Windows 10 Update image to C:\Windows10Upgrade, so move it to my SD Card (D:) and run the update again. Pain in the neck thing starts downloading the update to the C: drive again. So here’s the solution!

Copy the Windows10Upgrade folder from the C: drive to a USB disk or SD Card, we’ll refer to D: drive. Now delete the copy on the C: drive, and create a Directory link from C:\Windows10Upgrade to D:\Windows10Upgrade, therefore the installation thinks the download is on the C: drive, but actually it’s on the D:, and now there’s plenty of disk space to complete the upgrade!

To create the directory link, Open up a Command Prompt (Administrator) and enter the following command:

MKLINK /D C:\Windows10Upgrade D:\Windows10Upgrade

I really hope they fix this issue, why it has to download to the C: drive, Microsoft only knows! But in an earlier update, it used to detect a USB or SD drive with enough space and use that temporarily, hopefully they’ll add that feature in to this update and help a lot of the devices out there with hardly any¬†disk space¬†to¬†actually receive this update! But in the meantime, I hope this helps!

Categories
Blog

iCloud KeyChain and Wi-Fi Passwords!

Well this is one that’s been driving me mad for ages! Here’s the scenario:

I want to visit my workplace with my MacBook Pro and obviously bring my iPhone with me to communicate with the outside world, as I’m behind a Proxy / Filter on the Wi-Fi, and as I’ve just got Three with Unlimited 4G so I’d prefer to use 4G on my iPhone and Wi-Fi on my MacBook, seems simple enough.

So, every time I go to work, I have to turn off my Wi-Fi on my phone, otherwise I don’t get any notifications. So I decided, I’m fed up with that,¬†so I’ll just Forget the network on my iPhone.

Then, I noticed my MacBook wasn’t connected to the Wi-Fi! Strange, so I join it back on, having to put the password in, and low and behold, my Phone reconnects to Wi-Fi! Aaaarrrgh!

On the one hand, the iCloud KeyChain is AWESOME! But it would be really nice if you could decide which networks you wanted to be specific on each device, but it seems you cannot do this, yet?!

So, here’s a temporary solution, it does mean you get the occasionally “Enter Wi-Fi Password” dialog pop up¬†on your phone, but once you’ve Dismissed it, it doesn’t show up frequently enough to annoy you!

So, Forget the Wi-Fi network on your iPhone. This will eventually filter through to remove it off your MacBook too. Now, rejoin your MacBook to the Wi-Fi, and then open KeyChain Access (Using Cmd+Space and typing k, is the quickest way!).

In the Keychain Access use the Search (at the top right) to find the name of the WAP that you connect to, and you’ll see there will be 2 entries. One is in the iCloud keychain, and one is in the System keychain. Simply delete the iCloud entry!

Now on your iPhone, turn off Wi-Fi, turn it back on again, and this time it won’t connect to the WAP, but may present you with the “Enter Wi-Fi Password”. Simply dismiss it and Tada!!

I don’t know how many other people suffer this tiny annoyance, but at least this is a temporary fix until there’s some sort of way of restricting info being transferred between your iCloud devices!

Categories
Blog

TACO

And we’re not talking about the food! But Tools for Apache Cordova.

I love Visual Studio 2015, and I’ve always used it for development in ASP.NET (C#), but I’ve made Apps for iOS in Xcode previously and used the likes of Brackets and Visual Studio Code on my Mac to write Cordova Apps.

So I decided to actually write it on Windows! Seems a bit weird to write something for Apple on Windows, but it’s more of a Cross-platform thing! Now as I’ve only ever previously written for Apple and only just recently converted an existing Cordova App geared for iOS and utilising a plugin written for iOS to Android, including re-writting the custom plugin in Java, which again I used to hate, but amazing once you start actually really using a language you start to like features, and I have to say that of Android. The more and more I use it, the more I like it, but you will still never move me away from my iPhone!!

But, writing an App in Windows using Android is great, Visual Studio compiles it all up, i.e. executes¬†cordova run¬†android! and happily runs in the Visual Studio Emulator or on a phone plugged in. So I wrote my new app for Android first (against every bone in my body!) and once it work started looking at all the¬†amount of extra bits you have to put here and there for it to work on both Android and¬†iOS, it’s just a nightmare! But I suppose it’s easier than writing 2 Apps! But silly things like iOS will only record in .WAV, whilst some Androids can record in .MP3 but all can record in .AMR, then Windows uses it’s own .WMA! So just making sure the extension on the file name is correct between the 3 platforms, not to mention “Documents” is not the same location on all, and doesn’t exist on all!

So, you go through and make the tweaks and then think, how do I compile this then? Well that’s where Remote Build Tools for TACO come in. Simply install it on a Mac with Xcode installed, and make sure Xcode has been setup to your account, then run remotebuild and the first run will give you a setup code to put into the Options in Visual Studio.

Then, you have a choice! Plug your iPhone into the Mac that has the remote build tools installed on, or plug your iPhone into your Windows PC, and make sure you have iTunes installed on it. Then you can compile, run and debug (AWESOME!) an App on an iPhone in Windows. How Cool is that!

But, I did run into a few issues recently and here are my solutions!

Cordova 6.1.0 does not work with TACO on iOS ūüôĀ Whilst it adds the Plug-ins, the project gets renamed to HelloCordova and therefore fails.

Simple solution, don’t use Cordova 6.x.x with TACO on iOS, use 5.4.1, until better support, and apparently, 2 days ago a new Visual Studio 2015 update apparently resolves this issue, but I have yet to check.

1st build on iOS runs fine, but subsequent builds fail with unrecognised token (a random letter).

Again, this is a strange one, after remotebuild builds the App it then transmits it back to Visual Studio, but for some strange reason the file remote_ios in the plugins direction always gets corrupt. So simply delete it! It will happily rebuild again, you can also copy and paste the ios file and rename it to remote_ios.

Other than that, it’s been a dream writing a cross-platform app in Visual Studio. The support in Visual Studio Code is apparently getting better, so I may check that out one of the days, but I like Visual Studio, been using it since day dot of .net and previously for good old Visual Basic, so if it ain’t broke, don’t fix it! So I’ll be continuing to us Visual Studio for many moons to come!

But, PTR Systems’ first app by myself and Richard Cooper is live on the Google Play Store, and is waiting for Review on iOS. But for those who are interested, check out prenatool.com, but like all my sites! It’s still under construction!!

Categories
Blog

WordPress and Linux

I’ve been using WordPress for a while now, mainly to set other people up with simple blog sites, but the more the more I’ve done that, the more I’ve started really liking it.

But, one thing I don’t like about it, is, it’s better on Linux than Windows. ūüôĀ Which normally wouldn’t be an issue, but as I develop in ASP.NET (3.5 / 4.5 / Core) using C#, I don’t have much in the way of Linux support, other than through Mono, and as I use WCF (Windows Communication Foundation) to communication with old school XML SOAP based Web Services, that’s one of the parts Mono really fails at. So I’ve also gone for Windows hosting.

But, WordPress and Windows go together like Baileys and Lime (Unless you like Cement!).

It all seems to work properly, in fact it does! There’s generally no problems at all with it. Unless you want to upgrade Plugins, or the whole installation, then you’re done for! Every time you install a Plugin of reasonable size (Jetpack, WooCommerce), it will hang and seem to do nothing, if you refresh the page, you’ll get an Error 500, go back to the original site, it’ll load, go into the Dashboard and you’ll see a Failed Plugin installation, again and again. You quite literally have to remove the plugin and re-install it to get the best change to make it work.

Or, in my case, forget it and buy a Linux host! Straight away you’ll notice the difference, speedier installation and every plugin installs with no problem! Which then leads me onto the Network installation of WordPress, i.e. self-hosted WordPress.com! I love it! I just wished it had support for the child sites to install their own Themes, hopefully that’ll be a new feature in v5! But in the meantime, only the Network super-admin has rights to install Plug-ins and Themes, and if the Network super-admin Network Activates a theme, the child sites have no choice but to have them Active, whilst if they are not Network Active, the child sites can Activate / Deactivate them. Not all Plugins are Network Install compatible.

So, I’ve decided to go for the whole kit and caboodle and go for a decent¬†Linux host with lots of resources and setup ptrsites.com¬†which I’ll dedicate to WordPress sites, be-it little Blog sites, all the way through to eCommerce sites with Forums and Communities. If you have a current WordPress site that you want to save money on, check back soon for some highly competitive, no silly deals where you get the website for ¬£1/month, then the following year it’s ¬£8/month or something stupid like that, I’m going for simple, straight forward tiered pricing with your own domain name support too, and as I’m a GoDaddy Pro, I can do all the putting the things in the basket for you, you’ll just have to pay! The only issue at the moment is, I am busy, busy, busy!

Categories
Blog

Privacy and Cookie Policies

Finally got my Privacy Policy up as required by Google AdSense’s policy and that EU Cookie law¬†on all my sites. I found using a WordPress plugin called uk-cookie-consent was the quickest way to achieve the notification, and found a free to use / copy / edit Privacy Policy which I skimmed over and added the extra required Google bits and bobs and pretty much copied and pasted it to all my other sites!

Took a while, but I suppose best to be safe than sorry and at the end of the day its required for Google AdSense, which has now been verified and live now on all my sites.

Categories
Blog

Google AdSense

As part of working for PTR Systems Limited, I am in the process of writing an App, where the client wishes the app to be funded using Advertisements.

As the App I’m writing will be cross platform (hoping all, but currently iOS and Android only), I decided a Cordova based app would be the way forward, and therefore did not want to use Apple’s iAd services, as I cannot use that on Android, yet I can use Google AdMob on IOS.

So, I decided to rig up Google AdMob to my new App, and at the same time rig up Google AdSense to this site.

Wow! Is all I can say! Google AdSense is easy to set up on the Google side of things, then to rig up the WordPress side of things, simply install the plug-in, connect your account, choose the location of your Ads and away we go!

Categories
Blog

Hello world!

Welcome to¬†peterlgarland.com, this is the first WordPress post! I like to leave it here, so my next post doesn’t feel lonely!