Introduction to Amazon Code Pipeline with Java part 3: adding custom job runners

Introduction

In the previous post we went through the steps to set up a brand new pipeline in AWS Code Pipeline. If you are entirely new to the AWS tools then you might find it overwhelming at first as you have to learn about other AWS tools as well such as S3 and Elastic Beanstalk. However, you might not need all of it since a pipeline can be quite little and consist of only 2-3 steps. The pipeline will start executing as soon as it has been set up. The arrows connecting the steps enable us to cut the execution of the pipeline at a specific step.

In this post we’ll see how to update a pipeline. Updating the pipeline also makes it possible to add custom build runners to the pipeline. I’ll use the load test job runner I referred to in the first part. Note that you’ll need an Apica Loadtest account to fully follow along these steps. The main point is to demonstrate the process of adding a new custom job runner to an existing pipeline. The implementation details are not important at this moment.

Read more of this post

Introduction to MongoDb with .NET part 8: searching in arrays and nested documents

Introduction

In the previous post we went through 4 logical operators in MongoDb: $or, $and, $not and $nor. We saw a couple examples of their usage. The syntax for $or, $and and $nor are similar in that we have to provide an array of filters that are linked with the operator whereas the syntax for $not is simpler. You’ll probably not use the $and operator too often as AND conditions can be simplified by chaining together the filters by a comma.

In this post we’ll see how to query arrays and embedded documents.

Read more of this post

Introduction to MongoDb with .NET part 7: logical operators

Introduction

In the previous post we started looking at logical operators in MongoDb. In particular we saw several examples of using the $gt and $lt operators which stand for greater-than and less-than. We don’t use the mathematical symbols ” for this purpose. Instead, operators are used with sub-documents that are manifested as extended JSON documents. We can chain multiple filters separated by a comma which amounts to an AND operation: the city must have a population of at least 50000 and be located in the state of Texas.

In this post we’ll look at the logical operators $and and $or, $not and $nor.

Read more of this post

Introduction to MongoDb with .NET part 6: a return to querying with query operators

Introduction

In the previous post we looked at how to import all documents from a JSON file using the mongoimport tool. We created two collections in the process: restaurants and zipcodes. Both are readily available data sources for testing in MongoDb. They are large enough and offer varied data structures for meaningful queries.

In this post we’ll return to exploring querying techniques in MongoDb. In particular we’ll start looking at so-called query operators that help us construct more complex queries than the ones we’ve seen so far. We’ll first demonstrate the usage of the greater-than and less-than operators.

Have the MongoDb server and client ready in two different console applications if you want to try the examples yourself.

Read more of this post

Introduction to MongoDb with .NET part 5: data import

Introduction

In the previous post we started discussing queries in MongoDb. Specifically we looked at the find and findOne functions. Both can accept a JSON parameter – a JSON document to be exact – to limit the result set returned. find() returns all documents that match the filter or return all documents if there was no filter provided. findOne will always return a single document even if there are more that match the criteria. findOne can be very useful if you’d like to get familiar with a collection by viewing one of its documents. We’ve also quickly looked at two additional functions. The pretty() function produces a better formatted JSON result set on the screen whereas the count() function returns the number of documents within a collection.

In this post we’ll step back a little from querying and instead look at how to import data into a MongoDb database. Specifically we’ll create two real-life collections. We don’t want to keep adding the records ourselves, that’s very tedious. There are at least two different readily available and importable MongoDb collections. The goal is to be able to run meaningful and real-life queries against realistic data sets.

Read more of this post

Introduction to MongoDb with .NET part 4: querying basics with find and findOne

Introduction

In the previous post discussed some details around insertions in MongoDb. We saw that it was quite a painless and straightforward operation. We use the “db” handle, provide the name of the collection where we’d like to insert a document, call the “insert” function on it and pass in a JSON document. All MongoDb documents must have a unique and immutable ID represented by the “_id” field. By default it is of type ObjectId which comes from the BSON specification. We can also provide an ID of integer or string or some other type ourselves but then it is our responsibility that the ID is unique within the collection otherwise we’ll get an exception. Auto-incremented integer IDs are difficult to implement in MongoDb but storing GUID as a string for the ID is a viable option if you’d like to stick to a familiar ID setting strategy from relational databases.

In this post we’ll start looking into querying in MongoDb which will span multiple posts. We’ll mostly see a lot of short examples.

Read more of this post

Extracting information about key pressed in .NET console applications

Console applications let you extract the key(s) pressed by the user using the Console.ReadKey() method. It returns an object of type ConsoleKeyInfo which includes a number of useful properties.

Read more of this post

How to redirect standard error output for a .NET console application

Normally a .NET console application writes its exception messages directly to the console so that the user can view them.

Here’s an example:

static void Main(string[] args)
{
	RunStandardErrorRedirectExample();			
	Console.ReadKey();
}

private static void RunStandardErrorRedirectExample()
{
	try
	{
		double res = Divide(100, 0);
		Console.WriteLine(res);
	}
	catch (Exception ex)
	{
		using (TextWriter errorWriter = Console.Error)
		{
			errorWriter.WriteLine(ex.Message);
		}
	}
}

private static double Divide(int divideWhat, int divideBy)
{
	return divideWhat / divideBy;
}

You’ll get “Attempted to divide by 0” in the console.

However, this is not the only option you have. The standard error output channel can be overridden.

Read more of this post

Introduction to MongoDb with .NET part 3: document insertions

Introduction

In the previous post we successfully installed the latest version of MongoDb on Windows. I think you’ll agree that it was a very simple and painless process. We started exploring the two most important tools of the MongoDb installation folder. Mongo.exe starts the client with which you can interface with the database using commands and queries. Mongod.exe in turn starts the database. We saw a couple of command and query examples such as inserting a new record, searching for one and also deleting one. The default query language of MongoDb is JavaScript and most parameters to the query functions will be in JSON. A JSON query parameter is in fact also a document.

In this post we’ll take a closer look at insertions. Don’t forget to start both mongo.exe and mongod.exe in two separate command prompts if you want to try the examples yourself.

Read more of this post

Introduction to Amazon Code Pipeline with Java part 2: setup

Introduction

In the previous post we set out the main topic of this series. We’ll be talking and Amazon Code Pipeline and what it can do for you in terms of Continuous Delivery. The larger part of the post dealt with the differences between 3 related topics: Continuous Integration, Continuous Deployment and Continuous Delivery.

Code Pipeline is an example of an automated Continuous Delivery tool which can help you with the often tedious steps of builds, test runners and deployments. The idea is that the developer can concentrate on the exciting stuff, such as writing some fantastically well-written code which is then pushed into a code repository, like GitHub. The rest of the steps is then handled by a CI/CD tool like Jenkins.

In this post we’ll take a quick visual tour of Code Pipeline so that you get the idea how to set up a new pipeline. We won’t yet add a custom job runner as that is not part of the initial setup process.

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.