20
Apr 12

Android – Restlet or how to have your client working and how to send params in a post request

When you are reading the title, well it seems to be a really easy task to be able to do a POST request with some parameters sent along…

Well it is easy, but man it took me long to actually find this out. There is a Restlet documentation but it lacks a LOT of simple examples for a quickstart.
So, here in this first post of the Restlet serie (I’m sure I will have more to cover) I will show you how to do so…
Here I am getting back the response as a JSON string.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// this is if your device doesn't support IPV6
System.setProperty("java.net.preferIPv6Addresses", "false");

ClientResource clientResource = new ClientResource(Method.POST, YOUR_URL);
Form form = new Form();
form.add("param1", param1);
form.add("param2", param2);
Representation entity = clientResource.post(form);
JSONObject json;
try
{
    json = new JsonRepresentation(entity).getJsonObject();
    System.out.println(json.toString());
}
catch (JSONException e)
{
}
catch (IOException e)
{
}

Another tip, be sure you have an internet connection if you using the android emulator, and if you want to use a proxy check this other post.


19
Apr 12

Android emulator – proxy and custom domain

So, I wanted to be able to use a proxy while developing my android app. Also I am using a custom domain set in my hosts files.

Here I am using Charles, but any should do really.
So in the Android emulator go in Settings>Wireless and networks>Mobile Networks>Access Point Name. You will see one named Telkila.
Edit it and change the proxy to be 10.0.2.2 (which is in the emulator the address of the machine running the emulator). Set the port to be the port you are proxying on (in Charles by default it is 8888).
And voila. If you open your web browser you should see queries.

Now, what about having a localhost with a set up domain being for instance mydomain.localhost.
Well in Charles you have a map remote option. So just add one with the value

Protocol: http
Host: 10.0.2.2
Port: 8888

to

Protocol: http
Host: mydomain.localhost
Port: 80

and in your app the remote URL should look like for instance

http://10.0.2.2:8888/index.php

and charles will map this to

http://mydomain.localhost/index.php

and voila :)


08
Mar 12

Android development – Remote calls the proper way.

Hello,

I have started developing an android app and was looking for the best way to handle remote calls (as activities can be killed, … ) and found this really nice talk Google IO – Developing Android RESTFull apps

This session is really, really good and gives a really good insight of how applications doing remote calls should be developed.
So I asked myself: probably somebody has implemented this idea to makes developers life easier. Well I haven’t been able to find any code anywhere showing how this should be implemented not saying a nice framework I could use.

So I decided to do my own.
I will release it soon on github. I know many things can be improved and am really looking forward to push queries :)

Meanwhile if you have seen any framework that could help implementing the idea in the googleIO talk please let me know.

++


04
Oct 11

Installing USVN and migrating from old subversion server

So lately we changed server and although I’m using now Indefero (integrated git) to manage my projects I was in need of having subversion for all my old projects.
I used to use svnmanager on our old server but wanted to give a try to another web interface. So I choose usvn

USVN Installation

Download usvn here and unzip it somewhere on your web server.
Follow the main installation guide here with the following tips:

  • before starting the install, get the latest zend framework here. Backup the Zend folder existing in your usvn library folder and add the one from the latest downloaded zend framework found in the library folder. This is because the framework shipped with usvn is old and not in sync with the latest mysql package.
  • start the installation script accessing the install.php directly (http://youraddress.com/install.php)

Importing existing repositories

In my case my old subversion server was already offline, but the repo still existed. So I have copied them onto the new server somewhere using rsync over ssh. Nice guide here.
Once done, you need to import the projects into usvn. To do so they have done a script you can find in the library/tools folder named usvn-import-svn-repositories.php. The thing is this script is outdated now, so a usvn user has updated it. You can find it here. And here is how to use it.

Once the project imported, copy the files from the old repo to the newly created under the svn folder (that you have configure during the install) and finally change the owner to be your webserver (apache or www-data or … ).

Voila, all should be good now. Add a group and user to be able to access it.


10
May 11

Create Android application interface with some nice tools

I just came across a google code project android-ui-utils aiming at helping designer/developer to design their android application.

There is 2 seperate application:

  • Pencil for firefox, an already well know existing application. They have created the toolset for this app … or
  • A custom web based application (Android Asset Studio)

Might be helpfull for some…


11
Jan 11

ZamfBrowser and subversion

Just a quick one for the people that use ZamfBrowser and for myself (as a reminder)

I’m playing with ZendAmf right now so I’ve downloaded and installed ZamfBrowser, and got a really weird behavior.
I was able to get my gateway working, ie I could run my app and everything was fine, trying to access the services using ZamfBrowser was giving me an error.
Looking at the ZamfBrowser, it ties to load all the files/directories under the directories you specified for your services, including the .svn, where it fails.
So just replace line 62 (in the getServices method) with this one

if (file_exists($filePath) && $file != "." && $file != ".." && $file != ".svn")

and it should be all good now.


04
Jun 10

Flixel for Android

Recently I came across this post.
Flixel has been ported to Android, so games (well a specific kind of game) should be easy to develop :)
You can get the source here
and read the tutorial here


14
May 10

webDU 2010 – Caleb Adam Haye – Continuous Integration

Session Detail

To be discussed will be the overall concept of continuous integration, detailing the overwhelming benefits (and challenges) of employing a continuous integration strategy into your Flash Platform development paradigm, which transcends the build process into a science, rather than a black art. We will also cover concrete approaches to implementing continuous integration. Specifically, best practices for developing rich internet applications on the Flash Platform, with an emphasis on Flex/AIR development.  Some of these concepts include: PureMVC integration, generating documentation, setting up project dependencies, integrated unit testing with FlexUnit, and elegant deployment – all autonomously.
By Caleb Adam Haye

Here are the videos
Continue reading →


13
May 10

CPLUV is using Sphinx

Cpluv has done the switch for its search engine from Zend Lucene to Sphinx.

It is actually a breeze to implement and work with Sphinx once you got to know how everything’s working :)
When we choose the engine to be used instead of Zend Lucene, there were 2 finalist. SolR and Sphinx.
We used sphinx because of its ease to use/index and configure.
I’ll publish a small beginner tutorial tonight to help people to jump in Sphinx.

The community is great, although the forum could be better. But I know that they’re working on a new website, so it will probably be updated.
It’s definitely worth a look if you’re looking for a POWERFUL, FAST AND LIGHT search engine.


13
May 10

webDu 2010 – Mike Downey – Casual Gaming, what developers should know

Another video of the webdu 2010 conference in Bondi Beach, Sydney.
I’m sorry the battery of my nexus one died during the session, so you have only the first 40 minutes :/

Session Detail

In this session you will learn about development, deployment, and distribution, leveraging multiple technology platforms. Mike will also talk about some of the work that Microsoft is doing to make casual game development easier, faster and more flexible. He will also demonstrate some of the exciting innovations planned for gaming on the upcoming Windows Phone 7 Series devices.
By Mike Downey

Anyway here are the videos
Continue reading →