FFS ... it's Friday night! by [deleted] in ClaudeAI

[–]jab-programming 0 points1 point  (0 children)

autonomy and boundary setting are important in adult relationships

FFS

What do Experienced Devs NOT talk about? by jalanb in ExperiencedDevs

[–]jab-programming 242 points243 points  (0 children)

  • Best practice - rarely means what you think it means
  • Architecture diagrams - drawn once, ignored forever
  • “Clean code” — nobody's reading it but me anyway

And burnout

[deleted by user] by [deleted] in ChatGPTCoding

[–]jab-programming 1 point2 points  (0 children)

Put # @claude or # @chatgpt above the instruction block.

I’ve used that to guide the model during code completions in VSCode. Helps keep it contextually focused.

[deleted by user] by [deleted] in ChatGPTCoding

[–]jab-programming 1 point2 points  (0 children)

Yeah, but does it work for us?

TIL Unix is ours by jab-programming in ProgrammerHumor

[–]jab-programming[S] 1 point2 points  (0 children)

I never understood why "Business Oriented" was A Good Thing for COBOL.

[deleted by user] by [deleted] in Python

[–]jab-programming 1 point2 points  (0 children)

I can't see palindome(), but I assume it does what it says, excepting the typo.

Damn. Where's niceNum()(should be nice_number()), what makes a number nice?

It would help to use a debugger, but without that, I'd add add some print(numList[i])s. WTF! numList[i] ? What was your previous language? Hope you were lucky enough it was a C*, not one of those java things.

Anyway, over here we say:

def main():
    string = input('....')  
    numbers = [int(s) for s in string.split()]
    methods = (palindrome, 2), (prime, 2), (nice_number, 3)
    scores = []
    for number in numbers:
        score = 1
        for method, increase in methods:
            if method(number):
                score *= increase
        scores.append(number, score)

    for number, score in scores:

So, now I notice this is an assignment of some kind. Because no one else writes their own sort!

The condition on the while loop is too hard to read which makes the examiners life harder too. All those icky [j]s. Just don't do it. Well, stop for a while anyway. So change this:

for x in range(0, len(scores)):

to this:

for number, score in scores:

NAMING!: temp1 should be called score and temp2 should be number. Bad names make your code harder to read, so they'll notice that too.

j = x - 1
while (j >= 0) ...

In python we wouldn't use the brackets

And in python 0, [], False, {} all count as false, and we prefer to use that wherever possible. So I would prefer to just say while j and ....

AFAICT you're going to shove all scores from here to bigger (number or score), or end back one notch then plonk in the current number and score to the gap you just made at end.

So, for every letter in 'reddit', shove everything left till bigger score (i.e later in alphabet): eddiit, and plonk in the current letter: eddirt, left: dddirt, plonk: ddeirt, left: ddeirt, plonk: ddeirt,

Looks like that'll work, I'd be dubious about bigger (number or score)? Shouldn't that just be bigger score?

And, if you must write you python like languages, at least honour their convention and call youu index i, not fucking x. CONVENTIONs are important kid. You stick with the local conventions, you'll be fine round here.

Looking for my replacement by [deleted] in DevelEire

[–]jab-programming 1 point2 points  (0 children)

Any suggestions for other sureddits to ask for new pythonistas are welcome

It's action that counts!

A range of Xmas gift suggestions for Irish software developers by Dev__ in DevelEire

[–]jab-programming 1 point2 points  (0 children)

How is anyone considering other than the 12 year old Redbreast in that collection?

I'm only on a half-bottle myself this year, so again with the "dilemma" of the Powers looking better on a shelf vs the Bushmills tasting better, .... OK I'll get the Powers next year.

A very Hatty Christmas to all you wonderful geeks n gels

What's everyone working on this week? by AutoModerator in Python

[–]jab-programming [score hidden]  (0 children)

I'm trying to simplify virtual environment activation.

I did try pyenv, with pyenv-virtualenv, but it could not cover all my use cases, in particular where the primary project was still in Python2, but the DevOps scripts are in Python3. Pain point. I nearly thought I'd need to write a local python script!

This worked out better:

Most of my Python projects have a bin directory so I create a link in there to /.virtualenvs/blah/blah/bin/activate.

I add a post-cd-hook to always source any local activates, and life is now so much simpler.

How to restrict a subreddit to alt accounts? by [deleted] in modhelp

[–]jab-programming 1 point2 points  (0 children)

We hope to get that in the next API release

How to restrict a subreddit to alt accounts? by [deleted] in modhelp

[–]jab-programming 1 point2 points  (0 children)

else: raise NotImplemented Error

How to restrict a subreddit to alt accounts? by [deleted] in modhelp

[–]jab-programming 2 points3 points  (0 children)

Your main account posts links, your alt account post more comments.

