Skip to main content

Posts

Installing i3lock-color on Ubuntu

i3lock is fancy lock screen for Linux. There is i3lock dep available on Ubuntu but its not what I was looking for; I was more interested in i3lock-color . Lets see how we can install the same on ubuntu. PS: I'm using Ubuntu 16.04 Get source code for i3lock-color $ git clone https://github.com/PandorasFox/i3lock-color.git  $ cd i3lock-color Install required packages to build i3lock  $ apt install libev-dev $ apt install libxcb-composite0 libxcb-composite0-dev libxcb-xinerama0 libxcb-randr0  $ apt install libxcb-xinerama0-dev  $ apt install libxcb-xkb-dev  $ apt install libxcb-image0-dev  $ apt install libxcb-util-dev $ apt install libxkbcommon-x11-dev $ apt install libjpeg-turbo8-dev  $ apt install libpam0g-dev Build  $ autoreconf -i && ./configure && make Execute $ ./lock.sh Assign Shortcut In order to assign shortcut, install compizconfig $ sudo apt-get install compizconfig-settings-manager co...

Ubuntu 16.04: Office WiFI not connecting

I recently changed my office login password and after messing with my current wifi settings am not able to connect to wifi given credentials and all other expected settings are correct. This happens on Ubuntu 16.04 and found out that you need to manually enter settings into a disk file and make changes there.. Strangely, you wont find this settings in network manager UI, you have to manually enter this settings into file.. Open your wifi network file at below location and add/edit below properties. $ /etc/NetworkManager/system-connections/< > [802-1x] eap=peap; identity=< > phase2-auth=mschapv2 password-flags=0 password=< > system-ca-certs=false

Ubuntu Setup

I just moved to Ubuntu from Windows for numerous reasons and as I'm setting up my Ubuntu I have listed few points for future me. Here it goes.. Update Java Ubuntu 14.04 comes default with Java 7, I need Java 8 for new projects and Java 6 for some legacy projects. http://ubuntuhandbook.org/index.php/2014/09/install-oracle-java-ubuntu-1410/ https://ubuntuforums.org/showthread.php?t=2218888 Clean existing JDK sudo apt-get purge openjdk* sudo apt-get purge icedtea-* openjdk-* sudo dpkg --list | grep -i jdk java -version javac -version which javaws Update sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer java -version sudo apt-get install oracle-java6-installer java -version sudo apt-get install oracle-java8-set-default java -version Update GIT sudo add-apt-repository ppa:git-core/ppa sudo apt-get update sudo apt-get install git git --version Eclipse - Install Neon http://ubuntuhandbook.org/in...

Serlizing JSON polymorphically when type field is in parent JSON using Jackson

Today, I came across a json parsing situation where the sub-type field is outside the type json. Genrally we seen a situation like this @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class") class Animal{} class Dog extends Animal{ } class Cat extends Animal{ } and it de-serialize to json like this: {      "@class" : "x.y.z.Cat", ... } In my project I need to parse json like this { "status": "OK", "messageName": "x.y.z.Success", "messagePayload": { "foo": "cd3a5697", "bar": 224 } } { "status": "ERROR", "messageName": "x.y.z.Error", "messagePayload": { "errorCode": "APPLICATION_ERROR", "errorInstanceId": "b292b864", "errorDetailedMessage": "Invalid UUID string (Length mismatch)" } } ...

My first C program: now and then

I was searching for some documents in gmail and found a mail that I sent to company X for their hiring process. It was a c program for searching word in file. I do not know how much time I have taken for it but it was basic search utility function. The point of this blog is not discuss that program but to discuss how time makes you better programmer. Here are the few things I would like to share myself - It takes some learning to write clean code.  Reed books like clean code. You need mentor to learn from his experience. Get a github account and see how experts are writing code. This is not the complete list, there are many things you will acquire over a period of time which make you better programmer. PS: If you are wondering how that program used to look like, then see this  repo.

Again writing fast & maintainable integration tests using in-memory db, liquibase, gradle and spring mvc test

This blog is improvisation to previously blogged testing effectively with database blog . In this blog we will remove the jetty setup and instead use Spring MVC Test framework which kind of simulate the request/response for your controllers via Spring Web Application context (no deployment, to http client tests) Here, we will write Spring MVC tests and - Create the HSQLDB in-memory instance (instantiating datasource instance) and run Liquibase scripts against them. (using Spring Lqiuibase bean) 1. Setup your web-service. Write usual Controller->Service->Repository layer. @Controller @RequestMapping("/reports") public class MapAnomalyReportEndpoint { @Autowired private MapAnomalyReportService reportService; @ResponseBody @RequestMapping(method = RequestMethod.GET) public Collection getReports() { return reportService.getReports(); } } 2. Create Spring Java Config (No XML) Configure the controllers. @Configuration @Enabl...

Writing fast & maintainable integration tests using test double, in-memory db, jetty, maven and spring

Writing an integration test which test end to end flow of your application can become cumbersome activity if you really hitting real db and services. The best way to mock, test double your external dependencies and thus speed up your test execution. I created a dummy map-service project which demonstrate about writing maintainable and speedy integration tests using mocking, test double pattern, spring and automating them using maven and jetty. You can find the project at my github location: https://github.com/sagarr/maps-service Here are some code snippets explaining the important steps in configuring your project. POM - Configure jetty for deploying your app and running tests against it. . org.mortbay.jetty jetty-maven-plugin ${jettyVersion} /${project.artifactId} 8005 STOP 5 true 8080 60000 start-jetty pre-integration-test run 0 true stop-jetty post-integration...