find

jquery, selector, style

HI, How can I add by jQuery, some class "test" just to what have style="display:none", Output: <tr style="display:none" class="test"></td></td></tr> <tr></td></td></tr> <tr style="display:none" class="test"></td></td></tr>> <tr></td></td></tr> Thanks ...

How to locate device on network?

Hello CodeLath, maker of the TonidoPlug walwart, provides a web server to locate the Plug on the LAN: http://www.tonidoplug.com/ip/ I'm curious to know how a script located on some web servers on the Net manages to find the IP address of a device located on my LAN that uses the non-routable, private address plan 192.168.x.x. If it fa...

Never display some records in CakePHP

Hi, I would like return some records from my base (eg. users roles) And I use usually function find(), findAll(), etc., and I always must write 'conditions' with like this: not display role admin (name!=admin). My question is, how I can in RoleModel set for all function will be return with this conditions. Sorry for english! Bye! ...

C# - Calculate min date / max date from a List

I have a List which contains Dates : List<string> StringDates; [0]: "04.03.2010" [1]: "09.03.2010" [2]: "11.03.2010" [3]: "12.03.2010" [4]: "16.03.2010" [5]: "18.03.2010" [6]: "19.03.2010" [7]: "23.03.2010" [8]: "25.03.2010" [9]: "26.03.2010" Using C# what is the best/shortest way to find out ...

What is wrong with this function?

I got a problem today. It had a method and I need to find the problem in that function. The objective of the function is to append new line to the string that is passed. Following is the code char* appendNewLine(char* str){ int len = strlen(str); char buffer[1024]; strcpy(buffer, str); buffer[len] = '\n'; return buff...

jquery find and replace text, without element id

I'm playing around with finding and replacing text. The only problem I'm having is finding a text string, that is not attached to an element with an ID. Otherwise, it would be easy. I'm trying something like this: $("*").each(function () { $(this).html(this.html().replace('Original Text','New Text')); }); Not working too well. ...

jQuery - Find and replace text, after body was loaded

I received some amazing help from others, concerning finding and replacing text with jquery. The code below will find the word: "Subject:" and replace it with "Name:" $("*").each(function () { if ($(this).children().length == 0) { $(this).text($(this).text().replace('Subject:','Name:')); } }); And this works wonderful...

How to find text in a richtextbox on another form c#

Hi I have 2 forms, one with containing a richtextbox and the other used for finding text in this rtb. On this Find form is a textbox and 2 buttons , "Find" and "FindNext" I've no idea how to link the 2 forms together to find the text and also how to find the text :-S Any help please?? ...

problem with code. Searching text in a rtb c#

I have 2 forms One includes a richtextbox the other is used to search for text in this rtb My code is showing an error and i dont know how to fix it. This is the line that shows the error RichTextBox box = ((Form1)base.Owner).rtxtEditor; It's saying "Object reference not set to an instance of an object." This is my whole code. p...

Active Record: ordering finds and also returning nulls

I want to find a ordered list of runners by their results. models class Race < ActiveRecord::Base has_many :runners, :dependent => :destroy end class Runner < ActiveRecord::Base belongs_to :race has_one :result, :dependent => :destroy end class Result < ActiveRecord::Base belongs_to :runner end trying to use something like t...

Find and Replace Text with Prototype

I am new to Prototype and was wondering how to simply "find" some text in a class/ID and "replace" this text. My html is like this: <div id="test"> <a href="/test">test</a> <a href="/test2">test2</a> <a href="/test3">test3</a> <a href="/test4">test4</a> </div> And I am trying to replace the "test" in between the <a> tags for ...

using cakephp, how do I handle model operations that return no results so my view doesn't break?

In my controller I have model operations that can return empty results. I've setup the view to display the results using a foreach loop. But if the model opertion is empty and returns no results then the foreach loop is breaking in my view. This is the operation: $match3 = $this->Draw->Match-> find('all',array('conditions'=>array('Matc...

Ruby Array find_first object ?

Hi, Am I missing something in the Array documentation? I have an array which contains up to one object satisfying a certain criterion. I'd like to efficiently find that object. The best idea I have from the docs is this: candidates = my_array.select { |e| e.satisfies_condition? } found_it = candidates.first if !candidates.empty? B...

Ruby-on-Rails: How to pull out most recent entries from a limited subset of a database table

Imagine something like a model User who has many Friends, each of who has many Comments, where I'm trying to display to the user the latest 100 comments by his friends. Is it possible to draw out the latest 100 in a single SQL query, or am I going to have to use Ruby application logic to parse a bigger list or make multiple queries? I ...

Ruby on Rails: Instantiate associated models with find_by_sql?

Apparently, include and select can't be used simultaneously on a Rails find query, and this has been repeatedly marked as wontfix: http://dev.rubyonrails.org/ticket/7147 http://dev.rubyonrails.org/ticket/5371 This strikes me as very inconvenient, because the times I'd want to use include are exactly the same times I'd want to use select...

Ruby on Rails: Is it possible to :include the other leg of a circular join table?

I'm working on an application that models friendships between users. class User has_many :friendships has_many :friends, :through => :friendships, :conditions => "status = #{Friendship::FULL}" end class Friendship belongs_to :user belongs_to :friend, :class_name => "User", :foreign_key => "friend_id" end ...

Ruby on Rails: Is there a way to find with ActiveRecord that will first try the cache and if it fails run a query?

Let's say that I'm looking for a specific item in a has_many association. Is there a way to find that won't rehit the database if what I'm requesting is already cached? Here's my situation (which is not working and does not do what I requested): class User has_many :friendships def some_function(buddy) f = friendships.detect{...

phpinfo showing on pages without being called

Some pages are showing the phpinfo() output (in HTML so not php -i) even though there is no call to phpinfo() in that page. The pages include a number of files, but i have grep'd the whole directory from base but cannot find any instance of phpinfo() or "phpinfo" etc. I've also looked at all "shell", "exec" and "eval" that could gener...

How does C# lambda work?

I'm trying to implement method Find that searches the database. I forgot to mention that I'm using Postgresql, so I can't use built in LINQ to SQL. I want it to be like that: var user = User.Find(a => a.LastName == "Brown"); Like it's done in List class. But when I go to List's source code (thanks, Reflector), I see this: public T ...

JQuery Find #ID, RemoveClass and AddClass

Hi Guys, I have the following HTML <div id="testID" class="test1"> <img id="testID2" class="test2" alt="" src="some-image.gif" /> </div> I basically want to get to #testID2 and replace .test2 class with .test3 class ? I tried jQuery('#testID2').find('.test2').replaceWith('.test3'); But this doesn't appear to work ? A...