Go to advanced search

by Paeryn
Sun Oct 27, 2019 3:45 pm
Forum: Python
Topic: [solved] Puzzled by two simple hex-dec-string mixup
Replies: 7
Views: 768

Re: Puzzled by two simple hex-dec-string mixup

Thank you, it took several re-writes before I was happy that I hadn't made things more confusing for you. Playing around making small changes and seeing what difference it makes (and whether that is what you are expecting) is a good way of learning, programming languages are (for the most part) very...
by Paeryn
Sat Oct 26, 2019 8:16 pm
Forum: Python
Topic: [solved] Puzzled by two simple hex-dec-string mixup
Replies: 7
Views: 768

Re: Puzzled by two simple hex-dec-string mixup

Python will use the prefix \x if it is printing a character that doesn't have printable glyph in the encoding, it will use the prefix 0x if it is printing an integer in hexadecimal. It all depends on what type the value has. \x is used inside strings to denote that it and the hexadecimal value strai...
by Paeryn
Sat Oct 26, 2019 8:25 am
Forum: Beginners
Topic: How to utilize output from one program in another
Replies: 21
Views: 1029

Re: How to utilize output from one program in another

#overall concept for program #AH1815 (hall-effect switch) drops in resistance, so allows current to increase (from 0 to 1mA Nominal), when magnetic field is present in sufficient strength #import GPIO library and use conditional statement to activate example.py module if GPIO pin is high #then anal...
by Paeryn
Fri Oct 25, 2019 8:27 pm
Forum: Troubleshooting
Topic: troubles with scripts and crontab
Replies: 6
Views: 267

Re: troubles with scripts and crontab

So the code in the quoted text will work if I add it to my scripts? I'm lost No, the code in the quote is yours, all I did was put code tags around each bit of code so the forum would display it as code. The point I was making was that you look to be trying to run the same python program hardware_c...
by Paeryn
Fri Oct 25, 2019 4:06 pm
Forum: Troubleshooting
Topic: troubles with scripts and crontab
Replies: 6
Views: 267

Re: troubles with scripts and crontab

Lights off #!/bin/bash sudo python py/hardware_controller.py --config=overmech.cfg --state=off Lights on #!/bin/bash sudo python py/hardware_controller.py --config=overmech.cfg --state=on Run the show python $SYNCHRONIZED_LIGHTS_HOME/py/hardware_controller.py --config=overmech.cfg --state=off sleep...
by Paeryn
Tue Oct 22, 2019 3:12 am
Forum: Beginners
Topic: autoboot script does not function
Replies: 8
Views: 455

Re: autoboot script does not function

Thanks for the responses so far @pcmanbob and @Paeryn. I've tried the python method as suggested by pcmanbob and that would work if my script was in my home folder. however i need to CD into another folder outside of home first as the script relies on files there as well. Is that something i can in...
by Paeryn
Mon Oct 21, 2019 7:23 pm
Forum: Graphics programming
Topic: X11 fullscreen
Replies: 2
Views: 730

Re: X11 fullscreen

You are missing a mask in both the calls to XSendEvent(), you need both Notify and Redirect set. It should be

Code: Select all

  XSendEvent(dsp, DefaultRootWindow(dsp), False, SubstructureNotifyMask | SubstructureRedirectMask, &xev);
by Paeryn
Mon Oct 21, 2019 2:06 pm
Forum: Beginners
Topic: autoboot script does not function
Replies: 8
Views: 455

Re: autoboot script does not function

Also what is the difference in paths, I've seen online that some autostart files are in /.config/lxsession/LXDE-pi directory instead. Is there a difference between this? Also the autostart file in the LXDE folder in /etc/xdg/lxsession/LXDE The /etc/xdg/lxsession is the system-wide default directory...
by Paeryn
Mon Oct 21, 2019 2:28 am
Forum: Python
Topic: My first Python app--Age Calculator(need suggestions!)
Replies: 5
Views: 555

Re: My first Python app--Age Calculator(need suggestions!)

The datetime module deals with dates and times which you can use to get the date (amongst other things), e.g. import datetime today = datetime.date.today() day = today.day month = today.month year = today.year print('Today's day is', day) print('The month is', month) print('The year is', year) A ran...
by Paeryn
Mon Oct 21, 2019 12:38 am
Forum: Python
Topic: What does this error mean (thonny)
Replies: 4
Views: 823

Re: What does this error mean (thonny)

Under X11 iconbitmap() wants an xbm image, I don't think it accepts anything else. If you want to use png (or gif / jpg) you can load it as a PhotoImage and use iconphoto() . Don't forget that the PhotoImage has to be kept alive for as long as the image is used, if it goes out of scope and gets garb...
by Paeryn
Sun Oct 20, 2019 9:03 pm
Forum: General programming discussion
Topic: Liberation through Computer Literacy
Replies: 1764
Views: 86375

Re: Liberation through Computer Literacy

I would think that the people using these powerful supercomputers have more pressing jobs to run on them than calculating pi. It's not like us buying a new RPi where it may be sat idling for hours / days at a time.
by Paeryn
Sun Oct 20, 2019 8:27 pm
Forum: General discussion
Topic: "Click here..." is annoying
Replies: 8
Views: 1027

Re: "Click here..." is annoying

Did ask once before about disabling tool tips on buster but no one ever came back with an answer. From a quick look at the source code the tooltips are always added for the menu items (including the menu button itself) if there is a description present. It doesn't support the tooltips=0 setting tha...
by Paeryn
Sun Oct 20, 2019 1:15 pm
Forum: General discussion
Topic: "Click here..." is annoying
Replies: 8
Views: 1027

Re: "Click here..." is annoying

Open autostart and remove or comment out point-rpi. sudo nano /etc/xdg/lxsession/LXDE-pi/autostart #point-rpi Tried the above edit and rebooted pi , still get the "Click here to open applications menu" on my pi4 running buster. Have you got a local config for lxsession? If so that is used rather th...
by Paeryn
Sun Oct 20, 2019 3:33 am
Forum: General discussion
Topic: RPi 4 power consumption vs. RAM
Replies: 15
Views: 1463

Re: RPi 4 power consumption vs. RAM

Is the RAM on the main (SOIC ?) chip ? No, the RAM is on a separate chip. The RPi0 and RPi1 have the RAM chip sat directly on top of the SoC (so it looks like one chip unless you look closely) but for all other RPis they are on different parts of the PCB. The SoC does have some cache memory on-chip...
by Paeryn
Sun Oct 20, 2019 3:16 am
Forum: General discussion
Topic: RPi 4 power consumption vs. RAM
Replies: 15
Views: 1463

Re: RPi 4 power consumption vs. RAM

The static power will increase (that needed to keep the memory refreshed) but the power needed for accessing the memory (reading & writing) will largely be the same as the bandwidth doesn't change. I'd think the power usage of the rest of the system would make power consumption fairly negligible bet...
by Paeryn
Sun Oct 20, 2019 1:42 am
Forum: General discussion
Topic: python doesnt wanna download pip
Replies: 1
Views: 207

Re: python doesnt wanna download pip

Hello, I have a problem with command : sudo apt install python-pip when i activate it in python 3.5.3 on NOOBS v2_4_3 it says sudo apt install python-pip SyntaxError: invalid syntax How can i fix this Problem? Firstly, NOOBS isn't your operating system, it's an operating system installer . Typicall...
by Paeryn
Fri Oct 18, 2019 9:31 pm
Forum: Beginners
Topic: How to auto-boot a python3 program in Thonny
Replies: 32
Views: 1194

Re: How to auto-boot a python3 program in Thonny

Glad you managed to sort it out. That's the main downside of IDLE and Thonny (and possibly other python IDEs), when running programs in them your program never really exits unless you restart the shell (either manually or by re-running your progran). Whilst this makes it easier to debug your program...
by Paeryn
Fri Oct 18, 2019 7:04 pm
Forum: Beginners
Topic: How to auto-boot a python3 program in Thonny
Replies: 32
Views: 1194

Re: How to auto-boot a python3 program in Thonny

That looks like you haven't put the shebang line at the start of the file. It needs to be the very first line and the #! has to be the first two characters. If you so much as have a blank line above it or a space before the characters then it won't be recognised, the #! literally has to be the first...
by Paeryn
Fri Oct 18, 2019 5:21 pm
Forum: Beginners
Topic: How to auto-boot a python3 program in Thonny
Replies: 32
Views: 1194

Re: How to auto-boot a python3 program in Thonny

The chmod command given is entered on its own, not as an argument to either python3 or thonny. From how you are trying to do it I assume the file you are wanting to run is in /home/pi/Projects . Enter these lines individually at the command line in a terminal. The first line makes sure you in the di...
by Paeryn
Fri Oct 18, 2019 2:25 am
Forum: Beginners
Topic: How to auto-boot a python3 program in Thonny
Replies: 32
Views: 1194

Re: How to auto-boot a python3 program in Thonny

commands in autostart need the @ in front of them. But the not running from the command line is odd. Does it work if you add #!/usr/bin/python3 as the very first line of your TrackPlayer.py, make it executable with chmod +x TrackPlayer.py , then run it in the terminal with ~/Projects/TrackPlayer.py...
by Paeryn
Fri Oct 18, 2019 1:36 am
Forum: Raspbian
Topic: Why am I getting this syntax error?
Replies: 3
Views: 383

Re: Why am I getting this syntax error?

You solved my issue, thank you. I still needed sudo because these are write protected files, so I moved it in front of ffmpeg and it worked fine. I would have thought that ffmpeg is creating new files rather than overwriting current files, but if you need to overwrite write-protected files you shou...
by Paeryn
Thu Oct 17, 2019 9:44 pm
Forum: Raspbian
Topic: Why am I getting this syntax error?
Replies: 3
Views: 383

Re: Why am I getting this syntax error?

When I run the following from the terminal of Raspbian in my Pi 4B I get a "syntax error near unexpected token 'do'": sudo for f in *.flac; do ffmpeg -i "$f" "${f%.flac}.wav"; done rm *.flac This batch file statement comes from the GPIO Music Box example. Its purpose is to convert .flac files to .w...
by Paeryn
Thu Oct 17, 2019 2:59 am
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 57
Views: 4584

Re: Where can I begin learning C/C++?

I take it you held your ground, especially if you had already implemented it! GCC has been printing a caret showing the start position of the error on the line for quite a while but it used to be just that. I think it was in 6 that they added tildes with it to highlight the extent of the error rathe...
by Paeryn
Wed Oct 16, 2019 10:24 pm
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 57
Views: 4584

Re: Where can I begin learning C/C++?

It is all the massive complex machinery just below the surface that scares me. This a C++ hello world program: #include <iostream> int main() { std::cout << "Hello, world!\n"; } Seems innocuous enough, after you accept the peculiar way you have to do output. But look what happens when you type >> i...
by Paeryn
Wed Oct 16, 2019 12:37 am
Forum: C/C++
Topic: Running C/C++ on Raspberry Pi
Replies: 32
Views: 2619

Re: Running C/C++ on Raspberry Pi

vi is really a cumbersome crutch from times when the rock'n'roll was invented and which honestly makes me vomite - instead, Geany is a handsome and reasonable editor and IDE. I somehow doubt the honesty of your said reaction to vi. There's nothing wrong with vi (though vim has replaced vi nowadays)...

Go to advanced search