RSSAmplifier

Blog

Databases & Life

Recent content on Databases & Life

databasesandlife.comRSS feed ↗243 posts

Latest posts

Solving the "pop" problem on my B&W ASW608 subwoofer


I have finally managed to get to the bottom of the 'pop' problem on my Bowers and Wilkins ASW608 subwoofer. I understand the problem affects the ASW610 subwoofer as well.
 The solution is to set the EQ on your amp to reduce frequencies 30Hz and below, which the sub can’t reproduce anyway. 
 
 
 The problem is sometimes you hear a loud “pop” during playback.…

Avoid aligning keys and values in source code unnecessarily

You are reviewing a PR. You see this diff. What has changed?

Send message with an "ordering key" to GCP Pub/Sub via "Spring Integration"

To set an “ordering key” on a message sent to Google Pub/Sub via Spring Boot using “Spring Integration”, you need to do the following:

Spring `Properties`<wbr>`Loader`<wbr>`Utils`<wbr>`.`<wbr>`load`<wbr>`All`<wbr>`Properties` overrides properties in wrong order

The Spring PropertiesLoaderUtils.loadAllProperties method seems to have a bug where it returns entries from lower-priority classpath entries in preference to higher-priority classpath entries.

Git loses untracked files during &#34;stash&#34; if there are conficts

Git had a bug from version 2.33 onwards, fixed in 2.35. (Thanks to Richard Laager&rsquo;s comment for the exact version numbers.) &#xA; &ldquo;Stashing&rdquo; then &ldquo;unstashing&rdquo; untracked files (new files you&rsquo;ve just created) loses those new files, if any of the existing tracked files has a conflict. &#xA; Let me explain.

Debian 10 box in Vagrant fails with `grub` error

If you are trying to get Debian 10 Buster to run in Vagrant and are receiving the following error &#xA; default: /dev/vda does not exist, so cannot grub-install to it!&#xA;default: You must correct your GRUB install devices before proceeding:&#xA;default: &#xA;default: dpkg-reconfigure grub-pc&#xA;default: dpkg: error processing package grub-pc (--configure):&#xA;default: installed grub-pc package…

How to determine the hostname for absolute links

Links in web applications can be &#xA; &#xA; Relative links like <a href="/foo"> , or &#xA; Absolute links like <a href=&ldquo;https:// www.site.com/foo'> . &#xA; &#xA; If you&rsquo;re writing a web application, relative links are generally the way to go. It&rsquo;s simpler to move the application to a new domain. In addition, for those counting bytes, relative links are shorter. &#xA; However,…

On Transitioning from Software Developer to Architect

Around 2003 I changed companies and accepted the title &ldquo;Software Architect&rdquo; at the new company. Before that, I&rsquo;d been working as a developer, then lead developer, then development team lead for a B2C startup. &#xA; If I had a time machine and could go back in time to give myself advice, this is what I would say. &#xA; Caveat: Unlike &ldquo;Software Developer&rdquo; or…

Turning off my server with 1.5k days uptime

Turning off a great server from Hetzner with over 1.5k days uptime (4.6 years). It needed an OS &ldquo;dist upgrade&rdquo; so I suppose a reboot was in order anyway. Such a shame!

Saving and Loading XML to PostgreSQL via jOOQ

&#xA;To use XML Java DOM objects with PostgreSQL's XML datatype, do the following.&#xA; &#xA; Create your table with the XML datatype: (You now have a table where the x column can be an XML document, or can be null .) &#xA; CREATE TABLE foo (xml_column XML);&#xA; &#xA; Add the following to your Maven dependencies: &#xA; <dependency>&#xA; <groupId>com.databasesandlife</groupId>&#xA;…

The &#34;backspace&#34; key on the keyboard should delete the last character you typed

I hate when pressing the &ldquo;backspace&rdquo; key on the keyboard a certain number of times doesn&rsquo;t wipe out that number of previous keystrokes. &#xA; For example, on Mac, if you press the spacebar twice then press backspace key twice you end up with one space. (As Apple inserts a period when you type space twice, so there are now three characters to delete.) &#xA; Or on Chrome, when…

