Search Results

Search found 19688 results on 788 pages for 'con current'.

Page 33/788 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • access properties of current model in has_many declaration

    - by seth.vargo
    Hello, I didn't exactly know how to pose this question other than through example... I have a class we will call Foo. Foo :has_many Bar. Foo has a boolean attribute called randomize that determines the order of the the Bars in the :has_many relationship: class CreateFoo < ActiveRecord::Migration def self.up create_table :foos do |t| t.string :name t.boolean :randomize, :default => false end end end   class CreateBar < ActiveRecord::Migration def self.up create_table :bars do |t| t.string :name t.references :foo end end end   class Bar < ActiveRecord::Base belongs_to :foo end   class Foo < ActiveRecord::Base # this is the line that doesn't work has_many :bars, :order => self.randomize ? 'RAND()' : 'id' end How do I access properties of self in the has_many declaration? Things I've tried and failed: creating a method of Foo that returns the correct string creating a lambda function crying Is this possible? UPDATE The problem seems to be that the class in :has_many ISN'T of type Foo: undefined method `randomize' for #<Class:0x1076fbf78> is one of the errors I get. Note that its a general Class, not a Foo object... Why??

    Read the article

  • show current clicked div hide previous clicked div

    - by user295927
    Hi All, The code below is working, but with a problem I do not understand. When I click on first navigation link it is showing the div, this is what I want, but when I click on another nav link it does show the next div as expected but I need for the previous div(s) to hide. any help is appreciated. something like: if this is not the nav link that was clicked hide. I would think. $(document).ready(function(){ $('#navigation a').click(function (selected) { var getName = $(this).attr("id"); var projectImages = $(this).attr("name"); //console.log(getName); //console.log(projectImages); $(function() { $("#" + projectImages ).show("normal"); }); }); });

    Read the article

  • Maximizing the current window in javascript

    - by user349134
    Is there a way I can maximize a currently minimized window from Javascript? Here's my situation: I have a series of links that all target the same external window (e.g. "MyNewWindow"). When I click a link, a new window pops up. If I click another link, the page pops up in the same window as expected. If I minimize the "MyNewWindow" popup, I'd like to be able to click another link and have that window maximize. My approach was to put something on the onLoad part of the body so that when the page is refreshed it will automatically "maximize" if it is minimized. Note: Using window.MoveTo() and window.resizeTo() doesnt seem to do the trick (the window stays minimized). Thanks!

    Read the article

  • Capistrano update causes C: to be placed in the current directory (cygwin)

    - by user321775
    When I run cap deploy:update in a directory on my local machine (via cygwin), "C:" magically appears in the directory. Sure enough, I can cd to it and it's my windows C: drive. Now I'm afraid to delete it, but I definitely don't want it in this directory (a rails project under /home/username/blah/blah). Here's my config/deploy.rb file. custom options set :application, "xyz.com" set :repository, "ssh://[email protected]:yyyy/home/git/xxx" set :user, "myname" set :runner, user set :use_sudo, false server "xxx.xxx.xxx.xxx:yyyy", :app, :web, :db, :primary = true deploy to set :deploy_to, "/home/myname/public_html/xyz" repository set :scm, :git set :deploy_via, :copy ssh options default_run_options[:pty] = true ssh_options[:paranoid] = false ssh_options[:port] = yyyy start passenger namespace :deploy do task :start do ; end task :stop do ; end task :restart, :roles = :app, :except = { :no_release = true } do run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" end end Anyone see the problem? And does anyone know a safe way of getting rid of the C: drives that have already shown up (this has happened in a few directories)?

    Read the article

  • elisp: call command on current file

    - by Jasie
    Hello, I want to set a key in emacs to perform a shell command on the file in the buffer, and revert the buffer without prompting. The shell command is: p4 edit 'currentfilename.ext' (global-set-key [\C-E] (funcall 'revert-buffer 1 1 1)) ;; my attempt above to call revert-buffer with a non-nil ;; argument (ignoring the shell command for now) -- get an init error: ;; Error in init file: error: "Buffer does not seem to be associated with any file" Completely new to elisp. From the emacs manual, here is the definition of revert-buffer: Command: revert-buffer &optional ignore-auto noconfirm preserve-modes Thanks!

    Read the article

  • Eclipse Plugin: Enablement of an Action based on the current selection - before the

    - by Itay
    Here's my problem: I am using the org.eclipse.ui.popupMenus extension point for adding a sub-menu whose Action that is bounded to the following class: public class MyAction implements IObjectActionDelegate { private Logic logic = Logic.getInstance(); // Singleton public void setActivePart(IAction a, IWorkbenchPart targetPart) { // Nothing here } public void run(IAction a) { // Do something... } public void selectionChanged(IAction a, ISelection s) { a.setEnabled(logic.isEnabled(s)); } } This action is working correctly in most cases (including the call a.setEnabled() in selectionChanged()). My problem at the very first time my action is being invoked. The selectionChanged method is called only after the menu item has been displayed (and not when the user has made the selection) which means that the call to a.setEnabled() will have no affect. Any ideas on how to make my action receive selectionChanged() notifications even before the fist time it is being invoked?

    Read the article

  • Accessing "current class" from WPF custom MarkupExtension

    - by chaiguy
    I'm attempting to write a custom MarkupExtension to make my life easier by giving me a better way to specify bindings in XAML. However I would like to know if there is any way I can access the object that represents the file the MarkupExtension is used in. In other words, suppose I have a UserControl that defines a particular rendition of a data model of my program. This control has lots of visual stuff like grids, borders and general layout. If I use my MarkupExtension on a particular property of some element in this UserControl, I want to access the instance of the UserControl, without knowing what type it is (I plan on using reflection). Is this at all possible?

    Read the article

  • jQuery only apply to current li

    - by kylex
    I want to slide toggle the second level ul when I mouse over the relevant first level li. Currently the script displays all secondary ul on a mouseover. <div id="subNav"> <ul> <li>One</li> <ul> <li>SubOne</li> </ul> </li> <li>Two</li> <li> <ul> <li>SubTwo</li> </ul> </li> </ul> </div> And here is my jQuery $("#sideNav ul li").hover( function(){ $('#sideNav ul li ul').slideDown(); }, function(){ $('#sideNav ul li ul').slideUp(); } );

    Read the article

  • how to create a backup of a file once the current one is changed using php

    - by SkyLar
    I'm playing around with file info in php and i'm wondering if its possible to do the following: once a file is changed get the contents of the file, then put the contents of the file into another file. kinda like a "backup system" so once you make a change to the file a duplicate one is created, each change to the original file overwrites the duplicate one. i'm trying to do this with storing the time in the db, is this possible? i don't know what there is to test against? more clearly, i would like to do the following: execute a script once a specifeced file is changed on the server

    Read the article

  • Get current Apache version string for display

    - by Stijn Sanders
    I'm writing an Apache module and want to get a string with the Apache name version and other details. Much like what gets added to outgoing headers, e.g.: Server: Apache/2.2.13 (Win32) I've tried code like this: apr_table_get(request_rec->headers_out,"Server") But that doesn't seem to work. Is there an API call I haven't found or am I doomed to get version resource data from httpd.exe?

    Read the article

  • Android: How to periodically check current location without draining the battery

    - by uyahalom
    I have a background service which works periodically by timer.scheduleAtFixedRate. It wakes up every amount of time (let's say 60 seconds for example) and checks for the location. The location is checked by locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 5, listener); and the actual location is collected from the listener's onLocationChanged. Now, when the phone is outside and GPS reception is good, this works fine. But, if the phone is inside, the GPS is almost always active - looking for a signal, and the battery is drained rapidly. I created another thread using a Handler and a Runnable in order to conrol the GPS active time accurately: I used locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, listener); and locManager.removeUpdates(listener); so I can open and close the GPS as I want. In this case, I can open the GPS for the exact amount of time, but found out that it doesn't lock in an area with good reception even after 10 seconds. So here I'm draining the battery again... I'm using API level 7, hence I cannot use locationManager.requestSingleUpdate. I have two questions: Is there any way to optimize this process? Will upgrading to API level 9 (and use locationManager.requestSingleUpdate) improve the process significantly? I mean, does it worth upgrading?

    Read the article

  • Delete current row in a <table> with jQuery

    - by omgkurtnilsen
    I have a table that lists a bunch of customers. The last cell is an ajax delete button. I want the row containing the deleted customer to be deleted through jQuery. <table> <tr><td>Customer info 1</td><td><a href="javascript:deleteCustomer(1);">Delete</a></td> <tr><td>Customer info 2</td><td><a href="javascript:deleteCustomer(2);">Delete</a></td> function deleteCustomer(customerId) { $.post("somepage.php", {cid:customerId}, function(data){ //...delete the row that called the function... }

    Read the article

  • Hide elements for current visit only

    - by deanloh
    I need to display a banner that sticks to the bottom of the browser. So I used these codes: $(document).ready(function(){ $('#footie').css('display','block'); $('#footie').hide().slideDown('slow'); $('#footie_close').click(function(){ $('#footie_close').hide(); $('#footie').slideUp('slow'); }); }); And here's the HTML: <div id="footie"> {banner here} <a id="footie_close">Close</a> </div> I added the close link there to let user have the option to close the banner. How ever, when user navigates to next page, the banner shows up again. What can I do to set the banner to remained hidden just for this visit? In other words, as long as the browser remained open, the banner will not show up again. But if user returns to the same website another time, the banner should load again. Thanks in advance for any help!

    Read the article

  • How to get iPhones current orientation?

    - by Mike Rychev
    Is there a special method to get iPhones orientation? I don't need it in degrees or radians, I want it to return an UIInterfaceOrientation object. I just need it for an if-else construction like if(currentOrientation==UIInterfaceOrientationPortrait ||currentOrientation==UIInterfaceOrientationPortraitUpsideDown) { //Code } if (currentOrientation==UIInterfaceOrientationLandscapeRight ||currentOrientation==UIInterfaceOrientationLandscapeLeft ) { //Code } Thanks in advance!

    Read the article

  • In a pre-commit hook - how to access/compare current and previous versions of files

    - by EthanML
    I'm trying to add to our existing pre-commit SVN hook so that it will check for and block an increase in file size for files in specific directory/s. I've written a python script to compare two file sizes, which takes two files as arguments and uses sys.exit(0) or (1) to return the result, this part seems to work fine. My problem is in calling the python script from the batch file, how to reference the newly committed and previous versions of each file? The existing code is new to me and a mess of %REPOS%, %TXN%s etc and I'm not sure how to go about using them. Is there a simple, standard way of doing this? It also already contains code to loop through the changed files using svnlook changed, so that part shouldn't be an issue. Thanks very much

    Read the article

  • What is the current status on Microsoft ProClarity?

    - by Ali_Abadani
    I don't really know how to compose this question. My complay has been using Microsoft ProClarity for few years and we have a quite a few users using it publising books and doing ad-hoc analysis. With the new Microsoft BI solutions, it seems like they are completely going away from ProClarity and replacing the OLAP analysis with Excel. I understand the with SharePoint and integration with PerformancePoint and reporting services the dashboards and reports would be done in SharePoint but what about the analysis? Any ideas?

    Read the article

  • how to access a firefox extension variable from the current document/window

    - by bosky101
    my firefox extension has an object myExt . myExt = { request: function(){ //makes request to server}, callback: function(json) { //do something with this } }; From a dynamically added script element, I make a call to a server that returns json, i want the json to be sent to myExt.callback that exists within my extension's js code. //from my extension, i add a script element myExt.request(); //from server i get the following response myExt.callback ( {"some":"json"}) ; //but the window doesnt find a reference to myExt how do i make a reference to myExt variable from the webpage ?

    Read the article

  • how to identify process in kernel read func without using current->pid

    - by yoavstr
    my lecture wants us to build module where we need to identify each read process and where the same read process called twice on the same writer massage we should insert him to an queue who's we wake up when all readers have read I achieved this goal by by using list of pid's and boolean read/not_read inside each node but he decided to be nasty and require us to it with some argument from FILE struct can you please help me ?....

    Read the article

  • how to save current state of application

    - by medma
    hi, I am making an iphone application in which after login we will go through some steps and then finally we make a call from within the app. As we know on making call our app quits so plz suggest me how to resume that state on relaunching the app? 1-login 2-some steps 3-list of numbers 4-call Any help will be appreciated. Thanx..

    Read the article

  • jquery tabs - load url in current tab?

    - by BigDogsBarking
    I'm trying to figure out how to load the url each tab links to inside the tab area onclick, and have been trying to following the docs at http://docs.jquery.com/UI/Tabs#...open_links_in_the_current_tab_instead_of_leaving_the_page, but am clearly not getting it.... This is the HTML markup: <div class="tabs"> <ul class="tabNav"> <li><a href="/1.html#tabone">Tab One</a></li> <li><a href="/2.html#tabtwo">Tab Two</a></li> <li><a href="/3.html#tabthree">Tab Three</a></li> </ul> </div> <div id="tabone"> <!-- Trying to load content from 1.html in this div on click --> </div> <div id="tabtwo"> <!-- Trying to load content from 2.html in this div on click --> </div> <div id="tabthree"> <!-- Trying to load content from 3.html in this div on click --> </div> And this is the jquery I'm trying to use: $(".tabs").tabs({ load: function(event, ui) { $('a', ui.panel).click(function() { $(ui.panel).load(this.href); return false; }); } }); I know I've got some part of this wrong.... I've gone through several iterations (too many to post), and all I get is a blank div... I don't know... Feeling a bit confused here... Help?

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >