Thursday, April 21, 2016

Tell Git to Ignore File Changes

git update-index --assume-unchanged doc.asciidoc
git ls-files -v | grep '^[hsmrck?]' | cut -c 3-
git update-index --no-assume-unchanged doc.asciidoc

Clean Working Directory with Git

git reset --hard
git clean -xdf

Note: reset all files to their last-committed state and remove all uncommitted files

Tuesday, April 12, 2016

Monday, April 11, 2016

TIL: Oracle BPEL Process Manager

BPEL is the standard for assembling a set of discrete services into an end-to-end process flow, radically reducing the cost and complexity of process integration initiatives. Oracle BPEL Process Manager offers a comprehensive and easy-to-use infrastructure for creating, deploying and managing BPEL business processes.

Thursday, March 31, 2016

Push to GitHub from Visual Studio Code

git config --global credential.helper wincred
git push

Monday, March 28, 2016

Windows wireless service is not running on this computer in Windows 10

Run the following commands in the command prompt as Administrator to fix the issue in Windows 10. A system restart will be required.

netsh winsock reset catalog
netsh int ip reset reset.log hit

Sunday, March 27, 2016

BindingResult result follows validated object

BindingResult result has to follow the object show that it binds to properly validate the inputs. Otherwise, you'll get an exception similar to "field error in object on field rejected value codes".

@RequestMapping(value={"/addnewshow", "/editshow"}, method=RequestMethod.POST)
public String processShow(@Valid @ModelAttribute("show") Show show, BindingResult result,
@RequestParam(value="showid", required=false) Long showId)
return "myapp.editshow";
show =;
return "redirect:editshow.html?showid=" + show.getId();

Thursday, March 24, 2016

Installing ODP.NET_Managed_ODAC12cR4

ODP.NET_Managed_ODAC12cR4>install_odpm.bat c:\oracle12c_client_64 x86 true

Wednesday, March 16, 2016

Querystring or Model values

<c:set var="showId" value="${param.showid}"/>
<c:set var="showId" value="${show.getId()}"/>

Monday, March 14, 2016

Java Config dataSourceInitializer

private DATA_SCRIPT;

public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {

   final DataSourceInitializer initializer = new DataSourceInitializer();
   return initializer;

private DatabasePopulator databasePopulator() {
   final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
   return populator;


populator.addScript(new ClassPathResource("db/sql/insert-data.sql"));

Sunday, March 13, 2016

H2 Database


Saturday, February 27, 2016

JAVA JPA Goal Repository

package com.thekhuc.repository;

import java.util.List;

import com.thekhuc.model.Goal;
import com.thekhuc.model.GoalReport;

public interface GoalRepository {

Goal save(Goal goal);

List<Goal> loadAll();

List<GoalReport> findAllGoalReports();


package com.thekhuc.repository;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

import org.springframework.stereotype.Repository;

import com.thekhuc.model.Goal;
import com.thekhuc.model.GoalReport;

public class GoalRepositoryImpl implements GoalRepository {

private EntityManager em;

public Goal save(Goal goal) {
if(goal.getId() == null){
goal = em.merge(goal);
return goal;

public List<Goal> loadAll() {
//Query query=em.createQuery("Select g from Goal g");

TypedQuery<Goal> query = em.createNamedQuery(Goal.FIND_ALL_GOALS, Goal.class);
return query.getResultList();

public List<GoalReport> findAllGoalReports() {
//Query query = em.createQuery("Select new com.thekhuc.model.GoalReport(g.minutes, e.minutes, e.activity) " +
// "from Goal g, Exercise e where =");

TypedQuery<GoalReport> query = em.createNamedQuery(Goal.FIND_GOAL_REPORTS, GoalReport.class);
return query.getResultList();


Sunday, February 21, 2016



<persistence xmlns=""

<persistence-unit name="punit"></persistence-unit>




<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""


<bean class="" />

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="punit"/>
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true"/>
<property name="jpaPropertyMap">
<entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<entry key="" value="create"/>
<entry key="hibernate.format_sql" value="true"/>

<bean id="transactionmanager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>

<tx:annotation-driven transaction-manager="transactionManager"/>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/fitnesstracker?autoReconnect=true"/>
<property name="username" value=""/>
<property name="password" value=""/>


Installing MySQL Community Server 5.7.11 and Python 3.5.1

Friday, February 19, 2016