Programming

rmathew,
@rmathew@mastodon.social avatar

While is fun, creating & maintaining for others isn’t:

“Woodworking As An Escape From The Absurdity Of Software”, Alin Panaitiu (https://alinpanaitiu.com/blog/woodworking-escape-from-software-absurdity/).

Via HN: https://news.ycombinator.com/item?id=40245601

aksharvarma,
@aksharvarma@mathstodon.xyz avatar

Evolution of how I think of while :

  1. When I first learned "loops":

while (condition is true) {do these things, adjust things so a slightly new condition is checked}

// That's where I first saw infinite loop and how there are intentional infinite loops.

  1. A small step to move condition update out of the loop body:

for (i=0; i< N; i++) {do these things}

// After the couple of days it took to get used to them, I found them neater and closer to how I think of things.

  1. Most of the time, the i from before is indexing into something, so let's directly deal with the item being indexed:

for item in collection:
do stuff

After the few days to rewire syntax muscle memory, going back would decidedly feel like a step back.

I don't want to give up automatic (and transparent) out-of-bound checks.

  1. There are actually only about 3/4 things one does inside a loop:

map/fold/scan/filter function-to-call collection-to-traverse-through

;; Getting rid of explicit indexing was just step one.
-- After a few days/months/years, I now realize that it is more important and less buggy if I think only of the function to call (and whether I want to end up with a new (maybe pruned) collection, a single thing, or "both" (that's how I think of scans))


Alternatively, my evolution as I learned new languages idioms:
-->
or -->
-->
or --> ???

aksharvarma,
@aksharvarma@mathstodon.xyz avatar

@BoydStephenSmithJr

I do know that maps/folds/etc. can be generalized to anything belonging to the functor class in ; so things like trees and other "container" type things beyond just lists. However, I didn't want to introduce special terminology in what was otherwise free of such jargon.

As for the rest of what you said, I don't know enough category theory to understand what you meant, although I can recognize them as being category theory terms.

Thanks for pointing out the connections. Hopefully, one day I'll get to a level of understanding where I can grok what you said.

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@aksharvarma I was just yes-and-ing your post with what I think is the next step.

There's definitely categorical jargon, but that's how you fit the idea into 500 characters.

Basically every "container" type is recursive: some trivially [e.g. (a,a)] and some in much more interesting ways. Each of the "layers" is a (categorical) functor, the container is just a fixed-point (recursive self-call) of that functor.

publicvoit,
@publicvoit@graz.social avatar

What happens, when you join two paths in a language when the second one is an absolute one?

join("foo", "/bar")
returns "foo/bar" or "/bar"?

The wonderful @meisterluk wrote a great article about that you might want to read: https://lukas-prokop.at/articles/2024-05-03-filepath-join-behavior

I can not tell what version I'd actually prefer. There are situations where both versions would be "proper".

#C++

soc,
@soc@chaos.social avatar

@publicvoit @meisterluk Neither of those choices is correct.

The right solution is using the type-system to prevent obviously wrong code from compiling:
✅ join(AbsolutePath, RelativePath)
✅ join(RelativePath, RelativePath)
❌ join(RelativePath, AbsolutePath)
❌ join(AbsolutePath, AbsolutePath)

Another benefit is that AbsolutePath is not restricted to the root of the filesystem, but could express things like "the user's cache directory", increasing portability of paths saved to config files.

publicvoit,
@publicvoit@graz.social avatar

@soc @meisterluk Well, that's not something the compiler is able to decide when the parameters are not known during compilation.

SergKoren,
@SergKoren@writing.exchange avatar

Anyone who has ever told you that spelling and punctuation don’t matter, has never programmed.

wordsmith,
@wordsmith@writing.exchange avatar

@SergKoren I see what you did there, and I return an exit code of zero.

stevensanderson,
@stevensanderson@mstdn.social avatar

working on the next release of TidyDensity

#R

michaelten,
@michaelten@mastodon.social avatar

@stevensanderson
Github link?
Thanks and limitless peace

stevensanderson,
@stevensanderson@mstdn.social avatar
firusvg,
@firusvg@mastodon.social avatar

"The hard part of is building and maintaining a useful mental model of a complex system. The easy part is writing code."

-- Jennifer Moore, "Losing the imitation game" #q

rladies_bergen,
@rladies_bergen@hachyderm.io avatar

It's May already! Let's do something fresh and learn about how to use containers with your projects!
RSVP here:
https://www.meetup.com/rladies-bergen/events/300711368/

Drmowinckels,
@Drmowinckels@fosstodon.org avatar

📝 New blog post 📝

'The IDEs I use'

🧏 People who code have a tendency to spend a lot of time in various IDEs (Integrated Development Environments). They can be as simple as a text editor or as complex as a full-blown development environment. In this post, I'll go through my two go-to IDE's, RStudio and VScode, and why I switch between them rather than sticking to a single one. ---

👀 Read more at https://drmowinckels.io/blog/2024/ide

#R

milesmcbain,
@milesmcbain@fosstodon.org avatar

@Drmowinckels I realised I had all but turned VSCode into vim anyway due to the extensions I am using. And (neo)vim is much more free in terms of how you can create your own tools and automations. For VSCode (and RStudio actually) you’re expected to write and publish a package that contains your extension. It slows things down somewhat. In Vim you just source some code and now things work differently.

I also have some frustration with VSCode’s design - you can’t avoid a mouse completely.

joelnitta,
@joelnitta@fosstodon.org avatar

@Drmowinckels Nice post! For me the other "killer app" of VS Code (besides git support) is running instances within docker containers (which could be on a server). Feels identical to working locally.

Personally I've switched 100% to VS Code for my own work. I only use RStudio for teaching. The combination of RStudio plugins in VS Code and my own shortcuts make it fine for package development in my experience.

wrstscrnnm6,
@wrstscrnnm6@mastodon.social avatar

I was getting an error "failed to allocate XXXXXX b"

I copy the number into wolfram alpha to see how much data that really is.

5.3 Zettabytes.

How the hell is this program trying to allocate the equivalent of ... all of the data sent over the internet in a year, five times over?

Somewhere between my terminal and the browser the string of numbers got doubled.

Never have I been so relieved to find out my program was only trying to allocate 53Gb of ram.

#programming #rustlang #debugging

wrstscrnnm6,
@wrstscrnnm6@mastodon.social avatar

The CPU intensive part of the job finishes in less than two minutes. It then takes 6-12 additional minutes back on the main thread to handle all the data that those other threads produced.

gvrooyen,
@gvrooyen@c.im avatar

@wrstscrnnm6 A pretty good demonstration of Amdahl's Law!

https://en.m.wikipedia.org/wiki/Amdahl's_law

davidbisset,
@davidbisset@phpc.social avatar

Happy Anniversary to BASIC.

Turns 60. 🎉

https://arstechnica.com/gadgets/2024/05/the-basic-programming-language-turns-60/

I believe my first language (if you don't count LOGO) was Apple Basic.

oalders,
@oalders@fosstodon.org avatar
smoku,
@smoku@vivaldi.net avatar
metacpan,
@metacpan@fosstodon.org avatar

What's New on CPAN, March 2024 edition.

https://www.perl.com/article/what-s-new-on-cpan-march-2024/

@perl @tag@relay.fedi.buzzl

adamcrussell,
@adamcrussell@mastodon.sdf.org avatar

@metacpan @perl I just saw the list of bioinformatiocs modules from @ChristosArgyrop

aral,
@aral@mastodon.ar.al avatar

JSDB 5.0.0 published 🎉

• Custom classes must have a constructor that accepts a parameter object as its only argument. Constructors are run during deserialisation.

• Custom classes can now safely extend other classes (e.g., EventEmitter).

• Properties that begin with an underscore (_) are treated as private and ignored.

• Objects with null prototypes are supported. i.e., objects created with Object.create(null, …).

Full details: https://codeberg.org/small-tech/jsdb#migrating-from-earlier-versions-of-jsdf

aral,
@aral@mastodon.ar.al avatar

JSDB 5.0.1 published 🎉

• Fixes #14: Crash if DataProxy getHandler() called on object with null prototype. (https://codeberg.org/small-tech/jsdb/issues/14)

To install update:

npm install @small/jsdb@5.0.1

Learn more about JSDB:

https://codeberg.org/small-tech/jsdb#javascript-database-jsdb

#JavaScriptDatabase #JavaScript #database JSDB #JSDB5 #NodeJS #SmallTech #SmallWeb #web #dev

aral,
@aral@mastodon.ar.al avatar

JSDB 5.1.0 published¹ 🎉

• Forgetting to pass a custom class that’s persisted in your database in your JSDB.open() call now throws instead of corrupting your database by falling back to using an untyped object.

• Added JSDF ver. 2 to 3 database migration script (i.e., JSDB version 2-4 to 5)²

To install update:

npm install @small/jsdb@5.1.0

¹ https://codeberg.org/small-tech/jsdb/releases

² https://codeberg.org/small-tech/jsdb#version-2-to-3

#JavaScriptDatabase #JavaScript #database JSDB #JSDB5 #NodeJS #SmallTech #SmallWeb #web #dev

jperkin,
@jperkin@federate.me.uk avatar

We're hiring!

https://www.mnxsolutions.com/careers/senior-backend-developer

Come and help us maintain and enhance a fully open-source operating system and cloud stack that has been battle-tested in very large production environments.

There are plenty of interesting problems to solve, all the way from writing device drivers and debugging early boot issues, to writing new UIs in Rust.

I think we're a pretty friendly team to work alongside too ;)

Happy to answer any questions.

#SmartOS #illumos #nodejs #rust #DTrace #pkgsrc

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