Hardware, Software, Firmware, and Everything

Category: Programming Page 1 of 2

Multiple Exit Points in Java

Good PAndroidStudioTipMultipleExitrogramming Practice?

I may date myself and/or expose some naivety about general good programming practice, but I have been under the impression that multiple exit points from a function or method is bad practice.  In my opinion, it is bad practice because there is more code to check in the event that the function or method has a signature change and returns a different type.  You need to check all return statements and verify that all return values are cast or declared to be the proper type.  On the other hand, when writing the method / function, it can be more work to structure the code to return different values under different conditions.

Android Studio Niceties

There was a bit of a learning curve to using Android Studio, but not as steep as it was to get the Android SDK running in Eclipse.  Android Studio is based on Jetbrains IntelliJ IDEA, which is a mouthful and a whole new IDE for an Eclipse user.

But here is an example  of the niceties that may or may not have been available in the former Eclipse based Android IDE.

Using Tropo SMS gateway with BusTracker

SMS Bustracker works with “Obama Phone”


A pinch of Tropo, a dash of Bustracker, fold in a pound of jata with PHP, bake for an hour and you have jata-sms.

My Android smartphone suffered a breakdown last week.    New parts should arrive soon.  But in the meantime, I was at a loss without my favorite Android app jata.  I use it to get bus arrival times with the local WRTA Bustracker.  Bustracker has a text message interface, and I thought I would try that with the backup TracFone (Safelink Obamaphone[1]).  That didn’t work.  The TracFone Terms and Conditions states that “TracFone does not generally participate in Premium SMS services or campaigns.”  The Bustracker SMS number is 41411, a shortcode for Textmarks, and I guess Textmarks is a premium service.  Then, I remembered Tropo, a gateway for voice and SMS.  It offers a free developer account and phone number, and now I had a motivation to work with it.

  1. [1]There could be a whole other discussion about giving away the razors (phones) to sell the blades (20 ¢ / min airtime), but I’ll leave that for another day.

HTML Frame Titles

frametitledemoI had a job where the PCs were locked down such that only approved applications and web sites are allowed.  The company maintains a web page of reference documents.  Let’s call it “Genius”. 

Optimizing MySQL tables “on the fly” for gtfs data

I’ve been importing gtfs files into MySQL tables. There is a wide variation between data types for different agencies, as there is no standard for data types. For instance, GTFS trips.txt has a trip_id column, where a typical value is  “94108050”, but PSTA has “973379-JUN13-HQ-Weekday-02-0000100”!

WordPress Blog Spam Control with ReCAPTCHA and Akismet

First of all, even though it’s been almost a year since I started using WordPress blogging software I still feel like a newcomer.  And that’s OK, as I;m focusing on other things like Android programming, and some web programming, including HTML, JavaScript, PHP, MySQL and even database design.  Those are the current tasks,  Wordpress is a tool to record some of my experiences, as well as a vehicle to deliver my profound insights to my spellbound  readers.

Whitespace in PHP files

PHP, JavaScript,  and HTML each have their own idiosyncrasies, but they all lack what I would consider useful features of a more strictly typed language like C or C++.   After years of using C and C++ for micro-controllers and applications, I don’t recall problems with whitespace.  Recently, I’ve been working on the client side of an application for Android phones.

Use wget to debug remote XML feeds using XmlPullParser

I was working on an Android app, jata which depends on getting data from a web based server which uses XML  I tried using an Android Document object  org.w3c.dom.Document and it worked well, but I switched to using an XmlPullParserfor performance reasons

Recursively Clear Directory with PHP

I was working on a PHP program that reads  zipped files, extracts wanted files, stores the contents in a MySql database, and finally cleans up the contents of a local tmp directory.  I develop and debug the program on a local LAMP server, then upload and test it on a public web server.  I thought it was all finished, when I noticed that the public server printed out some PHP warnings that it was trying to unlink a directory, rather than a file.

jata development

jata development issues

Issues of general interest that do not reveal the secret sauce recipe of jata.

Page 1 of 2

Powered by WordPress & Theme by Anders Norén