Monday, December 12, 2011

Java Processors

As explained in Wikipedia - A Java processor is the implementation of the Java Virtual Machine (JVM) in hardware.

However, few people know that new Polish construction appeared recently: processor called Warszawa cosntrucred by Polish company http://www.gryftechnologia.com.

Warszawa Processor

During execution of Java program, instructions written in byte code and arguments are sent to instruction decoder. 30% of byte code instructions are realized directly on hardware. The rest is translated to assembly language because of their complicity and additional features of Java Virtual Machine.

An article about the new processor (in Polish) can be found here.

Wednesday, December 7, 2011

Web Design Techniques

I found recently an interesting speach about good web design techniqes. Putting it mostly for myself for reference.
http://ontwik.com/ui/design-for-developers-making-your-frontend-suck-less/

The presentation for this can be downloaded from Idan Gazit blog.

In context of good color design I found some time ago a color scheme generator here. You can read generated RGB for free.

Saturday, December 3, 2011

Global Code Retreat Day 2011

First Code Retreat took place in Java User Group Lodz on 3rd December.
Under vigilant supervision of Piotr Przybylak 12 programmers were improving their skills in context of Test Driven Development.
From 10.00 to 16.00 (roughly) in the office of Mobica company we went through several sessions, 45-minutes each, during which in pairs (different every session) we tried to implement Game of Life. Unfortunatelly noone succeeded to finish the application, but that was not the aim. The goal was to be comfortable with every line of code, to make it ideal given certain assets (such as e.g.: using no setters and getters, having rich domain model, in contrary to anemic domain model)

How does pair-programming look like? What is TDD about? It is well reflected in this conversation.

Every participant of today's event gained something new. I learnt a few Eclipse shortcuts, creating code templates in it, different aproaches to the same problem (objective vs. structural) a few useful libraries (Mockito, Hamcrest) and testing Android application ( thanks Mariusz :))
By chance a few positions worth reading appeared:
Wzorce projektowe. Analiza kodu sposobem na ich poznanie.
Release It!: Design and Deploy Production-Ready Software ( other books of Michael also worth reading)
Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation
Working Effectively with Legacy Code
Holub on Patterns: Learning Design Patterns by Looking at Code

The above list will be updated once I get more positions.

In the meantime we Skype-connected to Code retreat groups in Barcelona and Cracow.
I have a very good impression about this event and would attend similar ones more often.

Learning in practice - priceless, that's something what you can't buy. For everything else there is Master Card ;)

[youtube http://www.youtube.com/watch?v=FdMzngWchDk&w=420&h=315]

[youtube http://www.youtube.com/watch?v=0d6yIquOKQ0&w=420&h=315]


"...it's cats that are complicated"

Photos from event at Picasa Gallery

Monday, July 25, 2011

GWT DocLayoutPanel scrolls problem

I was creating a web application using GWT. My base panel is a RootLayoutPanel and I added on it a DockLayoutPanel on which I attached my components.
I came across a problem when changing browser window size to smaller than panel size. The panel size remained unchanged but part of it which was exceeding window size was not visible and there were no scroll bars for browser window.

I struggled with this annoying problem trying to put the DocLayoutPanel inside ScrollPanel, but it did not help at all.
Finally, i found a work around on GWT tutorial at:
http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html#Resize

I've added to my root html page a tag like:



<body>
    ..
    <div id="main" ></div>
    ..
</body>


then in onModuleLoad method instead of adding the panel like:



interface Binder extends UiBinder { }
private static final Binder binder = GWT.create(Binder.class);

public void onModuleLoad() {
    DockLayoutPanel outer = binder.createAndBindUi();
    RootLayoutPanel.get().add(outer);
}



I do it that way:



public void onModuleLoad() {
    DockLayoutPanel outer = binder.createAndBindUi();
    LayoutPanel panel = new LayoutPanel();
    panel.add(outer);
    RootPanel.get("main").add(panel);
    panel.setSize("800px", "800px");
}



NOTE that you must set explicitly the size of the panel to properly display on web page. You should have now scrolls as on any other web page when the panel size exceeds window size.

Wednesday, June 8, 2011

Unblock Android phone

Recently I had a little incident. Guys at work were playing with my Android phone lock trying to figure out the right pattern. Unfortunatelly they failed and after 5 attempts the phone asked for my Google login and password. To my surprise when I entered it the phone decided that it was wrong and I couldn't find a way to get into my phone until I found a usefull post here
Putting my Gmail login and password 'null' allowed me to set up a new lock pattern :) hurray!!
Nice security gap ;)

