Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

ultrafilter posted:

You might not be able to break anything permanently in a git repo, but you can definitely lose local changes that you haven't pushed to a remote.

It's very easy to lose uncommitted changes, but very difficult to actually lose committed but unpushed changes.

Adbot
ADBOT LOVES YOU

12 rats tied together
Sep 7, 2006

pokeyman posted:

Now imagine someone who doesn't find it extremely simple and intuitive.

It's difficult for me to reconcile this with "being a professional software developer". This isn't a sentiment that I usually express, because I generally just repress it instead of trying to crystallize it into something that doesn't come out as a direct personal attack. Git, in general, is complex enough to warrant pretty much perpetual confusion and resentment, I don't necessarily agree with this but I think its wholly justifiable.

Github flow, though, is a shared log of changes to a file tree and the difference between that log and your own copy of it, the extent of your commitment as a developer is the changes that you make to your copy of the log and the process by which those changes are integrated into the shared log.

A key distinction here between github flow and the OP's git flow is that there is no develop branch, there is only main, and main is always (theoretically) production. This drastically simplifies the branching model to the point where it is reasonable to expect that a feature contributor fully understands it, you can put it in the job description.

If you start mixing in shared branches, release branches, etc, it's because you've identified a need for some local expertise. Why can't main also be production? The people who know the answer to that question are now the release team, and managing it is part of their job.

ultrafilter posted:

You might not be able to break anything permanently in a git repo, but you can definitely lose local changes that you haven't pushed to a remote.

Certainly, but so long as you have committed (or stashed, please use git stash) your changes, you will always have them unless you start rewriting the past. I think git is pretty good about warning you that you are doing this, but again, you have to be operating in a mode where you are intentionally building a mental model of how this tool works. Pasting something from stack overflow and smashing yes until your bash prompt comes back will eventually cause you harm.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

12 rats tied together posted:

Certainly, but so long as you have committed (or stashed, please use git stash)

For those who are unaware, git stash -i is a thing and it is magnificent.

Empress Brosephine
Mar 31, 2012

by Jeffrey of YOSPOS
Thanks for the answers. That magic program is interesting.

redleader
Aug 18, 2005

Engage according to operational parameters

Volmarias posted:

For those who are unaware, git stash -i is a thing and it is magnificent.

i can't find -i in the docs for stash

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

12 rats tied together posted:

It's difficult for me to reconcile this with "being a professional software developer". This isn't a sentiment that I usually express, because I generally just repress it instead of trying to crystallize it into something that doesn't come out as a direct personal attack. Git, in general, is complex enough to warrant pretty much perpetual confusion and resentment, I don't necessarily agree with this but I think its wholly justifiable.

Github flow, though, is a shared log of changes to a file tree and the difference between that log and your own copy of it, the extent of your commitment as a developer is the changes that you make to your copy of the log and the process by which those changes are integrated into the shared log.

A key distinction here between github flow and the OP's git flow is that there is no develop branch, there is only main, and main is always (theoretically) production. This drastically simplifies the branching model to the point where it is reasonable to expect that a feature contributor fully understands it, you can put it in the job description.

If you start mixing in shared branches, release branches, etc, it's because you've identified a need for some local expertise. Why can't main also be production? The people who know the answer to that question are now the release team, and managing it is part of their job.

I'm not sure what to tell you except that there exist capable professional software developers working within established git workflows who nonetheless manage to end up getting stuck and cloning afresh. Maybe they're stupid, or maybe they're struggling with an obtuse tool.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

redleader posted:

i can't find -i in the docs for stash

:doh:

I meant -p, good thing git is consistent in its arguments and usage!

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Volmarias posted:

:doh:

I meant -p, good thing git is consistent in its arguments and usage!

quote:

A novice was learning at the feet of Master Git. At the end of the lesson he looked through his notes and said, "Master, I have a few questions. May I ask them?"

Master Git nodded.

"How can I view a list of all tags?"

"git tag", replied Master Git.

