Why do I get a 1, then a 0 when this script runs in greasemonkey:
//jQuery source code.....
alert(jQuery('body').size());
(function(jQuery){
var find = jQuery.find;
jQuery.find = function(selector, context){
return find(selector, context);
};
})(jQuery);
alert(jQuery('body').size());
...
I've written a plugin to highlight terms used to find a page. The source is also available.
My problem is, if you look at the first link's inline JavaScript, I've made a custom textPlacement function to handle the insertion of the display bar (it looks a bit like Stack Overflow's).
As you can see, I have an event handler on the button ...
Or better yet how do I dump all the variables in a given scope in jsp?
(In php you can use a function call to see all the system, global and user-defined vars and functions available...)
...
In section 11.5.1 of "The C++ Programming Language", Bjarne Stroustrup writes:
Like a member declaration, a friend declaration does not introduce a name into an enclosing scope.
For example:
class Matrix
{
friend class Xform;
friend Matrix invert (const Matrix &);
//..
};
Xform x; // error: no Xform in scope
Matrix (*p...
Given a model with *default_scope* to filter all outdated entries:
# == Schema Information
#
# id :integer(4) not null, primary key
# user_id :integer(4) not null, primary key
# end_date :datetime
class Ticket < ActiveRecord::Base
belongs_to :user
default_scope :conditions => "tickets.end_date >...
What is the difference between the following two snippets of code:
using (Object o = new Object())
{
// Do something
}
and
{
Object o = new Object();
// Do something
}
I have started using using a lot more but I am curious as to what the actually benefits are as compared to scoping objects.
Edit: Useful tidbits I took ...
I'm really stuck on why the following code block 1 result in output 1 instead of output 2?
Code block 1:
class FruitContainer:
def __init__(self,arr=[]):
self.array = arr
def addTo(self,something):
self.array.append(something)
def __str__(self):
ret = "["
for item in sel...
Here is my situation...
I am trying to dynamically generate a bunch of stuff in my settings.py file on a django site.
I am setting up several sites, (via sites framework) and I want to have some values I plug in to a function that will generate a portion of the settings file for each site.
for example:
from universal_settings import ...
My web service program is supposed to generate a random code and return it to the client program. Right now it returns "" as the code instead of the randomly generated code. What is wrong with my variable scopes? Thanks.
public class Service1 : System.Web.Services.WebService
{
private string code = "";
[WebMethod]
public vo...
I'm getting an error msg
DataReader.h:13: error: 'String' was not declared in this scope
DataReader.cpp:5: error: redefinition of 'std::vector<Data*, std::allocator<Data*> > DataReader'
DataReader.h:13: error: 'std::vector<Data*, std::allocator<Data*> > DataReader' previously declared here
DataReader.cpp:5: error: 'String' was not decla...
Hi guys,
I'm trying to populate a list of buttons with results from a xml picture list in AS2. These buttons will load the resulting image from the xml. I'm populating the buttons by first getting the number of results in the xml, and then using a for loop to attachMovie the require number of buttons and assign the actions to them.
Th...
Lets say I have this code
$(document).ready(function()
{
$('.checkbox').change(function()
{
$('.hidden').slideUp('slow', function()
{
alert(checkbox value);
}
}
}
How do I access the checkboxes value? $(this) doesn't work as you're now in the .hidden element?
...
I need to create a variable that can be accessed throughout my WordPress Theme template files (index.php, header.php etc..). I know function definitions go inside the functions.php template file (in your theme path), but there's no such thing for variables.
For example I constantly need to retrieve Categories in my Theme, so I would li...
Hello,
I'm studying databases and am currently working on a object-relational DB project and I've encountered a small problem with the number of possible constraints in an object table. I'm using "Database Systems: The Complete Book" by Hector Garcia-Molina (and other authors) as a reference and there's a general SQL example like this:
...
Code Example:
var gospels : Array = ["john", "mark", "matthew", "paul"];
for each (var book : String in gospels)
{
var loader : URLLoader = new URLLoader();
loader.load(new URLRequest("http://example.com/" + name));
trace(book) // outputs current value of array
loader.addEventListener(Event.COMPLETE, function(e : Event) : voi...
I have a working memoize decorator which uses Django's cache backend to remember the result of a function for a certain amount of time. I am specifically applying this to a class method.
My decorator looks like:
def memoize(prefix='mysite', timeout=300, keygenfunc=None):
# MUST SPECIFY A KEYGENFUNC(args, kwargs) WHICH MUST RETURN A ST...
So I have this app
require 'tk'
class Foo
def my_fancy_function
puts "hello, world!"
end
def initialize
@root = TkRoot.new{title "Hello, world!"}
frame = TkFrame.new
my_fancy_button = TkButton.new(frame) do
text "Press meee"
command {my_fancy_function}
pack
end
frame.pack
Tk.mainloop
...
Edit: My debugger was lying to me. This is all irrelevant
Howdy all,
I had a peek at http://stackoverflow.com/questions/637438/adding-element-to-vector, but it's not helpful for my case.
I'm trying to add an element (custom class LatLng) to another object (Cluster) from a third object (ClusterManager).
When I pass my LatLng to Clust...
Do stack-based languages have a concept of scope? It would seem to me that if function parameters are placed on the stack before the function executes, that they do in an unorthodox sort of way.
Or, I could be trying to impose an abstraction that doesn't quite fit.
...
Is there a way to transfer ownership of the data contained in a std::vector (pointed to by, say T*data) into another construct, preventing having "data" become a dangling pointer after the vector goes out of scope?
EDIT: I DON'T WANT TO COPY THE DATA (which would be an easy but ineffective solution).
Specifically, I'd like to have some...