Sunday, April 10, 2011

33rd Degree Conference Cracow 2011

polska wersja
The conference has just finished on Friday. Did it blow up my mind? Yes, definitely it gave me a bunch of new ideas and a lot of motivation.
It lasted 3 days (6-8 April) and I have to admit it was one of the greatest conference I’ve ever took part in.
I dare to say it was comparable to Google Developer Day last year in Prague in substantial and organizational aspect. Only that GDD lasted 1 day and was for free, but anyway it cost something to get to Prague by train.
Great thanks to organizers, especially the main one - Grzegorz Duda.
The place where the conference was held - Best Western Hotel - was equipped in everything needed for such event. Maybe one drawback was not enough toilets as there were queues constantly.
During conference we had free access to snacks and drinks all the time - that was really cool, not as on some other conferences when snacks used to go to end quickly.
Organizers took care for bonuses like 40% discount for O'Reilly bookstore, 4-months JRebel license, or lunch pre-order, but the most important - speakers were just great, at least the ones I've chosen from among multiple possibilities.
Here come the ones..

Linda Rising - 'Deception and Estimation'

Linda Rising is an Insights and Experience Reports publisher in IEEE Software magazine. In her first speech she explained what deception is, in other words 'lying'. People not only deceive other but also themselves. The process begins already in our early childhood, when we hear from the closest family: "Ohh... say how much you love aunt Ellen", or in our adolescence in relationships - a common question of wife to husband: "Honey, do I look fat in this dress?". We tend to lie, but in those particular cases there is nothing bad in it. What's more - it is even healthier than to say an honest truth, e.g. "Yes Honey, you are fat!" ;)

However when it comes to estimation, deception is not such a good thing anymore.

First of all, are we able to make a good estimation? We are hardwired to be optimistic, we refuse to think about a process or information we don't like, we distort what we see, even if confirmed by mathematical analysis. The smarter we are the more deceptive we are. Max Plack said:
'A new scientific truth does not triumph by convincing its opponents and making them see the light, but rather because its opponents eventually die, and a new generation grows up that is familiar with it'