Use the &#34;Repeatable Read” Isolation Level on PostgreSQL

The database system like PostgreSQL serves requests from many clients simultaneously. Sometimes multiple simultaneous requests might pertain to the same set of data. Programmers often (wrongly) think about the software they write as if it were the only process using the database. The danger is that often their software is the only piece of software using a particular piece of data, meaning that…

&#34;Activation&#34; library missing when sending email from Jetty on JDK11 despite library included via Maven

When trying to send an email, using JavaMail , from my application deployed via the Jetty web server in Docker , I kept on getting the following errors: &#xA; java.lang.NoClassDefFoundError: javax/activation/DataSource&#xA;Caused by:&#xA;java.lang.ClassNotFoundException: javax.activation.DataSource&#xA; &#xA; OK so with the upgrade from Java 8 to Java 11, due to Java 9 Project Jigsaw, a lot of…

Why is my Java software only using one core, on my multi-core AWS ECS Docker instance?

&#xA;There is no way to get Java to automatically use find out many cores are available and use them all, on AWS ECS using Docker. You have to specify how many cores you want to use via the -XX:ActiveProcessorCount option.&#xA; &#xA; On JDK >= 10, use the following JDK options: &#xA; -XX:ActiveProcessorCount=2&#xA; &#xA; On JDK >= 8, use the following JDK options: &#xA;…

How to set username and password when consuming a SOAP service with Spring

Spring&rsquo;s Consuming web service guide is great at describing how to go about being a client of a SOAP service, but it doesn&rsquo;t mention how to consume web services which are protected by any sort of security.

If you receive `null` for every attribute to your SOAP requests in Spring, after upgrading JDK, this is what you need to do

If you have a SOAP service written in Java using Spring, you have written methods that are called with Java objects representing the body of the SOAP request. If, after upgrading from Java 8 to Java 11 , you see that every attribute of those Java objects is null, adding the following to your Maven file is the solution:

Anonymous Types and Java 10 var

There is a nice new feature introduced by type-inference in Java. I&rsquo;ve wanted this feature for a while, but without type-inference, it wasn&rsquo;t possible. &#xA; The feature is the ability to create a local variable of an anonymous class, and then use the particularities of that anonymous class. &#xA; For example, in Java 9, to access a new method you&rsquo;d defined on an anonymous class,…

Suggestion Drop-Downs Being Confused with Other Fields

I always learn things about usability when watching my Dad use a computer. Recently I observed the following: &#xA; So as you type a station name into https://www.thetrainline.com/ it makes suggestions. So there are two fields, the &ldquo;From&rdquo; and the &ldquo;To&rdquo;. If you enter text in any of them, a drop-down appears with suggestions. Both these points are obviously completely standard…

art.world Retrospective

Sad day!!!&#xA;Taking the website https://art.world/ offline soon.&#xA;I guess I must have worked at least 1 year full-time on this product.&#xA;I made a little video so I could remember the product after it&rsquo;d been taken down.&#xA;It&rsquo;s 15 mins, not that interesting! But if you want to know the sort of stuff I work on, this is it.

Improve code readability by putting spaces around the &#34;not&#34; symbol

When I first started working, I noticed my boss at the time had a coding convention that I&rsquo;d not seen elsewhere. As I was new to work, and the convention seemed logical, I adopted it, thinking it might be standard in the world of work. Alas I was wrong, I&rsquo;ve never seen anyone else use it. But I still think it&rsquo;s a good convention. &#xA; And that&rsquo;s based around the following…

What is Resource Leveling and Why Do You Need it?

A Guide to the Project Management Body of Knowledge (PMBOK Guide) defines Resource Leveling (also known as Predictive Planning or Priority-Based Scheduling )&#xA;in the context of project management tools as: &#xA; &#xA; A technique in which start and finish dates are adjusted based on resource constraints with the goal of balancing demand for resources with the available supply. &#xA; &#xA; Many…

Project Management tools that offer &#34;Resource Leveling&#34;

