varsock

joined 2 years ago
MODERATOR OF
[–] varsock@programming.dev 44 points 1 year ago

Recently I used Google maps to search for the nearest DHL near me so I could return a package. DHL is not that popular near me and when I specifically typed for DHL, I would get only their competitors in the search results.

There was a DHL service center near me and I had to scroll a bunch to find it. Oh, and apparently big box stores (or anyone) can pay Google to come up in the search on maps, even if unrelated.

I don't think they have skin the in shipping game but their algorithms are over optimized that they don't even show what your searching for, but trying to infer why you're searching for it. That or whoever pays them more. Certainly a search risk

[–] varsock@programming.dev 1 points 2 years ago

Had a distinguished collegue (from the Bell Lab days) say to me recently:

"IDEs take up a lot of RAM on my machine. Vim takes up a lot of squishy RAM in my head. I need squishy RAM to hold info relevant to problem solving, not options available in my tool chain."

 

Unit tests are meant to verify the functionality of isolated units of code. When dealing with code whose output depends on the system or system configuration, what are approaches to write effective unit tests? I feel this problem plagues lower level systems languages more so I am asking it here.

I solve this by writing "unit tests" that I then manually compare to the output of my terminal's utilities. It is the quickest way to verify units work as expected but it is obviously not automated.

Making a container or a VM to run integration tests seems like the next easiest way, not sure if there are other cost effective ways.

Scenario

Say I have a function called

get_ip_by_ifname(const char *if_name, struct in_addr *ipaddr)

Inputs:

  • string of interface name
  • pointer to variable where the returned IP address will be

Returns:

  • -1 if interface does not exist,
  • 0 if interface exists but has no IPv4 IP
  • 1+ if interface exists and has at least 1 ip addr (some interfaces have multiple addresses, only 1st is written to ipaddr buffer)
Test Cases and their dependencies
  1. Interface doesn't exist
    • easy to test, use uncommon interface name
  2. Interface exists has no ipv4 ip address
    • requires the underlying system to have a unique interface name which I need to hard code and compare to in my unit test
  3. interface exists, has 1 ipv4 ip address
    • requires underlying system to have the uniquely named interface with exactly 1 uniquely defined ip address. Both of which I need to hard code into my test
  4. interface exists, has 1+ ipv4 ip addresses
    • similar to item 3.

The way I might test something like this works is write a test that logs each case's output to the terminal than run ip -c a in another terminal and compare the info in the 2 outputs. I verify it works as expected manually with very minimal setup (just assigned multiple IP addresses to one of my interfaces).

I would like to test this in an automated fashion. Is there any way that wont be a time sink?

 

Wanted to share a resource I stumbled on that I can't wait to try and integrate into my projects.

A GPT4All model is a 3GB - 8GB file that you can download and plug into the GPT4All open-source ecosystem software. Nomic AI supports and maintains this software ecosystem to enforce quality and security alongside spearheading the effort to allow any person or enterprise to easily train and deploy their own on-edge large language models.

 

If you didn't get a choice to work remote, how come?

 

https://radar.cloudflare.com/domains

Source of this is from Matthew Prince, Co-founder & CEO of Cloudflare posted at 11:34 Jul 9,2023. It was posted to his twitter (@eastdakota). Not linking to twitter bc don't want a deadlink next time twitter makes API changes. And not to drive traffic to twitter :D

Edit: July 11th update, arstechnica published a detailed explanation

https://arstechnica.com/tech-policy/2023/07/twitter-is-tanking-amid-threads-surging-popularity-analysts-say/

 

With all the strengths and shortcomings of Chat-GPT, I wanted to share one consistent strength I found it has when working with regex.

  • You can ask it to generate regex patterns for known and custom things.
    • If you are skeptical it is correct (like me), you can ask it to break down the pattern and inspect why the decisions were made. If I don't understand some fields, I type up a quick test and make sure it covers all edge cases.
  • And my personal favorite, you can paste a regex and ask it to tell you what it matches to. No more writing regex and forgetting what they are for!

I don't always have the opportunity to use regex when I work and would shy away from it because it can become illegible, but now that it is so easy I find I am slapping it everywhere and I cutting down on logic when sanitizing inputs/data. The bonus is now that I'm using it more, I am becoming less reliant on having it be generated for me.

 

I'm still getting the hang of Lemmy and federated services.

I'm browsing the programming.dev instandce in the Liftoff app and I can choose to view:

  1. my subscribed communities on the server (currently none)
  2. Local communities on the server
  3. All (?)

I know All is not "all communities on Lemmy" but what perplexes me is I can see posts from another community that is hosted on a different server and it appears because it is "via programming.dev".

At first I thought it was because a user registered on " programming.dev " posted on another instance but I opened my eyes and saw the user's origin is no way related.

Any ideas?

EDIT:

After reading all the comments I’m pretty sure “via programming.dev” should read in the context of the post as !community@instance is known via programming.dev instance. I guess it makes it explicit which “all” I am browsing if I pick up browsing where I left off and forget I am not in the “all local”.

At this point I have only seen this on the Liftoff App for Lemmy but still trying other. Must be in the metadata and Liftoff decided to display it.