Skip to main content

Posts

.Net Events

Events Background While theoretically delegates could be used by consumers as an even mechanism, it has some serious drawbacks. If we made our delegate public and allowed subscribers to add methods to our delegates invocation list, they would be able to receive notifications. However they would also be able to do something like the following:  MessageLogger = null;  In one misused line of code, our delegate has been wiped out along with it's invocation list and any link to subscribers has been lost. As a result, Events act as an abstraction on top of delegates to manage the invocation list with fairly limited  Add  and  Remove  operations. Subscribers go through the public event to add methods which in turn acts on the underlying delegate invocation list. What is an Event? Events allows a class to send notifications to other classes or objects that subscribe to the event. When an event is raised, any objects that have subscribed to the event will receive an even
Recent posts

Use Azure DNS for you web app

New-AzDnsRecordSet -ZoneName happycampervan.co.uk -ResourceGroupName happycampervan `  -Name "@" -RecordType "txt" -Ttl 600 `  -DnsRecords (New-AzDnsRecordConfig -Value  "happycampervan.co.uk") A Record ----------- New-AzDnsRecordSet -Name "@" -RecordType "A" -ZoneName "happycampervan.co.uk" `  -ResourceGroupName "happycampervan" -Ttl 600 `  -DnsRecords (New-AzDnsRecordConfig -IPv4Address "51.140.185.151") CName Record ------------ New-AzDnsRecordSet -ZoneName happycampervan.co.uk -ResourceGroupName "happycampervan" `  -Name "www" -RecordType "CNAME" -Ttl 600 `  -DnsRecords (New-AzDnsRecordConfig -cname "happycampervan.co.uk") Remove-AzDnsRecordSet -RecordType "CNAME" -Name "www" -ZoneName "happycampervan.co.uk" -ResourceGroupName "happycampervan" -Confirm:$False TXT record -----

Semantic Logging in Windows Azure - Part 2

In this second part of the series, we will configure the Semantic Logging Application Block (SLAB) in a Windows Azure role Out-Of-Process. Please read Part 1 - Semantic Logging  if you are unfamiliar with SLAB or want some background, including a source code starter project. When selecting suitable sinks for Azure, there are some obvious challenges. Your roles are virtual machine (vm) instances which are subject to recycles and shutdowns. When logging events on a vm with SLAB, both the logger and the listeners need to be running on the same instance. Multiple listeners and loggers can exist on the same vm. Prerequesites In order to  Windows Azure SDK 2.0 Windows Azure Emulator running  At Assemblysoft we specialise in  Custom Software Development  tailored to your requirements. We have experience creating Booking solutions, as we did for HappyCamperVan Hire. You can read more  here . We can onboard and add value to your business rapidly. We are an experienced Full-stack de

Debugging .Net Components called from Python, being run from a Batch Script, executed by the Windows Task Scheduler (Part 2)

In  Part 1  We identified the problem i was recently asked to investigate and looked at getting some output from the batch script being run by the Windows Task Scheduler. As this was a production environment, there was little that could be modified and remote debugging wasn't an option. In this part 2 post, we will continue to fault find touching on the Python and .Net components i mentioned previously and get to the point where the problem is fully identified and subsequently fixed without any changes made to the production code. Having started to receive output, the next step was to make some sense of it. The first thing i did was wrap the area of interest in the python script with a try catch 1) some generic exception try: except: print "Exception: %s" % (sys.exc_info()[0]) Exception: Query Error This was at least a start in that it looked database related at this point The next task was to identify the type of exception being thrown

Visual Studio 2017 RC installation

A quick look at the Visual Studio 2017 RC installation and first impressions on the look and feel of the new IDE My first impressions are really good. The web install genuinely took around 7 minutes and I was up and launching a new Asp.Net Core boilerplate application in a further 2 minutes, allowing for first time customisation and profile configure. That’s zero to hero in under ten minutes which is finally a wait time I can work with and will no doubt encourage non Microsoft Developers to just give it a try. I decided to go for the community edition for simplicity. The new setup experience The installer has been written from the ground up and it certainly feels nicer than the typical Microsoft Installer experience of not so long ago. I really like the select what you need approach and add later, which has always been possible but is a cleaner approach where you are selecting your intent rather than a host of individual features typical of a custom install.

Switching between DevOps Azure Artifacts and local Project references during development and debugging

Stumbled on a nice extension today for VS in the marketplace which allows simplified switching of references between NuGet package feeds and local references. If like me, you have multiple feeds for your packages via DevOps Artifacts, the Nuget Gallery, MyGet Feeds and personal feeds, it can sometimes be a challenge to switch between references to debug or extend some functionality. If you would like some hands on expertise for your business feel free to reach via my company  assemblysoft   or checkout some other musings via my blazor.net and azure blog here  carlrandall.net At Assemblysoft we specialise in  Custom Software Development  tailored to your requirements. We have experience creating Booking solutions, as we did for HappyCamperVan Hire. You can read more  here . We can onboard and add value to your business rapidly. We are an experienced Full-stack development team able to provide specific technical expertise or manage your project requirements end to end.  We

.Net Delegates

Delegates, Anonymous Delegates, Lambdas,  This article (part1) forms part of a mini series which will  and Generics What is a Delegate? You may be wondering why another article on delegates. If you are already comfortable using them, maybe you are done here, or maybe you have the job of mentoring other developers in your team and have found it tricky to explain in the real world, or maybe you have sat down with a team member and they still don't really get them. On my travels i frequently meet developers who failed to really grasp delegates earlier on and thus struggle with many other topics which build on a solid understanding of what delegates are. For example:  Lambda Expressions , Reading and Writing queries targeted at  LINQ to Entities ,  Events  and  Generics  to name a few. If we search MSDN the definition we find is as follows A  delegate  is a reference type that can be used to encapsulate a named or an anonymous method. Delegates are similar to function