Running IntelliJ IDEA under DWM with java 7 & 8

For quite long time I’ve been using IntelliJ 12 because it was still compatible with java 6 which & was running well with DWM. Whenever I was trying a newer version of IntelliJ which required java 7, I was getting a gray screen. The IDE was loading but couldn’t see anything but a gray window. And that sucked because the newer versions of IntelliJ support multiple selections etc which are quite neat.

Today I finally found a solution to the problem (mentioned here and I basically had to run the following command before starting IntelliJ:

> wmname LG3D
> ./

And that was it! Seems like you can use this tool/trick for any java program that has some issues!

So now I’m running IntelliJ using a little script I created inside /usr/bin/intellj (remember to sudo chmod a+x /usr/bin/intellj so other users can run it as well):

wmname LG3D
export IDEA_JDK=/usr/lib/jvm/java-8-oracle

Update: If you want to run Webstorm, you might need to exchange IDEA_JDK with WEBIDE_JDK

Connecting to wifi through command line (Lubuntu + DWM)

Hi everyone!

As you might have noticed already, I’m a big fun of DWM and for long time I had issues with wireless. Basically whenever I wanted to change to a different wireless network I had to logout from DWM, login to the Lubuntu’s default desktop manager (not even sure what it’s called) and from there switch to the new wifi. That was kind of annoying, having to close all my open applications just to set up the wifi.

I’ve tried a few times with iwconfig etc to get it working but I never managed to connect to another wifi through command line until today! How did I do that?ย I used nmcli tool! This seems to be the command line tool of the network manager. Here is the command I used to connect to the wifi network:

sudo nmcli dev wifi connect <wifinetworkname> password <wifipass>

That’s simple isn’t it? Enjoy!

Note: if you want to see what networks are found in range you can use the following simple command:

nmcli connection

Server time went out of sync

Last Sunday night I received a call from one of my clients that the pdf generation stopped working! What on earth! It was working fine for the 2 years and it decided this Sunday to stop working? What happened? I checked the code (nothing was committed accidentally). Checked the requests “Server can not generate pdf”. Then after a bit of debugging it turned out that the code that was uploading the generated PDF to Amazon S3 was throwing an error. Luckily the error description was quite clear:

The difference between the request time and the current time is too large.

So right away I checked the hour of the server that generates the PDF files & indeed it was around 15 mins in front. After a bit of looking up online I found that you can sync your server time using the command below. And that right away solved the issue & PDF generation was magically fixed ๐Ÿ™‚

sudo ntpdate
sudo apt install ntp
sudo systemctl reload ntp.service

You can read more about it on Ubuntu documentation

Change brightness of my laptop screen through command line

Unfortunately the Fn buttons for brightness don’t work with Lubuntu and my Acer laptop. Luckily, there is a command line solution for that:

xrandr --output LVDS1 --brightness 0.8

I’m pretty sure you can figure out that 0.8 means 80% right? Rest is simple ๐Ÿ˜€

I know that this is not a remarkable blog post but next time I’ll be sitting in the darkness blinded by my screen’s too strong brightness I’ll know exactly where to look for the command that changes it ๐Ÿ™‚

Have a nice weekend!

Alt + Shift + 0 on DWM

I have been using DWM for more than a year & I certainly love this window manager. It’s so lightweight, fast & simple that makes you forget all the features it is missing.

What I discovered today by accident is that you can attach a window to all the tags! Guess how?

Alt + Shift + 0 of course!

Why would that be useful? Well .. for me it’s useful cause I want sometimes to have the browser in all the tags so I can see it when I am looking at the code or when I’m doing some database changes on the terminal. Other reason could be to have an active skype chat all around so that you notice when a person replied.

If you don’t find it useful then you can not use it of course. But I won’t tell you the command how to remove it from all tags ๐Ÿ™‚

Multi touch works on my new Lubuntu!

Last week I bought a new laptop (Acer V3-571G i7-3630QM/16GB/750/DVD-RW GT640M) and accidentally a friend sent me an email about Lubuntu. So I decided to give it a try ๐Ÿ™‚

There are a few things I liked about Lubuntu:

  1. It’s lightweight. It doesn’t have all that gnome stuff that I’m not really using
  2. It has synaptic so I can properly see all the packages (comparing to that Software Center of Ubuntu that doesn’t show me the technical packages I want to install).
  3. It works out of the box. Didn’t have to install any additional drivers for anything (camera, microphone, wifi, graphics card). That’s the same with Ubuntu of course.
  4. Multi touch works! Most probably it works on Ubuntu as well & on other distributions but that’s the first time I have a multi touch mousepad. Therefore I can now scroll up & down with two fingers!! Even right click by tapping with my two fingers! This is super! I feel like I bought a Mac or something ๐Ÿ˜€
  5. It uses PC Man File Manager which is super fast!

What I didn’t like about Lubuntu:

  1. It looks a bit “old”. Well .. I can’t say much cause I’m using DWM (that’s the first package I installed!) but when I logged in the first time on that Openbox window manager it looked a bit “old”. But it’s ok. If you want to run it on a weaker machine it’s definitely a good option (although I would recommend DWM if you are a coder like me).
  2. Doesn’t come with Open Office (or Libre Office). It has of course Abiword & Gnumeric installed but I’m not sure how feature-full these programs are. Time will show. For now a couple of CSV files I opened worked fine. I wont install Libre Office for now until I really need it.

That’s it about Lubuntu. I’m not super excited about it but I’ll keep it on my PC. The main reason is because I’m using DWM as window manager and Lubuntu offers me PCMan file manager which is super quick & properly configured (icons show correctly etc).

On my previous Ubuntu installation I gave a try toย Thunar (another lightweight file manager) but icons weren’t showing properly. Now with Lubuntu & PCMan everything works like a charm!

Ok .. back to work ..

xargs vs parallel

Have you ever used xargs on linux? Did you ever get frustrated that it doesn’t work very well with the find command?

What do I mean?

Let’s assume we have a list of .csv (1.csv .. 5.csv) files in a directory and we run the following command:

find ./ -name "*.csv" | xargs echo

Then we would expect that for each filename it would run the echo command. But it doesn’t! Instead it returns us:

./1.csv ./2.csv ./3.csv ./4.csv ./5.csv

Apparently it calls echo only once passing it all the filenames.

There is a way to fix this problem by telling the find command to add a 0 (NULL character at the end of each filename & then tell xargs to accept those zeros as delimiter) but it’s not very elegant and it’s easy to forget:

find ./ -name "*.csv" -print0 | xargs -0 echo

Well today I discovered on stackoverflow a comment about the parallel command:

find ./ -name "*.csv" | parallel echo

The parallel command does exactly the same thing as xargs (but instead it properly handles results of the find command) and in addition to that it executes each argument in parallel! Depending on how many processors you have on your machine, the faster it will execute!

This is particularly handy when you are doing lots of uploads (that’s what I was doing today).

Note:ย You might need to install the parallel command on your machine (on ubuntu you can do it with sudo apt-get install parallel)