Go to advanced search

by BlackJack
Tue Nov 20, 2012 11:13 pm
Forum: Python
Topic: make your python talk
Replies: 8
Views: 8731

Re: make your python talk

@fdion: I don't think of `os.system()` as simple. More as complicated — starts a shell in between the calling program and the external one — and complicated to use correctly — needs thinking about escaping for an unknown shell. The return value is useless because its not clear if it is coming from t...
by BlackJack
Tue Nov 20, 2012 7:31 am
Forum: Python
Topic: make your python talk
Replies: 8
Views: 8731

Re: make your python talk

@fdion: `os.system()` has a bag full of problems. For instance it starts a shell and the command / argument you are giving is interpreted by that shell. That means you have to escape everything the shell might see as special syntax. That's why the `subprocess` module was introduced to the standard l...
by BlackJack
Mon Nov 19, 2012 9:20 pm
Forum: General programming discussion
Topic: British-made programming language
Replies: 54
Views: 10268

Re: British-made programming language

Isn't all this a bit off topic unless we also see if there are implementations that could run on the Raspi? :-)

For REXX there is a Debian package named `regina-rexx` for instance.
by BlackJack
Mon Nov 19, 2012 7:28 pm
Forum: Python
Topic: Strategies for configuring wifi on a headless RPi
Replies: 3
Views: 659

Re: Strategies for configuring wifi on a headless RPi

@GuitarExtended: How do you reach the web interface in option one without a working wifi connection? ;-)
by BlackJack
Sun Nov 18, 2012 1:04 pm
Forum: General programming discussion
Topic: Game Programming Questions
Replies: 4
Views: 1172

Re: Game Programming Questions

@Liuqahs15: Ad 1.: Source please. And which Qt? I mean which Linux distribution we are talking about? I see no reason why the number of PNGs should be limited by something other than (virtual) memory. Ad 2.: The Raspbian distribution is based on Debian Wheezy. SDL works — it is used via Pygame by th...
by BlackJack
Sun Nov 18, 2012 12:45 pm
Forum: Python
Topic: Trouble with GUI
Replies: 2
Views: 526

Re: Trouble with GUI

@Dog glitz: Maybe you started IDLE for Python 3? There ``print`` is a function and not a keyword.
by BlackJack
Sat Nov 17, 2012 10:27 pm
Forum: General programming discussion
Topic: Autorun Python
Replies: 7
Views: 4973

Re: Autorun Python

@beautifulsmall: Any chance you did not start the program asynchronously from ``/etc/rc.local`` so that skript never comes to an end and blocks the startup process‽

Can you stop the program by pressing Ctrl + C at the text screen to get to the text prompt?
by BlackJack
Sat Nov 17, 2012 9:01 pm
Forum: Python
Topic: Upgrading Python
Replies: 10
Views: 2462

Re: Upgrading Python

@dalpets: As 3.1 is the Python 3 available in Debian 6 I guess the author has used Debian 6. If he used Debian, or even Linux at all. Just go with Raspbian and the 3.2.3 installed there along with IDLE called IDLE3 as gordon77 pointed out. You really don't have to match the version exactly as long a...
by BlackJack
Fri Nov 16, 2012 9:03 pm
Forum: Python
Topic: Idle3. No horizontal scroll bar in edit window.
Replies: 1
Views: 443

Re: Idle3. No horizontal scroll bar in edit window.

@BerryPicker: Seems to be. Shouldn't be a problem — just don't write excessively long lines. The Style Guide for Python Code suggests a 79 characters per line limit.
by BlackJack
Fri Nov 16, 2012 4:27 pm
Forum: Python
Topic: Upgrading Python
Replies: 10
Views: 2462

Re: Upgrading Python

@gordon77: Raspbian is based on Debian 7 (code name Wheezy) so it should not be so surprising it has newer versions of some packages than Debian 6 (code name Squeeze).
by BlackJack
Fri Nov 16, 2012 1:02 pm
Forum: Other languages
Topic: MySQL: Writing trigger that uses custom function
Replies: 2
Views: 1054

Re: MySQL: Writing trigger that uses custom function

@FeersumEndjinn: Looks like the closing parenthesis for the SELECT expression is missing or rather moved to the end of the next line. Untested:

Code: Select all

BEGIN 
UPDATE candles 
SET can_materials_cost = (SELECT calculateMaterialCost(NEW.can_id))
WHERE candles.can_id = NEW.can_id; 
END
by BlackJack
Thu Nov 15, 2012 8:48 am
Forum: C/C++
Topic: Compiling for c++11
Replies: 9
Views: 16427

Re: Compiling for c++11

@joan: You can, but it is not the same if there is code to be executed between the declaration and assigning an „array constant” to it.

Code: Select all

int xs[4];

// Some code goes here…

if (condition) {
    xs = {1, 2, 3, 4};
} else {
    xs = {42, 23, 4711, 0};
} // …
by BlackJack
Thu Nov 15, 2012 8:03 am
Forum: Python
Topic: Pi3D
Replies: 241
Views: 24508

Re: Pi3D

