Peter Ledbrook

author
+ Follow
since Jul 15, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Peter Ledbrook

GMail manages this because it's AJAX-based and handles the history itself. If you're not using AJAX, then I don't think there's any way to prevent the browser from caching the page. Why is it a problem if the user can see the cached page after pressing back?
10 years ago
Do you know that you can use / as a string delimiter? If you use that, you don't need to escape backslashes. For example:


Cheers,

Peter
11 years ago
What does your resources.groovy file look like?
11 years ago
The chapter does introduce closures to a level that should be more than sufficient for most Grails work. For more advanced work, particularly with plugins, then it's worth getting a book dedicated to Groovy that covers delegates, name resolution, and other closure features.

Cheers,

Peter
11 years ago


Is groovy a complete paradigm shift from the Java world or it is simply a syntax sugar coated over the bitter Java tablet.



Both. At first glance, Groovy looks like Java with a lot of added syntax sugar, but it is a fundamentally different beast because it is a dynamic language. Its support for closures also contributes to a very different feel to Java.


I think unless an language owns its own runtime environment it cannot be called as a language.



I completely disagree. A language owns its syntax and its semantics. The execution or runtime environment is irrelevant except in the case that the runtime environment may not support a language's structures in the most efficient way (think Scala on the JVM and the tail recursion hack).

Cheers,

Peter
11 years ago
Hi Nicole,

The book mainly targets Java developers, so no, you don't need to know Groovy beforehand. Chapter 2 is a primer dedicated to Groovy that will get you up to speed with what you need to use Grails effectively. If you fall in love with Groovy and use it extensively, then it's worth getting Groovy in Action as well. It's probably worth getting even if your Groovy work is limited to Grails.

Hope that helps,

Peter
11 years ago
I suspect your problem is due to the session. Once a browser has a session cookie, it will always send that cookie to the server. You either have to log out or open a different browser (such as Opera). I gather that there are ways to get round this, but I don't know what they are.

Cheers,

Peter
11 years ago
Just to avoid confusion, Grails in Action also has a chapter on legacy database integration

Peter
11 years ago
Hi Andrew,

It's a bit difficult to say. There's not much coverage of Groovy in our book, so you could ask your instructor for more information on what makes Groovy a dynamic language and how to use meta-programming. If you have any trouble with closures, it may be worth asking for more on those. On the Grails side, there isn't much of the core framework that we don't cover. It may be worth asking about how to set up different databases for Grails.

I think you're best off trying to create your own application and see what questions arise. If the books don't answer those questions, then you can have them ready for the instructor.

Cheers,

Peter
11 years ago
LinkedIn also use Grails for one of their customer applications:

http://blog.linkedin.com/2008/06/11/grails-at-linkedin/

Cheers,

Peter
11 years ago
It's a bug in the scaffolding code. I suspect that it simply wasn't changed when custom types were introduced to Grails, so it uses some old (broken) way to determine whether a field is a relationship or not.

I don't think PropertyEditorSupport classes have any impact on the scaffolding. As far as I'm aware, they're only used during data-binding, for example when the params object is bound to a domain or command object.

Cheers,

Peter
11 years ago


I'm mainly curious about how it's used in a web application as opposed to a stand alone app
that you would run like "java myapp_with_main_method " .



You can use Groovy for anything that you might use Java for. It's XML processing is particularly strong. As an example, check out GroovyServlet:

http://groovy.codehaus.org/api/groovy/servlet/GroovyServlet.html

You just have to make sure that you use the Groovy compiler to compile the Groovy files. There is an Ant task you can use, or there is the GMaven plugin for Maven.

Hope that helps,

Peter
11 years ago


indexes and keys are named properly. Is this a bug or is this expected?



Do the indexes have the incorrect names in the database? Or is it just the foreign keys? As for the foreign keys, I notice you've raised an issue already. Whatever feature is already there may not be working correctly, but I have to admit I don't know for sure.


Another side question here is, Ive noticed also that unless you're using HSQLDB, Grails will not create the database for you. You have to drop and create it manually, and then Grails will generate the schema. This is a small issue, but kind of annoying with the extra step. I just figured I'd bring it up in case anyone knows the reason for this.



This is due to Hibernate's auto DDL feature. Why does Hibernate not do it? I don't know, but I suspect it's because the database user configured for the application typically shouldn't be allowed to create databases (something that a system/database administrator should be doing).

Cheers,

Peter
11 years ago
Groovy is a dynamic language. Scala is a static language. Scala is more of an evolution of Java, whereas Groovy complements Java (although it is sometimes sold as a replacement). There is more than enough room in one's toolkit for both.

Take Grails for example: about 70% of it is probably still written in Java. The rest is Groovy. It's all about using the right tool for the job. Of course, you need a fair bit of experience to determine which is the right tool!

Cheers,

Peter
11 years ago
Your mileage will vary depending on how far your database deviates from the Hibernate norm. The Grails user mailing list a useful resource for answering specific database mapping questions. As for ROI, there is a one-off hit in advance associated with the legacy mapping, but you gain the advantage of the dynamic finders, transactional services, GSPs, and other benefits.

On the legacy mapping front, I don't think the GORM mapping DSL supports every feature of Hibernate, so you may have to map some of your classes using Hibernate XML mapping files. It's not pleasant, but at least you only have to do it once.

Cheers,

Peter
11 years ago