|
|
||
Lucas Torri's BlogSeptember 2007 ArchivesJython : Scripting for the Java languagePosted by lucastorri on September 24, 2007 at 04:18 PM | Permalink | Comments (12)Scripts languages are famous for their simplicity and ease of development. For this, they can be powerful Allies to software development. In this vast world of available scripting languages, one that really calls attention is Jython[http://www.jython.org]. Jython, is the Java implementation for the high-level Python language, allowing you to run Python on any Java platform. Python is a multi paradigm language, can be learned in a few days and used to write any kind of application. Also, many programmers report substantial productivity gains using it. The syntax is a little bit different from usual languages, cause uses indentation to separate blocks of code, which makes Python a highly readable language. An increase in indentation comes after certain statements and a decrease in indentation signifies the end of the current block. For me, the biggest advantage of using Jython is that it provides interactivity with Java Classes and Objects. This property, makes possible, together with the interactive, interact with Java resources, allowing programmers to experiment and debug any Java system using Jython. Installation is made through a GUI installer, making this process very simple. After that, you can run the Jython interpreter running the executable file in the installation folder. Once the intrepeter it's open, you can starting coding like in every other editor, but in each new line the code will be instantly interpreted. For example, look how easily I create a JFrame using Jython:
>>> from javax.swing import JFrame # import the JFrame class Notice that the 'new' ain't needed and you can access and modify attributes without get/set before. Also, integers can be used as booleans, but there are also available the True and False operators. The line setting the frame visible could also be inside the constructor, making the code even smaller. It can be used to write automation scripts, including ones that use JDBC, use it as a script language inside your programs using the project jar or even use Jython compiler (jythonc) to transform the python code to Java code. All this using a very easy and high-level language. I'm not trying to write a Jython tutorial here, this is just to give you a little taste. So, if you want more information about that, I recommend you to check this: * http://www.jython.org/Project/index.html Hello mama, I'm homePosted by lucastorri on September 03, 2007 at 07:51 PM | Permalink | Comments (7)More and more, access control and other home automation stuff are being used and required. We are giving away part of our privacy to prior security and commodity. Bluetooth is a technology for wireless file transfer very spread today in cell phones, but most people don't know that it can be used to identify someone through the unique address each Bluetooth enabled device has. For example, if you see a number like "00:12:62:F8:E1:0C", be sure it's my cell phone. So, to show this, I did a very simple experiment using Java SE, a Bluetooth (BT) enabled cell phone and an Arduino Board. The project is very simple: the Java SE application uses Project Marge, Avetana JSR-82 Implementation and a Bluetooth USB adapter to search for available devices in area. Once a registered device enter in area, like my cell phone, the Java App sends a signal through the USB port to the Arduino board (mapped as a tty device at Linux), which then interprets the signal and turns on a green LED ( light-emitting diode). Talk is cheap, I know, so here it's a video of this little project running: http://br.youtube.com/watch?v=5GKwXAD1-RM Arduino is a very cool an easy to use open-source electronic prototyping platform. The Arduino Board, part of the project, is a no expensive board based on the ATmega168 micro controller, giving the programmer a big sort of IOs and the possibility to communicate with a computer thought an USB cable (this in the version I have, cause there are Bluetooth and serial versions of the board). This boards can be assembled by hand or purchased preassembled. There is also an IDE, writen in Java, which helps developing the software that will run in the board. Turn on a LED is a very basic thing, but imagine all the stuff that can be done: turn on or off several other gadgets, notify someone that you present in that place, update you cell phone with some kind of information, etc Bye! =) | ||
|
|