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.
Category: Programming (Page 1 of 2)
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.
SMS Bustracker works with “Obama Phone”
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). 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.
- 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.↩
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”!
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.