Go to advanced search

by Paeryn
Fri Apr 19, 2019 2:56 pm
Forum: Python
Topic: placing 2-dim arrays into 3-dim sheets
Replies: 6
Views: 115

Re: placing 2-dim arrays into 3-dim sheets

if i==0, j==0, k==0: correl=np.expand_dims(matmul, axis=0) print "correl is", correl.shape, correl.dtype correl(i,j,k)=correl.itemset(i, matmul[j,k]) I get File "nameofprog.py", line 245 correl(i,j,k)=correl.itemset(i,matmul[j,k]) SyntaxError: can't assign to function call I don't see what is wrong...
by Paeryn
Fri Apr 19, 2019 3:51 am
Forum: Off topic discussion
Topic: Why Avoid BASIC on RPi?
Replies: 1794
Views: 70304

Re: Why Avoid BASIC on RPi?

I think the humble RPi3 does fairly well then considering those times :-

Code: Select all

[email protected]:~ $ time ./fib.sh |tail -c32
4856539211500699706378405156269

real    2m27.222s
user    2m27.130s
sys     0m0.050s
by Paeryn
Thu Apr 18, 2019 11:58 pm
Forum: The MagPi
Topic: Errors in An Introduction to C & GUI Programming.
Replies: 10
Views: 246

Re: Errors in An Introduction to C & GUI Programming.

My biggest gripe with C is macros, part of the language which can modify your source code before it gets compiled. Though at least nowadays gcc gives fairly decent warnings when it sees potential problems with the changes that they make.
by Paeryn
Thu Apr 18, 2019 2:08 pm
Forum: Python
Topic: Is anyone using GTK3 via PyGObject ?
Replies: 4
Views: 59

Re: Is anyone using GTK3 via PyGObject ?

I see what you mean. I've had a quick look and I think it intends to pass the widget and userdata as a tuple if userdata is non-null but it doesn't seem to be doing it. I'll look into it more later on, got to go food shopping in a bit.
by Paeryn
Thu Apr 18, 2019 12:38 pm
Forum: Python
Topic: Is anyone using GTK3 via PyGObject ?
Replies: 4
Views: 59

Re: Is anyone using GTK3 via PyGObject ?

A signal's userdata is stored in the XML file as the signal's object . <signal name="pressed" handler="onButtonPressed" object="button1" swapped="no"/> If your XML file uses userdata , e.g. <signal name="pressed" handler="onButtonPressed" userdata="button1" swapped="no"/> then that is invalid. I hav...
by Paeryn
Thu Apr 18, 2019 2:18 am
Forum: The MagPi
Topic: Errors in An Introduction to C & GUI Programming.
Replies: 10
Views: 246

Re: Errors in An Introduction to C & GUI Programming.

We are going to laugh our bits off in the office when Simon gets back. The return value from main is a long running saga. Suffice to say, this is not a technical reference, it's a guide for beginners. Not for those of a more pedantic persuasion. I realise that it's not a technical reference and the...
by Paeryn
Wed Apr 17, 2019 10:52 pm
Forum: Troubleshooting
Topic: Raspbian Kills Python GUI App If No User Input
Replies: 4
Views: 104

Re: Raspbian Kills Python GUI App If No User Input

Thank you for the reply. I used those commands and they perform their intended function, to prevent blanking of the GUI screen. That part works great. The problem is the blanking, sleeping or "powering down" of the terminal session, which seems to be a different functionality. I notice that the win...
by Paeryn
Wed Apr 17, 2019 9:16 pm
Forum: Troubleshooting
Topic: BASH clone of ZORK game (Help needed)
Replies: 7
Views: 180

Re: BASH clone of ZORK game (Help needed)

https://github.com/Void-Frost/raspberry-pi-essentials/tree/master/ZORK I need help on it because I'm having issues coding a function. It's barely been started, I'm not too far in yet. Could any of you help me with the function though? If it gets taken down, it gets taken down [ The first 3 hits fro...
by Paeryn
Wed Apr 17, 2019 4:42 pm
Forum: The MagPi
Topic: Errors in An Introduction to C & GUI Programming.
Replies: 10
Views: 246