No view for workers to see what their tasks are.&#xA; No range estimates to capture uncertainty.&#xA; No view of estimated predicted costs.&#xA; No view to see how long workers have work for (resource utilization).&#xA; No 'what-if' scenarios.&#xA;&#xA;-->&#xA; &#xA; &#xA; &#xA; &#xA; &#xA; Tool &#xA; Cost &#xA; What it does &#xA; What it doesn't do &#xA; &#xA; &#xA; &#xA; &#xA; Microsoft Project…

Scrum stand-ups prevent you from doing your best work, and they do that every day

Back in 2010 I worked for a company that had daily stand-ups at 10am every day.&#xA;That&rsquo;s fairly standard practice, so I found it difficult to complain about.&#xA;I was never enthusiastic about these meetings, but could never put my finger on why.&#xA;Recently I realized it was a combination of these factors: &#xA; &#xA; &#xA; You get paid for your best ideas. Nobody hires anyone to go to…

Avoid Vendor Lock-in When Sending Emails by Using SMTP

Email delivery providers such as Mandrill, Mailgun, SendGrid, AWS SES etc. all provide proprietary APIs and SDKs to send email over their service. These APIs are different from one email provider to the next. However all these services also allow you to send email via the industry-standard SMTP. &#xA; All email delivery providers encourage you to use their own API. Sometimes they don&rsquo;t…

How to prevent Jetty, deployed via Docker on AWS ECS, behind an AWS ELB, redirecting from secure HTTPS to insecure HTTP

So this is your setup. You&rsquo;ve using Jetty to serve your web application, and you&rsquo;re deploying it via Docker to AWS Elastic Container Service (ECS), and you place it behind an AWS Elastic Load Balancer (ELB). You aren&rsquo;t living in the past so you enable HTTPS on the ELB. Your clients connect via HTTPS to the ELB, and the ELB connects to your application via HTTP internally to AWS.…

Change Git Line Endings

In a similar vein to my previous article , here is a script to change the line endings of all files across all revisions in a Git repository to UNIX line endings. &#xA; git filter-branch -f&#xA; --tree-filter 'find . &#xA; -name .git -prune -o &#xA; -exec sh -c 'file {} | grep -q text' \;&#xA; -exec dos2unix -q {} \;&#xA; ' &#xA; Subversion, by default, stores all files in the repository in the…

Best Practices For Invoice UX

So your product bills customers and produces invoices. Being self-employed, I have to go through my bank statements and send those invoices to my accountant. This is what I wish companies who produce invoices would do: &#xA; &#xA; &#xA; Invoices are PDFs. PDF files are easy to put into a directory to send to my accountant. PDF files can be styled to actually look like invoices. (HTML files…

Prefer Lombok&#39;s `@SneakyThrows` to rethrowing checked exceptions as `RuntimeException`s

The traditional way of dealing with a checked exception being thrown from a place where you know it can&rsquo;t actually be thrown, is to re-throw it as a RuntimeException . That way in case it does actually happen, you&rsquo;ll know about it, and have the full stack trace available. &#xA; public void foo() {&#xA; try {&#xA; Writer w = .....&#xA; w.write("foo");&#xA; ....&#xA; } catch (IOException…

On writing deadlock-free and composable software

&#xA; &#xA; Deadlocks are: One session/user has acquired access to resource A (and won&rsquo;t let anyone touch it), and is waiting for resource B. Another user/session has acquired access to resource B and is waiting for resource A. They&rsquo;ll both wait forever. You don&rsquo;t want that. Your software has now crashed. You want your software to be deadlock-free. &#xA; &#xA; &#xA; Software…

How to e.g. change Java package name, over all revisions, while preserving Git history

Recently a customer requested that a piece of software should &ldquo;move companies&rdquo; from company A to company B, henceforth appearing as if it&rsquo;d always been created by company B, and never appear to have been produced by company A at all. (I would surprise you if I say this is not the first time I&rsquo;ve received such a request.. or not?) &#xA; The simplest way would have been to…

Use the telephone for outgoing requests, email for incoming requests

