Our Blog

Ongoing observations by End Point people

CZML-KML Editor Geometry Editing

Dmitry kiselev

By Dmitry Kiselev
April 13, 2021

We are happy to introduce a new feature for the Cesium CZML-KML Editor: polygons and polylines geometry editing. You can now edit geometries for existing entities and move entered points during the creation process. Here is a video with a short summary of the editing process:

See our previous blog post introducing the Cesium CZML-KML Editor for further reference.


cesium google-earth gis open-source

Spatial queries with MySQL

Juan pablo ventoso

By Juan Pablo Ventoso
March 24, 2021

Spatial queries with MySQL Photo by Francois Powell, CC BY 2.0, cropped

MySQL is one of the most widely used relational databases. Most PHP websites rely on MySQL for persisting their information, which makes it one of the DB-Engines top four most popular databases along with Oracle, SQL Server, and PostgreSQL.

One of its capabilities that is not very well known is that the engine supports working with spatial data, allowing you to save different shapes (points, lines, polygons) and querying information based on intersections, distances, or overlaps. This capability was included in MySQL a long time ago, but it became easier to use starting in version 5.6, when the distance and point intersection functions were added.

Spatial data can be useful for many needs, including:

  • Searching for places based on latitude/​longitude coordinates
  • Displaying information and areas as layers on maps
  • Architecture or home design applications

My first experience with spatial queries was for a weather website I developed that displays local alerts/​warnings on a map using MySQL spatial functions to return active weather alerts for a given location, or to inform if lightning has been observed near the user’s current coordinates. So far, MySQL has given me all the resources I need to do such operations with relatively good performance and without needing to write lots of custom code.

Adding spatial information

There are many resources available to import spatial information into our database. From the United States Census Bureau we can find a set of shapefiles with all US states and counties. The Back4App social database platform also has many datasets available to download for free.

Of course, we can also create a table ourselves that contains any kind of spatial information. In the example below, we will create a table named restaurants which will have a name and location (lat/long) geometry for each row.

CREATE TABLE restaurants (
  name VARCHAR(100),
  location GEOMETRY NOT NULL,
  SPATIAL INDEX(location...

mysql database gis

Database Design: Using Natural Keys

Emre hasegeli

By Emre Hasegeli
March 15, 2021

Bank safe deposit boxes

Whether to use natural or surrogate keys is a long-debated subject of database design. I am a fan of using natural keys. I think there are even more compelling reasons to use natural keys in databases as the systems grow more complex and interdependent.

Natural or Surrogate

Let’s start by what we mean by natural. It’s not trivial to define this. In today’s world of APIs, someone’s surrogate key is another’s natural key. Wikipedia defines natural keys as “a type of unique key in a database formed of attributes that exist and are used in the external world outside the database”. This makes it clear that the keys we get from APIs are our natural keys. But how about the ones generated by us to be used in the external world?

When applications expose the keys on the URLs and APIs, others start relying on them. This is where our choices become important. When all those different applications generate their own keys instead of using the keys they got from other places, life becomes difficult for no reason.

Let’s elaborate with an example corporate database where employees are identified by their usernames and the departments with their domains. So our data would look like this:

| department        | username  | job                     |
| ----------------- | --------- | ----------------------- |
| sysadm.corp-x.com | hasegeli  | Database Administrator  |
| sysadm.corp-x.com | john      | System Administrator    |
| dep1.corp-x.com   | jane      | Developer               |

When we design this using surrogate keys, it’d look like this:

CREATE TABLE departments (
  id int NOT NULL GENERATED ALWAYS AS IDENTITY,
  domain text NOT NULL,

  PRIMARY KEY (id),
  UNIQUE (domain)
);

CREATE TABLE employees (
  id int NOT NULL GENERATED ALWAYS AS IDENTITY,
  username text NOT NULL,

  PRIMARY KEY (id),
  UNIQUE (username)
);

CREATE TABLE department_employees (
  id int NOT NULL GENERATED ALWAYS AS IDENTITY,
  department_id int NOT NULL,
  employee_id int NOT NULL,
  job text...

database postgresql

Job opening: Ruby on Rails & Vue.js developer

Jon jensen

By Jon Jensen
February 24, 2021

Two software developers at their computers Photo by WOCinTech Chat, CC BY 2.0, cropped

We are seeking a full-time software engineer specializing in Ruby on Rails and Vue.js to work with us on our clients’ applications.

End Point is an Internet technology consulting company based in New York City, founded 25 years ago! We have over 50 employees serving many clients ranging from small family businesses to large corporations.

Even before the pandemic most of us worked remotely from home offices. We collaborate using SSH, Git, project tracking tools, Zulip chat, video conferencing, and of course email and phones.

What you will be doing:

  • Develop new web applications and support existing ones for our clients
  • Consult with clients on software features and plans
  • Work together with End Point co-workers and our clients’ in-house staff
  • Use open source tools and contribute back as opportunity arises

What you bring:

Professional experience developing and supporting web applications in these technical areas:

  • 3+ years of development with Ruby on Rails and front-end JavaScript
  • Frameworks and libraries such as Vue.js, React, Angular
  • Databases such as PostgreSQL, MySQL, Redis, Solr, Elasticsearch, etc.
  • Security consciousness
  • Git version control
  • Automated testing
  • HTTP, REST APIs

These work traits are just as important:

  • Strong verbal and written communication skills
  • An eye for detail
  • Tenacity in solving problems and focusing on customer needs
  • A feeling of ownership of your projects
  • Work both independently and as part of a team
  • Ability to pass a criminal background check when clients require
  • A good remote work environment and self-discipline

What work here offers:

  • Collaborate with knowledgeable, friendly, helpful, and diligent co-workers around the world
  • Flexible, sane work hours
  • Paid holidays and vacation
  • Annual bonus opportunity
  • Freedom from being tied to an office location
  • Use your desktop OS of choice: Linux, macOS, Windows
  • For U.S. employees: health insurance subsidy and 401(k) retirement savings plan

company jobs ruby rails javascript remote-work

An Introduction to TypeScript

Jeff laughlin

By Jeff Laughlin
February 9, 2021

TypeScript logo

TypeScript is a programming language defined as a superset of JavaScript. It adds static type information to JavaScript code using type annotations. These annotations permit strong type-checking at compile-time, kind of like a very strict linter. They are only used for static analysis. TypeScript is transpiled to JavaScript for execution in the browser or Node.js and the type annotations are stripped out. It is still possible to use standard JavaScript type information at run-time, such as that obtained using the typeof and instanceof operators.

Adding type annotations brings many benefits. Most importantly, TypeScript can tell us when we’re doing something dumb that’s likely to cause a type-related bug. But more than that, it powers editors’/​IDEs’ context sensitive tool tips so when you hover or start typing the editor can supply helpful information so you can get your job done quicker. This is particularly useful to new developers as it saves them the trouble of reading all the sources to figure out the variable types from context, especially when debugging.

JavaScript is a fairly dynamic language but types still exist in JavaScript, whether we like it or not. Because it’s so dynamic it assumes that you the programmer know the type of every object you are using on every line of code and will do nothing to help you get it right. The type is specified by the context. The trouble is that in any non-trivial codebase it becomes impossible to be absolutely 100% certain about the type of some particular object that’s being passed around without reading the context, which is often a ton of code.

By eagerly annotating our JavaScript code with types we can eliminate entire classes of bugs from our codebase. TypeScript will never let you play loosey-goosey with integers and strings, for example. If you want a variable to be able to hold an int or a string you must explicitly declare it as type “integer” or “string”.

TypeScript lowers the total cost of ownership of a...


typescript javascript nodejs

Monads: Another tool from the functional programming toolbox

Kevin campusano

By Kevin Campusano
January 27, 2021

banner

I was first exposed to the world of functional programming back in 2007 with the release of .NET Framework 3.5 and the introduction of LINQ into the C# language. At the time, I was just beginning to learn how to code and LINQ seemed to be little more than an extension of the C# language that allowed programmers to use SQL-like syntax to interact with collections of data. This was mostly useful for interacting with databases, via LINQ to SQL. The concept of “functional programming” never even crossed my mind back then.

Once you had created a LINQ to SQL Object Model using the tools provided in Visual Studio, you could write code like this directly in C#:

var customersWithRecentExpensiveOrders =
  // Think of db.Orders as your hypothetical "orders" table.
  from o in db.Orders
  where o.Total >= 100.00 && o.Date == DateTime.Now
  // All orders have a customer
  select o.Customer;

Alternatively, you could also use the so-called method syntax:

var customersWithRecentExpensiveOrders =
  db.Orders
    .Where(o => o.Total >= 100.00 && o.Date == DateTime.Now)
    .Select(o => o.Customer);

LINQ would take that and turn it into native SQL that got executed against your database. Pretty neat.

So I ran with it and little by little I discovered that the set of tools provided by LINQ offered much more than syntactic sugar over database interactions. I discovered the power of LINQ when it came to interacting with lists of objects, database or no. That’s when the breakthrough came. LINQ was indeed a set of tools for working with collections, but more profound than that, it proposed a paradigm shift when it came to reasoning about problems whose solutions involved any sort of iterative logic.

It was weird to write and think about at first, but eventually, I adopted a programming style where I seldom wanted to write “vanilla” foreach loops. Looping manually using accumulators, iterators, and other types of temporary values began to feel clunky, inefficient, and verbose....


functional-programming javascript

Endless OS: A Linux Distro for Kids

Mom & daughter working at a computer Photo by August de Richelieu

In 2020 some of us had to work from home while taking care of the kids ourselves, as most childcare services are temporarily closed due to the COVID-19 pandemic. In this post I won’t complain about the pandemic, but rather share my experience.

I have installed several different Linux distributions for my kids’ desktop computer in the past, but have found it quite difficult to find a balance between strict parental controls and no parental controls at all. Then I came across Endless OS, a Linux distro based on Debian, but with heavy customizations to focus on school from home.

Installation

The installation process was smooth and easy. The install image I chose was quite huge though, at around 16GB. But given we can just use a USB drive as the installation medium nowadays this should not be a big issue. The installer does not seem to give an option to encrypt my hard disk with LUKS during the installation phase.

Endless OS is powered by OSTree (which is defined as “a system for versioning updates of Linux-based operating systems”) and Flatpak. According to the website, “Endless OS uses OSTree, a non-destructive and atomic technique to deploy operating system updates. That means updates can be installed without affecting the running state of the system, making the process safe and robust from environmental factors such as a sudden power loss.”

The default window manager is a customized Gnome.

According to its website, the operating system is free for individuals and non-commercial use up to 500 computers.

Desktop

Package installation and package updates

We can choose from a couple of ways to install new packages (or update them). You can either use the Control Centre, or (if you want to install remotely) the command line. Although Endless OS is based on Debian, the apt command does not work here. Instead you can use Flatpak, with commands like flatpak install <package name>. Flatpak assists the user when installing a new package. For...


linux kids

Creating a Messaging App Using Spring for Apache Kafka, Part 4

Kursat aydemir

By KĂĽrĹźat Kutlu Aydemir
January 14, 2021

Spring-Kafka Photo by Daniel Tran on Unsplash

This article is part of a series. The GitHub repository with code examples can be found here.

After a long break from this series let’s keep moving further.

Let’s configure and prepare the WebSocket session pool. As we go through some custom operations like authentication and storing messages on the time of socket messages and sessions received, we need to create a WebSocketHandler for WebSocket configuration. When a WebSocket session message is received we’re going to send the message to a Kafka topic. In order to achieve this we need to define our WebSocket message handler MessageHandler and Kafka message producer MessageSender. We also need a session pool WebSocketPool so we can manage the client sessions.

WebSocketPool

package com.endpoint.SpringKafkaMessaging.websocket;

import org.springframework.web.socket.WebSocketSession;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class WebSocketPool {
  public static Map<Long, Set<WebSocketSession>> websockets = new HashMap<>();
}

WebSocketPool holds client sessions in a map of <user_id, <set of WebSocketSession>>. This map allows multiple sessions for one user, ensuring it will work from multiple client applications.

MessageHandler

package com.endpoint.SpringKafkaMessaging.websocket;

import org.springframework.web.socket.WebSocketSession;

import java.io.IOException;

public interface MessageHandler {
  public void addSessionToPool(Long userId, WebSocketSession session);
  public void sendMessageToUser(Long userId, String message) throws IOException;
  void removeFromSessionToPool(Long userId, WebSocketSession session);
}

MessageHandlerImpl

package com.endpoint.SpringKafkaMessaging.websocket;

import org.springframework.stereotype.Service;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;

import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

@Service
public...

java spring kafka spring-kafka-series
Page 1 of 193 • Next page

Popular Tags


Archive


Search our blog