Daily Archives

Articles indexed Friday March 19 2010

Page 5/124 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • fresh_when in ruby not working with xml rendering

    - by Guilherme Silveira
    While trying to implement support for conditional GETting in a rest system, we have come across the fresh_when and stale? methods. The following code works fine with 304 and not further rendering: if stale?(:etag = resource, :last_modified = resource.updated_at.utc) respond_to do |format| format.html # show.html.erb } end end But accessing 1.xml will try to render the resource twice: if stale?(:etag => resource, :last_modified => resource.updated_at.utc) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @order.to_xml(:controller => self, :except => [:paid_at]) } end end The error message: ActionController::DoubleRenderError in OrdersController#show Can only render or redirect once per action RAILS_ROOT: /Users/guilherme/Documents/ruby/restfulie-test Application Trace | Framework Trace | Full Trace /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:900:in render_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:51:in render' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in ms' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:10:in realtime' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in ms' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:51:in render' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in send' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in perform_action_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:617:in call_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:610:in perform_action_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in ms' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:10:in realtime' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in ms' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/rescue.rb:160:in perform_action_without_flash' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/flash.rb:146:in perform_action' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in send' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in process_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:606:in process' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:391:in process' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:386:in call' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:437:in `call' Any suggestions? Regards

    Read the article

  • How can I tell if the screen is on in android?

    - by user297020
    In Android 2.2 (Level 7) the function PowerManager.IsScreenOn() returns a boolean that is true if the screen is turned on and false if the screen is turned off. I am developing code for Android 1.5 (Level 3). How do I accomplish the same task in older versions of Android? I do not want to turn the screen on or off in my code. I just want to know what it is.

    Read the article

  • Bypass all cacheing on jQuery.autocomplete(1.02)

    - by technicalbloke
    I am using jQuery.autocomplete(1.02) on my search box and I want exact string and substring matching. I don't care (yet!) about the database load, I'm happy for it to fire off a query every keystroke and bypass the caching entirely - I just don't want anything missed. To this end I have tried setting cacheLength=1, the minimum permitted, but the autocomplete function refuses to fire off a GET request for each key up. searchbox GET_request 'a' -> http://localhost/service_search_request?q=a 'ar' -> http://localhost/service_search_request?q=ar 'ars' -> http://localhost/service_search_request?q=ars Instead, it sends the first and the third and misses the second, giving me the wrong results for 'ar' :-/ I've cleared my cache and sessions but it looks like some sort of caching is still going on. AFAIK I have no proxying going on and I'm shift-refreshing each time. It looks likely then that this behavior is from jQuery.autocomplete itself. So my questions are... A) Does this seem likely? i.e. is it a feature, or maybe a bug? B) If so is there a clean way around it?... C) If not, what autocomplete would you use instead? Naturally D) No you're just using it incorrectly you douche! is always a possibility, and indeed the one I'd prefer having spent time going down this road - assuming it comes with a link to the docs I've failed to find / read! Cheers, Roger :)

    Read the article

  • Facebook status update URL

    - by dandu
    Does Facebook provide a URL the user can access that will take him to his profile page with the "What's on your mind" box auto completed with a value provided in the URL? I need something like "http://facebook.com?status=This is my new status message".

    Read the article

  • How to return a complex object from an axis web service

    - by jani
    Hi all, I am writing a simple web service to return an object with 2 properties. I am embedding the service into an existing web application. My wsdd looks like this. <globalConfiguration> <parameter name="adminPassword" value="admin"/> <parameter name="sendXsiTypes" value="true"/> <parameter name="sendMultiRefs" value="true"/> <parameter name="sendXMLDeclaration" value="true"/> <parameter name="axis.sendMinimizedElements" value="true"/> <requestFlow> <handler type="java:org.apache.axis.handlers.JWSHandler"> <parameter name="scope" value="session"/> </handler> <handler type="java:org.apache.axis.handlers.JWSHandler"> <parameter name="scope" value="request"/> <parameter name="extension" value=".jwr"/> </handler> </requestFlow> </globalConfiguration> <handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/> <handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/> <handler name="Authenticate" type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/> <transport name="http"> <requestFlow> <handler type="URLMapper"/> <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/> </requestFlow> </transport> <transport name="local"> <responseFlow> <handler type="LocalResponder"/> </responseFlow> </transport> <service name="helloService" provider="java:RPC" style="document" use="literal"> <parameter name="className" value="ws.example.HelloService"/> <parameter name="allowedMethods" value="*"/> <parameter name="scope" value="application"/> </service> I am able to deploy it successfully. If I try to invoke the method which returns a String, it is successfully returning the String. But when I invoke the method which returns an object, I am getting the following error. AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: org.xml.sax.SAXParseException: Premature end of file. faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Premature end of file. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(SAXParser.java:395) at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696) at org.apache.axis.Message.getSOAPEnvelope(Message.java:424) at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2765) at org.apache.axis.client.Call.invoke(Call.java:2748) at org.apache.axis.client.Call.invoke(Call.java:2424) at org.apache.axis.client.Call.invoke(Call.java:2347) at org.apache.axis.client.Call.invoke(Call.java:1804) at ws.example.ws.HelloServiceSoapBindingStub.getAwardById(HelloServiceSoapBindingStub.java:202) at Test.main(Test.java:21) Can any body help?

    Read the article

  • Any experiences using SharpDevelop to build an ASP.NET MVC app?

    - by Sosh
    I've always used VS for .NET development, but am just wondering about the alternatives around now. I'm especially interested in use for ASP.NET MVC development. I'm not bothered about any of the visual design aspects of vs, but of course love intellisense and the debugging features. So, for anyone who has tried SharpDevelop when doing ASP.NET MVC: How did you get on? What are the main disadvantages and pain points? Thanks

    Read the article

  • IIS7 ISAPI Filter Module & HttpModule Events - How do they line up?

    - by MikeGurtzweiler
    So IIS7 in Integrated Pipeline mode uses a IsapiFilterModule to shim ISAPI filter DLL's and fire off the correct "events" on the filters, which is quite different than previous versions of IIS or IIS7 in classic mode because this means that HttpModules fire off right along side ISAPI filters in Integrated Pipeline mode. So does anyone happen to know how ISAPI events (http://msdn.microsoft.com/en-us/library/ms524855.aspx) and the HttpModule events (http://msdn.microsoft.com/en-us/library/ms998536.aspx) line up?

    Read the article

  • How to disable Tcp/Ip settings in windows 7 via GPO?

    - by Akash Kava
    I have enabled following policies, "Prohibit TCP/IP advanced connection" "Prohibit access to properties of components of a LAN connection" "Enable Windows 2000 Network Connections setings for Administrators" after doing all these, all machines running windows xp, 2000 and vista have network settings properties button disabled as expected. However all machines running windows 7 have no effect, I believe there are few more steps, all Windows 7 machines are on domain and we want to control this via Domain Controler's GPO. Please let me know, what I need to do to have Windows 7 disable the properties of network connection, I am not network expert, I read few articles about what new has been added in GPO of windows 7 but I am blank. Everything works fine on Windows XP, Vista, 2003 Server. Only Windows 7 is a problem.

    Read the article

  • Report Builder 2.0 - Creating DataSet - User Not Authorized

    - by Fahad
    Hello, we are currently using SQL Server Reporting Services and we would like to use Report Builder so our customers can create reports themselves. I have created a User on the server. I have added this user to the SQLServerMSSQLUser and SQLServerReportServerUser groups. I have given this User db_datareader access to the required database and to the Reporting Services database. I've also tried giving the User db_owner access to the Reporting Services db's. And on the Report Manager, this User is a System_User, but has all access (every checkbox is checked). When I connect using Report Builder, I can select the Report Model to create a DataSource, but when I try to create a DataSet, I get the following error: An error occurred while connection to datasource 'DataSource1'. The details are: 'User Not Authorized'. Does anyone know what server permissions I forgot to set? I'm assuming it's a Windows permissions issue because I do not see any database login errors in the event logs.

    Read the article

  • Storage and bandwidth for a social network

    - by user38141
    I guess i asked a dumb question earlier. I am fairly new at this. I have a socal network being built in PHP wit MYsql. I was wondering how much bandwidth and storage would allow users to have have 500mins of streaming video and allow them to store photos and videos. Please forgive me. I am not a technology guy and just doing some research as I am learning as I go along.

    Read the article

  • Toggle 1 <div> at a time with Image Changing using JQuery

    - by dg
    Please see this site: http://www.sensationsskin.com/site10/treatments/skin-care.html I've got it working, but am wanting the "+" to change to the "-" (expandbutton-close.gif). I'm using CSS right now to pull up the image, but I think I need to incorporate it into the JQuery code? <script type="text/javascript"> $(document).ready(function(){ //hide the all of the element with class msg_body $(".msg_body").hide(); //toggle the componenet with class msg_body $(".msg_head").click(function(){ if ( $(this).next(".msg_body").is(':visible') ) { $(".msg_body").hide(); } else { $(".msg_body").hide(); $(this).next(".msg_body").slideToggle(450); } }); }); </script>

    Read the article

  • building jquery checkbox - can't set checked value

    - by benpage
    this seems straightforward enough, I don't know if it's a bug, or just something I'm doing wrong. What I want to do is build a checkbox input in jquery, then return the string of the input. I have this code: var obj = $('<input>'); obj.attr('disabled', 'disabled'); obj.attr('type', 'checkbox'); obj.attr('checked', 'checked'); // this does not work! no matter how i try to render this obj, the 'checked' attribute never gets outputted. So I have tried: $('<div>').append(obj).remove().html(); and it returns: <input type="checkbox" disabled="disabled" /> I have tried setting an id attribute, it makes no difference. I have also tried this but it doesn't work: obj.attr('checked', true); Any suggestions on how to get the input tag rendered with the checked attribute set to 'checked' (via jquery)? I realise I can just do this with string concatenation, but now I really want to know why it's not working the way it should.

    Read the article

  • How to get iPhone, not iPad view in Interface Builder

    - by dbonneville
    At first, I was not able to build a new blank project to iPhone using the new XCode 3.2 beta. I edited the project settings and was able to build the blank app to iPhone simulator. However, when I open the nib for the project in IB and click the view, it opens an iPad size view. How do I get the right sized view to work on in IB?

    Read the article

  • Actionscript: Why is drawRoundRectComplex() not documented?

    - by Chunk1978
    in studying actionscript 3's graphics class, i've come across the undocumented drawRoundRectComplex() method. it's a variant of drawRoundRect() but with 8 parameters, the final four being the diameter of each corner (x, y, width, height, top left, top right, bottom left, bottom right). //example var sp:Sprite = new Sprite(); sp.graphics.lineStyle(1, 0x000000); sp.graphics.drawRoundRectComplex(0, 0, 100, 50, 10, 20, 0, 10); addChild(sp); this seems to be a pretty useful method, so i'm just curious if anyone knows of any reasons why adobe chose not to document it?

    Read the article

  • How do I Handle Ties When Ranking Results in MySQL?

    - by Laxmidi
    Hi, How does one handle ties when ranking results in a mysql query? I've simplified the table names and columns in this example, but it should illustrate my problem: SET @rank=0; SELECT student_names.students, @rank := @rank +1 AS rank, scores.grades FROM student_names LEFT JOIN scores ON student_names.students = scores.students ORDER BY scores.grades DESC So imagine the the above query produces: Students Rank Grades Al 1 90 Amy 2 90 George 3 78 Bob 4 73 Mary 5 NULL William 6 NULL Even though Al and Amy have the same grade, one is ranked higher than the other. Amy got ripped-off. How can I make it so that Amy and Al have the same ranking, so that they both have a rank of 1. Also, William and Mary didn't take the test. They bagged class and were smoking in the boy's room. They should be tied for last place. The correct ranking should be: Students Rank Grades Al 1 90 Amy 1 90 George 3 78 Bob 4 73 Mary 5 NULL William 5 NULL If anyone has any advice, please let me know. Thank you! -Laxmidi

    Read the article

  • Selectively suppress XML Code Comments in C#?

    - by Mike Post
    We deliver a number of assemblies to external customers, but not all of the public APIs are officially supported. For example, due to less than optimal design choices sometimes a type must be publicly exposed from an assembly for the rest of our code to work, but we don't want customers to use that type. One part of communicating the lack of support is not provide any intellisense in the form of XML comments. Is there a way to selectively suppress XML comments? I'm looking for something other than ignoring warning 1591 since it's a long term maintenance issue. Example: I have an assembly with public classes A and B. A is officially supported and should have XML documentation. B is not intended for external use and should not be documented. I could turn on XML documentation and then suppress warning 1591. But when I later add the officially supported class C, I want the compiler to tell me that I've screwed up and failed to add the XML documentation. This wouldn't occur if I had suppressed 1591 at the project level. I suppose I could #pragma across entire classes, but it seems like there should be a better way to do this.

    Read the article

  • Why GWT? Advantages and Trade-Offs of Using This RIA Framework

    - by prometheus
    I'm new to stackoverflow and have been reading through a bunch of the "highest voted" questions for GWT. Several of these questions talk about the pitfalls or problems with GWT. In the articles: Which Javascript framework (jQuery vs Dojo vs … )? and Biggest GWT Pitfalls?, some posters seem to suggest that GWT is not lightweight enough or that there are better alternatives that may be used. Do most of you feel that there are problems with GWT that have not been fixed with GWT 2.0 -- which would make you inclined to suggest using a simpler framework for a new project? To some extent, shouldn't GWT be somewhat future-proof (since you don't have to worry about it changing drastically from release to release and since it is backed by Google)? I realize that the answer to this question depends greatly upon what you want to do or what you wish to make. I am looking at this from the perspective of starting a new web application that will eventually be used by millions of users.

    Read the article

  • Shell loops using non-integers?

    - by mary
    I wrote a .sh file to compile and run a few programs for a homework assignment. I have a "for" loop in the script, but it won't work unless I use only integers: #!/bin/bash for (( i=10; i<=100000; i+=100)) do ./hw3_2_2 $i done The variable $i is an input for the program hw3_2_2, and I have non-integer values I'd like to use. How could I loop through running the code with a list of decimal numbers?

    Read the article

  • Add WhereParameters to LinqDataSource in Selecting event

    - by Steven
    I have a repeater using a LinqDataSource as a data source. When a query string is entered, I'd like to filter the results, but ONLY when a query string is entered. If there is no query string, the results should not be filtered, all results should be returned. I'm trying to add a WhereParameter to my LinqDataSource in the Selecting event of the LinqDataSource, but it's not working. Here's my code: protected void ldsImages_Selecting(object sender, LinqDataSourceSelectEventArgs e) { if (Request.QueryString["id"] != null) { e.WhereParameters.Add("ImageTypeID", Request.QueryString["id"]); } }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >