[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001
Thursday, June 30, 2016
Tuesday, June 21, 2016
GAE Modules/Services
http://stackoverflow.com/questions/23055616/appengine-modules-dispatch-xml-routing-with-custom-domain
https://cloud.google.com/appengine/docs/java/config/dispatchref
https://github.com/GoogleCloudPlatform/appengine-modules-sample-java
https://cloud.google.com/appengine/docs/java/microservices-on-app-engine
https://cloud.google.com/appengine/docs/java/modules/converting
https://cloud.google.com/appengine/docs/java/config/dispatchref
https://github.com/GoogleCloudPlatform/appengine-modules-sample-java
https://cloud.google.com/appengine/docs/java/microservices-on-app-engine
https://cloud.google.com/appengine/docs/java/modules/converting
Thursday, June 16, 2016
Java HashMap
Map<Integer,String> uniqueMap =
new
HashMap<Integer,String>();
List<Value> list = new ArrayList<Value>(map.values());
map.size()
Thursday, May 19, 2016
Thursday, May 12, 2016
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
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
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.
http://www.oracle.com/technetwork/middleware/bpel/overview/index.html
http://www.oracle.com/technetwork/middleware/bpel/overview/index.html
Sunday, April 10, 2016
Thursday, March 31, 2016
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
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)
{
if(result.hasErrors()){
return "myapp.editshow";
}
else{
show.setId(showId);
show = showService.save(show);
}
return "redirect:editshow.html?showid=" + show.getId();
}
@RequestMapping(value={"/addnewshow", "/editshow"}, method=RequestMethod.POST)
public String processShow(@Valid @ModelAttribute("show") Show show, BindingResult result,
@RequestParam(value="showid", required=false) Long showId)
{
if(result.hasErrors()){
return "myapp.editshow";
}
else{
show.setId(showId);
show = showService.save(show);
}
return "redirect:editshow.html?showid=" + show.getId();
}
Friday, March 25, 2016
Thursday, March 24, 2016
Wednesday, March 16, 2016
Querystring or Model values
<c:set var="showId" value="${param.showid}"/>
~
<c:set var="showId" value="${show.getId()}"/>
~
<c:set var="showId" value="${show.getId()}"/>
Monday, March 14, 2016
Java Config dataSourceInitializer
@Value("classpath:db/sql/insert-data.sql")
private org.springframework.core.io.Resource DATA_SCRIPT;
@Bean
public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {
final DataSourceInitializer initializer = new DataSourceInitializer();
initializer.setDataSource(dataSource);
initializer.setDatabasePopulator(databasePopulator());
return initializer;
}
private DatabasePopulator databasePopulator() {
final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
populator.addScript(DATA_SCRIPT);
return populator;
}
OR
populator.addScript(new ClassPathResource("db/sql/insert-data.sql"));
private org.springframework.core.io.Resource DATA_SCRIPT;
@Bean
public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {
final DataSourceInitializer initializer = new DataSourceInitializer();
initializer.setDataSource(dataSource);
initializer.setDatabasePopulator(databasePopulator());
return initializer;
}
private DatabasePopulator databasePopulator() {
final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
populator.addScript(DATA_SCRIPT);
return populator;
}
OR
populator.addScript(new ClassPathResource("db/sql/insert-data.sql"));
Sunday, March 13, 2016
Saturday, February 27, 2016
JAVA JPA Goal Repository
JAVA JPA
//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();
}
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;
@Repository("goalRepository")
public class GoalRepositoryImpl implements GoalRepository {
@PersistenceContext
private EntityManager em;
@Override
public Goal save(Goal goal) {
if(goal.getId() == null){
em.persist(goal);
em.flush();
}
else{
goal = em.merge(goal);
}
return goal;
}
@Override
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();
}
@Override
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 g.id = e.goal.id");
TypedQuery<GoalReport> query = em.createNamedQuery(Goal.FIND_GOAL_REPORTS, GoalReport.class);
return query.getResultList();
}
}
//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();
}
//Interface
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;
@Repository("goalRepository")
public class GoalRepositoryImpl implements GoalRepository {
@PersistenceContext
private EntityManager em;
@Override
public Goal save(Goal goal) {
if(goal.getId() == null){
em.persist(goal);
em.flush();
}
else{
goal = em.merge(goal);
}
return goal;
}
@Override
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();
}
@Override
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 g.id = e.goal.id");
TypedQuery<GoalReport> query = em.createNamedQuery(Goal.FIND_GOAL_REPORTS, GoalReport.class);
return query.getResultList();
}
}
Sunday, February 21, 2016
persistence.xml
/src/main/resources/META-INF/persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.or/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/XML/ns/persistence http://java.sun.com/xml/ns/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="punit"></persistence-unit>
</persistence>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.or/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/XML/ns/persistence http://java.sun.com/xml/ns/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="punit"></persistence-unit>
</persistence>
jpaContext.xml
/src/main/resources/jpaContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">
<context:annotation-config/>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<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"/>
</bean>
</property>
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<entry key="hibernate.hbm2ddl.auto" value="create"/>
<entry key="hibernate.format_sql" value="true"/>
</map>
</property>
</bean>
<bean id="transactionmanager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<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=""/>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">
<context:annotation-config/>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<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"/>
</bean>
</property>
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<entry key="hibernate.hbm2ddl.auto" value="create"/>
<entry key="hibernate.format_sql" value="true"/>
</map>
</property>
</bean>
<bean id="transactionmanager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<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=""/>
</bean>
</beans>
Friday, February 19, 2016
Monday, January 18, 2016
Subscribe to:
Posts (Atom)