Search Results

Search found 645 results on 26 pages for 'grails enthu'.

Page 23/26 | < Previous Page | 19 20 21 22 23 24 25 26  | Next Page >

  • How can i use 'log' inside a src/groovy/ class

    - by firnnauriel
    I'm encountering this error: groovy.lang.MissingPropertyException: No such property: log for class: org.utils.MyClass Here's the content of the class: package org.utils class MyClass { int organizationCount = 0 public int getOrganizationCount(){ log.debug "There are ${organizationCount} organization(s) found." return organizationCount } } Do i need to add an import statement? What do i need to add? Note that the class is located in src/groovy/org/utils. I know that the 'log' variable is accessible in controllers, services, etc. Not sure in 'src' classes. Thanks.

    Read the article

  • Html Select tabindex not working correctly in Chrome Browser

    - by Shauni
    Hello there, this is a problem I'm currently facing : I've made a <select id="nationalityArea.id" tabindex="6" name="nationalityArea.id"> <option value="null"></option> <option value="619">Îles Cook</option> <option value="646">Îles Féroé</option> <option value="625">Îles Salomon</option> <option value="598">Îles Vierges Américaines</option> <option value="572">Îles Vierges Britanniques</option> </select> Looks fine right ? The problem is that the tabindex method works perfectly on firefox and internet explorer but not on chrome... I think the problem came from the < g:select name="nationalityAreaId" from="${myValue}" tabindex="6" optionKey="id" value="${user?.profile?.nationalityAreaId}" noSelection="['null': '']"/ But not being a Browser specialist is hurting me on this problem. Has anyone already faced this ? And more importantly, found a solution ? Thanks

    Read the article

  • Cannot see response body in ie8 when response http status code is set to some error code(422)

    - by Deewendra Shrestha
    I am making a requset to a web service that sends custom error with proper HTTP header when I notice some validation error, this works fine in chrome and mozilla as things always do and then it broke in ie8 as it always does! After checking the network activity, I see that ie8 is not able to get response body when HTTP code is other that 200(or at-least it seems so). In groovy I am returning error like : render(status: 422, contentType: 'TEXT', text: ((errors as JSON) as String)) Is there a way I could somehow get ie8 to read in the response body, or as an alternative I might be able to set response header but before trying that I was wondering if you guys have already seen this issue and know a solution to it. Thanks, Dee

    Read the article

  • Split a map using Groovy

    - by Tihom
    I want to split up a map into an array of maps. For example, if there is a map with 25 key/value pairs. I want an array of maps with no more than 10 elements in each map. How would I do this in groovy? I have a solution which I am not excited about, is there better groovy version: static def splitMap(m, count){ if (!m) return def keys = m.keySet().toList() def result = [] def num = Math.ceil(m?.size() / count) (1..num).each { def min = (it - 1) * count def max = it * count > keys.size() ? keys.size() - 1 : it * count - 1 result[it - 1] = [:] keys[min..max].each {k -> result[it - 1][k] = m[k] } } result } m is the map. Count is the max number of elements within the map.

    Read the article

  • Why One-to-one relationship dosen't work?

    - by eugenn
    I'm trying to create a very simple relationship between two objects. Can anybody explain me why I can't find the Company object via findBy method? class Company { String name String desc City city static constraints = { city(unique: true) } } class City { String name static constraints = { } } class BootStrap { def init = { servletContext -> new City(name: 'Tokyo').save() new City(name: 'New York').save() new Company(name: 'company', city: City.findByName('New York')).save() def c = Company.findByName('company') // Why c=null????! } def destroy = { } }

    Read the article

  • Groovy: Sorting Columns in a view: list

    - by Luixv
    I have a Groovy application. I am rendering the view list using the following statement: render (view: 'list', model:[reportingInstanceList: reportingInstanceList, reportingInstanceTotal: i, params: params]) The list.gsp is as follows: The view is rendered but the default sorting is not working. <g:sortableColumn class="tabtitle" property="id" title="Id" titleKey="reporting.id" /> <g:sortableColumn class="tabtitle" property="company" title="Company" titleKey="reporting.company" /> Unfortunately the default sorting (by id, by company, etc) are not working. Any hint why? Thanks a lot in advance. Luis

    Read the article

  • Problem with variable inside gsp

    - by xain
    Hi, I have a loop inside a gsp page, and I want to do a calculation on the fly, so I set a variable: <g:set var="total" value="0" /> And in the loop: <g:each in="${mob}" var="m"> ... <g:set var="total" value="${total+(m.q*m.sts.uf)}"/> ... </g:each> The "total" value does not correspond to the expected calculation. m.q is an integer, and m.sts.uf is a float. Any hints ? Thanks.

    Read the article

  • Issue with class design to model user preferences for different classes

    - by Mulone
    Hi all, I'm not sure how to design a couple of classes in my app. Basically that's a situation: each user can have many preferences each preference can be referred to an object of different classes (e.g. album, film, book etc) the preference is expressed as a set of values (e.g. score, etc). The problem is that many users can have preferences on the same objects, e.g.: John: score=5 for filmid=apocalypsenow Paul: score=3 for filmid=apocalypsenow And naturally I don't want to duplicate the object film in each user. So I could create a class called "preference" holding a score and then a target object, something like: User{ hasMany preferences } Preference{ belongsTo User double score Film target Album target //etc } and then define just one target. Then I would create an interface for the target Classes (album, film etc): Interface canBePreferred{ hasMany preferences } And implement all of those classes. This could work, but it looks pretty ugly and it would requires a lot of joins to work. Do you have some patterns I could use to model this nicely? Cheers, Mulone

    Read the article

  • Is It Possible To Cast A Range

    - by Brad Rhoads
    I'd like to do something like this: def results = Item.findAll("from Item c, Tag b, ItemTag a where c = a.item and b = a.tag and (b.tag like :q or c.uri like :q) " + ob,[q:q]) def items = (Item) results[0..1][0] but I get Cannot cast object '[Ljava.lang.Object;@1e224a5' with class '[Ljava.lang.Object;' to class 'org.maflt.ibidem.Item' I can get what I need with this, but it doesn't seem like it's the best solution: def items = [] as Set def cnt = results.size() for (i=0;i<cnt-1;i++) { items << results[i][0] } items = items as List

    Read the article

  • Prevent Session from being created In some cases

    - by Jean Barmash
    In my app, I have an external monitor that pings the app ever few minutes and measures its uptime / response time Every time the monitor connects, a new server session is created, so when I look at the number of sessions, it's always a minimum of 15, even during times where there are no actual users. I tried to address this with putting the session creation code into a filter, but that doesn't seem to do it - I guess session automatically gets created when the user opens the first page? all() { before = { if (actionName=='signin') { def session = request.session //creates session if not exists } } } I can configure the monitor to pass in a paramter if I need to (i.e. http://servername.com/?nosession, but not sure how to make sure the session isn't created.

    Read the article

  • Modifying object in AfterInsert / AfterUpdate

    - by Jean Barmash
    I have a domain object that holds results of a calculation based on parameters that are properties of the same domain object. I'd like to make sure that any time parameters get changed by the user, it recalculates and gets saved properly into the database. I am trying to do that with afterInsert (to make sure calculation is correct in the first place), and afterUpdate. However, since my calculation is trying to modify the object itself, it's not working - throwing various hibernate exceptions. I tried to put the afterUpdate code into a transaction, but that didn't help. I am afraid I am getting into a circular dependency issues here. The exception I am getting right now is: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [esc.scorecard.PropertyScorecard#27] Are the GORM events designed for simpler use cases? I am tempted to conclude that modifying the object you are in the middle of saving is not the way to go.

    Read the article

  • How to get the list of country names in a language (english for instance)?

    - by fabien7474
    Using Java, you can get the list of ISO2 codes through Locale.getISOCountries() (see this related question http://stackoverflow.com/questions/712231/best-way-to-get-a-list-of-countries-in-java). However, I would like to have the list of all country names (in English for example) and not the list of ISO2 country codes. How can I do that by programming in Java or Groovy ? Thank you very much, Fabien.

    Read the article

  • Quering computed fields in GORM

    - by Tihom
    I am trying to query the following HQL using GORM: MailMessage.executeQuery("toId, count(toId) from (SELECT toId, threadId FROM MailMessage as m WHERE receiveStatus = '$u' GROUP BY threadId, toId) as x group by x.toId") The problem is that count(toId) is a computed field doesn't exist in MailMessage and that I am using a subquery. I get the following error: java.lang.IllegalArgumentException: node to traverse cannot be null! Ideally, I would like to use a generic executeQuery which will return data of anytype. Is there such a thing?

    Read the article

  • what is this operator called and what is it used for <=>

    - by Scott
    I recently came across this magical operator when digging into Groovy: <= Groovy has really made me happy with elvis operators ?. and ?: which I use constantly now and very much wish were in Java. With this new operator, I have only found this reference. It seems to make comparators much easier. My question is how does it handle null values and how does it compare non Comparable object. Does this operator have a name, I couldn't find it Googling.

    Read the article

  • Can a webflow's action state have multiple redirects on success?

    - by callie16
    Say, I have this type of webflow: def myFlow = { state1 { } on("next").to("stateAct") stateAct { action { ... DB stuff ... } } on("success").to("state2") state2 { } on("prev").to("state1") } Now, the contents of "stateAct" is common between state1 and state2. Meaning, if I press "next" from state1, I need to pass by stateAct before I can go to state2 (which is the current implementation) and if I press "prev" in state2, I need it to pass by stateAct before it goes to state1. Obviously, in the sample webflow above, it doesn't do the latter. So, my question is, is there a way to detect in stateAct who called it (state1 or state2) so that I can redirect accordingly on "success"? Or something similar to that behavior? Thanks! -Lee

    Read the article

  • How to render or include files/data in bootstrap.groovy?

    - by skurt
    I want to use some parts of code in different area of bootstrap.groovy. How do I "include" these parts and reuse it? def init = { environments { production { include("bla.groovy) include("blaFoo.groovy) } test { include("blaFoo.groovy) } development { include("bla.groovy) include("bla1.groovy) include("blaFoo.groovy) } } }

    Read the article

  • How do I branch if message.properties-code exists

    - by skurt
    I want to branch if a message-property-code does exist or not. <g:if test="${message(code: 'default.code.foo')}"> true </g:if><g:else> false </g:else> should answer true if there a message property named default.code.foo and false if not. It fails because it answers the code if there is no property for it.

    Read the article

  • Keeping track of the action before a login?

    - by soybie
    I'm trying to do the following: User can vote for an item (controller: item, action: vote) 2a. If the user is logged in, then vote action goes through. 2b. If user is not logged in, then user needs to log in/creates an account (handled by user controller), then vote action goes through. How do I do 2b such that once the user logs in/creates account, the vote action automatically goes through without having the user vote for the item again?

    Read the article

  • Parsing in groovy between two tags ?

    - by fabien-barbier
    I would like to parse this Gstring with groovy : Format type : CodeClass, Name, Accession, Count. def txt = """ <Lane_Attributes> ID,1 FovCount,600 FovCounted,598 ... </Lane_Attributes> """ And get a map like : Map = [ID:1, FovCount:600, FovCounted:598] How can I : - extract text between tag and ?, - and convert to a map ?

    Read the article

  • database deign advice wanted: double data entry

    - by john
    hi, I'm designing a database for capturing clinical trial data. The data are entered twice by two persons, independently and the results must be matched. What are the best database tools to use to achieve the best results. Any one has similar experiences? Your helps are highly appreciated. thanks.

    Read the article

  • Utilisez-vous Grails, le framework Web écrit via le langage Groovy ? Venez partager votre expérience

    Grails en est actuellement à la version 2.1. Initié en 2005, ce framework écrit avec le langage Groovy en est donc à sa 7ème année d'existence. Nous aimerions avoir votre avis sur ce framework Web basé sur le patron de conception Modèle-Vue-Contrôleur. Vous pourriez par exemple insister sur :depuis quand vous l'utilisez, votre satisfaction, le soutien de la communauté, évolution des versions, l'apprentissage du langage Groovy. Merci pour votre participation. L'équipe Java...

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26  | Next Page >