Showing posts with label english. Show all posts
Showing posts with label english. Show all posts

Tuesday, May 29, 2018

Share the knowledge - in a fun way (with pictures)

At TouK we have so called TouK's Thursday Breakfast. It's name comes from King Stanisław II August's idea of Thursday Dinners. Our implementation is as a breakfast as it takes time at 10 am.
We gather from time to time at Thursday to discuss some interesting topics that are non-technical. For example we summarize projects, discuss important events in company's life, etc.

Technical topics we discuss on Fridays during TouK Weekly Workshops.

This time we tried to activate all our employees to share thier sources of knowledge - interesting Internet addresses: pages, blogs, vlogs etc. It could be done with an "ordinary" Google Forms poll but we love to do it differently. We've made a voting cards and voting box.




We've put it in the kitchen and made a call to action with special posters.




On that very day most of the company came and we've discussed all proposals.



There were two hosts - me and my colleague Tomasz. We've pulled out every card and asked the author to say a few words about this particular knowledge source. We've also presented this page on projector wall. Lot's of new ideas appeared.


But where's the fun? 
This was a surprise for all. Me and Tomasz were disguised as company owners. We were  acting like them even with some typical gestures. People were laughting all the time and it was really nice.




Some tips and takeaways?
Sure!


  • Prepare yourself. Take all results and visit them before to have a consistent list of pages. Let's waste no time on googling for proper resource. 
  • Prepare poster or email everybody that the meeting will take place.
  • Have some snacks and/or soft-drinks. This should be a nice meeting. 
  • Don't declaim. Have a chat and share opinions. Discuss. 
  • Make jokes. Have fun.



Grande finale
I really encourage you to share knowledge. I doesn't have to be so serious and boring.



Me and Tomasz :)


Tuesday, February 5, 2013

Http server with PHP on RaspberryPI

Totally awesome guide is at http://rasberrypibeginnersguide.tumblr.com/post/27283563130/nginx-php5-on-raspberry-pi-debian-wheezy
But instead using provided silex site config file, you should configure root folder of web server to serve php scripts. To do so please rm symlink to silex file and edit

/etc/nginx/sites-available/default

Set root folder to /var/www


#       root /usr/share/nginx/www;
        root /var/www;

Add index.php as a index file

index index.html index.htm index.php;

And configure all php files to be parsed by fastCGI php bridge set up on port 9000. Just put all below somewhere in default file

 ## Parse all .php file in the /var/www directory
            location ~ \.php$ {
                    fastcgi_split_path_info ^(.+\.php)(.*)$;
                    fastcgi_pass   127.0.0.1:9000;
                    fastcgi_index  index.php;
                    fastcgi_param  SCRIPT_FILENAME  /var/www/silex$fastcgi_script_name;
                    include fastcgi_params;
                    fastcgi_param  QUERY_STRING     $query_string;
                    fastcgi_param  REQUEST_METHOD   $request_method;
                    fastcgi_param  CONTENT_TYPE     $content_type;
                    fastcgi_param  CONTENT_LENGTH   $content_length;
                    fastcgi_intercept_errors        on;
                    fastcgi_ignore_client_abort     off;
                    fastcgi_connect_timeout 60;
                    fastcgi_send_timeout 180;
                    fastcgi_read_timeout 180;
                    fastcgi_buffer_size 128k;
                    fastcgi_buffers 4 256k;
                    fastcgi_busy_buffers_size 256k;
                    fastcgi_temp_file_write_size 256k;
            }

Now restart ngix as mentioned in original article and enjoy PHP on RPi!

Monday, January 21, 2013

Virtual task board + info radiator

There are some posts around about various task board solutions. Besides that we use white board to sketch some designs and exchange knowledge, we use virtual board as task board and info radiator.

Simply we have a jQuery script that runs in a web browser that rotates some most important pages with our project status. These are JIRA/Greenhopper task board, Jenkins, Sonar and current app snapshot built and deployed automatically by Jenkins.

And where this board stands? In front of us, at the windowsill where every team member sees it.

What is it? An old computer with 20" display.

Our colleagues from other project had ordered about 30" monitor but they have our company owner in team so this was obvious that they should have bigger and better display ;-)



Tuesday, September 11, 2012

GWT Development Plugin Firefox 15 (FF15) on 64bit ubuntu

