Programming

mononcqc,
@mononcqc@hachyderm.io avatar

Good blog post from the team on optimizations coming in Erlang/OTP 27: https://www.erlang.org/blog/optimizations/

henrikjernevad,
@henrikjernevad@mastodon.social avatar

Why should you unit test? What should you unit test? And how much?

Today's blog post answers these questions and provides some helpful guidelines.

The post is actually a lightly edited extract of a book on unit testing that I started about 10 years ago but never finished. Still, it has aged reasonably well.

https://henko.net/blog/why-write-unit-tests/

underlap,
@underlap@fosstodon.org avatar

@henrikjernevad I really enjoyed your post and thought it deserved a response. https://underlap.org/why-write-unit-tests

bluGill,
bluGill avatar

@henrikjernevad Every test you listed there is the type that should be deleted when you are done.

Which is to say you are missing something critical: to ensure when someone in the future makes a change they don't introduce bugs. Any test that will never alert you to a bug in your code by failing should not be kept. (that is about 80% of all tests, but I don't know how to figure out the difference)

hendrik,

I think some of the early designers of languages will burn in hell for making the index of the first element in a list/array/vector be 0....

yeti,
@yeti@emacs.ch avatar

@hendrik

For someone who had assembler as 1st language 0 as offset from the array base address to the array's first member makes the most sense.
I'm one of these fossils.

davidbisset,
@davidbisset@phpc.social avatar

Developers you cannot complain about debugging your code unless you work at NASA. New rule. https://mastodon.social/@jimray/112316533559894202

vascorsd,
@vascorsd@mastodon.social avatar

After hearing good things about scalatags, reading the readme I almost walked away when I saw the changelog with latest version being 0.7.0 adding support for scala 2.13. I was literally thinking it was dead and nobody worked on it for 3 for example... 😮‍💨

Well turns out that if you open github you see that it actually was tagged a version 0.13.1 and the changelog hidden in a file is getting updated.

But the official docs website doesn't have any recent updates! 😨

Always check the code!

alexelcu,
@alexelcu@social.alexn.org avatar

@vascorsd I like using Scaladex because finding the latest library versions can be challenging, as there's no standard (GitHub vs. homepage, README vs. tags vs. releases on GitHub).

vascorsd,
@vascorsd@mastodon.social avatar

@alexelcu true, very true. It's highly inconsistent where to find the latest release and also the changelog.

I'll have to keep in mind to check it, since it never crosses my mind.

joelanman,
@joelanman@hachyderm.io avatar

has anyone used Jest and Knex in Node? I've been banging my head against this issue for ages, and googling gets me nowhere. I just get Unable to acquire a connection every time.

My actual code works fine, it's just in Jest that it fails.

https://github.com/knex/knex/issues/6062

joelanman,
@joelanman@hachyderm.io avatar

sigh, I wasn't using dotenv correctly with Jest, you have to add it to the config like this:

setupFiles: ["dotenv/config"]  
AverageDog,
@AverageDog@mastodon.social avatar

This may very well be the most useless book I have ever written, and I don't even know why I did. I guess it is still better than getting drunk in a bar.
Anyway, it defines the #T3X programming language formally in terms of basic functions (zero, successor, identity, mu) and naive set theory. I have no idea why anybody would read such a book. Maybe you can give me some hints? :)
Or, in case you want to prove me wrong: http://t3x.org/t3x/0/formal.html
#programming, #semantics, #math, #futility

nil,
@nil@functional.cafe avatar

@AverageDog this was an immediate purchase!

nilesh,
@nilesh@fosstodon.org avatar

Have a strong urge to invent a new cloud-native, AI-native, dependent-typed language.

nilesh,
@nilesh@fosstodon.org avatar

@deshipu I don't want to live in a world where Python and Javascript are our default choices. 😃

deshipu,
@deshipu@fosstodon.org avatar

@nilesh Could have been worse, could be CGI in C++ and Java applets.

joelanman,
@joelanman@hachyderm.io avatar

I'm using Playwright to do end to end testing and very happy with it. How do I now add unit testing? Googling isnt giving very useful results. I'm imagining something like

npm test  

triggering Jest, then Playwright, but they both look for test.js files so that seems not correct?

Can/should Playwright be used for unit testing?

floehopper,
@floehopper@ruby.social avatar

@joelanman I'm using Playwright's testDir config option to limit the tests it runs to a specific directory: https://playwright.dev/docs/api/class-testconfig#test-config-test-dir.

And similarly using the Jest CLI to point at the unit test directory: https://jestjs.io/docs/cli#running-from-the-command-line.

I've wrapped them both up in scripts in package.json and called them from the test script.

joelanman,
@joelanman@hachyderm.io avatar

@floehopper perfect thanks!

bits,
@bits@mastodon.online avatar

My definition of an expert in any field is a person who knows enough about what’s really going on to be scared.

-- P. J. Plauger, Computer Language, March 1983

ดูหนัง! Exhuma (ขุดมันขึ้นมาจากหลุม 2024) ออนไลน์ฟรี HD พากย์ไทย [TV-THAI] พากย์ไท 1080p (www.feedspace.io) Indonesian

ดูหนัง! Exhuma (ขุดมันขึ้นมาจากหลุม 2024) ออนไลน์ฟรี HD พากย์ไทย [TV-THAI] พากย์ไท 1080p ดู>[หนัง] ขุดมันขึ้นมาจากหลุม | Exhuma (2024) พาก ไทย –...

davemark,
@davemark@mastodon.social avatar

DEVS:

  • BRAND NEW edition of "Programming: Principles and Practice Using C++"
  • This is the guy who created C++

https://www.informit.com/store/programming-principles-and-practice-using-c-plus-plus-9780138308681
#Programming #Development #C #CPlusPlus

davemark,
@davemark@mastodon.social avatar

@Drwave 😄

Fan of C++ or not, as a long time dev book writer, it warms my heart to see this book still have life.

Drwave,
@Drwave@mastodon.social avatar

@davemark Fair.

dentangle,
@dentangle@chaos.social avatar

What a frustrating little bug! 🐞 Fine on Linux, FreeBSD and OpenBSD - failing on NetBSD only.

I was convinced it was some weird memory ordering bug or perhaps something to do with NetBSD using gcc instead of clang. After digging through the asm and finding nothing I was tearing my beard out.

The actual problem? A usleep() in a test.

On the argument to usleep() must be less than 1,000,000µs. It was, in fact, exactly 1,000,000 == 1sec.

Argh!

#C

riastradh,
@riastradh@mastodon.sdf.org avatar

@dentangle Before it was removed from POSIX, the specification in 2004 explicitly forbid arguments >=1e6:

> The useconds argument shall be less than one million.

And listed EINVAL for this case:

> [EINVAL]
> The time interval specified one million or more microseconds.

https://pubs.opengroup.org/onlinepubs/009696899/functions/usleep.html

sqlite3 had this bug too: https://www.sqlite.org/src/info/1f5ed852f25515bb.

But maybe at this point it's not worth keeping that persnickety quirk in NetBSD. So I filed a PR to reconsider it: https://gnats.NetBSD.org/58184

jspath55,
@jspath55@chaos.social avatar

@riastradh @dentangle "nobody expects the Spanish usleepition"‐-nice one.

atoponce,
@atoponce@fosstodon.org avatar

Writing good code > your choice of IDE

#programming

vwbusguy,
@vwbusguy@mastodon.online avatar

@atoponce Having a clean git repo > your favorite IDE

https://github.com/teeyodmenihesepisansiateh Indonesian

https://testimonial.to/%E0%B8%94%E0%B8%B9%E0%B8%AB%E0%B8%99%E0%B8%B1%E0%B8%87%E0%B9%84%E0%B8%97%E0%B8%A2-%E0%B8%98%E0%B8%B5%E0%B9%88%E0%B8%AB%E0%B8%A2%E0%B8%94-2023-%E0%B8%94%E0%B8%B9-%E0%B8%AB%E0%B8%99%E0%B8%B1%E0%B8%87-teeyod-%E0%B9%80%E0%B8%95%E0%B9%87%E0%B8%A1%E0%B9%80%E0%B8%A3%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%87-uhd/all...

dentangle,
@dentangle@chaos.social avatar

Modern Stoneage Debugging

Debuggers are great and they have their place, but never underestimate the power of simply printing "Barney was here" when tracing code.

Barney often needs some help from Wilma and Betty and his mate Fred, but if you have to bring out Dino and Bam Bam it's probably gone wrong. Maybe you should put the Flintstones away and break out that debugger now. 😉

Important: don't forget to remove them before deploying into production.

🦖 + 🧑‍💻 => 😀

revk,
@revk@toot.me.uk avatar

@dentangle yes, don’t forget to remove them….

Xem Phim Mai Vietsub 2024 Full HD-4K - Bio Site (bio.site) Indonesian

Xem Phim Mai Vietsub 2024 Full HD-4K · Xem Phim Mai(2024) Vietsub Thuyết Minh Trọn Bộ. Phim Mai(2024) Vietsub HD. Maixoay quanh câu chuyện về anh chàng cảnh sát Mai(2024) là một nhân vật đến từ bộ phim hoạt hình Toy Story nổi tiếng. 【Xem phim】Mai「Full HD Vietsub」Bộ phim đầy đủ...

codebyjeff,
@codebyjeff@hachyderm.io avatar

If you're one of those programmers who leaves out any vertical whitespace between functions or blocks of code

wtf is it that motivates you?

kboyd,
@kboyd@phpc.social avatar

@codebyjeff they must save so many kilobytes per file in newline characters

syntaxseed,
@syntaxseed@phpc.social avatar

@codebyjeff And here I am sprinkling in extra blank lines like they're chapter breaks or something. 😆

I like lots of space for visual grouping.

SergKoren,
@SergKoren@writing.exchange avatar

I think I want to get back into BeOS/Haiku. Why? Why not? Maybe I’m feeling nostalgic.

https://www.haiku-os.org

#programming #os #beos #haiku

eugenialoli,
@eugenialoli@mastodon.social avatar

@SergKoren Love it too, but it's not ready. Many bugs with usb support, and it can't sleep.

SergKoren,
@SergKoren@writing.exchange avatar

@eugenialoli Minor problems. I don't want to use it as a daily OS, but more for programming/development.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programming
  • rosin
  • Backrooms
  • GTA5RPClips
  • magazineikmin
  • mdbf
  • Youngstown
  • slotface
  • tacticalgear
  • hgfsjryuu7
  • Durango
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • DreamBathrooms
  • provamag3
  • thenastyranch
  • cisconetworking
  • tester
  • cubers
  • modclub
  • khanakhh
  • everett
  • ethstaker
  • Leos
  • normalnudes
  • osvaldo12
  • anitta
  • JUstTest
  • All magazines