Python language basics 49: introduction to sets

Introduction

In the previous post we looked at the built-in enumerate function in Python. We saw how it could be used to get an item counter while looping through a collection. It provides a more elegant and reliable solution compared to a manual counter variable that’s updated after every iteration.

In this post we’ll start discussing how sets are represented in Python.

Read more of this post

Python language basics 48: getting a counter in for-each loops

Introduction

In the previous post we looked at two ways to reverse the elements in a list. The reverse function operates directly on the list whereas the reversed function returns an independent list with the elements of the source reversed.

In this post we’ll look at a case where you may need a counter while looping through a list.

Read more of this post

How to enable SSL for a .NET project in Visual Studio

Say you have a .NET MVC or Web API project and you’d like to run it on SSL. In other words you’d like to start up the project on a URL similar to https://localhost:xxxx.

The first step is easy. You just select the MVC/Web API project name in the solution and locate the property called “SSL Enabled” in properties window:

Read more of this post

Domain Driven Design with Web API revisited Part 13: view models

Introduction

In the previous post we tested the load testing database context. We saw how EF could transform the database objects into domain ones through reflection. However, we had to add some changes to the domain code in order to support this feature. The domain objects lost their persistence ignorance feature to some extent but I think we were able to minimise the “damage”. One such change was the addition of a private parameterless constructor which really has no role for the domain but helps us implement EntityFramework as the backing store mechanism.

In this post we’ll look at view models.

Read more of this post

How to add basic sounds to a .NET console application

We all know a couple of very annoying features of web sites: popups, flashing text, rotating images and the like. The good news is that there are some equally annoying features that you can add to .NET console applications: constantly changing titles, console window size and position, text size and colour etc.

In this short post we’ll see how to add a basic beep to a console app. As with the above mentioned features you should not overuse it.

Read more of this post

Using the BlockingCollection for thread-safe producer-consumer scenarios in .NET Part 5

In the previous post we finished the basics of building producer-consumer scenarios with BlockingCollection in .NET. In particular we saw how to send a signal to the consumer that the producers have completed their tasks and no more items will be inserted into the work queue.

In this final post I just want to draw your attention to a couple of other fine-tuning methods in the BlockingCollection object.

Read more of this post

Domain Driven Design with Web API revisited Part 12: testing the load testing database context

Introduction

In the previous post we created our data store using EF code-first techniques. We also tested our overall database context by running a number of test queries to view and insert a couple of database objects.

We’re done with the data store but we’re not done with our load test context yet. Recall that the load test bounded context has its own well defined database context which is somewhat reduced compared to the full context. We need to test how it works.

Read more of this post

Python language basics 47: 2 ways to reverse the elements in a list

Introduction

In the previous post we looked at 2 ways to sort the elements in a list. The sort function operated directly on the list and the sorted function accepted another list as an argument and returned a new list. You could use the sorted function in case you need an independent sorted list and leave the source intact.

In this post we’ll look at two ways to reverse the elements in a list.

Read more of this post

Python language basics 46: 2 ways to sort lists

Introduction

In the previous post we looked 3 ways to copy a list in Python: slicing, the copy function and the list constructor. We said that they all created shallow copies of the source list. Therefore beware of the implications of that if the list to be copied has mutable objects.

In this object we’ll look at 2 ways to sort the objects within a list.

Read more of this post

Using the BlockingCollection for thread-safe producer-consumer scenarios in .NET Part 4

In the previous post we saw how to wire up the producer and the consumer in a very simplistic producer-consumer scenario in .NET using a BlockingCollection. We started a number of producer and consumer threads and checked their output in the Debug window.

In this post we’ll see how we can send a signal to the consumer that all producers finished adding new items to the work queue. This is to simulate a scenario where you can determine in advance when all expected items have been added to the work queue.

Read more of this post

Elliot Balynn's Blog

A directory of wonderful thoughts

Software Engineering

Web development

Disparate Opinions

Various tidbits

chsakell's Blog

WEB APPLICATION DEVELOPMENT TUTORIALS WITH OPEN-SOURCE PROJECTS

Once Upon a Camayoc

ARCHIVED: Bite-size insight on Cyber Security for the not too technical.