Showing posts with label touk. Show all posts
Showing posts with label touk. 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 :)


Friday, September 4, 2015

What's the cause of your problem?

Most of exceptions has a few constructors including those with cause exception.
But what if you have to throw an exception that has no cause in constructor? You try to survive:


 Exception cause = new Exception("I'm the cause!");
 SSLHandshakeException noCauseExc = new SSLHandshakeException(String.format("SSL problem: [%s]", cause.getMessage()));
 noCauseExc.printStackTrace();

...and you lose stacktrace which is cruicial!

There's a solution Throwable::initCause(). Check this code and have cause tailed to your exception


import javax.net.ssl.SSLHandshakeException;

/**
 * Created by bartek on 04.09.15.
 */
public class Cause  {

    public static void main(String[] args) {

        Exception cause = new Exception("I'm the cause!");
        SSLHandshakeException noCauseExc = new SSLHandshakeException(String.format("SSL problem: [%s]", cause.getMessage()));
        noCauseExc.printStackTrace();

        SSLHandshakeException withCauseExc = new SSLHandshakeException("Another SSL problem");
        withCauseExc.initCause(cause);
        withCauseExc.printStackTrace();
    }
}

Tuesday, August 25, 2015

Restart or power off Rasperry PI with REST call

If you need to restart or power off your RPi remotely (or through local application's call) here's a simple way

http://raspberry.address:7000/reboot
http://raspberry.address:7000/power/off

Details and code at  https://github.com/zdanek/raspiPowerServer

Monday, April 20, 2015

Abstract method in Enums

Did you know that you can do that?


  private static enum DynamicProperty {

        cacheManagerName {
            @Override
            void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
                config.cacheManagerName = (String) evt.getNewValue();
            }
        },
        defaultCacheConfiguration {
            @Override
            void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
                LOG.debug("Default Cache Configuration has changed, previously created caches remain untouched");
            }
        };

        abstract void applyChange(PropertyChangeEvent evt, RuntimeCfg config);
}

I think it's nice because it allows you to customize Enum's behavior or perform other actions on use. 

Piece of code taken from EhCache Configuration (line 118 and further).

Thursday, April 16, 2015

EhCache config with BeanUtils

BeanUtils allows you to set Bean properties.
If you have configuration stored in a Map it's tempting to use BeanUtils to automagically setup EhCache configuration.
Sadly this class has mixed types in setters and getter and thus BeanUtils that use Introspector behind won't get getter and setter pairs properly. It will get only getters and thus inform you that these properties are read only: "Skipping read-only property".

My fast solution is to use BeanUtils and have a fallback to Reflection.

public static void setProperty(Object obj, String propertyName, Object propertyValue, boolean silently) {
        try {
            PropertyDescriptor desc = PropertyUtils.getPropertyDescriptor(obj, propertyName);
            Method writeMethod = desc.getWriteMethod(); 
                 
            if (writeMethod == null) {
                writeMethod = getAlternativeWriteMethod(obj, propertyName, propertyValue.getClass());
            }
            
            if (writeMethod == null) {
                if (silently) {
                    return;
                }
                throw new IllegalArgumentException("Can't find writerMethod for " + propertyName);
            }

            if (LOG.isTraceEnabled()) {
                LOG.trace(String.format("Setting %s property of %s", propertyName, obj.getClass().getSimpleName()));
            }
            
            writeMethod.invoke(obj, propertyValue);
        } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
            throw new IllegalArgumentException("Error when setting object property.", e);
        }
    }

    private static Method getAlternativeWriteMethod(Object obj, String propertyName, Class paramClass) throws NoSuchMethodException {
        String setterMethod = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
        Method m; 
        if ((m = getMethod(obj, paramClass, setterMethod)) != null) {
            return m;
        }
        Class altClass = paramClass.isPrimitive() ? ClassUtils.primitiveToWrapper(paramClass) : ClassUtils.wrapperToPrimitive(paramClass);
        if ((m = getMethod(obj, altClass, setterMethod)) != null) {
            return m;
        }
        
        return null;
    }

    private static Method getMethod(Object obj, Class paramClass, String setterMethod) {

        try {
            return obj.getClass().getMethod(setterMethod, paramClass);
        } catch (NoSuchMethodException e) {
            return null;
        }
    }




I will think about PR to Configuration class but it's complicated as EhCache 2.x is not present on GitHub.

Friday, June 28, 2013

Grails on Ubuntu 13.04 Raring Ringtail

If you add grails ppa to your sources you still won't install grails. There's no packages ready yet.

Instead of crying you could (temporarily) edit your apt sources and install packages for 12.10 Quantal Quetzal. So do this:

sudo add-apt-repository ppa:groovy-dev/grails

sudo vim /etc/apt/sources.list.d/groovy-dev-grails-raring.list
and change path to
deb http://ppa.launchpad.net/groovy-dev/grails/ubuntu quantal main

sudo apt-get update
sudo apt-get install grails-VERSION

If after typing grails if you press the tab key then it will show all available grails versions from 1.2.5 to 2.2.0 and beyond.

Remember that you can install several versions of grails and switch between them with

 sudo update-alternatives --config grails

Monday, April 29, 2013

Java encoding problem (in Tomcat and other servers)


The problem with encoding of served files appears when there's something wrong with java configuration on system level. Even providing proper headers inside HTTP responses can't help because all files are read improperly.


If you have problems with tomcat or other server and your files are served with broken encoding, you should edit your start script and add to JAVA_OPTS

 -Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8

I assume that you use utf8. If not, correct statement above with your encoding but please consider moving to utf8. 


Thursday, April 11, 2013

Jutro 4developers


Jutro na Bobrowieckiej (tam gdzie była wielokrotnie Javarsovia i Confitura), jutro, 12.04.2013, odbędzie się 4developers. Ja też tam będę z moim wykładem jak zacząć developować przy użyciu jQuery ("jQuery kickstart"). Zapraszam na ścieżkę "Javascript & modern web".


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 ;-)



Friday, November 2, 2012

Rapid development z Liveview

Film opisujący co i jak


Update: plugin do firefoxa

Saturday, October 27, 2012

Udana Warsjawa V - 100. spotkanie WJUG

Nigdy nie piszę relacji z imprez. Dzisiaj mam nastrój.

To była V edycja. Dotychczas współorganizowałem edycje III i IV. Tej nie organizowałem i bardzo dobrze, bo powstała nowa zwarta grupa zdolna organizować imprezy WJUGowe. Super.


Rozpoczęcie chwilę po 9 zawierało przemówienie Oćca WJUGa, czyli Jacka, który siedzi teraz na Ukrainie, ale przesłał nam wideo.


Potem ja wspominałem moją przygodę z WJUGiem i okolicami. W ramach tego miałem na sobie 10 T-shirtów, które zebrałem na imprezach, o których opowiadałem. Były to specjalne spotkania WJUG oraz m.in. kolejne wydania Warsjawy i Javarsovii/Confitury.







Zademonstrowałem też unikalną koszulką z okazji 100. JUG.



Po mnie wystąpiło jeszcze kilku kolegów, a następne Grzesiek Duda z 30 minutową opowieścią jak ważne są JUGi i angażowanie się w społeczność Javową.






Rozeszliśmy się do 10 sal, w których odbywały się warsztaty. Ja wybrałem Java + elektronika i było sympatycznie. Nauczyłem się podstaw programowania Arduino, ale i przekonałem się, że Java jest uruchomiona tylko na PC, a nie pakujemy jej do środka Arduino. Z tą Javą to nie taki głupi pomysł i możliwy, np. dzięki NanoVM.

Nie doczekałem do końca imprezy, bo tatowe obowiązki wzywały mnie z domu.









Program i szczegóły na www.warsjawa.pl

Plusy:
* mega dużo warsztatów (słownie 10 sztuk)
* bezpłatny obiad w barze Kubuś, na Wydziale MIMUW
* sprawna organizacja, żadnych wpadek

Minusy:
* słaba reklama poza WJUG
* ciągłość zajęć (brak przerw) powodowała, że nie było kiedy porozmawiać

Co do braku reklamy, to przyczyna była prosta - zanim organizatorzy zdążyli rozgłośnić imprezę gdzieś dalej, miejsca były wyczerpane. Cudownie, tylko ja jednak widzę tu problem, że impreza zrobiła się przez to i lokalna i zarezerwowana tylko dla Warszawiaków/WJUGowców.

Martwiła mnie też absencja stoisk sponsorów, których nie brakowało, ale byli nieobecni, poza Outbox.

Na miejscu organizujących bym przemyślał wskazane przeze mnie problemy. Na pewno będę miał okazje porozmawiać z nimi o tym. To jest coś, z czym i ja muszę się niejednokrotnie mierzyć podczas organizowania innych imprez.

Z punktu widzenia uczestnika 10pkt.
Z punktu widzenia organizatora 9pkt. ;)

Friday, October 26, 2012

Mój wykład na Warszawa JUG

We wtorek (29.10.2012) pokażę podstawy budowania Front Endu przy użyciu Twitter Bootstrap i jQuery. Zbudujemy razem aplikację do zarządzania biblioteką Warszawa JUG. Dlaczego warto przyjść? Bo będzie niedużo, ale powoli i ze zrozumieniem. Będzie to dobry fundament do dalszego rozwijania umiejętności związanych z budowanie FE.

Przeklejam zapowiedź z WJUG:


W najbliższą sobotę 100. spotkanie warszawskiego JUGa w postaci warsztatowej,
ale grupa nie zwalnia tempa i miło będzie nam gościć jednego z liderów grupy - Bartka Zdanowskiego!

Gorąco zapraszamy w najbliższy wtorek, 30 października o godzinie 18:00,
na Wydziale Matematyki Informatyki i Mechaniki UW (Banacha 2), w sali 5440 (IV piętro).

Temat: Budowanie frontendu przy użyciu TwitterBootstrap i jQuery - Bartek Zdanowski

Bartek o wykładzie:

Podczas wykładu zrobię mały wstęp do JavaScriptu (niezbędne minimum),
pokaże jak używać TwitterBootstrap[1], aby zbudować layout i jak to
ożywić przy użyciu jQuery[2]. W przypadku jQ zobaczymy też jak
komunikować się z backendem. Postaramy się razem zbudować długo
oczekiwaną aplikację do zarządzania biblioteką WJUG. Pokażę Wam rapid
development przy użyciu liveview, czy automatycznego odświeżania
przeglądarki w miarę powstawiania layoutu.
Backend zapewni nam Grails[3], którego nie będę pokazywał, chyba, że
starczy nam czasu i będą chętni.
Poziom wykładu: początkujący.

*Uwaga*: Jeśli pobijemy rekord frekwencji w październiku, to wśród
zebranych rozlosujemy licencję IntelliJ Idea lub dwie, jeśli przyjdzie
dostatecznie dużo ludzi! Na pewno do rozlosowania będzie roczna
licencja JRebel, bardzo dobrego narzędzia.

O Bartku:

Bartek Zdanowski na co dzień pracuje jako developer w TouK[4], jest
tatą dzieci, mężem żony oraz panem psa. Żonę wspiera w Fundacji
Artystycznej Młyn[5], która wystawia spektakle dla dorosłych, na które
bardzo serdecznie zaprasza ;-) Nie wypada nie mieć bloga, więc ma [6].
Od jakiegoś czasu jest współorganizatorem największej społecznościowej
konferencji Confitura[7], a ostatnio po godzinach jest szalonym
naukowcem[8].

Planowany czas prezentacji wraz z dyskusją to 120 min.

Informacje o spotkaniach zawsze widoczne w kalendarzu grupy oraz na Twitterze.

Zapraszamy!


PS. Yeah! Pobiłem rekord ilości linków w mojej zapowiedzi!

Friday, October 19, 2012

Wystartował toukLab

Dzisiaj oficjalnie wystartował toukLab. Miejsce, w którym pracownicy TouK mogą popracować nad własnymi pomysłami, poeksperymentować lub zbudować odjazdowe urządzenia.


Dziedziny, którymi będziemy się zajmować to ogólnie elektronika użytkowa, czyli urządzenia, które są fajne i fajnie się ich używa :) Jest to inicjatywa kilku moich kolegów i mnie, z której TouK nie będzie czerpał korzyści wprost. Wręcz przeciwnie, zainwestował małe conieco, ale na pewno zwróci się to kolejny raz w postaci naszej satysfakcji i poczucia, że pracujemy w fajnym miejscu.
Pomysł powstał z prostej przyczyny - część z nas ma dzieci i nie jesteśmy w stanie w domu budować niczego co dymi, kopie prądem lub zajmuje znaczącą powierzchnię. Zresztą, moja żona każe mi sprzątać graty na wieczór ;)

Gości witaliśmy naszym wewnętrznym manifestem, którego fragmenty zdradzam:


Witamy!

Czym jest toukLab?
To miejsce, gdzie można w wolnym czasie poeksperymentować i zbudować coś niezwykłego. To kolejny dowód na to, że TouK jest firmą totalnie nieszablonową, w której wszystko jest możliwe.

Dla kogo?
Dla każdego, kto realnie chce usiąść po godzinach i poeksperymentować z czymś więcej niż soft.

Kto to wymyślił?
Grupa śmiałków, w których buzuje energia i chcą eksplorować nowe światy!

Kto za to zapłaci?
Naszym mecenasem jest TouK, który udostępnił nam miejsce. Sprzęt na wyposażeniu jest prywatny lub przekazany nam przez TouK.

Czy to jest bezpieczne?
Pośrednio tak. Może trochę śmierdzieć, hałasować lub błyskać. Dlatego mamy wydzielone miejsce i będziemy tu pracować po godzinach, aby nie przeszkadzać.
Bezpośrednio może być niebezpieczne dla osób przeprowadzających eksperymenty, głównie z prądem, ale to ich odpowiedzialność.

mgr inż. wielokrotnie rehabilitowany (na kolano i stopę) 

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.

Tuesday, July 3, 2012

Pije SML do TouKa, a TouK do SMLa

Na Contiturę 2012 przygotowaliśmy w TouKu ulotkę informacyjną. Ktoś z firmy ją udostępnił w sieci i koledzy z Software Mill dodali do niej komentarz i wrzucili do sieci. W związku z tym, TouK odpowiedział swoim.

Wyszła sympatyczna wymiana myśli :)
Pozdrawiam SML!




Wednesday, June 13, 2012

GWT Developer's Plugin for Firefox 13

I dug it from the net.

For Firefox 13