Tuesday, November 3, 2015

NCITE 2015 Experience

This year's NCITE was held at Angeles Foundation University. There were four of us who attended the conference. Three papers from ICS were accepted for oral presentation. The acceptance rate was 22%!

There were several notable presentations in the conference. One is the presentation of Dr. Sioson of ADNU on the state of NCITE since its beginning 13 years ago. Another is the presentation of the new CHED guidelines for BSCS, BSIT, BSIS degree offerings.

James' paper won the Best Paper Award for the conference.



Monday, August 10, 2015

My dissertation writing workflow

Writing is difficult. Establishing a writing workflow can help you focus. The picture below shows my screen during dissertation writing sessions. My word processor is LibreOffice. In order to comply with the formatting requirements from the UPLB Graduate School, I created custom styles for the different sections of the document. I also created a separate document file for each section. This allows me to work independently on each section. All sections are consolidated in a single master document from which the PDF file is generated. In order to keep track of the changes, I use the Git version control system. Also, Zotero is open in Firefox for reviewing related work. The Zotero LibreOffice plugin allows me to insert citations and bibliographic entries directly from my Zotero library. Note: what works for me may not work for you. 

The template is free to download.


 

Workflow:
  1. Open the master document.
  2. Choose section to work on from the master document navigator. The corresponding document is loaded.
  3. Write.Cite.Edit.Save.
  4. Repeat 3 until there is something to write.
  5. Close section document.
  6. Go back to master document and update selection and indices.
  7. Save the master document.
  8. Generate a PDF.
  9. git commit, git push
  10. Choose another section to work on if desired.
  11. Repeat 2-10 until writing time is over.


Sunday, July 5, 2015

Estimating a MaxClients/MaxRequestWorkers base value for your MPM Prefork Apache configuration

The script below will generate a base value that you can use for MaxClient/MaxRequestWorkers in your mpm_prefork Apache configuration. The value guarantees that no disk swapping, which slows down the system, will not occur because there is enough memory for the Apache processes. Remember that this is just a base value, you can increase this number if you observe that there is still available memory. The script was tested in Ubuntu 14.04.

#!/bin/bash
#email jachermocilla@gmail.com

echo -n "Enter percent of free memory to use for Apache(1-100): "
read PERCENT_OF_FREE_FOR_APACHE

#restart apache
service apache2 restart > /dev/null

#PERCENT_FREE_FOR_APACHE=75
echo "Percent of free memory to allocate to apache(%): $PERCENT_OF_FREE_FOR_APACHE"

#MEM_TOTAL=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
#echo "Total system memory (kB): $MEM_TOTAL"

MEM_SINGLE_APACHE=`ps -o pid -C apache2 | tail -1 | xargs pmap -x | grep  total | awk '{print $4}'`
echo "Estimated memory used by a single Apache process (kB): $MEM_SINGLE_APACHE"

echo "Estimating free memory without Apache..please wait"
service apache2 stop > /dev/null
sleep 20
MEM_FREE_NO_APACHE=`free | grep buffers/cache | awk '{print $4'}`
service apache2 start > /dev/null
echo "Free memory without Apache: $MEM_FREE_NO_APACHE"


MEM_FREE_FOR_APACHE=`echo "scale=2;($PERCENT_OF_FREE_FOR_APACHE/100.0)*$MEM_FREE_NO_APACHE" | bc`
echo "Estimated free memory usable by Apache (kB): $MEM_FREE_FOR_APACHE"

#some constants
MAGIC=2.5

MAX_CLIENTS=`echo "scale=0;($MEM_FREE_FOR_APACHE/($MEM_SINGLE_APACHE))*$MAGIC" | bc`
echo "Recommended MaxClients/MaxRequestWorkers: $MAX_CLIENTS"




Sunday, June 21, 2015

To individuals interested to be an Instructor at ICS

