So In Conslusion...

The Official Big Eclipse 'Geek' Musings

Subscribe to RSS feed

Programming Python

,

i just received Programming Python 4th Edition the other day. All i can say is man this is one big book -- 1600+ pages. i have not started reading it yet, but i guess they cover everything. This book is a step up from the fundamentals of the Python programming language. It covers everything from systems programming to GUI programming; Web programming, OOP, and data representation. i love Python and i want to step my Python game up a bit so that is why i got this book. More to come.

The Showdown

, ,

So, i've been reading two books on Android application development -- Android Wireless Application Development and The Android Developer's Cookbook. There are things that i like about each one as well as things that i think could be better with each. For example, i think that The Android Developer's Cookbook does not cover enough information. Period. Too, while i think that the wealth of information covered in Android Wireless Application Development is impressive, i am not a fan of how it handles sample code. i do like both books however. In fact, i have stopped reading The Android Developer's Cookbook and have focused my energies on completing Android Wireless Application Development. More on the results of my reading later.

Annotations in Java

, ,

Annotations provide data about a program that is not part of the program itself. They have no direct effect on the operation of the code they annotate.

Annotations have a number of uses, among them:
  • Information for the compiler — Annotations can be used by the compiler to detect errors or suppress warnings.
  • Compiler-time and deployment-time processing — Software tools can process annotation information to generate code, XML files, and so forth
  • Runtime processing — Some annotations are available to be examined at runtime.

Annotations can be applied to a program's declarations of classes, fields, methods, and other program elements.

The annotation appears first, often (by convention) on its own line, and may include elements with named or unnamed values:
    
@Author(
   name = "Benjamin Franklin", 
   date = "3/27/2003"
)     
class MyClass() { }

or
   @SuppressWarnings(value = "unchecked")
   void myMethod() { }

If there is just one element named "value," then the name may be omitted, as in:
   @SuppressWarnings("unchecked")
   void myMethod() { }

Also, if an annotation has no elements, the parentheses may be omitted, as in:
    @Override
    void mySuperMethod() { }

Documentation

Many annotations replace what would otherwise have been comments in code.

Suppose that a software group has traditionally begun the body of every class with comments providing important information:
public class Generation3List extends Generation2List {

   // Author: John Doe
   // Date: 3/17/2002
   // Current revision: 6
   // Last modified: 4/12/2004
   // By: Jane Doe
   // Reviewers: Alice, Bill, Cindy

   // Class code goes here.
}

To add this same metadata with an annotation, you must first define the annotation type. The syntax for doing this is:
@interface ClassPreamble {
   String author();
   String date();
   int currentRevision() default 1;
   String lastModified() default "N/A";
   String lastModifiedBy() default "N/A";
   String[] reviewers();  // Note use of array.
}

The annotation type definition looks somewhat like an interface definition where the keyword interface is preceded by the @ character (@ = "AT" as in Annotation Type). Annotation types are, in fact, a form of interface, which will be covered in a later lesson. For the moment, you do not need to understand interfaces.

The body of the annotation definition above contains annotation type element declarations, which look a lot like methods. Note that they may define optional default values.

Once the annotation type has been defined, you can use annotations of that type, with the values filled in, like this:
@ClassPreamble (
   author = "John Doe",
   date = "3/17/2002",
   currentRevision = 6,
   lastModified = "4/12/2004",
   lastModifiedBy = "Jane Doe",
   reviewers = {"Alice", "Bob", "Cindy"} // Note array notation
)
public class Generation3List extends Generation2List {

// class code goes here
}

Note: To make the information in @ClassPreamble appear in Javadoc-generated documentation, you must annotate the @ClassPreamble definition itself with the @Documented annotation:
import java.lang.annotation.*; // import this to use @Documented

   @Documented
   @interface ClassPreamble {

   // Annotation element definitions.
}


Annotations Used by the Compiler

There are three annotation types that are predefined by the language specification itself: @Deprecated, @Override, and @SuppressWarnings.

@Deprecated— The @Deprecated annotation indicates that the marked element is deprecated and should no longer be used. The compiler generates a warning whenever a program uses a method, class, or field with the @Deprecated annotation. When an element is deprecated, it should also be documented using the Javadoc @deprecated tag, as shown in the following example. The use of the "@" symbol in both Javadoc comments and in annotations is not coincidental—they are related conceptually. Also, note that the Javadoc tag starts with a lowercase "d" and the annotation starts with an uppercase "D".
// Javadoc comment follows:
    /**
     * @deprecated
     * explanation of why it was deprecated
     */
    @Deprecated
    static void deprecatedMethod() { }
}

@Override— The @Override annotation informs the compiler that the element is meant to override an element declared in a superclass (overriding methods will be discussed in the the lesson titled "Interfaces and Inheritance").
   // Mark method as a superclass method
   // that has been overridden.
   @Override 
   int overriddenMethod() { }

While it's not required to use this annotation when overriding a method, it helps to prevent errors. If a method marked with @Override fails to correctly override a method in one of its superclasses, the compiler generates an error.

@SuppressWarnings— The @SuppressWarnings annotation tells the compiler to suppress specific warnings that it would otherwise generate. In the example below, a deprecated method is used and the compiler would normally generate a warning. In this case, however, the annotation causes the warning to be suppressed.
   // Use a deprecated method and tell 
   // compiler not to generate a warning.
   @SuppressWarnings("deprecation")
   void useDeprecatedMethod() {
      objectOne.deprecatedMethod(); //deprecation warning - suppressed
}

Every compiler warning belongs to a category. The Java Language Specification lists two categories: "deprecation" and "unchecked." The "unchecked" warning can occur when interfacing with legacy code written before the advent of generics (discussed in the lesson titled "Generics"). To suppress more than one category of warnings, use the following syntax:
@SuppressWarnings({"unchecked", "deprecation"})