"How can I view a list of all remotes?"

"git remote -v", replied Master Git.

"How can I view a list of all branches?"

"git branch -a", replied Master Git.

"And how can I view the current branch?"

"git rev-parse --abbrev-ref HEAD", replied Master Git.

"How can I delete a remote?"

"git remote rm", replied Master Git.

"And how can I delete a branch?"

"git branch -d", replied Master Git.

The novice thought for a few moments, then asked: "Surely some of these could be made more consistent, so as to be easier to remember in the heat of coding?"

Master Git snapped his fingers. A hobgoblin entered the room and ate the novice alive. In the afterlife, the novice was enlightened.

Source

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

12 rats tied together posted:

Certainly, but so long as you have committed (or stashed, please use git stash) your changes, you will always have them unless you start rewriting the past. I think git is pretty good about warning you that you are doing this, but again, you have to be operating in a mode where you are intentionally building a mental model of how this tool works. Pasting something from stack overflow and smashing yes until your bash prompt comes back will eventually cause you harm.

Even once you've started rewriting history, unless you explicitly call git gc (protip: there is almost never a reason to do that) your stuff is still all there in the reflog, although it may be hard to find.

raminasi
Jan 25, 2005

a last drink with no ice

pokeyman posted:

I'm not sure what to tell you except that there exist capable professional software developers working within established git workflows who nonetheless manage to end up getting stuck and cloning afresh. Maybe they're stupid, or maybe they're struggling with an obtuse tool.

It's definitely obtuse, but there seems to be a sense of git being somehow intractably incomprehensible rather than just a powerful tool built out of a fairly straightforward ontology hidden behind a terrible UI.

redleader
Aug 18, 2005

Engage according to operational parameters

Volmarias posted:

:doh:

I meant -p, good thing git is consistent in its arguments and usage!

neato, thanks!

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

raminasi posted:

It's definitely obtuse, but there seems to be a sense of git being somehow intractably incomprehensible rather than just a powerful tool built out of a fairly straightforward ontology hidden behind a terrible UI.

Sure, obviously it's not impossible to use. But I don't at all look down on anyone who finds it unintuitive. And it's unfortunate because we have many equally powerful tools with better interfaces.

Assuming that a developer who has trouble using git is an unprofessional idiot is a dumb, revealing take.

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.
Cheers for the advice KillHour (and for the git discussion it triggered, always gets a bit heated but good advice there anyway). As an aside has anyone used gitless? I was going to have a play around with it as the interface seemed...sensible I guess, and I can use it locally without it affecting workflows, just wondering if there was much point.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



KillHour posted:

Excel is already Turing complete and so is PowerPoint, for that matter.

Sure, I mean it's getting better about visualizing what it's doing.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
Anyone who has trouble with git internals should read chapter 10 of the Pro Git book: https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain

It’s enlightening.

Fruits of the sea
Dec 1, 2010

Really basic question here, but as I'm teaching myself Python from scratch I don't have a teacher to bug with it:

When should I be using for instead of a while loop? Seems like they both accomplish the same things with the only difference being that for establishes a variable and has a finite amount of possible loops. The book I'm using alluded to for being better coding convention, but didn't say why.

HamAdams
Jun 29, 2018

yospos

Fruits of the sea posted:

Really basic question here, but as I'm teaching myself Python from scratch I don't have a teacher to bug with it:

When should I be using for instead of a while loop? Seems like they both accomplish the same things with the only difference being that for establishes a variable and has a finite amount of possible loops. The book I'm using alluded to for being better coding convention, but didn't say why.

A for loop is generally going to be more convenient for iterating over a list

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


The general rule of thumb is to use a for loop when you know how many iterations the loop will take, and a while loop otherwise. Iterating over all the elements of a collection is always in the former case (although you probably want to use comprehensions if you can for performance reasons).

KillHour
Oct 28, 2007


ultrafilter posted:

