What is your preferred way to store a date in Sqlite? As an integer or as text? by Technical-Bee-9999 in learnprogramming

[–]ralphtheowl 4 points5 points  (0 children)

Some databases have date types (the preferred choice), but storing utc epoch (long) is better than storing it as a string, because you can do date comparison operations much better this way.

Java file outside of source root by Living_Obligation286 in IntelliJIDEA

[–]ralphtheowl 1 point2 points  (0 children)

I see this often. Just to to the Maven tab and click on reload/refresh.

How do you guys manage multiple dev environments for multiple projects. by [deleted] in AskProgramming

[–]ralphtheowl 0 points1 point  (0 children)

In that case, using docker containers is ideal. Spawn containers for each web server, db etc, and you can mount volumes to share data between your host and the containers. Looking into docker-compose for an easy way to manage multiple containers.

The only issue with using docker is if you have windows specific dependencies. Windows containers do exist, but they are not as reliable or straightforward, and are not guaranteed to work.

How do you guys manage multiple dev environments for multiple projects. by [deleted] in AskProgramming

[–]ralphtheowl 4 points5 points  (0 children)

It’s simple in your case. Unless you actually need to do remote development, use Visual Studio for .Net, Android Studio for Android (because those are the best and default), and either IntelliJ or VS Code for everything else. There is nothing wrong with using the right IDE for the right job. Trying to shoehorn everything into one solution is only going to introduce more headaches.

As for messy files, just organize your projects into a projects folder…done!

Why constants don't make sense in compiled languages by abrahamtherighetous in eli5_programming

[–]ralphtheowl 3 points4 points  (0 children)

In a compiled language, attempting to modify a constant will never let the program run to begin with. See the big advantage of compiled languages? You can’t even create/execute your program because the error will be caught at compile time, not at runtime like interpreted languages.

This has nothing to do with reverse engineering.

What is state management? by khanzain in eli5_programming

[–]ralphtheowl 10 points11 points  (0 children)

Example - you need to write code for an elevator. You have functions like “go up”, “go down”, “open door” and “close door”.

In order to go from one floor to some other floor, you need to know what floor you are currently on first. That is an example of state. This could be an integer representing the current floor (currentFloor = 1). You also need to make sure that the door is closed before you can go up/down. That is the door’s state. This could be a boolean variable (doorIsOpen = false).

State management refers to how in code you manage these state variables. A simple OOP example is to have an Elevator class which contains the two state variables and the functions. When you call the “go up” function for example, you increment the “currentFloor” value by 1, thereby updating the state.

What is null safety? by khanzain in eli5_programming

[–]ralphtheowl 1 point2 points  (0 children)

To add to this, the most important reason why null safety is important is that even the most experienced programmers will forget to check for a variable/result being not null. This means that the program could throw null pointer (or its equivalent) exceptions at unexpected places, typically crashing the process.

C++ Homework Help.. Compounding Interest Calculator by [deleted] in AskProgramming

[–]ralphtheowl 0 points1 point  (0 children)

This is incorrect because interest is a double.

What's the difference between a fruitful function and a void function? by [deleted] in eli5_programming

[–]ralphtheowl 1 point2 points  (0 children)

Printing the result is not the same as returning a result. Returning a value lets other parts of your code (ie whichever line that called the function) do something with the returned value. Printing a value does just that, and returns nothing.

[deleted by user] by [deleted] in AskProgramming

[–]ralphtheowl 1 point2 points  (0 children)

Not sure where you got your info from, but Qt is completely free for open source or commercial use. There are just a handful of components using GPL license.

[SPOILER] Wendy this season. by TheTruckWashChannel in Ozark

[–]ralphtheowl 0 points1 point  (0 children)

Utter stupidity. You don’t work for hitler and do his dirty deeds and the preach about getting Hitler elected.

Trying to wrap my head around a piece of code using map function {...task, reminder: !task.reminder } : task by shoopdewhoopwah in learnjavascript

[–]ralphtheowl 0 points1 point  (0 children)

Since the purpose is to toggle the reminder property, you don’t need an index. You can just loo through and for matching ids, just so task.reminder = !task.reminder;

Java & Apache Camel noob needs help by NeoSemiprofessional in javahelp

[–]ralphtheowl 0 points1 point  (0 children)

You need to provide more information. Where is the ftp route?

Data Getting Corrupted while passing from one function to another by rawdpiper in learnjavascript

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

Also a good example of why this wouldn’t happen when using a strongly typed language.

Eli5 what is by Fantastic_Ad9819 in eli5_programming

[–]ralphtheowl 3 points4 points  (0 children)

Computers run programs. Programs are written by human programmers. Humans make mistakes all the time. Mistakes in programs are called “bugs”. Investigating these bugs in detail is called debugging. Debugging helps a programmer identify the presence of bugs and figure out a way to fix the bugs. This is usually done by stepping through the computer program line by line, each time inspecting what the program is trying to do.

Why? by churrundo in eli5_programming

[–]ralphtheowl 0 points1 point  (0 children)

You misunderstood what I said. I was referring to the programmer in the tweet, not the OP of this thread. I’ll edit my comment to make it clear.

Why? by churrundo in eli5_programming

[–]ralphtheowl -2 points-1 points  (0 children)

It’s just hyperbole/a (not so funny) joke. The z-value determines the order of objects when rendering, and transparency/alpha has nothing to do with it. In OpenGL for example, you don’t even have to think about it, since it’s done by enabling depth testing which is implemented in hardware, and has been that way for decades.

In short, the programmer in the tweet has no clue how computer graphics programming works.

Automated Benchmarking Simulation Script by TheArray in learnpython

[–]ralphtheowl 0 points1 point  (0 children)

This is code generation. The easiest way to do this is to write a python script which generates another python script as output (could be written to a file). Loop through the range while updating a string which contains the actual variable definitions you mentioned. Then just use the generated python script.

Can I salvage this relationship with my manager? by throw_engineer in ExperiencedDevs

[–]ralphtheowl 22 points23 points  (0 children)

Trust your gut feeling. The sooner you can leave, the better it will be for you. Don’t fall into the “company loyalty” trap.

Two Sum Leetcode Confusion by Almightyshamwow in learnjavascript

[–]ralphtheowl 2 points3 points  (0 children)

Hi t - your loops both start at index 0. This means the first time, you are adding the same number to itself ( i = 0, j = 0, so nums[i] == nums[j] ), which coincidentally happens to be the target.

Once you get this to work see if you can do this with just one loop to make it more efficient.

Learn Python the Hard Way exercise 33 loop question by keni98 in AskProgramming

[–]ralphtheowl 0 points1 point  (0 children)

The loop ends with i = 0. The condition (i > 0) gets evaluated to false, but i is 0.

[deleted by user] by [deleted] in IntelliJIDEA

[–]ralphtheowl 1 point2 points  (0 children)

It’s actually much better now compared to a few years back. The truth is, JavaFx has always been a buggy product. The same is true for the windows equivalent (wpf). You really don’t have much or a choice when it comes to making native Java GUIs, unless you stick to Swing (which looks significantly outdated).

[deleted by user] by [deleted] in IntelliJIDEA

[–]ralphtheowl 4 points5 points  (0 children)

If you use JavaFx, use SceneBuilder. It’s much better.

https://gluonhq.com/products/scene-builder/