@JamesR: Just a guess based on the traceback: You are missing the Python Imaging Library (PIL). The Debian package name is `python-imaging`.
by BlackJack
Thu Nov 15, 2012 6:48 am
Forum: General programming discussion
Topic: show information on a webpage
Replies: 4
Views: 3773

Re: show information on a webpage

@cazz: I would use Python and the `psutil` module for that. There is RaspberryPi specific information which can't be determined with `psutil` like temperature, model type, or the overvolting flag, but for those you'll find code snippets here in the forums. For the web part I would use Bottle . Both ...
by BlackJack
Wed Nov 14, 2012 8:36 pm
Forum: Python
Topic: simple adventure game.
Replies: 22
Views: 5393

Re: simple adventure game.

A programming language is not just syntax. There is also idiomatic usage. Not everything the compiler accepts and the interpreter runs, qualifies as being idiomatic Python. For teaching a language I think it is a good idea to teach idiomatic usage and conventions used by the community. `cmd`, `actio...
by BlackJack
Wed Nov 14, 2012 7:28 pm
Forum: Graphics programming
Topic: cpan installing
Replies: 5
Views: 2818

Re: cpan installing

@Kurt: The Debian package I mentioned with ``apt-get`` (command line), or ``aptitude`` (still console but ”full screen user interface”), or ``synaptic`` (GUI application). If something can be installed with the package system of the Linux distribution I would prefer this over other ways unless there...
by BlackJack
Wed Nov 14, 2012 6:09 pm
Forum: Python
Topic: PYTHON NOOB ALERT.... Please Help Me.... PLEASE
Replies: 26
Views: 2972

Re: PYTHON NOOB ALERT.... Please Help Me.... PLEASE

@Bigcat123: Again: Look through the functions in the `random` module. Look at each function in the documentation of the module, read the description, think if it might be useful for the task at hand, and try to understand the example code.
by BlackJack
Wed Nov 14, 2012 4:02 pm
Forum: Python
Topic: PYTHON NOOB ALERT.... Please Help Me.... PLEASE
Replies: 26
Views: 2972

Re: PYTHON NOOB ALERT.... Please Help Me.... PLEASE

In addition to the three tools mentioned by techpaul the relevant documentation is also very helpful. There is a function in the `random` module which helps with bringing the words in the list into random order.

Edit:

Documentation: http://docs.python.org/2/library/random.html
by BlackJack
Wed Nov 14, 2012 9:00 am
Forum: Graphics programming
Topic: cpan installing
Replies: 5
Views: 2818

Re: cpan installing

Which operating system are you running on your Raspi? I would expect the GD library and the Perl bindings for it to be in the package system of every decent Linux distribution. On Debian Wheezy the package is called `libgd-gd2-perl`.
by BlackJack
Wed Nov 14, 2012 8:44 am
Forum: Python
Topic: WiringPython - WiringPi for Python
Replies: 205
Views: 58264

Re: WiringPython - WiringPi for Python

@salawinder: You have to actually *call* the setup function. The call operator in Python is a (possibly empty) sequence of arguments in parenthesis. Just writing the name of a function results in the function object itself but does not call it automagically.
by BlackJack
Mon Nov 12, 2012 6:27 pm
Forum: C/C++
Topic: C vs Python for GPIO
Replies: 24
Views: 14378

Re: C vs Python for GPIO

@jamesh: I did not focus on execution speed when I put C++ in the middle but on language features like syntactic sugar, OOP, foreach loops, automatic memory management, contents of the standard library and so on. I favor developement speed over execution speed as long as it executes fast enough. Whi...
by BlackJack
Sun Nov 11, 2012 8:55 pm
Forum: C/C++
Topic: C vs Python for GPIO
Replies: 24
Views: 14378

Re: C vs Python for GPIO

Count me under others that will disagree. ;-) I don't think C++ is easier than C. I find it *much* more complex and hard to get all the details right. Having C as ”platform independent macro assembler” on one side and high level languages like C#, Java, Python, Ruby on the other, C++ always seems to...
by BlackJack
Sun Nov 11, 2012 8:41 pm
Forum: Python
Topic: Running a never ending loop Python script at startup
Replies: 19
Views: 7400

Re: Running a never ending loop Python script at startup

@zitman: I guess all those unnecessary semicolons are also a personal thing for you‽ ;-) Writing a function for the BCD conversion makes the code a bit shorter/cleaner. A bare ``except`` without any specific exceptions isn't a good idea. You are reducing every possible exception to a message how man...
by BlackJack
Sun Nov 11, 2012 7:48 pm
Forum: Python
Topic: GPIO, UART, Python and an Arduino
Replies: 7
Views: 4066

Re: GPIO, UART, Python and an Arduino

@zitman: That's the 9600 in your example.
by BlackJack
Sun Nov 11, 2012 6:34 pm
Forum: C/C++
Topic: C vs Python for GPIO
Replies: 24
Views: 14378

Re: C vs Python for GPIO

@rickseiden: If you don't want to deal with ``struct``\s and pointers then C is not for you. :-) The C standard library is very limited compared to the amount of data structures and algorithms and building blocks you get with high level languages. But there are libraries that offer some of that stuf...

Go to advanced search