Feb 12, 2016

Sentiment Analysis LOL

Try Sentiment Analysis from Achemy

from alchemyapi import AlchemyAPI

alchemyapi = AlchemyAPI()

options = {}
options['knowledgeGraph'] = '1'
response = alchemyapi.faceTagging("image", "/home/hieult/Downloads/hieult3.jpg", options)

print response

Dec 20, 2015

C array

True

#include

int main() {
   char a[20];
   a[3] = 'x';
   4[a] = 'y';
   printf("a[3] = %c\n", a[3]);
   printf("a[4] = %c\n", a[4]); 
   return 0;

}

Feb 26, 2014

Rendering issue with Firefox 27.0.1

If you have issue with rendering on Firefox 27.0.1, go to about:config and change "layers.acceleration.disabled" to true to turn off acceleration.

Dec 15, 2013

NFS server on Mac OS

  1. Edit /etc/exports: sudo vi /etc/exports Add a line like the following (presuming your home network is using the 192.168 private network. You could also use 172.17 or 10.):
    /Users -network 192.168.0.0 -mask 255.255.0.0

  2. Enable nfsd: sudo nfsd enable

  3. Test your work: showmount -e

Nov 8, 2013

JIRA listener script to add assignee into Summary field

A little script to help the life better. This script is a Listener which update the summary of JIRA issue to add assignee info. I'm using JIRA Agile and its board doesn't show the assignee name so I create this script to display it in the summary field.

Code as following, save it with .groovy extension and then put it into atlassian-jira/WEB-INF/classes/com/xxx/listeners and then configure JIRA to use com.xxx.listeners.UpdateAssigneeSummaryListener as class

import com.atlassian.jira.event.issue.AbstractIssueEventListener;
import com.atlassian.jira.event.issue.IssueEvent;
import org.apache.log4j.Category;
import com.atlassian.jira.event.type.EventType;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.user.util.UserManager;
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.component.ComponentAccessor;

class UpdateAssigneeSummaryListener extends AbstractIssueEventListener {
    Category log = Category.getInstance(UpdateAssigneeSummaryListener.class)

    @Override
    void workflowEvent(IssueEvent event) {
        Issue issue = event.getIssue();
        Long eventTypeId = event.getEventTypeId();
        if ((eventTypeId.equals(EventType.ISSUE_ASSIGNED_ID) || eventTypeId.equals(EventType.ISSUE_CREATED_ID)) && issue.getResolutionDate() == null)
        {
            def test = (issue.getSummary() =~ /^\[([A-Za-z]+)\]/)
            def summary
            def assignee = issue.getAssigneeId()
            if (test.getCount() != 0)
            {
                // Replace the user in bracket.
                summary = (issue.getSummary() =~ /\[([A-Za-z]+)\]/).replaceFirst("[${assignee}]")
            }
            else
            {
                summary = "[${assignee}] ${issue.getSummary()}"
            }

            MutableIssue mutableIssue = (MutableIssue)issue;
            mutableIssue.setSummary(summary);
            IssueManager issueManager = ComponentAccessor.getIssueManager();
            UserManager userManager = ComponentAccessor.getUserManager();
            issueManager.updateIssue(event.getUser(), mutableIssue, EventDispatchOption.DO_NOT_DISPATCH, false)
        }
    }
}

Oct 22, 2013

Should we move to KVM?

The virtualization wars between VMWare and KVM is not over. KVM is recently adapted by many companies such as IBM,.

Should we migrate to KVM? It's free/low cost than VMWare but show better results than VMWare...Hmmm....

http://openvirtualizationalliance.org/blog
ftp://public.dhe.ibm.com/linux/pdfs/Clabby_Analytics_-_VMware_v_KVM.pdf
http://www.scalecomputing.com/files/documentation/whitepaper-vmware-vs-scale-computing.pdf