Running Docker on CentOS – accesing internet from docker

By default your docker can’t reach to internet only to get centOS.

running this command solves the problem:

sysctl net.ipv4.ip_forward=1
Advertisements

playing with code coverage using jacoco

I had to play little bit with code coverage to fill data to sonar.

Here is simple settings

  • download this generated maven repo
  • fill sonar properties in pom.xml file
  • run
    mvn clean compile install sonar:sonar

 

This creates jacoco.exe file with results in html.


first coderetreat in Ostrava

About month ago I decided that we should have session of CodeRetreat also in Ostrava. On December 14th there is Global Code Retreat Day, so I started to look whether we can make it in that short time and what is needed.

I had one condition – I can prepare everything, but I want to be participant during all sessions. So I have asked my friend Daniel Kolman to join us as CodeRetreat Master.

And what are my feelings ? It was great time, spent with great people, doing great things (learning how to code better and learning from others). I would like to point out 2 sessions:

  1. do session, where you can’t talk – basically you write test and hand over your keyboard to your pair body to write code. That was strange to program without communication
  2. write test with implementation inside the test (no object class, just the implementation) -> continue with other test with implementation inside that test. If you start having duplications extrat them into separate method and continue with other tests and when it make sense extrat it into separate class.  => that was really interesting how hard was it for me to stop thinking about classes objects and concentrate only on implementation inside of tests.

Here is quick intro to CodeRetreat: 

  • consists of 6 sessions where you write code for Game of Life and after each session you delete your code and start from scratch again
  • you do always pair programing
  • you concentrate on quality of code and not just to “make it working” – that’s why you delete your code, as it is not important how much you have done, but rather how good you have done it
  • each session concetrate on different tasks  – concetrate on good naming of your method and fields, every method can have maximum of 4 lines, TDD (starts with test which fails and then implementation which confirms that test will pass), pair programing – do ping -pong coding (one write test, mate writes implementation) …. 
  • you have very good options to learn new languages – in our case we had (java, groovy, clojure, scala, php, C#,…) 

here are few pictures from Ostrava CodeRetreat 

Big thanks goes to Daniel Kolman and others who helped us with it.


Changing default values when running IntelliJ IDEA

When running test – you can modify the default settings

So in my case, I wanted to:
* change default compiler to Eclipse compiler
* increase amount of HeapSize memory -Xmx1024m

This is quite easy when you know where to find it 🙂 So here it is:

1) from menu -> Run -> Run… (4th from top)
2) 1st option in pop up is “Edit Configurations”
3) 5th icon from menu on top left is “Edit defaults”

here you can many default values, like:
* compiler
* VM options
* code coverage – which coverage runner should be used
* compiling code before launch – aka Make
* and many others


zamestnanec vs osvc

This article is concerning czech people, that’s why writing it in czech.

V posledni dobe jsem dostal nekolikrat otazku ohledne rozdilu zamestnanec vs freelancer neboli osvc (popripadne podnikatel, ale zde jiz by zrejme platili jine podminky)

Predne si musime rict, ze to zalezi na hodne podminkach – jsem zenaty, mam deti, zena pracuje nebo je na materske,…

I kdyz jsem se snazil vysvetlovat rozdily dle mych subjektivnich zmen, ktere vnimam, ze se odehraly v mem zivote (zodpovednost, samostatnost, flexibilita, …) tak musim priznat, ze tyto zmeny, ktere ja pokladam za jedny z nejdulezitejsich, nejsou zrejme ty nejdulezitejsi v ocich zamestnancu.

Podivejme se tedy na danou situaci jazykem penez.

Modelova situace predstavuje zamestnance s mesicnim platem 50 000 a stejne tak osvc, ktery vystavuje fakturu ve vysi 67 000 (jinymy slovy superhruba mzda zamestnance je rovna obratu freelancera). Nyni nebereme v uvahu rozdilne vydaje, ktere by mohli mit (jak casto chodi do kina/restauraci, za co utraci a koli, kde bydli atd…). To co ja povazuji za dulezite, je podivat se jake mam “fixni” vydaje jako zamestnanec a jako freelancer – v odkazu je nazyvam tzv. Danove naklady a obsahuji v sobe dane, socku, zdravku (neboli superhruba mzda – cista mzda v pripade zamestnance)

Vytvoril jsem jednoduchy google spreadsheet, ve kterem modeluji jake danove naklad musi vynalozit zamestnanec a freelancer statu.

Zde je odkaz (stahnete si kopii k sobe do sveho spreadsheetu, a tam si muzete modelovat sve konkretni situace)
https://docs.google.com/spreadsheet/ccc?key=0Ar12q6OPfeNxdDl4OE9CNzczOXN2ZFl5RllCajdNUWc

Asi neni zadnym zazrakem, ze freelancer, ktery vyuziva 60% pausaly ma o hodne mensi zatizeni, jinymi slovy na konci roku ma o cca 270 000 vice.

Pojdme si rict jake vyhody a nevyhody zde cihaji:

