Paul Sutton

troubleshooting

Code Club 17/9/2022

The next Paignton Library code club is on 17th September. There will be the usual mix of coding, troubleshooting and discussions. I

We now have some of the Vodafone resources so will be sharing them if anyone is interested.

We still have a few printed resources, which will be binned if no one wants them. Simple fact is, we are running out of space.

Links

Tags

#CodeClub,#Information,#RaspberryPi,#Troubleshooting, #esafety,#misinformation,#SenseAboutScience,#Vodafone, #DigitalParenting,#StudySkills

Next session

  • Next Week is the STEM Group meeting 10/9/2022
  • Next Code Club is Saturday 17th September 2022.

Please contact Paignton Library for details and booking.


MastodonPeertubeQoto sign up

Donate using Liberapay

Code Club 3/9/2022

The next Paignton Library code club is on 3rd September. There will be the usual mix of coding, troubleshooting and discussions. I should have some e-safety resources too.

Links

Tags

#CodeClub,#Information,#RaspberryPi,#Troubleshooting, #esafety,#misinformation,#SenseAboutScience,#Vodafone, #DigitalParenting

Next session

  • Next Week is the STEM Group meeting 10/9/2022
  • Next Code Club is Saturday 17th September 2022.

Please contact Paignton Library for details and booking.


MastodonPeertubeQoto sign up

Donate using Liberapay

Code Club 20/8/2022 Write up

So we had another quiet session today, with 4 young people, plus a parent, nevertheless it was productive. Time was initially split between looking for an iphone cable (could not find one), and also troubleshooting a Raspberry Pi, which seemed more successful.

There was also a discussion on e-safety, in terms of posting online and how this can have consequences later on, employers can do searches on applicants for example and also what to post, also a brief discussion on asking for evidence and finding proper, credible information on the internet, I did give peer review a brief mentiobn

It seems really beneficial to have conversations.

This has prompted me to dig out a few resources I have here at home. These are set to one side for the next session. I have also asked the library if they can send off for some copies of the Vodafone digital parenting resource.

We also have access to a tablet with the Lego WeDo software installed so if anyone is interested they can have a go at code club without having to bring along own devices. However attendees can, it really helps as you can store projects on your own device.

Links

Tags

#CodeClub,#Information,#RaspberryPi,#Troubleshooting, #esafety,#misinformation,#SenseAboutScience,#Vodafone, #DigitalParenting

Next session

  • Next Code Club is Saturday 3th September 2022.

Please contact Paignton Library for details and booking.


MastodonPeertubeQoto sign up

Donate using Liberapay

Use pastebin from command line

Use pastebin from command line

Quite often, when you have a problem where, in order to get help you need to paste the contents of a file,or command output so that it can be shared, for example on IRC (Chat) or a forum, this can be challenging to begin with.

As it is depreciated that you paste more than 2 lines in to IRC chat. The way round this is to use a service called pastebin. Debian [1] has it's own service for this [2]. There is a tool called pastebinit which is really helpful from the command line.

The first step is to switch to the root user. Sear for and install the package pastebinit as per below.

Search

root@Desktop:/home/user# apt search pastebinit
Sorting... Done
Full Text Search... Done
pastebinit/stable 1.5.1-1 all
  command-line pastebin client

Install

root@Desktop:/home/user# apt install pastebinit
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-image-5.10.0-7-amd64 linux-image-5.10.0-8-amd64
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  pastebinit
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 46.6 kB of archives.
After this operation, 342 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 pastebinit all 1.5.1-1 [46.6 kB]
Fetched 46.6 kB in 0s (342 kB/s)
Selecting previously unselected package pastebinit.
(Reading database ... 190310 files and directories currently installed.)
Preparing to unpack .../pastebinit_1.5.1-1_all.deb ...
Unpacking pastebinit (1.5.1-1) ...
Setting up pastebinit (1.5.1-1) ...
Processing triggers for man-db (2.9.4-2) ...
root@Desktop:/home/user# 

Once complete switch back to normal user (usually type exit)

user@Desktop:~$ cat /etc/apt/sources.list > pastebinit
user@Desktop:~$ cat /etc/apt/sources.list | pastebinit
https://paste.debian.net/1228146/

In this example I have used the cat command and piped the contents in to pastebinit, this has given me a url to paste in to chat, (or copy manually)

Open this in a browser and you and others can see the contents, and people can help you further.