Annotation Processing

The more advanced uses of annotations include writing an annotation processor that can read a Java program and take actions based on its annotations. It might, for example, generate auxiliary source code, relieving the programmer of having to create boilerplate code that always follows predictable patterns. To facilitate this task, release 5.0 of the JDK includes an annotation processing tool, called apt. In release 6 of the JDK, the functionality of apt is a standard part of the Java compiler.

To make annotation information available at runtime, the annotation type itself must be annotated with @Retention(RetentionPolicy.RUNTIME), as follows:
   import java.lang.annotation.*; 

   @Retention(RetentionPolicy.RUNTIME)
   @interface AnnotationForRuntime {

   // Elements that give information
   // for runtime processing.
}


There you have it, Annotations in Java. So fire up NetBeans and give it a whirl. Too, visit the tutorial page to learn more and to take a quick quiz.

An Interview with C++ Creator Bjarne Stroustrup

, ,

Got a great article, an interview with C++ designer, Bjarne Stroupstrup from CodeGuru. He talks a lot about C++0x and the standardization process, new features in the language, and some plans for the future. He is also working on a new book -- The C++ Programming Language (4th Edition) -- that i am truly looking forward to purchasing upon it's release.

The improvements to C++ come in the form of many small and incremental improvements, rather than a few "marquee" features. I guess some of the improvements won't seem minor to many, but that's even better and don't detract from my key point: The C++0x improvements are pervasive; they help in many places in many kinds of code, rather than being isolated to a few new components. The way I think of it is that I'm getting a lot of new kinds of "bricks" to form my "building set" so that I can build many things that I couldn't easily build before, and far more easily and elegantly. In fact, it is hard for me to think of any program that I can't write a bit easier and more elegantly in C++0x than in C++98 - and typically have it perform better also. -- Bjarne Stroustrup

Great article. Read it here.

POCO C++ Libraries

,

Checking out the POCO C++ libraries at: POCO. What is POCO?

Modern, powerful open source C++ class libraries and frameworks for building network- and internet-based applications that run on desktop, server and embedded systems.

Robotics Make a Move Toward Autonomous Service

,

With costs coming down for sensor-based technologies, vision and tactile feedback robotic systems are becoming increasingly more intelligent, people-aware, and are converging on a new paradigm and set of robotic applications. This new direction is focused around three advances: proficiency without extensive software coding at the outset of an implementation, the ability for robots to work side-by-side with humans, and concepts like cloud computing that have the potential to help create more sophisticated learning machines.

Robotic Surgical System Overcomes Manual Limitations

,

Robotic-assisted laparoscopy, such as the da Vinci system, allows the surgeon to sit at a stereo console and remotely control endoscopic instruments via a patient-side robot. The da Vinci system consists of three components: the surgeon console, a patient-side cart that holds the instruments, and the image processing equipment. The system's 3-D visualization provides depth perception, and the wrist-like articulations of the miniaturized instruments improve surgeons' dexterity and range-of-motion. The system also improves control by reducing hand tremor and providing motion scaling. The ergonomic instrument-hand-eye alignment and intuitive instrument movement can also reduce surgeon training time in comparison to using manual laparoscopy. Read More...

ROILA - Robot Interaction Language

, ,

ROILA, a New Spoken Language Designed for Robots. Pito loki wikute tuji! That's ROILA for "I like fruit." The LEGO MINDSTORMS NXT robots are learning ROILA, Robot Interaction Language, as part of a team of robots donated by LEGO. The next step is to allow the NXT robots to talk in ROILA via text-to-speech synthesis. Read More...

MALaD (3pi)

, , , ...

Meet MALaD (My Lad).



This is the newest addition to the family. MALaD is a 3pi robot from Pololu and it is awesome. It's specialty is in using line following and maze solving algorithms to solve those problems -- both of which i have tried and successfully tested using both C and the C++ programming languages.

The 3pi robot makes a great platform for people with C programming experience to learn robotics, and it is a fun environment for ambitious beginners to learn C programming. At its heart is an Atmel ATmega168 microcontroller running at 20 MHz with 16KB of flash program memory and 1KB data memory, enough space to run complicated programs. An extra 512 bytes of persistent flash memory is provided on the microcontroller for data logging or long-term learning applications. The popular, free GNU C/C++ compiler works perfectly with the 3pi, Atmel’s AVR Studio provides a comfortable development environment, and an extensive set of libraries provided by Pololu makes it a breeze to interface with all of the integrated hardware. The 3pi is also compatible with the popular Arduino development platform. We provide a number of sample programs to show how to use the various 3pi components, as well as how to perform more complex behaviors such as line following and maze solving.



Here he is on a simple line-following task using the NXT line map. i will post a video of him solving a maze, a very crude maze, that i designed. As crude as the maze is, the task was still accomplished successfully.


[Programming] RFID & Sound

, , , ...

So today's topic covers using RFID with sound(s).



The image above depicts the use of RFID and sound on the NXT brick. This simple program starts out with implementing the RFID sensors and connecting them to a Logic block. The input we are looking for in this case is the 'AND' operator. We then connect to a Switch block which contains our first sound (can be any sound) and a simple motor movement. When we pass the RFID keyfob (any) transponder before the RFID sensor, out robot plays a sound and moves forward.

The second stage of the program does pretty much the same thing, in reverse, but with one key exception; we use a second keyfob transponder. This was done to experiment with using multiple transponders to see how it would work. The key thing to remember when using multiple transponders is to be certain to do a "Live Update" and click the "Current Transponder" button in order to uniquely identify each transponder. Sound, movement, just about anything is possible using RFID on the NXT.
May 2012
S M T W T F S
April 2012June 2012
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31