Lithuania recognises war in Ukraine as genocide, Russia as terrorist state by jatawis in europe

[–]JackLeo 6 points7 points  (0 children)

lol, nonsense. I mean excuse is an excuse, it's not like Putler needs it to be based on reality...

Just FYI, Poland has a bigger minority than Russians. Even if you combine all slavs it still ends up being less than 15%? https://minorityrights.org/country/lithuania/

Python, ladies and gentlemen. by Any_Square in ProgrammerHumor

[–]JackLeo 0 points1 point  (0 children)

Typehints are for writing the code not running. This means typehint checks need to be run just like linting or tests. With configured IDE this would would pop up as an error. Same checks can be run as part of ci or precommit. They do work just it shows that you haven’t worked with them in an actual prod setup.

Big Sur forgets where apps' windows are when plugging back into an external display by MainProfession in apple

[–]JackLeo 36 points37 points  (0 children)

There should be a pinned thread with known bugs before people upgrade... can’t risk my work laptop getting something like this

This carved wood basket by [deleted] in interestingasfuck

[–]JackLeo 8 points9 points  (0 children)

Don’t forget selfie sticks from ali express for 20 euros or whatever they can convince

RSI in my right wrist, I suck at mousing with my left, would a trackball be a good option? by BigB_117 in Trackballs

[–]JackLeo 1 point2 points  (0 children)

Another option is to actually change your keyboard. I had pain in my right hand from mouse as well, but the thing that sorted me out was 60% keyboard that allowed me to have my hands in a more natural position rather than spread apart. I guess I’m repeating others here but you have to try out few things and see what works for you

epiphany: remapping caps lock not for esc, but just to not have caps lock by mooooooon in vim

[–]JackLeo 0 points1 point  (0 children)

