Search Results

Search found 384 results on 16 pages for 'lucian jp'.

Page 7/16 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Select a Master Page in Web Developer Express

    - by JP
    The dialog box for adding a web form to a web project in Visual Studio has a checkbox to 'Select Master Page'. This checkbox doesn't exist in the Web Developer Express Edition. Is there a simple alternative to attach a Master Page while adding a new web form in the Express Version?

    Read the article

  • AMQP gem specifying a dead letter exchange

    - by JP.
    I've specified a queue on the RabbitMQ server called MyQueue. It is durable and has x-dead-letter-exchange set to MyQueue.DLX. (I also have an exchange called MyExchange bound to that queue, and another exchange called MyQueue.DLX, but I don't believe this is important to the question) If I use ruby's amqp gem to subscribe to those messages I would do it like this: # Doing this before and in a new thread has to do with how my code is structured # shown here in case it has a bearing on the question Thread.new do AMQP.start('amqp://guest:[email protected]:5672') end EventMachine.next_tick do channel = AMQP::Channel.new(AMQP.connection) queue = channel.queue("MyQueue", :durable => true, :'x-dead-letter-exchange' => "MyQueue.DLX") queue.subscribe(:ack => true) do |metadata, payload| p metadata p payload end end If I execute this code with the queues and exchanges already created and bound (as they need to be in my set up) then RabbitMQ throws the following error in its logs: =ERROR REPORT==== 19-Aug-2013::14:25:53 === connection <0.19654.2>, channel 2 - soft error: {amqp_error,precondition_failed, "inequivalent arg 'x-dead-letter-exchange'for queue 'MyQueue' in vhost '/': received none but current is the value 'MyQueue.DLX' of type 'longstr'", 'queue.declare'} Which seems to be saying that I haven't specified the same Dead Letter Exchange as the pre-existing queue - but I believe I have with the queue = ... line. Any ideas?

    Read the article

  • XamlReader.Parse throws exception on empty String

    - by sub-jp
    In our app, we need to save properties of objects to the same database table regardless of the type of object, in the form of propertyName, propertyValue, propertyType. We decided to use XamlWriter to save all of the given object's properties. We then use XamlReader to load up the XAML that was created, and turn it back into the value for the property. This works fine for the most part, except for empty strings. The XamlWriter will save an empty string as below. <String xmlns="clr-namespace:System;assembly=mscorlib" xml:space="preserve" /> The XamlReader sees this string and tries to create a string, but can't find an empty constructor in the String object to use, so it throws a ParserException. The only workaround that I can think of is to not actually save the property if it is an empty string. Then, as I load up the properties, I can check for which ones did not exist, which means they would have been empty strings. Is there some workaround for this, or is there even a better way of doing this?

    Read the article

  • `var = something rescue nil` behaviour

    - by JP
    In ruby you can throw a rescue at the end of an assignment to catch any errors that might come up. I have a function (below: a_function_that_may_fail) where it's convenient to let it throw an error if certain conditions aren't met. The following code works well post = {} # Other Hash stuff post['Caption'] = a_function_that_may_fail rescue nil However I'd like to have post['Caption'] not even set if the function fails. I know I can do: begin post['Caption'] = a_function_that_may_fail recsue end but that feels a little excessive - is there a simpler solution?

    Read the article

  • Passing parameters thru Ruby's OAuth

    - by JP
    I'm using Mirven's Twitter OAuth Sinatra example and trying to figure out how I can send a 'next page' parameter with the Oauth request: ie. The user attempts to visit /edit/profile which requires a login so I redirect to /request which deals with login via twitter - I now want to be able to redirect the user to the address they were originally looking for if they log in successfully. I thought I could do this in the .get_request_token line with this code: @request_token = @consumer.get_request_token({:oauth_callback => "http://#{request.host}/auth"},{:next => params['next'] || '/'}) But params has no additional items in the /auth handler. I'm new to OAuth, how would I go about doing this?

    Read the article

  • Checkbox 'off' value

    - by Richard JP Le Guen
    Does anyone have a no JavaScript way to make HTML checkbox still submit a value? As in if you check it the form submission will include a value A but if it is uncheck it still contains a value B? While I figure there isn't any way, I'm working on a site which needs to still be function when JS is off, and this would be ideal.

    Read the article

  • many to many query for ActiveRecord

    - by JP
    I have three data models, Users, Conversations and Lines, where each conversation has many lines and certain participating users, each line has one conversation and one user and each user has many conversations and many lines. I have arranged these in ActiveRecord like this: class Line < ActiveRecord::Base belongs_to :conversation belongs_to :user end class User < ActiveRecord::Base has_and_belongs_to_many :conversations has_many :lines end class Conversation < ActiveRecord::Base has_many :lines has_and_belongs_to_many :users end If I want to create a new conversation with 4 users, where the users are either found or created inside the users table, how would I go about doing this? I thought I could do: c = Conversation.new c.users.find_or_create_by_username('myUsername') c.save But this will create a new username in the Users table even if that username already exists! (ie. running the above code 3 times will result in Users having 3 rows with 'myUsername' as the username, one for each conversation, rather than three conversations all with the same 'myUsername' entry listed in their associated users) I'm not sure how to search for this kind of information with google - can anyone help?

    Read the article

  • Detect similar sounding words in Ruby

    - by JP
    I'm aware of SOUNDEX and (double) Metaphone, but these don't let me test for the similarity of words as a whole - for example "Hi" sounds very similar to "Bye", but both of these methods will mark them as completely different. Are there any libraries in Ruby, or any methods you know of, that are capable of determining the similarity between two words? (Either a boolean is/isn't similar, or numerical 40% similar) edit: Extra bonus points if there is an easy method to 'drop in' a different dialect or language!

    Read the article

  • Accessing parent 'this' inside a jQuery $.getJSON

    - by JP
    I'm going to assume that the overall structure of my code as it currently stands is 'best', otherwise this question gets too long, but if I've made any obvious mistakes (or if I've made life hard for myself) then please correct away! Using jQuery, I have a javascript 'class' set out something like this: function MyClass () { this.noise = "Woof" this.dostuff = function() { $.getJSON("http://cows.go",function(moo) { this.noise = moo.inEnglish; } } } var instance = new MyClass(); instance.doStuff() console.log(instance.noise) I'm expecting some kinda tea drinking moo in the console, but of course I'm getting an error about this.noise not being defined (because $.getJSON doesn't pass this through, right?) Any suggestions as to how to be able to affect instance.squeak for any and all instances of MyClass without interference?

    Read the article

  • QuickTimeX in Applescript / Scripting Bridge

    - by JP
    I'd like to be able to grab the metadata of the currently playing file in Quicktime X using ScriptingBridge and Ruby, so far I have the following code require 'osx/cocoa' OSX.require_framework 'ScriptingBridge' @app = OSX::SBApplication.applicationWithBundleIdentifier("com.apple.QuickTimePlayerX") @app.documents.each do |movie| # What now?! end But I can't find any functions in QuickTime X's applescript dictionary to get the metadata from a document object (the same data you can see in QT's 'Show Movie Inspector' HUD) — does anyone have any ideas?

    Read the article

  • Sintra app in a gem

    - by JP
    I have a Sinatra application I've created and I'd like to package it as a gem-based binary. I have my gemspec and gem set up to generate a suitable executable that points to the my_sinatra_app.rb (which is executable) but the sinatra server never runs. Any ideas why and how to make it work? my_sinatra_app executable: #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby # # This file was generated by RubyGems. require 'rubygems' version = ">= 0" if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then version = $1 ARGV.shift end gem 'my_sinatra_app', version load Gem.bin_path('my_sinatra_app', 'my_sinatra_app', version)

    Read the article

  • ActiveRecord finding from inside a serialized field

    - by JP
    While working with ActiveRecord I have a table which stores a serialized array of participant usernames for each row. Is there an easy way to search for all rows who contain a specific user? I realise I could just make a new linked table for the participants, but I feel like that would increase my overhead unnecessarily -- what do you think?

    Read the article

  • Sinatra Set Settings (Ruby)

    - by JP
    Using Sinatra in Ruby you can set the server's settings by doing: set :myvariable, "MyValue" and then access it anywhere in templates etc with settings.myvariable. In my script I need to be able to re-set these variables falling back to a bunch of defaults. I figured the easiest way to do this would be to have a function that performs all the sets calling it at the start of the Sinatra server and when I need to make the alterations: class MyApp < Sinatra::Application helpers do def set_settings s = settings_from_yaml() set :myvariable, s['MyVariable'] || "default" end end # Here I would expect to be able to do: set_settings() # But the function isn't found! get '/my_path' do if things_go_right set_settings end end # Etc end As explained in the code above, the set_settings function isn't found, am I going about this the wrong way?

    Read the article

  • Opinion of Hosted SVN providers?

    - by JP
    What is your opinion of the various online Hosted SVN providers? How do they all compare? I'm looking for thoughts on Assembla, Unfuddle, BeanStalk, CVSDude, ProjectLocker, and any others that I forgot to mention. Thanks for your insight and input.

    Read the article

  • C++ Header Guard issues

    - by JP
    I am making a small C++ framework, which contains many .h and .cpp. I have created a general include which include all my .h file such as: framework.h #include "A.h" #include "B.h" #include "C.h" each .h header are protected with include guard such as #ifndef A_HEADER #define A_HEADER ... #endif The issues is, I would like to be able to include "framework.h" inside all the sub .h such as, but it cause lots of compiler error: #ifndef A_HEADER #define A_HEADER #include "framework.h" ... #endif If instead I use the real header file for each sub header, and the framework.h for what ever use my framework it works fine.. I would just like to include the main header inside all my sub .h so I dont need to include all the dependency everytime. Thanks :)

    Read the article

  • Database locking: ActiveRecord + Heroku

    - by JP
    I'm building a Sinatra based app for deployment on Heroku. You can imagine it like a standard URL shortener but where old shortcodes expire and become available for new URLs (I realise this is a silly concept but its easier to explain this way). I'm representing the shortcode in my database as an integer and redefining its reader to give a nice short and unique string from the integer. As some rows will be deleted, I've written code that goes thru all the shortcode integers and picks the first free one to use just before_save. Unfortunately I can make my code create two rows with identical shortcode integers if I run two instances very quickly one after another, which is obviously no good! How should I implement a locking system so that I can quickly save my record with a unique shortcode integer? Here's what I have so far: Chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a CharLength = Chars.length class Shorts < ActiveRecord::Base before_save :gen_shortcode after_save :done_shortcode def shortcode i = read_attribute(:shortcode).to_i return '0' if i == 0 s = '' while i > 0 s << Chars[i.modulo(CharLength)] i /= 62 end s end private def gen_shortcode shortcode = 0 self.class.find(:all,:order=>"shortcode ASC").each do |s| if s.read_attribute(:shortcode).to_i != shortcode # Begin locking? break end shortcode += 1 end write_attribute(:shortcode,shortcode) end def done_shortcode # End Locking? end end

    Read the article

  • MVVM and Databinding with UniformGrid

    - by JP
    I'm trying to style the back of a WPF chart with some rectangles. I'm using MVVM, and I need the rectangles to be uniformly sized. When defined via Xaml, this works with a fixed "BucketCount" of 4: <VisualBrush> <VisualBrush.Visual> <UniformGrid Height="500" Width="500" Rows="1" Columns="{Binding BucketCount}"> <Rectangle Grid.Row="0" Grid.Column="0" Fill="#22ADD8E6" /> <Rectangle Grid.Row="0" Grid.Column="1" Fill="#22D3D3D3"/> <Rectangle Grid.Row="0" Grid.Column="2" Fill="#22ADD8E6"/> <Rectangle Grid.Row="0" Grid.Column="3" Fill="#22D3D3D3"/> </UniformGrid> </VisualBrush.Visual> <VisualBrush> How can I bind my ObservableCollection of Rectangles? There is no "ItemsSource" property on UniformGrid. Do I need to use an ItemsControl? If so, how can I do this? Thanks in advance.

    Read the article

  • Safe Cross Thread Signals/Slot C++

    - by JP
    It seem that the only implementation that provide Safe Cross-Thread Signals for both the Signal class and what's being called in the slot is QT. (Maybe I'm wrong?). But I cannot use QT in the project I'm doing. So how could I provide safe Slots call from a different thread (Using Boost::signals2 for example)? Are mutex inside the slot the only way? I think signals2 protect themself but not what's being done inside the slot. Thanks

    Read the article

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