Javascript editor plugin in Eclipse

I found this plugin in Eclipse which enables writing javascript code easier: Aptana studio. Go to Eclipse Marketplace and search for Aptana.


Renaming Android Project in Eclipse

I usually start with a template project, and then I rename it to my own project. These are some of the points where I have to modify:

  • Under src folder and gen folder, right click and choose refactor, and rename to your apps name, e.g. net.okakurniawan.myapp.
  • Refactor and rename the project name folder in Eclipse.
  • Go to AndroidManifest.xml and add the app name, e.g. net.okakurniawan.myapp.
  • Then go to res folder (resource)-> values -> strings.xml, and modify the element app_name(string) to your apps name, e.g. MyApp.

Setting number precision in Toolbook Action Editor

In Toolbook 10.5, there is a function round(number,exp) to do this setting precision. However, it seems that the function is buggy. When I tried it in action editor, it gives me error saying that the argument is too many. So I need to find a work around for this. One way that I found is to use javascript function toPrecision(). These are the steps:

  1. Create a javascript file, e.g. setPrecision.js
  2. Write the a function to call toPrecision javascript function. Note that Toolbok requires the function name to starts with tbfunction_. You can download the javascript file that I use.
  3. Then in your Toolbook Author View, click the Menu “Object”->”Properties for Book”.
  4. Click the Tab “Web”.
  5. Click the button “Import”, and select your javascript file.
  6. Once you have imported to your book you can use it in the Action Editor.
  7. Go to Action Editor, find “Execute Script” and drag into the code area.
  8. Click “Properties”, and set in the parameters. In the file that I gave the first parameter is the floating point number, and the second one is the number of precision.
  9. Set the return value of the function. You may want to create a variable to store the return value. And you are Done!



JavaScript toPrecision Method