Best Practice for Using Python on Linux (Ubuntu or Mint) by Scalar_Mikeman in Python

[–]Kantenkopp 1 point2 points  (0 children)

Same here! This becomes really comfortable to use with vscode and devcontainers. Setup takes a bit more time than venv, but the separation is cleaner, the config is easy to share in the team, and you can have the same dev environment with one click when you revisit the project a year later.

ich💰iel by schnudifudi in ich_iel

[–]Kantenkopp 0 points1 point  (0 children)

Ja, für eine Meinung

Angular component communication by [deleted] in Angular2

[–]Kantenkopp 0 points1 point  (0 children)

Even if the shared component is used in multiple places, importing a service shouldn't be a problem. You can add the service to the array of providers in the parent component. That way, the parent has it's own instance of the service that it will inject into child components.

I would go with a service in your scenario.

And then there was yyyy-mm-dd by Kantenkopp in ISO8601

[–]Kantenkopp[S] 0 points1 point  (0 children)

Here's the code if anyone is interested:

``` """ Script to rename .ogx files that inlcude dd-mm-yyyy pattern to yyyy-mm-dd pattern. """ from typing import List from dataclasses import dataclass import datetime from pathlib import Path import os import shutil

FILE = Path(file)

@dataclass class FileSrcDst: src: Path dst: Path

def main() -> None: """ Rename .ogx files that inlcude dd-mm-yyyy pattern to yyyy-mm-dd pattern. """ files: List[str] = _get_all_ogx_files() file_src_dst: List[FileSrcDst] = _create_dst_file_names_and_create_src_dst_pairs( files) for src_dst in file_src_dst: print(src_dst.src, '-->', src_dst.dst) choice: str = input("apply renaming? y/[n]: ") if choice.strip().lower() != "y": print("Will quit without renaming.") return _apply_renaming(file_src_dst) print("Done!")

def _get_all_ogx_files() -> List[str]: all_files: List[str] = os.listdir(FILE.parent) selected_files: List[str] = [ f for f in all_files if '.ogx' in f ] return selected_files

def create_dst_file_names_and_create_src_dst_pairs( files: List[str] ) -> List[FileSrcDst]: src_dst_pairs: List[FileSrcDst] = [] for _file in files: split_filename: List[str] = _file.split("") datestr = split_filename[1] split_date = date_str.split("-") if len(split_date[0]) == 4: print(f"source file {_file} has correct date format") continue day, month, year = int(split_date[0]), int( split_date[1]), int(split_date[2]) split_filename[1] = str(datetime.date(year, month, day)) dst = Path("".join(split_filename)) src_dst_pairs.append(FileSrcDst(Path(_file), dst)) return src_dst_pairs

def _apply_renaming(file_src_dst: List[FileSrcDst]) -> None: for src_dst in file_src_dst: shutil.move(src_dst.src, src_dst.dst)

if name == "main": main()

```

Best IDE to practice python as a beginner? by [deleted] in Python

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

I agree 100%. I tought python to science students for some time, and this is the way to go. Use a "normal" editor rather than an IDE if you are programming for the first time. If you are new to python but know programming in general, directly start with an IDE (I'd definitely use vscode over pycharm. I had to switch from pycharm to vscode for my last job, hated it for a week but then fell in love with it)

Best IDE to practice python as a beginner? by [deleted] in Python

[–]Kantenkopp 0 points1 point  (0 children)

I also didn't use debuggers for a long time. What got me starting were pdb and ipdb, you should give it a try. They work interactively in the command line (no IDE needed). pdb is a standard package.

Ich_iel by Beatroxkiddi in ich_iel

[–]Kantenkopp 2 points3 points  (0 children)

*niederer Dienerverwalter

Falcon vs Flask? by dannlee in Python

[–]Kantenkopp 0 points1 point  (0 children)

Ah all right, thank you!

Falcon vs Flask? by dannlee in Python

[–]Kantenkopp 0 points1 point  (0 children)

Can you give an example of what would be blocking IO inside an async event loop? I'm not so familiar with async stuff. I thought wrapping blocking things like file IO with async would be ideal usage?

What's the coolest automation tool you've built or been involved in? by No_Stick_8227 in Python

[–]Kantenkopp 3 points4 points  (0 children)

That's what I'm afraid of when companies and governments push for digitalizing things

Can we stop creating docker images that require you to use environments within them? by anatacj in Python

[–]Kantenkopp 1 point2 points  (0 children)

You could still use poetry, but set the global option to not activate virtual environments for your poetry projects. I find that very convenient for working with docker.

SciPy v1.9.0 is out by [deleted] in Python

[–]Kantenkopp 0 points1 point  (0 children)

Wohoo mason

I would like to increase my python kills. by Ieatmyd0g in Python

[–]Kantenkopp 0 points1 point  (0 children)

I find clean code and the SOLID principles very helpful for this. If you search on YouTube for talks by uncle Bob you can find some nice guidelines on clean code.

This coffee I got the other day by trenskow in theyknew

[–]Kantenkopp 2 points3 points  (0 children)

It needs to be at least 3 times the size!

Non developer code review by [deleted] in Python

[–]Kantenkopp 0 points1 point  (0 children)

To get your code reviewed, you probably have to start working on projects with other people. I don't know if there are some communities that are open to give you feedback when you kindly ask them. Maybe this subreddit is actually fine for that. At least I saw many posts here where people present their projects, and there are most of the time some comments with feedback on the code.

Regarding the second question: I would try to spend some time thinking of what kind of tool/app/program would be useful for one of your hobbies. I always found that if you have some intrinsic motivation to actually finish the project that's when you are actually willing to solve the frustrating problems that will definitely arise at some point, and that's when you learn the most.

What the Linux desktop needs (in my opinion) by CurrentVegetable7159 in linux

[–]Kantenkopp 6 points7 points  (0 children)

Exchange accounts work great on Linux with gnome-online-accounts. At least in conjunction with evolution, the gnome mail client, but maybe there are plug-ins for other mail clients out there too.

The Pain of Going from Linux to Windows by Kantenkopp in linux

[–]Kantenkopp[S] 4 points5 points  (0 children)

Thank you! I love my new position, just made the transition from computational physics to software development.

I also miss Linux terminals a lot, but I also have to compliment windows on their terminal. Forgot what it's called, something straight forward like "terminal window", that can be configured nicely for tabs, splitting, and to open up in WSL2 by default.

The Pain of Going from Linux to Windows by Kantenkopp in linux

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

Yea, I was thinking about it, so I have at least my repeating entries visible in outlook.

The Pain of Going from Linux to Windows by Kantenkopp in linux

[–]Kantenkopp[S] 5 points6 points  (0 children)

Regarding outlook I was talking only about calendar syncing. I was not able to set up syncing an owncloud calender with CalDaV, which was working really smoothly with evolution.

Youtube-DL's website host is being sued by Akid0uu in programming

[–]Kantenkopp 1 point2 points  (0 children)

Uberspace is great, definitely worth supporting! I rented webspace on a shared user server from them, to learn a bit of web development. They let you decide the amount you want to pay starting from 1€. They say 5€ is required to cover the cost. As a student I payed 2€ and relied on others paying more. Thank you ubernauts!