Heater
Posts: 14760
Joined: Tue Jul 17, 2012 3:02 pm

Re: The Pi as a development platform

Thu Jan 29, 2015 2:56 pm

peepo,

Ah, sorry. Seems the madgwick demo version I linked to is not quite the same as the github version.

Basically the github version is waiting for serial data from an IMU, where as the demo is generating some test data all by itself.

Thing is the main point of all this is the madgwickAHRS and mahonyAHRS javascript files in the repository that anyone could take and use for whatever they like. The rest of it is just a wrapper for me to debug the thing and demo it in the browser. So there is no HOWTO or documentation. Although there should be because even I will forget what it is about and how it works soon enough.

This demo does not concern itself with what the actual sensors are or how they are interfaced, SPI, i2c etc etc. Although it does have a serial port interface for getting such data from some attached device.

I'l try and find some time to write something to explain all this and say how it can be used.

Feel free to remind about this again in case I get diverted and forget all about it.
Memory in C++ is a leaky abstraction .

plugwash
Forum Moderator
Forum Moderator
Posts: 3550
Joined: Wed Dec 28, 2011 11:45 pm

Re: The Pi as a development platform

Thu Jan 29, 2015 9:16 pm

Heater wrote:Ah yes, they do look nice. Why would anybody ever use non-pretty URLs ?
A couple of reasons.

1: "query" style urls are easier on the programmer than path style urls because they avoid the need for the programmer to arrange things into a heirachy but are much uglier for users.
2: most database driven systems will use numbers as their primary identifier for database rows internally but users find numbers ugly and hard to remember.. Generating a url which is short enough that users won't find it overly long while at the same time meaningful to the user and unique (for example on a forum you can't just use the thread title as the url because it can be very long and because you get duplicate thread titles) can be nontrivial.

Producing "good" pretty urls is tricky.

Heater
Posts: 14760
Joined: Tue Jul 17, 2012 3:02 pm

Re: The Pi as a development platform

Fri Jan 30, 2015 10:37 am

plugwash,

I don't follow you. Here is an example of an "ugly" url
http://example.com/index.php?mod=profiles&id=193
and the "pretty" version taken from wikipedia
http://example.com/profiles/193

Clearly the pretty version is much nicer.

0) The ".php" is redundant. This implies the implementation of this feature on the server is done in PHP. That is an implementation detail that should not have to appear in the API. Bad practice.

1) The "mod=" and "id=" are redundant. And who knows what "mod" and "id" or whatever other parameter means anyway? Useless noise.

2) The "?" and "%" are just ugly syntax,

I don't believe either style makes any difference to the programmer. It's just as easy to get those parameters either way. For example in node.js servers we might see:

Code: Select all

app.get('/profiles/:id', routes.sample);
Where the routes.sample function gets at the params with:

Code: Select all

id = req.params.id
Where as for the ugly style we have:

Code: Select all

id = req.query.id
Or you can even get either style with this:

Code: Select all

var color = req.param('id');
There is no need to put things in a hierarchy in either case although the pretty style demands that the params are given in the right order.

How data bases work is neither here nor there. Many databases use strings as keys. Some data bases can use complex objects as keys. A usere should not have to know or care if there is a numeric id used in the implementation of his account.

As an example the url of this post as I see it now could be:
http://www.raspberrypi.org/forum/post/r ... 9/#preview
Much nicer and with no impact on the programmer who has to handle it at the other end.
Producing "good" pretty urls is tricky
I agree.

Actually I think designing a good API in either pretty or ugly styles is tricky.

But either way you go makes almost zero difference to the programmer.

Edit: However, there will be cases where it might be wise to use both path and query urls. Where the path identifies some resource you are accessing and the query params specify something about that query. For example when fetching a list of all users one might want to only get ten at a time so this would do it:
http://www.raspberrypi.org/forum/users?start=20&size=10

The general idea is that the path identifies some resource and the query params say something about the query on that resource.
Memory in C++ is a leaky abstraction .

beagile
Posts: 9
Joined: Tue Mar 03, 2015 9:24 pm

Re: The Pi as a development platform

Tue Mar 03, 2015 9:56 pm

Hi BillStephenson,

just wanted to add my 2c regarding Raspberry Pi as development plattform and containers.
Basically I would say it makes really a lot of sense to use something as Docker for development. Boot2Docker show how to do this for the Mac.

And the same is possible with your Raspberry Pi today. We just released a new version of our Get-Docker-Up-And-Running-On-Your-Pi-In-No-Time SD card image. It is based on Rasbian and includes a recent 3.18.8 kernel with the lastes Docker 1.5.0 version. Getting up and running only requires one to flash a SD card with our image.

Afterwards you can use our prepared Docker Images for various languages and frameworks: https://hub.docker.com/u/hypriot/

You can find our image and information about how to use it here: http://blog.hypriot.com/heavily-armed-a ... -1-dot-5-0

Govinda
- blog.hypriot.com

BillStephenson
Posts: 254
Joined: Thu May 17, 2012 1:25 am
Location: SW Missouri Ozarks
Contact: Website

Re: The Pi as a development platform

Wed Mar 04, 2015 4:36 am

beagile wrote:Hi BillStephenson,

just wanted to add my 2c regarding Raspberry Pi as development plattform and containers.
...

Govinda
- blog.hypriot.com
Thank you for sharing that here. I look into this asap.

I've not had the chance to play with Docker yet, but it's been something I've wanted to look into since Heater mentioned it. This certainly peaks my interest in getting started. I just got my Pi 2 a few days ago so the timing is perfect!

Return to “General discussion”