Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Python or Java

  • 05-05-2017 7:03pm
    #1
    Registered Users, Registered Users 2 Posts: 6,262 ✭✭✭


    Looking to do some development on a PI.
    Want to create a UI with some buttons that does some back end stuff and renders the PI camera on the screen also (maybe with some face recognition). Possibly looking to integrate a 3G Module for data connection

    Never used python before, but quite proficient in C# and have some apps in Android a few years ago.

    In terms of the pi, and its limited resources you can't necessarily use a heavyweight ide like eclipse on it, so I'm wondering what's the best approach for developing on a PI in peoples opinions?


Comments

  • Registered Users, Registered Users 2 Posts: 768 ✭✭✭14ned


    In terms of the pi, and its limited resources you can't necessarily use a heavyweight ide like eclipse on it, so I'm wondering what's the best approach for developing on a PI in peoples opinions?

    Python runs absolutely fine on a Rasp PI. And indeed on CPUs far slower. Interpreted languages are much easier to develop on low end hardware than compiled stuff for sure.

    Niall


  • Moderators, Computer Games Moderators, Technology & Internet Moderators Posts: 19,242 Mod ✭✭✭✭L.Jenkins


    Looking to do some development on a PI.
    Want to create a UI with some buttons that does some back end stuff and renders the PI camera on the screen also (maybe with some face recognition). Possibly looking to integrate a 3G Module for data connection

    Never used python before, but quite proficient in C# and have some apps in Android a few years ago.

    In terms of the pi, and its limited resources you can't necessarily use a heavyweight ide like eclipse on it, so I'm wondering what's the best approach for developing on a PI in peoples opinions?

    You're proficient in C#, so Java should be easy to pick up. You could always test your code on the PI, while developing it on a PC. Otherwise you could develop code in the CL and compile it there.

    I'd more that likely use Python if I were more proficient in it myself. Would you not develop a front end for your PC/Laptop and remote shell to the PI for back end?


  • Registered Users, Registered Users 2 Posts: 6,262 ✭✭✭Buford T Justice


    14ned wrote: »
    Python runs absolutely fine on a Rasp PI. And indeed on CPUs far slower. Interpreted languages are much easier to develop on low end hardware than compiled stuff for sure.

    Niall

    So my question really is, can you reach the same level of functionality with python as you could with Java on such a device, and it it much of a detraction from the methodology employed by these OO languages? Since it's a project that will be assessed, I'd like to try to implement SOLID principles in as much as possible.


  • Registered Users, Registered Users 2 Posts: 6,236 ✭✭✭Idleater


    So my question really is, can you reach the same level of functionality with python as you could with Java on such a device

    I think (and did a quick google) but the "pi" part refers to python, and the original idea behind the raspberry pi was an affordable learning computer. I'd have no concerns about the functionality that python can deliver. It's also very easy to learn and get up to speed on.


  • Registered Users, Registered Users 2 Posts: 768 ✭✭✭14ned


    So my question really is, can you reach the same level of functionality with python as you could with Java on such a device, and it it much of a detraction from the methodology employed by these OO languages? Since it's a project that will be assessed, I'd like to try to implement SOLID principles in as much as possible.

    SOLID, heh. I haven't written code except for coursework complying with that in well over a decade, if ever.

    If it's for coursework, writing it in Java is the safest choice. Java is well understood by those marking coursework. Python really isn't, any Python (or C++) I wrote would get a lousy mark because the people doing the marking are rarely professional programmers.

    I had figured you were playing with a Rasp PI in your spare time, if so Python is the best tool to solve your problem. If it's for assessed coursework, Java is least risk.

    Niall


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 6,262 ✭✭✭Buford T Justice


    14ned wrote: »
    SOLID, heh. I haven't written code except for coursework complying with that in well over a decade, if ever.

    If it's for coursework, writing it in Java is the safest choice. Java is well understood by those marking coursework. Python really isn't, any Python (or C++) I wrote would get a lousy mark because the people doing the marking are rarely professional programmers.

    I had figured you were playing with a Rasp PI in your spare time, if so Python is the best tool to solve your problem. If it's for assessed coursework, Java is least risk.

    Niall

    Its both really. I have one for the summer to tinker and play with, and as a group we will be using one as part of a 3rd year project in September. I also have a real interest in the IOT space, since there are vast possibilities.

    Its only one part of the project, so there'll be other languages used elsewhere. Guess I'm just trying to do things "the right way" if such a thing ever existed.

    As an institution they are actively encouraging us to use non syllabus languages and technologies, so I'd hope their lack of understanding of something wouldn't affect the marking....

    I'd hope.


  • Registered Users, Registered Users 2 Posts: 121 ✭✭DefinitelyMarc


    Its both really. I have one for the summer to tinker and play with, and as a group we will be using one as part of a 3rd year project in September. I also have a real interest in the IOT space, since there are vast possibilities.

    Its only one part of the project, so there'll be other languages used elsewhere. Guess I'm just trying to do things "the right way" if such a thing ever existed.

    As an institution they are actively encouraging us to use non syllabus languages and technologies, so I'd hope their lack of understanding of something wouldn't affect the marking....

    I'd hope.

    Which college is this?


  • Registered Users, Registered Users 2 Posts: 6,262 ✭✭✭Buford T Justice


    Which college is this?

    Any particular reason you ask?


  • Registered Users, Registered Users 2 Posts: 1,931 ✭✭✭PrzemoF


    OP, check pygame. I run it on Pi Zero W without any problems


  • Registered Users, Registered Users 2 Posts: 121 ✭✭DefinitelyMarc


    Any particular reason you ask?

    I suppose it doesn't make a difference, since I don't know all colleges in Ireland in-depth, but beware going too far off the path if the college is just saying "Use stuff that isn't on the syllabus to make us look good".

    I mean, if you can use new tech then great. You can make something truly innovative and get top marks. If you can't, you end up wasting time. And that's something you'd want to keep in mind with a thesis/big project deadline looming over your head. In your final year, every day counts.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 6,262 ✭✭✭Buford T Justice


    To that end, I'm looking to build a UI that will incorporate the PiCamera and some buttons and possibly a web frame within. Is there something native to Python that I can use to whip up a UI, or should i look at using swing in java?
    I've heard of pygame, but it doesn't seem to fit what I want. Also heard of tkinter but it didn't install so easy when I was messing with it earlier

    For reference, my experience is in UI's have all been in web technologies delivered in-browser with the exception of wpf...


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    You should use Python, with Qt for the gui, and OpenCV to do image stuff. Speed should not be an issue at all, since all your libraries are in C++ and really fast. Nothing is really "native" to python! Note if you are gonna learn Python use NumPy right from the start... Easiest way to get this good stuff is to install "anaconda" python as your distribution rather than the vanilla one.

    Sure you could use Java, but it would take you a lot longer and probably deliver inferior results. You would have to spend a lot of time screwing around trying to get bindings working for libraries etc, something that is trivial in python (use pip or conda for package management).

    You didn't specify a platform, windows, linux or mac? Any can be used with python, but linux works best (windows and mac often need hacky steps to install libraries etc). For windows you will have to go to following website allll the time: http://www.lfd.uci.edu/~gohlke/pythonlibs/


  • Registered Users, Registered Users 2 Posts: 6,262 ✭✭✭Buford T Justice


    srsly78 wrote: »
    You should use Python, with Qt for the gui, and OpenCV to do image stuff. Speed should not be an issue at all, since all your libraries are in C++ and really fast. Nothing is really "native" to python! Note if you are gonna learn Python use NumPy right from the start... Easiest way to get this good stuff is to install "anaconda" python as your distribution rather than the vanilla one.

    Sure you could use Java, but it would take you a lot longer and probably deliver inferior results. You would have to spend a lot of time screwing around trying to get bindings working for libraries etc, something that is trivial in python (use pip or conda for package management).

    You didn't specify a platform, windows, linux or mac? Any can be used with python, but linux works best (windows and mac often need hacky steps to install libraries etc). For windows you will have to go to following website allll the time: http://www.lfd.uci.edu/~gohlke/pythonlibs/


    Probably initial development on a windows box (simple ui and stuff) and the remaining work on a raspberry pi, where ultimately it'll run


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    Install virtualbox/whatever and run linux dev vm on your windows so - all free. Dev environment will be very similar to target then. Hell you could probably just use the pi itself as a linux/python dev environment.

    Not sure about linux on the pi, but most modern linuxes actually have python as an integral system component. Don't mess with this when installing/updating packages - instead install your dev python in a different place. Example: /usr/share/anaconda2


  • Registered Users, Registered Users 2 Posts: 768 ✭✭✭14ned


    srsly78 wrote: »
    Install virtualbox/whatever and run linux dev vm on your windows so - all free. Dev environment will be very similar to target then. Hell you could probably just use the pi itself as a linux/python dev environment.

    Windows 10 can natively run Linux nowadays, so no need for VMs.

    Look into "Windows Subsystem for Linux", it comes with Win10. It's an amazing productivity boon, I do almost all my work on Windows now using WSL in place of Linux. Visual Studio 2017 can now also run GDB debugging runs on Linux, so you basically never leave Windows now for cross platform development.

    Well done Microsoft, you finally converted me to you!

    Niall


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    Yeah it works very well for a lot of things, could be used to do Qt/Python/C++ development. I can't use it for work tho because there is no gpu support right now.

    Well that and the fact corporate GIS are still stuck on windows 7!


  • Registered Users, Registered Users 2 Posts: 768 ✭✭✭14ned


    srsly78 wrote: »
    Yeah it works very well for a lot of things, could be used to do Qt/Python/C++ development. I can't use it for work tho because there is no gpu support right now.

    It depends what you mean by GPU support. If you install an X server on Windows such as https://sourceforge.net/projects/vcxsrv/, as of the Creator's Update you can launch gnome, kde, or any of the desktop apps, or indeed the full Linux desktop. They're a little laggy, but entirely usable.

    Some people say that hardware accelerated OpenGL works from WSL, but I found here it does not for my onboard Intel graphics. I didn't try very hard though.

    Niall


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    Yeah but that's running X server on windows, not in linux subsystem. Hmm I will try it out. Still no gpu compute tho.


    https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/16108045-opencl-cuda-gpu-support

    Microsofts suggestions made me laugh: "One thing to explore in the meantime is to try running your code in Windows."

    CUDA can actually product cross-platform binaries (cubins/fatbins) - but it's the driver in between that causes compatibility issues. How get get linux nvidia driver to talk to windows one?


Advertisement