I tried the latest plugin from well known source. But it didn't work.
But this one did.

Wednesday, August 1, 2012

GWT/GXT Unable to get value of property 'user.agent'

If your app hangs in IE/IE8 during load and you have

Unable to get value of property 'user.agent'

error under Development Mode, you should instruct your IE how to interpret application's page. To do this, put

<meta http-equiv="X-UA-Compatible" content="IE=8">

in your index.jsp or whatever you use to render the app.

More information on GWT wiki page.

Monday, July 30, 2012

GWT has bug in Dev mode for Chrome

It happens when trying to check visibility of component. So be careful with
component.isVisible()
as it fails on Chrome.

Same thing is for GXT (extgwt from Sencha) as it calls underlaying GWT's isVisible()


(UncaughtExceptionHandler.java:23) 2012-07-30 12:55:02,147 [ERROR] java.lang.ClassCastException: java.lang.String cannot be cast to com.google.gwt.dom.client.Element
java.lang.ClassCastException:
java.lang.String cannot be cast to com.google.gwt.dom.client.Element
    at com.google.gwt.dom.client.DOMImpl.getParentElement(DOMImpl.java)
    at com.google.gwt.dom.client.Node$.getParentElement$(Node.java:184)
    at com.google.gwt.user.client.DOM.getParent(DOM.java:892)
    at com.extjs.gxt.ui.client.core.El.getParent(El.java:1274)
    at com.extjs.gxt.ui.client.core.El.isVisible(El.java:1889)
    at com.extjs.gxt.ui.client.core.El.isVisible(El.java:1874)
    at com.extjs.gxt.ui.client.core.El.isVisible(El.java:1898)
    at com.extjs.gxt.ui.client.widget.Component.isVisible(Component.java:767)
    at com.extjs.gxt.ui.client.widget.Component.isVisible(Component.java:754)
    at pl.touk.mnp.frontend.webapp.client.widgets.RichDateComboFilter.handleBeforeLoadEvent(RichDateComboFilter.java:258)

When using development mode, better use Firefox. In production Chrome works well without bugs.

EDIT:
When using shallow visibility checking
component.isVisible(false);
the error can be avoided. GWT isn't traversing through DOM tree and it doesn't blow with an exception but you have to check whether shallow visibility checking is sufficient (in most cases it is).

Thursday, July 19, 2012

New Firefox 14 ruined all my GWT work (Ubuntu 12.04)

That's because there's no GWT Development Mode plugin for Firefox 14. And now I can't work!

Wait! There's a solution. Instead of fighting with ubuntu with reversing installed Firefox to 13. I can have parallel versions of FF.

So how to install previous version of Firefox on ubuntu?
Go there


http://mirror.dacentec.com/mozilla/firefox/releases/

and download your binary. Be cautious with 32 and 64 version. If you don't know what version do you have, call


uname -m

and it'll tell you.

Then unpack your version to desired directory (other than current Firefox's dir).
Close any running Firefox instances and run your downloaded version. Beware of upgrading both firefox and any plugins. Don't do this. This copy should remain as is.


If you're looking for unofficial GWT Development Plugin versions (for FF12, FF13 and soon for FF14)  you might looking at my gwt entries.

Monday, June 25, 2012

Imagination is better than high budget

Many times I've seen big crap for big money. That applies to software, to films, to theater plays and to music video clips. It's not a problem to create anything when you have a lot of money to spend (all polish romantic-like comedies for example - they all sucks!). But when you doesn't have them then you start to be creative, to use imagination instead of super-duper video effects. That's a huge opportunity to create diamonds instead of shiny plastics.

I bet you know what I mean.

As a little proof, a nice clip from Quiet Company. The band I don't listen to. It's not kind of music I like but I saw this video clip about 5 times and I like it and I found inspiration in it. They said that it was very low budget production made in their private house.



Wednesday, June 13, 2012

GWT Developer's Plugin for Firefox 13

I dug it from the net.

For Firefox 13

Thursday, May 31, 2012

How to set gnome-terminal tab title. Permanently...

I've been looking for this a few times without success. There are some nasty proposals with setting PS1 variable or other tricks with .bashrc mods. Weak and doesn't actually work.
I needed a way to make a bash script that opens several tabs with fixed titles and with fixed start directories and with already started programs (for example tail/less of log files). Or solutions are very complicated.

There's a simple way.

There's a nice option for gnome-terminal -t "Tab title" which allows you to set a title for a tab. But in default profile (a switchable terminal behavior configuration) any program or bash prompt can change tab's title. So actually setting tab title doesn't work permanently.

A good solution is to create a new profile (let's call it "NoTitleChange") with options set to not to allow tab change. To do this, in gnome-terminal go to Edit->profiles... click New, apply new name. Then in tab Title and Command from drop box (When commands set own title...) choose Keep initial title.


Now you can invoke

gnome-terminal --tab-with-profile=NoTitileChange -t "My Permanent title"


and nothing will change the tab's title.

You can play with these and other options to create many tabs in one window.

gnome-terminal --tab-with-profile=NoTitleChange -t "PERMANENT" --tab-with-profile=NoTitleChange -t "TABS ARE"  --tab-with-profile=NoTitleChange -t "AWESOME"


I'm using these other options
-e, --command=STRING
                 Execute the argument to this option inside the terminal.

--working-directory=DIRNAME
                 Set the terminal's working directory to DIRNAME.

--geometry=GEOMETRY
                 X geometry specification (see "X" man page), can be specified once per window to be opened.

For example

gnome-terminal --tab-with-profile=NoTitleChange -t "src" --working-directory=/opt/workspace/play/mnp/repo/console_gxt2/mnpc  --tab-with-profile=NoTitleChange -t "DevMode" --working-directory=/opt/workspace/play/mnp/repo/console_gxt2/mnpc --command="mvn initialize exec:exec -Pdevel"


Now you can create start script that opens proper working dirs (with source code for example) and with server logs open. And you're ready to go!

Friday, May 11, 2012

GWT Hosted mode on 64bit linux

GWT for linux is build against 32bit architecture. It contains some SWT/GTK 32bit modules. So if you try to run it with 64bit java it fails

Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/tools/sdk/gwt/gwt-linux-1.5.3/libswt-pi-gtk-3235.so: /opt/tools/sdk/gwt/gwt-linux-1.5.3/libswt-pi-gtk-3235.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1003)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:132)
    at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:22)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
    at org.eclipse.swt.widgets.Display.<clinit>(Display.java:126)
    at com.google.gwt.dev.GWTShell.<clinit>(GWTShell.java:301)
Could not find the main class: com.google.gwt.dev.GWTShell.  Program will exit.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR


You have two choices. Find 64bit SWT/GTK modules with same build version (3235 in this case) - good luck! or download 32bit JRE.

I chose second option and it took me 3 mins to resolve the problem.
Find proper JRE version on Oracle site I suggest bin file instead rpm. It unpacks jre to own dir. Move that directory to some convenient location (it doesn't matter where). Edit gwt.properties and set java.executable to java exec located in 32bit JRE.
Now run your GWT hosted mode and be unstoppable developer!




You may have some warnings from GTK, such as

/usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so: wrong ELF class: ELFCLASS64
(GWT:351): Gtk-WARNING **: Failed to load type module: /usr/lib/gtk-2.0/2.10.0
/menuproxies/libappmenu.so


But it has no consequences for me, so far...



Some sources say that you should set an environment var:

export LIBXCB_ALLOW_SLOPPY_LOCK=1

to block bugs in X display layer but I don't know what does it mean :)


In this case I had to hadle with GWT version 1.5.3 (old corporate project)
 

Wednesday, September 7, 2011

Browser caches user authorities when using Waffle security

When using Waffle security (with Spring security, in my case) I discovered that both Internet Explorer (9) and Firefox (5) caches authorities bounded to user. I discovered this when I've chagned required user group to access my application and then I added current user to required group but no change. I couldn't gain access. After some debugging it appeared that Waffle returns unchanged set of authorities for current user.
Reloading browser, tomcat and clearing all caches and data didn't work. I'm sure that Chrome would work neither.
Firefox has convenient way to clear active logins. Click Tools-> Clear recent history -> [check]active logins

Finally I got the solution - user should logout and login again into windows box...

Tuesday, August 30, 2011

A Mockito catch

Suppose we have such classes and interfaces

public class AddOrganizationAction implements Action {}
public class AddPersonToOrganizationAction implements Action {}


public interface DispatchAsync {
     void execute( Action action, AsyncCallback callback );
}


We're using the best mocking framework ;) Suppose we want to verify that code under test will call execute() with proper Action - AddOrganizationAction.
I found that many developers (including me!) check such condition with

verify(async).execute(any(AddOrganizationAction.class), any(AsyncCallback.class));

In such case AsyncCallback is not important for us. We just want to ensure that AddOrganizationAction will be passed. We run test and it's green. But suddenly if we put the code below into test it will be green too!

verify(async).execute(any(AddPersonToOrganizationAction .class), any(AsyncCallback.class));

Why? Because any() matcher doesn't check the instance of passed object to be equal to declared class (AddOrganizationAction in this case). Any() checks if passed object conforms to method signature. In this case any Action's child will do. And we have an erroneous test!
The proper matcher we'd like to use is isA() matcher that checks if passed object is instance of declared class (which means instance of class or it's children).

So the proper test should contain

verify(async).execute(isA(AddOrganizationAction.class), any(AsyncCallback.class));

Go now and search for any() usages and think about changing it to isA(). In 1 of 10 cases whenever I change all tests in a testcase to isA() usage, I find an error in implementation of logic under test. Luckily I know the catch and now you do :)

Ok. It's not really a catch but ignorance of all us developers that we don't read entire documentantation :)

Friday, April 29, 2011

Using Eclipse snippets for faster JUnit test creation (with Mockito!)

I'm using this snippet to create a template of new unit test method supporting BDD mockito tests. This is a good example for adding static imports to a class from snippets.

@${testType:newType(org.junit.Test)}
public void should${testname}() {
 ${staticImport:importStatic('org.mockito.BDDMockito.*', 'org.mockito.Matchers.*', 'org.mockito.Mockito.*', 'org.junit.Assert.*')}// given

    // when
    ${cursor}
    // then

}

The result is astonishing ;)

import static org.mockito.BDDMockito.*;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;


(...)

 @Test
    public void shouldTestSomething() {
        // given

        // when
        CURSOR_LANDS_HERE
        // then

    }

Friday, April 22, 2011

Spring security authentication-success-handler-ref and authentication-failure-handler-ref does not work with KerberosServiceAuthenticationProvider

I'm using SpringSecurity with KerberosServiceAuthenticationProvider which is Kerberos security extension. You can read how to use it on extension author's blog.
But you cannot use handler on form-login to catch authorization result. It's because of inner construction of authorization filter chain calls. Maybe it can be considered a bug?
The workaround is to implement ApplicationListener<AuthenticationSuccessEvent> and ApplicationListener<AbstractAuthenticationFailureEvent> to catch proper events.

package pl.touk.app.fe.server.security;

import org.springframework.context.ApplicationListener;
import org.springframework.security.authentication.event.AuthenticationSuccessEvent;

public class UserSuccessfulLoginLogger implements ApplicationListener<AuthenticationSuccessEvent> {

    @Override
    public void onApplicationEvent(AuthenticationSuccessEvent event) {
        //do something here
    }
}

package pl.touk.app.fe.server.security;

import org.springframework.context.ApplicationListener;
import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent;

public class UserFailedLoginLogger implements ApplicationListener<AbstractAuthenticationFailureEvent> {

    @Override
    public void onApplicationEvent(AbstractAuthenticationFailureEvent event) {
       //do something here
   }
}

Then you init beans in Spring configuration
<bean id="userSuccessLoginLogger" class="pl.touk.app.fe.server.security.UserSuccessfulLoginLogger" />

<bean id="userFailedLoginLogger" class="pl.touk.app.fe.server.security.UserFailedLoginLogger" />


A drawback is that one cannot have access to request and response as could have when using authentication-success-handler-ref and authentication-failure-handler-ref.
But in my case I didn't need that.

Tip! If you cannot receive AuthenticationEvents look at this page.

Thursday, March 31, 2011

GWT Designer for Eclipse 3.6 can cause project compile freeze

Lately I installed GWT Designer for Eclipse Helios (3.6). I wanted to check it's features. They aren't so cool I've expected but that's other story. The problem was that suddenly my main GWT enabled project began to freeze during compilation.  The project is maven enabled also.
So it freezed in about half of compilation. All other features of Eclipse worked well. Restarting Eclipse and Windows didn't help anyway.
After about an hour of investigating I've found that GWT Designer caused this. After removing it all came back to order.

Ofcourse I suspect that something is wrong with my Eclipse for example I have too many bizzarre plugins installed but if I could have such problems you could have them too. So be warned :-)