Errors in An Introduction to C & GUI Programming.

After having a quick look at the new book "An Introduction to C and GUI Programming" there are a couple of errors in the first chapter. The first is that on page 11 it states that main() has a return type of void . No it doesn't, it has a return type of int . Worse, on page 18 it states There are al...
by Paeryn
Tue Apr 16, 2019 3:28 am
Forum: Off topic discussion
Topic: Why Avoid BASIC on RPi?
Replies: 1794
Views: 70304

Re: Why Avoid BASIC on RPi?

I have now. No change. Could the problem be related to Linux subsystem for Windows? No, I tested it on Linux Mint, I've updated my post above which shows gst clearly has a problem with certain LargeInteger maths on the PC (possibly a 64-bit problem?), will have to look at the source code for gst la...
by Paeryn
Tue Apr 16, 2019 2:02 am
Forum: Off topic discussion
Topic: Why Avoid BASIC on RPi?
Replies: 1794
Views: 70304

Re: Why Avoid BASIC on RPi?

Integer extend [ fibo [ | k fk fk1 | (self < 2) ifTrue: [ ^ self ]. (self = 2) ifTrue: [ ^ 1 ]. (self > 2) ifTrue: [ k := (self + 1) // 2. fk := k fibo. fk1 := (k - 1) fibo. (self odd) ifTrue: [ ^ (fk raisedToInteger: 2) + (fk1 raisedToInteger: 2) ] ifFalse: [ ^ ((2 * fk1) + fk) * fk. ] ] ] ] 8576 ...
by Paeryn
Mon Apr 15, 2019 2:38 pm
Forum: Off topic discussion
Topic: Why Avoid BASIC on RPi?
Replies: 1794
Views: 70304

Re: Why Avoid BASIC on RPi?

Was just working on that. I also have found what I was doing wrong when trying to deal with negative indices (which lead me to write it as a separate formula rather than the normal "calculate using the positive index and negate the result if it's an even index"). It's been a long time since I used P...
by Paeryn
Mon Apr 15, 2019 1:53 pm
Forum: Off topic discussion
Topic: Why Avoid BASIC on RPi?
Replies: 1794
Views: 70304

Re: Why Avoid BASIC on RPi?

Prolog. Someone do it in Prolog. That's a dare! Ask and ye shall be given ;-) Not very elegant and it's the basic slow method rather than a fast one but it does handle negatives. [email protected]:~/Programming/prolog $ cat fibo.prolog fibo(0, 0) :- !. fibo(1, 1) :- !. fibo(N, X) :- N > 1 -> N1 is N - 1, N2 ...
by Paeryn
Mon Apr 15, 2019 1:51 am
Forum: Off topic discussion
Topic: Is ARM doomed?
Replies: 298
Views: 11453

Re: Is ARM doomed?

All this talk of smalltalk reminds me of the language I was first introduced to, Logo on a BBC B, I think the school had a tutle wired up too which you could watch it draw the shapes on paper as well as the screen.

Was Logo a precursor to smalltalk or a cut down version?
by Paeryn
Mon Apr 15, 2019 12:07 am
Forum: Off topic discussion
Topic: Is ARM doomed?
Replies: 298
Views: 11453

Re: Is ARM doomed?

!Integer methodsFor: 'benchmarks' ! demoFib " Time millisecondsToRun: [26 demoFib]." ^ self < 2 ifTrue: [1] ifFalse: [(self-1) demoFib + (self-2) demoFib + 1] ! ! 30 demoFib ! This should add the method demoFib to the code for the Integer class and then run 30 demoFib. I imagine gst will generally ...
by Paeryn
Sun Apr 14, 2019 10:56 pm
Forum: Python
Topic: how to run python file from new terminal with subprocess ???
Replies: 3
Views: 103

Re: how to run python file from new terminal with subprocess ???

Hello, i am using subprocess to open new terminal in new path and run another file of python that in that folder : import subprocess subprocess.call(['lxterminal' , 'python3 try.py'], cwd='/home/pi/try', shell =True) i am gettint a new terminal in the new location ('/home/pi/try') but the file is n...
by Paeryn
Sat Apr 13, 2019 12:09 am
Forum: Python
Topic: Python recursion error
Replies: 10
Views: 255

Re: Python recursion error

jahboater wrote:
Fri Apr 12, 2019 10:19 pm
Is there such a thing as longjmp() in Python?
Not as far as I'm aware, the nearest would involve using exceptions to unwind the call stack but that would be a mess to manage especially if there's mutual recursion involved.
by Paeryn
Fri Apr 12, 2019 9:50 pm
Forum: Python
Topic: Python recursion error
Replies: 10
Views: 255

Re: Python recursion error

The continuous loop code finally works great in my updated RPi-based plant watering system but errors out when the maximum recursion depth is exceeded. The logic requires taking different paths through the code, depending on tests along the way. Not having GOTOs in Python, I used functions to perfo...
by Paeryn
Thu Apr 11, 2019 1:30 pm
Forum: Bare metal, Assembly language
Topic: When compiling for Pi3 in Arch32 enabling VFP
Replies: 12
Views: 3116

Re: When compiling for Pi3 in Arch32 enabling VFP

sheroy wrote:
Thu Apr 11, 2019 12:10 pm
also the answer was posted on Fri Jun 14, 2013 6:34 pm
Have you been time travelling? That was 5 years before your original post on 13th July 2018. Not counting that the RPi3 wasn't out in 2013 :D
by Paeryn
Thu Apr 11, 2019 12:31 am
Forum: C/C++
Topic: std::thread not working with clang in rpi3
Replies: 3
Views: 148

Re: std::thread not working with clang in rpi3

Clang 6.0.1 is in the Raspbian Stretch repo (did this get added at some point? I had 4.0 installed, I'm sure I wouldn't have installed that if 6.0 was there). [email protected]:~/Programming/asm/thr $ clang++-6.0 --version clang version 6.0.1-10+rpi1~bpo9~rpt1 (tags/RELEASE_601/final) Anyway, compiling with t...
by Paeryn
Wed Apr 10, 2019 9:17 am
Forum: Python
Topic: How to kill stream.py running once it's running. I'm trying to use p.kill()
Replies: 5
Views: 132

Re: How to kill stream.py running once it's running. I'm trying to use p.kill()

1. Can I just declare a bunch of global variables at the beginning of my code? Like before any functions or classes? Like arduino coding? Or is it better to just declare them in the fuctions/classes you use them, and then when they need to be global, you make em so? It doesn't seem like I can just ...
by Paeryn
Wed Apr 10, 2019 1:33 am
Forum: Python
Topic: How to kill stream.py running once it's running. I'm trying to use p.kill()
Replies: 5
Views: 132

Re: How to kill stream.py running once it's running. I'm trying to use p.kill()

def killetch(): process.kill() def stream_circle(): process = subprocess.Popen(["python", "stream.py", "/home/pi/laseretcher/gcode/circle.gcode", "/dev/ttyUSB0"]) if process.poll() is None: time.sleep(5) print("Lasering!") #printing_indicator() print("Finished Process") # rotate_table() I don't kno...
by Paeryn
Mon Apr 08, 2019 4:47 pm
Forum: Python
Topic: Help please with delayed shutdown script
Replies: 20
Views: 626

Re: Help please with delayed shutdown script

Glad you've got it working.
by Paeryn
Sun Apr 07, 2019 11:14 pm
Forum: Python
Topic: Help please with delayed shutdown script
Replies: 20
Views: 626

Re: Help please with delayed shutdown script

/sbin should already be in the PATH used by systemd when starting services. Is there anything in the logs for your service? If your service is as written in the init file you gave (i.e. the service filename is sd-ps ) then the following line will show any output of your program (I changed your init ...
by Paeryn
Sun Apr 07, 2019 10:18 pm
Forum: Python
Topic: Help please with delayed shutdown script
Replies: 20
Views: 626

Re: Help please with delayed shutdown script

I ran the script from a terminal window and it works perfectly! Any ideas why it only works from there? How / where are you running it from normally? I'll presume you are running it from cron in which case the shutdown command won't be found because cron defaults to using a limited search path. Try...

Go to advanced search