Go to advanced search

by pfletch101
Mon Nov 18, 2019 4:50 pm
Forum: Python
Topic: Pause a program in python
Replies: 7
Views: 792

Re: Pause a program in python

I think that you need to try to find out the real reason why your program is exiting/failing. I don't think that the problem is how it is pausing/sleeping. I have a number of 24/7 services that use time.sleep() to pause execution for long periods of time (more than 12 hours for some of them), withou...
by pfletch101
Mon Nov 18, 2019 4:03 pm
Forum: General discussion
Topic: What would it take? Vehicle HVAC controls
Replies: 8
Views: 525

Re: What would it take? Vehicle HVAC controls

I'd assume the HVAC controls would just be like anything else in the car. Either 12volt on or off, or a variable voltage sensor. I agree with topguy. Without knowing how the HVAC system controls work, you are likely to have major problems interfacing with them in a way that won't damage or destroy ...
by pfletch101
Sun Nov 17, 2019 2:10 am
Forum: Advanced users
Topic: Access to GPIO connector in a Flirc Case
Replies: 20
Views: 5293

Re: Access to GPIO connector in a Flirc Case

pfletch101, You say that you got one of the Octopart ribbon cable GPIO extender cable to suit a Pi 4 in a Flirc case? I'm looking for the female to male type but struggling to identify it from the Octopart product list - if you got the male to female sort, what type number was yours? I'm afraid tha...
by pfletch101
Tue Nov 12, 2019 2:01 am
Forum: Graphics, sound and multimedia
Topic: Recorder Based Pipe Organ
Replies: 5
Views: 754

Re: Recorder Based Pipe Organ

Thanks for the input. You are totally correct in your assessement. After posting I stumbled accross a python module called MIDO this decodes MIDI files (and does a lot of other things). Now I've seen inside the file I think it may be easier than I orignially thought. As you said the file contains a...
by pfletch101
Fri Nov 08, 2019 10:51 pm
Forum: Advanced users
Topic: Writing to SQLIte database from multiple processes
Replies: 10
Views: 1245

Re: Writing to SQLIte database from multiple processes

Or maybe use a database that does have row level locking? e.g. postgresql Indeed, but it is overkill for most of the things I do with my Pis. If I want a server-based DB manager, I tend to use Mariadb, because I have worked a lot with MySQL in the past, but if I hadn't, I would probably go to postg...
by pfletch101
Fri Nov 08, 2019 10:48 pm
Forum: Advanced users
Topic: Writing to SQLIte database from multiple processes
Replies: 10
Views: 1245

Re: Writing to SQLIte database from multiple processes

Transactions would solve the problems you listed. Read https://www.sqlite.org/lockingv3.html#transaction_control No, I don't think so. If Process A and Process B both read the same record (permitted, because neither has tried to write to the database yet), they can each sequentially proceed to subm...
by pfletch101
Fri Nov 08, 2019 9:51 pm
Forum: Advanced users
Topic: Writing to SQLIte database from multiple processes
Replies: 10
Views: 1245

Re: Writing to SQLIte database from multiple processes

Thanks for pointing out that SQLite implements internal file-based locking. For my purposes, that is probably enough, though the FAQ rather glosses over the situations where it is not enough and record-based locking (which SQLite does not implement) is required. If all the multiple writing processes...
by pfletch101
Fri Nov 08, 2019 3:55 pm
Forum: Advanced users
Topic: Writing to SQLIte database from multiple processes
Replies: 10
Views: 1245

Re: Writing to SQLIte database from multiple processes

You should safe if you implement access to the database with a mutex. While you have the mutex you need to perform the SQL statement and then commit (if writing), and then release the mutex. /Mogens I normally leave a connection to the database and a cursor open while my application is running - on...
by pfletch101
Thu Nov 07, 2019 11:56 pm
Forum: Advanced users
Topic: Writing to SQLIte database from multiple processes
Replies: 10
Views: 1245

Writing to SQLIte database from multiple processes

I know that, under normal circumstances, SQLite databases can have multiple readers but only one writer. Can the 'only one writer' rule be relaxed if any potential writers share a semaphore or similar means of interprocess communication in such a way as to prevent multiple writing attempts at the sa...
by pfletch101
Thu Nov 07, 2019 11:46 pm
Forum: Python
Topic: SOLVED - Frustrating problem with python code in Flask application
Replies: 4
Views: 584

Re: SOLVED - Frustrating problem with python code in Flask application

Although I haven't seen your code and my apologies if I am wrong, but I expect you were doing something like this : Well, not quite. :) Here is a copy of the relevant parts of the corrected Class. I was vaguely aware of the issue, which is why the original code contains the extra assignment to a te...
by pfletch101
Thu Nov 07, 2019 9:20 pm
Forum: Python
Topic: SOLVED - Frustrating problem with python code in Flask application
Replies: 4
Views: 584

Re: SOLVED - Frustrating problem with python code in Flask application

The explanation for the weird behavior was that the contents of the fields['pattern'] array was being changed when I changed the corresponding setting in the mypattern Class instance, so, by the time the code got to testing it, it was the same as the relevant setting from request.form. Because of th...
by pfletch101
Thu Nov 07, 2019 3:48 pm
Forum: General discussion
Topic: Interesting interview with Eben in Physics World
Replies: 41
Views: 4623

Re: Interesting interview with Eben in Physics World

Personally I think one can expect ones data to go missing on an abrupt power down. Or at least very recent versions of it. But if the operating system won't boot after such an event that is a bug. A design flaw. In the same way I expect my car to restart after running out of gas when I put some mor...
by pfletch101
Wed Nov 06, 2019 11:59 pm
Forum: Python
Topic: SOLVED - Frustrating problem with python code in Flask application
Replies: 4
Views: 584

SOLVED - Frustrating problem with python code in Flask application

The behavior of the following chunk of code has me tearing my hair out! It is from one of the 'routes' in a fairly complex Flask application, which I am writing to schedule Wemo devices. This is only a section of a much longer piece of code, and its purpose is to handle edits to the weekly 'pattern'...
by pfletch101
Wed Nov 06, 2019 5:36 pm
Forum: General discussion
Topic: Interesting interview with Eben in Physics World
Replies: 41
Views: 4623

Re: Interesting interview with Eben in Physics World

I don't think those who encloses their Pi in a FLIRC case heavily uses their GPIO :mrgreen: It's not actually that difficult. :) You just have to use a flat extender cable with skinny connectors that don't foul the case's mounting posts (there is a link to a source for these on the Flirc site). The...
by pfletch101
Tue Nov 05, 2019 10:15 pm
Forum: Troubleshooting
Topic: VLI firmware v2.0 - powersaving features enabled
Replies: 117
Views: 37025

Re: VLI firmware v2.0 - powersaving features enabled

Not correct My 3B+ with no heatsink in a 28 deg C room idles about 32 degrees. Pi4B next to it, again no heatsink, idles about 38 degrees Both those temperatures seem very low, from my experience. How idle is idle? :) Is this running a standard Buster GUI with no I/O, running a bare bones CLI syste...
by pfletch101
Sun Nov 03, 2019 4:44 pm
Forum: Other projects
Topic: Messure AC current
Replies: 5
Views: 947

Re: Messure AC current

I don't think that you will find a current transducer that will give you reasonably precise measurements at these low currents, so you will probably need to put a low value resistor (e.g. 200 Ohm 5W) in the circuit and measure the AC voltage across it. Even though the currents you are measuring are ...
by pfletch101
Sun Nov 03, 2019 12:24 am
Forum: Troubleshooting
Topic: Under-voltage when using USB storage
Replies: 8
Views: 783

Re: Under-voltage when using USB storage

I will order one, hoping this will solve my problem. Thanks. (But I still not understand why voltage shortage occur when there is high I/O, and not when there is high CPU load) I had missed your original statement that the USB drives had their own power supplies. However, even with external (typica...
by pfletch101
Sat Nov 02, 2019 9:45 pm
Forum: Troubleshooting
Topic: Under-voltage when using USB storage
Replies: 8
Views: 783

Re: Under-voltage when using USB storage

You are using a 'power supply' (probably really a charger) which is under-specified for your Pi, even if one assumes that the specifications are valid in this context. Why are you surprised that you are having power problems? Buy and use an official Pi power supply.
by pfletch101
Tue Oct 22, 2019 12:48 am
Forum: Troubleshooting
Topic: Use battery as a back-up when main power goes down
Replies: 15
Views: 1594

Re: Use battery as a back-up when main power goes down

I an using a UPS to power a pi3 and a modem/router for my pi running 24/7. It is a "Back-UPS 700" from APC by Schneider Electric. It has 4 mains outlets that are battery backed. However, when power goes out it only runs my gear for about an hour, so you may need a bigger one. Your modem/router is a...
by pfletch101
Mon Oct 21, 2019 1:06 am
Forum: General discussion
Topic: Pi 3 A +. What is it for?
Replies: 52
Views: 4706

Re: Pi 3 A +. What is it for?

@W. H. Heydt, I think I've written more than 10MB of source code in my life. Yes, but you would be wrong. I was calculating the industry average rate of source code production, 10 lines per day. I would not hire somebody who writes only ten lines of code (40 characters per line) per day. That's abs...
by pfletch101
Mon Oct 14, 2019 1:09 am
Forum: Raspberry Pi OS
Topic: STICKY: Buster bug report thread
Replies: 391
Views: 98976

Re: Buster bug report thread

Also, after an apt-get update/upgrade I then got the following from my background program - sudo modprobe -r g_mass_storage modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.66+/modules.dep.bin' Presumably because it hadn't yet rebooted, an...
by pfletch101
Fri Oct 11, 2019 2:43 pm
Forum: General discussion
Topic: Help me please,my due date is next week.....
Replies: 29
Views: 2589

Re: Help me please,my due date is next week.....

Step 2 ist wrong: if it is NOT wet... Step 2.5 is missing: turn the pump off. Good catch. At least the code in python was ok! Good way to flood your basement! :-) To me, "turn the pump on for n seconds" fairly strongly implies turning it off after n seconds - otherwise, why specify a time at all?
by pfletch101
Thu Oct 10, 2019 12:29 am
Forum: General discussion
Topic: Switch or not
Replies: 21
Views: 1571

Re: Switch or not

I must seriously ask why though. What's stopping you from moving the additional couple of feet to reach the switch at the wall where you plugged the power supply in... Depending where the OP lives, there may not be "a switch on the wall". Switched outlets are the rule (though not universal) in the ...
by pfletch101
Sat Oct 05, 2019 7:35 pm
Forum: Beginners
Topic: How to distinguish that the python program is executed on a RPI?
Replies: 7
Views: 716

Re: How to distinguish that the python program is executed on a RPI?

I am developing Python scripts on different machines, including RPI. Is there a way to distinguish on which machine I am working, so that I load the right modules? There is 'os.name' and I am sure others which can give you information about what the code is being run on. One can search for the pres...
by pfletch101
Sat Oct 05, 2019 4:50 pm
Forum: Beginners
Topic: How to distinguish that the python program is executed on a RPI?
Replies: 7
Views: 716

Re: How to distinguish that the python program is executed on a RPI?

I am developing Python scripts on different machines, including RPI. Is there a way to distinguish on which machine I am working, so that I load the right modules? E.g. PySimpleGUI uses this: #!/usr/bin/env python import sys if sys.version_info[0] >= 3: import PySimpleGUI as sg else: import PySimpl...

Go to advanced search