Search Results

Search found 1512 results on 61 pages for 'ryan french'.

Page 49/61 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • Encoding problem using Spring MVC

    - by Makis Arvanitis
    Hi all, I have a demo web application that creates users. When I try to insert data in other languages (like french) the characters are not encoded correctly. The code on the controller is: @SuppressWarnings("unchecked") @RequestMapping(value = "/user/create.htm", params={"id"}, method = RequestMethod.GET) public String edit(@RequestParam("id") Long id, ModelMap model) { System.out.println("id is " + id); User user = userService.get(id); model.put("user", user); return "user/create"; } @RequestMapping(value = "/user/create.htm", method = RequestMethod.POST) public String save(@ModelAttribute("user") User user, BindingResult result) { System.out.println(user.getFirstName()); System.out.println(user.getLastName()); validator.validate(user, result); if(result.hasErrors()) { return "user/create"; } userService.save(user); return "redirect:list.htm"; } my web.xml is: ... <filter> <filter-name>encoding-filter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding-filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> ... and the page is: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> ... <form:form method="post" commandName="user"> ... <form:input path="firstName" cssErrorClass="form-error-field"/> ... when I enter some french characters in the first name then the output from the system.out.println is ????+????? or something similar. I saw other people fixing this with the CharacterEncodingFilter but this doesn't seem to work. Thanks a lot. Edited the filter value.

    Read the article

  • Event handle in drop-down menu.

    - by QLiu
    Hello fellows, I am trying to develop a dynamic drop down menu by a customized widget style The custom widget has two main features: Read user's location cookies variable to set the proper contact phone number in the CP pages When users select on the drop down menu, it triggers onChange event, it re-select the contact phone number based on users' selections, but it won't reset the location cookies. My widgets conatins two files: Controller.php: Simply one, it uses to handle get cookies variables class serial extends Widget { function __construct() { parent::__construct(); } function generateWidgetInformation() { $this->info['notes'] = "Serial Number search Box"; } function getData() { //Get cookies code will go here, and pass to view.php $this->data['locale'] = 'gb';// for test purpose now } } view.php is about Presentation layer contains HTML, which get the data from my controller <div style="border: 1px solid black; display: block;" id="<?=$this->instanceID;?>"></div> <script>locale2contact('<?=$this->data['locale']?>', '<?=$this->instanceID;?>');</script> And then the Javascript function, call locale2contact var element_id =''; //Define Global Variables, //Receive the cookies locale, and instance id from view.php function locale2contact(locale, instance_id) { var details = ''; this.element_id=instance_id; //assing the instance id into global variable // alert(instance_id); //Check whether we got the instance id from view files if (locale == 'gb') details = 'UK Contact Details<br>' + build_dropdown(locale); else if (locale == 'fr') details = 'French Contact Details<br>'+build_dropdown(locale); else if (locale == 'be') details = 'Belgian Contact Details<br>'+ build_dropdown(locale); else details = 'Unknown Contact Detail'; writeContactInfo(details); } //Build the drop down menu with pre-selected option by using cookies. function build_dropdown(locale) { var dropdown = '<select onChange=changeContactInfo(this.options[selectedIndex].text)>'; dropdown += '<option' + (locale == 'gb' ? ' selected' : '') + '>UK</option>'; dropdown += '<option' + (locale == 'be' ? ' selected' : '') + '>Belgium</option>'; dropdown += '</select>'; return dropdown; } // Not smart way in here, once the people select the drop down box, it reselect the drop down menu and reset the contact info function changeContactInfo(selected) { var details =''; //alert(this.element_id); //alert(locale); if (selected == 'UK') details = 'UK Contact Details<br>' + build_dropdown2(selected); else if (selected == 'fr') details = 'French Contact Details<br>'+ build_dropdown2(selected); else if (selected == 'Belgium') details = 'Belgian Contact Details<br>'+ build_dropdown2(selected); else details = 'Unknown Contact Detail'; writeContactInfo(details); } //Build the drop down menu function build_dropdown2(selected) { var dropdown = '<select onChange=changeContactInfo(this.options[selectedIndex].text)>'; dropdown += '<option' + (selected == 'UK' ? ' selected' : '') + '>UK</option>'; dropdown += '<option' + (selected == 'Belgium' ? ' selected' : '') + '>Belgium</option>'; dropdown += '</select>'; return dropdown; } //Back to view function writeContactInfo(details) { document.getElementById(this.element_id).innerHTML = details; //update the instance field in view } Javascript function is not efficient. As you see, I got two similar duplicate functions to handle events. Users go to the page, the widget read the cookies variable to display contact info (locale2contact)and preselect the drop-down menu (function build_dropdown) If users select the drop down menu, the displya contact info change (function changeContactInfo), and then I need to rebuild the drop down menu with user previously selection (function build_dropdown2). I am looking for best practices for adding this functionality to RightNow widget. Thank you. I really do not like the way i am doing now. It works; but the code looks bad.

    Read the article

  • Problem running Thinking Sphinx with Rails 2.3.5

    - by benoror
    Hi, I just installed Sphinx (distro: archlinux) downloading the source. Then I installed "Thinking Sphinx" plugin for Rails. I followed the official page setup and this Screencast from Ryan Bates, but when I try to index the models it gives me this error: $ rake thinking_sphinx:index (in /home/benoror/Dropbox/Proyectos/cotizahoy) Sphinx cannot be found on your system. You may need to configure the following settings in your config/sphinx.yml file: * bin_path * searchd_binary_name * indexer_binary_name For more information, read the documentation: http://freelancing-god.github.com/ts/en/advanced_config.html Generating Configuration to /home/benoror/Dropbox/Proyectos/cotizahoy/config/development.sphinx.conf sh: indexer: command not found I tried starting the daemon manually (/usr/bin/sphinx-searchd), changing the config/sphinx.yml file: devlopment: searchd_binary_name: sphinx-searchd indexer_binary_name: sphinx-indexer But it shows the same error, any ideas ?

    Read the article

  • _mask and Rails

    - by Eric Koslow
    So I am trying to get the cancan gem to work with my rails 3 app and I've hit a problem. I tried to copy the code that Ryan Bates (the creator of the gem) used in his screen cast, but I get an error saying that roles_mask is not a method. I figure that the _mask method was removed from Ruby/Rails at some point, and I'm now wondering what is the replacement. Here's the code in my user.rb model: named_scope :with_role, lambda { |role| {:conditions => "roles_mask & #{2**ROLES.index(role.to_s)} > 0 "} } ROLES = %w[admin student principal admissions] def roles=(roles) self.roles_mask = (roles & ROLES).map { |r| 2**ROLES.index(r) }.sum end def roles ROLES.reject { |r| ((roles_mask || 0) & 2**ROLES.index(r)).zero? } end def role? roles.include? role.to_s end def role_symbols roles.map(&:to_sym) end I'm using Rails 3 and Ruby 1.9.2dev Thank you

    Read the article

  • Python Instance Variable as Default Parameter

    - by DuneBug
    Hello, I have am writing a Python function that takes a timeout value as a parameter. Normally, the user will always use the same timeout value, but on occasion he may want to wait slightly longer. The timeout value is stored as a class instance variable. I want to use the class' timeout instance variable as the default parameter. Currently, I am implementing this as follows: def _writeAndWait (self, string, timeout = -1): if (timeout == -1): timeout = self._timeout I was just wondering, is the proper way to use an instance variable as a default parameter? Or is there a better way that would avoid the "if" check? Thanks, Ryan

    Read the article

  • Any working tutorials for Authlogic?

    - by Mark Wilbur
    I've been trying to build my first rails app and have gotten stuck on the issue of user authentication. I've found a number of tutorials for using various plug-ins to do this, but so far every single one of them is out-dated, and as a result, broken! From what I've read, I think Authlogic may be the best fit for me, and I've tried two things: 1) Going through Railscast, episode #160 (which is a tutorial for setting it up) 2) Using Ryan B's nifty_authentication gem with the --authlogic tag In both cases, I get the following error as soon as I try to do anything with a user: undefined local variable or method `acts_as_authentic' for # I believe this is from the User model: class User < ActiveRecord::Base acts_as_authentic end I'm sure I've installed the authlogic gem, and I've added config.gem "authlogic" to my environment.rb Any ideas about what's wrong? Anybody know of a complete and up to date tutorial for adding user authentication?

    Read the article

  • How to show an animated spinner while a background task is processing in nested rails model using aj

    - by Globalkeith
    My specific example is highly complex, so I will use the example shown by Ryan from Railscasts to discuss this: http://railscasts.com/episodes/197-nested-model-form-part-2 Background I have a form, let's say "Survey", which contains an arbitrary number of "Questions". Senario Give i am on the "Edit Survey" page. I would like to add a button to each "Question" field which calls a remote_function, which in turn queue's up a delayed_job to execute some processing on the "Question". To give feedback to the user, i would like to disable the button, and show an animated spinner, which remains until the delayed_job has processed the "Question". Hint - I can add methods to the "Question" model to indicate the status of the delayed_job. So, with best practices in mind, what is the best way to achieve this?

    Read the article

  • Is there a way to undo Mocha stubbing of any_instance in Test::Unit

    - by Craig Walker
    Much like this question, I too am using Ryan Bates's nifty_scaffold. It has the desirable aspect of using Mocha's any_instance method to force an "invalid" state in model objects buried behind the controller. Unlike the question I linked to, I'm not using RSpec, but Test::Unit. That means that the two RSpec-centric solutions there won't work for me. Is there a general (ie: works with Test::Unit) way to remove the any_instance stubbing? I believe that it's causing a bug in my tests, and I'd like to verify that.

    Read the article

  • What's a good tutorial for creating a gem with RSpec?

    - by ramon.tayag
    I've been searching around for ways to create a gem with RSpec, but haven't found descriptive tutorials. I started out with Ryan Bates' Making a gem, but I'm looking for a tutorial that discusses creating an acts_as style gem with RSpec. By acts_as, I mean to say that the gem adds certain methods to an existing class in Rails. Why is this important? Because I've found gem templates like New Gem, got a spec to run but when I try to test an Active Record object it starts choking. I've tried requiring active_record in spec_helper.rb but I must be doing something wrong because it doesn't solve the problem. When it comes to plugins, I found this Rails Guide. If there's a gem version for that around that'd be awesome. Thanks guys! P.S. I love screencasts.

    Read the article

  • InnoSetup Uninstall Ask Message - Pascal Coding

    - by ryu
    I have created an installer for some of my games and I want the uninstaller to ask me if I want to save my game files. Something like this: when I execute the uninstall.exe to ask me 'Do you want to keep all saved games?' YES or NO. If I hit YES my save files remain and my program files are uninstalled and if I hit NO my program files inclusive save files to be uninstalled. What is the PASCAL code for InnoSetup to do this? Thank you very much! Best regards, Ryan

    Read the article

  • Using Unix Process Controll Methods in Ruby

    - by John F. Miller
    Ryan Tomayko touched off quite a fire storm with this post about using Unix process control commands. We should be doing more of this. A lot more of this. I'm talking about fork(2), execve(2), pipe(2), socketpair(2), select(2), kill(2), sigaction(2), and so on and so forth. These are our friends. They want so badly just to help us. I have a bit of code (a delayed_job clone for DataMapper that I think would fit right in with this, but I'm not clear on how to take advantage of the listed commands. Any Ideas on how to improve this code? def start say "*** Starting job worker #{@name}" t = Thread.new do loop do delay = Update.work_off(self) break if $exit sleep delay break if $exit end clear_locks end trap('TERM') { terminate_with t } trap('INT') { terminate_with t } trap('USR1') do say "Wakeup Signal Caught" t.run end end

    Read the article

  • Rails, using jQuery without jrails

    - by ibuck
    Hello all, I have been trying to convert my rails 2.2.2 app over to jQuery, and would like so without using jrails. The only reference material I can find on the subject is Railscasts Episode 136. Ryan goes over how to use jQuery to post a form and handle the response in a .js.erb file. My questions is has anyone tried to use jQuery with .js.erb files with anchors as the trigger? As a replacement for "link_to_remote". I have gotten jQuery to do a .get to submit this link on click to the controller, but I cannot seem to get it to go into the .js.erb file. Thanks

    Read the article

  • Eclipse and Cassandra

    - by H2oNinja
    I've searched various websites for instructions on how to link 'Cassandra' and 'Eclipse' and followed directions to the last detail in several sites. For some reason, while using Git Bash, I cant get through the 'ant build', via instruction in said mentioned locations across the web. In some location's its easy, just make sure you have; 1. Apache Cassandra source 2. Apache Ant 3. Git So, yeah I've downloaded all the above, tried the same directory, different directories, etc., although still unable to get past the middle step of 'ant build'. Here are a few websites I've used to muddle through setting up the Src code for both utilities, 'Eclipse' and 'Cassandra'. http://uisurumadushanka89.blogspot.com/2012/02/apache-cassandra-how-to-setup-source.html and http://wiki.apache.org/cassandra/RunningCassandraInEclipse both resulting in an immediate halt at the 'ant build'. any insights are information is greatly appreciated. Thank-you, Ryan

    Read the article

  • C 64-bit Pointer Alignment

    - by DuneBug
    Are pointers on a 64-bit system still 4 byte aligned (similar to a double on a 32 bit system)? Or are they note 8 byte aligned? For example, on a 64-bit system how big is the following data structure: struct a { void* ptr; char myChar; } Would the pointer by 8 byte aligned, causing 7 bytes of padding for the character (total = 8 + 8 = 16)? Or would the pointer be 4 byte aligned (4 bytes + 4 bytes) causing 3 bytes of padding (total = 4 + 4 + 4 = 12)? Thanks, Ryan

    Read the article

  • Rails plugin for generating dynamic / ajax crud interfaces compatible with Rails 3 beta?

    - by mikehansen
    Anyone know of some good gems or plugins to create dynamic / ajax crud interfaces for Rails 3 projects? I know active scaffold was popular before and it's been awhile since I have used it / any other gems similar to this (I usually just write it myself). I like the direction that the formtastic gem (http://github.com/justinfrench/formtastic) is headed and wonder what else people are combining with it. Also I like the generators approach that Ryan Bates uses and he appears to be making updates for Rails 3. Anything else I am missing here? (I am also open to gems not compatible with Rails 3 too I guess, I can always make a contribution and try to help them get to the next phase. ;)) PS - Really stackoverflow, only one hyperlink?? lame.

    Read the article

  • Extracting a Rails application into a plugin or engine

    - by Globalkeith
    I have a Rails 2.3 application which I would like to extract into a plugin, or engine. The application has user authentication, and basic cms capabilities supported by ancestry plugin. I want to extract the logic for the application into a plugin/engine so that I can use this code for future projects, with a different "skin" or "theme" if required. I'm not entirely sure I actually understand the difference between plugin and engine concepts, so that would be a good first point. What is the best approach, are there any good starting points, links, explanations, examples that I should follow. Also, with the release of R3 to consider, is there anything that I should be aware of for that, with regards to plugins etc. I am going to start off by watching Ryan's http://railscasts.com/episodes/149-rails-engines but obviously thats over a year old now, so one of the challenges I'm faced with is finding the most up to date and relevant information on this subject. All tips and help gratefully received.

    Read the article

  • Changing background image on accordion change - jQuery Ui

    - by Coughlin
    I am using this code: $('.ui-accordion').bind('accordionchange', function(event, ui) { $(this).next().next().css({'background-image':'images/green-bg.jpg'}); //ui.newHeader // jQuery object, activated header //ui.oldHeader // jQuery object, previous header // ui.newContent // jQuery object, activated content // ui.oldContent // jQuery object, previous content }); To try to change the background image of the PREVIOUS header after it changes. I see that the jquery docs supply the object for oldHeader, but I am trying to change the CSS of that element. Any ideas how I would do that? So You go to the next one it goes green, then the current one is going to be red. Thanks, Ryan

    Read the article

  • GUI design techniques to enhance user experience

    - by aku
    What techniques do you know\use to create user-friendly GUI ? I can name following techniques that I find especially useful: Non-blocking notifications (floating dialogs like in Firefox3 or Vista's pop-up messages in tray area) Absence of "Save" button MS OneNote as an example. IM clients can save conversation history automatically Integrated search Search not only through help files but rather make UI elements searchable. Vista made a good step toward such GUI. Scout addin Microsoft Office was a really great idea. Context oriented UI (Ribbon bar in MS Office 2007) Do you implement something like listed techniques in your software? Edit: As Ryan P mentioned, one of the best way to create usable app is to put yourself in user's place. I totally agree with it, but what I want to see in this topic is specific techniques (like those I mentioned above) rather than general recommendations.

    Read the article

  • jQuery Click event on object added with JavaScript not working.

    - by Hultner
    I'm work on a quiz for school but I've bumped into a problem. I got a javascript file for custom radio buttons (CUSTOM FORM ELEMNTS by Ryan Fait if it's helping). The script hides the input buttons and adds custom styled spans instead. Now what I want, when I click one of these JavaScript added spans I want to remove disabled for a button called "Next Question" which when pressed takes you to the next question. The reason for this is that I don't want people to accidently got to the next question without choosing a answer. The problem is when I press the added spans nothing happens but when I press another identical span which I have added in the html it works just as intended. The span got the class radio which is the class I'm looking for in the jQuery. Here's the test page with the error on: http://hultner.se/graphicsquiz/livetest/livetest.php Short: Can't get jQuery .click() functions to work with spans added using JavaScript earlier in the document.

    Read the article

  • Adjust Title Helper in Ruby on Rails Tutorial 3.2 to deal with & properly

    - by memoht
    I am using the title helper from the 3.2 edition of the Ruby on Rails Tutorial by Michael Hartl and just realized a snag with the & character showing up in the title as &Amp instead. The relevant snippet of code is here Official Sample App 2nd Edition The problem. I have a School model and am using the School name on the Show view as follows: <% provide(:title, @school.name) %> If my School has a & in the name, it is being replaced with &Amp in the browser title. Ryan Bates Railscasts site has a similiar title helper that solves this issue this way but it is using content_for instead of provide. Trying to adjust the Rails Tutorial helper, but having trouble getting it work properly. Works great expect for this issue.

    Read the article

  • Is there a way to undo Mocha stubbing of any_instance?

    - by Steve Weet
    Within my controller specs I am stubbing out valid? for some routing tests, (based on Ryan Bates nifty_scaffold) as follows :- it "create action should render new template when model is invalid" do Company.any_instance.stubs(:valid?).returns(false) post :create response.should render_template(:new) end This is fine when I test the controllers in isolation. I also have the following in my model spec it "is valid with valid attributes" do @company.should be_valid end Again this works fine when tested in isolation. The problem comes if I run spec for both models and controllers. The model test always fails as the valid? method has been stubbed out. Is there a way for me to remove the stubbing of any_instance when the controller test is torn down. I have got around the problem by running the tests in reverse alphabetic sequence to ensure the model tests run before the controllers but I really don't like my tests being sequence dependant.

    Read the article

  • What would you use for auto completion in Rails app?

    - by Andrei
    I want to use auto-completion in a number of fields (5-7) in my forms. There is a screencast on auto-completion with Prototype library by Ryan Bates ( http://railscasts.com/episodes/102-auto-complete-association). On the other hand, I have noticed that quite many guys suggest jQuery for this task ( http://jquery.bassistance.de/autocomplete/demo/). And I guess, there was probably some development last year(s), so I ask you - what would you use nowadays to auto-complete your form fields and why? BTW, I still have an open question on auto completion for HABTM association: http://stackoverflow.com/questions/1510935/how-to-do-habtm-management-with-auto-completion-in-rails

    Read the article

  • Modal windows plugin to rails

    - by VP
    Hi, I'm starting to digg some rails plugins to create modal forms in rails. Almost all documents that you find are too old (2006,2007) or more focused in php. I would like to create a "feedback" tab that when you click on that, it opens a form. For example, you can check the railscast website, http://railscasts.com/. Ryan Bates made it in his website, but didnt make any screencast about it. any idea/tip about a rails plugin to work with jquery and to do those forms?

    Read the article

  • Simple rails routing / url question

    - by justinbach
    I'm using Ryan Bates' nifty authentication in my application for user signup and login. Each user has_many :widgets, but I'd like to allow users to browse other users' widgets. I'm thinking that a url scheme like /username/widgets/widget_id would make a lot of sense--it would keep all widget-related code in the same place (the widgets controller). However, I'm not sure how to use this style of URL in my app. Right now my codebase is such that it permits logged-in users to browse only their own widgets, which live at /widgets/widget_id. What changes would I need to make to routes.rb, my models classes, and any place where links to a given widget are needed? I've done Rails work before but am a newb when it comes to more complicated routing, etc, so I'd appreciate any feedback. Thanks for your consideration!

    Read the article

  • Rails routing: how to mix "GET" and "PUT"

    - by thermans
    Not sure how to frame this question (I'm still wrapping my head around Rails). Let's try this: Say I wanted to implement the user side of Ryan Bates' excellent railscast on nested models. (He shows how to implement a survey where you can add and remove questions and answers dynamically). I want the user's side of this: to be able to answer questions and, not in the tutorial, be able to add comments. It seems to me that you have to implement a view that shows the questions and answers, allow selection of the answers, and the input of comments. So there would need to be a way to show the information, but also update the model on input, right? I know I'm not explaining this very well. I hope you understand what I'm getting at. Is it just a question of setting up the right routes? Or is there some controller mojo that needs to happen?

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >