Nothing to see...

A simple blog about all things in the world that is ridikulouse.

Monday, July 20, 2015

String Interpolation

String Interpolation is an interesting method of being able to access properties directly within a string. Once upon a time in order to include properties into a string you would have to do something like this : int age = 16; string mystr = "My age is" + age.ToString(); Essentially a string concatenation and then returning other types as a string. Then we had string.Format which I thought it was fantastic with the autoconversion of types to string - so we had something like this: string.Format("My age is {0}", age); Now, this was very handy...

Null Conditional Operators

I cannot count the number of times that I've faced exception caused by running into a null. This then leads to code using the if{} blocks or using the short hand "?" on almost all of your variables. In C# 6.0 specification a null conditional operator. The null conditional operator allows you to check for the instance of a null and replace a returned value or to return a value. For example : If you have a simple class such as a Person : public class person { public string Name {get;set;} public int Age {get; set;} } and you instantiate...

Tuesday, June 9, 2015

Xamarin.Auth Sample How to

Introduction I wanted to try out Xamarin.Auth and specifically have authentication for my App with Facebook. I downloaded the Xamarin.Auth from https://github.com/xamarin/Xamarin.Auth and I thought that this would be a simple build and run to check it out. However, it became slightly long winded process than the simple build and run. In this post I'll go through the steps that I went through. 1. Downloading the Sample To get the sample application...

The Debugger Cannot Continue Running the Process. Unable to Start Debugging

While I've been working with Xamarin I have noticed some frustrating errors from Xamarin Studio and now with Visual Studio. I was looking into Facebook Authentication and downloaded the master of Xamarin.Auth and tried to run the sample apps included and ran into a strange error: Looking at the error it was hard to work out what went wrong, so I reverted to a friend to help with this. The Fix The solution contained two projects : Xamarin.Auth...

Saturday, May 30, 2015

VisualStudio 2013 - Xamarin - How to use Intellisense

When I installed Xamarin Business License, I noticed that intellisense was not working with the xml and axml files. To get this to work you need to manually add two XSD files, once you have added them you will get Instellisense. First open any random XML file, once you have opened it you will notice that the menu bar will have a new menu item called XML. Next navigate to XML > Schemas > Add Next enter the path in the filename box C:\Program Files (x86)\MSBuild\Xamarin\Android and hit enter You should see two XSD files, select them both...

Tuesday, March 17, 2015

Intellisense in Razor View - Visual Studio 2013

Intellisense in VisualStudio is a god's gift to developers, its one of the things that make Visual Studio unbeatable for development. But on occasions Intellisense stops working for some reason, and I find that this normally happens while editing a view in an MVC application. I tried a number of things, from building the project, to deleting the bin folder and re-doing the webconfig file, right through to re-creating the project again. That's how much it annoys me when Intellisense stops working. I recently realized that this occurs when I edit...

Wednesday, February 18, 2015

Building your own coils

Personal Vaporizers have suddenly become popular, so popular in fact that in my last trip to Europe and America I noticed that 50% of smokers were vaping. When you first start getting into vaping you will probably start off with a standard kit, as your curioisity grows you'll slowly move up and up in to more technical areas. The minimum equipment you will need will be : Rebuildable Atmoizer  A small screwdriver or drill bit or anything that you can wrap a coil around Wicking Material Wire A blow torch (Butane) Tweezers  A cutting...

Tuesday, February 17, 2015

Entity Framework and Many to Many Relationship - Simple Example

If you want to do Many to Many relationship in Entity Framework the work is quite simple: Create two classes say Order and Product Establish a navigational property between the two classes  You're done.  So lets take a look at this, the following, as in the example above is Order class Public Class Order { public int ID {get; set;} public string Description {get; set;} public virtual ICollection<Product> Products {get; set;} public Order() { this.Products = new List<Product>(); } } The...

Saturday, February 7, 2015

[Solved - I think ] Visual Studio High CPU usage

Out of nowhere I started Visual Studio to get some coding happening, and it was almost unusable. I was editing a CSHTML file, and the CPU usage was through the roof. At one point the CPU usage was over 40% and my Surface Pro 3 started heating up and the only thing I could do was to shutdown Visual Studio. I don't know why this is happening I was working on the same file last night without a hitch. Here is a screenshot of task manager: I'm...

Thursday, February 5, 2015

Surface Pro Function Keys

If you are an owner of Surface Pro you may have noticed that you don't have quick access to the function keys. For the general consumer the settings of the function keys are less useful and the standard media and other options are far more convenient. However, if you are a developer you tend to always try and reach for the function keys (e.g build, run etc...). What you can do is press the    Fn    key +   Caps   key to lock the function key. Then you no longer need to press the Fn key to access the Function...

Tuesday, February 3, 2015

Create your own Android Character

There's a new site out that allows you to create your own Android Character. You can choose from a range body shapes, outfits, and accessories to try and mimic an Android that looks just like you, your friend, or your family member. Or maybe make character of who you think you are, to check it out click here : https://androidify.com/en...

Samsung Galaxy S5 - What I want

I'll soon be in the market for a new smart phone, and I'm eagerly looking forward to what Samsung has been working on under the covers. The last set of rumours indicated that the Galaxy line up is being re-designed from the ground up. This is welcome news, since I didn't get a new phone this year because S5 just didn't cut it enough for me to move from my HTC One M7. So if Samsung is looking to re-design this from the ground up, then here is my wish list: TouchWiz The only Samsung Phone that I have liked to date is the Samsung Galaxy Nexus and...

Visual Studio Code Snippets

I've been working with Visual Studio for years, and all this time I have not come across this feature till now. Visual Studio has built in code snippets, in order to access them you need to first place your cursor where you want some code to be pasted and then you need to press CTRL + K + CTRL X I haven't been able to take a screenshot of this, but what will happen is a dialog box will appear with a set of folders. Simply use your cursor keys to navigate to a folder (in my case it is Visual C#) and then press enter, this will reveal the snippets....

Stuck trying to modify the ApplicationUser and Multiple DbContexts

When you are trying to update the AccountController in ASP.NET MVC - to enhance the ApplicationUser or another related entity during Registration you may quickly realise that the AccountController doesn't have a DbContext for you to use. So like anyone, and looking at the other sample controllers you'll probably define something like this: ApplicationDbContext db = new ApplicationDbContext(); You then write your code, everything compiles and...

Monday, February 2, 2015

Get the Current Logged in user

In ASP.NET MVC if you are using Asp.Net Identities, you will need to at times get the current logged in user. You may need to do this to determine whether the current logged in user has access to view, create, modify records etc... First of all this can be only completed in the Controller. If you need the user inside of another class, you will need to pass this through to the class method/function etc... In the controller, header set the following properties: protected ApplicationDbContext Db { get; set; } protected UserManager<ApplicationUser>...

Saturday, January 24, 2015

MVC - Unable to Attach DB

If you are working in Visual Studio, sometimes you want to try and start again with the database. Often this is when you make drastic model changes. I have on a number of occasions have deleted the .mdf file in the App_Data folder. This is not a recommended approach, since it will cause inconsistencies with the connected database. To resolve this, open up the Package Manager Console and type in the following commands: sqllocaldb.exe stop v11.0 sqllocaldb.exe...

Tuesday, January 20, 2015

Lost Bitcoins

In the world of Crytocurrency Bitcoins is considered the Gold standard. One of the features that make Bitcoins and Cryptocurrency in general ahead of the normal Fiat currency is the fact that you transact anonymously around the world. This means that who ever owns the wallet is unknown,  which is why it was being used at underground sites such as SilkRoad. There's a total limit of the number of Bitcoins that will ever be available, once this...

Surface Pro 3 - Fantastic

I think the last time I posted something about the Microsoft Surface it was a couple of years ago. Although Surface Pro 3 didn't deliver everything I wanted, I bit the bullet and bought one any way. That was over 6 months ago. There are a number of reviews out there about Surface Pro 3, so I didn't want to something about the surface that has already been covered.  After using the Surface Pro 3 this is how I feel about it :  The...

Working with the Paypal Classic API Samples

When I started the the Classic API Samples I had to do the following operations for Visual Studio 2013: Open the solution by double clicking on the .sln file via Exporer (or open it directly from Visual Studio) Visual Studio will prompt you about one way migration, accept it and continue Set the .NET Framework to 4.5.2 as it suggests When you run the application it will work to a point - I noticed that the order that the main() executes the...