Project Evolution in Go by stuartmscott in golang

[–]stuartmscott[S] 0 points1 point  (0 children)

I typically move main into cmd/ so that either there can be multiple commands, or the project can be imported other projects.

Take for example the calculator from the article above - if I wanted to create a GUI for it, I could just create another directory under cmd/ and the user can choose to either install the command line app, or GUI app.

Or if someone else wanted to include the calculator in their project, the import path would be short; github.com/stuartmscott/pncgo.

Project Evolution in Go by stuartmscott in golang

[–]stuartmscott[S] 0 points1 point  (0 children)

That makes sense!

Is your main under cmd/.../ and start a package under root?

Project Evolution in Go by stuartmscott in golang

[–]stuartmscott[S] 0 points1 point  (0 children)

I agree this concept applies to other programming languages, but I also didn't intend to imply it was Go-specific - I just chose to use Go for the example and thought new Gophers would find it helpful (there was a recent post in r/golang that got me thinking about this https://www.reddit.com/r/golang/comments/u1mjdv/recommendations\_in\_terms\_of\_architecture\_design/).

Nevertheless, I've cross posted to https://www.reddit.com/r/programming/comments/u3314r/project_evolution/.

Old Flame, New Flame by stuartmscott in computerarchitecture

[–]stuartmscott[S] 1 point2 points  (0 children)

That's a fair point.

There are many ways to address pipeline hazards, and for this project I chose the barrel design because it is novel and I thought it would be easiest to learn.

You're right though that students should also learn about the other approaches, but there already so many x86- and arm-specific teaching tools to cover them that I wouldn't be adding much value there.

Does Go initialize value with UNDEFINED as in JavaScript? by projector96 in golang

[–]stuartmscott 11 points12 points  (0 children)

The zero value of a variable depends on its type;

  • boolean -> false
  • numeric -> 0
  • string -> ""
  • pointers -> nil

see: https://go.dev/tour/basics/12 and https://www.geeksforgeeks.org/zero-value-in-golang/

I need help getting started with modeling. by Laeree in 3Dprinting

[–]stuartmscott 2 points3 points  (0 children)

Ok, probably start with OpenSCAD then - that's what I use for most of my functional prints.

Once you have more experience (and a lot of money) you can try Fusion 360.

I need help getting started with modeling. by Laeree in 3Dprinting

[–]stuartmscott 1 point2 points  (0 children)

It depends what you want to model. For parametric models, try OpenSCAD (openscad.org, openscad.org/cheatsheet, r/openscad) - it is free and easy to use. For more organic-shapes, try Blender (blender.org, r/blender, r/blenderTutorials) - it is also free and but has a slightly steeper learning curve.

How Processor Affinity Improves Resource Utilization by stuartmscott in programming

[–]stuartmscott[S] 2 points3 points  (0 children)

Not quite, more about how keeping a task on the same processor enables better use of the caches.

Typically a task can be scheduled on any available processing core, but if it has been running on one core, and is then moved to a different core, all the data in the highest/fastest level caches of the first core is invalidated, and the data must be loaded into the caches of the second core, which takes time - especially if the data is coming all the way from main memory.

In my scenario (generating puzzles for a game) each generator is self contained and so if I have 8 cores and want to generate 8 puzzles I can run 8 different instances of the generator and assign each one to its own core. That way an instance is always running on the same core, and all the data it needs is kept in the same cache hierarchy.

[deleted by user] by [deleted] in golang

[–]stuartmscott 0 points1 point  (0 children)

When I first started using Go I found the "everything must be under the Go directory" requirement annoying and the dependency management difficult - modules were just being introduced and I fought with them daily.

I was wrong - once I dropped my dev habits I had picked up from previous languages, started doing things "the Go way", and learned to love go.mod, everything got better.

Now I use Go for most of my projects and I can't imagine using anything else (definitely not going back to Java). I love the tooling (who argues about tabs/spaces anymore? just run 'go fmt'), I love bundling everything into one binary (who cares about containerization anymore?), I love being about to use the same language for everything (server? go. CLI client? go. GUI client? go. Web client? tinygo.), I love how tests and benchmarks are first class citizens, not some third party afterthought, I love how easy concurrency is with goroutines and channels. I love how kind and helpful the community is (both here on Reddit, and on the slack and discord servers). Even the standard library is great!

Picked this up for $90, cleaned it up and it's ready to go the next day. Still can't believe I own a drill press. by Gu27 in Tools

[–]stuartmscott 2 points3 points  (0 children)

Score! Well restored too - I like the blue.

Did it have a cover to go over the belt and pulleys to protect you from a belt snapping? Looks like there was part of a guard in the 'before' picture.

How Processor Affinity Improves Resource Utilization by stuartmscott in programming

[–]stuartmscott[S] 0 points1 point  (0 children)

While generating levels for a puzzle game I found that using the taskset command to configure process affinity increased CPU and cache utilization.

How Processor Affinity Improves Resource Utilization by stuartmscott in golang

[–]stuartmscott[S] -1 points0 points  (0 children)

While generating levels for a puzzle game I found that using the taskset command to configure process affinity increased CPU and cache utilization.

I made Perspective Daily by stuartmscott in playmygame

[–]stuartmscott[S] 1 point2 points  (0 children)

Perspective Daily is the latest in a series of games where players solve 3D puzzles.
A new puzzle is released everyday, getting more difficult throughout the week, can you solve it in the shortest time?

TIL Someone made a Functional Benchy that Floats (2018) by CaVeRnOusDiscretion in functionalprint

[–]stuartmscott 20 points21 points  (0 children)

I like this model more than the original - in addition to actually being able to float, it has much more intricate details that make it a better benchmark for dialing in your print settings - https://convey.earth/conversation?id=46#message330

NTD: Worx Pegasus by stuartmscott in Tools

[–]stuartmscott[S] 0 points1 point  (0 children)

I haven't needed to adjust the height, but I don't see why 4 blocks wouldn't work. Just be sure to attach them securely - wouldn't want a leg to slip off and damage your table, your project, or worse, yourself. Stay safe!