radioAe6rt

Archive for the ‘Internet’ Category

Using xmllint to format xml

without comments

Long ago I used to use this utility with some frequency to pretty-print xml: xmllint, from the libxml2 project. I mention this here as much to remind myself how to use it as anything else.


$ export XMLLINT_INDENT=” “; xmllint –format foo.xml

where the environment variable XMLLINT_INDENT controls the indentation level. Two spaces are the default.

The utility is available without further ado on later versions of OS X, as well as on a number of Linux distributions, where I suspect it’s almost ubiquitous.

Written by radioae6rt

October 20th, 2008 at 9:31 am

Posted in Internet

Tagged with

Configuring RESTlet’s via Spring

without comments

After help provided by my friends on the restlet.org mailing list, I successfully configured my restlet-based app via Spring. The unrelated parts of the Spring bean config have been removed for the sake of brevity.

To use this config, get a reference to the “server” bean and invoke its “start” method to start the server. The server bean has wired into it the restlet/resource routing information, so there is no need to explicitly refer or otherwise show concern for the “router” bean at the application level.

The app has a number of resources, with associated routes, all of which are easily identified.

Written by radioae6rt

October 20th, 2008 at 9:19 am

Posted in Internet

Morse Code practice utilities and files

without comments

Jack Twilley has an excellent set of open source utilities for generating Morse code audio practice files. If you cannot put the source code to use, you can track the audio files he generates via RSS.

Written by radioae6rt

September 14th, 2008 at 11:28 am

Posted in Internet

GWT-Restlet example app

without comments

Rob Heittman posted a simple, standalone example of integrating Restlet technology into GWT apps. See the “Examples” section toward the end of the page.

Written by radioae6rt

September 11th, 2008 at 5:09 pm

Posted in Internet

GWT-Restlet snippet

without comments

Rob Heittman was good enough to post this tidbit of what a RESTful call and callback look like using the Restlet API in Google Web Toolkit:


 button.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
       new Client(Protocol.HTTP).put("http://localhost:8888/demo/hello.txt", "entity", new Callback() {
          @Override
          public void onEvent(Request request, Response response) {
              try {
                 label.setText(response.getEntity().getText());
              } catch (final Exception ioException) {
                  GWT.log("Restlet I/O failed", ioException);
              }
           }
        });
     }
   });

You’d use this in conjunction with a server process that can handle RESTful requests. A bit more detail can be found here.

Written by radioae6rt

September 10th, 2008 at 10:15 am

Posted in Internet

New JXTA ContentService

without comments

Mike Cumings, JXTA community member, has been busy at work writing a Content service for JXTA. In Mike’s own words:

“The ContentService is a recent addition to the JXTA (JXSE) API which allows arbitrary data (Content) to be transferred from one Peer to another. The specific mechanism/algorithms used to transfer the Content are abstracted away, allowing the developer to utilize an existing general purpose transfer mechanisms or create their own transfer implementation, all while exposing as much state information - such as the details of the transfer progress - to the API user.”

The ContentService is a great addition to the platform, making it much easier from a programmer’s perspective to move bits from one peer to another. The service is available in the platform now, at the head of the SVN trunk, and will be available in official release form with the next release of the platform.

Good stuff, Mike!

Written by radioae6rt

September 10th, 2008 at 6:12 am

Posted in Internet

Boilerplate for Cocoa/iPhone NSURLConnection and NSXMLParser delegates

without comments

There may be an easier, more sophisticated way to do this, but here’s one way to add boilerplate code for the methods required of delegates of Cocoa or iPhone NSURLConnection and NSXMLParser. Add parser-delegates.sh and url-delegates.sh to your bin directory, then add them to your User Scripts in Xcode via “Edit User Scripts/Add Script File…”. When you need to implement these methods in a class file, place the cursor where you want the delegates, then execute the scripts via the Xcode User Script facility. The script output will be pasted into the editor at the cursor.

Written by radioae6rt

September 1st, 2008 at 12:57 pm

Posted in Internet

Support Barack Obama

without comments

I’ve made a few financial contributions to the Obama campaign, which is the most important run for the presidency in my lifetime. Be a part of our own redemption as a nation — help elect this man the next President of the United States with not only your vote, but with a small contribution to the campaign.

Written by radioae6rt

August 17th, 2008 at 3:48 pm

Posted in Internet, Music

Regex on the iPhone

without comments

John Engelhart wrote a nice piece of code, RegexKitLite, that allows regex programming on the iPhone. RegexKitLite is part of his larger RegexKit project.

There is something funky about how the simulator and device SDKs work with respect to how this code pulls in header files, however. I had to insert an #ifdef as a hack to get the code to work on a real iPhone device. The code works as-is if running in the simulator. Here is the mod, to RegexKitLite.m:

#ifdef iPhone
  else { if((splitStrings = rkl_realloc(&scratchBuffer[1], splitStringsSize, (NSUInteger)1)) == NULL) { goto exitNow; } }
#else
  else { if((splitStrings = rkl_realloc(&scratchBuffer[1], splitStringsSize, (NSUInteger)NSScannedOption)) == NULL) { goto exitNow; } }
#endif

near the original line 579.

October 21, 2008 update John Engelhart sent me a note indicating that v2.2 of RegexKitLite is available, and that this version probably doesn’t need this #ifdef. He was right: I tested my original simple test code against v2.2, and it seems to work fine. Thanks, John.

Written by radioae6rt

August 16th, 2008 at 8:36 am

Posted in Internet

UI programming on the iPhone

without comments

Some good links on programming view controllers and table views on the iPhone.

Written by radioae6rt

August 12th, 2008 at 9:27 am

Posted in Internet