Paul Sutton

Programming

Code Club – Simple Python 3 Functions

As we are learning Python at Code Club, I am going to make some related posts looking at the very basics of this. We are using Trinket.io for this

Firstly open a new Python Trinket

Firstly we are going to tell the interpreter to use python3.

#!/usr/bin/env python3 #use python 3

We are going to create a function called print_name() and then call it. The function will just print hello to the standard output.

def print_name():
  print ("hello")
  
print_name()  

So this in does the same as what

print ("hello")

To the next step is to run the function several times.

We could run

print_name()  
print_name() 
print_name() 

However it is probably better to put the print_name() in a loop, so it calls the function a specified number of times (in this case 4)

for x in range(0,4):
  print_name()

So this will now call the print_name() four times (or however many times is specified.

Assuming this works, we can now add some user interactivity

y = input("iterations")

As we are dealing with numbers (integers) than y will be a string we fix this in the line for x in range(0,int(y)): int(y) will convert string y in to integer y

Final program looks like this:-

def print_name(y):
  print ("hello")

y = input("iterations")
for x in range(0,int(y)):
  print_name(y)

Will ask for user input, store this in the variable y, as an integer. It run a loop which calls the function y times. Which in turn prints hello.

If you add the line

print(y)

After the

print("hello") 

Line, then the program should output a number count for each iteration. This can be a useful too for debugging loops. This will also make use of the fact we are passing the value of y to the function.

Links

Tags

#CodeClub,#Programming,#Education,#Python.#Functions

Code Editors

The two main code editors that are on the Raspberry Pi are Thonny and Geany

Thonny

Thonny appears to be written in Python,but also specific for editing python code, the screen shot appears to be from a different version to that on the Code Club Pi's but both are fine for editing code. I may just need to update the pi we were using though.

Geany

Geany is more of a general purpose and supports many different languages from Python, C, Ruby, php as well as HTML / CSS.

Both editors are fine.

Tags

#Thonny,#Geany,#Programming,#Code,#Editors

How to contribute to Nextcloud

This was posted to Mastodon by the Nextcloud team.

Video

Links

Tags

#Nextcloud,#Development,#Contrubution,#Software,#Programming,

Python video tutorials

Just found a series of videos on Peertube which cover the Python 3 Programming language.

Worth a look, as different tutorials can present the same material in a different way, sometimes this is really helpful.

Tags

#Tutorial,#Python3,#Programming

Jupyter Notebook intro

If you are interested in Sciences and I think with this specifically data science or science generally then it seems that Jupyter notebook is very popular and powerful tool.

The following is an introductory video.

Jupyter Notebook Tutorial: Introduction, Setup, and Walkthrough

Links

If there is interest, perhaps we can look in to this at a future STEM group meeting and try and invite someone along who may be able to help explain and or demonstrate further.

Tags

#Programming,#Data,#Jupyter,#Notebook,#Python,#R,#Visualisation, #JupyterNotebook

CyberSecurity part 24

Functional Programming in Coq

Staying on the theme of programming and cybersecurity, this course is about Functional Programming in Coq and was mentioned on the Libreplanet discuss mailing list. It may be useful generally as a way to learn skills that can be applied to other languages or just generally.

#CyberSecurity,#Coding,#Functional,#Programming,#COQ

ToriOS Internship Program – version 1.0

  • We need people who enjoy #programming and want to do it for fun, to create really nice small things that can be used easily by almost anyone.
  • All levels of programming are fine.
  • People need to have #motivation to do this because they want to, themselves. They need motivation to learn more because they are growing.
  • They must have the ability to #fail and #learn from it.
  • As long as those exist, #skills will come. Anything anyone already has to begin with is fine.
  • Rust, serde, FLTK, DBus, X11/etc, XDG, lexer, TUI, Linux, Every Window Manager there is, Rust coreutils/chroot/squashfs?/etc for building, TOML/JSON/INI/etc, HIG/UI/UX accessibility, Bash scripting.

Goals:

1- Oxidize the C++ programs used in ToriOS, and improve them. 2- Oxidize the scripted builds. 3- Oxidize the scripts used in ToriOS, and use serde for configuration, support multiple formats in and out. 4- Build separate libraries for separate tasks. Many small libraries that can be reused are better than one big one for everything. 5- Bring these components together and create a desktop environment using any window manager. 6- Replace GNU with Rust equivalents to make Oxidized Linux as the base of the operating system. 7- Configure multiple window managers using the same graphical tool, allowing for the conversion of one window manager format to another, seamlessly. 8- build menus for window managers with an oxidized menu generator. 9- Oxidize FLTK applications menu program. 10- Make portrait and landscape layouts for the desktop. Using dbus to load things when needed.


Longer term wish list goals:

1- Rust + FLTK to create a modern panel/tray system. 2- Handle the virtual desktops, use ~/Desktop.d/... for handling multiple desktops with multiple icon layouts. Just a desktop manager, not a file manager. 3- Build our design of a very modular onscreen keyboard. 4- Make all GUI apps display a TUI when no $DISPLAY exists. 5- Volume manager to trigger whatever events are configured. 6- Pre-built Phone images to flash as well as ISOs to download. 7- replace any GTK specific programs with Rust + FLTK versions. 8- use a native Rust GUI toolkit when one is mature enough.


Note:

The word [#Oxidize] is used to mean converting an older program to use Rust, instead of whatever programming language it was originally written in.


IF AND ONLY IF YOU MEET ALL THE REQUIREMENTS, please apply by sending an email to: [ ali AT torios DOT top ]

  • Subject Line must contain [ToriOS Internship ver 1.0]
  • Introduce yourself – mention your REAL name.
  • Country – wherever you currently live.
  • Written consent that have read + agree on each and everything mentioned in this post.
  • Please explain WHY you think I should let you in?
  • NO begging please. Begging means reject.
  • DO NOT send any Resume/CV because that means reject.

Internship

#Linux. #Debian,#Ubuntu,#volunteering,#Jobs,#ToriOSInternship

Tilde – text editor

Donate using Liberapay

Tilde is a nice, curses based text editor. It is useful for if you are at the console or terminal in Linux and want a menu driven editor.

tilde

While other tools are more command driven (nano, emacs, vi, vim and joe to name a few). Tilde is being mentioned for those of you who may find it useful

As you would expect with a modern editor, tilde has support for syntax highlighting.

Tilde Syntax Highlighting

Which is really useful for programming or editing website code for example.

REFERENCES

TAGS

#YearOfTheFediverse,#Linux,#TextEditor,#Editor,#Text, #Tilde,#Programming,#SyntaxHighlighting,#console, #terminal

Creative Commons Licence
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

Open CV Tutorial

Open Computer Vision Tutorial. This looks interesting and something else to have an experiment with at some point. Would also be good at the Paignton Library STEM group meetings.

Posted to Mastodon on 23/12/2021 by Danie

Links

Tags

#technology #opensource #programming #coding #Python #OpenCV

Book on Haskell

If anyone is interested in learning Haskell, then this book may interesting :-

Links

Tags

#Coding,#Programming,#Language,#Haskell