I installed Arch Linux before but using archinstall script. archinstall
is a helper library which automates the installation. It is packaged with different pre-configured installers that work like a "guided" installer. Linux enthusiasts will oppose to this way of installing since Arch Linux is meant to be DIY.
Then I attempted to do the encrypted version using the same archinstall
. I am not happy with the result due to the following reasons.
It has very limited swap space size. archinstall
is creating 4GB swap by default and cannot find a way around it.
It doesn't wake up from hibernation. The only way to recover is through hard restart.
On this post, I will put the step by step guide I followed for an encrypted Arch Linux setup. I had three attempts before I get a working one. Common issue I have is along bootloader and missing resume hook to wake up from deep sleep. I learned my lessons the hard way!
This setup will create an LVM on LUKS with GRUB boot loader.
Read More →I attended recently a golang
programming training. Our instructor is a respected Golang developer himself William Kennedy who has trained thousands of developers worldwide in Go.
The class I attended teaches how to build production-level services in Go leveraging the power of Kubernetes. From the beginning, you will pair program with the Bill Kennedy walking through the design philosophies and guidelines for building services in Go. With each new feature that is added to the service, you will learn how to deploy to and manage the Kubernetes environment used to run the service.
I will outline here my install experience for the starter service. I installed it on my Mac during our training but this time, this is my Linux experience.
Read More →Docker is an open source project which allows us to deploy applications inside containers. A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and realiably from one computing environment to another. A docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system librarries and settings.
It's been a while since I installed Docker desktop but hopefully it's a similar apt
or yum
install experience on yet another flavour of Linux.
We have microservices developed using Ruby on Rails. I have to install several of these microservices to run another Golang microservice. Being a ruby noob, I find it challenging to install since I think the README assumes every developer is seasoned Ruby programmer.
The other challenge I have is that Kali Linux has out-of-the-box ruby which version is lower than what its Gemfile requires. I have to uninstall the existing ruby and install rbenv. But the hurdle doesn't stop there.
Read More →I recently published Tomcat Manager Application to my existing tomcats. In a nutshell, the Tomcat Manager App is a web application packaged with the Tomcat server to provide basic functionality to manage our deployed web applications. I intentionally dropped them on the first instance I installed Tomcats since I lack the time to configure them.
Tomcat Manager App is a part of the existing Tomcat package so I just have to untar it and copy the manager folder to the existing Tomcat webapps folder.
In an instance, here's how you can test if there are memory leaks
$ curl -ku tomcatman:s3cret https://yourdomain.com/manager/text/findleaks?statusLine=true
OK - No memory leaks found
Read More →
As part of our training, we were given access to some courses on codebashing and Java being my primary course. We were generously given access to other courses which I will pursue during my spare time. I'm looking forward to complete other Java-related courses too and time-permitting, I'll try Golang and Ruby on Rails courses. That's a very optimistic wish but if access to this resources will remain, might as well consider it as opportunity.
Read More →My employer is issuing new laptops during pandemic (I'm not sure if this is part of the Work From Home (WFH) whenever possible initiative). Nevertheless, it's a good thing since we are getting MacBook instead of Windows machine. Don't get me wrong, Dell machines are reliable in general. The only thing missing on Windows is the opensource toolchain. And to be specific, I'm missing a good console that's pleasing to my eye while reading texts. With my git bash
, I have to type clear every time since texts overlap each other (a common experience after tailing a log file). Another specific I'm missing is the package manager though I survived with choco.
To my surprise, I received a brand spanking new MacBook Pro 2019. It has Intel Core i9 and AMD Radeon Pro with 4GB of GDDR6 memory, hardware specs that I'm really proud of!
What I'm about to write is my out-of-the-box experience and the commands I used to set it up.
Read More →We are planning to use AWS for our Java applications which is a step forward from the dedicated hosting that we currently have. Being on a corporate world, security is pretty tight and common ports are locked down including SSH port. This is a challenge since I have to SCP to deploy my jar and war files.
Luckily AWS allows to tunnel SSH through their session manager. I followed this guide to setup my connection. There are prerequisites to comply with and you need to have the correct role provisioned to your AWS login.
Read More →From letsencrypt.org:
To enable HTTPS on your website, you need to get a certificate from a Certificate Authority (CA). Let's Encrypt is a CA. In order to get a certificate for your website's domain from Let's Encrypt, you have to demonstrate control over the domain. With Let's Encrypt, you do this using software that uses the ACME protocol, which typically runs on your web host.
You will need SSH access to your web host to install a certbot
client. certbot
will automate certificate issuance and installation with no downtime.
On my machine, it added more Python dependencies.
$ sudo yum install certbot python2-certbot-apache
Read More →
If you're running the latest Ubuntu 18.04, then you don't need to add the PPA repository. If on lower version of Ubuntu, please add this PPA.
$ sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tp
$ sudo apt-get update
network-manager-l2tp-gnome
is required if running gnome
$ sudo apt-get install network-manager-l2tp
$ sudo apt-get install network-manager-l2tp-gnome
Read More →
This is from Spring Guides and it's their "hello websocket" application. This sends messages back and forth between a browser and the server using WebSocket.
$ spring init --dependencies=websocket --build=gradle --groupId=com.prototype websocket
Using service at https://start.spring.io
Project extracted to '~/idea/websocket'
Then I download all dependencies using gradle build
$ cd ~/idea/websocket
$ ./gradlew clean build
Download https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-websocket/2.1.0.RELEASE/spring-boot-starter-websocket-2.1.0.RELEASE.pom
Download https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starters/2.1.0.RELEASE/spring-boot-starters-2.1.0.RELEASE.pom
Download https://repo.maven.apache.org/maven2/org/springframework/spring-websocket/5.1.2.RELEASE/spring-websocket-5.1.2.RELEASE.pom
Download https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-web/2.1.0.RELEASE/spring-boot-starter-web-2.1.0.RELEASE.pom
.....
> Task :test
2018-11-03 11:56:46.459 INFO 12650 --- [ Thread-5] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
BUILD SUCCESSFUL in 26s
6 actionable tasks: 5 executed, 1 up-to-date
Read More →
This assumes that Apache httpd is already running on the target Linux machine.
Install mod_sll
and openssl
. mod_ssl provides cryptography for Apache web server using SSL and TLS protocols while openssl is a toolkit that includes certificate management tool and share libraries which gives us various cryptogrpahic algorithms.
We have a legacy IVR (Interactive Voice Response) software running an Asterisk PBX Server. It executes AGI (Asterisk Gateway Interface) compliant protocol to launch external programs written in Python to control telephony channel, play audio, read DTMF (Dual Tone Multi Frequency) digits, etc. We ran into an issue when the payment gateway stopped supporting lower versions of TLS (Transport Layer Security). It requires TLSv1.2 as minimum version.
$ curl -Ivvv https://secure.payment.com
* About to connect() to secure.payment.com port 443
* Trying 185.n.n.n... connected
* Connected to secure.payment.com (185.n.n.n) port 443
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSLv2, Client hello (1):
Unknown SSL protocol error in connection to secure.payment.com:443
* Closing connection #0
curl: (35) Unknown SSL protocol error in connection to secure.payment.com:443
Read More →
We are migrating to MySQL Enterprise from community version. Currently I'm upgrading from 5.7.22 to 8.0.11. It's my bad not reading the upgrade strategy from Oracle themselves so I ended up with some issues.
What I did was uninstall the community version using yum remove
and install the following RPMs. I got them from Oracle website as trial.
We are moving from community to commercial. Sounds posh but if it doesn't, I always like the sound of going to fully supported not partially supported. Honestly, I don't know the extra benefits but here I am trying to install it on my local machine. If you want to try it, you can download the packages from Oracle Software Delivery Cloud. Please read the print since until now, I'm not sure how MySQL Enterprise is going to expire.
Read More →My company laptop comes like a present to me. It has 16GB of RAM and couple of SSDs on it. It's running Windows 10 Home Edition but I don't have issue with that since I'm going to use Linux. I'm originally CentOS but we will use Ubuntu going forward to make it a smooth Linux transition for non-seasoned Linux users.
The only issue I encountered with this laptop while installing Ubuntu is the graphics driver. The laptop has multiple graphics card (Intel and Nvidia) and the Nvidia driver is not supported on Ubuntu being proprietary.
Read More →jvisualvm
is a tool that provides a visual interface for viewing detailed information about Java technology-based applications while they are running. You can his to view data related to your local applications and those running on remote hosts. You can also capture data about JVM software instances and save the data to your local system.
There are couple of ways to use it, one is using jstatd
and the other is by JMX (Java management Extensions). I tried jstatd first but didn't work. The later worked on my CentOS machine using the visualvm I downloaded from visualvm.github.io.
Create a file called jstatd.all.policy
. If in production, make sure your server port are locked down to your local IP.
We were given the opportunity to replace an existing mobile app by a responsive website. Mobile apps are great but since we are paying a monthly subscription to third-party, we are better off building a responsive website supported in all platform. We have iOS and Android version of the app but having it build once then run on different platforms is an added benefit.
For this setup, we need springboot-cli
and ng-cli
. I won't detail how to have them installed but in my setup I used sdkman
for springboot-cli and npm
for ng-cli.
$ spring init --dependencies=web,h2,jpa,actuator,devtools mobile
Using service at https://start.spring.io
Project extracted to '/home/drmanalo/idea/mobile'
Read More →
On my new role, I have found out that we are publishing jars to a private repository. This is to speed up build by telling Maven to get from our private repository first before going out to public. To learn more about Nexus, I'm installing it on my personal laptop running CentOS 7.
$ wget http://download.sonatype.com/nexus/3/latest-unix.tar.gz
$ sudo tar xvf latest-unix.tar.gz -C /opt
$ sudo ln -s /opt/nexus-3.3.1-01/ /opt/nexus
Read More →
Before leaving my current role, I was tasked to migrate existing SVN repositories into git. It is exciting since I never did such thing in the past. Funny enough, I was challenged to install git-all
on one of our unregistered Red Hat box. I'm failing to run this command to make base repository accessible. I can raise a ticket to register the box but I'm worried waiting for resolution would take longer than doing the migration on a different machine.
rhn-channel --add --channel=rhel-x86_64-server-optional-6
Anyways, I have to install git-svn
to my personal laptop and do the migration.
$ sudo yum install git-svn
...
Running transaction
Installing : git-svn-1.8.3.1-6.el7_2.1.x86_64 1/1
Verifying : git-svn-1.8.3.1-6.el7_2.1.x86_64 1/1
Installed:
git-svn.x86_64 0:1.8.3.1-6.el7_2.1
Read More →
Just recently, I was tasked to support Apache Ofbiz (Open for Business) something not very exciting. The application is built on release 4 making Google search less efficient. The current release 16 is not that popular either let alone legacy versions. To have a better understanding of the framework, I'm going to follow this OFBiz Tutorial.
Just like any JVM application, you will need a JDK to run Ofbiz. It's build tool is ant
being Apache. Newer releases has maven
, ivy
and gradle
as build tool.
$ svn co http://svn.apache.org/repos/asf/ofbiz/branches/release15.12 ofbiz.15.12
...
U ofbiz.15.12
Checked out revision 1781334.
Read More →
Angular is one of many open source frameworks for developing web applications. I may have not seen all of them but this is the closest I think to Java and its metadata approach to programming. Another Javascript framework I wanted to use is nodejs but this is more than just a framework or library but a runtime environment if you like.
You will get this with any language you wanted to use, you need to set up its environment. node
and npm
is a must when writing Angular.
$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Fetched 313 kB in 0s (484 kB/s)
## Run `apt-get install nodejs` (as root) to install Node.js v7.x and npm
$ sudo apt-get install nodejs
Fetched 10.9 MB in 2s (4,238 kB/s)
$ node -v
v7.3.0
$ npm -v
3.10.10
Read More →
This is how I implemented "Consuming a SOAP Web Service" from Spring Guides. For the RESTful world, SOAP is dead but it's pretty much alive and Spring is developing features for it. I'm not yet sure why the web service we are integrating to has extra requirements not available in REST but if you're wondering why companies are using SOAP, here is a good REST vs SOAP article.
To get started with SOAP, I have to add this to my existing Spring Boot POM.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
</dependency>
The above Spring Boot starter will add the following dependencies.
Read More →Creating an exception in Java is a very slow operation. Expect that throwing an exception will cost you around 1-5 microseconds. Nearly all this time is spent on filling in the exception thread stack. The deeper the stack trace is, the more time it will take to populate it. If you take a peek on java.lang.Throwable
source, you will see the answer staring into your face.
public Throwable() {
fillInStackTrace();
}
public synchronized Throwable fillInStackTrace() {
if (stackTrace != null ||
backtrace != null /* Out of protocol state */ ) {
fillInStackTrace(0);
stackTrace = UNASSIGNED_STACK;
}
return this;
}
private native Throwable fillInStackTrace(int dummy);
Usually we throw an exception in case of unexpected problems. This means that we don’t use exceptions as part of the the repetitive if-then-else mess.
Read More →Before you are able to tweak your CentOS installation, you will need additional yum repositories.
# yum install epel-release
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
# yum update
Download and extract Super Flat Remix GNOME icons. After extracting, move folder Super Flat Remix
into your ~/.icons
folder.
Download and extract OSX Arc White theme. After extracting, move folder OSX-Arc-White
into your ~/.themes
folder.
I recently switched from ElementaryOS to CentOS. The install process went smoothly despite an initial issue while using a bootable SD card. I cannot detail the issue here but Google suggested using a DVD rather than SD card or any USB drive. Everything are working perfectly except I cannot go back to my Windows. It's embarassing to admit that we are using Windows for our open-source development but this is the reality. So when I'm away from work and testing things out, I'm rebooting to my CentOS and switch to Windows when I'm at work.
This is not grub2 specific issue by the way, grub2 should be able to add the loader but it has no knowledge of how to read ntfs partitions. The solution is install ntfs-3g
and rebuild grub2 after.
$ yum info ntfs-3g
Installed Packages
Name : ntfs-3g
Arch : x86_64
Epoch : 2
Version : 2016.2.22
Release : 1.el7
Size : 659 k
Repo : installed
From repo : epel
Summary : Linux NTFS userspace driver
Read More →
We are moving to enterprise Linux from Ubuntu to Red Hat, finally a dream come true for me being able to have some enterprise nix
experience. To prepare myself, I removed my ElementaryOS and installed CentOS. If I have enough cash I'll probably get one of those Linux Developer Suite.
As an exercise, I'm installing Java 1.8 and hopefully install more dockers
to my CentOS in the near future. A quick Google took me to techadmin's blog.
$ cd /opt/
$ wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz"
$ tar xzf jdk-8u91-linux-x64.tar.gz
Read More →
This is a backup of my .bashrc
. I'm keeping it safe in case I'm rebuilding my machine.
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
# THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/home/kodi/.sdkman"
[[ -s "/home/kodi/.sdkman/bin/sdkman-init.sh" ]] && source "/home/kodi/.sdkman/bin/sdkman-init.sh"
# Strong red prompt
export PS1="\[$(tput setaf 1)\]\[$(tput bold)\][\u@\h \W]\\$ \[$(tput sgr0)\]"
Read More →
I have an existing Octopress blog which is probably near its useful days. Octopress which is Jekyll underneath the covers, is still one of the best static site generator. It has more community support and more written plugins. If I'm a Ruby guy, I will certainly stick with Octopress or Jekyll. But I'm not, being a Java developer. One of the biggest reason why I'm switching to jbake
is being able to run it on JVM. JBake is not as mature as Jekyll, it's Github inception was 17th of July 2012.
We are writing a new application and the team agreed to use JSP as view technology with Freemarker for email templates. To type less on our views, I decided to write custom JSP tags.
There are two approaches in making your custom JSP tag. One is by using a Java class extending one of the classes inside javax.servlet.jsp.tagext
and then writing your tld
Tag Library Descriptor which calls the class and defines other attributes needed by the custom tag. This is the neat way if you're a Java purist but harder to test since you need a mock servlet implementation with mock JSP writer to do your assertions.
The other approach is by writing a tag file that goes to WEB-INF/tags
folder by convention. The tag file is nothing but JSP code fragments with declared attributes of the required parameters for the tag to be able to perform its sole purpose. This is well-documented here JSP Tags 5.
My previous post is all about writing a simple Groovy CRUD application. It includes writing your views in Groovy as well though it doesn't involve where to put the files. But if you're a seasoned Java developer, you should know your way out.
What it lacks is how to test your Groovy classes which I'm about to document on this post.
This is a workaround assuming your Spring Boot application bootstraps more @Configuration
and you don't want to include them in your integration tests.
import org.junit.Test
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.test.context.ActiveProfiles
/**
* For integration tests
*/
@ActiveProfiles("dev")
@SpringBootApplication
class FakeLoader {
}
Read More →
I've been using Redmine as help desk and bug tracker since it has all the features/plugins you could ask for for a help desk or a bug tracker. But tracking bugs and issues has changed lately. When fixing bugs, you need to put in your estimate so you will have a pretty good idea how much effort you are putting into it. This is probably one of the reasons why RedmineCRM premium plugins exists. The lack of planning tools in RedmineCRM pushed me further to use Acunote. This is hosted online and free for a team of 5 users but 5 is very
limiting. Acunote also lacks the tooling support you will get from Jira, FogBugz and the likes.
Since I don't need enterprise solution at the moment so I'll give YouTrack a try. It's free for the first 10 users so I actually doubled what Acunote is offering for free. As with Jira, FogBugz or Acunote, it has hosted solution too.
$ wget https://download.jetbrains.com/charisma/youtrack-6.0.12634.jar
HTTP request sent, awaiting response... 200 OK
Length: 111007822 (106M) [binary/octet-stream]
Saving to: ‘youtrack-6.0.12634.jar’
100%[======================================>] 111,007,822 4.93MB/s in 26s
Read More →
Recently, I've been looking for a Jenkins alternative and the closest I found is TeamCity. It's not free as in free speech compared to Jenkins but the twenty build configs and three build agents is more than enough for my small projects.
TeamCity promised to work out-of-the-box just like Jenkins does so I'll give it a go. It's using Tomcat by default so I'm expecting a flat learning curve here.
Read More →I was trying to mount a GPT NTFS drive and get Error mounting /dev/sdb1 at /media/drmanalo/DATA: Command-line mount -t "ntfs" -o
Windows 8 is using hibernation mode which writes RAM contents to the hard drive before powering off to be able to restore to the same state as it was before shutdown.
$ sudo ntfsfix /dev/sdb1
Mounting volume... The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
FAILED
Attempting to correct errors...
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sdb1 was processed successfully.
Read More →
Personal Package Archive is a collection of software not included in Ubuntu repositories by default. Typically these repositories focus on a single program, but they can include more depending on the person maintaining them. With PPAs, Ubuntu users can have access to bleeding-edge software without waiting for the next official release if ever the PPA made it to the official repository.
Here are my top PPAs...
$ sudo add-apt-repository ppa:team-xbmc/ppa
$ sudo apt-get update
$ sudo apt-get install kodi
Read More →
After testing elementary OS using VirtualBox, I am finally installing it to my desktop. Not that I don't like CentOS anymore but it will help me on my job to totally embrace Ubuntu.
Read More →There is a book of exactly the same title from manning.com. I don't have it yet but father Christmas will put it underneath my tree this Christmas.
What I do have is Spring Boot in Action which covers mixing Java with Groovy. This is what this post is all about. I am going to create a Spring Boot project but will primarily use groovy
.
$ mkdir paluwagan
$ cd paluwagan
$ mkdir static
$ spring init --dependencies web,h2,data-jpa,jdbc,groovy-templates --build gradle --packaging jar --extract
Using service at https://start.spring.io
Project extracted to '/home/drmanalo/workspace/paluwagan'
Read More →
firewalld provides a dynamically managed firewall with support for network/firewall zones to define the trust level of network connections or interfaces. It has support for IPv4, IPv6 firewall settings and for ethernet bridges and has a separation of runtime and permanent configuration options. It also supports an interface for services or applications to add firewall rules directly.
The two important concepts of firewalld is zones and services.
A zone defines the trust level of the interface used for a connection. There are several pre-defined zones provided by firewalld.zone.
A service can be a list of local ports and destinations and additionally also a list of firewall helper modules automatically loaded if a service is enabled. Service configuration options and generic information about services are described in firewalld.service. The use of predefined services makes it easier for the user to enable and disable access to a service.
$ firewall-cmd --get-zones
block dmz drop external home internal public trusted work
In order from least trusted to most trusted, the pre-defined zones within firewalld are:
Read More →Spring Boot is an exciting new way to develop Spring applications with minimal friction from the framework itself. Auto-configuration eliminates much of the boilerplate configuration that infests traditional Spring applications. Spring Boot starters enable you to specify build dependencies by what they offer rather than explicit library names and version. The Spring Boot CLI takes Spring Boot’s frictionless development model to a whole new level by enabling quick and easy development with Groovy from the command line. Finally, the Actuator lets you look inside your running application to see what and how Spring Boot has done.
Above is an excerpt from Craig Walls' Spring Boot in Action which perfectly describe my feelings with the traditional Spring configuration and how Spring Boot modernise it.
My favourite part of Spring Boot is its CLI so I'll try creating a new project using CLI.
Read More →Jenkins is an opensource and probably the most popular continuous integration tool in the Java community. There are many plugins out there available to make your coding life easier. It supports almost all version control systems and can run all your Maven or Ant tasks.
To install and configure Jenkins on CentOS, we have to first make sure that Java is installed on your machine. If not, please refer to this post from if-not-true-then-false.com
$ sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
Resolving pkg.jenkins-ci.org (pkg.jenkins-ci.org)... 199.193.196.24
Connecting to pkg.jenkins-ci.org (pkg.jenkins-ci.org)|199.193.196.24|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 75 [text/plain]
Saving to: ‘/etc/yum.repos.d/jenkins.repo’
$ sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
Read More →
Android system update is like pushed notifications where you cannot opt out. Rooted device actually can but I'm not rooting my device again since I had a bad experience with it. I kept ignoring this update but I woke up one morning in Android 5.0.2. This update is not compatible with my device as this drives it to the bend hence the reason I want to downgrade.
$ apt-cache search android-tools
android-tools-fsutils - Android ext4 utilities with sparse support
android-tools-adb - Android Debug Bridge CLI tool
android-tools-adbd - Android Debug Bridge Phone Daemon
android-tools-fastboot - Android Fastboot protocol CLI tool
You can only install android-tools-adb
for this purpose.
I installed JBoss Application Server 7 but it won't start on my Ubuntu machine. If I will run $JBOSS_HOME/bin/standalone.sh
,
here's how far I can get.
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/jboss7
JAVA: java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m
-Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
-Djboss.server.default.config=standalone.xml
=========================================================================
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
23:41:04,456 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
23:41:05,336 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
23:41:05,525 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
A bit of Googling suggested it is a Java 8 related issue and shouldn't happen if I'm going to downgrade to Java 7. Stackoverflow did suggest I can use Wildfly 8 for my latest version of Java.
Read More →Express Editions of Oracle are in rpm (Red Hat Package Manager). But since I turned away from my CentOS, I have to install it on Ubuntu using the hard way I suppose.
For the installation of Oracle 11g R2 Express Edition (XE), a couple of additional Linux packages are required. These packages can be installed using apt (goodbye yum).
$ sudo apt-get install alien libaio1 unixodbc
Download the Oracle 11g R2 Express Edition from the Oracle website. Make sure you select the Linux x64 version from Oracle website. Unzip the file after downloading.
$ unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
Read More →
I copied this startup script from liferay. You can use this script start and stop your tomcat instance just like any CentOS standard services.
Read More →vim is a versatile and powerful text editor for command-line environments. In *nix world, it would be very difficult to survive if you cannot edit files/configs without using vi. It was first dubbed as Vi iMitation but was later relabeled Vi IMproved. It is free and open source software and is released under a license that includes some charityware clauses. To pimp your vim, you will need to create a file called .vimrc
under your home folder.
set nocompatible
syntax on
set mouse=a
set showmatch
set autoindent
set smartindent
set backspace=2
set tabstop=4
set number
set smarttab
set shiftwidth=4
colorscheme torte
Read More →
This is a simple Ant build script I'm using for my Symfony2 blog. This has the following dependencies:
Read More →$ grails create-app qotd
| Application created at /home/drmanalo/intellij/qotd
$ cd qotd
$ grails run-app
> Configuring > 0/1 projects > root project > Resolving dependencies ':classpath1/1 projects > Resolving dependencies ':agent' > Resolving dependencies ':versio:compileJava UP-TO-DATE
> Building 16% > :compileGroovy > Resolving dependencies ':compile' > Resolving :compileGroovy
Download https://repo.grails.org/grails/core/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
> Building 16% > :compileGroovy > Resolving dependencies 'detachedConfiguration4:processResources
:classes
:findMainClass
> Building 83% > :bootRun > Resolving dependencies ':runtime' > Resolving depend:bootRun
Download https://repo.grails.org/grails/core/commons-io/commons-io/2.2/commons-io-2.2.jar
Grails application running at http://localhost:8080
Read More →
From my Java best practices training, my instructor gave us an example of the factory pattern using Shape object with draw() method. The Shape interface is further implemented by a base class called ShapeFactory which decides what kind of shape it is going to create using some business intelligence you put into the factory.
The example is spot on but I found another good example from our hands-on exercise which I'm about to share. Not just because I'm a Star Wars fan but the way factory is being used.
package com.robots;
import java.awt.Color;
import java.awt.Point;
import java.util.List;
import com.robots.parts.Part;
public interface Robot {
void move(int distance, Direction direction);
List<Part> getParts();
String getName();
Point getXY();
void setXY(Point p);
double dist(Robot r2);
Color getColor();
int getSerial();
}
Read More →
Observer Pattern has been around Java since version JDK 1.0. One of the nice thing about having it inside the language is you only have to subclass it and just worry about its implementation logic.
Here are the key benefits of the observer pattern.
Observer
nor Observable
know class type of the otherObservable
can communicate with any Observer
Observer
can register for state change events on any Observable
Observable
indirectly broadcasts to all registered Observers
This is from one of our exercises which is a card game called Tehi. This is not the complete program but what it shows here is how are you going to use the observer pattern. First you will notice CardDeck extends Observable
and the abstract CardViewer implements Observer
. The concrete classes FutureCardsViewer and PastCardViewers then has update method which is the glue that attached them to the Observable
.
I took this from my Java best practices notes training. This is a verbatim of the switches I used as part of our exercises.
In many cases an application can meet performance goals with the default garbage collector. For sufficiently large applications that scale to large numbers of threads, processors, sockets, or a large amount of memory choosing an appropriate garbage collector will make a difference.
-XX:+UseSerialGC
-XX:+UseParNewGC -XX:+UseConcMarkSweepGC
-XX:+UseG1GC
-XX:+AggressiveHeap
-XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseAdaptiveSizePolicy
-XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseAdaptiveSizePolicy -XX:GCTimeRatio=9
-XX:+UseG1GC -Xmx30m
-XX:+UseSerialGC -Xmx30m
Read More →
Here is a simple batch script to backup my project folder every 18:30. I wish I could run this in cron but my development machine is running Windows.
@SETLOCAL
@ECHO OFF
@REM ----- begin backup ------------------------------------------------
@REM path is handled by mklink done initially
@REM SET reads whitespaces too!
SET file=workspace.7z
SET source=C:\Users\dhonnee.manalo\git\workspace\
@REM ----- 7za merges with old archive
@REM ----- workaround is to delete first
7za a -t7z %file% %source%
ECHO Compression finished!
@REM ----- end backup --------------------------------------------------
@REM ----- copy to x:drive ---------------------------------------------
SET destination=\\remote_server\dev\dhon.manalo\workspace\
copy %file% %destination% /Y
ECHO Backup finished!
@REM ------- END backup.bat ------------------
Read More →
I bought the Web Designer Issue 233 being interested with jQuery effects but it turned out that I will find something far more interesting. I found a gem inside the magazine, it was a ruby! This issue discussed how to start learning rails. As rails website define it, Ruby on Rails® is an open-source web framework that’s optimised for programmer happiness and sustainable productivity. It lets you write beautiful code by favouring convention over configuration.
To be able to setup rails, we need to setup the dependencies first. The first requirement is ruby of course.
$ apt-add-repository ppa:brightbox/ruby-ng
$ apt-get update
$ apt-get install ruby2.2
$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux-gnu]
Read More →
I was trying to improve an existing Spring project to be able to inject Hibernate's SessionFactory but get confused where to put my Hibernate XML configuration. I initially put it within <context-param/>
but was surprised Spring is not creating my sessionFactory bean. Then I tried it under <init-param/>
but the result is the same, there's no sessionFactory bean. I tried putting my Hibernate configuration on both locations and it worked. I still don't understand why hence I asked my friend Google.
I found this post from Late Night Developer which helped me understand why there are two places for my custom XML configurations.
Read More →The most important thing to understand is that there are 2 layers of application contexts, and they each have default XML files to load beans from.
Spring Security 3.0 introduced the ability to use Spring EL expressions as an authorisation mechanism. Expression-based access control is built on the same architecture but allows complicated boolean logic to be encapsulated in a single expression. This comes handy when you want to secure a Controller method or even the entire Controller. JSP has native support for this feature using
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
FreeMarker don't so you need to do more than just importing a tag library.
Read More →I was using FreeMarker with my previous project as my email templating engine but for now I'm using it for all my views. I will show here the macros that bind a Spring form.
One might wonder why I'm leaving JSP but the whole truth is I'm typing less with FreeMarker. I read this post from stackhunter.com and among the 10 reasons mentioned I like these:
Just saw this issue while concatenating fields in Oracle.
SELECT LISTAGG(column_name, ', ') WITHIN GROUP (ORDER BY column_name) alias FROM table_name;
ORA-01489: result of string concatenation is too long
01489. 00000 - "result of string concatenation is too long"
*Cause: String concatenation result is more than the maximum size.
*Action: Make sure that the result is less than the maximum size.
SELECT RTRIM(XMLAGG(XMLELEMENT(e, column_name, ',').EXTRACT('//text()') ORDER BY column_name).GETCLOBVAL(), ',') alias FROM table_name;
Read More →
Redmine is a flexible project management web application written using Ruby on Rails framework.
To install redmine, you have to check if you have ruby
installed. To install ruby with ease, use RVM
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ curl -sSL https://get.rvm.io | bash -s stable
$ source ~/.rvm/scripts/rvm
$ rvm install ruby 2.3.1
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Read More →
I installed Centos7 as minimal for a basic LAMP server but then I decided to switch to Gnome instead of pure command line environment. If you're interested how I did it, groupinstall has the perfect recipe.
$ yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
Read More →
Oracle JDBC is not available from Maven's online repository therefore you have to download it from the Oracle website and add the JAR to your local Maven repository. I will not detail how and where to download it but the last time I checked it, it requires login to Oracle website.
After downloading the JAR, you have to open your console and issue mvn install:install-file
. Please refer below for the complete syntax. -Dfile requires fullpath.
After I prototyped a Spring standalone application with a deployment-friendly runnable jar, I want to prototype another Spring standalone application with added complexity, Hibernate persistence I mean. I'm going to use H2 to avoid 3rd party database dependency.
Just like my previous post, I'm going to use maven-archetype-generate
and will add Spring dependencies later on.
$ mvn archetype:generate -DgroupId=com.manalo.prototype -DartifactId=persistence -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom
[INFO]
[INFO] maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.manalo.prototype
[INFO] Parameter: packageName, Value: com.manalo.prototype
[INFO] Parameter: package, Value: com.manalo.prototype
[INFO] Parameter: artifactId, Value: persistence
[INFO] Parameter: basedir, Value: /home/drmanalo/workspace
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: /home/drmanalo/workspace/persistence
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 52.401s
[INFO] Finished at: Thu Sep 04 23:17:16 BST 2014
[INFO] Final Memory: 14M/150M
[INFO] ------------------------------------------------------------------------
Read More →
Creating a Spring standalone application is a challenge to me without using Spring Boot. I used to have web.xml
to bootstrap my application but being standalone left me thinking which XML or configuration file will bootstrap it.
I'm prototyping maven-archetype-generate
and will add Spring dependencies later on hoping I will achieve my goal.
$ mvn archetype:generate -DgroupId=com.manalo.rabbitmq -DartifactId=rabbitmq -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom
[INFO]
[INFO] maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.manalo.rabbitmq
[INFO] Parameter: packageName, Value: com.manalo.rabbitmq
[INFO] Parameter: package, Value: com.manalo.rabbitmq
[INFO] Parameter: artifactId, Value: rabbitmq
[INFO] Parameter: basedir, Value: /home/drmanalo/workspace
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: /home/drmanalo/workspace/rabbitmq
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:54.171s
[INFO] Finished at: Wed Aug 26 19:34:57 BST 2014
[INFO] Final Memory: 14M/150M
[INFO] ------------------------------------------------------------------------
Read More →
Cisco ASA includes a very nice debugging feature called packet-tracer
. You can inject and trace a packet as it travels through different phases and quickly determine whether or not the packet will pass through. I'm using this quite often to verify traffic passing through ACL rules, NAT rules and VPN but its uses is not limited to these.
packet-tracer input <source interface> <protocol> <source IP> <source port> <destination IP> <destination port> [detailed]
Read More →
I'm putting here my working VPN configuration for ASA 5505 on ASA Version 8.4(7). All upper case values need changing to suit your business requirements and personal taste. IP addresses are mere examples.
object network OBJ_REMOTE_VPN_ENDPOINT
subnet 172.16.0.0 255.240.0.0
description OBJ_REMOTE_VPN_ENDPOINT is a label
object network OBJ_INSIDE_SERVER1
host 10.100.100.131
description OBJ_INSIDE_SERVER1 is a label
object network OBJ_INSIDE_HOST1
host 10.100.100.190
description OBJ_INSIDE_HOST1 is a label
object network OBJ_NATTED_INSIDE_HOST1
host 10.0.7.190
description OBJ_NATTED_INSIDE_HOST1 is a label
Read More →
This Cisco dialup VPN configuration worked for ASA 5505 running on version 8.4(7). All upper case letters are labels and should be changed according to your standards and taste. IP addresses are representational.
object network OBJ_VPN_ENDPOINT1
subnet 10.175.0.0 255.255.128.0
description OBJ_VPN_ENDPOINT1 is a label
ip local pool VPN_DHCP_POOL1 10.0.20.10-10.0.20.14
Read More →
This is my working Cisco dialup configuration. IP addresses and wildcard masks are fictitious.
Read More →When enabling Cisco router's http server, it automatically generates a self-signed certificate which is good but when you decided to turn off the http server, it will then leave a self-signed certificate making running-config a bit messy. Here are the steps to remove the self-signed certificated if it's no longer needed.
Read More →