There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

astraeus , in Python tutorial moment
@astraeus@programming.dev avatar

Hey, if you understand Python it makes sense. If you’ve used the PIL before it makes even more sense. If you don’t understand Python, you should probably start by understanding Python.

dev_null ,

Of course it makes sense, the code does pretty much nothing. The point is that the tutorial does not teach you about how to remove a background. It’s like a “how to cook X” article that just tells you to “order X online” and that’s it.

aniki ,

Except the code removes the background in complete compliance with the statement “remove image background using python.”

It’s not “remove image background using photoshop.”

astraeus ,
@astraeus@programming.dev avatar

If you want to build a background removal tool from scratch that’s a project of its own. This shows you how to very simply remove a background with a pre-existing tool that other people have spent the many hours to get functional so you can do the five-minute tutorial.

It’s not the Arch Linux way, it’s more like the Ubuntu way.

lugal ,

Well, it does the job. No need to reinvent the wheel and for people who don’t know the packages, this is helpful

dev_null ,

Yeah, I’m explaining the meme, not agreeing with it.

lthlnkso ,

There are two kinds of “how-to”.

  1. How to do something - that’s what this is. Simple, straightforward, accomplishes its goal.
  2. How to understand something - explaining how and why this works and how you could generalize what this is doing to related projects.

However, even if you are interested in the second choice, this is still useful! Your next step is just to look into the libraries that the rembg package uses.

emergencyfood ,

The first rule of coding is that you don’t re-invent the wheel.

RamblingPanda ,

If nobody before you invented the wheel, you’ve probably not looked hard enough.

Test_Tickles ,

I did, and they were all square or triangles because “that’s good enough for most people”.

LordCrom , in Daylight saving creator left the chat....

Would be more appropriate if it was the datetime library creator.

Thorry84 , in Three monitors, and i feel insulted

Only 2 monitors? Them be rookie numbers, need to get them up

BurningTurtle ,
@BurningTurtle@programming.dev avatar

3 is good

DoomBot5 ,

At a previous job I had, we were only given options for 1080p monitors. I ended up with a total of 5 and needed all of them.

MagicShel ,

I think I started on a single 640x480 CRT. Professionally. My actual first computer was 320x200. Now I’m on dual UHD + laptop screen.

ouRKaoS ,

I remember in high school when I started running my monitor in 1024x768 and felt like I was a legit professional programmer.

ripcord ,
@ripcord@lemmy.world avatar

Professionally similar; 1024x768 here (might have had an 800x600 laptop or thereabouts).

But when people today complain about how how anything less than 4k x 60fps on some game is unplayable, I remember playing Doom in 320x200 on a 14" monitor, and still having to shrink the screen into an even tinier window, so I could get 10fps.

Steve ,

5 here

someguy3 , (edited ) in Daylight saving creator left the chat....

Ok so there are 24 time zones. Before that every town had their own time based on the sun. We basically went from infinity time zones down to 24. This is in fact simpler.

(There are some half hour time zones too, (India, Newfoundland) so at least 26.)

zaphod ,

There are a few time zones that are 45 minutes off, like Nepal Standard Time which is UTC+5:45, some places in Western Australia and South Australia use UTC+08:45 and the Chatham Islands are at UTC+12:45 or UTC+13:45 in summer.

WalrusDragonOnABike ,

DST means you also have things like CST vs CET and given some places start DST earlier or later than others and some ignore it all together, we probably have at least 50 time zones.

Always fun trying to schedule international regular meetings when suddenly there’s a week when half the people’s times changed and the other half’s times haven’t yet, so you try to figure out which time would exclude the fewest essential people.

Gork ,

Absolute madness. smh my head

perviouslyiner ,

there are 24 time zones

Cunningham’s law says that this will generate some discussion in the replies!

uis ,

No, there is entire continuum of time zones.

conditional_soup , in Daylight saving creator left the chat....

I identify as a time radical. We should switch the entire world onto GMT; +/- not a goddamn thing. Is it perfect? I think so, but all those people who might be confused will probably find it a lot less confusing than trying to make sense of the difference between timezones.

uis ,

GMT has leap seconds. TAI does not. Switch world to TAI.

perviouslyiner , in Daylight saving creator left the chat....
maniclucky ,
pewgar_seemsimandroid , in Computer components cheat sheet
uis , in Daylight saving creator left the chat....

Move to International Atomic Time timezone. clock_gettime(CLOCK_TAI, …) and stop complaining.

ALoafOfBread , in Computer components cheat sheet

Inkjet: uses yellow ink to dye paper.

But what if it’s just black text?

Inkjet: USES YELLOW INK TO DYE PAPER

LostXOR ,

Gotta put on those invisible tracking codes.

dan ,
@dan@upvote.au avatar

The EFF were tracking which printers print the invisible tracking dots, but they gave up because practically all colour inkjet and laser printers do it now. eff.org/…/list-printers-which-do-or-do-not-displa…

AgentGrimstone , in Daylight saving creator left the chat....

I’m not a developer but give him one for me too

CosmicCleric , in Daylight saving creator left the chat....
@CosmicCleric@lemmy.world avatar

If only I had a numeric type that could hold the value of how many seconds since the creation of the Universe, without overflowing, I’d be set.

prole , in Computer components cheat sheet

I thought this was a D&D alignment chart at first… And yes, Inkjet printers are chaotic evil.

nxdefiant ,

I would say it’s pretty accurate across the grid, but I’d swap HDD and ram. HDD is chaotic neutral, because it can turn into a maraca at any moment.

ripcord ,
@ripcord@lemmy.world avatar

It’s more unreliable than SSD?

nxdefiant ,

absolutely.

nick OP ,

I think they’re lawful evil, more devils than demons.

stebo02 ,
@stebo02@lemmy.dbzer0.com avatar

yes because unfortunately selling printer ink at higher prices than human blood is somehow completely legal

Scoopta , in True Story
@Scoopta@programming.dev avatar

I really wish more projects would use .hpp to differentiate from C headers. It’s really annoying to have a single header extension blend across two incompatible languages.

Kethal ,

I did this in a project and someone later came and changed them all to .h, because that was “the convention” and because “any C is valid C++”. Obviously neither of those things is true and I am constantly befuddled by people’s use of the word convention to mean “something some people do”. It didn’t seem worth the argument though.

Scoopta ,
@Scoopta@programming.dev avatar

…so that leads to another annoyance of mine. The insistence that there aren’t two languages but indeed one named C/C++. Obviously I’m being a bit sarcastic but people blur the lines HEAVILY and it drives me crazy. Most of the C code I’ve written is not compatible with C++…at least not without a lot of type casting at a bare minimum. Or a compiler flag to disable that. Never mind the other differences. And then there’s the restrict keyword, and the ABI problems if the C library you’re using doesn’t extern C in the headers…etc etc… -_-

Kethal ,

Yeah, I use that all the time. I think I use it in a different way though. I have projects with C, C++ and other languages. The C and C++ get compiled and linked together, and so there are some considerations for those files that don’t apply to anything else. So I mean C files and C++ files, but not as if they were the same language.

Scoopta ,
@Scoopta@programming.dev avatar

Yeah that’s completely fair and makes sense to me. I just know I’ve come across stuff where people are talking about it like they’re the same language. This seems to be especially prevalent in windows development where the C support is pretty poor in comparison and tends to kinda be lumped into into C++.

paperplane ,

Projects for Apple platforms usually also use .h, where it could mean anything from C/C++ to Objective-C/C++.

In practice, Clang handles mixed C/C++/Obj-C codebases pretty well and determining the language for a header never really felt like an issue since the API would usually already imply it (declaring a C++ class and/or Obj-C class would require the corresponding language to consume it).

If a C++ header is intended to be consumed from C, adding the usual #ifdef __cplusplus extern “C” {… should alleviate the name mangling issues.

Scoopta ,
@Scoopta@programming.dev avatar

Yeah, I was ignoring apple platforms because Objective-C doesn’t even have its own header extension as an option. Also not all C headers do extern stuff…and it doesn’t fix 100% of compatibility problems when you do that anyway. Also I’m not really talking about it from a compiler perspective, I’m talking about it from an organization and human perspective. I know compilers generally don’t care…which is exactly how we ended up in this predicament.

MinekPo1 ,
@MinekPo1@lemmygrad.ml avatar

reminder that .H can be used as a c++ header extension , along with .C for source files

Scoopta ,
@Scoopta@programming.dev avatar

Yep which IMO is ugly but I’d way prefer that over everyone using .h

MinekPo1 ,
@MinekPo1@lemmygrad.ml avatar

honestly I use .hh/.cc which is quite nice IMO . you can also use .hpp/.cpp but I don’t like it personally

Scoopta ,
@Scoopta@programming.dev avatar

Yeah. My original comment should have been “I wish people would use a C++ specific extension for headers.” I just picked hpp because cpp seems to be the most widely used C++ extension.

SpaceNoodle ,

C++ is a superset of C.

JoYo ,
@JoYo@lemmy.ml avatar

hpp is a superset of h

Scoopta , (edited )
@Scoopta@programming.dev avatar

It’s actually not. Objective-C is a superset of C. C++ is not. It’s MOSTLY compatible…but it’s not a superset. See the restrict keyword, or the need for casting to and from void*, or the inability to name variables new or delete, or class, or this. I can’t count how many C projects I have which use this as a variable name that WILL NOT compile as C++…or the need for extern C to call C ABI code…in no way is it a superset

EDIT: lol, you can downvote me if you want but I think you need to lookup what a superset is

SpaceNoodle , in As someone not in tech, I have no idea how to refer to my tech friends' jobs

“Software Development Engineer”

deegeese , in Floating point Maths

Also 1-1 ≠ 0

Turun ,

Are you sure? I’ve never seen that inequality before.

Edit: and at least python agrees with me


<span style="color:#323232;">print(0.1 + 0.2)  # 0.300...0004
</span><span style="color:#323232;">print(1.0-1.0)  # 0.0
</span>
h3ndrik ,

I think it’s equal zero in this case. I’d have to look up the IEEE specification to make sure. AFAIK it’s just not guaranteed for any numbers and depends on the floating point implementation. A general rule of thumb for programmers is not to use ‘equal’ with floating point numbers.

Turun ,

The example is wrong, because they used 1.0.

But in general x-x does not have to equal 0, that is true. I’m pretty sure Nan and infinity would yield not 0.0, but Nan instead.

And if you reach x with two different calculations, e.g. x1 = a - b - c and x2 = a - c - b it is certainly not guaranteed that x1 - x2 == 0.0

mokus ,

This is correct. Additionally, if x is NaN, then x ≠ x.

FizzyOrange ,

It does. x-x == 0 is true unless x is NaN or infinity.

SpaceNoodle ,

Positive or negative zero?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines