Comparison of Lightweight CSS Frameworks
Several months ago I was building a new website and needed a CSS framework. There are many new CSS frameworks around now, so I decided to do several small trial runs and compare them to find the most fitting for our site.
Initially I tried using Foundation, which this site is built on, but I ran into a problem: Foundation and other popular frameworks are powerful, but they have more features than I needed, and they take up too much disk space for a modest website. Foundation is about 6000 lines long and 200kB unminified. It can be shrunk by removing components you don’t need, but the time it takes to slim a large CSS framework down to your needs can be more than it’s worth, especially if you want to change any styling.
Instead of adapting a larger framework to my needs, I looked into lightweight CSS frameworks. These aim to provide boilerplate components, better styling for buttons, forms, tables, and the like, all at the cost of very little disk space.
I like to modify the source CSS as needed, so all of the sizes I list will be unzipped and unminified. They are also from my brief real-world testing on one machine, so your mileage may vary.
Bulma
Bulma looked very …
!-->css design
Database integration testing with .NET
Ruby on Rails is great. We use it at End Point for many projects with great success. One of Rails’ cool features is how easy it is to write database integration tests. Out of the box, Rails projects come with all the configuration necessary to set up a database that’s exclusive for the automated test suite. This database includes all the tables and other objects that exist within the regular database that the app uses during its normal execution. So, it is very easy to write automated tests that cover the application components that interact with the database.
ASP.NET Core is also great! However, it doesn’t have this feature out of the box. Let’s see if we can’t do it ourselves.
The sample project
As a sample project we will use a REST API that I wrote for another article. Check it out if you want to learn more about the ins and outs of developing REST APIs with .NET. You can find the source code on GitHub.
The API is very straightforward. It provides a few endpoints for CRUDing some database tables. It also provides an endpoint which, when given some vehicle information, will calculate a monetary value for that vehicle. That’s a feature that would …
!-->dotnet integration database testing docker containers
On the Importance of Explicitly Converting Strings to Numbers
Recently a valued colleague approached me with a JavaScript problem. This individual is new to programming and is working on a self-taught course.
The assignment was fairly simple: Take a list of space-delimited integers and find the maximum and minimum values. If you are an experienced developer you can probably already guess where this is going. His code:
function highAndLow(numbers) {
const myArr = numbers.split(" ");
let lowNum = myArr[0];
let highNum = myArr[0];
for (let i = 0; i < myArr.length; i++) {
if (myArr[i] > highNum) {
highNum = myArr[i];
} else if (myArr[i] < lowNum) {
lowNum = myArr[i];
}
}
return highNum + ' ' + lowNum;
}
console.log(highAndLow("8 3 -5 42 -1 0 0 -9 4 7 4 -4"));
This produced the output:
"8 -1"
These are clearly not the maximum or minimum values.
After looking at it for a few moments I recognized a classic JavaScript pitfall: failure to explicitly convert stringy numbers to actual number types.
You see, JavaScript tries to be clever. JavaScript tries to get it right. JavaScript tries to say “the thing you are doing looks like something that you would do with numbers so …
!-->programming javascript typescript
Kubernetes 101: Deploying a web application and database
The DevOps world seems to have been taken over by Kubernetes during the past few years. And rightfully so, I believe, as it is a great piece of software that promises and delivers when it comes to managing deployments of complex systems.
Kubernetes is hard though. But it’s all good, I’m not a DevOps engineer. As a software developer, I shouldn’t care about any of that. Or should I? Well… Yes. I know that very well after being thrown head first into a project that heavily involves Kubernetes, without knowing the first thing about it.
Even if I wasn’t in the role of a DevOps engineer, as a software developer, I had to work with it in order to set up dev environments, troubleshoot system issues, and make sound design and architectural decisions.
After a healthy amount of struggle, I eventually gained some understanding on the subject. In this blog post I’ll share what I learned. My hope is to put out there the things I wish I knew when I first encountered and had to work with Kubernetes.
So, I’m going to introduce the basic concepts and building blocks of Kubernetes. Then, I’m going to walk you through the process of containerizing a …
!-->kubernetes docker dotnet postgres containers
Fixing a PostgreSQL cluster that has no superuser
Normally in a newly-created PostgreSQL database cluster there is a single all-powerful administrative role (user) with “superuser” privileges, conventionally named postgres
, though it can have any name.
After the initial cluster setup you can create other roles as needed. You may optionally grant one or more of your new roles the superuser privilege, but it is best to avoid granting superuser to any other roles because you and your applications should generally connect as roles with lower privilege to reduce the risk of accidental or malicious damage to your database.
Let’s break something 😎
Imagine you have a cluster with two or more superuser roles. If you accidentally remove superuser privilege from one role, you can simply connect as the other superuser and re-grant it.
But if you have a cluster where only the single postgres
role is a superuser, what happens if you connect as that role and try to remove its superuser privilege?
$ psql -U postgres postgres
psql (14.1)
Type "help" for help.
postgres=# \du
List of roles
Role name | Attributes | Member of …
postgres security tips
Setting up SSH in Visual Studio Code
Visual Studio Code is a powerful code editor that can create a customized IDE for your development. VS Code’s default configuration is great for working locally but lacks the functionality to give the same experience for remote SSH development. Enter the extension Remote SSH.
Installation
Installing the Remote SSH extension is really easy! First you access the Extension Marketplace with Ctrl+Shift+X
or by clicking View > Extensions
in the menu, then you just search for and select Remote - SSH
.
Setting up your SSH config file
To configure your connection, you’ll need to add a few lines to your SSH config. Click the green Open a Remote Window
icon on the bottom left corner:
Select Open SSH Configuration File...
and select the config file you want to use. I use the Linux default, /home/$USER/.ssh/config
. Add the Host, HostName, and User as required and save:
Host MySite
HostName site.endpointdev.com
User couragyn
Connecting
Click the green Open a Remote Window
icon on the bottom left corner, select Connect to Host...
, and pick your desired host, in this case MySite
. If your public SSH key isn’t on the remote server, you will be prompted to enter a …
ssh tips vscode
Word diff: Git as wdiff alternative
The diff
utility to show differences between two files was created in 1974 as part of Unix. It has been incredibly useful and popular ever since, and hasn’t changed much since 1991 when it gained the ability to output the now standard “unified context diff” format.
The comparison diff
makes is per line, so if anything on a given line changes, in unified context format we can tell that the previous version of that line was removed by seeing -
at the beginning of the old line, and the following line will start with +
followed by the new version.
For example see this Dockerfile that had two lines changed:
$ diff -u Dockerfile.old Dockerfile
--- Dockerfile.old 2022-01-05 22:16:21 -0700
+++ Dockerfile 2022-01-05 23:08:55 -0700
@@ -2,7 +2,7 @@
WORKDIR /usr/src/app
-# Bundle app source
+# Bundle entire source
COPY . .
-RUN /usr/src/app/test.sh
+RUN /usr/src/app/start.sh
That works well for visually reviewing changes to many types of files that developers typically work with.
It can also serve as input to the patch
program, which dates to 1985 and is still in wide use as a counterpart to diff
. With patch
we can apply changes to a file and avoid the need to send …
git terminal vscode intellij-idea tips
Generate PDF with Chrome, Puppeteer, and Serverless Stack
Function as a Service (FaaS) solutions are becoming more and more mainstream today. The FaaS model allows developers to not have to worry about managing infrastructure and instead focus on writing the application logic. In the FaaS model, developers write individual functions that run specific tasks that are deployed together on a FaaS platform, including but not limited to Amazon Web Services (AWS), Azure, and Google Cloud Platform (GCP).
These functions don’t always run like a traditional application server does, waiting for a request. Instead, these FaaS platforms only spin up instances of these functions whenever there is traffic and will shut them back down once there are no more requests after a given period of time. This helps make FaaS a really cheap platform while traffic is low. It is a good approach for on-demand tasks that are part of the application but not necessarily the most common path in a customer’s everyday journey within the application.
The tools
In this tutorial, we’re going to be looking at implementing PDF download with Chrome, Puppeteer, and Serverless Stack, but first, let’s have a brief introduction of the tools that we are …
!-->automation aws chrome cloud pdf serverless