Introducing Perl6::Math::Matrix (Part 1: Data)

See the original posting on DZone Python

At TPC in Glasgow, I held two talks (slides and video stored or linked to my domain as linked on conference site) about my module, Perl6::Math::Matrix. To me, the most interesting parts of this talk were musings about how to write a good API in and for Perl 6. And since I already got a lot of good suggestions from the audience (which are all implemented by now [by the critic or me]), I will write here a series of posts about this topic and maybe get some more inspirations.

Basic Properties

As said during the talk, the basic design decisions were to see the Matrix as an array of arrays and a read-only data object. This allows me to cache all lazy evaluated, computation-heavy properties and not worry about them changing. It also forces me to create new Matrix objects when computing derivative matrices.

Customizing ASP.NET Core, Part 1: Logging

See the original posting on DZone Python

In this first part of the new blog series about customizing ASP.NET Core, I will show you how to customize logging. The default logging only writes to the console or to the debug window. This is quite good for most cases, but you may need to log to a sink, like a file or a database. Maybe you want to extend the logger with additional information. In those cases, you need to know how to change the default logging.

The Series Topics

  • Customizing ASP.NET Core Part 01: Logging
  • Customizing ASP.NET Core Part 02: Configuration
  • Customizing ASP.NET Core Part 03: Dependency Injection
  • Customizing ASP.NET Core Part 04: HTTPS
  • Customizing ASP.NET Core Part 05: Hosted Services
  • Customizing ASP.NET Core Part 06: MiddleWares
  • Customizing ASP.NET Core Part 07: OutputFormatter
  • Customizing ASP.NET Core Part 08: ModelBinder
  • Customizing ASP.NET Core Part 09: ActionFilter
  • Customizing ASP.NET Core Part 10: TagHelpers

Configure Logging

In previous versions of ASP.NET Core (pre-2.0) the logging was configured in the Startup.cs. Since 2.0 the Startup.cs was simplified and a lot of configurations where moved to a default WebHostBuilder, which is called in the Program.cs. Also, the logging was moved to the default WebHostBuilder:

From Callbacks to Async-Await: A Migration Guide

See the original posting on DZone Python

I originally wrote this article for Morning Cup of Coding. Morning Cup of Coding is a newsletter for software engineers to be up to date with and learn something new from all fields of programming. Curated by Pek and delivered every day, it is designed to be your morning reading list. Learn more.

Callbacks have been at the core of JavaScript and Node.js ecosystem. As much as they are needed for the performance boosts, they have proven to have huge maintenance issues. There have been multiple attempts at fixing these, from generator functions to promises, until asyncawait came into the picture mitigating most of the concerns that asynchronous code traditionally used to bring with it. Now that they have been standardized, most developers are stuck with old code still living in callback hell (when you have multiple, deep nested callbacks within a function) that needs to be migrated to the same ecosystem. This blog post gives a set of step-by-step instructions to ease these migrations.

Quick Tip: Dynamic Stencil Component Names With JSX

See the original posting on DZone Python


Components composition is the main way to work with Stencil. There are occasions that we would like to decide dynamically which component to render as child component in some parent component. This can happen if you get the name of the component to render from the outside or need to decide the component according to some state. What can we do then?

One way to solve this is to put switch/case or if statements inside the component render function and get over with it. This solution is valid and will work but one of the main features of Stencil is the usage of JSX. So, how can we use JSX in our favor?

Full Stack Development From Client-Side JavaScript [No Node.js]

See the original posting on DZone Python

In case you think the above header sounds like an oxymoron or some sort of black magic, think again. With Lizzie, you can (at least in theory) create your entire business logic in JavaScript, in your browser, submit your Lizzie code to the server for evaluation (securely), and have it return JSON back to your client.

For the record, this assumes you’ve previously created generic "hooks" in C#, allowing your Lizzie code to do something useful, since, out of the box, Lizzie can barely do anything at all, besides from creating lists, dictionaries, do basic math, and some simple string manipulation. However, if you create generic methods for retrieving data from your database, etc., creating your business logic in JavaScript as Lizzie code, and transmitting this code to your server for evaluation, is actually a breeze. This in turns creates a much more dynamic server-side API, allowing you to (after a while) do anything you want from JavaScript, without having to code in (any) server-side language at all. At least that’s how the theory goes. To understand what I am talking about, picture the following code.

