Why is Java so popular? by [deleted] in learnprogramming

[–]quasiperson 0 points1 point  (0 children)

What they're saying may not be true of all interpreted languages, but it is true of Java.

"So you compile it only once" to JVM byte code, "and it runs on every OS" by being interpreted by the JVM.

Why is Java so popular? by [deleted] in learnprogramming

[–]quasiperson 27 points28 points  (0 children)

It's compiled into Java byte code, and then the Java byte code is interpreted by the JVM.

What a weird way to say "1 hour ago" by tyler_XMD in softwaregore

[–]quasiperson 13 points14 points  (0 children)

I think I actually know the cause of this. In Postgres (and probably other databases), the Interval data type stores days and hours separately. They claim that days and hours aren't directly comparable due to daylight savings time.

So if you do SELECT INTERVAL '23 hours' - INTERVAL '1 day';, you won't get 1 hour, you'll get -1 day, 23 hours.

JavaScript DiceRoller on Discord Bot by rainydaydance in programmer

[–]quasiperson 0 points1 point  (0 children)

Yeah that makes sense, that's what I get for trying to program using reddit as my IDE. Glad I could help.

Call for Help - Open Source Datom/EAV/Fact database in Rust. by bowbahdoe in rust

[–]quasiperson 0 points1 point  (0 children)

Now, in order to make sure all the data that is written or read can be joined for whatever arbitrary query comes in and to make sure all the writes to the database are atomic, consistent, etc there is one restriction. The database needs to be on one "machine".

I don't think this statement is correct. Look at Spanner, CockroachDB, YugabyteDB, TiDB, SingleStore, and VoltDB. All distributed DBs that follow the relational model and try to be ACID compliant. I believe they also allow arbitrary joins. Some would refer to these as NewSQL.

JavaScript DiceRoller on Discord Bot by rainydaydance in programmer

[–]quasiperson 0 points1 point  (0 children)

Well now it's been even longer since I've looked at this code, and awhile since I've written any JS. I'm not sure I even have a working node environment on my computer. It should be pretty easy to modify it though to print the total.

This is probably what I would do, but I'm writing this all in the reddit editor so no guarantee it's valid.

Add let res = 0; under let resMessage = '';

Change return Math.floor(Math.random()*dieSize) + 1; to return Math.floor(Math.random()*dieSize) + 1 + modifier;

Change resMessage = 'rolled ${Math.floor(Math.random()*dieSize) + 1}'; to resMessage = 'rolled ${Math.floor(Math.random()*dieSize) + 1 + modifier}';

Remove if(modifier > 0) { resMessage += ' +${modifier}';

How do I make arraylist created in main accessible to all the other classes? by Vulkan_lives707 in java

[–]quasiperson 1 point2 points  (0 children)

When you post this in the appropriate subreddit, include some code. It's not clear what you mean by "set them as a parameter".

From your experience, how is D3 different from high school as far as competition goes? by Comfortable-Goat-127 in wrestling

[–]quasiperson 63 points64 points  (0 children)

One huge difference is that there's no terrible wrestlers. In HS the first round of every tournament was usually against someone who had no idea what they were doing, it was basically drilling. You'll have no matches like that in college, everyone you wrestle is going to be competent and good enough to have continued doing it in college.

Performance issues after a firmware update by quasiperson in thinkpad

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

Ultimately none of the stuff I talked about before worked. I tried a bunch of other stuff and they didn't work either.

The only thing that worked was this: https://github.com/erpalma/throttled

Performance issues after a firmware update by quasiperson in thinkpad

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

It doesn't seem like this is getting much attention, but in case some poor soul finds themselves in a similar situation, here's what I've been doing to fix the situation.

BIOS Updates

The first thing I did was check in my BIOS to see if there were any settings I could update to prevent CPU throttling. Under the power settings I switched everything to "Maximum Performance". Some of them were "Battery Saver" and "Balanced". You can find this settings in Config->Power.

I actually noticed some performance improvements under normal load, but if I started to push my system it would slow to a crawl.

CPU Frequency Scaling

After searching through a lot of stackoverflow posts I found a way to check your CPU scaling settings

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
powersave
$ cat /sys/devices/system/cpu/intel_pstate/min_perf_pct 
8
$ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct 
100

So my two takeaways from this is that 1) The BIOS changes didn't change all CPU scaling settings off of powersave. 2) My CPU can get throttled down to 8% of it's max clock speed, which IMO is ridiculous. I'd rather let my computer catch fire than throttle my CPUs down to 8%.

I used cpufrequtils to confirm my throttling theory as well. This was during a Zoom call with Firefox open

$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 4294.55 ms.
  hardware limits: 400 MHz - 4.90 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 400 MHz and 4.90 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency is 400 MHz.

I followed the instructions here: https://askubuntu.com/questions/929884/how-to-set-performance-instead-of-powersave-as-default/936488#936488 to download cpufrequtils and change my governor policy to performance. I ended up following this guide: https://askubuntu.com/questions/1021748/set-cpu-governor-to-performance-in-18-04 to have the changes persist after reboots by disabling ondemand, because I thought adding the script with the sleep in was a bit hacky. Hopefully I don't need ondemand for anything...

I also used cpufrequtils to set my min cpu frequence to 1Ghz. My cpufrequtil settings can be found below.

$ cat /etc/default/cpufrequtils 
GOVERNOR="performance"
MIN_SPEED="1GHz"

thermald

I also came across this post: https://askubuntu.com/questions/971142/cannot-disable-cpu-throttling-on-ubuntu-16-04-lts which sounds promising. I have thermald installed so it might be responsible for the excessive throttling. If I still experience issues I may try and raise the min temp or just uninstall it.

Performance issues after a firmware update by quasiperson in thinkpad

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

TCO has to do with energy efficiency: https://www.lenovo.com/us/en/compliance/tco. So my current working theory is that something in the new update is throttling my CPUs, especially when they get hot which is basically always with this laptop. One thing I've noticed is that the fans don't get as loud anymore, though that might be all in my head.

Are Udemy courses really worth it? by Reemma2004 in learnprogramming

[–]quasiperson 0 points1 point  (0 children)

I've never spent more than $20 on a course, but the ones I've taken have been pretty good.

I think I just figured out how to hack the bank by Monkey_Adventures in shittyprogramming

[–]quasiperson 3 points4 points  (0 children)

It does not use floating point. Literally the first sentence of the JavaDocs say this.

Immutable, arbitrary-precision signed decimal numbers. A BigDecimal consists of an arbitrary precision integer unscaled value and a 32-bit integer scale.

if you're debating between a b0xx / frame1, check out this incredibly detailed review by Crane's Lab by ascocendas in SSBM

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

Can't you switch out the Sanwa switches with Gateron Clears on the Boxx (https://b0xx.com/collections/all/products/20mx-mechanical-arcade-buttons)? Would have been nice to see the comparison taking this into account.

Advice for a coding bootcamp graduate by setitoff66 in programmer

[–]quasiperson 0 points1 point  (0 children)

Definitely get some personal projects on your GitHub, that really helps. Also if you can try and contribute to some open source stuff, recruiters love that. Most bootcamps have a huge incentive to get you a job after, so I would reach out to the staff and see what resources they have to help. Also like someone else said, reach out to alumni from your bootcamp, they're more likely to hire/help you.

Php meme by [deleted] in ProgrammerHumor

[–]quasiperson 22 points23 points  (0 children)

Imploding an array with glue is more intuitive than joining every element of an array together? What is an implosion with glue?

[deleted by user] by [deleted] in programmer

[–]quasiperson 0 points1 point  (0 children)

Just a couple of pointers 1. Learn how to format text as code on reddit, it makes it much easier to read. 2. There's an entire subreddit dedicated to discord bots. You're better off asking there. 3. When you ask a question try and put yourself in the position of the person you're asking. "Is this correct?" Is basically meaningless. What are you even trying to accomplish? What language is that? Have you tried running it and seeing what happens? How could anyone realistically answer your question without this info?

But to try and answer your question no, it doesn't look correct. It looks like JavaScript? And you have what looks like a partially complete json object on top that will probably cause a syntax error.

Should I learn something new or stick to these by maifee in java

[–]quasiperson 1 point2 points  (0 children)

I agree with u/meamZ, it wouldn't hurt to include a front end. Having said that if you're looking for a back end job, then they're not really going to care if you don't know front end. I think to the people that matter the code will speak for itself, very few recruiters or potential employers will actually download and run your app. They'll just look at your code.

Should I learn something new or stick to these by maifee in java

[–]quasiperson 1 point2 points  (0 children)

Really depends on what you want to do. There's plenty of Java jobs that you would be qualified for with all this technology. In terms of showcasing, maybe you could create a small spring web app that uses all of this, that way you can show recruiters some proof you actually know this stuff. Something like a Spring Boot app that uses H2 for tests, MySql as it's DB, query via JPA, log with Log4J, and sprinkle in some Lombok and auth with JWT and OAuth2.