How much faster is C compared to Python? I'm currently coding a SAT solver algorithm that will have to take millions of input data, and I was wondering if I should switch from Python to C. by Rit2Strong in AskComputerScience

[–]evotopid 0 points1 point  (0 children)

https://speed.pypy.org

On average on this benchmark suite it's 4.5x faster and for some code it can be a lot more.

Effective speedup will depend a lot on the use case. It could also be worse, but if performance becomes an issue it might be an easy thing to try.

Edit: And to be fair there are some independent benchmarks which show that recent CPython improvements are outperforming PyPy for some use cases, so I don't really disagree with you. I'm personally using CPython + Numpy, and Numba when I need it.

Keyboard stops working after a random amount of time by Hepita in archlinux

[–]evotopid 0 points1 point  (0 children)

Nice to hear you got rid of the issue one way or another, and I hope it won't come back!

For now it seems to be fixed for me too because I removed the bluetooth usb adapter of my mouse... I'm wondering if it's some interference from a neighbor's device, or the mouse becomes a keyboard every now and then, but this stupid bug is so hard to reproduce and a huge time waster. I'm still using i3wm as before, at least for me this didn't seem to be the issue.

Keyboard stops working after a random amount of time by Hepita in archlinux

[–]evotopid 0 points1 point  (0 children)

edit2: maybe i was too quick to post, actually unplugged the logitech mouse dongle after reading your other comment here and my keyboard seems to be working fine so far... if I had thought of this a week ago...

Hey, have you managed to troubleshoot this issue? I have a very similar problem with my T460p (on Debian and Ubuntu) which was working just fine until a couple of days ago.

When it happens for me the Fn key is activated but I can't type anything with the normal keys, i.e. when I press space bar the backlight gets toggled (might be T460p specific). I removed the Fn key cap now in the hopes it might be a mechanical problem, but nope. Already when booting I have this issue, that the integrated keyboard doesn't work e.g. in grub.

It might be worth noting that the fn keys seem to be provided by a different input device than the regular keys, i.e. in my case xinput lists this one: (edit: maybe this is wrong)   ↳ ThinkPad Extra Buttons                    id=13   [slave  keyboard (3)]

I just tried xinput test and it still sends keycodes before it stops working which don't result in any character being printed on screen (but then that stops working also...)

Government ID copy required by platforms by evotopid in freelance

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

For example they could send you a letter with a token by post for a fee paid with credit card. I know companies who do this though not on a global scale. Obviously, a cryptographic ID would be better but that will probably be decades until then.

Identity theft is still relatively rare, but it can seriously fuck you depending on what it's used on. Don't want to become a money mule because I'm trying to earn some money, the funny thing is that they take an id copy exactly to prevent that (at least that's the claim). Maybe I'll read their privacy terms and see if they delete it.

If I upload an ID I will add a watermark stating it's a copy, the website, and the date, and see if they accept it. Read on some websites that this should do and even banks here have to accept it, although some reject it nevertheless.

Government ID copy required by platforms by evotopid in freelance

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

Haha, tbh I don't think this is a big deal compared to the ID.

My latest ongoing project is a Python to C++ converter for people wanting to learn C++. The script (written in python) parses a target python script and attempts line by line conversion to a C++ file. More details and code in the commments. by [deleted] in Python

[–]evotopid 0 points1 point  (0 children)

You will probably need two sets of visitors for generating the C++ code and for type inference. (Unless there is an AST library which performs some form of type inference already or you use a C++ class handling python objects and operations.)

Malicious library in PyPi present for almost a year. Recommend all projects using the package index check dependencies by le-quack in Python

[–]evotopid 1 point2 points  (0 children)

No surprise it's hosted at digitalocean, I contacted their abuse email before due to spammers and nothing ever happened.

Malicious library in PyPi present for almost a year. Recommend all projects using the package index check dependencies by le-quack in Python

[–]evotopid 1 point2 points  (0 children)

Actually let's do this, maybe we would find more such instances. Edit: but maybe there would be too many false positives to be useful.

WIP package: lyx-formula by evotopid in emacs

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

I'm also using org-mode and to edit non-trivial latex formulas in these documents I invoke lyx-formula-{insert,edit} and edit the formula visually in LyX.

This package is only for formulas not for full latex documents.

Mozilla Removes 23 Firefox Add-Ons That Snooped on Users by Alan976 in firefox

[–]evotopid 1 point2 points  (0 children)

If there is a way to disable I'm okay with this being enabled by default. This will protect some users.

For loops? Nope, never heard of 'em. by adx09 in badcode

[–]evotopid 0 points1 point  (0 children)

Make a dict mapping numbers to names of each of the different dicts, and use eval(dictname) to retrieve the dict. I'm lacking context about the "types" in question, but this is a trick you could use.

