Sunday, August 28, 2016
Monday, August 8, 2016
Today I Read: How to use Servlets and Ajax
How to use Servlets and Ajax
http://stackoverflow.com/questions/4112686/how-to-use-servlets-and-ajax/
http://stackoverflow.com/questions/4112686/how-to-use-servlets-and-ajax/
Friday, August 5, 2016
MemcacheService, BigInteger, and Byte Array
MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService();
IdentifiableValue oldValue = syncCache.getIdentifiable(key);
BigInteger.valueOf(0).toByteArray()
byte[] newValue = increment((byte[]) oldValue.getValue());
new BigInteger(newValue).intValue()
syncCache.putIfUntouched(key, oldValue, newValue)
break;
Thread.sleep(delayMs);
private byte[] increment(byte[] oldValue) {
long val = new BigInteger(oldValue).intValue();
val++;
return BigInteger.valueOf(val).toByteArray();
}
IdentifiableValue oldValue = syncCache.getIdentifiable(key);
BigInteger.valueOf(0).toByteArray()
byte[] newValue = increment((byte[]) oldValue.getValue());
new BigInteger(newValue).intValue()
syncCache.putIfUntouched(key, oldValue, newValue)
break;
Thread.sleep(delayMs);
private byte[] increment(byte[] oldValue) {
long val = new BigInteger(oldValue).intValue();
val++;
return BigInteger.valueOf(val).toByteArray();
}
Thursday, August 4, 2016
Oracle decode() and sign() functions and count(*) - count(COLUMN_NAME)
decode(sign(count(*) - count(COLUMN_NAME)), 1, 'Y', 'N')
1) count(*) - count(COLUMN_NAME): returns a count of non-null records, used with group by
2) sign(NUMBER): returns sign of NUMBER
If NUMBER < 0, then sign returns -1
If NUMBER = 0, then sign returns 0
If NUMBER > 0, then sign returns 1
3) decode(sign(NUMBER), 1, 'Y', 'N'): if NUMBER is greater than 0, then returns 'Y', otherwise returns 'N'
1) count(*) - count(COLUMN_NAME): returns a count of non-null records, used with group by
2) sign(NUMBER): returns sign of NUMBER
If NUMBER < 0, then sign returns -1
If NUMBER = 0, then sign returns 0
If NUMBER > 0, then sign returns 1
3) decode(sign(NUMBER), 1, 'Y', 'N'): if NUMBER is greater than 0, then returns 'Y', otherwise returns 'N'
Tuesday, July 26, 2016
.NET Oracle Client
Method 1: Web.config
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<section name="oracle.dataaccess.client" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
</configSections>
<dataConfiguration defaultDatabase="DefaultDatabase">
<providerMappings>
<add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.DDTekOracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="DDTek.Oracle"/>
<add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Oracle.DataAccess.Client" />
</providerMappings>
</dataConfiguration>
<connectionStrings>
<add name="ConnectionString1" providerName="Oracle.DataAccess.Client" connectionString="User Id=;Password=;Data Source=; Pooling=true; Min Pool Size=1; Max Pool Size=50; Incr Pool Size=10; Decr Pool Size=10; Connection Timeout=50; Validate Connection=true;"/>
</connectionStrings>
</configuration>
Method 2: Web.config
<connectionStrings>
<add name="ConnectionString1" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=;Password=;Data Source=; Pooling=true; Min Pool Size=1; Max Pool Size=50; Incr Pool Size=10; Decr Pool Size=10; Connection Timeout=50; Validate Connection=true;"/>
</connectionStrings>
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<remove invariant="Oracle.DataAccess.Client" />
<add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<add name="ODP.NET, Managed Driver"
invariant="Oracle.ManagedDataAccess.Client"
description="Oracle Data Provider for .NET, Managed Driver"
type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
Method 3: Machine.config
<system.data>
<DbProviderFactories>
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<section name="oracle.dataaccess.client" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
</configSections>
<dataConfiguration defaultDatabase="DefaultDatabase">
<providerMappings>
<add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.DDTekOracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="DDTek.Oracle"/>
<add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Oracle.DataAccess.Client" />
</providerMappings>
</dataConfiguration>
<connectionStrings>
<add name="ConnectionString1" providerName="Oracle.DataAccess.Client" connectionString="User Id=;Password=;Data Source=; Pooling=true; Min Pool Size=1; Max Pool Size=50; Incr Pool Size=10; Decr Pool Size=10; Connection Timeout=50; Validate Connection=true;"/>
</connectionStrings>
</configuration>
Method 2: Web.config
<connectionStrings>
<add name="ConnectionString1" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=;Password=;Data Source=; Pooling=true; Min Pool Size=1; Max Pool Size=50; Incr Pool Size=10; Decr Pool Size=10; Connection Timeout=50; Validate Connection=true;"/>
</connectionStrings>
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<remove invariant="Oracle.DataAccess.Client" />
<add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
<add name="ODP.NET, Managed Driver"
invariant="Oracle.ManagedDataAccess.Client"
description="Oracle Data Provider for .NET, Managed Driver"
type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
Method 3: Machine.config
<system.data>
<DbProviderFactories>
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
Sunday, July 24, 2016
Issue: Unable to fetch transient dependency com.google.http-client:google-http-client:[1.19.0,2.0)
Issue:
Unable to fetch transient dependency com.google.http-client:google-http-client:[1.19.0,2.0)
Solution
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.6</version>
<exclusions>
<exclusion>
<!-- TODO remove me after the issue is fixed https://github.com/google/google-http-java-client/issues/330 -->
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Add the transitive dependency explicity -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.22.0</version>
</dependency>
Unable to fetch transient dependency com.google.http-client:google-http-client:[1.19.0,2.0)
Solution
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.6</version>
<exclusions>
<exclusion>
<!-- TODO remove me after the issue is fixed https://github.com/google/google-http-java-client/issues/330 -->
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Add the transitive dependency explicity -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.22.0</version>
</dependency>
Wednesday, July 6, 2016
Bootstrap Carousel
http://www.tutorialrepublic.com/codelab.php?topic=bootstrap&file=carousel
https://bootstrapbay.com/blog/bootstrap-3-carousel-tutorial/
https://bootstrapbay.com/blog/bootstrap-3-carousel-tutorial/
GAE URLFetchService, JDOM2, Amazon ItemSearch, Bytes Array to String
https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/appengine/urlfetch
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemSearch.html
http://stackoverflow.com/questions/4661680/how-to-read-fetch-the-xml-file-from-an-url-using-java
http://stackoverflow.com/posts/4661726/revisions
http://www.tutorialspoint.com/java_xml/java_jdom_query_document.htm
http://www.studytrails.com/java/xml/jdom2/java-xml-jdom2-xpath.jsp
http://www.tutorialspoint.com/java_xml/java_jdom_parse_document.htm
https://ikaisays.com/2010/06/29/using-asynchronous-urlfetch-on-java-app-engine/
byte[] bytes = example.getBytes();
String decoded = new String(bytes, "UTF-8");
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemSearch.html
http://stackoverflow.com/questions/4661680/how-to-read-fetch-the-xml-file-from-an-url-using-java
http://stackoverflow.com/posts/4661726/revisions
http://www.tutorialspoint.com/java_xml/java_jdom_query_document.htm
http://www.studytrails.com/java/xml/jdom2/java-xml-jdom2-xpath.jsp
http://www.tutorialspoint.com/java_xml/java_jdom_parse_document.htm
https://ikaisays.com/2010/06/29/using-asynchronous-urlfetch-on-java-app-engine/
byte[] bytes = example.getBytes();
String decoded = new String(bytes, "UTF-8");
Thursday, June 30, 2016
.NET 4.5.2 TLS1.2
[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
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001
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()}"/>
Subscribe to:
Posts (Atom)