IntelliJ Application Servers Greyed Out

If you ever come across the problem of the IntelliJ Application Servers menu greyed out like this:

image

This is simply because you need at least one Run Configuration.

I’m using JBoss just now so here’s what I do to add a run config:

image
image

 

image

Once this is done you can now see your application servers tools window menu item becomes enabled.

image  image

Not accepted here

and it's not because I'm Irish ;-)

ODataController - 406

So I’m working on a project that returns some entities from an OData endpoint, I wanted to remove the unnecessary parts of my entities so I created some DTO’s (which in itself is a good idea btw). The screenshot below shows the changes, I’m now returning a TimeSheetDto list (previously just a TimeSheet list) and I’m just projecting (using automapper) the Timesheets from my database into these DTO’s .

image

 

However when I test said entities I see nothing come back in my browser, nada,zilch,zippo… so what is happening?
Well I fired up fiddler and saw that I was getting a HTTP status code of 406, but why?
It worked before and I changed nothing…. oh wait!….

Configure OData entities

You know that message that gets scaffolded with new OData end points!? We’ll it explicitly tells us what entities are to be considered, so with a quick addition of my Dto Suffix in my OData config I’m back in action.

image

Azure, Sql User invalid from Azure Website

Problem

I was faced with a problem this morning that took me a good 30 minutes to figure out..

I had created a website and associated SQL database. However I changed said database as part of some development work. The problem was that even though my publish profile was overriding the Release Connection String with my new database it was getting ignored!

image

 

I knew that the connection string I was supplying was correct as I could log in with Visual Studio and SSMS.

Cause:

The reason is that the website had already an connection string (under the Configure tab) and this was taking preference. The reason this is here is that one does not have to store the Azure connection string in the publish profile which is quite nice, same goes for a lot of other Azure features.

image

 

Solution

I removed same and then it works. (Fixing it is also another option but this code is in a private git repository so it’s not a concern for me just now).

Prevent angular event bubbling

In this screencast I show you how to prevent a click event on a table cell content from propagating up to its parent.

Screenshots

image

 

image

Angular Form Validation

Hi all,

Ok this is my very first ever screencast, It’s not very polished but hopefully I’ll get into the swing of things with some more practise.

The screen cast shows how to add validation to forms the Angular.JS way.

 

image

 

 

image

image

Angular.js Auth with ASP WebApi2

So in my previous post I show you how to auth with a bearer token against WebApi2 with the OWIN middleware using a HttpClient. Next up I show you how to do the same with AngularJS.

AngularJS

True to form I’m not going to write a big long blog post on this topic, there are many others that are better than mine. There are even a nice few github hosted solutions you can grab for yourself.

I ended up picking the first post I saw, http://www.codeproject.com/Articles/742532/Using-Web-API-Individual-User-Account-plus-CORS-En

Now lets ignore the CORS part for starters (have banged my head against the walls many times over that).  In order to get this working with the latest and greatest web api as of this post you’ll need two little tweaks

1) Relative URL

The author posts the following code

image

You’ll need to change the baseUrl to an empty string, if you leave it this way (even when correcting the port) you’ll end up in a CORS situation and you’ll see the browser send an OPTIONS request which you don’t want. (in fairness the author was showing CORS working so there is nothing wrong with his/her post).

 

2) Token Payload

image

The important part is that i create a new object ‘data’ and this contains the querystring for the POST body, in the $http call, I then pass data rather than userData like the codeproject article shows.

That’s it, you should now be up and running.

NDepend

Hi all, I’d like to introduce you to what appears to be a great tool for the .net platform. http://www.ndepend.com/

image

I’ve promised to write a review on this tool, however, I’ll be perfectly honest and admit, that I’ve just not got the time right now, so I’m going to take a short cut.

Podcasts

I listen to a lot of podcasts mostly when driving or cycling, recently I’ve started listening to a new podcast http://www.codingblocks.net/ it’s a good podcast and I hope it continues to stick around. As it turns out this podcast did a review on NDepends http://www.codingblocks.net/podcast/ndepend-on-how-good-your-code-is/ and I encourage you to check it out. Moreover; in a more recent episode they mention that they’ve received feedback from Patrick Smacchia (Lead Developer and brains behind the tool) and the feedback they’ve received from Patrick on the few little niggles they encountered is quite positive and upbeat.

