Search Results

Search found 6976 results on 280 pages for 'active'.

Page 65/280 | < Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >

  • Rails problem with Delayed_Job and Active Record

    - by Michael Waxman
    I'm using Delayed_Job to grab a Twitter user's data from the API, but it's not saving it in the model for some reason! Please help! (code below) class BandJob < Struct.new(:band_id, :band_username) #parameter def perform require 'json' require 'open-uri' band = Band.find_by_id(band_id) t = JSON.parse(open("http://twitter.com/users/show/#{band_username}.json").read) band.screen_name = t['screen_name'] band.profile_background_image = t['profile_background_image_url'] band.url = 'http://' + band_username + '.com' band.save! end end To clarify, I'm actually not getting any errors, it's just not saving. Here's what my log looks like: * [JOB] acquiring lock on BandJob [4;36;1mDelayed::Job Update (3.1ms)[0m [0;1mUPDATE "delayed_jobs" SET locked_at = '2009-11-09 18:59:45', locked_by = 'host:dhcp128036151228.central.yale.edu pid:2864' WHERE (id = 10442 and (locked_at is null or locked_at < '2009-11-09 14:59:45') and (run_at <= '2009-11-09 18:59:45')) [0m [4;35;1mBand Load (1.5ms)[0m [0mSELECT * FROM "bands" WHERE ("bands"."id" = 34) LIMIT 1[0m [4;36;1mBand Update (0.6ms)[0m [0;1mUPDATE "bands" SET "updated_at" = '2009-11-09 18:59:45', "profile_background_image" = 'http://a3.twimg.com/profile_background_images/38193417/fbtile4.jpg', "url" = 'http://Coldplay.com', "screen_name" = 'coldplay' WHERE "id" = 34[0m [4;35;1mDelayed::Job Destroy (0.5ms)[0m [0mDELETE FROM "delayed_jobs" WHERE "id" = 10442[0m * [JOB] BandJob completed after 0.5448 1 jobs processed at 1.8011 j/s, 0 failed ... Thanks!

    Read the article

  • Help with active record relations

    - by Christian Fazzini
    class CreateActivities < ActiveRecord::Migration def self.up create_table :activities do |t| t.references :user t.references :media t.integer :artist_id t.string :type t.timestamps end end def self.down drop_table :activities end end class Fan < Activity belongs_to :user, :counter_cache => true end class Activity < ActiveRecord::Base belongs_to :user belongs_to :media belongs_to :artist, :class_name => 'User', :foreign_key => 'artist_id' end class User < ActiveRecord::Base has_many :activities has_many :fans end I tried changing my activity model too, without any success: class Activity < ActiveRecord::Base has_many :activities, :class_name => 'User', :foreign_key => 'user_id' has_many :activities, :class_name => 'User', :foreign_key => 'artist_id' end One thing to note. Activity is an STI. Fan inherits from Activity. In console, I do: # Create a fan object. User is a fan of himself fan = Fan.new => #<Fan id: nil, user_id: nil, media_id: nil, artist_id: nil, type: "Fan", comment: nil, created_at: nil, updated_at: nil> # Assign a user object fan.user = User.first => #<User id: 1, genre_id: 1, country_id: 1, .... # Assign an artist object fan.artist_id = User.first.id => 1 # Save the fan object fan.save! => true Activity.last => #<Fan id: 13, user_id: 1, media_id: nil, artist_id: 1, type: "Fan", comment: nil, created_at: "2010-12-30 08:41:25", updated_at: "2010-12-30 08:41:25"> Activity.last.user => #<User id: 1, genre_id: 1, country_id: 1, ..... But... Activity.last.artist => nil Why is Activity.last.artist returning nil?

    Read the article

  • Security-Active Application in background-Does it store image of current screen

    - by user1509593
    Is this a probable security flaw. A user in public (lets say Starbucks) tries to log in to iOS application. He enters user id and password [Password is hidden using xxxxxxxx (not exposed)] and a call comes in or he presses home and the application goes to background. a) Does iOS store an image of current screen b) A malicious hacker with intent takes control of the device. Can he read the password ? Do we have to clear out sensitive information while going to background

    Read the article

  • Business Objects ver 3 Alternate Row/Column Colors not active

    - by boxeo47
    I am converting reports from version 2 to version 3. When I select the vertical table in the report, the propeties box appears but any changes I make is not reflected in the table. If I change any attributes at the column or cell level however, the changes are taken. The problem is that some attributes like alternate row coloring are not available at the column level.

    Read the article

  • Finding the next record in the database with Active Record

    - by ericraio
    So I have my rails application and I have blog posts in my application. For starters I am on rails 2.3.5 and Ruby 1.8.7 For the show page, I am required to give a prev/next link to the prev/next blog post. The catch is that I need to find the next blog where the language column in the database is equal to 'eng'. I had started writing this out in my model and it works but of course this will just find the prev/next record in the database no matter what the language is specified in the column and it will break when the record is not found. def next(lang='eng') BlogEntry.find(self.id - 1) end def prev(lang='eng') BlogEntry.find(self.id + 1) end

    Read the article

  • Grails external Jms broker (active mq)

    - by TheBigS
    I have what will become an 'external' activemq server I'd like grails to be able to talk to. Right now I am just running it on my dev box. Here is what I have setup right now: 1) Run activemq server 2) Run activemq/examples using ant to produce messages 3) View ActiveMQ admin site: http://localhost:8161/admin/queues.jsp verify that messages are in the queue. 4) Follow Mini Tutorial to create the Service and Controller: http://www.grails.org/ActiveMQ+Plugin 5) Configured my Grails resources.groovy file as follows: beans = { jmsConnectionFactory(SingleConnectionFactory){ targetConnectionFactory = { ActiveMQConnectionFactory cf -> brokerURL = 'tcp://localhost:61616' } } } When I run the grails app I get a BindException saying port 61616 is already in use. How do I configure this to use my server that is already running? I've tried changing 'localhost' to '127.0.0.1' and to my LAN ip, but no luck, it keeps trying to setup its own embedded activemq server. Any ideas?

    Read the article

  • What causes a UIViewController to become active?

    - by Rob Bonner
    I am sure this is an easy question, but one that has escaped me for some time now. Say I have a UIViewController, either defined as a root in an XIB or on a stack. At some point in my code I want to replace it with another view controller. Just flat out replace it. How would I do that? I have tried defining the controller and assigning, but not sure what actually makes it push on the screen with the absence of a navigation controller.

    Read the article

  • Rails Active Record find(:all, :order => ) issue.

    - by CodingWithoutComments
    I seem to be unable to use :order_by for more than one column at a time. For example, I have a "Show" model with date and attending columns. If I run the following code: @shows = Show.find(:all, :order => "date") I get the following results: [#<Show id: 7, date: "2009-04-18", attending: 2>, #<Show id: 1, date: "2009-04-18", attending: 78>, #<Show id: 2, date: "2009-04-19", attending: 91>, #<Show id: 3, date: "2009-04-20", attending: 16>, #<Show id: 4, date: "2009-04-21", attending: 136>] If I run the following code: @shows = Show.find(:all, :order => "attending DESC") [#<Show id: 4, date: "2009-04-21", attending: 136>, #<Show id: 2, date: "2009-04-19", attending: 91>, #<Show id: 1, date: "2009-04-18", attending: 78>, #<Show id: 3, date: "2009-04-20", attending: 16>, #<Show id: 7, date: "2009-04-18", attending: 2>] But, if I run: @shows = Show.find(:all, :order => "date, attending DESC") OR @shows = Show.find(:all, :order => "date, attending ASC") OR @shows = Show.find(:all, :order => "date ASC, attending DESC") I get the same results as only sorting by date: [#<Show id: 7, date: "2009-04-18", attending: 2>, #<Show id: 1, date: "2009-04-18", attending: 78>, #<Show id: 2, date: "2009-04-19", attending: 91>, #<Show id: 3, date: "2009-04-20", attending: 16>, #<Show id: 4, date: "2009-04-21", attending: 136>] Where as, I want to get these results: [#<Show id: 1, date: "2009-04-18", attending: 78>, #<Show id: 7, date: "2009-04-18", attending: 2>, #<Show id: 2, date: "2009-04-19", attending: 91>, #<Show id: 3, date: "2009-04-20", attending: 16>, #<Show id: 4, date: "2009-04-21", attending: 136>] This is the query being generated from the logs: [4;35;1mUser Load (0.6ms)[0m [0mSELECT * FROM "users" WHERE ("users"."id" = 1) LIMIT 1[0m [4;36;1mShow Load (3.0ms)[0m [0;1mSELECT * FROM "shows" ORDER BY date ASC, attending DESC[0m [4;35;1mUser Load (0.6ms)[0m [0mSELECT * FROM "users" WHERE ("users"."id" = 1) [0m Finally, here is my model: create_table "shows", :force => true do |t| t.string "headliner" t.string "openers" t.string "venue" t.date "date" t.text "description" t.datetime "created_at" t.datetime "updated_at" t.decimal "price" t.time "showtime" t.integer "attending", :default => 0 t.string "time" end What am I missing? What am I doing wrong? UPDATE: Thanks for all your help, but it seems that all of you were stumped as much as I was. What solved the problem was actually switching databases. I switched from the default sqlite3 to mysql.

    Read the article

  • JQuery Active Refresh Not Working After Server-Side Redirect

    - by Ömer Faruk AK
    I have a page which is refreshing actively every 5 second. But when i click a button from the page which is redirect to itself at server-side and then it's not refreshing. What can i do? JQuery Code; <script type="text/javascript" charset="${_response_encoding}"> // Reload the whole messages panel var refresh = function() { $('#thread').load('@{room()} #thread', function() { $('#thread').trigger('create'); }); } var create = function(){ $('#thread').trigger('create'); } // Call refresh every 5 seconds $(document).ready(setInterval(refresh, 5000)); </script> Server-Side Code; public static void served(Long servingID) { Serving serv = Serving.findById(servingID); serv.isServed = true; serv.save(); index(); }

    Read the article

  • Codeigniter - Active record - sql - complex join

    - by Jack
    I have a function that retrieves all tags from a table: function global_popular_tags() { $this->db->select('tags.*, COUNT(tags.id) AS count'); $this->db->from('tags'); $this->db->join('tags_to_work', 'tags.id = tags_to_work.tag_id'); $this->db->group_by('tags.id'); $this->db->order_by('count', 'desc'); $query = $this->db->get()->result_array(); return $query; } I have another table called 'work'. The 'work' table has a 'draft' column with values of either 1 or 0. I want the COUNT(tags.id) to take into account whether the work with the specific tag is in draft mode (1) or not. Say there are 10 pieces of work tagged with, for example, 'design'. The COUNT will be 10. But 2 of these pieces of work are in draft mode, so the COUNT should really be 8. How do I manage this?

    Read the article

  • Updating the foreground of a label on window active property-WPF

    - by Deb
    I have a label which shows the name of the window. I want to update the colour of the label on the IsActive property of the window using styles and triggers so that all the labels inheriting this style should exhibit the same property. Please can anyone suggest me how? I tried like this: <Style TargetType="{x:Type Label}" x:Key="HeaderLabel"> <Style.Triggers> <DataTrigger Binding="{Binding (Window.IsActive)}" Value="True"> <Setter Property="FontSize" Value="15"/> <Setter Property="FontWeight" Value="Bold"/> <Setter Property="FontFamily" Value="Arial"/> <Setter Property="Foreground" Value="Black"/> <Setter Property="HorizontalAlignment" Value="Left"/> </DataTrigger> <DataTrigger Binding="{Binding (Window.IsActive)}" Value="False"> <Setter Property="FontSize" Value="15"/> <Setter Property="FontWeight" Value="Bold"/> <Setter Property="FontFamily" Value="Arial"/> <Setter Property="Foreground" Value="White"/> <Setter Property="HorizontalAlignment" Value="Left"/> </DataTrigger> </Style.Triggers> </Style>

    Read the article

  • How to change active culture on Windows Phone 7

    - by Sam
    [Update] I see I need the full example to explain. In my Windows Phone 7 App, I got a page containing a TextBox bound to a Decimal "Amount": <TextBox Text="{Binding Amount,Mode=TwoWay}" InputScope="CurrencyAmount"/> The phone settings are set to German. In german localization, a value like 1234.56m would be formatted 1.234,56 (unlike the US, where it should be 1,234.56). Problem is, when I enter a value like 1.234,56 in the textbox, the content will be interpreted for US, resulting in 1.23456m, when it should have been 1234.56m. So, how do I get the binding on the WP7 to use the current phone culture instead of a generic US one? In Germany people expect to enter a colon for decimals instead of a dot.

    Read the article

  • why is Active Record firing extra query when I use Includes method to fetch data

    - by riddhi_agrawal
    I have the following model structure: class Group < ActiveRecord::Base has_many :group_products, :dependent => :destroy has_many :products, :through => :group_products end class Product < ActiveRecord::Base has_many :group_products, :dependent => :destroy has_many :groups, :through => :group_products end class GroupProduct < ActiveRecord::Base belongs_to :group belongs_to :product end I wanted to minimize my database queries so I decided to use includes.In the console I tried something like, groups = Group.includes(:products) my development logs show the following calls, Group Load (403.0ms) SELECT `groups`.* FROM `groups` GroupProduct Load (60.0ms) SELECT `group_products`.* FROM `group_products` WHERE (`group_products`.group_id IN (1,3,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,33,42,49,51)) Product Load (22.0ms) SELECT `products`.* FROM `products` WHERE (`products`.`id` IN (382,304,353,12,63,103,104,105,262,377,263,264,265,283,284,285,286,287,302,306,307,308,328,335,336,337,340,355,59,60,61,247,309,311,66,30,274,294,324,350,140,176,177,178,64,240,327,332,338,380,383,252,254,255,256,257,325,326)) Product Load (10.0ms) SELECT `products`.* FROM `products` WHERE (`products`.`id` = 377) LIMIT 1 I could analyze the initial three calls were necessary but don't get the reason why the last database call is made, Product Load (10.0ms) SELECT `products`.* FROM `products` WHERE (`products`.`id` = 377) LIMIT 1 Any idea why this is happening? Thanks in advance. :)

    Read the article

  • Having two backgrounds for an active menu item?

    - by HollerTrain
    Hi I have a dynamic menu where the ul li items change in width depending on the text set in the CMS (Joomla). They want the menu item, on mouse over, to both have 1. a repeated background image and 2. an image placed at the top (http://screencast.com/t/Zjk4YTJmNGQ). Now, I'm great with doing the repeated background image on a mouse over and that would be great, but I am not sure how to get both of these images in one css declaration. Any help would be greatly appreciated, as I haven't learned this technique yet :(

    Read the article

  • rails active record - Advanced find

    - by par
    I have the following model setup - a User is interested in projects in many project Categories. Each Project has many categories. Like so: class User has_many :projects has_and_belongs_to_many :project_categories class Project belongs_to :user has_and_belongs_to_many :project_categories class ProjectCategory has_and_belongs_to_many :projects has_and_belongs_to_many :users Now, I'd like to do a find for projects with any of the catogories that a certain user are interested in, i.e. if a user is interested in project categories A,B,C then I'd like to find projects which are part of one or more of those project categories. Anyone?

    Read the article

  • This query show me with this active record

    - by New Kid
    I am having trouble getting two tables and passing them to controller: IN A MODEL: function get_all_entries() { $query = $this->db->get('entry'); return $query->result(); $this->db->select('entry_id , count(comment_id) as total_comment'); $this->db->group_by('entry_id'); $comment = $this->db->get('comment'); return $comment->result(); } IN A CONTROLLER: $data['query'] = $this->blog_model->get_all_entries(); $this->load->view('blog/index',$data); How do I return $query and $comment variables to controller? I think I am doing it wrong.

    Read the article

  • Picking photo from Photochooser or holding hardware back button cause active timers ring

    - by Nznoonee
    This is very strange problem, and all the people I had asked to confirm it said that it takes place. I have a Threading.Timer instance which fires every 15 minutes. And if I call the PhotoChooser view and then select a photo from it, when going back to the calling page my application calls that timer's callback! I tried different timers either it be Timer from Threading namespace or Dispatcher timer. The same happens when being in my app I hold the back button of my device and then choose the app from the list. My application is as plain as it can be - the timer with a callback and method calling PhotoChooser. Could anyone help with solution or workaround please?

    Read the article

< Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >