Aug 29, 2013

GAE - Datastore filtering using IN operator

Since I can't find in datastore queries the documentation on how to use the IN operator, that why I decide to share my expirimentaion.

Here how I did.
Query q = new Query("YourKindHere");
// Create a list of possible data tobe compare in your IN operator
List<Long> levels =  new ArrayList<Long>(); // Initiate a List object
// Add the possible levels
// INFO: If you notice, I put "l" to represent the value as Long
arrayList.add(1l); // add level 1
arrayList.add(2l); // add level 2
arrayList.add(3l); // add level 3

// Create and AND operation with IN operators
q.setFilter(CompositeFilterOperator.and(
  FilterOperator.EQUAL.of("active", 1l), // compare as active=1
  FilterOperator.IN.of("level", levels) // compare ad level IN (1, 2, 3)
));


For other info about queries please check google appengine datastore query docs. Java DataStore Queries.

Aug 12, 2013

Android: How to install the apps to you SD Card as default.

Here basic requirement.
Java
Android SDK


Assume you already installed the java and extract the Android sdk.
In your DOS Command prompt/Console.
1 Change working directory
cd Android-SDK/platform-tools
2 List the devices connected
adb devices

3 Change the default location.
adb shell pm setInstallationLocation 2

INFO: If you want to revert the past setting just change the 2 to 0

Aug 6, 2013

Magento: How to reindex via ssh or in terminal/console

Since reindexing request long term of running in our webserver. I thing it is better to do this one the console, to liminated the posoble timeout error.


Below are some possible command you can use.
Index product attributes for layered navigation building
php shell/indexer.php -reindex catalog_product_attribute

Rebuild Catalog product fulltext search index
php shell/indexer.php -reindex catalogsearch_fulltext

Reorganize EAV product structure to flat structure
php shell/indexer.php -reindex catalog_category_flat

Index Product Stock Status
php shell/indexer.php -reindex cataloginventory_stock

Indexed category/products association
php shell/indexer.php -reindex catalog_category_product

Index product prices
php shell/indexer.php -reindex catalog_product_price

Rebuild Tag aggregation data
php shell/indexer.php -reindex tag_summary


Index product and categories URL rewrites
php shell/indexer.php -reindex catalog_url

If you want to reindex all.
php shell/indexer.php -reindexall


Also, for other useful command parameter you can use help screen that is accessable via SSH using the command:
php ./shell/indexer.php -help

SVN - How to recommit failed commit with svn-commit.tmp

To deal with this, and since we get failed commit the file is created. In some reason this file created so we don't lost the big long comment for our commit.


To reuse the commit info

svn ci -F svn-commit.tmp

INFO: The file also free to delete. just rm it.