paste bin it output

This is really useful too if you are stuck at the command prompt, without a graphical interface.

Links

1 Debian 2 pastebin – debian 3 Paignton Library STEM Group TAGS

#Debian,#GNULinux,#Paste,#Text,#Pastebin,#Share,#Troubleshooting


Donate using Liberapay

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


MastodonPeertubeQoto sign up

Donate using Liberapay

LaTeX and Overleaf – Changing the compiler

A question came up on IRC earlier about Overleaf, LaTeX and compiling to use the \usepackage{arabluatex} package.

I suggested that it is possible to change the compiler to use LuaTeX and made the following video to help others with this

#Overleaf,#LaTeX,#compiler,#pdfLaTeX,XeLaTeX,LuaLaTeX, #typesetting,#troubleshooting,#tech,#science,#document, #report,#writing,#author,#authoring #thesis,#creative,#creating

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


MastodonPeertubeQoto sign up

Donate using Liberapay

Add more functions

I have added a few more maths functions to the application and also provided a clear function. There are still a few items to add to help improve debugging but the application is starting to take shape.

Notes

window = Tk()
window.title('Maths Application')
window.geometry("570x150") # w x h
window.resizable(0,0)
  1. The above code is being modified as I go. So I am changing the window size depending on what is being displayed.

  2. I have also made the Window title reflect the purpose of the application.

  3. That the source code now has 'result' as a label rather than output. This will show up future screenshots.

addition app

The code for the above is as follows.

#!/usr/bin/env python
import Tkinter # note use of caps
from Tkinter import *

window = Tk()
window.title('Maths Application')
window.geometry("570x150") # w x h
window.resizable(0,0)

#define button actions
def btn1():
	#convert box text in to integers	
	ent1 = int(entrytext.get())
	ent2 = int(entrytext2.get())
	
	#add the 2 integers and store in variable add
	add = (ent1 + ent2)
	print (add)
	
	#insert value of variable add in	to box outtext 
	outtext1.insert(0,str(add)) # insert response

def btn2():
	#print("subtraction")
	ent1 = int(entrytext.get())
	ent2 = int(entrytext2.get())
	
	#subtract the 2 integers and store in variable sub
	sub = (ent1 - ent2)
	
	
	#insert value of variable sub in	to box outtext 
	outtext1.insert(0,str(sub)) # insert response	
	
def btn3():
	#print("multiply")
	ent1 = int(entrytext.get())
	ent2 = int(entrytext2.get())
	
	#multiply the 2 integers and store in variable mul
	mul = (ent1 * ent2)
		
	#insert value of variable mul in	to box outtext 
	outtext1.insert(0,str(mul)) # insert response		

def btn4():
	#print("divide")
	ent1 = int(entrytext.get())
	ent2 = int(entrytext2.get())
	
	#multiply the 2 integers and store in variable div
	div = (ent1 / ent2)
		
	#insert value of variable mul in	to box outtext 
	outtext1.insert(0,str(div)) # insert response	
	
#clear boxes
def clear():
	#print("clear boxes") # leave in for legacy testing
	entrytext.delete(0, END) # clear input box
	entrytext2.delete(0, END) # clear input box2
	outtext1.delete(0, END) # clear output box
	
btn_tog2 = Button( window, text ='+', command=btn1) # add
btn_tog3 = Button( window, text ='-', command=btn2)  # subtract
btn_tog4 = Button( window, text ='x', command=btn3) #multiply
btn_tog5 = Button( window, text ='/', command=btn4) #divide
btn_tog6 = Button( window, text ='Clear', command=clear) #clear
btn_exit = Button( window, text ='Exit',command=exit)	 #exit

# define some labels
box1 = Label(window, text="1st Value")
box2 = Label(window, text="2nd Value")
box3 = Label(window, text="Result")

#define entry box 
entry1 = StringVar() # this is our entry box
entry2 = StringVar()
entrytext = Entry(window, textvariable=entry1) # this is our entry box
entrytext2 = Entry(window, textvariable=entry2) # this is our second entry box

#define out box 

entry2 = StringVar() # this is our output box
outtext1 = Entry(window, textvariable=entry2) # this is our output box

#display boxes
entrytext.grid(row = 3, column = 2,)  #display entry box
entrytext2.grid(row = 3, column = 3,)  #display entry box
outtext1.grid(row = 3, column = 4,) #display output box

