I have started using Python in a real-time application (serial communication with to gps modules at once), but have found out recently about Lua. Which language would be more suited to the application?
My definition of real-time in this context is the fastest possible time to receive, process and output the data. (Feedback system)
Both are fine languages. Neither should take you years to learn. An easy way to make the decision is to look at what modules are out there already.
For example, you mentioned that your application is related to GPS. Take a look at what libraries are already written to hook Python and Lua into your particular GPS hardware. Maybe someone's already done most of the hard work for you. If not, then go down a step. If you're talking to your GPS over an I2C link, look at I2C libraries in both languages. See which ones are more popular and better maintained.
That said, garbage collected languages have historically had problems with meeting real time requirements. Depending on yours, you may need to go with a lower level language. You should also ensure that whatever system you're running on will support your programming environment. I've worked with systems where Python would have been great but it doesn't fit in 5K of code space.
Take a look at eLua and see if it meets your needs.
Related
What are pros and cons of Fabric and Plumbum python libraries for local/remote command execution? What are use cases when one library should be used and other is not? What are the differences attention should be drawn to?
background and suggested comparison methodology
(oops it's a dead post)
Both tools are fun, allow either local or remote work, but have differences in the things they are supposed to solve, i.e. "terminology", and both are basically pretty much obsolete by modern deployment/automation tooling (like ansible, and many others that chose DSL way, e.g. terraform).
Their advantage over more modern ones are lack of "opinionated" approach about the "how", and more on "what".
Suggested comparison criteria:
"Pythonness" vs. "Shellness" (i.e. how "pythonic" the user code with each is)
Special Capabilities
ROI with 2 types of maintainers of your "automation" code (ops vs. devs, let's put "QA" as something in between)
Fabric (my last work was done at 1.8 take this with a grain of time salt):
more pythonic, than shellish, this means easy to support by both old tools and new - i.e. editors, IDEs would be easy to setup
many many context processors, many decorators, very nice
easier to adopt by developers, a bit more traction would come from ops people
Plumbum
The user code can be either pythonic or shellish
"shell combinators" are a killer feature to get senior shell/perl folk onboard, but it uses dynamic imports, so editors/IDEs are a bit trickier to setup.
Due to 1. You will get 'ops' people on board easier, because of mimicking shell constructs in Plumbum, but please install good coding conventions.
Epilogue
Having worked with both toolkits (with lots of fun) and then having switched to ansible - I feel confident to claim - both tools are now superseded by ansible.
you can do most automation tasks with existing ansible modules, and what you can't - you can write a plugin or module for it (in any language), or just call shell module.
My consideration would be this:
if your team of maintainers has good level of programming skills (Esp. in python), as a requirement - you'd be ok with using either fabric, Plumbum (it has more cool hacks ;)) or Ansible.
if you have multi-level multi-team organization, I would simply bet on Ansible - it has lower learning curve, and allows to grow up easily.
Good day.
They're pretty much the same thing. The biggest win for fabric over plumbum is the ability to connect to multiple hosts in parallel, which is more or less indispensible when you're working with a non-trivial setup. fabric also offers a couple of contrib helpers that let you upload jinja templates, upload files, and transfer files back to the local system. I personally find the fabric api to be far more intuitive for working with remote servers.
YMMV, of course, but both are geared towards being very close to shell commands. That said, my team and I are focused on ansible for most configuration / deploy flows. Fabric does offer some power over ansible at the expense of having to roll your own idempotence.
I learned about them for GUIs, and they are indeed my favourite Python option for such purposes. However, they are so much more than that. They implement network sockets, media management, regular expressions, basic geometry, stuff like QVariant is basically a dynamic attribute handler...
I mean, it seems weird to just call them "GUI packages". It can be as little as a GUI, but it can also be pretty much an entire mask on top Python where you never use a naked function and rely on QObjects for everything.
Is there a name for this concept? Are there others that I should be aware about if I'm doing, say, scientific programming?
Frameworks, platforms, toolkits. PyQT calls itself a toolkit. DirectX is a full featured framework like you described, and it is intended to run on platforms like Windows and Xbox. I use the ExpressJS framework for web development, but most of it's core functionality is either in the NodeJS server, which is not officially referred to as a framework AFAIK; it exposes pretty much the whole OS through a javascript interface for server side interweb code. For scientific programming, Matlab and Octave both just call themselves languages, but I would call them platforms because they have a graphical interface and GUI building tools, and a whole ecosystem of modules, and because your code lives inside of their system. OpenGL, scipy and numpy are libraries, by contrast, because they are used as a component inside of your project. And then there are content management systems (CMS) like Wordpress and Drupal, enterprise resource planning systems (ERP) like Tryton, and probably a bunch of other sub-categories of the "framework" and "platform" categories of software.
All in all, it's not easy to categorize software. We need to standardise a taxonomy, and then make new standardized taxonomies to make up for deficiencies in the first one ;)
I'm investigating Google refine to speed up some of my data work -- never used it before this week, but I like a lot of what I see.
My biggest question so far is whether it's possible to call external python functions from Refine. I know you can call jython internally, but that doesn't provide access to C-based python libraries (e.g. lxml), and I have scripts elsewhere that I'd like to integrate, without lots of copy-paste or rewrite hassle.
What options are there for doing this in Refine? I'm willing to get creative -- I just want a stable, re-usable solution.
As Google Refine Wiki says:
lxml will NOT work in Jython, since lxml has C bindings for CPython (regular Python), hence will not work in Refine which is Jython / Java only, and has no CPython interpreter built-in
But you can try Google Refine Python Client Library to create projects and manipulate your data programmatically.
I'm going to mark reclosedev's answer as accepted, but there's still a litle more to the story.
The other answer to this question is that you can set up your own python-based API. For this project, I was able to set up a django app running on a local server. It only took an hour or so to build the API to my existing library.
More hassle than I'd have liked, but it fit the bill for this project without soaking up too much time.
Suppose I have a script written in Python or Ruby, or a program written in C. How do I ensure that the script has no access to network capabilities?
You more or less gave a generic answer yourself by tagging it with "sandbox" because that's what you need, some kind of sandbox. Things that come to mind are: using JPython or JRuby that run on the JVM. Within the JVM you can create a sandbox using a policy file so no code in the JVM can do thing you don't allow.
For C code, it's more difficult. The brute force answer could be to run your C code in a virtual machine with no networking capabilities. I really don't have a more elegant answer right now for that one. :)
Unless you're using a sandboxed version of Python (using PyPy for example), there is no reliable way to switch-off network access from within the script itself. Of course, you could run under a VM with the network access shut off.
Firewalls can block specific applications or processes from accessing the network. ZoneAlarms is a good one that I have used to do exactly what you want in the past. So it can be done programatically, but I don't know near enough about OS programming to offer any advice on how to go about doing it.
I am getting started with the development of 3d environments for using in panda3d. As I am new to this, I need to choose a modelling software to create basic geometries, etc. Therefore, which one is better suited for automation through python? 3DS Max or Blender3D? I would like to automate generating basic geometries, the export process and some basic animations. Blender has the benefit of being free, but my office will provide me the licenses for 3DS if I request, so that is not a problem.
From a python automation point of view, blender itself is written largely in python, and the source is available which allows a level of automation not possible if you can't change the source. To me, having the source available in that situation is more of a benefit than the price tag.
If you do go with blender, definitely grab the 2.5 beta. They made some huge UI and scripting improvements. In my opinion, most of the complaints about it being difficult to learn compared to commercial packages are no longer valid for 2.5, especially if you don't have the mental burden of already having learned another software's interface.
Actually the poster Karl Bielefldt is wrong. Blender is not written in python is written in C. What is written in python is some script tools, python is used as blender's script engine , but in the end what is triggered are C libraries. That is not big deal though since python itself is written in C.
However all this is totally unrelated to your question.
Since the engine you are going to use is third party and not the game engine of blender, there is no reason for you to consider Blender as a mandatory choice. Any 3d package can serve you well. This is because as other kind of software, 3d software has several formats that are common ammong 3d apps. Like *.3ds and *.obj . So that means that you can use anything you wish like Maya, XSi, Ciname 4d , anything. As almost 3d software saves to these common file formats.
However I would strongly advice to take a look at blender game engine. The blender game engine automates alot of things and has a gui inside blender that minimises coding unlike Panda 3d which requires everything to be coded regarding the engine.
You can save loads of time with blender's game engine.
There is even a blender game that was developed using solely with the blender game engine , its called project apricot or Yo Fankie.
Apricot Project
You can download it for free and see the source to help you learn loads of things for Blender Game engine.
Good luck.