The general rule of thumb is to use a for loop when you know how many iterations the loop will take, and a while loop otherwise. Iterating over all the elements of a collection is always in the former case (although you probably want to use comprehensions if you can for performance reasons).

Unless you modify the collection within the loop! :viggo:

Don't do this







Okay, you might want to do this if it's a queue or something, but you won't need to do this until you're a lot more experienced. For now, don't do this.

CarForumPoster
Jun 26, 2013

⚡POWER⚡

KillHour posted:

Unless you modify the collection within the loop! :viggo:

Agree for a list but is extremely common and necessary to loop over a pandas dataframe, modifying the elements in the rows.

KillHour
Oct 28, 2007


CarForumPoster posted:

Agree for a list but is extremely common and necessary to loop over a pandas dataframe, modifying the elements in the rows.

Modifying the elements in a loop is extremely common. Modifying the collection by adding or removing elements is not, and is the source of many bugs.

CarForumPoster
Jun 26, 2013

⚡POWER⚡

KillHour posted:

Modifying the elements in a loop is extremely common. Modifying the collection by adding or removing elements is not, and is the source of many bugs.

Yea agree that modifying the number of things you’re looping over within the list is a big red flag in code. Our new to python friend might not know the difference yet though.

KillHour
Oct 28, 2007


CarForumPoster posted:

Yea agree that modifying the number of things you’re looping over within the list is a big red flag in code. Our new to python friend might not know the difference yet though.

Which is why I wanted to call it out as something not to do, but thank you for helping clarify if it wasn't totally clear what I meant.

Quote
Feb 2, 2005
I'm coming to the end of a training course on Python 3. I have really enjoyed it, but now as the end looms I worry that I won't use it and will lose what I've learned.

I don't have a project in mind. I don't have anything that I want to build right now.

My question is, is there a sort of project list--or a collection of exercises-- designed to put what I've learned to the test? Like, exercises for the sake of understanding?

KillHour
Oct 28, 2007


Kaggle?

Dominoes
Sep 20, 2007

Sit down with coffee or whiskey. Maybe at home, maybe somewhere quiet outdoor, or maybe at a socially-distanced cafe. Think for a while. Read a hard-sci fi book, or talk with intellectually-curious friends.

Find something that should exist, but doesn't, or needs improvement. Think of what's feasible in the sci-fi world, but absent from our own. Think to the things that frustrated you recently. What have you lamented, that could perhaps address instead?

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
There are some sites which use applied programming to solve problems.

Project Euler is one if you have an interest in math

If you want to learn how modern cryptography works, and how to code break, you might enjoy https://cryptopals.com/

Really, it depends most on what you're interested in.

Macichne Leainig
Jul 26, 2012

by VG
At least in the spirit of the season, there is the Advent of Code. Might test your algorithmic skills more than anything, but it's always pretty fun.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Quote posted:

I'm coming to the end of a training course on Python 3. I have really enjoyed it, but now as the end looms I worry that I won't use it and will lose what I've learned.

I don't have a project in mind. I don't have anything that I want to build right now.

My question is, is there a sort of project list--or a collection of exercises-- designed to put what I've learned to the test? Like, exercises for the sake of understanding?

Think about some everyday (or week/month/year) thing you you could automate. Doesn't matter if you'll spend more time writing the script than you'd ever save from running it.

For example, on my todo list is automatically downloading a copy of new financial statements (bank, brokerage) once a month for safekeeping. It's not hard to do this manually once a year or so, and none of the issuers have an official API so it's not gonna be an efficient use of time, but it's a good excuse to learn and practice.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Volmarias posted:

There are some sites which use applied programming to solve problems.

Project Euler is one if you have an interest in math

If you want to learn how modern cryptography works, and how to code break, you might enjoy https://cryptopals.com/

Really, it depends most on what you're interested in.

There's also Rosalind for bioinformatics.

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Quote posted:

I'm coming to the end of a training course on Python 3. I have really enjoyed it, but now as the end looms I worry that I won't use it and will lose what I've learned.

