Skip to main content

Posts

First Android Application Released: River Water Level Stations

Update: I gifted this code and basically the entire project with related software tools I had made to my friend who I was trying to start a business with after we decided to stop. The app is still active and available on the market under his account and not “CWSolver” anymore. A friend and I just finished our first Application targeted for the Android marketplace. The application basically allows the user to monitor the level of rivers in the United States thanks to publicly available data that is updated frequently. This is useful to anyone who does boating among other various activities that have some relation to rivers. Here is the link to Water Level Stations on the Android market. Here is our official description: “Do you fish and hunt? Are you out on the river frequently for business or pleasure? It is important to know what the level and flow of the river is, so you can stay safe and maximize your enjoyment. We have an application tailor made for you.Water Level Stations allow...

A little rant about Android SDK, Java, and Eclipse

I don’t often rant nor say the work “sucks” very often. However as any programmer knows, some tools just frustrate you to no end. Java, the Android SDK, and the Eclipse IDE are something I need to use, but are frequently on my “sucky tools” list. I’ve used a lot of programming languages and tools in my day, and these have made the frustrating Sh** king-of-the-mountain where things like Cobol and JCL reside. Here is an email rant I made recently: Wasted the whole day trying to get the settings activity working as I initially designed it. I eventually dropped that after wasting a large amount of time “playing” around with the code, so now the unit conversions happen outside of the settings activity. In the settings activity, it is just cut-and-dry select setting and select type of units. There is no unit conversion and re-selection of a setting value in the spinner as I had attempted to do earlier. For example, 10 for the search distance will me km or miles depending on if the use...

Android SDK: String Arrays and Controls like Spinners

Due to how the Android SDK and Java are setup it isn’t really a simple task to link up an array with a spinner control. I’ll go over some basics I just learned of the process. In this example I setup a setting control that will allow the user to select from a list of values. The spinner control will be initialized by the global setting value (from a black box object in this example), and a control listener will be defined that allows the user to change the global setting. To define a list of string values that can be loaded into android controls you would do something like this. You can add an arrays.xml file to your project (in the /res/values directory): <?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="settinglist01"> <item>1</item> <item>2</item> <item>3</item> <item>4</item> <item>5</item> </string-a...

Android Eclipse Issue: Unparsed aapt error Unknown Android Packaging Problem

I added my first menu to an Android application through Right-click on the project in New >> Other… >> (Android) >> XML file. After editing the file I tried running it and received this error: Unparsed aapt error(s)! Check the console for output. PROJECT_NAME Unknown Android Packaging Problem A google search brought up a few results which helped. All you need to do is access the Eclipse IDE menu item: Project >> Clean… You can then clean all projects open or just the one having an issue. Seems like and file.xml.out gets generated or something causing a packing issue to occur. The clean process fixes that. A strange error that isn’t easy to diagnose without having knowledge about the IDE and Android Plug-in for sure…

Setting up Subversion (SVN) on Ubuntu Linux

After getting the Android SDK and Eclipse IDE installed and running, I started on getting Subversion ready for our first project. Here are the general steps necessary. For my configuration there is a Ubuntu server that I connect through ssh and will need to do the same to connect to SVN after everything is configured. Useful tutorials: https://help.ubuntu.com/community/Subversion https://help.ubuntu.com/community/AddUsersHowto https://help.ubuntu.com/community/AptGet/Howto Commands executed to setup the system: sudo apt-get install subversion cd / mkdir svn_repository sudo addgroup subversion sudo adduser USERNAME1 subversion sudo adduser USERNAME2 subversion # Repeat the above line for other usernames as needed sudo adduser www-data subversion cd /svn_repository mkdir android_test sudo svnadmin create /svn_repository/android_test cd /svn_repository sudo chown -R www-data:subversion android_test sudo chmod -R g+rws android_test Above I have an example where a directory called “svn_re...

Setting up the Android SDK in Linux (Eclipse IDE)

While it’s generally pretty “easy” to setup the Android SDK in Linux (in my case Ubuntu 10.04), there are a few quirks that required some searching on the Internet to figure out. The SDK and related items are located here: http://developer.android.com/sdk/index.html Here is the general process I went through to get things running: – Install JDK by typing “jdk” into the ubuntu software center and install the proper piece of software. I think you need at least version 5 or 6 for the Android SDK. – Install eclipse by getting the latest version at http://www.eclipse.org/downloads/ – Download “Eclipse IDE for Java Developers” – Extract eclipse-java-helios-SR1-linux-gtk-x86_64.tar.gz (or similar depending on what version you download) to say the… /home/user/ directory (you can run the program by double clicking on the “eclipse” icon in the main directory of the program. – I started the program and defin...

Securing Wordpress Continued...

I had written a basic securing wordpress article back in February of this year. Since then I’ve done a bit more research and came upon the idea of using Apache to help secure the administration directory and scripts, making it more difficult for intrusions to take place. It’s always a good idea to try and protect your sites as best you can. When dealing with open source software, the code is visible to the world, so any exploits that have been found can travel fast. Issues and security flaws get fixed on well known open source projects like WordPress, but it also leaves an un-upgraded system easily open to attack. One option to add a second layer of protection by using Apache server’s built-in directory password functionality. Thankfully, Askapache made a decent plug-in to save a good deal of time playing around with Apache .htaccess settings and researching the necessary code. While the plugin needs work, it functions with a bit finesse on your part. Download the Askapache Passw...

Solid Basic Javascript Input Validation

Here is a simple yet pretty powerful and easy to use way to do validation on HTML form text boxes and text areas and similar controls. It checks to make sure required form field have *something* in them before allowing processing to continue. It’s a good simple way to add some basic validation to prevent trusted individuals from forgetting to fill out required fields. This is generally useful for internal websites where you can assume the user isn’t trying to hack the site. First we have two global JS variables that define the default and error-ed state of text boxes in question. Below I have standard controls with black borders and error-ed controls with red borders. // Assign a default border color for all form controls var defaultControlBorderColor = '#000000'; // Use a special color to highlight trouble (such as if a control doesn't validate) var notificationControlBorderColor = '#ff0000'; Below I have the primary function that does the field validation. F...

Execute a console command in PHP revised

While it seems like there are multitude of different methods to execute commands in PHP, so far the code I will go over below is my preferred method. Using the passthru() function works nicely and includes the final return code of whatever was being executed, which is generally useful to me in error checking. In processing, I also include ob_start(), ob_get_contents(), and ob_end_clean() so that I can capture the console programs output and return it the user eventually. // Execute a console command and return both the // command's success value and any output to the console it made function executeConsoleCommand($commandToExecute, &$commandConsoleOutputToAppend) { $returnValue = 0;      // Append command to output $commandConsoleOutputToAppend .= $commandToExecute . "\r\n"; // Catch console output ob_start(); // Execute the console program passthru($commandToExecute, $returnValue); // Save console output to a string variable (this s...

.NET Path.Combine() in PHP

I’m the type of person who prefers to do things in a way that I perceive as the proper or correct way. While this tends to make things take a bit longer to accomplish, I feel the result ends up being better overall. One such thing I noticed is that file and path handling in PHP was missing a function I used quite a bit when writing C# code. In C# there is a Path.Combine() function that appends two file paths together to form one complete path without having to care what the beginning character and ending character of the two paths are. I wrote up a little function in PHP to mimic what happens. // Take a path and/or a filename and combine them into one file path function filePathCombine($path1, $path2) { $completedPath = ''; // Check if path1 ends with DIRECTORY_SEPARATOR if (substr($path1, -1) !== DIRECTORY_SEPARATOR) { $completedPath = $path1 . DIRECTORY_SEPARATOR; } else { $completedPath = $path1; } // Check if path2 starts with D...