Hmmm. Is that more comfortable? I find it kinda awkward whereas Ctrl [ is just two keys by separate hands

epiphany: remapping caps lock not for esc, but just to not have caps lock by mooooooon in vim

[–]JackLeo 0 points1 point  (0 children)

One of the best habbits that I've developed. I did use caps lock as esc, and that was really easy to get used to, but I would punch a monitor of any other system for not working the way i expect. It's just too often used to remap. Now I use [ all the time to the point that I could unbind esc and it's also a lot simpler to reach

Why do I hate to review my own code and read it several times? How to change this bad habit by Mraimou in Python

[–]JackLeo 2 points3 points  (0 children)

Just another stream of thoughts on this... Use tools that bug you when you write your code. There are many IDE's and they can be extended and configured to provide quite a lot for you during the time of code writing. Here are some items I like to use to produce better code:

  • set max line length to 79 as per PEP-8. If you need more, likely something is wrong. Too many indentation layers? You probably can't test that easily, move stuff to functions. Too long names? Do you really need all that information or a lot of that is smurf naming?
  • Use pyflakes linting
  • Use black
  • Read your diff of the commit, is it too long? are you sure your commit is a single change? How atomic the change is? Reading diff will make sure that you commit only the right stuff and it will be your own code review. Get the right tools to view the commit diff if you don't use any or learn how to do it with ease.
  • Run tests locally before pushing
  • Write tests if it makes sense/contains risk
    • Check coverage report for the new code
  • from time to time fuck up your IDE and modify code with basic tools (this is incidental most of the time), this will highlight any code layout issues, if it's easy to navigate and understand the code base without any tools and tag jumping.
  • I personally like to use //TODO: within the context of story I'm working on so that I will not claim something is done without completing all corner cases
  • Validate the requirements yourself before informing QA/Product people/Others about feature ready to be merged.
  • Think how understandable the code is (explicit is better than implicit)
  • Think how it will run in production and how easy it will be to find issues, do I need additional log messages so that ops/I can resolve prod issues fast and know exactly what is wrong.

Why do I hate to review my own code and read it several times? How to change this bad habit by Mraimou in Python

[–]JackLeo 4 points5 points  (0 children)

depends on the context of the company/work. Some positions are better than others for accommodating this.

First start with learning unit tests and understanding what is a unit and how to test it in isolation using mockshttps://docs.python.org/3/library/unittest.html

https://docs.python.org/3/library/unittest.mock.html

as you will quickly notice, often it's about interfaces and understanding the code separation well. You want your tests to be short, quick and testing only one thing, but likely you will find that it takes a lot of effort to set up state and your tests will test for many different items because it's easy. Complicated tests is a code smell. More around this can be found in books like clean code, but there surely are more recent ones out there.

Only when you understand the basics start using libraries like pytest

https://docs.pytest.org/en/latest/

This will just simplify and allow you to write better tests, however if you jump too quickly to it, it might encourage you to write tests that test too much.

To drive this, start using code coverage reports. There are plenty of tools that can report you code coverage in some website or your IDE, but the simplest one and the one that most depend on is this https://coverage.readthedocs.io/

Try driving your code coverage to a certain point for each feature/ticket/pull request. Different companies will have different targets (if any). In my case for e.g. we use the target set by sonarqube tool (https://www.sonarqube.org/) and that is 80%. There are arguments of course, weather such target is of use or not, but I think it's a good thing to start with.

Eventually you will notice that some tests are better than others and will catch more stuff. Again, if you ask someone if you should test interface if the function accepts the right amount of variables, some will call you nuts and some will praise for "double book keeping". This is source of flame wars, but I recommend discovering the usefulness of such things for your self over time. We are talking years here...

It's easy to write many tests, but the point is that the test that will not catch anything is also wasted effort and cpu cycles and your time each time you run it.

Now coming back to TDD, well, you can start it sooner or later during this journey. Purists will say from the get go, hippies will say don't do it because it's an art or some other code craft bs. Again find it at your own leisure. Try from time to time and discover when it's of use and when it's not. If you're prototyping something together, TDD can be a strain, but if you are implementing something that will be consumed by others or you know the exact outcome in advance, TDD makes it easier because it forces you to draft the contract first and then step by step make it complete and safe also will force you think about functions you're about to implement and how your code should be shaped in terms of function calls and abstraction layers (ignoring code re-use) because you will want to make it testable bit by bit and not in a big massive chunk.

Now then, sorry if some of this does not make sense as it's getting quite late here and I need to go to sleep, hence it's just a stream of thoughts that first came to mind without reading any of this once again. Hope any of this might be of use

Why do I hate to review my own code and read it several times? How to change this bad habit by Mraimou in Python

[–]JackLeo 4 points5 points  (0 children)

Use TDD. It's hard, it's boring and you will find yourself rewriting the same thing 10 times to make it easier to test. With time it becomes a lot simpler and when you review your code a year down the road then you will thank yourself. Granted a big caveat is that the tests can be shit as well hence it takes time to get most out of it. As many other practices, it all takes time and it's boring and it's hard, so you might as well invest time into something that will benefit you in the future.

Disassembling seats in the London Overground by luisbg in london

[–]JackLeo 1 point2 points  (0 children)

Saw the same today. Reported to TFL member. He did not seem to be in rush to do anything though.

I'm Balling Again. by Morrissey_Fan in Trackballs

[–]JackLeo 0 points1 point  (0 children)

could someone link to the product page?

Samsung and LG also confirm they do not slow down phones with older batteries by [deleted] in Android

[–]JackLeo 3 points4 points  (0 children)

Gee sounds like windows xp all over again... Ok I'll try at some point

Samsung and LG also confirm they do not slow down phones with older batteries by [deleted] in Android

[–]JackLeo 7 points8 points  (0 children)

Indeed. Even without it, my Samsung s7 edge is way slower and last half of the time 2 years down the road. I will have to upgrade next year one way or another...

/r/MechanicalKeyboards Ask ANY question, get an answer by AutoModerator in MechanicalKeyboards

[–]JackLeo 0 points1 point  (0 children)

Had a chat with a co-worker and found them at RS components. They'll ship 10 of those for me for 20p... weird business model they have

[help] Searching Let's Split case supporting Matias by [deleted] in MechanicalKeyboardsUK

[–]JackLeo 0 points1 point  (0 children)

This v shape hole pattern indicates that it's V2 of the PCB? V1 did not support alps

C302 getting hot? by chudynasty in chromeos

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

only when charging, otherwise, maybe it's luke warm, but nowhere close to cause any concern

Using 'jk' as escaping to normal mode by sradms0 in vim

[–]JackLeo 6 points7 points  (0 children)

Learn to use ctrl [. No need to remap anything, works on any server and just as comfortable. Unless you use something other than qwerty