ericjmorey

joined 1 year ago
MODERATOR OF
[–] ericjmorey@programming.dev 6 points 2 weeks ago (1 children)
[–] ericjmorey@programming.dev 4 points 2 weeks ago

This is a great idea!

Motivation

The Python docs are ill-suited to novices.

The content of the built-in functions documentation favors precision and correctness over comprehension for beginners. While this style is great for experienced developers who already understand the finer points of Python’s design, the docs are confusing to novice programmers like a 12 year old who is not far on his journey of learning Python.

This guide is an opinionated and simplified description of Python’s built-in functions.

My goal is to provide definitions, in plain English, of each built-in function that comes with Python. Along with each definition is an example that is as simple as I can think of. I ran each example against the latest version of Python as of the time writing this guide.

I want to be able to share this with my 12 year old son or my 10 year old daughter, so that they can understand and use Python. My hope is that this guide also serves others who would like some plain definitions of what the built-in functions do.

A note for pedants: I am sacrificing precision and exactness in favor of comprehension. That means I will use substitionary language that I think will communicate more clearly than the exact terminology. If you’re looking for that level of precision, please refer to the standard library docs. Those docs are great for that level of clarity.

For the rest of us, let’s go!

[–] ericjmorey@programming.dev 3 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

That's a nice addition for those that want security over convenience. I wonder why it took them 11 years after this was written to add it.

[–] ericjmorey@programming.dev 2 points 2 weeks ago

It provides for control over certain functions, but it is underutilized.

[–] ericjmorey@programming.dev 4 points 2 weeks ago (3 children)
[–] ericjmorey@programming.dev 9 points 2 weeks ago (5 children)

I like the diversity of sphincter options in unicode and encourage their use. Here are a few of my favorites:



[–] ericjmorey@programming.dev 9 points 2 weeks ago* (last edited 2 weeks ago)

This is a web service that returns the ActivityPub data for any URL that returns an ActivityPub message. For instance this post (https://lemmy.ml/post/19589249) returns:

{
  "@context": [
    "https://join-lemmy.org/context.json",
    "https://www.w3.org/ns/activitystreams"
  ],
  "type": "Page",
  "id": "https://lemmy.ml/post/19589249",
  "attributedTo": "https://lemmy.ml/u/hongminhee",
  "to": [
    "https://lemmy.world/c/fediverse",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "name": "BrowserPub: A browser for debugging ActivityPub and the ⁂fediverse",
  "cc": [],
  "mediaType": "text/html",
  "attachment": [
    {
      "href": "https://podcastindex.social/@js/113011966366461060",
      "mediaType": "text/html; charset=utf-8",
      "type": "Link"
    }
  ],
  "sensitive": false,
  "published": "2024-08-26T11:43:09.033551Z",
  "language": {
    "identifier": "en",
    "name": "English"
  },
  "audience": "https://lemmy.world/c/fediverse",
  "tag": [
    {
      "href": "https://lemmy.ml/post/19589249",
      "name": "#fediverse",
      "type": "Hashtag"
    }
  ]
}

Prepend https://browser.pub/ to the URL you want to check: https://browser.pub/https://lemmy.ml/post/19589249

[–] ericjmorey@programming.dev 4 points 2 weeks ago* (last edited 2 weeks ago)

So this is a web service that returns the ActivityPub data for any URL that returns an ActivityPub message. For instance this post (https://lemmy.ml/post/19589301) returns:

{
  "@context": [
    "https://join-lemmy.org/context.json",
    "https://www.w3.org/ns/activitystreams"
  ],
  "type": "Page",
  "id": "https://lemmy.ml/post/19589301",
  "attributedTo": "https://lemmy.ml/u/hongminhee",
  "to": [
    "https://programming.dev/c/activitypub",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "name": "BrowserPub: A browser for debugging ActivityPub and the ⁂fediverse",
  "cc": [],
  "mediaType": "text/html",
  "attachment": [
    {
      "href": "https://podcastindex.social/@js/113011966366461060",
      "mediaType": "text/html; charset=utf-8",
      "type": "Link"
    }
  ],
  "sensitive": false,
  "published": "2024-08-26T11:44:00.478179Z",
  "language": {
    "identifier": "en",
    "name": "English"
  },
  "audience": "https://programming.dev/c/activitypub",
  "tag": [
    {
      "href": "https://lemmy.ml/post/19589301",
      "name": "#activitypub",
      "type": "Hashtag"
    }
  ]
}

https://browser.pub/https://lemmy.ml/post/19589301

[–] ericjmorey@programming.dev 7 points 2 weeks ago (3 children)

Some key quotes from the article:

It’s perfectly reasonable for a consumer cloud storage provider to design a system that emphasizes recoverability over security. Apple’s customers are far more likely to lose their password/iPhone than they are to be the subject of a National Security Letter or data breach (hopefully, anyway).

I wish that companies like Apple could just come right out and warn their users: ‘We have access to all your data, we do bulk-encrypt it, but it’s still available to us and to law enforcement whenever necessary’.

So what is the alternative?

Well, for a consumer-focused system, maybe there really isn’t one. Ultimately people back up their data because they’re afraid of losing their devices, which cuts against the idea of storing encryption keys inside of devices.

You could take the PGP approach and back up your decryption keys to some other location (your PC, for example, or a USB stick). But this hasn’t proven extremely popular with the general public, because it’s awkward — and sometimes insecure.

Alternatively, you could use a password to derive the encryption/decryption keys. This approach works fine if your users pick decent passwords (although they mostly won’t), and if they promise not to forget them. But of course, the convenience of Apple’s “iForgot” service indicates that Apple isn’t banking on users remembering their passwords. So that’s probably out too.

 

Karl Zylinski writes:

This article is an introduction to the Odin Programming Language. It is aimed at people who know a bit of programming, but have never touched Odin. It is not a reference guide, rather I try to keep things informal and talk about what I think are important aspects of the language. There will be some notes on differences to C/C++, as Odin in many ways tries to be better C. If you enjoy this article and want to support me, then you can do so by becoming a patron.

In the recent years most of my programming has been done using the Odin Programming Language, sometimes referred to as Odinlang. Since a year back I create my own video games using Odin. You can find my game CAT & ONION on Steam, it is completely created in Odin.

...

While Odin is a great language, it is currently quite lacking in documentation. There is lots of documentation, but it is scattered and incomplete. I tried to address that by writing this article, which I hope gives a holistic introduction to the language.

Read Introduction to the Odin Programming Language

 

July 18, 2024 Narek Galstyan writes:

We were naturally curious when we saw Pinecone's blog post comparing Postgres and Pinecone.

In their post on Postgres, Pinecone recognizes that Postgres is easy to start with as a vector database, since most developers are familiar with it. However, they argue that Postgres falls short in terms of quality. They describe issues with index size predictability, index creation resource intensity, metadata filtering performance, and cost.

This is a response to Pinecone's blog post, where we show that Postgres outperforms Pinecone in the same benchmarks with a few additional tweaks. We show that with just 20 lines of additional code, Postgres with the pgvector or lantern extension outperforms Pinecone by reaching 90% recall (compared to Pinecone's 60%) with under 200ms p95 latency.

Read Postgres vs. Pinecone

 

Jun 28, 2024

Matt Walker writes:

This is an extremely early stage of development, but basically at this point it is possible to:

  • Call any builtin Godot utility function or method (static, virtual, or otherwise) from OCaml easily, and with documentation comments for the original function intact an available through your favourite OCaml LSP implementation.
  • Use Godot (binary) operators in a natural way from OCaml. (Unary operators are currently broken, which I will be investigating!)
  • Construct Godot values from OCaml easily, and from OCaml analogues if they exist (e.g. I incur a dependency on Gg for low-dimensional vector math)
  • Marshalling in and out of all these functions to/from the OCaml analogues. That is, a method that is in Godot on an object of type ClassyClass taking an int parameter and returning an int will appear in Godotcaml as int64 -> ClassyClass.t structure ptr -> int64, where the ClassyClass.t structure ptr is the “pointer to the Godot object”, commonly called self. (Note that this is always the last argument, to facilitate pipeline-style programming when GDScript programmers have a method-chaining interface.)
  • Naturally define a new Godot class in OCaml that inherits from an existing Godot-registered class. (Currently NOT tested with classes defined in GDScript and/or externally.)
  • Most of the code-gen for custom engines that define new stock/builtin types and classes, etc.
  • Simulated inheritence for stock (and easily extendable to user-defined) classes using module inclusion: That is if Derived inherits from Base, then simply include Base in the module representing Derived, and you get access to all the methods from Base without explicit casting (or in the case of Rust’s gdext, object composition).
  • Naturally define a new Godot method in OCaml and have it called from GDScript or another Godot-bound language. (ergonomics still WIP).

Read Announcing Godotcaml for Godot 4.2

See also: Setting Up a Godotcaml Project (Today)

 

7/3/2024

Steven Wang writes:

Many in the data space are now aware of Iceberg and its powerful features that bring database-like functionality to files stored in the likes of S3 or GCS. But Iceberg is just one piece of the puzzle when it comes to transforming files in a data lake into a Lakehouse capable of analytical and ML workloads. Along with Iceberg, which is primarily a table format, a query engine is also required to run queries against the tables and schemas managed by Iceberg. In this post we explore some of the query engines available to those looking to build a data stack around Iceberg: Snowflake, Spark, Trino, and DuckDB.

...

DuckDB + Iceberg Example

We will be loading 12 months of NYC yellow cab trip data (April 2023 - April 2024) into Iceberg tables and demonstrating how DuckDB can query these tables.

Read Comparing Iceberg Query Engines

 

I think that the last time I've seen any "update" about the Virgo laptop project was over a year ago. Does anyone have more recent public information about Virgo?

 

cross-posted from: https://programming.dev/post/16349359

July 2, 2024

Sylvain Kerkour writes:

Rust adoption is stagnating not because it's missing some feature pushed by programming language theory enthusiasts, but because of a lack of focus on solving the practical problems that developers are facing every day.

... no company outside of AWS is making SDKs for Rust ... it has no official HTTP library.

As a result of Rust's lack of official packages, even its core infrastructure components need to import hundreds of third-party crates.

  • cargo imports over 400 crates.

  • crates.io has over 500 transitive dependencies.

...the offical libsignal (from the Signal messaging app) uses 500 third-party packages.

... what is really inside these packages. It has been found last month that among the 999 most popular packages on crates.io, the content of around 20% of these doesn't even match the content of their Git repository.

...how I would do it (there may be better ways):

A stdx (for std eXtended) under the rust-lang organization containing the most-needed packages. ... to make it secure: all packages in stdx can only import packages from std or stdx. No third-party imports. No supply-chain risks.

[stdx packages to include, among others]:

gzip, hex, http, json, net, rand

Read Rust has a HUGE supply chain security problem


Submitter's note:

I find the author's writing style immature, sensationalist, and tiresome, but they raise a number of what appear to be solid points, some of which are highlighted above.

 

July 2, 2024

Sylvain Kerkour writes:

Rust adoption is stagnating not because it's missing some feature pushed by programming language theory enthusiasts, but because of a lack of focus on solving the practical problems that developers are facing every day.

... no company outside of AWS is making SDKs for Rust ... it has no official HTTP library.

As a result of Rust's lack of official packages, even its core infrastructure components need to import hundreds of third-party crates.

  • cargo imports over 400 crates.

  • crates.io has over 500 transitive dependencies.

...the offical libsignal (from the Signal messaging app) uses 500 third-party packages.

... what is really inside these packages. It has been found last month that among the 999 most popular packages on crates.io, the content of around 20% of these doesn't even match the content of their Git repository.

...how I would do it (there may be better ways):

A stdx (for std eXtended) under the rust-lang organization containing the most-needed packages. ... to make it secure: all packages in stdx can only import packages from std or stdx. No third-party imports. No supply-chain risks.

[stdx packages to include, among others]:

gzip, hex, http, json, net, rand

Read Rust has a HUGE supply chain security problem


Submitter's note:

I find the author's writing style immature, sensationalist, and tiresome, but they raise a number of what appear to be solid points, some of which are highlighted above.

 

Jul 1, 2024

Aman Salykov writes:

This blog post is the result of my attempt to implement high-performance matrix multiplication on CPU while keeping the code simple, portable and scalable. The implementation follows the BLIS design, works for arbitrary matrix sizes, and, when fine-tuned for an AMD Ryzen 7700 (8 cores), outperforms NumPy (=OpenBLAS), achieving over 1 TFLOPS of peak performance across a wide range of matrix sizes.

By efficiently parallelizing the code with just 3 lines of OpenMP directives, it’s both scalable and easy to understand. The implementation hasn’t been tested on other CPUs, so I would appreciate feedback on its performance on your hardware. Although the code is portable and targets Intel Core and AMD Zen CPUs with FMA3 and AVX instructions (i.e., all modern Intel Core and AMD Zen CPUs), please don’t expect peak performance without fine-tuning the hyperparameters, such as the number of threads, kernel, and block sizes, unless you are running it on a Ryzen 7700(X). Additionally, on some Intel CPUs, the OpenBLAS implementation might be notably faster due to AVX-512 instructions, which were intentionally omitted here to support a broader range of processors. Throughout this tutorial, we’ll implement matrix multiplication from scratch, learning how to optimize and parallelize C code using matrix multiplication as an example.

Read Beating NumPy's matrix multiplication in 150 lines of C code

view more: ‹ prev next ›