I don't have a project in mind. I don't have anything that I want to build right now.

My question is, is there a sort of project list--or a collection of exercises-- designed to put what I've learned to the test? Like, exercises for the sake of understanding?

Pick a project. What do you like to do? What do you wish existed?

Hadlock
Nov 9, 2004

Quote posted:

I don't have a project in mind. I don't have anything that I want to build right now.

My question is, is there a sort of project list--or a collection of exercises-- designed to put what I've learned to the test? Like, exercises for the sake of understanding?

I have an email thread to myself I just keep replying to, every time I get an idea

Here are some popular ones

1. Twitter for zombies
2. Jira project management clone
3. Web service to send encrypted secrets
4. Markdown to HTML (static website renderer)
5. Pick your favorite board game, then build a CLI version of it. Games primarily based on cards/tokens and no board are easiest (I did Sushi Go! and Jaipur)
6. A UCI compatible chess engine (interface is very similar to talking to an AT modem)
7. Django based blog

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Edit: Wrong general questions thread LOL

Hyvok
Mar 30, 2010
Hmm, is there an active topic for making websites/blogs for profit? I remember a thread like that but can't find it right now.

Dawncloack
Nov 26, 2007
ECKS DEE!
Nap Ghost
I am trying to program a CSV parser in bash.

When I check the file in libreoffice write I can see that each "entry" (you'll see why I don't call it line) finishes with a carriage return "↵", the type that libreoffice produces when I push shift+enter.

However, for some reason that I cannot understand, the automatically produced CSV files come with a pilcrow sign "¶", (the kind that I get when I push plain enter) at points that look random to me. At first I thought that it might be at about the time a normal A4 page ends, but nope.

I think I would be set if I could just erase whatever the pilcrow sign represents. However, looking at unicode and stuff I see paragraph and line separator, both represented by "↵" and associated with the plain enter key.

I know how to make a sed and erase all the newlines, but I have no idea what symbol the pilcrow sign would be, or even if there are two symbols and I can erase one or not the other. At least libreoffice seems to think they are different.

Does anyone know encodings and stuff and can give me a suggestion?

Also, I see powershell threads but is there a bash thread or an "open source shells" thread?

TIA

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Hyvok posted:

Hmm, is there an active topic for making websites/blogs for profit? I remember a thread like that but can't find it right now.

I would assume that any thread like that would have died around 2010

Kilson
Jan 16, 2003

I EAT LITTLE CHILDREN FOR BREAKFAST !!11!!1!!!!111!

Dawncloack posted:

I am trying to program a CSV parser in bash.


I know how to make a sed and erase all the newlines, but I have no idea what symbol the pilcrow sign would be, or even if there are two symbols and I can erase one or not the other. At least libreoffice seems to think they are different.

Does anyone know encodings and stuff and can give me a suggestion?

hexdump -C <file>

That will show you the hex encoding for all the characters in your file. Look at an ascii table to see what those numbers mean for certain characters that only show up as whitespace or whatever

Dawncloack
Nov 26, 2007
ECKS DEE!
Nap Ghost
^^^ you sir, madame or nonbinary being, you are cool. Thanks.

Hadlock
Nov 9, 2004

Dawncloack posted:

I am trying to program a CSV parser in bash.

Mostly for my own curiosity, why are you using sed, rather than awk for this task? Awk seems purpose built for this task, and both are preinstalled on most systems

Adbot
ADBOT LOVES YOU

Dawncloack
Nov 26, 2007
ECKS DEE!
Nap Ghost
Because I havent learnt any awk yet, is the honest answer. I am a stupid newbie. But hey, if you think that I'll force myself to do it with awk. Gotta get there at some point.

Edit: now that I think of it, there moght have been a misunderstanding. I was thinking of using sed to eliminate the unwanted line breaks, not for parsing. I was going to parse the csv with read and comparison or something like that. But I bet awk is better. That will be my christmas project.

Dawncloack fucked around with this message at 09:43 on Dec 15, 2020

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply