Grails native2ascii Error

Error executing script RunApp: : Error starting Sun's native2ascii: 
gant.TargetExecutionException: : Error starting Sun's native2ascii: 


Getting the following error
----------------------------------------------------------------------------------------------

Error executing script RunApp: : Error starting Sun's native2ascii: 
gant.TargetExecutionException: : Error starting Sun's native2ascii: 
        at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:331)
        at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
        at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
        at gant.Gant.withBuildListeners(Gant.groovy:344)
        at gant.Gant.this$2$withBuildListeners(Gant.groovy)
        at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
        at gant.Gant.dispatch(Gant.groovy:334)
        at gant.Gant.this$2$dispatch(Gant.groovy)
        at gant.Gant.invokeMethod(Gant.groovy)
        at gant.Gant.processTargets(Gant.groovy:495)
        at gant.Gant.processTargets(Gant.groovy:480)
Caused by: : Error starting Sun's native2ascii: 
        at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.java:67)
        at org.apache.tools.ant.taskdefs.optional.native2ascii.DefaultNative2Ascii.convert(DefaultNative2Ascii.java:54)
        at org.apache.tools.ant.taskdefs.optional.Native2Ascii.convert(Native2Ascii.java:268)
        at org.apache.tools.ant.taskdefs.optional.Native2Ascii.execute(Native2Ascii.java:227)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at _GrailsPackage_groovy$_run_closure2_closure13.doCall(_GrailsPackage_groovy:108)
        at _GrailsPackage_groovy$_run_closure2_closure13.doCall(_GrailsPackage_groovy)
        at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274)
        at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
        at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:107)
        at RunApp$_run_closure1.doCall(RunApp:28)
        at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
        ... 10 more
Caused by: java.lang.ClassNotFoundException: sun.tools.native2ascii.Main
        at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:164)
        at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.java:51)
        ... 22 more
----------------------------------------------------------------------------------------------


Solution


Edit the "Config.groovy" file located in grails-app/conf


change "grails.enable.native2ascii = true" to "grails.enable.native2ascii = false"

Google Phone Search 1-800-41-999-999

Google Phone Search

Voice Search is now available for Bangalore

Use google phone search to find out the local business info, flight & movie timings. One of the cool product from google India labs. This service be can be accessed from any phone and google sends the search results as SMS to your mobile @ free of cost.
All you need to do is dial 1-800-41-999-999 from any phone. Its a toll free number.

Its worth giving a try.

Other similar services:

Sulekha - http://yellowpages.sulekha.com

Justdial - http://wwww.justdial.com/

Install DBD::Oracle for Windows

Install DBD::Oracle for Windows


Recently i was in need to install DBD::oracle for windows so scoured google for it. Found that many people have trouble with installing the module.
Activestate site says:
Using PPM: "DBD::Oracle Oracle no longer provides the Oracle client libraries for free, so we can no longer provide DBD Oracle as a PPM/PPM3 module. The DBD-Oracle package for ActivePerl 5.6 is the last package compiled before the licensing changed that is still available on our site. If you wish to compile this module locally, the source may be obtained from www.cpan.org. Instructions on using CPAN are at: http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/lib/CPAN.html. If you are using Windows, an easy workaround for you might be just to use DBD-ODBC instead."


I encountered with following errors 
ppm install failed: The PPD does not provide code to install for this platform

