Git

Python-advanced level-seminar: lifelong learning

Written by  on May 9, 2018

I am currently traveling back from my very first paid educational leave. Proper selection, arrangement and preparation lead to some awesome impressions: about the capabilities of Python and about the city of Detmold.
Daniel Warner lead us – an assembly of five inquisitive men in the age-range from 30 to 60 – along the details and
specialties of that programming language. I learned much, in detail:

  • basic structures; list comprehension
  • classes; objects; overrides; imports; representation; init-method
  • dictionaries for caching results (memoisation)
  • decorators (nice for for printing, caching and thread-safety)
  • descriptors, properties and slots, kwargs
  • (multi-)inheritance and its quirks
  • recursive functions; functional programming
  • threads, synchronisation, atomic access

I put all the exercises (full script with my own annotations) into a Git-repository right from the beginning and published it:ย https://github.com/marcelpetrick/Python_FortgeschrittenenSeminar/.
Which also makes a nice view of the github-history ๐Ÿ™‚

Python was chosen by me by intent: I see and plan for ways to use it with artifical intelligence (TensorFlow-binding ..); microcontroller-programming (ESP can run MicroPython) and for the Raspberry (currently the tumblr-upload-script for the catcam is also Python); for daily data-manipulation-tasks which are currently done more or less on Bash or AutoIt or Batch – and then: write it once, run it both on Linux and Win).
This was a great choice! And I want to thank my wife for supporting these stays absent from home and my plan to achieve the wanted education ๐Ÿ™‚ And I got a small certificate – but that’s just icing on the cake.

My plan as first real exercise is to re-implement the “find all islands in the given map”-programming challenge. This will be fun. Getting to know some specialties and what properties/slots mean in Python-context (compared to the Qt-ones) was nice. And the decorators are a really powerful way to add special functionality to methods without bloating them and without blocking the view to the busines logic.

visualise your github <3

Written by  on May 8, 2018

Will create a nice overview of your projects, the amount of commits and the used languages. I like it ๐Ÿ™‚
http://ghv.artzub.com/#user=marcelpetrick

export a git-repo as a bundle

Written by  on July 31, 2017

Archiving the whole directory is also an idea, but why not use the integrated functionality?
More hints: https://stackoverflow.com/a/5578292/1694302

export to a single file (bunlde):
git bundle create ../SAP_autoIt_bundle --all

recreate:
git clone SAP_autoIt_bundle myClonedFolder

clean my code: reloaded!

Written by  on June 21, 2017

As always: some projects need a first (working) implementation and then over time you can improve them.
During lunch I was talking with a colleague about this tool. Then the idea to just use those actually changed files from the current implementation (means: the current branch in Git) shall be used as input. Et voila: consider it done!
Also added some fine-tuning to the call-parameter of the script itself, so it can be run as well with some custom string beside “todoM” (which is my marker).

Cleaning an implementation of properly tagged lines takes now a second – not minutes (like before!
Enjoy and have fun ๐Ÿ™‚

Code can be found as always at https://github.com/marcelpetrick/cleanMyCode/blob/master/remove_todoM.sh

Get rid of the master-branch @ github

Written by  on October 30, 2016

issue:

solution:

  1. create a fake branch and push it
  2. go to github > $your_repo > settings > branches > default branch and make the fake branch the current one
  3. delete master
  4. push new master
  5. revert the default branch

Mixing SVN and Git

Written by  on October 23, 2016

When you join a new team, you don’t enforce your view of best tools of trade – instead you adapt to the new environment. Even if that means that you have to switch from your favorite CVS (Git) to something you used last time in 2008 (Subversion) …
I am aware, that the Git-client is fully backward-compatible to SVN and also able to do the most common tasks. But for me it was the branching model, the stashes and also the GUI from SmartGit, which lead me to the idea: why not mix both version-controls in one directory?

steps:

  1. clone the repository via SVN (TortoiseSVN)
  2. run $ git init
  3. add the following stuff to your .gitignore:
  4. add the following exclusions to your TortoiseSVN > Settings > General > Subversion > Global ignore-pattern:
  5. stash, branch, stage as much as you want – use TortoiseSVN for the final commit, which should be published to the team

I use this set-up now for some weeks and it works. Saved me lots of hassles. Because I have not figured out (yet?) how to create local “mile-stones” as safety-backup with SVN.

“If Microsoft ever does applications for Linux it means I’ve won.”

Written by  on September 23, 2016

~ Linus Torvalds

I’ve given Visual Studio Code for Linux as prebuilt rpm-package a try. I don’t know what I expected ten minutes ago, but I am definitely under-whelmed! Another editor with syntax-highlighting, code-completion, integrated git-support and the ability to add “extensions” for all kinds of stuff. But: do I miss the trick or how do I start build binaries? (edith: possible via some “we need another build-configuration-system..”-JSON).

vscode

OK, it was fun to test, but now back to my favorite IDE* ๐Ÿ˜‰ gedit & gcc on the terminal can do the same, so I don’t see any reason to use VS Code.ย  Maybe for Go or one of the other languages, but not C++.

*QtCreator

QtScrobbler (final cut)

Written by  on October 22, 2015

Just to close the topic: I finished what I planned for the forked QtScrobbler-project. I changed the workflow, so that if you did not provide correct credentials for your favourite submission-site (last.fm, libre.fm ..), then the progress-dialog will be closed and you will see immediately the error in the ui (not just log). Because before the user could wait until the cows come home – and I found this really annoying, especially when I set up QtScrobbler on a new system, mistyped or forgot to set the credentials at all.
Besides: also cleaned the code a little bit with the help of cppcheck ๐Ÿ˜‰

The repository: https://github.com/marcelpetrick/QTScrobbler

All in all it was a nice experience: set up GitHub, clone the repository, work into a medium large project, try to fix an error without breaking the remaining functionality ..
I do not fully agree to the original code of conduct for style and includes. But as long as it is comprehensive ..

My first (?) offical fork?

Written by  on October 2, 2015

I want to fix several smaller, but annoying issues with QtScrobbler. Originally hosted on sourceforge, but development was discontinued in 2013. I mean: it worked. I used it for years with my upgraded SANSA clips.
So I forked the project to github, upgraded the whole project to the current Qt-version (5.5) and fixed immediately some ‘klein-klein’. But now I am too tired …

createContactSheet 0.3

Written by  on June 13, 2015

I fixed a small glitch, which was included in the first releases: input-filenames with spaces were not treated correctly therefore no result was created. Fixed by some string-replacement and setting the IFS-variable which dictates that bash should treat spaces not as separators.
For the next release some filename-embedding into the thumbnail is planned. But this has to happen after the negfix8-conversion else it would alter the conversion itself ..

Download this: version_0.3

Small hint: git offers a really nice exporting-function which will just include the current state of the given branch: