See you at Ignite in Atlanta

MSIgnite_Atl_Facebook

How to the fix the iCloud Backup (Never) problem in iPhone?

I am not one of the biggest Apple fan boy, but speaking truth I have been using their iPhone (thus iOS) for more than 5 years now. My first iPhone was iPhone 4.

Having said that, I am usually one of the consumers who would upgrade their devices on the very first day of it’s release of the newest iOS. To be honest, I have also been brave enough to run my iPhone with one of their BETA builds of iOS 5. Wasn’t a bad experience I should say.

Coming back to the iOS9, I was once again done with my first day upgrade and no issue noticed for the first 2 weeks untill one fine day my iPhone says that I haven’t backedup my iPhone for 2 weeks.

Strange. I use iCloud backup and it is supposed to auto-back up whenever I am Wi-Fi and charging.

I tried to manually press the “Back up Now” button but it would just not do anything. Another weird thing was that it also indicated my iPhone has NEVER been backed up but within “Manage Storage”, indicated that only 3 GB was left. I was like where is the other 2 GB gone.

Anyway, after numerous tries and going through suggestion on various forums I called up the Apple Support Customer number. Must say, I liked the call back option. The first executive was not very supportive and friendly. Was not able to help me and just ended up giving me the case ID and asked to call later.

Tried again after a week. This time, the fellow tried his best and even went to discuss the case with a “Senior Expert” (not sure what that means). Eventually, asked me to use the iTunes backup and sold the idea of purchasing more iCloud space. Good salesman skills :).

However, I was like I am not using much data to be backed up and quite sure that it’s way less than the free 5 GB.

Getting help from no official Apple support, I tried the following and am so glad that it worked like charm.

  1. Create a backup of iPhone manually on your computer using iTunes. See instructions here at: https://support.apple.com/en-us/HT203977
  2. Reset your iPhone to factory settings. https://support.apple.com/en-us/HT201274
  3. Setup you iPhone as a new Phone and DO NOT USE the backup option.
  4. AGAIN, Reset your iPhone to factory settings (Step 2).
  5. This time, use the backup from computer instead. See here: https://support.apple.com/en-us/HT204184

If everything goes well, you should have the backup working with iCloud.

How to use Spire.PDF to generate Word document from a PDF

Introduction

Earlier last year, I wrote multiple articles with my review and comments on the Spire.Doc product suite from E-iceblue.

First thoughts on Spire.Doc for .NET

Using Spire.Doc to convert documents

E-iceblue Co., Ltd. is a vendor of .NET, Silverlight and WPF development components. The goal of e-iceblue is always to offer high-quality components for reading and writing different formats of office files.

Our components have been widely-used by most of the Fortune 500 corporations. The key developers of e-iceblue have over 10 years of combined experience developing high-performance, high-quality .NET, Silverlight and WPF component technology.

Everyday, e-iceblue products help a large number of developers from large/small companies in more than sixty countries to easier, better, faster and to be more productive develop and deliver reliable applications to their customers.

Using Spire.PDF for .NET to generate word document from PDF

A common use case over the years has been to convert the word documents in PDF documents for various obvious reasons. However, the opposite scenario has been relatively complex to implement.

Thanks to the new Spire.PDF for .Net, this can be really accomplished with relatively ease.

In this article, I will give a small walk-though on my thoughts and usage of this component.

To start with, you can download the Spire.PDF installation package from the link below. The installation is quite simple and professionally wrapped in a MSI. However, note that you don’t need to install this package on every server where you install your app using Spire.PDF.

http://www.e-iceblue.com/Introduce/pdf-for-net-introduce.html

Spre.PDF Installation

Also, note that apart from the installer or a reference the Spire.PDF DLL, a valid license file is required.

At the time of writing this post, the price of various license is as follows. From the cost perspective, the return on investment is very high and this also provides you a support from the vendor. A win-win in my opinion.

Spre.PDF Price

Document Conversion