We tend to think about ourselves we are superior than other people, smarter, always have right. Often we use some silly things to estimate, e.g. it's common believe that adding more people to the project should cause more work-force, therefore should bring it to the end faster, however the Brooks' Law says something different - it prolongs the project. Brooks gave simple example, that "Nine women can't make a baby in one month" (http://en.wikipedia.org/wiki/Brooks's_law).

Agile software development says we should divide a project into very small pieces - the smaller, the better estimation.

Finally if we still can't answer the questions that come up when we need to estimate something we can use a special page prepared for this purpose ;) http://estimategoat.com

Matt Raible - 'Comparing JVM Web Frameworks'

Matt Raible is an UI architect specializing in Open Source web frameworks. Matt compared a few frameworks such as: GWT, Spring MVC, Vaadin, Ruby on Rails, JSF, Wicket, Tapestry, Play.

When we start choosing the right web framework for our application we need to get to the right one by eliminating the ones that won't work for our requirements an leave the ones that fit the best. It often appears that when one framework is excellent for implementation of certain functionality, it completely sucks for others, therefore coming to the choice by additive approach is not the right thing.

When choosing the framework a good idea is to watch a mailing list traffic on the framework’s page - this is a good indicator that framework is alive and people use it. Choosing a framework that is dead means we will have to fix any bugs that we find in this framework ourselves, which is not what we want to do. Web framework popularity report for 2011 can be found at http://www.zeroturnaround.com/java-ee-productivity-report-2011/

Nathaniel Schutta - 'Hacking Your Brain for Fun and Profit'

Excellent presentation full of ideas on how to boost one's productivity. From among many, just a few I've noted down..

Listener's brain pattern mirrors the one of speaker and when the listener gets lost, his brain patterns decouple (http://www.zeroturnaround.com/java-ee-productivity-report-2011/)

Our brain is active 24h/7. Even when we sleep our brain still digests, e.g. there is an unbelievable example of Croatian girl who woke up from coma being able to speak German while she'd never spoken it before (http://bit.ly/9t7JW9).

Scientists have amazing achievements on the field of brain analysis, e.g. the first brain scanners that can tell what a person is thinking about are already being developed (http://www.newscientist.com/article/mg20427323.500-brain-scanners-can-tell-what-youre-thinking-about.html)

It's proven that a short nap can enhance productivity. Thomas Edison was sleeping 4-5 h a day, but he used to make a short naps. He kept a heavy balls in his hands when falling asleep in order to prevent falling into 'deep sleep'. Whenever he was reaching this state, his relaxed body dropped the balls which fell on the floor noisily making him wake up (http://www.wilywalnut.com/Thomas-Edison-Power-Napping.html, http://dilbert.com/fast/2009-05-26)

There are cases in history of people that managed several days without sleep (http://www.youtube.com/watch?v=nSNRdvusmQs). Nevertheless the sleep is necessary for our body to function properly. Lack of sleep can cause severe productivity loss, even cause illnesses. It's also proved that genes impact our resistance for sleep, an insomniac gene was discovered at some people that could deal without sleep for a long time.

The whole presentation with many references to external resources can be found at Nathaniel's page: http://ntschutta.com/slides/Hacking_Your_Brain.pdf

Nathaniel Schutta - 'Going mobile with jQuery'

Again Nathaniel proved he is a real showmen on his presentations. A few examples comparing native mobile interface with a one implemented with jQuery Mobile (http://jquerymobile.com/) was very inspiring. I will definitely try it out.

Developing interfaces in HTML5 has a main advantage over native ones - we deliver one code for multiple operating systems and multiple mobile devices. The difference in appearance is sometimes almost impossible to spot. Noteworthy is a Pretty Mobile toolkit (http://wdtoolbox.com/prettymobile-iphoneitouch-website-development-toolkit/) mentioned by on of the audience, which is helpful for developing web interfaces that appear nearly as the native ones.

Linda Rising - 'The Power of Retrospection'

Again Linda proved her tremendous presentation skills, this time on a workshop.

What is retrospection about. In Agile projects it is a term meaning a meetings on which project members meet to summarize the project. Which is important, managers do not take part in the meeting but can see the results of them later on. The results should be anonymous. The retrospection does not necessarily have to be set up at the end of the project but can be more often, e.g. after each sprint.

Main retrospection rules are:

- no naming, no blaming

- do not admit to faults

We talk about the problems and not about people involved in them. We also do not put guilt on ourselves.

There are 4 retrospection questions to answer:

1) What worked and we don't want to forget?

2) What should we do differently?

3) What did we learn?

4) What still puzzles us?

When we say what we should do differently, we should find out no more than 3 small and easy things to change, even it at first sight they might not bring any solution. Often solutions some itself when the changes are brought into life.

What is nice to have on retrospection meetings is to offer appreciations to the team. Each member says what he liked in other members, e.g.: "I appreciate very much Bob, that when we delivered the project you stayed at work in the weekend when your sun had birthday. Without you we couldn't get where we're now"

A technique which helps to spot the things which went right or not during the project is doing a lifetime. What is the lifetime about? Any day during the project duration each member of a team might choose one of 4 colored papers and write on the sheet his/her feelings about that's currently happening. The papers are: red for anger, green for challenge, blue for happiness, yellow for surprise. The papers are filled in and placed on the wall or floor anonymously during each project phase. At the end of the phase or project when it comes to the retrospection it is clearly visible when the project faced most problems (red cards) or when most ambiguities happened (yellow cards).

Jakub Nabrdalik - 'Hack your company'

This talk was a set of real life examples of how to boost performance and motivation of employees. Just a couple tips can be:

- weekly/monthly workshops (like code retreat) that last for about 1h

- weekly/monthly lightening talks when a person picks up a technology to present to the others for about 1h

How to convince your boss to spare some time for these activities? One of the statements can be to choose a suitable time when anyway employees are not very productive and usually do nothing, like Fridays around 3-4 p.m. The other is involving inexperienced developers in workshops that can bring about better code quality in the future. Employees gain new skills.

The first day finished with beer party :)

On the second day I started with Jevgeni Kabanov - 'Do you really get Memory?'

A presentation about how JVM works in terms of garbage collectors, different implementations of GC. How JVM memory model looks like (young, ternured, perm spaces). What does 'volatile' word means.