I have been thinking about emails vs phone , or more generally asynchronous vs synchronous communication, and have realized: &#xA; &#xA; &#xA; If you receive a call , it breaks your flow, which is bad. &#xA; &#xA; &#xA; If you send an email , it breaks your flow, which is bad. (As you have to wait for an answer, and do something else in the meantime.) &#xA; &#xA; &#xA; So: &#xA; &#xA; &#xA; If you…

Use Mutually Understandable Names for Priorities in Project Management Tools

So today I got access to a customer&rsquo;s new JIRA task management system. Unsurprisingly, every task has a field priority , from highest , high , low etc. It&rsquo;s understandable that tasks might be sorted by urgency, to communicate that the most urgent stuff should be done first.&#xA;But these aren&rsquo;t good names.&#xA;I have had the following experience at various previous customers:…

Avoid using out-of-date operating system images in Docker by always using the `docker build --pull`

I wrote down a note on my task list on the current project, &ldquo;Investigate whether docker build always gets the latest version of the base image&rdquo;. The answer is, it does not, by default. Always use the --pull option to get the latest version. &#xA; When installing any software, it&rsquo;s important to have security updates applied to all its components, including the operating system.…

Java Exceptions naming convention: `<problem><noun>Exception`

I have long been inconsistent when creating Java Exception classes, in terms of how I name them. Having looked through the Exeptions that are supplied with Java, I see there is no real standard naming convention. &#xA; I have found more exceptions with the form <problem><noun>Exception . For example, IllegalArgumentException . So that&rsquo;s what I&rsquo;ve decided to use in the future.

What language should be taught as the first language on a university computer science degree course?

&#xA;A friend of mine asked me for my opinions on what programming language should be taught in the introductory class of computer science at university.&#xA; &#xA; I remember this debate when I was at university 20 years ago, this debate has no doubt been raging for centuries. (This may not be literally true, or rather, it is just not yet literally true at the time of writing&hellip;)&#xA;This is…

Unit testing code that needs data in a database

If you write a method like &ldquo;add product to user&rsquo;s cart&rdquo;, you want to test that that method works. &#xA; That method may require state to exist e.g. in a database (e.g. that the user exists, to whose cart the product shall be added), and testing it automatically e.g. with JUnit may require querying the new state (e.g. that the product is now in the user&rsquo;s cart). &#xA; You…

Survive being hacked by using _write-only_ backups

&#xA;One of the functions of backups is to be able to restore the system and data in the case of a successful hacking attack. Without write-only backups, if the servers have access to the backups, then the hacker who has access to the servers has access to the backups too.&#xA; &#xA; It is generally understood that backups which don&rsquo;t happen automatically get forgotten at some point. Without…

Reduce bugs by: not using `toString()`

&#xA;The trouble with toString() in Java (or ToString() in C#) is that every object implements it. If you want to extract information from your object, define your own method, like getName() , as opposed to overriding toString() .&#xA; &#xA; In order to leverage the Java type-checker, you might want to define a class like FooName to wrap a String , as opposed to simply using a String . That way, a…

Handle errors gracefully by offering *idempotent* APIs

&#xA;In the REST specification, there is no way to group individual requests together into a transaction (in the way that it's possible to group multiple modifications to a database into a database transaction, or in a distributed J2EE system use a distributed transaction). Making all APIs idempotent goes some way to compensating for this shortcoming.&#xA; &#xA; Motivation &#xA; A client may well…

How to include draw.io diagrams into LyX documents

&#xA; &#xA; In draw.io in the browser, go to the File menu, Export submenu, export as PDF. (I did not succeed in getting SVG output to work with LyX.) Select &ldquo;crop&rdquo; in the PDF export dialog. Export the PDF to the same directory where your LyX document is. &#xA; &#xA; &#xA; In LyX, go to the Insert menu, choose Float, choose Figure. (A &ldquo;float&rdquo; creates the style that the…

The craziest &#34;undo&#34; algorithm you&#39;ve never heard of