When I find myself looking for some tooling like this I’ll write a proper review of my own, but until then based on my interactions with Patrick and after listening to the podcast above, I encourage you, that if you’re in the market for such analysis tools to take NDepends for a spin, and let us know how you get on!

WebAPI OWIN and HppClient Authorize

Hi all, I know I promised my next post was going to be more Azure but I encountered a little task that took me a while to get working, the scenario was that I wanted to make a call to my WebAPI (MVC5) service using a C# HttpClient, the problem was that the resource I wished to access had the AuthorizeAttribute set

image

 

Now there’s a few ways to skin a cat but in the presence of the default Token Authorization one needs to first get a token and then use this token in subsequent requests. There is some good documentation using fiddler here: http://www.asp.net/web-api/overview/security/individual-accounts-in-web-api, however, there was not a lot of information on how to do this with HttpClient against Katana/Owin/MVC5, rather this information was not available in one specific place.

How

image

The first request gets the token and then this token is used as the Bearer for further requests.

Writing to an Azure Queue

If you've seen my previous post then this post is quite similar, this time however I write to an Azure Queue and not to a blob.

Code

First of all you need an Azure storage account as before, but once this is setup, consider the following code…

image

 

What I’m doing in the code above is

  1. Connecting to my storage account
  2. Creating the queue if it doesn't exist (remember you’ll get a bad request if you don’t name the queue correctly!).
  3. Then I create a simple message, I’m using an POCO object from another project and serializing it to JSON.

Did it work?

Lets use VS2013 U3 to check!

image

Open your server explorer and select the queue under the storage account you’ve chosen in your connection string, double click

image

Above you see the message added to the queue, you can see how many times it was de-queued  and when it’s set to expire, If we use a competing consumer pattern that count may be more than 1!

Next

I’m a little thorn re my next post, I’ve been writing a post on c# expression trees which is nearing completion, however I think to keep in line with the current trend I’ll post how this queue can be read and feed to an Azure Service Bus topic (pub/sub)… stay tuned ;-)

Azure WebJob triggering on BlobUpload

Tonight I’m going to follow up on my previous post where I promised to show you how to react on somone/something uploading a Blob.

Please read http://azure.microsoft.com/blog/2014/06/18/announcing-the-0-3-0-beta-preview-of-microsoft-azure-webjobs-sdk/ as there is a lot of old information lying about on the web regarding v0-2-0 which will not work in v0-3-0, I’m not ashamed to say it’s now the early hours of the morning before I’ve finally managed to get this working as most of the documentation I was reading was v0-2-0.

Let’s get started by creating a console application.

Nuget

image

 

Code

In this code you can see that I’m just appending worked… to the input file, the important parts to consider are the BlobTrigger and Blob attributes, the trigger is the item that will start to process when a blobupdates on the reuters-input container, the BlobAttribute is the output and the reuters-gdmx is the identified container for same.

image

 

There are a few options with the job, schedule/on demand/continuous..

image

 

For the automatic trigger I’m setting the job to be On Demand, however I know in the current version of webjobs, that ondemand for blobs are polled every 10 minutes (I hope can be more real-time once WebJobs exit preview).

image

image

 

Connection Strings

You need to add two connections string to your blob storage account (get the connection string with visual studio Azure explorer), I’ve set both to the same storage account. The last two are from v0-3-0.

image

 

Test

I’m going to use the AzureStorage explorer to upload a file, once this file gets uploaded the WebJob will run and create the associated blob in reuters-gdmx

image

image
image

Output

Here you can see the result of the WebJob (appending worked….)

image

Recent Tweets

Note: For Customization and Configuration, CheckOut Recent Tweets Documentation

Calendar

<<  December 2018  >>
MoTuWeThFrSaSu
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

View posts in large calendar

Month List