Tag Archives: Perl

Unidecode for NodeJS


via FGRibreau/node-unidecode · GitHub.

Unidecode is JavaScript port of the perl module Text::Unicode. It takes UTF-8 data and tries to represent it in US-ASCII characters (i.e., the universally displayable characters between 0x00 and 0x7F). The representation is almost always an attempt at transliteration — i.e., conveying, in Roman letters, the pronunciation expressed by the text in some other writing system.

See Text::Unicode for the original README file, including methodology and limitations.

Note that all the files named ‘x??.js’ in data are derived directly from the equivalent perl file, and both sets of files are distributed under the perl license not the BSD license.

STDIN/STDOUT into a WebSocket server


via joewalnes/websocketd · GitHub.

websocketd is a small command-line tool that will wrap an existing command-line interface program, and allow it to be accessed via a WebSocket.

WebSocket-capable applications can now be built very easily. As long as you can write an executable program that reads STDIN and writes to STDOUT, you can build a WebSocket server. Do it in Python, Ruby, Perl, Bash, .NET, C, Go, PHP, Java, Clojure, Scala, Groovy, Expect, Awk, VBScript, Haskell, Lua, R, whatever! No networking libraries necessary.

Hacking Mac OS X Cocoa API from Perl


JavaScript Tutorial: Understand JavaScript in Depth


via JavaScript Tutorial: Understand JavaScript in Depth.

This JavaScript tutorial is simple, practical, example based. Each page has links to ECMAScript Language Specification when appropriate.

Read the basics section if you are new. In 1 hour you will be able to code JavaScript.
If you have JavaScript experience, the rest sections cover the language in depth. You will get a complete understanding of its prototype inheritance system. JavaScript is a language very different from {C, Java} and very different from {Python, Perl, Ruby} too, because of the prototype inheritance system.
The DOM sections get you started in web application programing. Focusing on understanding how to script DOM with practical examples. It teaches you how to write web app without JQuery or other lib/frameworks.

How to Develop Quality Python Code


Click to Read

Developing in Python is very different from developing in other languages. Python is an interpreted language like Ruby or Perl, so developers are able to use read-evaluate-print loops (REPLs) to execute Python in real-time. This feature of Python means that it can be used for rapid development and prototyping because there is no build process. Python includes many functional programming tools akin to Scala or Javascript to assist with closure based script development. But Python is also a fully scalable object-oriented language, a paradigm used to build large modular software rather than to simply execute scripts, more akin to Java or C++.

Python sits in the middle of these paradigms, providing the best of many worlds. Python is used for writing quick one-off scripts, large scale web frameworks like Django, data processing with Celery, even numerical and scientific computing. Python is lightweight, is standard on many operating systems, and is effective, thereby making it the top choice for data scientists and analysts for data engineering and analytical tasks.

However, the breadth of Python means that there is no one workflow to developing with it, and certainly there is no standard IDE or environment framework to make these decisions on your behalf. Most Python educational materials focus on the scripting aspects of the language, leaving out the important details of how to construct larger projects. This post will focus on the question of how a developer interacts with Python to build larger data applications.

firmata firmware for arduino


examples revert include of Firmata.h to systems one 2 years ago
test added missing newline to make github stop complaining 2 years ago
.gitignore update gitignore 2 years ago
Boards.h added Teensy 3.0 to boards.h 2 years ago
Firmata.cpp restored Serial.begin(speed) to earlier version so blinkVersion is ca… a year ago
Firmata.h bumped bugfix version a year ago
LICENSE.txt changed directory layout 3 years ago
keywords.txt changed directory layout 3 years ago
readme.md Added a PHP client library. 6 months ago

Firmata

Firmata is a protocol for communicating with microcontrollers from software on a host computer. Theprotocol can be implemented in firmware on any microcontroller architecture as well as software on any host computer software package. The arduino repository described here is a Firmata library for Arduino and Arduino-compatible devices. See the firmata wiki for additional informataion. If you would like to contribute to Firmata, please see the Contributing section below.

Usage

There are two main models of usage of Firmata. In one model, the author of the Arduino sketch uses the various methods provided by the Firmata library to selectively send and receive data between the Arduino device and the software running on the host computer. For example, a user can send analog data to the host using Firmata.sendAnalog(analogPin, analogRead(analogPin)) or send data packed in a string using Firmata.sendString(stringToSend). See File -> Examples -> Firmata -> AnalogFirmata & EchoString respectively for examples.