#place labels
box1.grid(row = 1	, column = 2, padx = 5, pady = 5)
box2.grid(row = 1	, column = 3, padx = 5, pady = 5)
box3.grid(row = 1	, column = 4, padx = 5, pady = 5)

#buttons
btn_tog2.grid(row = 4, column = 2, padx = 1, pady = 1) # addition button
btn_tog3.grid(row = 4, column = 3, padx = 1, pady = 1) # subtraction button
btn_tog4.grid(row = 5, column = 2, padx = 1, pady = 1) # multiply button
btn_tog5.grid(row = 5, column = 3, padx = 1, pady = 1) # divide button
btn_tog6.grid(row = 4, column = 6, padx = 1, pady = 1) # clear button
btn_exit.grid(row = 3, column = 6, padx = 1, pady = 1) # exit button

window.mainloop()


The code that I used for a previous application to detect if numerical values have been used is below but provided 'as is' for now.

def response():
		
	msg = "error : must be a text value"

	i = circletext.get()
	y = i.isdigit()
	l = len(circletext.get())
	#print l
	if y == True or l == 0:
		circletext.insert(0,(msg))
		
	else:	
		x = random.choice(RESPONSES)
		circletext2.delete(0, END) # clear prev output
		circletext2.insert(0,str(x)) # insert response

I will integrate a version of this in to the main code.

#python, #tkinter, #programming, #python, #graphic, #applications, #bugs, #troubleshooting, #howto, #paignton, #library, #virtual, #codeclub

Happy to provide help and support via decentralised social media. I can be contacted on Mastodon here. You can get a free account on the http://qoto.org instance by following this link.

cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)


MastodonPeertubeQoto sign up

Donate using Liberapay

Addition Application

So following on from the previous posts, I am how sharing a small application, that makes use of what we have been learning.

This presents 2 input boxes and an output box, any values entered in to the first two, the sum is placed in to the last box.

addition app

This is not perfect, but getting there slowly.

We need to:-

  • Fix the name of the button from button1
  • Detect if the user has entered numerical values
  • Detect for empty boxes
  • Make labels more useful
  • Fix spelling in comments
  • Fix clarity of comments

The code for the above is as follows.

#!/usr/bin/env python
import Tkinter # note use of caps
from Tkinter import *

window = Tk()
window.title('App 1')
window.geometry("650x125") # w x h
window.resizable(0,0)

#define button actions
def btn1():
	#convert box text in to integers	
	ent1 = int(entrytext.get())
	ent2 = int(entrytext2.get())
	
	#add the 2 integers and store in variable add
	add = (ent1 + ent2)
	print add
	
	#instert value add in	to box outtext 
	outtext1.insert(0,str(add)) # insert response
	
btn_tog2 = Button( window, text ='button1', command=btn1)
btn_exit = Button( window, text ='exit',command=exit)	

# define some labels
box1 = Label(window, text="Entry 1: ")
box2 = Label(window, text="Entry 2: ")
box3 = Label(window, text="Ouput1: ")

#define entry box 
entry1 = StringVar() # this is our entry box
entry2 = StringVar()
entrytext = Entry(window, textvariable=entry1) # this is our entry box
entrytext2 = Entry(window, textvariable=entry2) # this is our second entry box

#define out box 

entry2 = StringVar() # this is our output box
outtext1 = Entry(window, textvariable=entry2) # this is our output box

#display boxes
entrytext.grid(row = 3, column = 2,)  #display entry box
entrytext2.grid(row = 3, column = 3,)  #display entry box
outtext1.grid(row = 3, column = 4,) #display output box

#place labels
box1.grid(row = 1	, column = 2, padx = 5, pady = 5)
box2.grid(row = 1	, column = 3, padx = 5, pady = 5)
box3.grid(row = 1	, column = 4, padx = 5, pady = 5)

#buttons
btn_tog2.grid(row = 3, column = 5, padx = 5, pady = 5)
btn_exit.grid(row = 3, column = 6, padx = 5, pady = 5)

window.mainloop()

#python, #tkinter, #programming, #python, #graphic, #applications, #bugs, #troubleshooting, #howto, #paignton, #library, #virtual, #codeclub

Happy to provide help and support via decentralised social media. I can be contacted on Mastodon here. You can get a free account on the http://qoto.org instance by following this link.

cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)


MastodonPeertubeQoto sign up

Donate using Liberapay