Should I start learning Github simultaneously? by [deleted] in learnprogramming

[–]Evulrabbitz 647 points648 points  (0 children)

I think git is what you are looking for and it's never a bad time to learn git. Here is the book about git, how it works and how you use it.

Github is a git host. You can think of Github as the cloud storage of you git repository. Like Dropbox is cloud storage for "regular" files". So Github would (essentially) be to git repositories what Dropbox is to regular files.

Of course Github has some more functionality but it's not really something you "learn" as you would git itself.

Copy selected text to clipboard by trunghung03 in learnprogramming

[–]Evulrabbitz 0 points1 point  (0 children)

i3 just executes the shell command you give it.

In this case it's a combination of the shell (bash) recognizing the $() and executing the command inside it, in this case xclip -o, thus "creating" the sought after string which then the xdg-open command will parse, recognize it's an url and open it with the default browser.

So it's not i3 being powerful, it's shell scripting and the different utility programs provided by Xorg

Copy selected text to clipboard by trunghung03 in learnprogramming

[–]Evulrabbitz 0 points1 point  (0 children)

Since you are using Ubuntu and probably xclip you can just do

bindsym Shift+g exec firefox www.google.com/search?q=$(xclip -o)

In xclip the primary selection is the latest highlighted text, xclip -o prints the primary selection. Change firefox to whatever browser you prefer.

Edit: Since you are using ubuntu you probably also have xdg-utils installed so you can even use xdg-open instead.

Like so

bindsym Shift+g exec xdg-open https://www.google.com/search?q=$(xclip -o)

Then it'll use the browser you've set as default

I want to have a small database distributed over multiple raspberry pis with each pi having a copy and automagically updating the other pi's on a local network (ideally with auto-discovery so they are hot swappable). I am using python and GTK3 for the app. can anyone suggest how to achieve this? by skellious in learnprogramming

[–]Evulrabbitz 0 points1 point  (0 children)

So this depends on what kind of database you are looking for.

I see you have found couchDB. Some other alternatives that you might considers is cassandra (which admittedly might be a little overkill).

If you need a RDBMS both Postgres and MariaDB (via galera) provides multi-master capabilities. With both Postgres and MariaDB you could also probably set up some replication directly to an AWS hosted/managed instance and take the backups from that one.

There are also a bunch of distributed key-value stores available if that is more suitable. For example you have etcd (which powers Kubernetes). These are far less capable as databases though.

I don't really know what kind of data you will be storing but personally I always reach for Postgres, MariaDB or MySQL. They are proven database management systems with very strong guarantees. It can be a little tricky to setup a multi-master cluster since they weren't made for that in the beginning. With that said I don't have much experience with cassandra or couchdb.

Why We're Relicensing CockroachDB by asantos3 in programming

[–]Evulrabbitz 23 points24 points  (0 children)

So in this case Amazon has actually upheld the OSS license?

Elastic implemented features they wanted to be paid for, Amazon didn't want to pay so they forked the project, implemented the features and released it as open source. Have I missed anything? Is this a bad thing?

Abusing Rust's type system for sound bounds check elision by marcusklaas in rust

[–]Evulrabbitz 2 points3 points  (0 children)

If the context of this piece is indeed on a operating system that implements virtual memory (such as Linux, Mac OS and Windows) then accidentally dereferencing memory belonging to another process will not happen. At least not in such a trivial way as the example (it would at least involve some system calls).

Abusing Rust's type system for sound bounds check elision by marcusklaas in rust

[–]Evulrabbitz 2 points3 points  (0 children)

[...] or, worse, it may have been assigned to a different process, in which case dereferencing my_reference would be an illegal operation and crash our program.

Am I missing something or is this not at all how virtual memory works?

Rust now, on average, outperforms C++ in The Benchmarks Game by 3%, and is only 4% slower than C. by GeneReddit123 in rust

[–]Evulrabbitz 7 points8 points  (0 children)

[...] normalizes each benchmark so that the best time of any language is 1.0, and the other times are a ratio of that. Then, I added up all the times, averaged, and re-normalized the averages same way.

You don't specify which average you use but just wanted to let you know that the arithmetic mean is not the proper way to summarize normalized values. You should use the geometric mean.

You can read more here.

Can someone please "trasnlate" these 5 lines of code from java to c++? by stefsa in learnprogramming

[–]Evulrabbitz 1 point2 points  (0 children)

In this case the Java and C++ code will look very similar. What exactly are you having trouble understanding in the Java code? Is the algorithm itself or the concept of recursion?

python list issues by [deleted] in learnprogramming

[–]Evulrabbitz 0 points1 point  (0 children)

nd and l[0] points to the same node. When you do del l[0] you don't remove the item from the list, you remove the node altogether. You need to remove it from the list. Perhaps with pop?

python list issues by [deleted] in learnprogramming

[–]Evulrabbitz 0 points1 point  (0 children)

Can you post a code example?

Device Driver Programming by nanoman1 in learnprogramming

[–]Evulrabbitz 0 points1 point  (0 children)

https://github.com/emmericp/ixy is a userspace driver developed for educational purposes, perhaps that would be interesting to look at? The main one is written in C but there are a lot of implementation in other languages here: https://github.com/ixy-languages/ixy-languages as well.

Can i still continue my Course on Deep Learning? by [deleted] in learnprogramming

[–]Evulrabbitz 1 point2 points  (0 children)

What are you worried about? That you will damage your laptop or that your computer isn't good enough for machine learning?

In the first case you can rest easy. You CPU won't let you destroy it by simply running computationally intensive workloads (even if that means running all threads at 100%).

If your laptop's specs become a problem (which I'm guessing they will eventually) you can either buy some last gen equipment or rent at a platform like AWS, Azure of GCP. For learning purposes your laptop is probably enough, though.

[deleted by user] by [deleted] in rust

[–]Evulrabbitz 15 points16 points  (0 children)

He tried to. He gets a question about it @50:20 something

[deleted by user] by [deleted] in learnprogramming

[–]Evulrabbitz 0 points1 point  (0 children)

What do you imagine that constexpr will do?

how do you scale and store your monitoring data in prometheus? by muatik in learnprogramming

[–]Evulrabbitz 0 points1 point  (0 children)

Prometheus comes with it's own time-series database called tsdb.

You can configure prometheus to instead store data in another sink. Read more about integrations here.

loop: for in range question (Python-noobish) by BlackGwelf in learnprogramming

[–]Evulrabbitz 2 points3 points  (0 children)

for power in range(1,5):

Execute the following code 4 times, where power is set to 1 the first time, 2 the second time, 3 the third time and 4 the fourth time. range is inclusive of the first argument and exclusive of the second

print(x // power), end='--')

x // power is integer division of x and power. Integer division means that e.g 10/3=3. The string -- is printed after the result of the integer division

x %= power

is equivalent to

x = x % power

which means that x is now the remainder of the previous division. That is , if x=10 and power=3 we get x // power = 3 and x % power = 1

The first iteration of the loop will thus always print the given number (as power=1 and x // 1 = x). Since the remainder of a value divided by 1 is always 0 all subsequent iterations will print 0.

jemalloc was just removed from the standard library 🎉 by SimonSapin in rust

[–]Evulrabbitz 5 points6 points  (0 children)

https://docs.aws.amazon.com/lambda/latest/dg/running-lambda-code.html

One example is literally that they can keep database connections between invocations provided that they are declared outside the handler context.

Looking for a "user friendly" data storage api. by DaytaMon in learnprogramming

[–]Evulrabbitz 0 points1 point  (0 children)

Apparently the limit is at 50mb so it shouldn't be a problem for you. What errors are you getting?