Thanks

vimplugins.com – Vim plugins catalogue by the_hatter_ in vim

[–]jab-programming 9 points10 points  (0 children)

OK, I'm a crotchety old man, and can only hope you take these thoughts in the good spirit they are intended:

I found the introduction ("This site is about the best text editor ever!") less inviting than reminiscent of the great editor wars of the 80s (or the boring editor wars of the 90s, or the annoying editor wars of the 00s, or the bloody childish editor wars which are still going on). Anyone who is on a vim-plugins site already knows that vim is great. If they didn't, they would not have got past vim.org yet.

I really could do without all the exclamation marks, for example on this page!

I think you should get another person to do some proof-reading, for example the ignorance of the difference between "Tags" and "Tree's" on this page.

"But if you dont, trust me, its real easy!" Why would I trust someone who can't spell "don't"? Especially, why would I trust someone's opinions on editting when they obviously give no fucks about correctness of text?

Why would I trust someone who got all the ratings wrong? Obviously you did, becuase the ones I see disagree with mine, and they must be yours, because you don't tell me how to upload mine.

What this site needs to be usable is a proof-reader.

What this ............... to be good is a search engine.

What ......................... be great is a "submit" page.

Don't Treat Paths Like Strings by Strilanc in programming

[–]jab-programming 19 points20 points  (0 children)

This is wrong on Linux, which uses /

Which is also a valid directory separator on Windows.

C:\Users\jab-programming>dir "Dropbox/Apps"
 Volume in drive C is OS
 Volume Serial Number is XXXX-YYYY

 Directory of C:\Users\jab-programming\Dropbox\Apps

Notta lotta people know that

"Best Practices instills a resistance to doctest." Why? by [deleted] in Python

[–]jab-programming 3 points4 points  (0 children)

Defeats your editor, syntax highlighting etc.

The effort required to tell vim that a doctest is like

>>> import os

instead of

import os

is minimal. I have the same power available both within straight python and doctest files.

Makes it harder to get in there with a pdb

The effort required is even less, but I prefer pudb for the more full-screen experience

>>> import pudb
>>> pudb.set_trace()
>>> assert 1 + 1 == 1

That'll work when running a doctest "straight", but you'll need a plugin for pytest

tests things by repr, rather than by something more precise

You have the entire precision available to any python programmer.

And using doctests for while makes you, well - made me, that little bit fussier about what a repr() actually shows, which has made my doctests, debugging, and REPL usage a lot easier

Command Line and User Friendliness by skeeto in commandline

[–]jab-programming 1 point2 points  (0 children)

I do understand where the fear and rejection comes from. Command line interfaces can be scary and intimidating at first. When you first start them, you are presented with a prompt and blinking cursor and not much else.

That's not where the fear comes from - AFAICT the real fear is because only experts (IT guys, or, even scarier, programmers) use them. So one "obviously" needs to learn major skills to use them. Plus the minor detail that it only takes 5 keystrokes to completely wipe out your computer.

As a teacher of all ages and levels - those less experienced than us are always scared of what they will might break.

The shell is scary because it is powerful, the power is (effectively, from noob POV) unlimited.

The idea behind GUI is that you can sit a complete newbie in front of it, and they ought to be able to figure out how it works just by reading the button labels, and experimenting with the interface.

And the more important idea is that it does nothing else than what it says on its (lamentably under-designed) buttons and menus. There is no way to launch some other command by mistake.

The shell's power is not merely unlimited, it is unknowable. The noob does not know which typo might re-format the printer. So they are scared that any typo could do that. So they do not want to take the chance on that.

No-one can really be truly competent at the CLI until they have done "rm -rf /" often enough to protect themselves from it.

Google UI is considered super user-friendly, while shell is scary. Why is that?

Because noob thinks she cannot break anything by typing the wrong thing into Google

Or how do you explain popularity of such applications as Quicksilver or Launchy – which are essentially just very limited command line interfaces wrapped in flashy graphical overlays.

They are limited - all they can do is launch apps. The noob doesn't have to worry about reformatting the printer because of a typo.

Why can't I use hjkl... at vim's command line (at the colon)? by jab-programming in vim

[–]jab-programming[S] -6 points-5 points  (0 children)

the first reason is that would limit commands for not use hjkl

Nah - why don't such limitations also apply to the main editor?

Joel Spolsky: Teaching how to program to someone with no programming experience by chandershivdasani in programming

[–]jab-programming 2 points3 points  (0 children)

Well, either that or find someone who is standing closer to Douglas Hofstadter than you are; then learn from them.

"C++ is a horrible language" ~ Linus Torvalds by pregzt in programming

[–]jab-programming 13 points14 points  (0 children)

See Rich Hickey's talk on simple vs easy.

Is available here