or What I wish I knew when I applied as Instructor at ICS..

  • The pay is not high. It is just enough if you are only supporting yourself and you enjoy a low cost of living.
  • You should have the intention and commitment to complete a graduate degree in CS. It is a total waste of time if you do not have any plan to complete one. You'd be better off in the industry, earning more experience and money.
  • Finish your graduate studies in 3-4 years, not too early and not too late. This must be your ultimate goal. Your academic career officially starts after completing the MS degree. If you finish too early, you will lack some skills in research(hilaw). If you finish late, like me, it will be difficult to get promoted(bulok). If you are not yet finished in 6 years, leave. There is the Up-or-Out rule. Also remember that you alone (not your adviser or others) is responsible for finishing your degree. Start thinking about your thesis from day one.
  • You need to a have a passion for learning, not necessarily teaching. Teaching can be learned along the way especially if you have lots of knowledge to share to your students. You will be able to explain things clearly if you are continuously learning about your field. It is a fact that in UP research is rewarded more than teaching.
  • Understand and blend in the culture of ICS, CAS, UPLB, and UP. The faculty and staff are generally supportive, kind, and friendly. Better not to piss them off. Follow the rules and observe due dates. Get to know the person who handles what. Later in your career you will probably become an administrator so better learn about ICS culture and processes now. Carefully navigate the politics that exists. Know the meaning of collegiality and academic freedom.
  • Teach the subjects you hate. While a student, you probably hated courses such as CMSC 125 and CMSC 137 (haha!) but loved CMSC 11 or CMSC 123. Teaching the subjects you hate will be a challenge but will be rewarding. It will force you to study, thus develop research skills. It will also enhance your interpersonal skills since you will need to ask for help from the more senior faculty members (mentoring).
  • Write. Create handouts, tutorials, essays, guides, blogs, articles. Write  anything that comes out of your silly little head. If you are serious about working in the academe, writing is a very important skill. Even now, I am still struggling in this area.
  • Code. Being an instructor does not excuse you from writing complete programs or systems. You may be writing some sample codes for your class but that is not enough. Scrap the "Those who can, do. Those who can't, teach." mentality. Create your own hobby programming projects. You might complain of not having time for such projects. That's b.s.! Industry people I know who really work from 8 to 5 can still do projects on the side. Also, if you plan to leave teaching, then at least you are still marketable as a dev.
  • Minimize committee work. Join at most two committees, specifically college-level committees. Joining college-level committees will introduce you to some senior administrators who might influence your tenure application later. 
  • Don't play too much computer games. I wasted a few years being addicted to MU Online, an MMORPG. Those years could have been used to finish my thesis or to exercise. I do miss Samson, my very powerful wizard.
  • Don't please students. Your job is to make sure that when your students graduate, they can solve any computing problem presented to them by their employers. They should be able to provide technical and computational solutions, not wishy-washy small talks. I know this can be difficult to accomplish, but simply put, that is your job. Giving them too much "consideration" is totally wrong. Give challenging exercises and exams but be fair. Students will hate you for now but they will thank you later. Don't worry too much about student evaluations (if you are doing your job well), worry more about peer evaluations.
  • Don't mix personal, social, and spiritual lives with work. Mixing them can cause conflicts. This is difficult to do but it must be done or all will suffer unless they are managed properly.
  • Don't be selfish. Share what you have and what you know. However, don't let the system abuse you.
  • Find senior faculty to idolize. If you can ask that faculty to mentor you, much better. Study how he/she thinks, how he/she solves problems, how he operates. Be like him/her or be better than him/her. I have three idols in the institute (Sir Eli, Sir Jimmy, and Sir Freddy when he was still in ICS).
  • Improvise. You must find ways to do what you need to do despite limited resources. This is UP, resources are scarce here, but it still manages to be the top school in the country. Now you know one reason why.


(DISCLAIMER: The items above do not refelect the views of my employer. They are entirely my own and mostly based from experience.) 

Tuesday, May 19, 2015

Resize qemu (.qcow2) images

Scenario:  You have a working VM (qemu) which is running out of disk space. You need to add more space without destroying its current contents.

