Programming Leftovers
-
R ggmap - How to Visualize Spatial Data in R - R programming
Spatial data is always tougher to visualize than it seems at first. Well, not anymore. R ggmap is an amazing package you can start using almost instantly, after some light configuration. It won’t take you more than a couple of minutes to configure everything and have your first map ready.
Today you’ll learn how to use the ggmap package to do almost everything geodata-related. We’ll kick things off by plotting basic maps, markers, and paths, and then dive into changing map themes. Once that’s under our belt, we’ll focus on advanced topics, including geocoding, reverse geocoding, drawing routes, and calculating distance between locations.
-
Decision Trees Explained — Entropy, Information Gain, Gini Index, CCP Pruning | by Shailey Dash | Nov, 2022 | Towards Data Science
Though Decision Trees look simple and intuitive, there is nothing very simple about how the algorithm goes about the process deciding on splits and how tree pruning occurs. In this post I take you through a simple example to understand the inner workings of Decision Trees.
-
A Footnote in History | Quantum Jitter
Producing a journal-quality table requires fine-grained and reproducible control over presentation. Surgical targeting of footnotes, capable of adapting to changes in the underlying data, is one example.
This post briefly explores the shifts in the nature of employment whilst at the same time visiting the grammar of tables gt: The natural companion to the grammar of graphics ggplot2.
-
Making a DNS query in Ruby from scratch
Hello! A while back I wrote a post about how to write a toy DNS resolver in Go.
In that post I left out “how to generate and parse DNS queries” because I thought it was boring, but a few people pointed out that they did not know how to parse and generate DNS queries and they were interested in how to do it.
This made me curious – how much work is it do the DNS parsing? It turns out we can do it in a pretty nice 120-line Ruby program, which is not that bad.
So here’s a quick post on how to generate DNS queries and parse DNS responses! We’re going to do it in Ruby because I’m giving a talk at a Ruby conference soon, and this blog post is partly prep for that talk :). I’ve tried to keep it readable for folks who don’t know Ruby though, I’ve only used pretty basic Ruby code.
-
How we use binary search to find compiler bugs
I work on Cinder, a just-in-time (JIT) compiler built on top of CPython. If you aren’t familiar with Cinder and want to learn more, a previous post about the inliner gives a decent overview of the JIT. This post will talk about how we use binary search to isolate miscompiled functions, a technique that is applicable to any compiler if you have the right infrastructure.
-
UGC: User-Generated Code
The concept of time-sharing has been around since the early days of UNIX. However, it wasn't until the advent of virtual machines that the security boundary between two different workloads was hardened enough to support two different customers on the same hardware. True cloud multi-tenancy changed the way we write programs. And it's still improving – lightweight isolation like containers and WebAssembly are becoming more secure.
-
A map of Haskell's numeric types
I keep getting lost in the maze of Haskell's numeric types. Here's the map I drew to help myself out. I think there might have been something like this in the original Haskell 1998 report but I like this one better.
-
The heavy responsibility of the package maintainer
In the world of BSD and Linux, a software developer is someone who develops software, it's someone who knows how to program in a programming language like C (or something else). A ports or package maintainer on the other hand, is not someone who develops software, it is someone who typically maintains a port or a package (I am going to use the term "package" henceforth in this article for both ports and packages).
-
My first impressions from a few weeks with Lean and Coq
For the last few weeks, some of us have been working through learning about interactive theorem proving together at Recurse Center. I've been curious about proof assistants since undergrad, and finally have the time, space, and peers to dive into it with. It's been an interesting experience getting started. Since we're just getting started, I can't tell you much about the long-term experience, but I can give some basic guidance on what it's like to get started on each and who I imagine the audience for each is.
First off, what's a proof assistant? Simply, it's a piece of software that helps develop formal proofs via human-machine collaboration. You want formal proofs in a lot of cases; they're used in math, but it would also be great to know that an algorithm you want to implement does what you say it does, or that a bigger piece of software is proven correct. Proving software correct does, of course, lead to the question of how you check that the spec is correct, and that you're specifying the properties you care about. That's a whole other conversation.
-
RC Week 6: Halfway done, wrote a parser!
I'm halfway done with my RC batch now. Time feels like it has sped up. The feeling that my time at RC is infinite is gone. This was compounded by seeing folks from the Fall 1 batch conclude their batches yesterday. We'll get a new boost from the Winter 1 batch joining on Monday, which I'm really pumped for! New people, new excitement, new energy!
I'm happy with how things have gone so far in the batch. I don't think I want to do anything dramatically different in the second half of the batch, except be a little bit more focused on one project instead of splitting between two.
I did have a less social week this week than most weeks, because I have some personal life stress right now (should wrap up next week) and it made it hard to focus, and I withdrew a little bit. Despite that, I still had a pretty social week! Something for me to take away here is that RC has shifted my understanding of where I get energy from and how much I do benefit from social things.
-
Software Moves • Buttondown
The piece You might as well timestamp it argues that instead of storing booleans in databases, you store the timestamp of when it became true. A missing timestamp means that value is false. This is generally more useful than a boolean, because in addition to boolean behavior you also get auditing information.
-
Java Getters and Setters
When we do the program, we tend to work with many user-defined and built-in methods. Java programming is also diverse when it comes to the use of functions. The special class methods known as getters and setters are employed in Java programming to read from and apply to an entity’s attributes. In Java, the setter function serves to set up or populate corresponding class fields while the getter function serves to read the value stored in the variable or retrieve the content. This procedure can be performed with inheritance as well. Most classes come with getter and setter methods by convention. Nevertheless, by specifically declaring the getter and setter functions, we may override the standards. In this regard, we are going to explain the usage of getter and setter functions in Java programming.
-
Java Array to List
Arrays and lists are the two most basic data structures in Java. The array provides the common names of the collection which has the same data type. It includes both primitive data types and objects of a class that is based on the array’s definition. On the other hand, the Java lists are the collection frameworks that organize the elements and store them in an object in a manner that maintains the insertion order. There come various scenarios where the Java arrays are required to be converted into Java lists. We can accomplish the conversion of the arrays to lists by using the methods provided by Java.
-
Java Logical OR
The logical operator in java is utilized to integrate two or more conditions as well as to enhance the examination of the initial condition. There are various logical operators in Java and one of them is the logical OR operator. The logical OR operator used the two vertical bar symbols “||” in the program. It is utilized between the operand which is to be evaluated. The result of the logical OR operator is true when the two or more specified operands have true values on the evaluation of the condition. It is frequently applied to Boolean (logical) values.
-
Mastering Backticks in Linux Bash Scripts
Bash scripts are best when it comes to simplifying the daily tasks. These scripts contain commands and tricks that you can use as a sysadmin. The backtick (`) operator is one of those features of Bash script that can ease up your work.
However, many beginners misunderstand the backticks as quotation mark characters used in the strings. That’s why learning about back quote characters or backticks is essential. In this guide, we will list down the approach on how to master the backticks in Linux Bash scripts.
-
Making a Bash Script Return with Different Return Codes on Exit
Exit codes are integer numbers that indicate that a script has been successfully executed. These codes are also known as return codes or exit statuses. Exit codes usually return zero upon successful execution and non-zero upon unsuccessful execution.
However, many Bash script users want to return with different return codes on exit, but they get errors. In this tutorial, we will explain the different approaches to make a Bash script return with different return codes on exit.
-
Mastering the Command Line
The command line might seem daunting for new (and old) developers, but another unlock for developer productivity — if you can master it. A crash course syllabus that will get you 80% there (Pareto principle).
The caveat is that “the command line” means a lot of things. To be more specific, these are UNIX-y, bash, and popular terminal emulator tricks. This is not a list of complex one-liners that you can alias and never remember what they do. It's a hopefully practical list of things you can learn and remember.