Ruben Laguna's blog

Apr 30, 2009 - 1 minute read - Comments - addchild connectionwidget fontdesignmetrics labelwidget layer layerwidget library metricskey netbeans nullpointerexception visual widget

NullPointerException in FontDesignMetrics$MetricsKey.init when using Netbeans Visual Library

If you’re getting a NullPointerException stacktrace like the one below while using the Netbeans Visual Library to create your own GraphScene, check that your adding your widgets propertly to scene. A good idea is to use LayerWidgets, declaring them in the constructor of your GraphScene: mainLayer=newLayerWidget(this);addChild(mainLayer);connectionLayer=newLayerWidget(this);addChild(connectionLayer); and then add the widgets to those layers in attachNodeWidget and attachEdgeWidget: @OverrideprotectedWidgetattachNodeWidget(Stringnode){LabelWidgetw=newLabelWidget(this,node);w.setBorder(BORDER4);w.getActions().addAction(createSelectAction());w.getActions().addAction(createObjectHoverAction());w.getActions().addAction(ActionFactory.createMoveAction());this.mainLayer.addChild(w);returnw;}@OverrideprotectedWidgetattachEdgeWidget(Stringedge){ConnectionWidgetw=newConnectionWidget(this);w.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);this.connectionLayer.addChild(w);returnw;} The stacktrace: java.lang.NullPointerException at sun.font.FontDesignMetrics$MetricsKey.init(FontDesignMetrics.java:199) at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:267) at sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:973) at org.

Apr 29, 2009 - 1 minute read - Comments - assign attach download hyperlinking link linking manager netbeans netbeans platform manager plaform source sources zip

Add Platform Sources using Netbeans Platform Manager

To be able to do Navigate ⇒ Go to Source on netbeans classes like TopComponent you need to link the sources to the Netbeans Plaform using the Netbeans Plaform Manager as explained in Hyperlinking to NetBeans API Sources. Be sure to download the proper source zip from the netbeans download page, otherwise the Platform Manager won’t let you attach the source file to the platform (all invalid options are greyed out/dimmed):

Apr 28, 2009 - 2 minute read - Comments - dependency favorites layer layer.xml loading module netbeans opened order startup state

Opening Favorites window at startup in a Netbeans Platform Application

After learning about the Favorites window in the NetBeans Platform Quick Start. I wanted to use it in an application of my own. This easy task became more difficult that I though because I was getting random results, sometimes after a clean build I got the Favorites window open and sometimes not. But let’s start from the beginning, I put my hands at work, it was just a matter of adding the Favorites module to the Netbeans Platform Application (app’s properties ⇒ Libraries ⇒ Platform Modules ⇒ platform9 ⇒ Favorites) and edit one of my modules layer.

Apr 6, 2009 - 2 minute read - Comments - arduino boost drop electronics max756 regulator stepup troubleshooting voltage

Sudden voltage drop on MAX756

I got the MAX756 that I was waiting for from Futurlec. The idea was to implement the very same circuit that comes in the MAX756 datasheet. In my first try I got very strange results which I posted to ladyada forum hoping to get some advice on how to solve. Eventually I set up the circuit in another breadboard and got it working the way I expected or at least I thought so.

Mar 30, 2009 - 1 minute read - Comments - 8051 altera controller CY7C68013 cyclone Cypress electronic electronics fpga FX2 GPIF high microcontroller radio speed usb usrp

High speed USB in a embedded design

I’m looking at how to do a USRP clone. After evaluating a little bit the Altera Cyclone FPGA development/starter kits I realized that I would need an extra USB controller like the original USRP has. Right now, I’m trying to figure out how to use the Cypress FX2 CY7C68013, together with the FPGA. The USRP FAQ on FX2 CY7C68013 has proven quite helpful, also the Design of a hardware platform for narrow-band Software Defined Radio applications” by Kalen Watermeyer .

Mar 26, 2009 - 1 minute read - Comments - arduino electronics mega uart usart

Arduino Mega released today

Arduino Mega was released today. I already ordered mine from lawicel. As stated in arduino mega page: It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. I definitely will use those additional USARTS. The lack of a second USART was the main drawback of previous Arduinos for me.

Mar 26, 2009 - 2 minute read - Comments - adc altera converter cyclone electronics fpga gnu radio rf tuner

FPGAs, GNU Radio and alternatives

A couple of day ago, I stumbled on GNU Radio. I was looking around electrokit online shop searching for components and I saw a Cyclone III FPGA Starter Kit for 1599 SEK (2000 SEK including taxes) and I thought : “uhmm, I could put one of this to some use” I was thinking that maybe there was a way to implement ZibBee radio using one of these FPGAs. So I started searching google about FPGAs and radio and I found GNU Radio.

Mar 21, 2009 - 2 minute read - Comments - accelerometer arduino electronics library max756 mma7260q sensor tilt xbee

Arduino library for MMA7260Q (Tilt Sensor)

In the past days I published a couple of arduino libraries. All coming from by XBee sensor development. I’m still waiting for the MAX756 to arrive from Futurlec, I need the MAX756 to power the xbee sensor with batteries and mount it in its final position. So in the meanwhile I’m cleaning a little bit the code, moving thing to libraries, etc. Now it’s the turn of the MMA7260Q, (see other posts about MMA7260q) .