<!doctype html>
<html lang="en">
<head>
<title>ProductManagement</title>
<base href="/">
</head>
<body>
<pm-root></pm-root>
</body>
</html>
Thursday, July 6, 2017
Monday, June 19, 2017
Friday, May 5, 2017
Wednesday, April 5, 2017
Sunday, March 5, 2017
Saturday, February 11, 2017
Sunday, January 29, 2017
Jcache vs Memcache
Jcache
import javax.cache.Cache;
import javax.cache.CacheException;
import javax.cache.CacheFactory;
import javax.cache.CacheManager;
try {
CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
Cache cache = cacheFactory.createCache(Collections.emptyMap());
key = "p";
if (cache.containsKey(key)) {
pList = (List<p>) cache.get(key);
} else {
pList = ofy().load().type(p.class).list();
cache.put(key, pList);
}
} catch (CacheException e) {
}
Memcache
import com.google.appengine.api.memcache.ErrorHandlers;
import com.google.appengine.api.memcache.MemcacheService;
import com.google.appengine.api.memcache.MemcacheServiceFactory;
MemcacheService cache = MemcacheServiceFactory.getMemcacheService();
cache.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO));
key = "p";
if (cache.contains(key)) {
pList = (List<p>) cache.get(key);
} else {
pList = ofy().load().type(p.class).list();
cache.put(key, pList);
}
import javax.cache.Cache;
import javax.cache.CacheException;
import javax.cache.CacheFactory;
import javax.cache.CacheManager;
try {
CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
Cache cache = cacheFactory.createCache(Collections.emptyMap());
key = "p";
if (cache.containsKey(key)) {
pList = (List<p>) cache.get(key);
} else {
pList = ofy().load().type(p.class).list();
cache.put(key, pList);
}
} catch (CacheException e) {
}
Memcache
import com.google.appengine.api.memcache.ErrorHandlers;
import com.google.appengine.api.memcache.MemcacheService;
import com.google.appengine.api.memcache.MemcacheServiceFactory;
MemcacheService cache = MemcacheServiceFactory.getMemcacheService();
cache.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO));
key = "p";
if (cache.contains(key)) {
pList = (List<p>) cache.get(key);
} else {
pList = ofy().load().type(p.class).list();
cache.put(key, pList);
}
Sunday, December 4, 2016
XCOPY
Copy new/updated files from source folder on D to destination folder on K
xcopy D:\Documents\Pictures K:\Documents\Pictures /s /d
xcopy D:\Documents\Pictures K:\Documents\Pictures /s /d
Thursday, December 1, 2016
Linux Notes
uname -r: shows kernel version
lsb_release -a: shows operating system/distribution
free -m: shows memory
Ubuntu/Lubuntu/Centos/Raspberry Pi (Raspbian, Debian based distribution)
lsb_release -a: shows operating system/distribution
free -m: shows memory
Ubuntu/Lubuntu/Centos/Raspberry Pi (Raspbian, Debian based distribution)
Thursday, November 17, 2016
Joda-Time DateTimeFormat
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss");
DateTime showDate = formatter.parseDateTime("02/02/2016 08:02:00");
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss");
DateTime showDate = formatter.parseDateTime("02/02/2016 08:02:00");
facebook4j Events
import facebook4j.Event;
import facebook4j.Facebook;
import facebook4j.FacebookException;
import facebook4j.FacebookFactory;
import facebook4j.ResponseList;
import facebook4j.auth.AccessToken;
Facebook facebook = new FacebookFactory().getInstance();
facebook.setOAuthAppId(appId, appSecret);
facebook.setOAuthPermissions(commaSeparetedPermissions);
facebook.setOAuthAccessToken(new AccessToken(accessToken, null));
ResponseList<Event> events;
int count;
try {
events = facebook.getEvents();
count = events.size();
} catch (FacebookException e) {
e.printStackTrace();
}
import facebook4j.Facebook;
import facebook4j.FacebookException;
import facebook4j.FacebookFactory;
import facebook4j.ResponseList;
import facebook4j.auth.AccessToken;
Facebook facebook = new FacebookFactory().getInstance();
facebook.setOAuthAppId(appId, appSecret);
facebook.setOAuthPermissions(commaSeparetedPermissions);
facebook.setOAuthAccessToken(new AccessToken(accessToken, null));
ResponseList<Event> events;
int count;
try {
events = facebook.getEvents();
count = events.size();
} catch (FacebookException e) {
e.printStackTrace();
}
Saturday, October 29, 2016
Thursday, September 22, 2016
Wednesday, September 14, 2016
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()
Subscribe to:
Posts (Atom)