The arrow of time may famously only point only one way, but the progress in computer science takes a weaving non-linear path through the thing we understand as time. &#xA; The current understanding of how &ldquo;undo&rdquo; works within computer programs is pretty fixed;&#xA;all programs use &ldquo;undo&rdquo; and &ldquo;redo&rdquo; in the same way? But could &ldquo;undo&rdquo; and…

Blog re-design 2016

Today I've released a new version of my blog and homepage. Unless you're reading this a long time in the future and this design has been superseded by a new design, you're looking at it :) &#xA; It&rsquo;s been a long time since I updated my blog design last. The previous design was a modification of the standard WordPress theme from January 2008. It wasn&rsquo;t responsive, and was primarily…

Don&#39;t leave old out-of-date code commented out; just delete it

If you replace code, and commit out the original while you are working, please delete the commented out code before you commit. &#xA; Code such as: &#xA; int x = foo() + 1;&#xD;&#xA;// int x = foo() + 2;&#xA; Becomes pretty unreadable after a time. &#xA; It makes sense to you while you write it, but in 2 years, and looked at by another developer, it will probably not make any sense. &#xA; We all…

Persistent Login (the &#34;remember me&#34; checkbox)

It is a requirement of many customer projects of mine to have a 'remember me' or 'keep me logged in' checkbox on the log-in form. I am not aware of any standard approach to the subject; I suspect every company invents their own (and then blogs about it?) Here's what I do when asked to implement this feature, as online on art.world . &#xA; Here are the requirements as I see them: &#xA; &#xA; Users…

As a Customer, I Want To See Up-to-Date Costs I&#39;ve Incurred, Using a Web Application

I think it's important, that in a software development company, as all others, customers get transparent up-to-the-minute information about what costs they have incurred. Alas my company can't provide that at the moment, due to our tooling (this is a deficiency, or at least difference of opinion, between me and LiquidPlanner, the tool we use for tracking time.) This is the email I sent to…

&#34;Facebook Background Task Host&#34; consuming 100% disk bandwidth

The program &ldquo;Facebook Background Task Host&rdquo; was consuming the entirety of my disk bandwidth on my Windows 8.1 computer. Further, there seemed to be almost nothing written about this program on the internet according to Google. Rebooting the computer didn&rsquo;t help: after the reboot it was there again. I did not remember downloading anything from Facebook to run on my computer. &#xA;…

&#34;Leaving out the best bit&#34; project management anti-pattern

When I was at university in the 90s, studying computer science, my final-year bachelor project was a &ldquo;fractal raytracer&rdquo;. &#xA; My idea was to write a program which could produce pictures of those wonderful artificial worlds one saw on posters of the time, hung in every university dorm room. Raytracers render highly realistic images, and fractals produce interesting shapes to render.…

How to install Percona MySQL 5.6 on Ubuntu 14.04 LTS from a script (i.e. without an interactive prompt for the mysql root password)

Ubuntu 14.04 (and various versions of Debian) come with MySQL 5.5. If you need MySQL 5.6 features (such as better join algorithms) you can install the Percona software, as described here . &#xA; However, the installation process prompts you for the database&rsquo;s root password. This isn&rsquo;t convenient if you&rsquo;re running the installation process from a script e.g. a Vagrant or Docker…

Avoid adding &#34;drive-by formatting changes&#34; to commits

Recently, when reviewing code, I saw a commit resembling the following: &#xA; - if (x) foo();&#xD;&#xA;- if (y) bar();&#xD;&#xA;+ if (y) {&#xD;&#xA;+ bar();&#xD;&#xA;+ }&#xD;&#xA; &#xA; It&rsquo;s not easy to see that of the two &ldquo;if&rdquo; statements, only one was actually deleted. The other had its formatting changed, but was otherwise not altered. &#xA; To prevent this, go through the…

Business and Work 2014

I went to a lecture recently and the CEO of Runtastic spoke. He said: you don’t “win or lose” , you “win or learn” . 2014 was a year of learning for me. Some of it was good, but some of it was definitely in the “you win or learn” sense of learning. &#xA; Collecting on debts &#xA; Many customers thought they would just order software from me and worry about paying it later. (The word “later” in the…