Newbie: OSX Dev Environment

May 18, 2016 22 Replies

Hi folks



My name is Victor Espina and I am a senior programmer, mainly VFP, C# and J avaScript. I am working on a project with a friend, using a Raspberry PI 3 board to basically collect data from a device connected to the Raspberry, save it to a local database and then send new collected data to a remote da tabase using a REST webservice.



My working machine is a MacMini running the last version of OSX, and I woul d like to know the best way to create a dev environment to create the progr ams I need for the Raspberry, without having the actual device.



I've try to follow a couple of guides to get a working Raspbian environment with no luck so far.



Also, I would like to know your suggestions regarding the best language to create simple daemons (my goal is to create two daemons: one that collects the data from the external device and save it to a local Sqlite db, and ano ther that reads this new data and post it to a remote REST webservice.



TIA


Victor Espina


mmm. I would install a Linux system - Debian, Ubuntu or Mint, - on a virtual machine in that Mac.

Programs that compile and work there should compile and work on a pi. Somne of te IO may need tweaking.

C for me. No question.

The way I handle this is to use cron to invoke a C program rather than a true daemon in its own right, when I want periodic sweeps of data into a database

I also prefer Mysql or mariadb to sqlite

However in the end its a matter of choice, and a lot of code is being done in Python these days.

I would say that if you are using cron as the daemon, a less low level language than C may suit you, but for an actual daemon itself, running detached from a terminal, C is the choice for me.

No Apple devices were knowingly used in the preparation of this post.

Purchase Vmware Fusion, install it and create a Linux virtual machine on it. For compatibility, it may be a good idea to install the Debian distribution as the Linux.

The Pi Raspbian is a derivative of Debian.

There are also development tools that can be run on the Linux machine to cross-compile binaries for Pi, but I found it easier to do the Pi binaries on Pi itself, less hassle with library versions etc.

-TV

Or use the free Virtual Box, just try to forget its branded as Oracle these days.

---druck

In article (Dans l'article) , Victor Espina

I'm using VirtualBox with Debian on my MacBook Pro and El Capitan.

Jean-Pierre Kuypers

It works very well. It does make me wince when the Oracle logo appears etc. but it's free and does what it says on the tin. I normally run it on RedHat Linux machines to host some sensible Mint or Debian images. Sometimes used to run Win7 clean as our IT dept. insists on loading Win7 with so much Symmantec and WebSense junk they're unusable. I prefer it over the free VMware. Even if it does say Oracle!

On Wed, 18 May 2016 07:09:04 -0700 (PDT), Victor Espina declaimed the following:

What response time and loading do you expect?

I'd be tempted to suggest -- at least for prototype -- using the language the Raspberry was intended to expose... Python

Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

I didnt recommend virtualbox because I didnt know if it ran on OSX.

Having used it and VMware I would say Vmware is more suitable for virtualised servers, but for desktop work VirtualBox is the best.

If you tell a lie big enough and keep repeating it, people will eventually come to believe it. The lie can be maintained only for such time as the State can shield the people from the political, economic and/or military consequences of the lie. It thus becomes vitally important for the State to use all of its powers to repress dissent, for the truth is the mortal enemy of the lie, and thus by extension, the truth is the greatest enemy of the State. Joseph Goebbels

Thanks all for your answers. I use Parallel Desktop for virtualization, so I can eaasily create a debian VM and work there. I also think C could be a good tool for tke the task, but I wonder if I can take the opportunity to learn Phyton, wich is very popular these days and would be a nice adding t o my programming skills :)

Syntax is very critical in Phyton;-)

At beware the Evil Phyton Witch

Yet another obscure syntax providing exactly the same programming constructs.

New Socialism consists essentially in being seen to have your heart in the right place whilst your head is in the clouds and your hand is in someone else's pocket.

and every other programming language

python has very reasonable c-style syntax for the most part the differences are either good ideas inherited from other languages or restrictions to prevent common programming errors.

python is deliberately a very readable language. (form the zen of python

- Readability counts!)

1 advantage over C is that it is an interpreted language so development & debugging can be much faster.

1 disadvantage over C is that it is an interpreted language so speed critical functions cannot be so easily fine tweaked for performance.

except for Operating systems & device drivers this is not usual a major issue.

reading the original post I would say that Python is an ideal language for this requirement as many if not all of the features required would be available in the python standard library.

if you write the code in python on the MAC in python it should run unchanged on the PI.

Facts do not cease to exist because they are ignored. -- Aldous Huxley

Python for fast writing and easy maintenance, C for efficient code. If you're going python then IMHO you should also go OO and think about your abstractions before you start coding on anything bigger than a simple script.

Steve O'Hara-Smith | Directable Mirror Arrays C:>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/

If you're fluent with C, go ahead. C is the native language of Linux.

-TV

, so I can eaasily create a debian VM and work there. I also think C could be a good tool for tke the task, but I wonder if I can take the opportunit y to learn Phyton, wich is very popular these days and would be a nice addi ng to my programming skills :)

I am not fluent in C. Haven't done anything on it since my college days. In the other hands, after reading some papers I now realize that the cron w ay is not for me, since my process should be fired very often, like every 1

0 or 15 seg.

Also, I understand that there are python libraries that allows to daemonize python scripts. Since I can actually get more uses for python thant for C , in my normal work, I think I will get python a shot.

Thanks all for your help and information.

Victor

Remember, systemd (instead of /etc/init.d) is the way forward from Jessie onwards :/

Mm. You can do that under cron, but its a bit ugly

I would say that unless you are needing severely small code or high performance, IF you dont *do* C and IF there is a python library that does what you want, then that is indeed the best approach. Learn Python.

?it should be clear by now to everyone that activist environmentalism (or environmental activism) is becoming a general ideology about humans, about their freedom, about the relationship between the individual and the state, and about the manipulation of people under the guise of a 'noble' idea. It is not an honest pursuit of 'sustainable development,' a matter of elementary environmental protection, or a search for rational mechanisms designed to achieve a healthy environment. Yet things do occur that make you shake your head and remind yourself that you live neither in Joseph Stalin?s Communist era, nor in the Orwellian utopia of 1984.? Vaclav Klaus

El lunes, 23 de mayo de 2016, 10:49:08 (UTC-4), The Natural Philosopher esc

As I said in the OP, I just need to create two process:

1) One that reads data from a mounted drive and save that data to a local d atabase b) One that reads the unsent rows in the local database and send them to a REST webservice.

None of them need to be particularly high perfomance, but both needs to be fired very often.

lism

ellian

'every 10-15 seconds' is more frequently than cron jobs are designed for (they are generally run at intervals ranging from months to minutes) but, that said, if a process needs more frequent activation than that, it is usual for it to either 'tick' once every second or two on an internal timer and/or to be activated by external events. Processes written in C and, IIRC, Python can do both.

martin@ | Martin Gregorie gregorie. | Essex, UK org |

yeah. Its not the easiest time to wake up a daemon in, especially if precision is required.

No Apple devices were knowingly used in the preparation of this post.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required