Saturday, March 30, 2013

InvokeDynamic

At Devoxx, I saw a great presentation of Charles Nutter about InvokeDynamic.

Here is a full article  :http://blog.headius.com/2008/09/first-taste-of-invokedynamic.html

You could also see slides :http://fr.slideshare.net/CharlesNutter/invokedynamic-in-45-minutes

Friday, March 22, 2013

CRaSH : a good way to test it !


If you don't know CRaSH, it's time to test it !
You can test it online and discover all the potential of this wonderful tool !

http://try.crashub.org

Send a POST request on Google App Engine

To send a request, you need to use Url Fetch service.The URL Fetch service uses Google's network infrastructure for efficiency and scaling purposes.Here is the code to send a simple POST request on Google App Engine :

   public void send(String messageToSend, String date, String level, String servers) {

        try {
            String message = URLEncoder.encode(messageToSend, ENCODING);
            Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyUrl, Integer.parseInt(proxyPort)));

            URL url = new URL(urlDest);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy);
            connection.setDoOutput(true);
            connection.setRequestMethod("POST");

            OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
            writer.write("date=" + date);
            writer.write("&level=" + level);
            writer.write("&servers=" + servers);
            writer.write("&msg=" + message);
            writer.close();

            if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
                logger.info("OK ! message returned:" + connection.getResponseCode());
            } else {
                logger.info("KO ! message returned:" + connection.getResponseCode());
            }
        } catch (MalformedURLException e) {
            logger.error(e.getMessage());
        } catch (IOException e) {
            logger.error(e.getMessage());
        }
    }

I've made a small java project ( 2 class ;-) )that send a simple POST request : See https://github.com/drieu/Tools
More details on https://developers.google.com/appengine/docs/java/urlfetch/overview

Wednesday, March 20, 2013

Feedback about the creation of an application on Google App Engine


Goal : Create a small alert's application on Google App Engine and evaluate the easiest method.
Here is my small feedback :

Test 1 : Create a small project with GWT


Drawback


1) Installation
- Netbeans : Not working for me.Installation problem with plugin ...
- Intellij : I didn't find any plugin
- Eclipse : OK and it's easy

2) Create his own application

I want to made a small application but in my mind, GWt is too complex and not quick
Here is an example : see https://github.com/drieu/gwtalert).


Advantage


Quick deploy on Google App Engine facile.


- Test 2 : Create a project with Play 1.2.5 and GAE plugin.


Advantage 



Easy to develop because of framework Play.

Drawback

- I've some difficulties with my proxy
Here is the Play application with solution  https://github.com/drieu/PlayWithGoogleAppEngine

- Play 1.2.5 isn't maintain.See if Yalp will work ...

Monday, March 18, 2013

Play Job monitoring



SiIf you want to monitor Play jobs (1.2.5) easily , you can use CRaSH and with command line, you type the following :
% dashboard | thread ls -n "jobs-thread*"
More information on http://www.crashub.org/

Thursday, March 14, 2013

First step with the cloud OpenShift of RedHat

My goal : Deploy an Play 1.2.5 on OpenShift.

For this purpose, I follow that link : planet_jboss


Steps summary:


- Create my application :

I create my application directly on the web site.It was quick and simple.
Moreover, all usefull command to connect with ssh and clone are available.You just have to make copy and paste.

- Gentoo install :


emerge dev-ruby/rubygems
ruby -e 'puts "Welcome to Ruby"
gem install rhc


- Initialisation (as a user)

rhc setup

- Clone of our application's repository


git clone ssh://XXX/~/git/monapp.git/

Then, I follow steps ICI

- Export of the war dans monapp/deployements :


play war -o /home/toto/monapp/deployments/cookies.war
git add deployments/cookies.war*
git push

- Check of the deployement

- Connexion with ssh on the RedHat cloud
- tail -f jbossas-7/logs/server.log


Comment:

- I try the cloud at my job but I didn't succeed because of proxy and firewall.I also tried to use ssh over
90 but without success.
- At home, no problem : it was easy end fast.

Saturday, March 9, 2013

JavaFx project on GitHub


To learn JavaFx, I've began a small project on GitHub.
I use JavaFx 2 and Maven.Perhaps, It could help you to begin  in your project.

See https://github.com/drieu/MetricViewer for more information.