Programming Leftovers
-
The Image Model | Structure and Interpretation of Computer Programmers
I was reflecting on things that I know now, a couple of decades in to my career, that I wish I had been told at the beginning. Many things came to mind, but the most immediate from a technological perspective was Smalltalk’s image model.
It’s not even the technology of the Smalltalk image that’s relevant, but the model of thinking that works well with it. In Smalltalk, there are two (three) important files for a given machine: the VM is the machine that can run Smalltalk; the image is a snapshot of all of the Smalltalk objects on the machine(; and the sources are the source code for the classes and methods in that image).
-
Is Data Science a Dying Profession? | R-bloggers
Data science is described as a “dying field” that will soon be supplanted by positions like data engineering and ML operations in some articles, while it is described as being replaced by tools like AutoML in others.
-
Bootstrapping An {ojs} Quarto Document With An Observable Notebook | R-bloggers
Quarto is amazing! And, it’s eating the world! OK. Perhaps not the entire world. But it’s still amazing!
-
Quick Sort Time Complexity
Quick Sort, also written as quicksort, is a divide-and-conquer sorting algorithm. When coded, the quicksort program would consist of a swap() function, a pivot() function, a partition() function, and the quicksort function itself. Both the pivot() and partition() functions call the swap() function. The quicksort() function itself is short and calls the pivot() and partition() functions. It recursively calls itself in two places within its body. Now, there are different ways of writing the pivot() and partition() functions. The choice of the type of pivot() function and/or partition() function determines the efficiency of the whole program. Efficiency is like the number of main operations that are carried out by the program.
Time complexity is the relative runtime of a program. This can be seen as the main operation of the program.
Sorting can be ascending or descending. In this article, sorting is ascending.
The aim of this article is to produce the time complexity for a quicksort program. Since quicksort can be written in different ways depending on the choice of the pivot() and/or the partition() functions, each quick-sort type has its own time complexity. However, there is a range of a number of operations into which the different types of quicksort programs fit. This article presents just one of the different types of quicksort programs. Any code segment presented is of the C language.
-
Intercept Flutter traffic on iOS and Android (HTTP/HTTPS/Dio Pinning) – NVISO Labs
Some time ago I wrote some articles on how to Man-In-The-Middle Flutter on iOS, Android (ARM) and Android (ARM64). Those posts were quite popular and I often went back to copy those scripts myself.
Last week, however, we received a Flutter application where the script wouldn’t work anymore. As we had the source code, it was easy to figure out that the application was using the dio package to perform SSL Pinning.
While it would be possible to remove the pinning logic and recompile the app, it’s much nicer if we can just disable it at runtime, so that we don’t have to recompile ourselves. The result of this post is a Frida script that works both on Android and iOS, and disables the full TLS verification including the pinning logic.
-
Re-implementing JavaScript's == in JavaScript
JavaScript’s “double equals” operator, ==, is typically discouraged. And for good reason: its behavior is tricky. Where === asks “are these the same thing?”, the double-equals operator asks a question that’s not straightforward.
More specifically, == implements something called the Abstract Equality Comparison Algorithm, a 13-step process for determining if two things are equivalent.
Let’s try to implement this algorithm in pure JavaScript. (Without using the == operator, of course.) This is mostly a useless idea, but I wanted to try it!
-
Use Node built-ins to test small projects
In short: small Node projects don’t need a testing framework like Jest or Mocha. You can just use Node’s built-in assert module and a test script.
I maintain a few npm packages. Some of them are very small—often just a single short function. For example, I maintain percentage, a tiny package that formats numbers like 0.12 as 12%.
-
Some resources for looking at the current development version of Go
Go is under more or less continuous development (although the pace and nature of changes is different near releases). The Go website, Go playgroup, and other resources are what you want if you're interested in the latest released version of Go, as most people are, but there are also some resources if you want to look at the latest development version, what is generally called the tip.
The official source code is at go.googlesource.com. Typically you'll want to look at the tree view of the main branch. There's also the Github mirror of Go, which is where the issues are and which may be more convenient to navigate. Getting your own local copy is straightforward, as is building Go from source.
Tip.golang.org is more or less what it sounds like. Generally I'll want the Go documentation, especially the Go language specification. Tip.golang.org has a link for the latest standard library documentation, which goes to pkg.go.dev/std@master. You can also directly look at the specification from your local source tree, in doc/go_spec.html, but it probably won't have formatting that's as nice. At the moment, godoc can be used to run a local web server to view the standard library documentation for a Go source tree (or perhaps only the source tree that it was built from, in which case you'll want to build the latest Go development version yourself).
-
Re: “The web is a harsh manager” - Jim Nielsen’s Blog
In fact, I bet you could make a persuasive powerpoint for a C-level audience which hinges on the fiscal argument for design engineers, e.g. “You believe in design, and you’re paying for it, but you are not getting your money’s worth because of the gap between engineering and design.” I know I’ve seen it.
It’s like a restaurant that believes in sourcing sushi-grade fish, which they pay people to source and purchase, but turns out their cook is just deep frying it and nobody is noticing. Shame.
-
Separating I/O and logic
Earlier this week I watched Alex Chan's Sans I/O programming talk. In the talk, Alex argues the importance of separating I/O and program logic, with reference to a situation where his team was unable to use already-available parsing libraries for BagIt data because said libraries depended on local access to a file.
-
Using mutants to improve Slither | Trail of Bits Blog
The most common approach to finding ways to improve a static analysis tool is to find bugs in code that the tool should have been able to find, then determine the improvements that the tool needs to find such bugs.
This is where program mutants come into play. A mutation testing tool, such as universalmutator, takes a program as input and outputs a (possibly huge) set of slight variants of the program. These variants are called mutants. Most of them, assuming the original program was (mostly) correct, will add a bug to the program.
Mutants were originally designed to help determine whether the tests for a program were effective (see my post on mutation testing on my personal blog). Every mutant that a test suite is unable to detect suggests a possible defect in the test suite. It’s not hard to extend this idea specifically to static analysis tools.
-
Solene'% : How to hack on Nix and try your changes
Not obvious development process is hard to document. I wanted to make changes to the nix program, but I didn't know how to try them.
Fortunately, a coworker explained to me the process, and here it is!
-
From Novice to Industry Professionals, the East Bay R Enthusiasts Welcomes Everyone
R Consortium recently talked to Allan Miller with the East Bay R Language Enthusiasts Group about the group’s history and success in environmental and health industries.
-
I have complicated feelings about TDD • Buttondown
That thread (it’s a good one) argues that the problem was an organization failure by TDD proponents, pushing too hard and letting memetic decay transmute “TDD” into “tests r gud”. I have a different explanation: TDD isn’t as valuable as its strongest proponents believe. Most of them are basing TDD’s value on their experience, so I’ll base it on mine.
Let’s start with my background: I’d consider myself a “TDD person”. I learned it in 2012, it helped me get my first software job, and my first two jobs were places that did strict TDD in Ruby. For a while all my personal projects followed strict TDD, and if I ever went crazy and did a tech startup, I’d use TDD to write the software. I defended it back in 2018 and would defend it now.
-
outline is your friend
If you open a plain HTML document with no CSS and you focus an interactive element like a button, link, or textarea, you’ll see that by default browsers use the outline property to highlight these elements.
-
Tradeoffs in API Design
There are a few choices when designing an API layer: REST or RPC, binary or plaintext, TCP or HTTP, schema or schemaless? A few of the tradeoffs and an overview of some of the tools.
-
Scala SortBy
Ordering or organizing the components in a sequential or alphabetical sequence is the process of sorting. A unique sorting function for both mutable and immutable Scala collections is developed and is referred to as Scala Sort. One or more attributes of a Scala collection can be sorted using the SortyBy function. It uses a function that is specified on the user side to sort the components of a collection. The SeqLike trait includes it. To sort the collection according to our needs, we can utilize a variety of data structures and the SortBy function. We will study the Scala SortBy on this topic.
-
Scala Streams
Scala is to facilitate lazy operations. Since all calculations on these collections are deferred, they are not strictly defined. We will explore the Scala streams which are the unique types of lists in this article on streams in Scala. The Scala collection which stores the data also includes the Scala Stream. The only one difference that separates this from a list in Scala is when it is necessary for the Scala when the stream values are calculated. Because they don’t load the data all at once, Scala Streams are lazy lists that only evaluate the values as needed. This improves the program performance.
-
Scala for Comprehension
To iterate across the collections in programming languages, we utilize the loops like the for-loop and while-loop. A unique type of loop called a for-comprehension is introduced by the Scala programming language. The construct, like many others in Scala, is a direct descendant of Haskell. It may be used for much more than just looping through collections. When utilizing a functional way of programming, it helps us deal with the syntax’s complexity.
-
Pandas Count Rows with Condition
-
Pandas Covariance
-
Pandas Change Index
-
Pandas Cross Join
-
Pandas Combine DataFrames
-
Pandas Columns
-
PandasCrosstab() Function
-
Pandas DataFrame from CSV