Thursday, March 24, 2011

(Another) GWT exception in Development Mode

Lately I got a new kind of exception during GWT Development Mode startup.


java.lang.NullPointerException
        at com.google.gwt.dev.resource.impl.DirectoryClassPathEntry.descendToFindResources(DirectoryClassPathEntry.java:79)
        at com.google.gwt.dev.resource.impl.DirectoryClassPathEntry.findApplicableResources(DirectoryClassPathEntry.java:54)
        at com.google.gwt.dev.resource.impl.ResourceOracleImpl.refresh(ResourceOracleImpl.java:351)
        at com.google.gwt.dev.cfg.ModuleDef.refresh(ModuleDef.java:386)
        at com.google.gwt.dev.cfg.ModuleDefLoader.tryGetLoadedModule(ModuleDefLoader.java:150)
        at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:136)
        at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:963)
        at com.google.gwt.dev.DevMode.loadModule(DevMode.java:468)
...


This was because after I started Development Mode, my IDE cleaned compiled classes directory(target/classes/ in my case).
Rebuild project and I'll be back to game :)

Did you like the post? Was it helpful? Leave a comment!

Thursday, February 10, 2011

GWT exception in Hosted Mode

I work with GWT version 1.7.0. It's old but our product requires it. Recently I had to debug using Hosted mode. During Hosted mode startup I had an exception

2011-02-08 17:04:31,578 [FATAL] Uncaught Exception:
com.google.gwt.core.client.JavaScriptException:
(TypeError): Object doesn't support this property or method.
 number: -2146827850
 description: Obiekt nie obsługuje tej właściwości lub metody.
    at com.google.gwt.user.client.impl.DOMImplStandard.initEventSystem(Native Method)
    at com.google.gwt.user.client.impl.DOMImplMozilla.initEventSystem(DOMImplMozilla.java:39)
    at com.google.gwt.user.client.impl.DOMImpl.maybeInitializeEventSystem(DOMImpl.java:111)
    at com.google.gwt.user.client.impl.DOMImplStandard.sinkEvents(DOMImplStandard.java:140)
    at com.google.gwt.user.client.impl.DOMImplMozilla.sinkEvents(DOMImplMozilla.java:27)
    at com.google.gwt.user.client.DOM.sinkEvents(DOM.java:1221)


After some investigation I found the reason.
During development, for performance reasons I compile my GWT apps only for Firefox. So this was the case. You must know that in earlier versions of GWT (and so in 1.7.0), application is displayed in special window with embedded Internet Explorer. And now you might look closer to the stacktrace above and see that there are some Mozilla classes involved and that's wrong because for IE we should have only IE classes! So that's the cause I had exception.

So if you want to run Hosted mode you have to compile your GWT application at least with IE support. Add this to you *.gwt.xml config file



<set-property name="user.agent" value="ie6,ie8" />


Or leave it without declaring user.agent so it would be compiled for all supported browsers. Too shame that GWT doesn't warn if it was not compiled for current browser.


If you still have problems with mentioned exception look at an issue in GWT bug tracker.

Tuesday, November 23, 2010

Servicemix: could not start under Windows XP due to infinitive wait for lock

I got looped during ServiceMix start

2010-11-23 14:49:32 org.apache.felix.karaf.main.SimpleFileLock lock
INFO: locking
2010-11-23 14:49:33 org.apache.felix.karaf.main.SimpleFileLock lock
INFO: locking
2010-11-23 14:49:34 org.apache.felix.karaf.main.SimpleFileLock lock
INFO: locking
2010-11-23 14:49:35 org.apache.felix.karaf.main.SimpleFileLock lock

...

SerivceMix tries to lock certain files to mark it's instance run. If you have an error shown above search for SeriviceMix process in memory and kill it.

Friday, November 19, 2010

Servicemix: Could not parse settings maven_path/settings.xml under Windows XP

Today I encountered problem with servicemix

Could not parse settings [file:/C:/Documents and Settings/Bartek/.m2/settings.xml]

A quick look at karaf.log revealed the problem

Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 4-byte UTF-8 sequence.

So the problem is with BOM (byte order mark) in settings.xml file. Many Windows editors add it at start of an utf encoded files. You should save settings.xml as ordinary utf8 file without BOM.

Problem solved.