Let’s start with a demo project. The first step is to include the reference to the Spire.PDF and License assemblies.

Spre.PDF Project_1

The interface of the component is very clear is self explanatory. Even without looking at any sort of documentation, I was able to write “3 line” program which can convert the PDF document to a word document. (or any other support format such as HTML, Image etc.)

Spre.PDF Project_2

Ok, now when we are ready with the program; let’s create a document with different elements such as Heading, Table and a paragraph.

Spre.PDF Project_3

The good news is that Spire.PDF does the 100% conversion keeping the output Word document same as the initial PDF document. 🙂

Conclusion

Overall, I was impressed by the power and ease provided by this product. While it didn’t always do everything in the way that I thought it should, it is probably due more to my lack of understanding of how the Word document model works rather than a flaw in this library. From a license and pricing overview, it’s not very expensive compared to other products in the markets which are offering the same functionality. Thus, a real value for money in my opinion.

How to quickly setup your Azure Development Environment?

More than a post, this is note to self.

Honestly, over the years it has been so easier to set-up the development environment time and again. I use Azure Virtual Machines as my personal development environment. And of course, this being a personal development environment is ought to be not as clean as you would like it to be and there are chances that you want to recreate it from scratch. Here are the steps which I use to re-create by development environment:

Create Azure Virtual Machine

Of course, you can create a new machine via the portal. I just prefer to create it via the following script:

Change basic settings and Windows Features

Such as:

  • Install IIS
  • Disable Loopbackcheck
  • Enable PS Remoting
  • Disable IE Security Check
  • Set Execution Policy for PowerShell
  • Install Chocolatey (used later for installation of packages)

Chocolatey comes to picture

Chocolatey NuGet is a Machine Package Manager, somewhat like apt-get, but built with Windows in mind. Lately, I am a lot dependent on this and why not, I don’t have to keep a links of software, packages which I want to install. Chocolatey makes sure every-time I install the packages, I have the latest version and that too with just a single command. Isn’t it cool!

The essentials which I always install are as:

  • Visual Studio
  • Fiddler
  • Chrome
  • Firefox
  • NotePad++
  • WinMerge
  • Visual Studio Code

Passing –Yes to the choco command makes sure that it runs in the silent mode.

Of course, this is not the actual configuration of my development environment but this is how I usually start and my environment evolves based on need. Also, I deliberately skipped installation of SQL Server from this post and in scripts as it gives me a reason to make use of Azure SQL Servers.

How to call a RESTful web API using PowerShell?

Needless to say that my love for PowerShell grows every time I make use of it. I had a good discussion with one of my fellow colleagues some time back on whether PowerShell should be considered a scripting language or a programming language. It’s for sure that it is NOT a programming language. Having said that, just to classify it as scripting language (remember VB script?) will not be justice with it’s capabilities.

“PowerShell is a true DevOps language.”

It has the right tools in it’s kitty which not only helps the core developers but also the day-to-day Administrators. And I am still talking about the OLD WORLD where we had those distinctions. Now, let’s come back to 2015 where even Microsoft promotes to deploy right from your Visual Studio.

Anyway, I should come back to the intention of this post before I drift further. It’s about using PowerShell to call RESTful APIs using PowerShell.

Let’s take an example where I want to call a service which sends an email accepting a JSON object with To address, From address, Subject, Body etc. for creating a mail message object. Thanks to Postman, testing your APIs are no more easy as you’t have to write the calling part anymore.

Postman

Having, my API ready I wanted to schedule this API to called at a certain interval. Yes, I miss those Azure Web Jobs when running on IIS.

However, the good old Task Scheduler is still handy to create a task which calls a PowerShell script. The script looks something like this:

It uses Invoke-RestMethod. The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that returns richly structured data. However, the additional parameters such as Body, ContentType etc. really make it powerful to use it. If you look at the script, I defined a normal PowerShell Hash Table with a mapping of key and values. And later using ConvertTo-Json to convert hash table as a JSON object.