The presentation, unfortunately in very low quality, can be seen here:

http://www.youtube.com/watch?v=-KlYKIXBdHw

http://www.youtube.com/watch?v=lE5djOLKTjg

http://www.youtube.com/watch?v=it9I5bIzktE

Hamlet D'Arcy - 'Java Boilerplate Busters'

An overview of such Open Source libraries like:

Google Guava

Apache Commons

The libraries help to write a clear understandable code that is effective instead of 'discovering the wheel' ourselves.

Dan Allen - 'Arquillian: Real Java enterprise testing'

Started with some problems with his laptop with about 15min delay but eventually led an interesting speech about testing enterprise application in their real environment instead of isolation (e.g. embedded container).

The tool used for this purpose is Aquillian from JBoss community together with Shrinkwrap.

Patrycja Węgrzynowicz - 'Patterns and Anti-Patterns in Hibernate'

I expected something more on this speech. It was an introduction of a few real life problems with transaction isolation, query performance and errors.

This was something that I already knew before, therefore not much gain for me form this presentation.

Jarosław Pałka - 'Architecture and programming model for NOSQL web'

Presentation in Polish. This was a first time I've seen NOSQL used in real life project, therefore very interesting. Source code of the examples shown on presentation can be found at https://bitbucket.org/kcrimson I'm looking forward to find some free time to experiment with it myself. Another external resource for NOSQL knowledge pointed in presentation is http://nosql.mypopescu.com

Jarosław show how to connect NOSQL value-key store with traditional RDBMS. Also a discussion on using Neo4j in commercial applications proved that NOSQL trends will gain more and more interest in the coming days.

As I'm interested in the new approach since not long ago I was happy to find even more topics around application scallability and NOSQL in next presentations.

Matthew McCullough - 'Monitoring 10 Critical Code Quality Metrics with Sonar'

Matthew presented an interesting tool - Sonar - an enterprise application for code analysis with web interface. The tool is 90% Open Source. The rest part has a commercial license. It is extend-able for new plugins, recognizes multiple languages (even COBOL, that made me surprised) and looks cool for code reviews. User can easily navigate from analysis to affected lines of code.

Moreover the tool goes with Eclipse plugin that can be synchronized with server. In Eclipse you can easily navigate to problematic code, make a correction and submit the change.

Server application can be integrated with SVN or Git for code version control and Hudson for continuous integration. It also integrates with Apache Ant and Maven.

Google charting is used to present most common developer sins which appear in the following domains:

  • size/complexity

  • unit test

  • duplication

  • coding rules

  • potential bugs

  • architecture

  • comments


Nathaniel Shutta - 'Agile UI'

Again a great speech. This time about usability of design. A few ordinary life bad but funny designs were presented. The main idea about UI design is to put yourself in the shoes of end users. Where do they work? Is there noisy? Is there light?

The software should be intuitive. What happens is we don't watch the signs or misinterpret them? (http://www.slate.com/id/2245644)

The slides with more external references are at http://ntschutta.com/slides/Agile_UI.pdf

The second day finished with Hackergarten. This is a name for a meeting on which developers gather to work on different open source projects. The idea is to finish the meeting with a commit. This not necessarily has to be a piece of code, but also documentation, podcast, etc. It must be something that brings some value to the project.

Interesting experience as I've never done sth like this before. It's a great chance to meet new people, see how they work and exchange knowledge.

Nice that we were supplied with food and beer for free ;)

The third day I begun with presentation of Karl Rehmer - 'How Debuggers Work'

Unfortunately my level of knowledge on debuggers design and operation didn't allow me to grasp too much from this presentation. However what I remembered is that Java debuggers differ a lot from other languages that run directly on OS (that use DWARF).

Java debugging does not use addresses or machine code. They use JDWP (Java Debug Wire Protocol) or JDI (Java Debug Interface) to communicate with JVM. These can be useful not only for debugging but also for any analysis of runtime such as getting the constants pool, intercepting executed methods, etc.

Costin Leau - 'Using Spring with non relational databases'

Costin can be found at http://twitter.com/costinl

Another dose of knowledge on NOSQL trend. This time showing Spring support in this domain: http://www.springsource.org/spring-data

