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)
{
if(result.hasErrors()){
return "myapp.editshow";
}
else{
show.setId(showId);
show = showService.save(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

@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"));

Sunday, March 13, 2016

H2 Database



C:\DEV\Apps\h2-2016-01-21\h2\bin>h2w.bat