Go to advanced search

by PeterO
Tue Jul 17, 2018 3:11 pm
Forum: General programming discussion
Topic: What Does Hiding the Details of I/O in Library Calls Teach?
Replies: 37
Views: 645

Re: What Does Hiding the Details of I/O in Library Calls Teach?

Q: What Does Hiding the Details of I/O in Library Calls Teach?
A: Abstraction.

PeterO
by PeterO
Fri Jul 13, 2018 4:48 pm
Forum: Troubleshooting
Topic: What is wrong with these fstab entries?
Replies: 6
Views: 172

Re: What is wrong with these fstab entries?

Are you using Raspbian "full" (ie. with the Desktop etc.) or Raspbian lite? The file-manager of the Desktop usually handles auto-mounting: http://www.cpmspectrepi.uk/raspberry_pi/MoinMoinExport/MultipleUsbSticks.html#Raspbian_Wheezy.2FJessie_.28Desktop.2FHeadless.29_Methods Trev. I'm using desktop,...
by PeterO
Fri Jul 13, 2018 4:24 pm
Forum: Troubleshooting
Topic: What is wrong with these fstab entries?
Replies: 6
Views: 172

Re: What is wrong with these fstab entries?

Seems there isn't a nice easy to way to have the Pi automount usb drives in Raspbian, Works for me :roll: I just plugged a USB drive into a hub on my PI3B+ and it's automounted both partitions just fine ... /dev/sdb1 on /media/pi/boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022...
by PeterO
Thu Jul 12, 2018 3:25 pm
Forum: General discussion
Topic: 25% of SD's corrupted
Replies: 7
Views: 417

Re: 25% of SD's corrupted

I very much doubt this would solve your problems. Does anyone have any real experience with the difference between booting from SDcard and booting from USB without an SDcard on systems where the power has failed multiple times ? That is what the OP needs, not just some unsubstantiated "doubt" . Pet...
by PeterO
Wed Jul 11, 2018 10:10 am
Forum: Python
Topic: except KeyboardInterrupt: print " Quit" not working
Replies: 2
Views: 89

Re: except KeyboardInterrupt: print " Quit" not working

You are missing a "try" to match with the "except". #!/usr/bin/python3 import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BCM) relay = 17 GPIO.setup(relay, GPIO.OUT) try: while True: GPIO.output(relay, True) sleep(1) GPIO.output(relay, False) sleep(1) except KeyboardInterrupt: print(" ...
by PeterO
Tue Jul 10, 2018 8:22 am
Forum: C/C++
Topic: [Solved] Reading from stdin
Replies: 7
Views: 230

Re: Reading from stdin

Note that when Paeryn added these warning switches to the gcc command "-Wall -Werror -Wconversion" it showed exactly where the problem was with your code. If you can make a habit of adding warning switches to your compiler commands it will save you time in the future. The compiler can spot some prob...
by PeterO
Tue Jul 10, 2018 6:11 am
Forum: C/C++
Topic: [Solved] Reading from stdin
Replies: 7
Views: 230

Re: Reading from stdin

Here are the imoprtant bits of the man page for fgetc (run "man fgetc" to see the full page). GETS(3) Linux Programmer's Manual GETS(3) NAME fgetc, fgets, getc, getchar, gets, ungetc - input of characters and strings SYNOPSIS #include <stdio.h> int fgetc(FILE *stream); ...... DESCRIPTION fgetc() rea...
by PeterO
Mon Jul 09, 2018 8:34 am
Forum: Python
Topic: How to read first file name?
Replies: 3
Views: 96

Re: How to read first file name?

Google found this

Code: Select all

import os

files = sorted(os.listdir(path), key=os.path.getctime)

oldest = files[0]
newest = files[-1]
on this page
http://code.activestate.com/recipes/576 ... -of-files/

PeterO
by PeterO
Tue Jul 03, 2018 7:04 am
Forum: Python
Topic: I need help with sensehat display code.
Replies: 2
Views: 93

Re: How would you do this?

You might get more replies if you used a sensible tile like "1 need help with sensehat display"
PeterO
by PeterO
Mon Jul 02, 2018 5:20 pm
Forum: General discussion
Topic: New Raspbian release 2018-06-27
Replies: 30
Views: 1537

Re: New release 2018-06-27

Fresh install onto a USB HDD with nosdcard , first reboot (from raspi-config after disabling oversca) takes forever to stop and then fails to restart leaving red and green LEDs both off.

:-(

PeterO
by PeterO
Fri Jun 29, 2018 7:32 pm
Forum: Python
Topic: GUI with CAN-BUS
Replies: 3
Views: 124

Re: GUI with CAN-BUS

You should use the canbus socket interface to open a socket and then add the file desciptor to the event loop of your chosen GUI tool kit. That way you can specify a function to be called to handle incomming canbus messages.

Timers are not the way to do this sort of thing.

PeterO
by PeterO
Thu Jun 28, 2018 9:00 pm
Forum: General discussion
Topic: Pi Is Too Complicated
Replies: 112
Views: 3879

Re: Pi Is Too Complicated

ejolson wrote:
Thu Jun 28, 2018 8:41 pm
An interesting consequence of the increasing complexity of Raspbian is the fact that it no longer easily fits on a 4GB or 8GB SD card, as discussed in this thread.
It is only interesting if you have a box full of unused 4Gb sdcards :lol:


PeterO
by PeterO
Tue Jun 26, 2018 12:59 pm
Forum: Graphics programming
Topic: Gtk3 exiting through delete_event handler (SOLVED)
Replies: 8
Views: 300

Re: Gtk3 exiting through delete_event handler

I've never used an "application" window so I don't know if the behaviour is due to that...

PeterO
by PeterO
Tue Jun 26, 2018 8:26 am
Forum: Graphics programming
Topic: Gtk3 exiting through delete_event handler (SOLVED)
Replies: 8
Views: 300

Re: Gtk3 exiting through delete_event handler

Looking at your code, I wouldn't do it that way ! I think your code should display the dialog box from within button_clicked_cb and use the return value to decide if the delete event should be sent or not. I think trying to display a dialog within the delete event handler is a bad idea. However it d...
by PeterO
Mon Jun 25, 2018 1:14 pm
Forum: Graphics programming
Topic: Vulkan, OpenGL or OpenGLES
Replies: 9
Views: 434

Re: Vulkan, OpenGL or OpenGLES

Hi Gavin! You should definitely go for OpenGL ES. The first place to start is looking at /opt/vc/src on your Raspbian installation and compile those examples. It will give you a lot of pointers and ideas about what to do next. Don't hesitate to write me a message here on the forums or via email to ...
by PeterO
Sat Jun 23, 2018 7:36 pm
Forum: Graphics programming
Topic: Gtk3 exiting through delete_event handler (SOLVED)
Replies: 8
Views: 300

Re: Gtk3 exiting through delete_event handler

Can you provide a small complete program that shows this behaviour ?

It's much easier to investigate if we can run something for ourselves that demonstrates the problem.

PeterO
by PeterO
Fri Jun 22, 2018 5:49 pm
Forum: C/C++
Topic: [Solved] Segmentation fault and debugging
Replies: 7
Views: 354

Re: Segmentation fault and debugging

It may not be the only bug, but in test_word_exists the code opens a file, but if "j == pl" is true the function returns without closing the file. See obvious comment in code below. int test_word_exist(wchar_t * pattern) { char filename[MAX_FILENAME_LEN]; wchar_t wstring[MAX_WORD_LEN]; FILE *infile;...
by PeterO
Wed Jun 20, 2018 9:48 am
Forum: Troubleshooting
Topic: Repeated external USB drive corruptions
Replies: 7
Views: 194

Re: Repeated external USB drive corruptions

The Pi cuts power to USB too early for your drives, they are probably busy saving when the Pi reaches the end of shutdown and cuts power to the USB ports. Using the external automounter (autofs5) should solve this; systemd tries to stop the automounter early in the shutdown process, so the drives h...
by PeterO
Mon Jun 18, 2018 9:46 am
Forum: C/C++
Topic: Dynamic sized arrays
Replies: 120
Views: 4600

Re: Dynamic sized arrays

jahboater wrote:
Mon Jun 18, 2018 9:30 am
Thanks for posting that, very interesting.
If you read it all, he is not that negative.
But I saw this amusing spoof in the comments :-
http://www-users.cs.york.ac.uk/susan/joke/cpp.htm
:)
That's so ...... believable :-)

PeterO
by PeterO
Mon Jun 18, 2018 9:08 am
Forum: C/C++
Topic: Dynamic sized arrays
Replies: 120
Views: 4600

Re: Dynamic sized arrays

http://www.theregister.co.uk/2018/06/18 ... plus_plus/

"What's all the C Plus Fuss? Bjarne Stroustrup warns of dangerous future plans for his C++
Language creator calls proposals 'insanity'"

Clearly even BS realises C++ is out of control !

PeterO
by PeterO
Sun Jun 17, 2018 7:33 pm
Forum: OpenGLES
Topic: glDrawElements abysmally slow
Replies: 10
Views: 652

Re: glDrawElements abysmally slow

SO one obvious question is how is the memory split set up ?
PeterO
by PeterO
Sun Jun 17, 2018 5:52 am
Forum: OpenGLES
Topic: glDrawElements abysmally slow
Replies: 10
Views: 652

Re: glDrawElements abysmally slow

triangle.c looks like old GLES 1 code so I don't think it's worth trying to diagnose anything based on that.

PeterO
by PeterO
Sat Jun 16, 2018 7:47 am
Forum: OpenGLES
Topic: glDrawElements abysmally slow
Replies: 10
Views: 652

Re: glDrawElements abysmally slow

Without seeing some example code it is hard to diagnose your problem, Can you at least post your modified "triangle" example that shows the problem ? I have some quite complex OpenGL ES code that runs fine, but it is composed of lots of small objects that each have their own call to drawElements. Pe...
by PeterO
Wed Jun 13, 2018 4:06 pm
Forum: Raspbian
Topic: Raspbian + Pi3B+ = low voltgae warning?
Replies: 4
Views: 322

Re: Raspbian + Pi3B+ = low voltgae warning?

The 3B+ needs the latest firmware as the way the low voltage detection circuity works has changed.
PeterO
by PeterO
Wed Jun 13, 2018 9:54 am
Forum: Advanced users
Topic: Write Raspbian img to external drive partition
Replies: 5
Views: 312

Re: Write Raspbian img to external drive partition

The image file is a "whole disk" image that includes a partition table with two partitions (for boot and root filesystems). It will not work if you try and write it into an existing partition. See the instructions here : https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.m...

Go to advanced search