Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Monday, February 14, 2011

How to Vacuum Indexes (Java) on App Engine

Note, you need App Engine SDK 1.4.2 or higher.

On Linux:
./appengine-java-sdk/bin/appcfg.sh vacuum_indexes myapp/war

On Windows: 
appengine-java-sdk\bin\appcfg.cmd vacuum_indexes myapp/war

You need to run this from command line on your local PC. This command deletes all indexes for the app that are not mentioned in the local versions of datastore-indexes.xml and generated/datastore-indexes-auto.xml.

About parameters:

  • appcfg.cmd file is part of GAE SDK and so you have to look for it in the folder where SDK is installed. If you use Eclipse then App Engine plugin is installed under "eclipse\plugins\" folder. There might be several GAE SDK folders in there, so make sure you pick the right version. For example for version 1.4.2 the folder name starts with "com.google.appengine.eclipse.sdkbundle.1.4.2".

  • vacuum_indexes - name of the action.

  • myapp/war  - path to the war folder of your application. You need to specify the full path in there.


 Here is corresponding App Engine doc.

After you execute this command, it's going to ask you if you actually want to delete index or not. See screenshot below. 

[caption id="attachment_100" align="alignnone" width="683" caption="Delete index confirmation"]Delete index confirmation[/caption]

-=Oleg=-

Sunday, February 13, 2011

How to download App Engine logs in Windows

The web interface provided by admin console does not provide a lot of flexibility for analyzing your logs and sometimes you just need to have them locally to study carefully. If you are working on Windows and you feel that information provided in App Engine docs is too short, then this blog is for you.

App Engine Docs say you need to run this:

./appengine-java-sdk/bin/appcfg.sh request_logs myapp/war mylogs.txt

Well this is for Linux. If you are on Windows, here what you need to do:

  1. Find the location of the “appcfg.cmd” on your computer. I use Eclipse and in my case it was here:
    "c:\Program Files\eclipse\plugins\com.google.appengine.eclipse.
    sdkbundle.1.4.0_1.4.0.v201012021502\appengine-java-sdk-1.4.0\bin\appcfg.cmd".

  2. Find the location of your app. You need the “war” folder. Here is what I have on my machine:
    "c:\svn\mysource\myapp\trunk\war"

  3. And the final step is to put it all together. Open command prompt and type:
    "c:\Program Files\eclipse\plugins\com.google.appengine.eclipse.
    sdkbundle.1.4.0_1.4.0.v201012021502\appengine-java-sdk-1.4.0\bin\appcfg.cmd" request_logs c:\svn\mysource\myapp\trunk\war mylogs.txt


This will do the magic of downloading your application logs to your computer. Just be patient because it may take a while. In my case downloading 9 hours of logs (~1,000,000 records) took about 30 minutes.

BTW, if you don’t specify the destination folder then file is downloaded into "c:\Documents and Settings\username\" folder.

BTW2, running appcfg.cmd without parameters will show you a help page where you can read how to specify number of days and minimum log level if you need to. By default it will be 1 day of request logs only.

-=Oleg=-

Wednesday, December 2, 2009

GWT - Unicode Characters

Sometimes simple 1 minute tasks make you stop and spend 20 minutes figuring solution out.

I've got a request to replace the label "Up" by this arrow "▲" . What could be simpler? I quickly replaced "Up" by "▲" in my Java source code. Then I tried to save my code and got the Eclipse error "Some characters cannot be mapped using "Cp1252" character encoding"...

The solution is simple. I used a nice online converter http://people.w3.org/rishida/scripts/uniview/conversion.php to get the Unicode code for the arrow character and then pasted it in my Java code like this:

String upArrrow = "\u25B2";

-=Oleg=-

Friday, October 2, 2009

New Direction - Google App Engine

As it often happened in developers life, as soon as you become an expert in something, the life throws you a new project which requires you to learn brand new  languages, platforms, frameworks, technologies, etc... Suddenly your work day routine changes from 80% coding and 20% research to 99% of learning and researching.

Only six month ago I started working with Silverlight. We had some fun playing with new power tool, we've built the a series of prototypes... and that was the end of Silverlight journey.

New mission is Google App Engine.  Our language of choice is Java. My experience with Java - none. So far looking at zillions of Java frameworks makes me dizzy. After spending 2 days on learning Struts 2 I've realized that the learning curve is expected to be very deep. I'm diving in... - wish me good luck.

-=Oleg=-