Search Results

Search found 8446 results on 338 pages for 'dynamic cast'.

Page 84/338 | < Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >

  • Creating dynamic resource in cookbook

    - by zsong
    Long story short, here is my code: template "...." do .... notifies :restart,"service[myservice_One]" notifies :restart,"service[myservice_Two]" end ['One', 'Two'].each do |proj| service 'myservice_#{proj}' do start_command "setsid /etc/init.d/my_command #{proj} start" stop_command "setsid /etc/init.d/my_command #{proj} stop" restart_command "setsid /etc/init.d/my_command #{proj} restart" status_command "setsid /etc/init.d/my_command #{proj} status" supports :status => true, :restart => true action [:enable,:start] end end I got this error: template[...] is configured to notify resource service[celery_worker_One] with action restart, but service[celery_worker_One] cannot be found in the resource collection. I know I can duplicate my code to make it work but how to dynamically create the services? Thanks!

    Read the article

  • Dynamic, reflective SignalHandler in Java

    - by pilcrow
    How do I install signal handling logic iff sun.misc.Signal is available? Background First generation of my code looked something like this: class MyApp { public static void main(String[] args) { ... Signal.handle(term_sig, new SignalHandler() { public void handle(Signal sig) { ... } }); ... } } I believe I understand how to reflectively test for and use signal handlers -- Class.forName("sun.misc.Signal"), reflectively call Signal.handle, and so forth. My impulse was simply to instantiate another anonymous inner class with the dynamically obtained SignalHandler class, but I think that's just wishful syntax.

    Read the article

  • java dynamic function calling

    - by dpaksp
    here is that case....i have an String array that contains only method names of yyyyyy.java file in xxxxxx.java file am creaing yyyyyy.java 's instance (say obj) now i have access obj.fuction_name....that function i should get from that String array in loop ...is that possible ... thank u

    Read the article

  • Dynamic allocated array is not freed

    - by Stefano
    I'm using the code above to dynamically allocate an array, do some work inside the function, return an element of the array and free the memory outside of the function. But when I try to deallocate the array it doesn't free the memory and I have a memory leak. The debugger pointed to the myArray variable shows me the error CXX0030. Why? struct MYSTRUCT { char *myvariable1; int myvariable2; char *myvariable2; .... }; void MyClass::MyFunction1() { MYSTRUCT *myArray= NULL; MYSTRUCT *myElement = this->MyFunction2(myArray); ... delete [] myArray; } MYSTRUCT* MyClass::MyFunction2(MYSTRUCT *array) { array = (MYSTRUCT*)operator new(bytesLength); ... return array[X]; }

    Read the article

  • template static classes across dynamic linked libraries

    - by user322274
    Hello, I have a templated class with a static value, like this: template <class TYPE> class A{ static TYPE value; }; in the code of a dll I assign the static value: code of DLL_1 A<float>::value = 2.0; I wish the value to be shared by all the dlls I'm using, i.e. I want that: code of DLL_2 printf("value on DLL_2 %f",A<float>::value); print out "2.0" any clues? thx

    Read the article

  • Dynamic use of :default_url in Paperclip

    - by dgilperez
    I'm trying to configure Paperclip to provide different missing images based on the instance's category attribute. Every category of the object has its own missing image. This is my first take: EDIT to add full models: class Service < ActiveRecord::Base attr_accessible :logo, :logo_file_name, :logo_content_type, :logo_file_size, :logo_updated_at belongs_to :category, :counter_cache => true has_attached_file :logo, :path => "/:id-:style-:filename", :url => ":s3_eu_url", :default_url => "/logos/:style/#{self.category.name]}.png", :styles => { :large => "600x400>", :medium => "300x200>", :small => "100x75>", :thumb => "60x42>" } end class Category < ActiveRecord::Base attr_accessible nil has_many :services end In my view, image_tag service.logo.url(:thumb) outputs: undefined method `category' for #<Class:0x0000010a731620> Any ideas? EDIT2: A working default_url is :default_url => "/logos/:style/missing.png", SOLUTION: See my own answer below.

    Read the article

  • Dynamic loaded libraries and shared global symbols

    - by phlipsy
    Since I observed some strange behavior of global variables in my dynamically loaded libraries, I wrote the following test. At first we need a statically linked library: The header test.hpp #ifndef __BASE_HPP #define __BASE_HPP #include <iostream> class test { private: int value; public: test(int value) : value(value) { std::cout << "test::test(int) : value = " << value << std::endl; } ~test() { std::cout << "test::~test() : value = " << value << std::endl; } int get_value() const { return value; } void set_value(int new_value) { value = new_value; } }; extern test global_test; #endif // __BASE_HPP and the source test.cpp #include "base.hpp" test global_test = test(1); Then I wrote a dynamically loaded library: library.cpp #include "base.hpp" extern "C" { test* get_global_test() { return &global_test; } } and a client program loading this library: client.cpp #include <iostream> #include <dlfcn.h> #include "base.hpp" typedef test* get_global_test_t(); int main() { global_test.set_value(2); // global_test from libbase.a std::cout << "client: " << global_test.get_value() << std::endl; void* handle = dlopen("./liblibrary.so", RTLD_LAZY); if (handle == NULL) { std::cout << dlerror() << std::endl; return 1; } get_global_test_t* get_global_test = NULL; void* func = dlsym(handle, "get_global_test"); if (func == NULL) { std::cout << dlerror() << std::endl; return 1; } else get_global_test = reinterpret_cast<get_global_test_t*>(func); test* t = get_global_test(); // global_test from liblibrary.so std::cout << "liblibrary.so: " << t->get_value() << std::endl; std::cout << "client: " << global_test.get_value() << std::endl; dlclose(handle); return 0; } Now I compile the statically loaded library with g++ -Wall -g -c base.cpp ar rcs libbase.a base.o the dynamically loaded library g++ -Wall -g -fPIC -shared library.cpp libbase.a -o liblibrary.so and the client g++ -Wall -g -ldl client.cpp libbase.a -o client Now I observe: The client and the dynamically loaded library possess a different version of the variable global_test. But in my project I'm using cmake. The build script looks like this: CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(globaltest) ADD_LIBRARY(base STATIC base.cpp) ADD_LIBRARY(library MODULE library.cpp) TARGET_LINK_LIBRARIES(library base) ADD_EXECUTABLE(client client.cpp) TARGET_LINK_LIBRARIES(client base dl) analyzing the created makefiles I found that cmake builds the client with g++ -Wall -g -ldl -rdynamic client.cpp libbase.a -o client This ends up in a slightly different but fatal behavior: The global_test of the client and the dynamically loaded library are the same but will be destroyed two times at the end of the program. Am I using cmake in a wrong way? Is it possible that the client and the dynamically loaded library use the same global_test but without this double destruction problem?

    Read the article

  • dynamic memory allocation of 2d array in which columns are of different size

    - by vishal kumar
    i want to create a 2d array dynamically in c++ language. But in that 2d array columns should be of different size. i mean to say that 2d array should not be in M * N. It should be something like.... 1 2 next line 3 4 5 next line 2 3 4 5 next line 5 next line 4 5 7 I am able to create 2d array in above manner but how to display content of array continously create a problem for me. Please anyone explain me how to come up with this problem.

    Read the article

  • how to add a dynamic param

    - by user569846
    the jquery plugin that im using is this http://code.google.com/p/jquery-in-place-editor/ if i have a table like this <table> <thead> <tr> <th>id</th> <th>first name </th> <th>last name </th> </tr> </thead> <tbody> <tr> <td class="id">1</td> <td class="fname">sarmen</td> <td class="lname">mikey</td> </tr> <tr> <td class="id">2</td> <td class="fname">john</td> <td class="lname">angelo</td> </tr> <tr> <td class="id">3</td> <td class="fname">sarmen</td> <td class="lname">grande</td> </tr> </tbody> </table> and my js looked something like this $("td.fname").editInPlace({ url: 'ajax.php', params: '', show_buttons: true }); then lets say i click on the first record to edit it which is fname of sarmen. how can i pass a param that only accociates id 1 ? because if i do a query of lets say "update tbl_users set fname = '$_POST['update_value']' where fname = '$_POST['original_html']'" (note: im just showing an example so no need to clean posts if that was bothering you :) ) if i run this query the fname of sarmen will update in two records rather than one. How can i only update to id of 1 being to update only one record.

    Read the article

  • AngularJS recursive directive with a dynamic HTML template (bounty)

    - by Nazar Sobchuk
    I have a realy hard task here. I am working on an AngularJS web app, which is capable of sending different HTTP methods to our project's Restful Web Service and receiving responses in JSON. Basicaly it looks like this: You can create some REST resource from this application. Let's say an exam. To create an exam - you pick a resource from a list of available resources. This triggers a function, that sends a request to localhost:8080/STEP/api/explain/resorceName and gets a description for this resource. Description looks like this: http://jsonblob.com/534fc022e4b0bb44248d6460 After receiving a response - I start building input fields like follows (allFields - array of field objects for this resource, enumValues - enum values for resource's field if it's property isEnum = true): <div ng-repeat="field in allFields"> <div ng-show={{!field.isEnum}}> <p ng-show={{field.isRequired}}>{{field.name}}*: </p> <p ng-show={{!field.isRequired}}>{{field.name}}: </p> <input type="text" ng-model="updateEntityResource[field.name]" ng-change="getUpdateEntityAsText()" class="form-control" placeholder="{{parseClassName(field.type)}}"> </div> <div ng-show={{field.isEnum}}> <p ng-show={{field.isRequired}}>{{field.name}}*: </p> <p ng-show={{!field.isRequired}}>{{field.name}}: </p> <select ng-model="updateEntityResource[field.name]" ng-change="getUpdateEntityAsText()" class="form-control"> <option></option> <option ng-repeat="enumValue in field.enumValues" label={{enumValue.name}}>{{enumValue.ordinal}}</option> </select> </div> </div> Now, the problem. I need to create a recursive directive, which would be capable of generating fields in such maner as described above for every resource's field that has "restResourceName" not null. To get all it's fields you just send a request to localhost:8080/STEP/api/explain/restResourceName and get similar JSON response as shown above, which is then used to build HTML elements for inputing values into model. Does anyone know how this can be achieved using angular recursive directive? Every useful answer is highly appreciated and evaluated. The correct answer will get +50 or I will start a bounty, because I'm realy stuck with this for 2 days. If you need any additional info - let me know. Thank you.

    Read the article

  • Exporting to CSV with dynamic field type handling

    - by serhio
    I have to do an export from DB to CSV. field; fileld; field... etc Have 3 types of fields: Alpha, Numeric and Bool respresented as "alphaValue",intValue and True/False. I try to encapsulate this in a fields collection, in order to export if alpha then set "", if Bool=True/False if numeric let as is. and try to build a CsvField class: Public Structure?Class CsvField(Of T As ???) End Structure Enum FieldType Alpha Bool Numeric End Enum any suggestions welcomed.

    Read the article

  • is this correct syntax to create onclick event on dynamic html document

    - by user321382
    var val1=document.createElement("input"); val1.setAttribute('type',"image"); val1.setAttribute('src',"../images/delete.gif"); val1.setAttribute('id',chkid); val1.setAttribute('name',"val2"); val1.setAttribute('class',"mylist2"); val1.onclick=function(){var block=document.getElementById("repeat_ul"); var obj=document.getElementById('country_chk'); document.block.removeChild(obj);};

    Read the article

  • jQuery javascript dynamic menus with mbMenu plugin

    - by lafoaug
    Im using the MbMenu jQuery plugin. http://plugins.jquery.com/project/mbMenu http://pupunzi.open-lab.com/2009/01/18/mbmenu/ I am probably being ridiculously stupid but I wish to have multiple menus on the same page, but not load them from external files (the html structure of the menu already exists on the page). To me the only place you define what menu is linked to the element you call buildMenu on is the 'template' construction which is a external file. Thanks.

    Read the article

  • ant support for dynamic target

    - by Li He
    I previous saw some similar questions on stackoverflow but didn't see any solution. I guess the answer could be impossible and I am trying to see who can provide me this confirmation. AFAIK, an ant project contains several targets and each target may have several tasks. There is an task MacroDef that defines a sequential of `things' (tasks I suppose?). I tried to put target inside this block but ant complains the name of the target is missing (I am using the attribute of the macrodef to generate the name of the target). So it could be a dead end. Then I found that by using a task `script', we have access to the Project and can even call addTarget/AddOrReplaceTarget from there. But it seems that the targets I create there have no impact on the running targets. Does that mean ant doesn't support manipulating dependencies at target runtime? Is there any way to generate these targets before ant start building the dependency graph?

    Read the article

  • paypal_adaptive gem in Rails: Dynamic Receiver "Population" (Chained Payments)

    - by Jmlevick
    Note: I didn't find a better title for this O.o Hello, Humm... Look, what I want to do is to have a Rails app where a visitor can click a button/link to make a "special" chained payment using Paypal; Currently I have a Users registration form that has one field for the user to enter his/her paypal account email, and as I saw here: http://marker.to/XGg9MR it is possible to specify the primary reciever and the secondary ones by adding such info in a controller action when using the paypal_adaptive gem in a rails app. The thing is, I don't want to hard code the secondary reciever as I need to specify a different secondary reciever from time to time, (being specific my primary reciever will always be the same, but depending on what button/link the visitor clicks, the secondary one is going to change) and I want that secondary reciever email to be the paypal e-mail account from one of the registered users when the visitor clicks on their specific button/link... My question is: Is it possible to create such enviroment functionality in my app using the current implementation of the paypal_adaptive gem? Could someone point me in the right direction on how to accomplish such thing? I'm still learning rails and also I'm really new in the paypal handling universe with this framework! XD P.S. Thanks! :)

    Read the article

  • dynamic inheritance without touching classes

    - by Jasper
    I feel like the answer to this question is really simple, but I really am having trouble finding it. So here goes: Suppose you have the following classes: class Base; class Child : public Base; class Displayer { public: Displayer(Base* element); Displayer(Child* element); } Additionally, I have a Base* object which might point to either an instance of the class Base or an instance of the class Child. Now I want to create a Displayer based on the element pointed to by object, however, I want to pick the right version of the constructor. As I currently have it, this would accomplish just that (I am being a bit fuzzy with my C++ here, but I think this the clearest way) object->createDisplayer(); virtual void Base::createDisplayer() { new Displayer(this); } virtual void Child::createDisplayer() { new Displayer(this); } This works, however, there is a problem with this: Base and Child are part of the application system, while Displayer is part of the GUI system. I want to build the GUI system independently of the Application system, so that it is easy to replace the GUI. This means that Base and Child should not know about Displayer. However, I do not know how I can achieve this without letting the Application classes know about the GUI. Am I missing something very obvious or am I trying something that is not possible?

    Read the article

  • Get the Dynamic table data from gui in selenium webDriver

    - by Rabindra
    I am working on a web based Application that I am testing with Selenium. On one page the content is dynamically loaded in table. I want to get the Table data, i am geting a "org.openqa.selenium.NullPointerElementException" in this line. WebElement table = log.driver.findElement(By.xpath(tableXpath)); I tried the following complete code. public int selectfromtable(String tableXpath, String CompareValue, int columnnumber) throws Exception { WebElement table = log.driver.findElement(By.xpath(tableXpath)); List<WebElement> rows = table.findElements(By.tagName("tr")); int flag = 0; for (WebElement row : rows) { List<WebElement> cells = row.findElements(By.tagName("td")); if (!cells.isEmpty() && cells.get(columnnumber).getText().equals(CompareValue)) { flag = 1; Thread.sleep(1000); break; } else { Thread.sleep(2000); flag = 0; } } return flag; } I am calling the above method like String tableXpath = ".//*[@id='event_list']/form/div[1]/table/tbody/tr/td/div/table"; selectfromtable(tableXpath, eventType, 3); my html page is like <table width="100%"> <tbody style="overflow: auto; background-color: #FFFFFF"> <tr class="trOdd"> <td width="2%" align="center"> <td width="20%" align="center"> Account </td> <td width="20%" align="center"> Enter Collection </td> <td width="20%" align="center"> <td width="20%" align="center"> 10 </td> <td width="20%" align="center"> 1 </td> </tr> </tbody> <tbody style="overflow: auto; background-color: #FFFFFF"> <tr class="trEven"> <td width="2%" align="center"> <td width="20%" align="center"> Account </td> <td width="20%" align="center"> Resolved From Collection </td> <td width="20%" align="center"> <td width="20%" align="center"> 10 </td> <td width="20%" align="center"> 1 </td> </tr> </tbody> </table>

    Read the article

  • Got a static var which is working, now need to get dynamic var which isnt working

    - by Ritz
    got this variable var zvmlist = { 'Huishoudelijke hulp': 'Huishoudelijke hulp', 'Verpleging thuis': 'Verpleging thuis', 'Verzorging thuis': 'Verzorging thuis', '24 uurs zorg': '24 uurs zorg', 'Ondersteunende begeleiding': 'Ondersteunende begeleiding', }; this var is used in a function to create a dropdownlist. $.each(zvmlist, function(key, value) { var selected=''; if(key==eventdata.title){var selected='selected' } $('<option value="'+key+'" '+selected+'>'+value+'</option>').appendTo($('#calendar_edit_entry_form_title')); }); which works lika a charm. Now i created a function to fetch the list from a mysql table. $.get('get_zorgvormen.php', function(data) { var zvmlist = '{'+data+'}'; //alert(zvmlist); }); when i enable the alert function it shows me the var(array). But i it wont act as a variable. How can i pass this data to my .each function? see it in action here: http://www.zorgzuster-zeeland.nl/site/static/calendar_test.php

    Read the article

  • Dynamic change of class of <TR> with Jquery

    - by Coronier
    Hi all, This is my first post, and first please forgive me for my poor english. I have a problem I really can't fix: I have a <table> of questions, the first question is visible (class:visible), the others are hidden (class:hidden) $(document).ready(function(){ $('.hidden').hide(); When people click on the first question, I want the second question to appear (and the first question to turn to grey, using a 'done' class). $('.visible:not(.done)').click(function(){ $(this).addClass('done'); $('.hidden:first').toggle(500).removeClass('hidden').addClass('visible'); }) The first question is now done (class:done) and the 2nd question should be the only one to react to a click(), and so on... But it doesn't work: the other <tr> appear only when I click on the 1st <tr>. Can someone give me a hand on this problem ? Thank you.

    Read the article

  • dynamic text in <h1> tag

    - by Ami
    what would be the impact on SEO of changing the text of the <h1> dynamically on the server side each time the web page loads? I'm not talking about changing the whole text, just part of it, for example if the header contains some fixed text (with keywords of course), and also contains the current date or time/the current number of logged on users/the count of items current in stock/whatever. how would that affect my ranking? is it bad? doesn't make a difference? thanks.

    Read the article

  • calling a function from a set of overloads depending on the dynamic type of an object

    - by Jasper
    I feel like the answer to this question is really simple, but I really am having trouble finding it. So here goes: Suppose you have the following classes: class Base; class Child : public Base; class Displayer { public: Displayer(Base* element); Displayer(Child* element); } Additionally, I have a Base* object which might point to either an instance of the class Base or an instance of the class Child. Now I want to create a Displayer based on the element pointed to by object, however, I want to pick the right version of the constructor. As I currently have it, this would accomplish just that (I am being a bit fuzzy with my C++ here, but I think this the clearest way) object->createDisplayer(); virtual void Base::createDisplayer() { new Displayer(this); } virtual void Child::createDisplayer() { new Displayer(this); } This works, however, there is a problem with this: Base and Child are part of the application system, while Displayer is part of the GUI system. I want to build the GUI system independently of the Application system, so that it is easy to replace the GUI. This means that Base and Child should not know about Displayer. However, I do not know how I can achieve this without letting the Application classes know about the GUI. Am I missing something very obvious or am I trying something that is not possible?

    Read the article

  • dynamic tag count on keyup

    - by rod
    Hi All, I have a div that contains many spans and each of those spans contains a single href. Basically it's a tag cloud. I have a textbox with a keyup event that filters the tag cloud div (It actually just hides the tags if not in filter condition). Is there a way to get a count of the tags shown as the keyup event occurs? Thanks, rodchar

    Read the article

  • jquery accessing dynamic class selectors

    - by dinotom
    Given the following html rendering; <fieldset id="fld_Rye"> <legend>7 Main St.</legend> <div> <table> <tr> <th class="wideCol"><b><i>Service Description</i></b></th> <th class="wideCol"><b><i>Service Name</i></b></th> <th class="normalPlusWidth"><b><i>Contact Name</i></b></th> </tr> <ItemTemplate> <tr class=""> <td class="servDesc">&nbsp;<b>Plumbing Services</b></td> <td class="servName">&nbsp;<b>Flynnsters's Plumbing</b></td> <td class="servContact">&nbsp;<b>Jim Flynnster</b></td> </tr> </ItemTemplate> I am trying to access all the td's with a class of servDesc, get their width into an array and get the max width from that array to reset the css width of that class using jquery on page load. I cant seem to get the right selector for those tags, and I've tried at least 50 variations. My latest try; var maxTdWidth; var servDescCols = []; $("#fld_Rye td#servDesc").each(function () { alert("found one"); servDescCols.push(this.width()); }); maxTdWidth = Math.max.apply(Math, servDescCols);

    Read the article

< Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >