Queue in Python - Part 1

Best way to implement a simple queue A simple list can be easily used and implemented as a queue abstract data structure. A queue implies the first-in, first-out principle. However, this approach will prove inefficient because inserts and pops from the beginning of a list are slow (all elements need shifting by one). It’s recommended to implement queues using the collections.deque module as it was designed with fast appends and pops from both ends....

November 2, 2016 · 1 min · Rezha Julio

Fix Java Unsupported major.minor version 52.0 on Ubuntu

Today when I run gradle test, I hit Unsupported major.minor version 52.0 error. It comes when you are trying to run a class compiled using Java 1.8 compiler into a lower JRE version e.g. JRE 1.7 or JRE 1.6. Simplest way to fix this error is install the latest Java release i.e. Java 8 and run your program. The Ubuntu archives have multiple versions of OpenJDK available. One of these is designated as the default and this has the package names default-jdk and default-jre....

July 12, 2016 · 1 min · Rezha Julio

Enable Spark Context on Your Ipython Notebook

When you’re trying spark with its python repl, it’s really easy to write stuff using simple function or lambda. However, it will be a pain in the ass when you’re starting to try some complex stuff because you could easily miss something like indentation, etc. Try running your pyspark with this command IPYTHON_OPTS="notebook" path/to/your/pyspark It will start an IPython Notebook in your browser with Spark Context as sc variable. You could start using it like this:

June 25, 2016 · 1 min · Rezha Julio

Fix GDM Service Can't be Enabled on Arch Linux

Today I just changing my desktop environtment from XFCE to Gnome 3. However GDM service always failed to be enabled. Everytime I ran sudo systemctl enable gdm, it always return Failed to execute operation: File exists. This caused by another display manager still enabled, but I don’t know which one. Fortunately, running sudo systemctl enable gdm -f will force GDM to be enabled and another display manager will be disabled....

February 11, 2016 · 1 min · Rezha Julio

Remove Entry from Known Host

Sometimes I am moving my domain from one server to another and facing this problem Add correct host key in /home/rezha/.ssh/known_hosts to get rid of this message. Offending key in /home/rezha/.ssh/known_hosts:60 RSA host key for rezhajulio.id has changed and you have requested strict checking. Host key verification failed. I am just too lazy to find line 60 of known_host I ended up deleting the entire known_host. Use this command to remove entries from known_hosts:...

February 3, 2016 · 1 min · Rezha Julio