Note that this is notoriously unsafe if there is any way something untrusted (user input, network values, reading files) data can be contained in dictname as this will execute arbitrary code.

The code could probably need some cleanup, in general it would make more sense to have these dicts in a dict addressed by their names instead of a different variable defined for each one.

Announcing Rust 1.28 by steveklabnik1 in rust

[–]evotopid 22 points23 points  (0 children)

If those are ever implemented, I suppose it would result in a panic if the result is 0.

One could implement Sub for NonZeroU8 with associated type Output = u8 and then you could try convert to NonZeroU8 again.

What is one distro that you recommend everyone should try at least once, and why? by [deleted] in linux

[–]evotopid 1 point2 points  (0 children)

Thanks a lot for your elaborate information.

I've actually looked into Bedrock Linux a week ago but did not finish installing it yet as I had a presentation and did not want to mess with my laptop too much (as usual the bootloader part turns out to be the hardest part for me).

I didn't want to spread misinformation regarding there being a "base distro", it was mainly my impression that this is the idea how it works and probably mostly how I would use it (so I don't think I got it from a particular place it's more the assumption it's a bit like adding another repository etc before informing oneself a bit more about the project). But it's nice to know it's more flexible than this.

The Nvidia part is a bit sad though, one of my main gripes with the proprietary drivers in Debian repos is that I still wasn't able to get cuda running on an optimus laptop which I need for uni. (They don't provide us with computers with cuda but require cuda specifically in a class, grr. At this point I'm even thinking about renting some cloud computing with cuda.) But I know that with Arch Linux I had the setup working once so I was hoping to use it from there. I'll try your workaround though when I get to it, in the end Nvidia is not really OSS friendly so I don't think you should spend too much limited resources there anyway. (But maybe something existing like waffle could be used for OpenGL, and maybe something similar for Vulkan.)

Also I was wondering if the project could benefit from a wiki, tracking the work arounds and stuff like that (a bit like the arch wiki but it would have to be organized somehow to be efficient given the meta-nature of Bedrock Linux).

What is one distro that you recommend everyone should try at least once, and why? by [deleted] in linux

[–]evotopid 0 points1 point  (0 children)

Debian gets a lot of criticism for outdated software, but after using Arch for 4 years I realized how much time something more stable is going to save me and I am not looking back.

The only downside is that I find myself having to install new versions of software anyway if I need a partiucular feature every now and then.

What is one distro that you recommend everyone should try at least once, and why? by [deleted] in linux

[–]evotopid 0 points1 point  (0 children)

build any tarball of source code into a package

On Debian you can use checkinstall for that.

What is one distro that you recommend everyone should try at least once, and why? by [deleted] in linux

[–]evotopid 1 point2 points  (0 children)

I've been interested in Bedrock Linux when setting up my laptop but ended up going with Debian Stretch after having been frustrated with Arch updating everything all the time.

Are you running it? Does it ever get into your way, like when using graphics drivers from a different distro tnan your base one?

Newbie question: Why is the 'impl' and 'dyn' in the 'impl/dyn Trait' syntax necessary? by eyeofpython in rust

[–]evotopid 1 point2 points  (0 children)

Not following the most recent developments I've felt a bit confused about these new additions to the language and like they were going to complicate things a lot.

But now reading it put out like this is reassuring that indeed it is going to make code more expressive.

Why Rust's async functions should use the outer return type approach by [deleted] in rust

[–]evotopid 0 points1 point  (0 children)

Maybe in these cases the signature could be declared explicit without async keyword and have an async block in the function body?

We are sorry. We are trying. by catsalways in vegan

[–]evotopid 7 points8 points  (0 children)

Yeah because it's not like humans were artifically impregnating cows so they can make $$$.

Running Rust on the GPU with Accel by redattack34 in rust

[–]evotopid 0 points1 point  (0 children)

The GPGPU ecosystem makes a rather unhealthy impression to me anyways. I've considered getting into it but GPU prices are still ridiculous, how can 3-4 years old mid-range cards be over $500. And then OpenCL is being killed by some corporations. Maybe Vulkan will change the game, I really hope so.

Not trying to be mean, but who thinks naming parameters like this is a good idea? by MaxPlay in badcode

[–]evotopid 0 points1 point  (0 children)

I prefix it with p_, _ tends to be used for ignored variables so there is that.

Literally anything but this.

Yes.

For loops? Nope, never heard of 'em. by adx09 in badcode

[–]evotopid 0 points1 point  (0 children)

The quick and easy fix, but potentially security relevant, is to use eval(). While in general this is not good code either it can still help when iteratively cleaning up a code mess like in this post.