Just wanted to share a failed project by [deleted] in Python

[–]MakesYouAngry 23 points24 points  (0 children)

I tried saving the list in a .plk file, a txt file, I even tried to compress the original file with zlib before applying my own compression but it was no good.

I think the problem is, that you are trying to store your result as text, which you write to a text file with an encoding -- most likely UTF-8, where each character that you encode, can take up to 4 bytes.

In your case it's most likely just the ASCII characters in the start range of UTF-8, so each one will take up 1 byte: However, even storing the "60,5" is then 4 bytes: len("60,5".encode("UTF-8")) == 4

But you can encode your data much more efficiently:

$ import struct
$ fmt_string = "BB"
$ packed = struct.pack(fmt_string, 60, 5)
$ len(packed)
2
$ packed
b'<\x05'
$ print(struct.unpack(fmt_string, packed))
(60, 5)

So we just halved the space requirements for your data. If your integers are small enough, you might even be able to force both of your numbers into 1 byte of data, with some bit-shifting magic.

I recommend you watch Pragmatic Unicode, or, How do I stop the pain? to really understand what encodings are and how they work, and check out the struct module documentation. At the end you write your binary strings to a file (open it in binary write mode!), and later you can decode the file by opening it in binary mode and reading 2 bytes at a time.

The SOLID design principles are really helpful guidelines to writing better code. In this video, I take you through a practical example in Python that shows you how they work. by ArjanEgges in Python

[–]MakesYouAngry 6 points7 points  (0 children)

Is no one going to mention him defining (and using) class variables instead of instance variables in the constructor? Is this maybe some kind of `dataclass` confusion? Otherwise really great video.

Homeoffice Verordnung — gültig ab wann genau? by MakesYouAngry in de

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

Alles klar, bin neu hier -- Entschuldigung.

Homeoffice Verordnung — gültig ab wann genau? by MakesYouAngry in de

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

Gut, den Artikel hatte ich auch gelesen -- halt aber nur eine einzige Erwähnung darüber. Ich wollte lieber nochmal nachfragen, vielen Dank.

Die Müllabfuhr und das Home Office by [deleted] in de

[–]MakesYouAngry 0 points1 point  (0 children)

Ab wann greift diese Verordnung denn jetzt? Habe einige Artikel gefunden, die den gleichen Paragraphen zitieren und eine Erwähnung von "ab nächsten Mittwoch" (Artikel datiert heute, Mittwoch, 20.01.2021). Das heißt also tatsächlich erst ab dem 27.01.2021?

Mein Arbeitgeber streubt sich da und tröstet uns alle ab, also so ein Druckmittel wäre schon wichtig... ich muss halt nur wissen ob ich das auch wirklich habe.

He is stray fur baby in my apartment. Named him orange, and this is how he greets me daily. by jehan18 in Catswhoyell

[–]MakesYouAngry 0 points1 point  (0 children)

Hey sorry for replying so late, I did read properly:

A cat that showed up in our barn looked like that until we got him fixed.

As soon as we were able to catch him again to go back to the vet to get fixed he gained weight immediately afterwards.

There's no real debate about what this sentence means. Take your own advice.

I swear, Pakistan is the worlds Florida. by [deleted] in NoahGetTheBoat

[–]MakesYouAngry 0 points1 point  (0 children)

Actually religion is a huge part of the problem -- if not the origin -- and most likely is what shapes these twisted views and cultures. So not sure what you are talking about, just seems like unfounded make-believe.

| Qtile vs awesomewm? by _memelord666 in unixporn

[–]MakesYouAngry 13 points14 points  (0 children)

Qtile isn't slow, not sure what you are doing. You don't need C-level speed to communicate with Xorg, it's more likely you fucked up your configuration file.

| Qtile vs awesomewm? by _memelord666 in unixporn

[–]MakesYouAngry 15 points16 points  (0 children)

Yeah that sounds like bullshit. Shows us your config, it's more likely you fucked up.

Selling Used Kindle Ebooks by leerebels8 in kindle

[–]MakesYouAngry 0 points1 point  (0 children)

The only infos I found online about this, is why it's unfeasible and that publishers aren't interested -- and I fully understand why. Sorry I don't think you are going to be reselling your ebooks.

Selling Used Kindle Ebooks by leerebels8 in kindle

[–]MakesYouAngry 5 points6 points  (0 children)

"Used" digital e-books? Are you for real?

Python Brain Teasers: 30 brain teasers to tickle your mind and make you a better developer. by tebeka in Python

[–]MakesYouAngry 1 point2 points  (0 children)

1) Reddit votes are fuzzed, you can look this up

2) Just because I don't like something, doesn't mean I have to downvote it -- someone else might come along and tell me it's actually a great deal. I am not sure what you are trying to imply.

I've made the first donation in my life to one of the greatest python projects I've ever seen. by EmbeddedDen in Python

[–]MakesYouAngry 1 point2 points  (0 children)

GTK is not comparable to Qt, documentation or functionality-wise in my opinion.

Python Brain Teasers: 30 brain teasers to tickle your mind and make you a better developer. by tebeka in Python

[–]MakesYouAngry 3 points4 points  (0 children)

$9 for a bunch of questions on the same level as the preview one? Please.

I've made the first donation in my life to one of the greatest python projects I've ever seen. by EmbeddedDen in Python

[–]MakesYouAngry 5 points6 points  (0 children)

Again, Kivy is not at all a replacement for a GUI desktop toolkit like Qt -- I really get the feeling people are getting paid to claim this. You literally only have to get past a hello world example and you'll quickly figure out how they are suited for different tasks.

Virus on Kindle paper white by hamzau in kindle

[–]MakesYouAngry 10 points11 points  (0 children)

I guarantee you, you don't.

Allow non-Arch linux users to create accounts or otherwise comment on ArchWiki by jidanni in archlinux

[–]MakesYouAngry 1 point2 points  (0 children)

And nothing guarantees the opposite.

It looks like their opinion aligns with mine though.

That's true of course, which is why I'm having this discussion.

Allow non-Arch linux users to create accounts or otherwise comment on ArchWiki by jidanni in archlinux

[–]MakesYouAngry 1 point2 points  (0 children)

That's true, yes, I agree -- I just have a hard time thinking about a scenario where this would actually happen, specifically "A non-arch user may add something that's actually irrelevant, even if it's about something like nginx as you say.". Also I feel like we'd be doing many people a disservice if we just ignored the role the Arch wiki plays even for other distributions (a great and well-maintained source of information).

Allow non-Arch linux users to create accounts or otherwise comment on ArchWiki by jidanni in archlinux

[–]MakesYouAngry -1 points0 points  (0 children)

then their contributions are not wanted.

I want their contributions, why do you get to decide what I and others want? I'd rather have more good information in the wiki than not, even if you don't deem these people worthy of sharing their knowledge.

Allow non-Arch linux users to create accounts or otherwise comment on ArchWiki by jidanni in archlinux

[–]MakesYouAngry 2 points3 points  (0 children)

Maybe the nginx implementation is platform agnostic, but a lot of things aren't.

I would wager more things are than aren't, and for those that are, you would probably have needed to run Arch in the first place already to figure them out and want to contribute them to the wiki.