Sunday, November 18, 2018

Ubuntu 17.04, readonly FS and failure after restart...

I have AUSUS B451J (older ver of B451JA).

I was working with my project and suddenly IntelliJ Idead reported problems with saving workspace. Quick check of free space left - 4GB, so it was not the cause but dmesg reported read-only filesystem. WTF?
I restarted system and this appeared:

Couldn't get size: 0x800000000000000e
MODSIGN: Couldn't get UEFI db list
Couldn't get size: 0x800000000000000e


with initramfs in Busybox. I write all those details because it might help others to find this post.

It was a bit hard to check drive as I have encrypted LUKS partition so my old distros hanging around on old laptops couldn't decrypt it. I've used old laptop to prepare USB with Ubuntu 18.04.

I don't know which of my compulsive actions fixed it but I have
  • booted from live CD (actually live USB ;) of Ubuntu 18.04)
  • fsck'ed hdd - it found dozens of problems
  • removed (commented out!) UEFI mount point from /etc/fstab: #UUID=6B6A-68B7 /boot/efi
  • restored defaults in BIOS

After rebooting it worked again. I don't know how, why or when. I think it's time for new Ubuntu 18 or laptop.

Leave comment and twitt about this article if you found it helpful.

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


Saturday, January 9, 2016

Error:(, ) java: package edu.umd.cs.findbugs.annotations does not exist using Lombok

If you have an error during compilation in IntelliJ Idea and/or maven/gradle

Error:(X, Y) java: package edu.umd.cs.findbugs.annotations does not exist

you've enabled FindBugs Suppress Warnings in lombok.config:

lombok.extern.findbugs.addSuppressFBWarnings = true

but you forgot to add FindBugs to your maven/gradle config...

You might either remove config directive or add FB dependency.

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.

Thursday, September 5, 2013

Dostawcy

TouK zaangażował się w produkcje filmową.
Polecam stronę www.dostawcyfilm.pl

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

Tuesday, June 11, 2013

Prezentacja jQuery z 4developers

Prezentacja z konferencji 4developers jest całkiem interaktywna. Nie ma dema (gry Jeżyk), ale może kiedyś uda mi się je wrzucić.
http://zdanek.github.io/jquery.html

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".


Sunday, March 3, 2013

BitBucket push/pull keeps asking me for password

It does it even if you've added your ssh key?! Really?

So edit .git/config and change repo url from https to ssh.

It should look like this

url = git@bitbucket.org:your_login/your_project.git

If you don't know the address then go to your bitbucket repo page and check SSH address on the project's Overvier tab.

Don't forget to set up your name (bitbucket login) in [user] section. Refer git manual or just type

$ git config user.name your_login
$ git config user.email your_email

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

Za kilka godzin Warsjawa V - 100. wydanie WJUG

O 9 zacznie się Warsjawa. Czas iść spać. Muszę jeszcze tylko ostatni raz przejrzeć moją prezentację, którą właśnie skończyłem. Będzie niespodzianka.

Jestem gotowy


Albo przypakowałem, albo coś kombinuję... 

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