Many suggested to use ftp://ftp.esoftmatic.com/, which is no longer exists.
Later found this site(http://www.cedet.dk/perl/). It gave me the solution to install DBD::Oracle for Active State Perl 5.8.x. But i am using perl, v5.10.0 built for MSWin32-x86-multi-thread.

http://trouchelle.com/perl/ppmrepview.pl is a good site with a whole lot of ppd repository.

Finally this helped me to solve the problem.
 

C:\>ppm install http://trouchelle.com/ppm10/unstable/DBD-Oracle.ppd
Downloading DBD-Oracle-1.22...done
Unpacking DBD-Oracle-1.22...done
Generating HTML for DBD-Oracle-1.22...done
Updating files in site area...done
  16 files installed


Point to be noted.
  • Dont use graphical interface(ppm) to install DBD::Oracle. Use install command from the command prompt.
  • Install oracle client. If still problem persists (error message like entry point not found) try replacing oci.dll

Perl Mechanize

WWW-Mechanize


I used Perl mechanize to test my web application. Found it awesome. If you have plans to test your web app then, give a try with mechanize. It will make your job easier. 
Thanks to Andy Lester . Download WWW::Mechanize from here


lets see a small example with www::mechanize


Load necessary modules.
#!/usr/bin/perl -w
use strict;
use WWW::Mechanize;


Create agent
# create agent
my $mech = WWW::Mechanize->new();
$mech->get("http://search.cpan.org");
if(! $mech->success) {
   print "Failed to load\n";
}


Get the list of module category URL 

# Get all the links from the page that matches the given pattern.
my @links = $mech->find_all_links(url_regex => qr/modlist\/(.*)/);
foreach my $modlist (@links) {
 print("The URL is " . $modlist->url_abs . "\n");
}

The output of the above will be like this



The URL is http://search.cpan.org/modlist/Archiving_Compression_Conversion
The URL is http://search.cpan.org/modlist/File_Name_System_Locking
The URL is http://search.cpan.org/modlist/Option_Parameter_Config_Processing
The URL is http://search.cpan.org/modlist/Bundles
The URL is http://search.cpan.org/modlist/Graphics
The URL is http://search.cpan.org/modlist/Perl6
The URL is http://search.cpan.org/modlist/Commercial_Software_Interfaces
The URL is http://search.cpan.org/modlist/Internationalization_Locale
The URL is http://search.cpan.org/modlist/Pragmas
The URL is http://search.cpan.org/modlist/Control_Flow_Utilities
The URL is http://search.cpan.org/modlist/Language_Extensions
The URL is http://search.cpan.org/modlist/Security
The URL is http://search.cpan.org/modlist/Data_and_Data_Types
The URL is http://search.cpan.org/modlist/Language_Interfaces
The URL is http://search.cpan.org/modlist/Server_Daemon_Utilities
The URL is http://search.cpan.org/modlist/Database_Interfaces
The URL is http://search.cpan.org/modlist/Mail_and_Usenet_News
The URL is http://search.cpan.org/modlist/String_Language_Text_Processing
The URL is http://search.cpan.org/modlist/Development_Support
The URL is http://search.cpan.org/modlist/Miscellaneous
The URL is http://search.cpan.org/modlist/User_Interfaces
The URL is http://search.cpan.org/modlist/Documentation
The URL is http://search.cpan.org/modlist/Networking_Devices_IPC
The URL is http://search.cpan.org/modlist/World_Wide_Web
The URL is http://search.cpan.org/modlist/File_Handle_Input_Output
The URL is http://search.cpan.org/modlist/Operating_System_Interfaces


Now lets see how to use forms. On top of the page you can see the search form. Lets search for mechanize. To do that,



1  #search something
2  $mech->submit_form(
3    fields => {
4        query => 'mechanize'
5     }
6   );






In line number 4 query is the name of the form field.





< \input type="text" name="query" value="mechanize" size="35"> 

Fetch all the urls from search output
my @search_links = $mech->find_all_links();

Get all the URL that ends with .pm extension 
foreach my $search_list (@search_links) {
    if ($search_list->url_abs =~ /(.*).pm/) {
        print "I found mechanize module and the URL is $1 \n";
    }
}


Note: @search_links bring only the 1st page's URLs. The actual search output have more than 6-7 pages.


Using Fork 
If you think the test takes more time then you can use fork to create a child process.


Example to create a child process:





 if ( !defined ($child_pid = fork()) ) {
  die "cannot fork: $!";
  }
  elsif ($child_pid == 0) {
  # I'm the child
  }
  else {
  # I'm the parent
  } 

If you have a array with huge number of URLs, you can split that into two and process them in child and parent. This will make the task easier.

Source code:


#!/usr/bin/perl -w


use strict;
use WWW::Mechanize;


# create agent
my $mech = WWW::Mechanize->new();
$mech->get("http://search.cpan.org");
if(! $mech->success) {
   print "Failed to load\n";
}


# Get all the links from the page that matches the given pattern.
my @links = $mech->find_all_links(url_regex => qr/modlist\/(.*)/);


foreach my $modlist (@links) {
 print("The URL is " . $modlist->url_abs . "\n");
}


#search something
$mech->submit_form(
    fields => {
        query => 'mechanize'
    }
);


my @search_links = $mech->find_all_links();
foreach my $search_list (@search_links) {
    if ($search_list->url_abs =~ /(.*).pm/) {
        print "I found mechanize module and the URL is $1 \n";
    }
}

See also:
Test::WWW::Mechanize
Test::WWW::Mechanize::Catalyst

Savior to google notebook

Google Notebook has announced that is has stopped development. Which means new users cant sign-up for this feature but the existing users can still use the service. Google notebook is knows for its: simple, design, effective, friendly, and well suited to a getting things done.Its one of the best tool of google and i use it extensive. Keep it alive. Petition to save Google Notebook. So now its time look for alternatives. I found some good alternatives for google notebook.
Evernote is worth a try. It handles web links, text notes, pictures, voice memos. Overall its a rich media note-taking system. With evernote its easy to import your google notebook notes.
Zoho Notebook is very similar to googe notebook. It handles text, image, audio, video etc. It also has a version control, Zoho Notebook plugin for firefox. You can even import your google notebook.
To import your notes from Google Notebook, select a notebook, click “export”, choose the Atom option, and save to disk. Repeat this step for each notebook you want to import into Evernote. When you’re done,
Login into the Evernote website
click on Settings, find the “Import into Evernote” section, click the link, and then select Google Notebook. You’ll need to import notebooks one by one.
Below is the video to help yourself

Login into the Zoho Notebook website
Click Import Google notebook, on top of the page. Start importing notes one by one.
Thats simple.
Have a look at this to try some other note taking applications.

Want to try Catalyst

Catalyst is open-source perl based elegent MVC framework(http://dev.catalystframework.org/wiki/). Check out http://www.perl.com/lpt/a/930 to know more about Catalyst.

Lets see the steps to install catalyst in a easy way.


Download svndump.gz from http://handelframework.com/downloads/
Extract/unzip the items from svndump.gz



For windows:

open a command prompt
-------------------------
  • Goto -> Run->cmd


Change directory to CatInABox/bin
------------------------------------


> cd CatInABox/bin folder
Run catalyst.bat
----------------
Run catalyst.bat along with your Application name. Say my application name is 'Testapp', i would run


> catalyst.bat Testapp
















Now you are done with creating your application. To start the server, change directory to your Testapp/script and start the server.


cd Testapp/script

perl testapp_server.pl
Now your application is up and running. To view it. Goto browser and check
http://localhost:3000 . you should be able to view the application.
For unix flavors:
Repeat the same procedure for unix boxes. Instead of catalyst.bat use catalyst.pl


catalyst.pl Testapp
Which will create the same structure as in windows.



To create a TT view, run:
$ script/testapp_create.pl view TT TT
This creates the lib/Testapp/View/TT.pm module, which is a subclass of Catalyst::View::TT.



To create a new Controller, run:(say i am creating controller User)
$ perl script/testapp_create.pl controller User
This will create "/lib/TestApp/Controller/User.pm" and "/t/controller_user.t"dot(.) t files are used for testing.
To create a database Model
Before creating model, read: http://www.perlmonks.org/?node_id=700283
You need a database, it is recommened to use SQLite, if your application is small. Since its a "embedded" database. so the database exists as a single file and requires no server to run.
$ $ perl script/testapp_create.pl model TestDb DBIC::Schema \ Testapp::Schema::TestDb create=dynamic \ dbi:SQLite:/tmp/database