I wanted to show a simple example of using Azure Service Fabric to create a a reliable & scalable micro service that would perform addition functionality on an input string for example “1+1” using a console application as the client.
The string is parsed out to two integers and calculates the result. Obviously this is extremely simplistic type of example. I wanted to really just do a quick test on passing input and expecting output.
The code is listed up on my GitHub account under the ServiceFabric Repo.
This article simply demonstrates creating a simple service called ‘AdditionMicroService’ that adds two integers provided as input.
I will add this code to my GitHub account under Getting started with Microservices
Docker for Windows
Hyper-V is installed
1) Create new blank solution we will be working with Visual Studio 2017 RC in this example.
2) Create a new ASP.NET Core Web Application (.Net Core) project
- Select Web API Template
- Check the Enable Container (Docker) Support checkbox
3) Change name of file ValuesController to AdditionController
4) Remove all methods from the class except the Get method
5) change return type to type ActionResult in order to return status code
6) Add method parameters : int x and int y
7) Change the return value to Ok(x*y)
8) Change all launchurls from ending in ‘values’ to ‘addition’ in launchsettings.json file
for example :
api/values –> api/addition
9) Run the Project to ensure everything is good
10) Once the browser launches ad render the page append sample parameters to the end as below and verify that rendered result is the addition of your two values entered
Next Stage(2): Setting up RabbitMQ
Debugging Lambda expressions is certainly a very welcome feature of Visual Studio 2015. Before when trying to evaluate lambda expressions within either the watch or immediate windows we would see the message “Expression cannot contain lambda expressions”.
The great thing about this feature is that it really speeds up the diagnoses of possible bugs being faced within your application and being able to really dig in to your collections and query the data right there and then on the fly.
For instance if you are retrieving a result set from a collection but not getting the results you are expecting, you can now query the collection using lambda expressions within either the immediate or watch window during debug to give you a direct view of what data is resident within your collection that particular point in time, from there you can then dynamically make changes to your query within the immediate or watch windows necessary to confirm your hypothesis of why you are not seeing the results you were expecting – all while in debug mode without having to perform that oh so fun process of stop debugging –> make a change –> re-run –> confirm results if yes stop else go again.
Once you confirm that you are now getting the results expected from your changes you can then go ahead an make the necessary adjustments to your source code.
This is really well demonstrated by Andrew Hall in the below video.
Well a few weeks back I passed the 70-483 Programming in C# exam, it had been several years since I took an exam so I did not know how I would do.
I had worked in c# for quite some time now but all of my knowledge was pretty much self taught on the job so I knew there were some gaps in my knowledge so I thought going for the exam would at least highlight the areas in which I need to focus on. Indeed there were some areas I had touched on very little throughout my career so it was definitely a worthwhile cause from that perspective alone.
In my previous employment I had the opportunity to attend the Microsoft official course for this exam which lasted a week which was really beneficial and was a great resource, however it was expensive and not sure I personally would have attended I have had to foot the bill. Other resources that I took advantage of where pluralsight courses, virtual academy jumpstart videos as well as the MCSD Certification Toolkit.
To mention the pluralsight course there is blog post covering this exam course : http://blog.pluralsight.com/learning-path-c-microsoft-exam-70-483 which indicates the videos to check out that would be specific to the exam areas, I cannot rate pluralsight enough to be honest I truly believe it to be one of my best subscriptions I cannot tell you the amount of information I have learnt over the years using this resource as well as solving many technical issues that I had faced – if you do not have a subscription I would encourage you to take advantage of their free trial.
The virtual academy jump start videos were awesome too : http://www.microsoftvirtualacademy.com/training-courses/developer-training-with-programming-in-c, the videos were very entertaining and the presenters knew their stuff best of all it is free so definitely check them out. It is a great resource for some free training.
Other than this plenty of hands on coding there is really no substitute for actual coding I believe it is not only the best way to learn as it will quickly let you know when you hit an area you do not truly fully grasp but also the best way to retain what you learn for longer.
This post is particularly directed at a configuration of an Azure wordpress website with MySql as a linked resource.
Select your Azure wordpress website in your Azure portal then select dashboard
If you scroll to the bottom you will see a section titled ‘linked resources’ under here you should see your MySql database linked resource.
If you click on your MySql database name it will bring you to a clear db web portal.
If you click endpoint information from the top menu, note down your hostname along with your access credentials as you will need them to log in to a MySql client (MySql workbench)
Next click on the dashboard menu item on the clear db web portal and under the ‘Managing Your Database’ heading you should see a MySql workbench link which will bring you to a download page in which you can go and follow the instructions to download and install the client.
Once the client has been installed you should be able to run it and enter the hostname, username and password for your MySql database you noted earlier in the prompt that appears .
From here you should see a query windows open by default if you type in ‘SELECT * FROM [your database name].wp_users;’ and select the lightning bolt in the menu that will execute this sql statement you should see a list of users in your wp_users table in your database.
From here you can manually edit the ‘user_pass’ column that is associated with the admin account with an md5 hash(you will need to generate an MD5 hash of your new password, which you can utilize md5 hash online generators) of your newly chosen password and select the apply bottom near the bottom right of the table view.
That’s it – you can now go to back to your login page and enter your username with the new password and login.