Hi all, I’d like to introduce you to what appears to be a great tool for the .net platform. http://www.ndepend.com/
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.
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!
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
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.
The first request gets the token and then this token is used as the Bearer for further requests.
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.
First of all you need an Azure storage account as before, but once this is setup, consider the following code…
What I’m doing in the code above is
- Connecting to my storage account
- Creating the queue if it doesn't exist (remember you’ll get a bad request if you don’t name the queue correctly!).
- 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!
Open your server explorer and select the queue under the storage account you’ve chosen in your connection string, double click
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!
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 ;-)
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.
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.
There are a few options with the job, schedule/on demand/continuous..
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).
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.
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
Here you can see the result of the WebJob (appending worked….)
In the picture above you see a storage account in Azure, in the storage account we have an ecbfx (European Central Bank FX Rates) container. Now let’s see how to upload some data to this container using a C# console application.
Given we are going to work with C# the best option is to use the .NET library, this can be retrieved from NuGet
The code above connects to the pre-created container, notice that my container has built in Geo Redundancy (primary storage in Dublin, secondary in the Amsterdam) so after running there will be 6 copies of this blob, 3 in Dublin and 3 in Amsterdam, this is the storage package I’ve chosen.
The easiest way to view the newly uploaded blob is to use the Windows Azure server explorer in Visual Studio, it’s the easiest way of getting the connection string to the storage account also.
In the next post I’m going to show you how react to someone uploading a Blob with an automatic trigger.
This is a post, that I've just not got time to explain in full yet...
But if you are stuck on 1-2mbps ADSL and have a bit of time on your hands then its possible to get +20mbps broadband.
I achieved this by load balancing a fixed wireless connection of 8mbps with a HSPDA 12+mbps connection. The HSPDA connection took most of the work and involved installing a fixed external yagi antenna for starters..
So far so good! PM me for more details.
The code above logs this three times, but what is this?
The main source of confusion is a quirk of the language where depending on the invocation pattern this can be set to the global variable (e.g. window in a browser). But there are come other gotchas.
In the example above this is 3 different objects.
Function Invocation Patterns
I’ve covered the first 3 above in my example
Constructor In this constructor invocation pattern (i.e. new) this is assigned to the object getting created, ATest
In the function invocation pattern this is the enclosing type also, however this is just object in this case i.e. the object literal returned from ATest constructor.
I’m not covering this here but the Apply (and the call) invocation patterns basically let you set the value of this.
Note: Object Literal can be avoided in this example above as follows.
What we do is set the methods on this explicitly.
In this post I’m going to show you how to upload a file using Angular.js on the client side and Asp WebApi on the back end.
Lets get started
Create you project in visual studio, and add your angular.js app controllers etc.
Interestingly enough I’ve already shown you how to do the server side over 2 years ago!
Crikey 2 years and I’m still writing about the same old stuff….. well not really, last time it was knockout, sliverlight and the likes, now it’s Angular.js’ turn.
Angular file upload, Nuget
In order to facilitate the process, we’re going to use a nuget package I like, see screenshot.
The beauty of this package is that its got shims for non html5 browsers (apparently there are a few hanging around still :-( )
To use this package you’ll need to include 2 scripts, file-upload-shim before angular.js and file-upload after.
Next add the input tag and add the ng-file-select directive
Add the upload module
Here i added the $upload factory to my controller
Here I enumerate the files (should i wish to have multi select) then I upload each one by posting to my Web Api .net controller, I pass a little more information also as to the diff side, but that’s pretty much it.
Now even though I did show you the .net code before I’m going to show it again now, because as I mentioned I’m passing a little information as to the side the file I’m uploading represents.
http://2014.javazone.no/videos.htmlAn ex colleague of mine sent me this link this morning. www.whyjavasucks.com
Apparently I got associated with it, haha, yes at one time I used to shoot down java at every occurrence, this was most likely because I didn’t know it well enough at the time; now I just yawn a little and continue ;-)
Enjoy the website! I did ;-)
To see the other side of the story have a look at some of the videos here
I’ve gotten a few emails from last night’s post asking me why I’ve gone black (and will i go back?),, well you know what they say!
Btw: I’ve Visual Studio, IntelliJ and WebsStorm on black/dracula themes at the moment and a week on I’m kinda sold, the only big downside is when I switch to another app when in dark light (in bed for example) I hurt my eyes as they adjust.
Some people asked about the IDE as it wasn’t visual studio (nope, I’ve not written java in VS yet ;-) ) so I thought it would be interesting to share what tools and IDE’s I use.
As it happens I just rebuilt my OS last weekend so it’s all clear in my head, here goes:
Windows 8.1 and Mac OS as the moment, I prefer Windows, but my Mac Book Air is by far my favourite hardware… conflict!! I am doing a project with a Raspberry Pi at the moment and between that and the Mac I’ve pretty much given up on DOS* in favour of powershell (simply because I can type linux commands)
- Visual Studio 2013 this is my favourite IDE, I’ve been using VS since the mid 90ies, mostly these days I use VS for C#, ASP, UML, Testing, Azure, most of my pet projects are Azure based.
- InetlliJ : I took me a while when I started learning Java to settle on IntelliJ, I went back and forth between that and eclipse for a while until I understood java and it’s eco system enough to set up my own projects. IntelliJ is just fantastic and the tooling is great (ideal for MSofties) and there is a certain degree of familiarity as Jetbrains the company behind is the company behind Resharper.
- WebStorm: This is another Ide from Jetbrains (they have a few good IDE’s js,java,php,objective-c, python etc, check them out), I use this mostly for non ASP web stuff (where I naturally use VS), it’s quite good.
- XCode: I’ve created a few iPhone app’s, I hit the curve learned objective-C and the libraries enough to get a few apps in the store and XCode was the vehicle, I’ve not used AppCode from jetbrains but I bet it’s good! The truth is I’ve not used XCode in about a year now I guess, the reason is that I’ve moved to Android myself and don’t have a iPhone any longer (and at least for the foreseeable future) so I’m not motivated enough to do any iOS coding on my free time.
Total Commander by Ghisler.com, I’ve been using this since 2001, I was previously using norton commander but when I changed company I no longer had access to that software so I found my beloved TotalCommander, this is without doubt one of the major reasons I prefer windows. (I must get off my bum and find a corresponding program for Mac as Finder is dreadful IMO.
XML and it’s cousins
Stylus studio: great for formatting xml and editing xml in tree and grid formats, generating xsd, debugging xlst etc, nice xpath support.