The following steps will let you accomplish the task.
  1. Backup the image first.
  2. Check if it is in qcow2 format:
    file winxp.qcow2
  3. Boot the image and take note of the current sizes of the entire disk (use fdisk command) and partitions (use df command).
  4. Resize the image (for example add 10GB of unallocated space):
    qemu-img resize winxp.qcow2 +10GB
  5. Run qemu to boot the gparted[1] live cd:
    qemu-system-i386 -hda winxp.qcow2 -cdrom gparted-live.iso -boot d
  6. From within gparted live resize the nearly full partition to "eat" the unallocated space we added (10 GB). Apply the changes. You may need to move partitions especially if you have many. Exit from gparted live.
  7. Boot the image and check if the changes have been reflected. Again use df and fdisk commands.
[1] http://gparted.org/livecd.php

Thursday, May 14, 2015

Speed up VM startup in OpenStack Juno

By default Nova deletes unused images in compute nodes after 24 hours. If you start an instance in which the image is no longer in the compute node, a transfer of the image from Glance is performed which increases the instance start up time. To override this, simply add the following line in the default section of nova.conf and restart the nova-compute service. The line will disable the removal of unused images from the compute nodes.
remove_unused_base_images = False

Wednesday, April 15, 2015

How to use a proxy for common applications

Global environment
Set the HTTP_PROXY environment variable
export HTTP_PROXY=http://username:password@proxy.server:port/  
apt
Create the file /etc/apt/apt.conf.d/43proxy and place the line below (be sure to provide the appropriate proxy information):
Acquire::http::Proxy "http://username:password@proxy.server:port/";
wget
Set the proxy settings in /etc/wgetrc

http_proxy=http://server_ip:port

git
Use the command below:
git config --global http.proxy http://username:password@proxy.server:port/

Monday, April 13, 2015

SSH without user-known hosts checking

If the IP address of the host you are connecting to frequently changes, as in the case of cloud instances, but you are sure that that you are connecting to the correct host, you can use the following ssh command to disable known host checking (Note: This may lead to MITM attacks).
ssh -o UserKnownHostsFile=/dev/null user@10.0.3.x 

Monday, February 23, 2015

A formula for computing your hourly rate as a consultant


Let S be your regular monthly salary and your work is forty hours per week, then your hourly rate HR can be computed as:

   HR = 2.5 x (S / 160)

For example, if your salary is 12,000.00 PhP, your hourly rate is

   HR
= 2.5 x (14,000.00 / 160)
      = 218.75 PhP


Now, let's say you have a website development project that you estimate will take one month (at 160 hours per month), you can charge your client 35,000.00 PhP.

Tuesday, January 6, 2015

OpenLDAP+Apache

I decided to create an OpenLDAP server[1] for my research group to serve as the central storage for member information (POSIX generic account). This server will be used to authenticate users when they access certain services that should be available to group members only. The group's wiki seems like a good candidate to test the setup.
First, enable LDAP related apache modules.
sudo a2enmod ldap authnz-ldap
Next, edit /etc/apache2/apache2.conf to add the following:
<directory>
        AuthType Basic
        AuthName "This site is for SRG members only. Please use your SRG NetId credentials to access this site."
        AuthBasicProvider ldap
        #AuthzLDAPAuthoritative on
        AuthLDAPURL "ldap://[your ldap server ip addess]:389/dc=srg,dc=ics,dc=uplb,dc=edu,dc=ph?uid"
        AuthLDAPBindDN "cn=admin,dc=srg,dc=ics,dc=uplb,dc=edu,dc=ph"
        AuthLDAPBindPassword [your admin password]
        Require valid-user
</directory>
Finally, restart apache.
sudo service restart apache2

Sunday, January 4, 2015

Remove unused kernel images/headers in Ubuntu

The command below removes the image and associated headers of the kernel not currently running. This allows us to reclaim disk space in /boot (especially when created as a separate partition). The kernel version currently running (usually the latest) can be viewed using the command uname -r.

To be sure, upgrade the system first.
sudo apt-get -y update
sudo apt-get -y upgrade
sudo reboot
uname -r

Then remove the old kernel images and headers.
echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -n | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge