Search Results

Search found 562 results on 23 pages for 'inspect'.

Page 14/23 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Accessing an API

    - by Paritosh Praharaj
    I'm trying to build a Rails app where I have to access the Zomato API Could anybody guide me on how to create the Controller and View. Suppose I want to get the name of the restaurant from this URL: Restaurant, how do I write the controller and views for it. Currently, I'm using HTTParty gem. This is my controller code: def restaurants @response = HTTParty.get("https://api.zomato.com/v1/restaurant.json/773", :headers => {"X-Zomato-API-Key" => "MYAPIKEY"}) puts response.body, response.code, response.message, response.headers.inspect @categories = Category.where(:category_name => 'Restaurants') end And I'm trying to get the response object in the view: <%= @response.each do |item| %> <td><%= item.id %></td> <td><%= item.name %></td> <td><%= item.url %></td> <% end %> So, this shows the following error: undefined method 'id' for ["id", 773]:Array

    Read the article

  • How do I create and append an image with Javascript/jQuery?

    - by Chris Armstrong
    I'm using the following code to create an image element, load it, then append it to the article on load. $('<img />') .attr('src', 'image.png') //actually imageData[0].url .load(function(){ $('article').append( $(this) ); alert('image added'); }); The alert is firing off ok, but the image doesn't appear, and when I inspect the element it has been added without the closing slash <img src='image.png' > Why is the browser removing the forward slash and how do I stop it?

    Read the article

  • Entity Framework insert error ("The Version field is required.")

    - by Graham
    I am using Silverlight 4 and RIA services. When I try to insert into my database, I get the following error: "Submit operation failed validation. Please inspect Entity.ValidationErrors for each entity in EntitiesInError for more information." Upon inspecting the ValidationErrors, I see: "The Version field is required." Isn't the Version field updated and maintained by the framework? If so, why is it null? If not, how am I supposed to set it?

    Read the article

  • Access to nested methods when DSL

    - by Vyacheslav Loginov
    class Warcraft def initialize &block instance_eval &block end def method_missing name, *args, &block instance_variable_set("@#{name}".to_sym, args[0]) self.class.send(:define_method, name, proc { instance_variable_get("@#{name}")}) end def game &block @game = Game.new &block end class Game def initialize &block instance_eval &block end def method_missing name, *args, &block instance_variable_set("@#{name}".to_sym, args[0]) self.class.send(:define_method, name, proc { instance_variable_get("@#{name}")}) end end end warcraft = Warcraft.new do name "Warcraft III" battle_net :iccup game do side :sentinels hero "Furion" rune_appear_every 2 end end puts warcraft.inspect # => #<Warcraft:0x00000000be3e80 @name="Warcraft III", @battle_net=:iccup, @game=#<Warcraft::Game:0x000000009c6c38 @side=:sentinels, @hero="Furion", @rune_appear_every=2>> How to access nested methods? puts warcraft.battle_net # => iccup puts warcraft.side #=> #<Proc:[email protected]:9 (lambda)> puts warcraft.game #=> dsl.rb:18:in `instance_eval': block not supplied (ArgumentError) puts warcraft.game.side #=> dsl.rb:18:in `instance_eval': block not supplied (ArgumentError)

    Read the article

  • Why is the Twitter Bootstrap "fixed" layout NOT fixed?

    - by leonel
    The Twitter Bootstrap site reads as follows: The default and simple 940px-wide, centered layout for just about any website or page provided by a single <div class="container">. Quote from http://twitter.github.com/bootstrap/scaffolding.html#layouts That's exactly what I have in my HTML but when I inspect the element, I see this CSS apply to it: .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container { width: 1170px; } By the way, if I override that CSS rule by adding... div.container{ width:940px; } Then the elements inside the div.container are wider than the div.container itself and look out of place. So, why is the Twitter Bootstrap "fixed" layout NOT fixed? and how can I make it fixed?

    Read the article

  • How to transfer a post request in curl into a ruby script?

    - by 0x90
    I have this post request: curl -i -X POST \ -H "Accept:application/json" \ -H "content-type:application/x-www-form-urlencoded" \ -d "disambiguator=Document&confidence=-1&support=-1&text=President%20Obama%20called%20Wednesday%20on%20Congress%20to%20extend%20a%20tax%20break%20for%20students%20included%20in%20last%20year%27s%20economic%20stimulus%20package" \ http://spotlight.dbpedia.org/dev/rest/annotate/ How can I write it in ruby? I tried this as Kyle told me: require 'rubygems' require 'net/http' require 'uri' uri = URI.parse('http://spotlight.dbpedia.org/rest/annotate') http = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data({ "disambiguator" => "Document", "confidence" => "0.3", "support" => "0", "text" => "President Obama called Wednesday on Congress to extend a tax break for students included in last year's economic stimulus package" }) request.add_field("Accept", "application/json") request.add_field("Content-Type", "application/x-www-form-urlencoded") response = http.request(request) puts response.inspect but got this error: #<Net::HTTPInternalServerError 500 Internal Error readbody=true>

    Read the article

  • Matlab: How to find the right-most point of a white line within the imrect?

    - by mchlfchr
    i've got a question regarding the imrect() function, which is part of the image processing toolbox in MatLab. I'd like to find a starting point within an image. I use the imrect function for setting a region to limit and specify the lookup area, but I can't get the point where the ROI mask is getting back mapped to the original size of the image. As you can see on the image there is a specified rectangle (cyan-colored), which I want to inspect for the white line, especially the nearest point to the right edge of the rectangle. I experimentated with only looking up on the last column of the rectangle, but as I mentioned before, the re-mapping onto the global image coordinates failed. So in this example, the white point I'd like to get would be around (98,302) The original (x,y) coordinates are relevant, so a cropping of the image to the rectangle is not acceptable. So, do you have any ideas? Thanks for any helping comments. Kind regards,

    Read the article

  • Managing Large Database Entity Models

    - by ChiliYago
    I would like hear how other's are effectively (or not) working with the Visual Studio Entity Designer when many database tables exists. It seems to me that navigating the Designer is tough enough to find what you are looking for with just a few tables but how about a database with say 100 to 200 tables? When a table change is made at the database level how is the model updated? Does it overwrite any manual changes you have made to the model? How would you quickly find an entity in the designer to make a change or inspect a change? Seems unrealistic to be scrolling around looking for specific entity. Thanks for your feedback!

    Read the article

  • AngularJs not working with dynamic html

    - by user2541753
    In my cshtml file I have a form named 'ApplyMedicalMain' and I want to show a dynamically loaded division when the form is dirty but its not happening even though the form is dirty ... Below is my code that i got in Firefox Inspect Element: <form class="form_section ng-dirty ng-valid ng-valid-required" name="ApplyMedicalMain" method="post" action="/MVC/Quote/ApplyMedical"> <div id="Step1_PartialView" class="QuoteStep1"> <script type="text/javascript" src="/Scripts/Renderings/Presales/ApplyMedical.js"> <div name="Conditions" id="conditions_or_symptoms" ng-hide="ApplyMedicalMain.$dirty"> <div class="generic_error_message select"> <div class="error_icn_message"></div> </div> As you can see above, I have mentioned ng-hide for the division name='conditions' but it is not getting hidden even though the form has class 'ng-dirty'.And please note that the the division 'conditions' is loaded dynamically from other partial view. can someone help me ?

    Read the article

  • Link redirects to "show" action instead of the indicated in routes.rb

    - by Brian Roisentul
    I'm working with Ruby on rails 2.3.4 and I'd like to have a link that executes an action when clicked. The relevant part of the routes.rb file looks like this: map.search_filter_relevance "/anuncios/buscar", :controller => 'announcements', :action => 'search_filter_relevance' My view(it's the model's index page) looks like this: <%= link_to 'M&Aacute;S RELEVANTES', search_filter_relevance_path %> And my controller looks like this: def search_filter_relevance raise params.inspect unless params[:announcements].nil? or params[:announcements].empty? @announcements = params[:announcements].order_by_featured end end The problem is that when I click the link I get an error due to some null value in the Show action! I'm not accessing that action at all...why is executing it?

    Read the article

  • How to make Visual C++ 9 not emit code that is actually never called?

    - by sharptooth
    My native C++ COM component uses ATL. In DllRegisterServer() I call CComModule::RegisterServer(): STDAPI DllRegisterServer() { return _Module.RegisterServer(FALSE); // <<< notice FALSE here } FALSE is passed to indicate to not register the type library. ATL is available as sources, so I in fact compile the implementation of CComModule::RegisterServer(). Somewhere down the call stack there's an if statement: if( doRegisterTypeLibrary ) { //<< FALSE goes here // do some stuff, then call RegisterTypeLib() } The compiler sees all of the above code and so it can see that in fact the if condition is always false, yet when I inspect the linker progress messages I see that the reference to RegisterTypeLib() is still there, so the if statement is not eliminated. Can I make Visual C++ 9 perform better static analysis and actually see that some code is never called and not emit that code?

    Read the article

  • How do I load multiple FLV files, with the same COMPLETE event handler?

    - by Josamoto
    When loading files with the Loader in ActionScript 3, I am able to inspect the event attribute on the complete event handler to determine what the URL is for the file that has completed downloading. Loader exposes a variable in the event handler attribute: event.target.url which I means that when the handler returns, I can easily determine which file is loading. However, my client has sent numerous FLV files built in After Effects that constitute the UI elements of a Flash application built for them. Loading FLV files require the use of URLLoader, and this does not appear to expose the name of the file being loaded. So I either need to convert the FLV's to SWF, so I can load them as normal. Is there a way to determine the URL inside the onComplete event handler fired by URLLoader?

    Read the article

  • Passing parameters to service by URL - How do I discover the parameter names?

    - by VitalyB
    Hi, I have a report to which I have execute-only access - I don't have the access to the RDL file. This report exposes several parameters which I would like to set from URL. I've successfully changed some parameters using the standard param=data form (as explained here: http://msdn.microsoft.com/en-us/library/ms153586.aspx). However, some parameters don't have the same parameter-prompt and parameter-name. Unfortunately, to pass parameter values by URL I must know the name of the parameter and I don't see how I can deduct from the report and its parameters prompt text. I've tried to inspect the source and post-data but to no avail. Anyone has an idea? Thanks P.S I also stumbled on this: http://odetocode.com/Articles/123.aspx. However, I wasn't able to connect to the web-services of my report server.

    Read the article

  • Test param value using EasyMock

    - by fmpdmb
    I'm attempting to write some unit tests using EasyMock and TestNG and have run into a question. Given the following: void execute(Foo f) { Bar b = new Bar() b.setId(123); f.setBar(b); } I'm trying to test that the Id of the Bar gets set accordingly in the following fashion: @Test void test_execute() { Foo f = EasyMock.createMock(Foo.class); execute(f); Bar b = ?; // not sure what to do here f.setBar(b); f.expectLastCall(); } In my test, I can't just call f.getBar() and inspect it's Id because f is a mock object. Any thoughts? Is this where I'd want to look at the EasyMock v2.5 additions andDelegateTo() and andStubDelegateTo()?

    Read the article

  • Rails streaming file download

    - by Leonard Teo
    I'm trying to implement a file download with Rails. I want to eventually migrate this code to using S3 to serve the file. I've copied the Rails send_file code almost verbatim and I cannot seem to get it to stream a file to the user. What happens is that it sends 'a' file to the user, but the downloaded file itself simply contains the text.inspect of the Proc: # What am I doing wrong here? options = {} options[:length] = File.size(file.path) options[:filename] = File.basename(file.path) send_file_headers! options render :status => 200, :text => Proc.new { |response, output| len = 4096 File.open(file.path, 'rb') do |fh| while buf = fh.read(len) output.write(buf) end end } Ps: I've read in a number of other posts that it's not advisable to send files through the Rails stack, and if possible serve using the web server, or in the case of S3 use the hashed URL it can provide. Yes, we really do want to serve the file through the Rails stack.

    Read the article

  • Setting selected item on Listbox in Silverlight - Windows Phone 7

    - by Fishcake
    I have a databound Listbox bound to a generic list as follows (Provider is a very simple class that just includes a single property (Name). ProviderList = new List<Provider>(); //Populate list Providers.ItemsSource = ProviderList; I can save the selected item with no problem but I can't manage to set the selected item from code afterwards. I am trying to do so as follows: int x = Providers.Items.IndexOf((Provider)_Settings["provider"]); However IndexOf() is always returning -1. If I inspect both Providers.Items[1] and _Setting["provider"] at runtime using the immediate window they both return {StoreRetrieveData.Provider} Name: "Greenflag" Am I doing something wrong (well clearly I am)?

    Read the article

  • Fastest/One-liner way to list attr_accessors in Ruby?

    - by viatropos
    What's the shortest, one-liner way to list all methods defined with attr_accessor? I would like to make it so, if I have a class MyBaseClass, anything that extends that, I can get the attr_accessor's defined in the subclasses. Something like this: class MyBaseClass < Hash def attributes # ?? end end class SubClass < MyBaseClass attr_accessor :id, :title, :body end puts SubClass.new.attributes.inspect #=> [id, title, body] What about to display just the attr_reader and attr_writer definitions?

    Read the article

  • If my application doesn't use a lot of memory, can I ignore viewDidUnload:?

    - by iPhoneToucher
    My iPhone app generally uses under 5MB of living memory and even in the most extreme conditions stays under 8MB. The iPhone 2G has 128MB of RAM and from what I've read an app should only expect to have 20-30MB to use. Given that I never expect to get anywhere near the memory limit, do I need to care about memory warnings and setting objects to nil in viewDidUnload:? The only way I see my app getting memory warnings is if something else on the phone is screwing with the memory, in which case the entire phone would be acting silly. I built my app without ever using viewDidUnload:, so there's more than a hundred classes that I'd need to inspect and add code to if I did need to implement it.

    Read the article

  • How can I evaluate a deferred Linq statement when debugging?

    - by DanO
    I'm debugging in VS2010, and I want to inspect a string value but all I can get the debugger to show me (through watches, hovering, locals, etc.) is: "System.Linq.Enumerable+<TakeIterator>d__3a`1[System.Char]" I don't care if there are side effects from premature evaluation or whatever, I just want to see what the expression would evaluate to if I evaluate it right now at the current breakpoint. How is this done? Also can I change my code in such a way that it evaluates earlier? Not that I care when I'm not debugging... but just wondering. In case it is relevant... (I doubt it.) I'm stuffing a new entity object before saving it to the database... some fields are assigned with LINQ statements, I'm not sure when they get evaluated under the covers of EF. The DB update fails with 'string or binary data would be truncated... So I'm trying to find the too-long field.

    Read the article

  • Debugging Drupal 6

    - by coach_rob
    OK, I've read and attempted all of the tutorials I can find on being able to debug a locally installed Drupal 6 instance. I'm on Windows, 32-bit. I have access to Eclipse (obviously) as well as Visual Studio 2005/2008. I've yet to be able to get any of the Eclipse options (XDebug, Zend, etc.) working to be able to step through code, inspect variables, etc. I've heard good things about VS.PHP, but haven't committed to the $100 or whatever it is. Can some of your PHP/Drupal gurus out there tell me the best, simplest, most reliable way to debug Drupal and PHP on the Windows platform?

    Read the article

  • How to get function's name from function's pointer in C?

    - by Daniel Silveira
    How to get function's name from function's pointer in C? Edit: The real case is: I'm writing a linux kernel module and I'm calling kernel functions. Some of these functions are pointers and I want to inspect the code of that function in the kernel source. But I don't know which function it is pointing to. I thought it could be done because, when the system fails (kernel panic) it prints out in the screen the current callstack with function's names. But, I guess I was wrong... am I?

    Read the article

  • Webhook data for Orders Paid

    - by David Lazar
    A client recently requested some fancy processing based off of the Gateway attribute registered with a Paid order. When I receive, validate and inspect the JSON of the order, I am logging the gateway attribute and finding it is nil at times. When I check the order using the API after the Webhook, the gateway attribute is present and matches the one rendered in the Shop admin. Is there an explanation for why the gateway can at times be nil? This prevents me from taking care of the client's requested processing.

    Read the article

  • Reverse engineering a custom data file

    - by kerchingo
    At my place of work we have a legacy document management system that for various reasons is now unsupported by the developers. I have been asked to look into extracting the documents contained in this system to eventually be imported into a new 3rd party system. From tracing and process monitoring I have determined that the document images (mainly tiff files) are stored in a number of 1.5GB files. These files seem to be read from a specific offset and then written to a tmp file that is then served via a web app to the client, and then deleted. I guess I am looking for suggestions as to how I can inspect these large files that contain the tiff images, and eventually extract and write them to individual files.

    Read the article

  • Is there a good (standalone) PHPDoc parser class or function in PHP?

    - by Kris
    Hi folks, I'm looking for some method of converting a PHP Docblock (as used for generating documentation by tools like Doxygen) into a structure I can inspect in PHP. For example, I want to parse the following lines: /** * Multiply two values * @CHECKME * * @author someone * @created eons ago * * @param integer $x * @param integer $x * * @return integer */ function multiply($x, $y) { return $x * $y; } Into something similar to: array( 'author' = 'someone' ,'created' = 'eons ago' ,'param' = array( 'integer $x' ,'integer $y' ) ,'_flags' = array( '@CHECKME' ) ); I explicitly cannot use PEAR or any such library, it has to be relatively standalone. Any given solution that is better than using a bunch of regexes after stripping away comment outline would be awesome.

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >