Go to advanced search

by KCarscadden
Sat Jun 04, 2016 12:43 pm
Forum: Beginners
Topic: how to monitor a cron job
Replies: 5
Views: 1893

Re: how to monitor a cron job

Instead of or in addition to using logging, you could have the python script send an email message to you if there was an error. Just Google python sending email - it is not difficult.


Keith
by KCarscadden
Fri Jun 03, 2016 1:47 am
Forum: Staffroom, classroom and projects
Topic: VISUALISING SORTING WITH PYTHON
Replies: 1
Views: 1505

VISUALISING SORTING WITH PYTHON

I tried lesson 1 for Visualising Sorting with Python and had a few issues. Do I discuss them here or can I contact someone about them directly?


Keith
by KCarscadden
Fri May 20, 2016 3:53 am
Forum: Python
Topic: Tkinter messagebox askyesno
Replies: 2
Views: 3116

Re: Tkinter messagebox askyesno

messagebox..askyesyno returns True for Yes and False for No, unless you use additional options. See this test: Python 3.4.2 (default, Oct 19 2014, 13:31:11) [GCC 4.9.1] on linux Type "copyright", "credits" or "license()" for more information. >>> from tkinter import messagebox as tkm >>> print(tkm.a...
by KCarscadden
Wed May 11, 2016 12:05 am
Forum: Other projects
Topic: Raspberry Pi Networking Cookbook (free epub TODAY)
Replies: 2
Views: 7488

Re: Raspberry Pi Networking Cookbook (free epub TODAY)

Different e-book every day. If you tried on Nov. 25, you would have received the one posted on Nov. 25.
by KCarscadden
Tue May 10, 2016 11:53 pm
Forum: Python
Topic: Code editor
Replies: 11
Views: 2279

Re: Code editor

EMACS is a great editor. Get it with sudo apt-get emacs, and it will show up on the windows system under Menu, Accessories, GNU Emacs 24.

Alternately, you could check http://www.raspberryconnect.com/raspbia ... an-editors


Keith
by KCarscadden
Tue May 10, 2016 11:38 pm
Forum: Beginners
Topic: Raspian Jessie Static IP issue
Replies: 6
Views: 1309

Re: Raspian Jessie Static IP issue

Probably the answers to your questions are here:

http://www.jeffgeerling.com/blog/2016/s ... spberry-pi


Keith
by KCarscadden
Tue May 10, 2016 11:24 pm
Forum: Beginners
Topic: Code Editor
Replies: 1
Views: 421

Re: Code Editor

Emacs will certainly do what you want. If you use it within the X-Windows environment, it shouldn't be too hard to use. Do an apt-get install emacs to get it. It will then show up under Menu, Accessories, GNU Emacs 24 on the X-Windows system. You can find other editors at http://www.raspberryconnect...
by KCarscadden
Wed Feb 20, 2013 3:32 pm
Forum: Python
Topic: IndentationError
Replies: 6
Views: 3628

Re: IndentationError

The example should be: #!/usr/bin/python import time import RPi.GPIO as GPIO GPIO.setup(11, GPIO.IN) while True: mybutton = GPIO.input(11) if mybutton == False: print "giggle" time.sleep(.2) The number of spaces before the 6th, 7th and 9th statements doesn't matter, provided the number of spaces is ...
by KCarscadden
Tue Nov 27, 2012 4:24 pm
Forum: General programming discussion
Topic: Working with Curses
Replies: 21
Views: 9006

Re: Working with Curses

The following works for the tests I've done, but YMMV. elif menu['options'][getin]['type'] == COMMAND: curses.def_prog_mode() # save curent curses environment os.system('reset') os.system(menu['options'][getin]['command']) # run the command screen.clear() # tells curses screen is cleared, so it will...
by KCarscadden
Sat Nov 24, 2012 7:56 pm
Forum: Python
Topic: pi.py - Crashes at 100,000
Replies: 4
Views: 1058

Re: pi.py - Crashes at 100,000

Counting the .14156 as digits 1 through 5, then digits 99,991 through 100,000 are 5493624646. How does your answer check?

(see post http://www.raspberrypi.org/phpBB3/viewt ... ss5#p80261
by KCarscadden
Tue Nov 06, 2012 6:38 pm
Forum: Beginners
Topic: LAMPA Script – Install Apache, MySQL, PHP5 and APC easy
Replies: 5
Views: 1651

Re: LAMPA Script – Install Apache, MySQL, PHP5 and APC easy

Link? Another thing to note is that option 7 or 8 doesn't do as advertised but installs a lot of additional programs, one of them imagemagick) ;) Poing, Option 8 just does this: 8 ) clear ; apt-get install nmap ; clear ; nmap -p 80 google.se ; press_enter So all of the other stuff installed is just...
by KCarscadden
Thu Nov 01, 2012 10:53 pm
Forum: Python
Topic: When to declare variables as global
Replies: 27
Views: 7038

Re: When to declare variables as global

I mean things like this:- http://stackoverflow.com/questions/279561/what-is-the-python-equivalent-of-static-variables-inside-a-function Only allows you to have one static variable in a function. In that stackoverflow discussion, there was need for just one static variable in the example. There coul...
by KCarscadden
Wed Oct 24, 2012 12:02 am
Forum: Python
Topic: convert number to length-specified hex string
Replies: 7
Views: 4668

Re: convert number to length-specified hex string

One expression is all that is required;

Code: Select all

("000" + hex(N)[2:])[-4:]
[2:] says take part of the string, starting at the 2nd character, going to the end, where the first character is 0.
[-4:] says take part of the string, starting at the 4th character from the end, going to the end of the string.
by KCarscadden
Mon Oct 22, 2012 10:02 pm
Forum: Python
Topic: When to declare variables as global
Replies: 27
Views: 7038

Re: When to declare variables as global

It is very easy to test this sort of thing. Create a short test program, run it, and see what happens. Here is an example: #! python # #------------------------------------------------------------------------------- # def f1 (aa): global y a = aa * 3 x = aa * 4 y = aa * 5 return (12) a = 1 x = 1 y =...
by KCarscadden
Sat Oct 13, 2012 3:31 pm
Forum: Beginners
Topic: Question about command in the User Guide.
Replies: 5
Views: 1667

Re: Question about command in the User Guide.

There are two processes that need to run for this command - the echo and the create file. If you do sudo echo “<?php phpinfo(); ?>” > /var/www/phptest.php you get the sudo only on the echo part, not on the create file. So doing this produces an error: pi@RPi ~ $ sudo echo ".<?php phpinfo(); ?>." > /...
by KCarscadden
Tue Sep 18, 2012 1:42 am
Forum: General programming discussion
Topic: Ideas to use for Raspberry Pi
Replies: 3
Views: 1428

Re: Ideas to use for Raspberry Pi

If you like mathematical problems, try Project Euler at http://projecteuler.net/
by KCarscadden
Mon Sep 10, 2012 8:57 pm
Forum: General discussion
Topic: Seeking advice on 26-pin IDC
Replies: 6
Views: 1236

Re: Seeking advice on 26-pin IDC

How about from Adafruit:

https://www.adafruit.com/products/862
by KCarscadden
Tue Aug 28, 2012 2:31 am
Forum: Beginners
Topic: Advice please on $DISPLAY
Replies: 25
Views: 19259

Re: Advice please on $DISPLAY

Here is a first approximation of what you want. It gets you part way, and someone with more knowledge will hopefully get you the remainder. lxde gets its icons and menus from several places. One of these is from the directory Desktop in your home directory, which I presume is /home/pi. First get rid...
by KCarscadden
Tue Aug 28, 2012 1:55 am
Forum: Beginners
Topic: Advice please on $DISPLAY
Replies: 25
Views: 19259

Re: Advice please on $DISPLAY

So you want an Xserver (lxde) to start with no icons, no menus, no status line - just your program running?

Or perhaps a single icon, which when clicked, starts your program?
by KCarscadden
Tue Aug 28, 2012 1:41 am
Forum: Beginners
Topic: Advice please on $DISPLAY
Replies: 25
Views: 19259

Re: Advice please on $DISPLAY

lxde is an X server, which you start with startx or startlxde. It then takes over your monitor, so then to start your program, you go to an lxterminal. (Which is of course is what you have already done.) To see this in a different way, if you can ssh to your RPi, then from your remote system (your P...
by KCarscadden
Tue Aug 28, 2012 1:24 am
Forum: Beginners
Topic: Advice please on $DISPLAY
Replies: 25
Views: 19259

Re: Advice please on $DISPLAY

Your program requires an X server to run. An X server is external to your program. geany needs an X server to run, so when you run your program from geany, there is already an X server running and your program uses it. LX terminal is also running from an X server, so your program uses the X server. ...
by KCarscadden
Sun Aug 26, 2012 4:46 pm
Forum: Python
Topic: Python version issues?
Replies: 3
Views: 1246

Re: Python version issues?

To see what your error is, the rest of the code would be necessary. But check to see whether broker or port are tuples.
by KCarscadden
Fri Aug 24, 2012 9:21 pm
Forum: Beginners
Topic: Win32 Disk Imager doesn't work
Replies: 5
Views: 1611

Re: Win32 Disk Imager doesn't work

Why do you think the card is empty? It is mostly Linux type filesystems, which Windows can't read. Try it in your RPi.
by KCarscadden
Fri Aug 24, 2012 1:58 pm
Forum: Python
Topic: error?
Replies: 30
Views: 4460

Re: error?

Indentation problem again, in lcd_byte. The line giving the error is not indented the same as the previous line, so it gets executed before anything else, including before GPIO.setup (LCD_D4, GPIO.OUT). def lcd_byte (bits, mode): GPIO.output (LCD_RS, mode) GPIO.output (LCD_D4, FALSE) Gotta go do oth...
by KCarscadden
Fri Aug 24, 2012 1:50 pm
Forum: Python
Topic: error?
Replies: 30
Views: 4460

Re: error?

Python is an interpretive language, not a compiler. So as it reads the code, it is executing it. When it hits a def, it stores it until it needs it. But when it hits something that isn't in a def, it executes it. At this point: def lcd_string (message) : message = message.ljust (LCD_WIDTH," ") for i...

Go to advanced search