dynamic

jquery - how to addClass based on the content of an element?

Suppose you have a table like this: <table> <tr> <td>Group 1</td> <td>some data here</td> <td>Group 2</td> </tr> </table> and you want it to be like this: <table> <tr> <td class="group1">Group 1</td> <td>some data here</td> <td class="group2">Group 2</td> </tr> </table> Both Nick Craver's and Kevin's solutions here below work nicel...

Creating Dynamic Sitemap in SharePoint

Hello all, I have developed a publishing portal in sharepoint.I have a requirement wherein I need to create sitemap for the entire web application. This should be dynamic, in the sense, whenever we update the contents of any given page in our web application, it should be reflected immediately in the sitemap page. What are the possibl...

Accessing C++ classes based on list of strings

Hi, I am hoping this is possible in C++. I have a list of classes that inherit from a common base class (Base). All of these will be compiled as part of the library linked to my program. I could be adding more classes that derive from Base and will be recompiling everything after I do this. When my program starts it will gather a vec...

Dynamically creating local variables in Ruby

I have a CSV file which I'm parsing and inserting bits of it in a database. I'd like to write a parser which takes account of the fact that the column order may change in the future. I thought that I could do this by grabbing the header line as an array, and for each line, putting the value in a dynamically created local variable (usin...

Dynamic SWF loading with out running the main class

I've been using SWFLoader and ModuleLoader to dynamically load SWFs. The problem I'm having before I instantiate any class it runs the creationcomplete event of the main class when I do the moduleInfo.load(). Is there a way to load the SWF without creating an instance of the main class? ...

Dynamic/Static scope with Deep/Shallow binding (exercises)

I'm studying dynamic/static scope with deep/shallow binding and running code manually to see how these different scopes/bindings actually work. I read the theory and googled some example exercises and the ones I found are very simple (like this one which was very helpful with dynamic scoping) But I'm having trouble understanding how stat...

jQuery inserting element .before() and .after() does not work as expected, what am I doing wrong?

I am trying to dynamically surround sets of IMG and A tags with a div tag but am unable to make it work. my html: <img class="myClass-1" src="img5" /> <a class="myClass-2" href="url"></a> my script: $('img.myClass-1').each(function(){ $(this).before('<div style="position: relative;">'); $(this).next().after('</div>'); ...

C# 4.0: Dynamic, Inheriting from DynamicObject

Let's say I have this: dynamic foo = new Foobar(); And I have this: public class Foobar : DynamicObject { } The question is, is it possible to override members of DynamicObject so that this code: string name = new Foobar().Name Does not throw an Exception at run-time? I want to return default for name's if Name is not a member....

Java - Dynamic Class Casting from Interface to Implementation

I have read other related posts, but am still not quite sure how, or if it is possible to Dynamically cast (Interface to Implementation) in Java. I am under the impression that I must use Reflection to do so. The particular project I am working on requires a usage of many instanceof checks, and it is, in my opinion getting a bit out o...

Why this.Page.Master is not working when I set the MasterType?

I have an aspx page which is linked to a MasterPage. If I write "this.Master" Visual Studio autocopletes the MasterPage's properties and I can access its properties. But If I write "this.Page.Master" Visual Studio does not autocomplete and I also get a compilation Error when I try to use any MasterPage's property because it is not reco...

dynamic keyword enables "maybe" monad?

So I have this in my C# lib: public static TOut IfNotNull<TIn, TOut> (this TIn instance, Func<TIn, TOut> func) { return instance == null ? default(TOut) : func(instance); } Used like: DateTime? expiration = promo.IfNotNull(p => p.TermsAndConditions.Expiration) .IfNotNull(e => e.Date); I keep wrac...

C : Dynamically storing strings (of dynamic sizes!)?

Am I missing something incredibly simple? because I can't seem to find a reason why my code isn't storing strings dynamically. All I get are blank lines when I print them at the end. Its supposed to print the last "n" lines of an arbitrary number of lines. There seems to be a problem with the storage of the actual lines though. Can anyon...

how to add dynamic property for python object

site=object() for k,v in dict.iteritems(): setattr(site,k,v) print site.a#it won't works i use this code but it didn't work,any one could help?thanks ...

Referencing a non-existent user Control?

I have created an application that searches a directory and loads all of the usercontrols into the form and then uses a "GetResult()" method to grab the answers from the form. I did not do this OOP style because I am still learning how to fully utilize OOP and I am now going back to design it with OOP so I can move onto the next part whi...

dynamic forms asp.net

Hi all, Today i'm using crystal reports to create parameterized forms and save them into PDF, but isn't there other alternatives? What i want to do? Well, simply have a form with information "placeholders" (that's how i'm using crystal) ... then in code i set the placeholder data to be binded ... Save as PDF and voila... But crystal i...

YUI range slider separate ticksize for subranges

My requirement is typical. I need a price range dual-handle slider, where based on the current handle value, the tick size (step size) will change, for example if price is less that 1500, the tick size is 50. between 1500 and 15000, the tick size should become 100, between 15000 to 50000 the tick size should become 500, and so on. I have...

How to fill a textfield in later frames from the first frame?

Hello, I have a case where I can change the contents of an actionscript class which fills the dynamic text fields in a flash movie. The class function is called from the first frame in the movie and fills all visible fields. I need to fill a dynamic text field in the n-th frame (say 100, or so) but when I call tagline2.htmlText = "hell...

Binding to the change event in dynamically created dropdown list using jQuery

I am creating a number of dropdown lists dynamically using jQuery. I would like to be able to trigger an event when the selected dropdown list item changes. From browsing on here and elsewhere I see that it's not possible to bind to the change event of the dropdown lists using live() so I am wondering what are the alternatives? I know it...

Matching dynamically added events (as attributes) with jQuery

How can I match all elements that have a specific attribute that is added at run time? For example, the code: $('[onkeydown]') will successfully match: <div onkeydown="foo();"> but won't match the following div: <div id="mydiv"> // .... <script type="text/javascript"> var element = document.getElementById('mydiv'); element.onkeyd...

How do I use the trait scala.Proxy

I just found it in the API (http://www.scala-lang.org/api/current/scala/Proxy.html) and would like to see one or two examples along with an explanation what it is good for. ...