Achieve: JavaScript Servlets on Node.js

See the original posting on DZone Python

Achieve is a modern HTTP server that runs on Node.js and uses JavaScript Servlets to initiate backend processing. (npm, GitHub) JS Servlets are fast, very easy to use, and do not limit your ability to develop sophisticated backend applications; perfect for the rapid development of microservices or complete Node.js-based web applications. You can even use it just to serve web pages.

A servlet is a small program that runs on a server. The term has long since been associated with Java. Java Servlets provide the interface between servers and backend application programs written in Java. This new server implementation, named Achieve, provides a JavaScript Servlet implementation on Node.js. If you are familiar with Java Servlets, you should easily see general similarities in the new JS Servlet design.

Freeze-Mutate: An Immutable Object Management Library for JS and TS

See the original posting on DZone Python

I was looking for a nice little module that would help me make my DTOs immutable. The libraries I found were either an overkill (immutable.js), lacking support for deep merging of objects during mutations, or they were making my code ugly with lots of function calls for each change. So that’s how freeze-mutate came to life: a Javascript/Typescript-based npm module that helps me keep things simple and neat.

  • Freeze any object and it becomes deeply-immutable: all its properties and child-objects are frozen in the process. This is done by recursively calling JavaScript’s native Object.freeze.
  • Mutate a frozen object with a change-set and you get a new frozen object that is a merge, or an overlay, of the change-set on top of the original object. Again, this is a deep-merge that also you to works with Arrays, Sets, Maps, and your own custom classes. For the brave: you can provide custom freeze and merge functions.
  • Using TypeScript you get all the goodies of generics, enforcing the validity of the change-set, Readonly returned types and interfaces for the custom functions.

Enough talking. Let’s dive in…

Return 0 Value From C# Entry Point Method Using Parent and Child Programs

See the original posting on DZone Python

Hello everyone, as we know that in C# apps (both Console and Win) Entry Point Method refers to the Main() of a program. When the application is started, the Main method is the first method that is invoked. This Main() does have a return type of “int” and much of the time we noticed that the return value for this Main() seems to 0. So let’s understand the behind the scenes of this return value.

Background

In general, our assumption is (after a Google search) a return of 0 in Main() refers to the status code of the application such as, “Exited Successfully,” or if it’s 1. then it exited with some errors. But, these 0/1 values are user-defined.

Parsing in C#: All the Tools and Libraries You Can Use (Part 3)

See the original posting on DZone Python

Welcome back! If you missed the first two parts, you can check them out here: Part 1; Part 2.

Parser Combinators

Parser combinators allow you to create a parser simply with C# code, by combining different pattern matching functions that are equivalent to grammar rules. They are generally considered to be best suited for simpler parsing needs. Given that they are just C# libraries, you can easily introduce them into your project: you do not need any specific generation step and you can write all of your code in your favorite editor. Their main advantage is the possibility of being integrated in your traditional workflow and IDE.

A Breakdown of Blazor Project Types

See the original posting on DZone Python

We discuss the three project types available with Blazor 0.5.1, get an understanding of what scenarios to apply them to, and explore what to expect from each.

Blazor is a single-page web application (SPA) framework built on .NET that runs in the browser with Mono’s WebAssembly run-time or server-side via SignalR. Blazor features a component architecture, routing, a virtual DOM, and a JavaScript Interoperability (interop) API. Currently, Blazor is in an experimental state which allows for rapid development, iterations, and, as implied, experimentation.a

How to Install and Use Chatra

See the original posting on DZone Python

Still provide phone support? Have you ever thought about the live chat effectiveness for your website? While the majority of people avoid phone conversations and lack time to read emails, live chat can be a perfect option for providing the effective support and building relationships with your visitors. You can forget about all that "Could you spell your email phonetically?” and give quick replies to the burning requests. Live chat saves you time, provides a much broader picture of your visitors, increases customers’ loyalty, and even reduces stress caused by the phone calls.

What Is Chatra?

Chatra is a user-friendly messenger tool for websites that helps you assist the website visitors promptly and build sustainable relationships with them. Chatra gives you a chance to effectively fight the cart abandonment and avoid costly delays that are common for email support and are so critical in the competitive business environment. And their mobile apps allow you to help the visitors even when you are out of the office.

1 2 3 129