Zamestnanec:
* relativni jistota, stabilita (vic jak 90% zamestnancu to dava na predni mista)
* nemuset se starat o administrativu – (osobne jsem rad, ze mam danovou poradkyni a pomaha mi optimalizovat me danove naklady a uprimne, tech par hodin za rok to stoji)
* nemusest nest zodpovednost – cely zivot neseme zodpovednost (v zivote musime byt zodpovedni za hromadu veci (za svoji rodinu, sve materialni veci, sve dulezita rozhodnuti, tak proc se nekdo tak vehementne brani prevzit zodpovednost i v praci)
* nemuset vkladat sve penize – pracovni “naradi” zajistuje zamestnavatel – (vyhoda i nevyhoda – jako freelancer mam svobodu co si koupim, to vetsinou jako zamestnanec nemam)
* placene volno – to je opravdu vyhoda, kterou jako freelancer nemate. pokud chceme opravdu sjednotit freelancera a zamestnance, tak bud si freelancer odecte 1 mesicni plat (je na dovolene) nebo zamestnanec si pricte 1 mesicni plat

Freelancer:
* svoboda (ale bez jistot 🙂 – ono v dnesni dobe je opravdu malo jistot – asi to muzu shrnout jen do 3: smrt, dane a vlepsim pripade (pokud verite v duchovni veci) vira v Boha
* vetsi vydelek (sice mate stejnou mzdu jako zamestnanec, tak jste schopen si ji lepe danove optimalizovat)
* flexibilita – moznost prejit z fyzicke osoby na pravnicky subjekt, nebo prenest sidlo sve firmy do jine zeme, ktera umoznuje lepsi danove optimalizace

nevyhody:
* prvotni naklady jsou velke – nakup pracovniho “naradi”
* mensi duchod – pokud nejaky bude ? – mensi dane znamenaji sice vetsi zisk, ale taky mensi zaplacene odvody na duchodove a socialni pojisteni
* vice prace okolo (administrativy) – jak jsem jiz napsal vyse – osobne to vnimam jako vyhodu
* ostatni kolem vas zacnou vnimat jinak (a zrejme se i zacnete chovat jinak nez ostatni kolem vas) a v nejhorsim pripade to muze skoncit tak, ze nektere pratelstvi budete muset ukoncit (je velka pravdepodobnost, ze se setkate s zavisti, pomluvami, vycitkami,…)
* stat vas narkne, ze ho okradate i kdyz platite vse presne tak jak je to narizene statem a vetsina zamestnancu bude na vas ukazovat, ze muzete za jejich problemy (maly plat, problemy ve statu, problemy s duchody,…)
* rucite veskerym svym majetkem v pripade freelancingu (i tato neprijemna podminnka se da obejit)

update: Kdyz jsem nad tim premyslel, tak jsem si uvedomil ruzne druhy pohledu na danou vec.
Zamestnanec a jeho rodina se vidi jako 36 500 “looser” protoze statistiky hovori, ze jeho prace by mela byt ohodnocena za 50 000.
Zamestnavatel a stat ho vidi jako velmi uspesneho jedince s platem 67 000. Obzvlast stat ho velmi rad vidi, protoze ho muze legalne “okradat” o jeho penize.

Hrube mzdy, ciste mzdy bych uplne zrusil, jedine co je relevantni je tzv. superhruba mzda (jak pro vypocet dane, socky, zdravky (proste stat a dokonce i zamestnavatel musi pracovat s touto castkou) – to je castka za kterou pracuje a ktera ho reprezentuje pred statem, zamestnavatelem a pred dalsimi urady). Pokud clovek si tento fakt uvedomi, tak dokaze velmi rychle videt, ze plat ma nad prumerny, a ze to neni zamestnavatel, ktery ho okrada, ale je to stat, ktery mu z platu legalnim zpusobem ‘ukrade’ skoro az 50%.
Pokud to nezaznelo dostatecne hlasite, chyba neni v tom, ze zamestnavatel malo plati – podivejte se na superhrubou mzdu – jste 70 000-tisicovy clovek (velmi uspesny s vysokym nadprumernym platem) – to co chci rict, zjistete, kde se ztraci penize – a zda zmenou formy pracovniho vztahu se neda optimalizovat svoji situaci.


vmware how to install windows on scsi disk(disk not found)

You can install windows on vmware image using scsi disk. But XP will tell you that they can’t find any HD.

For this you have to include scsi driver  as floppy disk during installation : F6 -> specify driver -> A: -> use scsi driver -> continue 🙂

More details here.


OSX package manager

Long time ago when I have switched to Mac I have missed “apt” from debian. APT is package manager the easiest tool I have ever seen.

Mac is more GUI based, anyway there are some tasks you would like to do/run from command line. For example mac doesn’t have “wget” command and there can be much more comands you would like to use but they are not there. In this case you can install them by using some package manager.

Some time ago I have played with Fink and Macports but honestly they are good, but ….

Last weekend I have found the project called HomeBrew which is package manager for OSX based on Ruby. So what is homeBrew?

Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with OS X.

Very easy to install and use.