PHPass

Looking further into PHP authentication I feel PHP pass is the way to go.

openID is not suitable for my high security needs. Sure its great for social networking but running a banking style website is going to require a whole lot more!

Info about the openwall PHPass can be found here:

http://www.openwall.com/phpass/

Posted in Uncategorized | Leave a comment

PHP?

So I once created a PHP user authentication script. This was back in 2007. It was for a gaming service and forums. It worked great.

I was a PHP registration and authentication with a mysql backend
I followed best practices at then time which included sql injection protection and all that jazz.

A quick google turns up that I would not only be reinventing my previous code and code from thousands of other programmers. It seems OpenID is the way to go.

There is some neat discussion here at StackOverflow and I liked the implementation of the OpenID selector. There is a clean demo of the selector here.
Open ID Example

Posted in Uncategorized | Leave a comment

spolit by choice?

I have decided to blog some of my other bushes with coding. This is because I have the tendency to go cold on a project very fast.

I’ve will set the banner l rotate through the current areas I am dabbling in.

Anyway I am delving into PHP next. Starting with web authentication, I mean how hard can it be? On the subject of PHP, what is up with the logo? It looks like it was taken straight from a GeoCities page circa 1996.

Posted in Uncategorized | Leave a comment

Android Licensing

Over at the official Android Developers Blog the release of the licensing service for applications is being discussed.

The licensing service means you can better protect your applications from unauthorized use. Go and check it out if you need a model to lock down your applications.

I think its a good move and will encourage larger developers invest time and resources into the market if they can lock down usage and thus returns. Of course you need to make a great application that everyone is willing to pay for in the process!

Posted in Android | Leave a comment

We have decimals

So I tweeked the code to allow for decimals. Here are the changed lines.

Float 	t1,t2,t3,t4;	

t1 = Float.parseFloat(text1.getText().toString());
t2 = Float.parseFloat(text2.getText().toString());
t3 = Float.parseFloat(text3.getText().toString());
t4 = (t1 / 50) + (t2 / 12) - (t3 / 5);
text4.setText(Integer.toString(Math.round(t4)));
Posted in Android | Leave a comment

Swype is cool!

Just a test post from my Android phone using Swype and the open source WordPress application. Works pretty well and I am quite impressed how fast the Swype keyboard can be used.

Posted in Android | Leave a comment

My first app

Having run through some tutorials and also armed with some vague memories of coding Java 1.0 at university I plunged in to my own app.

I wanted to make something so my Girlfriend would understand why I had been battling with netbooks, usb drives and obscure command line coding these last few days. I decided on a simple calculator. My lovely lassy is undertaking some unnamed calorie controlled diet regime and I thought I could whip up a simple implementation of the mental arithmetic she had to go through when she encountered a food item that was not in her secret code book.

It was perfect for my first app. Simple interface, easy to code and something that she could actually use!

First things first with my android app I had to design an interface and this is what I came up with.

?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="fill_parent"
	android:layout_height="wrap_content"
	android:padding="10px">
	<TextView android:id="@+id/tv1"
 		android:layout_width="fill_parent"
  		android:layout_height="wrap_content"
  		android:text="Calories"/>
	<EditText android:id="@+id/text1"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:layout_below="@id/tv1"/>
	<TextView android:id="@+id/tv2"
 		android:layout_width="fill_parent"
  		android:layout_height="wrap_content"
		android:layout_below="@id/text1"
  		android:text="Fat"/>
	<EditText android:id="@+id/text2"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:layout_below="@id/tv2" />
	<TextView android:id="@+id/tv3"
 		android:layout_width="fill_parent"
  		android:layout_height="wrap_content"
		android:layout_below="@id/text2"
  		android:text="Fibre"/>
	<EditText android:id="@+id/text3"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:layout_below="@id/tv3" />
	<Button android:id="@+id/button1"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_below="@id/text3"
		android:layout_alignParentRight="true"
		android:layout_marginLeft="10px"
		android:text="Calculate" />
	<TextView android:id="@+id/tv4"
 		android:layout_width="fill_parent"
  		android:layout_height="wrap_content"
		android:layout_below="@id/button1"
  		android:text="Points"/>
	<EditText android:id="@+id/text4"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:layout_below="@id/tv4" />
</RelativeLayout>

So along with this beautiful layout I needed some code to drive it all. I came up with this. Its been a while since I coded Java and I had some trouble getting the data types to work correctly.

package com.example.pointCalc;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.*;

public class pointCalc extends Activity {
	Button		button1;
	EditText 	text1,text2,text3,text4;
	Integer 	t1,t2,t3,t4;
    @Override
    public void onCreate(Bundle icicle){
    	super.onCreate(icicle);
    	setContentView(R.layout.main);
    	text1 = (EditText) findViewById(R.id.text1);
    	text2 = (EditText) findViewById(R.id.text2);
    	text3 = (EditText) findViewById(R.id.text3);
    	text4 = (EditText) findViewById(R.id.text4);
    	button1 = (Button) findViewById(R.id.button1);
    	button1.setOnClickListener(new clicker());
    }
    class clicker implements Button.OnClickListener{
    	public void onClick(View v){
    		if(v==button1){
    		        try {
    			t1 = Integer.parseInt(text1.getText().toString());
    			t2 = Integer.parseInt(text2.getText().toString());
    			t3 = Integer.parseInt(text3.getText().toString());
    			t4 = (t1 / 50) + (t2 / 12) - (t3 / 5);
    			text4.setText(Integer.toString(t4));
    			} catch (NumberFormatException nfe) {
    				text4.setText("Only Numbers!");
    			}
    	   	 }
    	}
    }
}

My next step will be to convert this code to allow for floating point. I would like users to be able to enter decimal numbers, however I only wish to return rounded positive integers as the result. Hmmmm any ideas?

My thoughts are to:

  • Change t1,t2,t3,t4 from an Integer to a Float
  • Use Float.toString(t4) instead of Integer.toString
  • Include some sort of Math.round()

I have had some initial tinkers with this but so far have been met with failure. I might get it working as a Java applet first and then port it back to Android to speed up the development process.

Posted in Android | Leave a comment

Bring on the Toshiba

I caved in and picked up a Toshiba L655D-011. Its a Canadian model. Athlon 2 P320 4GB Ram, 640GB HD and an integrated ATI HD 4250. Its running Windows 7 Home Premium 64 bit.

Toshiba L655D-011

I am sure this will do most of what i want. It’s not top of the line. In fact its right down there towards the bottom, but it was cheap as hell and I considered it good value.

Posted in General | Leave a comment

Bending the rules

I was struck by a new thought. Perhaps I could use my work issued laptop to do a bit of coding on the side. It’s heavily locked down by group policy and various other forms of protection but that’s no reason to stop me.

So I downloaded Eclipse, the Android SDK and I copied the JDK install directory from my netbook. I then set up a batch file as so:

@SET CLASSPATH=.
@SET JAVA_HOME=%~d0\development\jdk6
@SET PATH=%~d0\development\jdk6\bin\;%~d0\development\android-sdk-windows\tools\;%PATH%
@%~d0\development\eclipse\eclipse.exe -vm "%~d0\development\jdk6\jre\bin\javaw.exe" -data "%~d0\development\workspace"

Now that seemed to work for a while, but Eclipse kept on crapping out with out of memory problems and just was not stable. I tried adding some arguments:
-vmargs -XX:MaxPermSize= -Xmx

I tried a few different values for memory size and it made it a bit more stable, but it was still crapping out.

Next step was to try and find a live cd of Ubuntu with the development kits and tool already deployed. I found some links but they all wanted me to pay. It really should be easier.

I then tried a to make a persistent Ubuntu Live USB. Nope that wasn’t working either. I managed to have it boot on one Ubuntu Live USB and store the Casper:RW persistant partition/filesystem on another. That allowed me to book into Ubuntu and install all the parts I needed including OpenJDK.

I finally manged to get it all up and running and compiled my first Android app. Yes the hello world tutorial was coming in handy now.

The bad news passing the app to the emulator was horrendously buggy and would only work around 1 out of every 5 times. I think its time to face the reality that I am going to need a my own laptop.

Posted in Android | Leave a comment

SyntaxHighlighter Plus

Testing the SyntaxHighlighter Plus. This looks like a decent plugin to demonstrate my code.

class myfirstjavaprog
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}
Posted in Android | Leave a comment