It provides extensions for key-value stores (Redis, Riak), document stores (MondoDB, CouchDB), graph stores (Neo4j) using AspectJ to provide transparent POJO persistence. An example of Neo4j usage with Spring is Restaurant Social

Spring has also support for Apache Hadoop - software framework for intensive data processing.

Matthew McCullough - 'Hadoop: Divide and Conquer Gigantic Datasets'

This was an introduction to Apachee Hadoop. Matthew showed on VMware image that everyone can download from http://www.cloudera.com/downloads/ how to use Hadoop.

Hadoop is ideal solution for systems storing huge files of approximately 1TB size. The larger data sets the more performing is Hadoop.

Data is distributed among multiple servers but it's transparent to the and user who can execute common shell commands (in fact these are Hadoop commands) e.g. to list files, count words in text content, etc. as if the files were stored on localhost. User can also write own map-reduce methods in Java used to process distributed data.

Hadoop was inspired by Google MapReduce framework and Google File System. The document describing GFS is available from http://labs.google.com/papers/gfs.html

I'm going to explore the VM ware from Cludera soon :)

Neal Ford - 'Abstraction Distractions'

The presentation can be seen at http://www.jfokus.se/jfokus11/preso/jf11_AbstractionDistractions.pdf

Neal underlined an importance of wider look at the problems. The abstraction can never be as good as the original thing. The abstraction which is good now, can appear to be completely ridiculous in the future, e.g. in the past it was believed that the Earth is in the center of universe and any other idea was aggressively refused. Similar idea - how to persist some important information so that it survived decades. E.g. first computer programs ware stored on perforated tapes. One of the programs that lasts for decades and is still used is Emacs editor. It's  original source code is still stored on the perforated tapes but to retrieve it the machine to read perforated tapes would have to be build.

People undertake steps to create solutions that will be valid over centuries, one of these is a Long Now project that is to build a giant millennium clock http://longnow.org

Another example of abstraction (from many mentioned by Neal) can be e-mail storage system. For years mail clients used to store messages sorted in folders structure until GMail appeared with an idea to assign tags to a message. The message can have multiple tags, it can be connected to multiple contexts which is a lot more natural than putting it into only one folder (of course we could create different copies of the same message and distribute it among different folders, but isn't it an unnecessary complication when compared to the abstraction on GMail?)

The resources recommended to read in the speech include Paul Graham: 'Hackers and Painters' as well as Gef Roskin: 'The Human Interface' books.

Neal mentioned also a Blub paradox which can be explained as a problem of ignoring new things, e.g, ignoring the programming language which a developer does not know. The developer is familiar with a language he uses daily and all new stuff sucks for him.

Michael Nygiard - 'Architect for Scale'

Michael spoke about large scale systems, partitioning and scalability. Again in this context NOSQL appeared and CAP theorem. Basically partitioning is about fewer number of nodes within cluster and larger number of clusters.

Systems can be partitioned e.g. geographically, functionally.

Amdahl's Law was compared with Universal Scalability Law.

This was already the last presentation I could attend. I rushed for the train back to Lodz afterwards.

Conference home page

Saturday, January 15, 2011

Code Retreat Poznan 2011

Today took place the next Code Retreat event, this time in Poznan (POLAND).
The workshop on which programmers working in pairs try to solve a simple problem (Conway's Game of Life ) and practice Test Driven Development and Behavior Driven Development methodologies.
After each session lasting for about 45 min. the pairs mix. Finally it took us 5 sessions.
The event started at 8.30 am with a short welcome and introduction. Then a breakfast and hard work afterwards until about 12.00 to stop for a nice lunch.
After lunch more sessions with a 30min discussion in the meanwhile.
We could choose 2 topics to discuss among the ones most interesting for us. Finally these were: "TDD vs. BDD" and "TDD in practice".
All finished at about 5.00 pm.

Personally I have a very good impression about the event. This was the first time I took part in such kind of workshop. It was interesting to see how many different approaches to the same problem we could come into in different pairs. In some cases we started writing tests for a single cell among the neighboring cells. The other time we started from bigger perspective - testing the whole board of cells.
I also find the office of Cognifide (where the event was held) very pleasant.
Summing up, I recommend similar workshop to anyone. It was worth to get up at 5.30 am to drive to Poznan from Lodz for the whole day and to come back home in the evening after 2.5 in a car.