Make a directory writable by Apache on Mac OS X

Just a quick reference on how to make a directory writable by OSX integrated Apache web server.

1. Set the ownership of your desired directory/file to the _www user:

sudo chown -R _www:staff path/to/folder/

2. Set the permissions so that the _www can write in the directory/file without giving permissions to everyone else:

sudo chmod -R 755 path/to/folder

Happy coding 🙂

Hyper-V: How to change screen resolution in CentOS / Red Hat Enterprice Linux virtual machine

I’m thinking of doing a switch to GNU/Linux as my desktop OS yet again! (My last GNU/Linux desktop experience lasted for 5 years, then back to Windows.) This time giving CentOS 7 a try.

Why CentOS? I particularly like that, it’s one of the few GNU/Linux distributions out there providing LTS, which means I will have a stable development machine for at least 2 – 3 more years.

Making a decision to migrate or stay with Windows among other things is testing various aspects of the distribution such as how things works out of the box, installing various development tools / applications required for my area of work, etc..

For testing, CentOS 7 was installed on Hyper-V virtual machine. What I didn’t liked after the installation was the screen resolution that the machine was set to (1152×864) with now way of chaining it either from KDE System Settings or Hyper-V virtual machine properties.

After a bit of digging I learned that there is a frame buffer driver for Hyper-V and that CentOS unlike other distributions I have worked with, provides a tool called grubby for managing grub.cfg. It’s way easy to work with grubby than editing “/etc/default/grub” for example and running update-grub.

To set the desired screen resolution under Hyper-V. Open a terminal, and su. Then execute:

grubby --update-kernel=ALL --args="video=hyperv_fb:1280x1024"

and reboot the system.

NOTE: Replace 1280×1024 with the desired screen resolution.

See grubby man page if you need further info on what the a bought line does.

Enabel super user log in on Ubuntu 14.04 LTS

In order to maintain higher security level and keep the user from accidental breakage of the system the root user log in is disabled by default. To enable it, open a terminal window and type:

sudo passwd root

you will be prompted to enter the root user password. When done press enter.

That’s it. Now you can work from the command line like super user.

Screenshot-root@home: -home-vpaskov

Installing JD-GUI on OpenSUSE

JD-GUI is a standalone graphical utility that displays Java source codes of “.class” files. You can browse the reconstructed source code with the JD-GUI for instant access to methods and fields.

jd-gui
This java decompiler has GNU/Linux version available for download, but the site don’t mention anything about the dependencies of the package. It’s up to the user to find and install the required libraries in order to run JD-GUI.

For the x64 version of OpenSUSE install the following packages:

  • libgtk-2_0-0-32bit
  • libgthread-2_0-0-32bit
  • libXxf86vm1-32bit
zypper in libgtk-2_0-0-32bit libgthread-2_0-0-32bit libXxf86vm1-32bit

For the x86 version install:

  • libgtk-2_0-0
  • libgthread-2_0-0
  • libXxf86vm1
zypper in libgtk-2_0-0 libgthread-2_0-0 libXxf86vm1

Install Oracle JDK on OpenSUSE

Due to licensing issues, OpenSUSE comes with OpenJDK. I personally prefer using Oracle’s JDK. It’s worth mentioning that OpenJDK will not work in some cases such as building Android source code and it’s not recommended for Android development.

Here is how to install and setup Oracle JDK on OpenSUSE.

1. Download the JDK from Oracle’s site. I use 64-bit OpenSUSE so i downloaded the ‘Linux x64‘ version rpm. For 32 bit systems download the ‘i586′ version of the package.

2. Install the JDK by opening a terminal, becoming root and switching to the directory where you downloaded the RPM package.

For x64 version execute:

rpm -i jdk-8u5-linux-x64.rpm

For 32-bit version execute:

rpm -i jdk-8u11-linux-i586.rpm

3. Make the OracleJDK default system JDK.

While at the terminal and with root privileges execute the following sequence of commands:

update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_05/bin/java 1551
update-alternatives --install /usr/bin/javadoc javadoc /usr/java/jdk1.8.0_05/bin/javadoc 1551
update-alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_05/bin/jar 1551
update-alternatives --install /usr/bin/javap javap /usr/java/jdk1.8.0_05/bin/javap 1551
update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_05/bin/javac 1551
update-alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_05/bin/javaws 1551
update-alternatives --install /usr/bin/javah javah /usr/java/jdk1.8.0_05/bin/javah 1551
update-alternatives --install /usr/bin/jarsigner jarsigner /usr/java/jdk1.8.0_05/bin/jarsigner 1551

4. Define JAVA_HOME environment variable.

Type ‘exit‘ at the terminal to become your normal everyday user again. Open .bashrc in your favorite command line text editor and the following:

export JAVA_HOME=/usr/java/jdk1.8.0_05

Save the file and exit from the editor. Type:

source .bashrc

5. Verify Java version by typing ‘java -version‘ it should says “java version “1.8.0_05”“. If that’s the case you have OracleJDK correctly installed.