Posts

ruby on rails - how to check if parent exists in has many relation -

i have 3 models: user: has_many :comments video: has_many :comments comment: belongs_to :video, :user videos/show.html.erb <%= form_for(@comment, :method => :post ) |f| %> <%= f.text_area :body %> <%= f.hidden_field :video_id, :value =>"4" %> <%= f.submit "submit" %> <% end %> comments_controller def create @comment = comment.new(params[:comment].merge(:user_id => current_user.id)) @comment.save end how can check existence of video before create comment? this should present validation in comment model. class comment < activerecord::base validates_presence_of :video

jquery - Drop down slide menu for iPhone web app -

i'm creating iphone web app , want add drop down menu in top menu bar preserve page space. how menu slide? have list items in unordered list in div. have jquery installed can use that. check out this link filament group.

groovy - grails spring-security-core plugin does not make under intellij idea 9/10 -

i've been playing grails framework lately idea , has gone until stalled spring-security-core grails plugin. plugin , project work fine when using grails compile/run-app/etc, intellij idea (9) no longer able "make" project, giving me errors: steps: grails create-app my-app grails install-plugin spring-security-core import my-app grails project click make this produces errors similar following... $home\.grails\1.3.6\projects\macs\plugins\spring-security-core-1.1\src\java\org\codehaus\groovy\grails\plugins\springsecurity\ipaddressfilter.java cannot find symbol variable reflectionutils this error repeated several java class files reference reflectionutils groovy class file org.codehaus.groovy.grails.plugins.springsecurity.reflectionutils in same package, found in spring-security-core/src/groovy directory (as opposed spring-security-core/src/java) the ide source parser seems resolve things correctly, there no red marks littering file, , navigation finds fi...

javascript - jQuery parents then locate a div to hide -

ok, i've got .parents() function goes outside located class/id. in case, (.wrapper). <div class="wrapper"> <div class="hide">hide class</div> <div class="boxclass></div> </div> i've got list of these div's on single page, so, if click "hide class" text, fadeout, since in list, has same class name. now, question. use .parents() locate (.wrapper) (i know can done (.parent)). how can use .parents go , select (fadeout) class inside it? ex, boxclass? in case, they're siblings, use siblings() (docs) method in handler. $(this).siblings('.boxclass').fadeout(); or if they're not siblings, use closest() (docs) method find() (docs) method. $(this).closest('.wrapper').find('.boxclass').fadeout(); inside handler this represents element invoked handler. such, direct reference specific .hide element clicked.

vsto - How to programmatically use Word's "Compare and Merge Documents..." functionality from C#? -

question is possible call word 2003's tools > compare , merge documents..." function c# , feedback whether differences found or not? what have found far it possible call functionality this. don't know how feedback whether differences found. private void compareandmergewithfileb(string fullfilepath) { string filename = fullfilepath; object mergetarget = wdmergetarget.wdmergetargetselected; object detectformatchanges = false; object useformattingfrom = wduseformattingfrom.wdformattingfromprompt; object addtorecentfiles = true; word.activedocument.merge(filename, mergetarget, detectformatchanges, useformattingfrom, addtorecentfiles); } absolutely. once merge complete, work revisions collection extract details changes.

maven 2 - What Maven2 plugins are available for JAXB2? -

i'd generate java source code xml schema file using jaxb2 via maven2 plugin (as in this blog post ). there seem 2 maven plugins jaxb: "maven 2 jaxb 2.x plugin" (org.jvnet.jaxb2.maven2:maven-jaxb2-plugin) hosted @ java.net, , "maven jaxb 2.1 plugin" (org.codehaus.mojo:jaxb2-maven-plugin) hosted @ codehaus. it seems me 1 @ java.net has more features, xjc plugins. java.net page refers highsource.org documentation, unfortunately seems unavailable recently. so what's best choice? know what's going on highsource.org? what's else using? i found following working enough system. <plugin> <groupid>org.jvnet.jaxb2.maven2</groupid> <artifactid>maven-jaxb2-plugin</artifactid> </plugin>

eclipse - Do I need to prevent caching on Android emulator? -

i using phonegap develop cross-device (simple) applications, , using eclipse android emulator. problem encountering not appear code changes reflected application installed on emulator. have tried uninstalling application emulator, cleaning , re-building within eclipse, neither of has worked. is there manual script need run re-install .apk? newbie @ mobile development, please bear me. :) eclipse should automatically rebuild application if option activated. take @ project -> build automatically the adt should reinstall application if run project. take @ console (not logcat) of eclipse, should see information reinstalling application (at least thats when deploy on device). if want try if change made, try use log statement change have feeling not current version. can find out if @ least deploy worked. if nothing of helped, should dig deeper...