The second and more common model is to load a general purpose sketch called StandardFirmata on the Arduino board and then use the host computer exclusively to interact with the Arduino board. StandardFirmata is located in the Arduino IDE in File -> Examples -> Firmata.

Firmata Client Libraries

Most of the time you will be interacting with arduino with a client library on the host computers. Several Firmata client libraries have been implemented in a variety of popular programming languages:

Note: The above libraries may support various versions of the Firmata protocol and therefore may not support all features of the latest Firmata spec nor all arduino and arduino-compatible boards. Refer to the respective projects for details.

Updating Firmata in the Arduino IDE (< Arduino 1.5)

The version of firmata in the Arduino IDE contains an outdated version of Firmata. To update Firmata, clone the repo into the location of firmata in the arduino IDE or download the latest tagged version (stable), rename the folder to “Firmata” and replace the existing Firmata folder in your Ardino application.

Mac OSX:

$ rm -r /Applications/Arduino.app/Contents/Resources/Java/libraries/Firmata
$ git clone git@github.com:firmata/arduino.git /Applications/Arduino.app/Contents/Resources/Java/libraries/Firmata

If you are downloading the latest tagged version of Firmata, rename it to “Firmata” and copy to /Applications/Arduino.app/Contents/Resources/Java/libraries/ overwriting the existing Firmata directory. Right-click (or conrol + click) on the Arduino application and choose “Show Package Contents” and navigate to the libraries directory.

Windows:

Using the Git Shell application installed with GitHub for Windows (set default shell in options to Git Bash) or other command line based git tool:

update the path and arduino version as necessary

$ rm -r c:/Program\ Files/arduino-1.x/libraries/Firmata
$ git clone git@github.com:firmata/arduino.git c:/Program\ Files/arduino-1.x/libraries/Firmata

Note: If you use GitHub for Windows, you must clone the firmata/arduino repository using the Git Shell application as described above. You can use the Github for Windows GUI only after you have cloned the repository. Drag the Firmata file into the Github for Windows GUI to track it.

Linux:

update the path and arduino version as necessary

$ rm -r ~/arduino-1.x/libraries/Firmata
$ git clone git@github.com:firmata/arduino.git ~/arduino-1.x/libraries/Firmata

Updating Firmata in the Arduino IDE (>= Arduino 1.5.2)

As of Arduino 1.5.2 and there are separate library directories for the sam and avr architectures. To update Firmata in Arduino 1.5.2 or higher, follow the instructions above for pre Arduino 1.5 versions but update the path as follows:

Mac OSX:

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/libraries/Firmata
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/sam/libraries/Firmata

Windows:

/Program\ Files/arduino-1.5.x/hardware/arduino/avr/libraries/Firmata
/Program\ Files/arduino-1.5.x/hardware/arduino/sam/libraries/Firmata

Linux

~/arduino-1.5.x/hardware/arduino/avr/libraries/Firmata
~/arduino-1.5.x/hardware/arduino/sam/libraries/Firmata

Contributing

If you discover a bug or would like to propose a new feature, please open a new issue. Due to the limited memory of standard Arduino boards we cannot add every requested feature to StandardFirmata. Requests to add new features to StandardFirmata will be evaluated by the Firmata developers. However it is still possible to add new features to other Firmata implementations (Firmata is a protocol whereas StandardFirmata is just one of many possible implementations).

To contribute, fork this respository and create a new topic branch for the bug, feature or other existing issue you are addressing. Submit the pull request against the dev branch.

If you would like to contribute but don’t have a specific bugfix or new feature to contribute, you can take on an existing issue, see issues labeled “pull-request-encouraged”. Add a comment to the issue to express your intent to begin work and/or to get any additional information about the issue.

You must thorougly test your contributed code. In your pull request, describe tests performed to ensure that no existing code is broken and that any changes maintain backwards compatibility with the existing api. Test on multiple Arduino board variants if possible. We hope to enable some form of automated (or at least semi-automated) testing in the future, but for now any tests will need to be executed manually by the contributor and reviewsers.

Maintain the existing code style:

  • Indentation is 2 spaces
  • Use spaces instead of tabs
  • Use camel case for both private and public properties and methods
  • Document functions (specific doc style is TBD… for now just be sure to document)
  • Insert first block bracket on line following the function definition:
void someFunction()
{
  // do something
}

Horizontal reuse in JavaScript and C#


Horizontal reuse in JavaScript and C#

how to implement multiple inheritance or mixins in Java, Perl, PHP and Ruby. It’s a very interesting comparison of programming languages features and well worth the read.