Search Results

Search found 9134 results on 366 pages for 'variadic functions'.

Page 40/366 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • Rails routing of a controller's functions query

    - by Jty.tan
    So I've got a Users controller, and it has (amongst others) a function called details. The idea is that a user can go to localhost:3000/user/:user_id/details and be able to view the details of :user_id. For example, I have a user called "tester". When I go to the uri: http://localhost:3000/users/tester/details I'd want the details function to be called up, to render the details view, and to display the information for the user tester. But instead I get an error saying that No action responded to tester. Actions: change_password, create, current_user, details, forgot_password, index, login_required, new, redirect_to_stored, show, and update_attributes And I understand that to basically mean that if I wanted to access details, I should really be using http://localhost:3000/users/details Except that that isn't really working either... .< That is instead bringing me to http://localhost:3000/users/details/registries (which is the default path that I'd stipulated for anybody trying to view users/:user_id, so again, that's working the way I wanted it to) Point is: Can anybody help and tell me how I can go about getting users/:user_id/details to work the way I want it to and display the details of :user_id? Thanks!

    Read the article

  • How to access widgets created within functions in later function calls in Qt

    - by Inanepenguin
    So currently I have code, in C++, that creates a few QLabels, a QLineEdit, and a QCheckBox when a selection is made from a QComboBox. However, I would like to be able to access the widgets I have created in a later function to destroy them if a new selection is made from the combo box. I am able to access the objects created from using the Designer by doing ui-Object but i am not able to do that with objects created by using my own code. Can I do that some how, because I know how to work with that. In short, I would like to be able to dynamically create/destroy QWidgets based on selections made by the user. Is there a reference I should know of to do this, or any documentation? Or am I just completely going about this the wrong way? Here is the code I presently have for creating the objects: if (eventType == QString::fromStdString("Birthday")) { QLabel *label1 = new QLabel ("Celebrant: "); QLabel *label2 = new QLabel ("Surprise: "); QLineEdit *lineEdit = new QLineEdit; QCheckBox *box = new QCheckBox; ui->gridLayout->addWidget(label1,3,0,1,1, 0); ui->gridLayout->addWidget(label2,4,0,1,1,0); ui->gridLayout->addWidget(lineEdit,3,1,1,1,0); ui->gridLayout->addWidget(box,4,1,1,2,0); }

    Read the article

  • Python : Crating Dynemic Functions

    - by jigar
    I have issue where i want to create Dynamic function which will do some calculation based to values retrieved from database, i am clear with my internal calculation but question in how to create dynamic class: My Structure is something like this : class xyz: def Project(): start = 2011-01-03 def Phase1(): effort = '2d' def Phase2(): effort = '3d' def Phase3(): effort = '4d' Now want to generate those all PhaseX() function dynamically so can any one suggest me how to achieve such thing using Python Code Waiting for Positive reply Regards Thank You

    Read the article

  • Asterisk with new functions

    - by MhdAboAhmad
    hi all , please need help for an asterisk I created a write func odbc list records files in sql table: [R] dsn=connector write=INSERT INTO ast_records (filename,caller,callee,dtime) VALUES ('${ARG1}','${ARG2}','${ARG3}','${ARG4}') prefix=M and set it in dialplan : exten = _0X.,n,Set( M_R(${MIXMONITOR_FILENAME}\,${CUSER}\,${EXTEN}\,${DTIME})= ) when I excute it I get an error : ast_func_write: M_R Function not registered:

    Read the article

  • Scala return type for tuple-functions

    - by Felix
    Hello Guys, I want to make a scala function which returns a scala tuple. I can do a function like this: def foo = (1,"hello","world") and this will work fine, but now I want to tell the compiler what I expect to be returned from the function instead of using the built in type inference (after all, I have no idea what a (1,"hello","world") is) I thought I remembered the classname being something like Tuple3[Int,String,String] but that doesnt work for me. Suggestions? :D (ps: I love stack overflow!)

    Read the article

  • Where to store frequently used functions in a OOP correct way

    - by Stefan Kuijers
    I'm working on a project which I want to build up OO. Now I came with a function that checks or a value is valid. private function valid(value:*, acceptedValues:Array):Boolean { for(var i:uint = 0; i < acceptedValues.length; i++) { if (value == acceptedValues[i]) { return true; } } return false; } As you can see, the function is very general and will be accessed across different classes. Now my question is; where do I store it in a OO correct way? Thanks in advance!

    Read the article

  • Clojure multimethod dispatching on functions and values

    - by Josh Glover
    I have a function that returns the indexes in seq s at which value v exists: (defn indexes-of [v s] (map first (filter #(= v (last %)) (zipmap (range) s)))) What I'd like to do is extend this to apply any arbitrary function for the existence test. My idea is to use a multimethod, but I'm not sure exactly how to detect a function. I want to do this: (defmulti indexes-of ???) (defmethod indexes-of ??? [v s] ;; v is a function (map first (filter v (zipmap (range) s)))) (defmethod indexes-of ??? [v s] ;; v is not a function (indexes-of #(= v %) s)) Is a multimethod the way to go here? If so, how can I accomplish what I'm trying to do?

    Read the article

  • JavaScript's Associative Array / Object can't be read in functions

    - by Matrym
    At the very beginning of the javascript file, I have: var lbp = {}; lbp.defaults = { minLength: 40 }; I can successfully alert it afterwards, with: alert(lbp.defaults.minLength); But as soon as I put it inside a function, when I alert, I get "Undefined". What gives, and how do I avoid this? Is it absolutely necessary to pass this variable into each function, for example, by doing: function(lbp) { alert(lbp.defaults.minLength); } I would have thought that defining it first, it would attain global scope and not be required to be passed in? Thanks in advance for enlightening me :)

    Read the article

  • Annonymous functions accessing local variables [ActionScript - Flex 3.5]

    - by Ali
    Hi All, I am having a situation with my actionscript/flex front end. for each (var sym:String in ["A","B","C"]) { const handler = function (data:Object):void { Alert.show(sym); } asyncCallback(handler); } I am expecting to have 3 Alert windows containing A, B and C. But the actual result is 3 alert windows all showing C ! I appreciate your comments. -A

    Read the article

  • Executing functions parallelly in PHP

    - by binaryLV
    Hi! Can PHP call a function and don't wait for it to return? So something like this: function callback($pause, $arg) { sleep($pause); echo $arg, "\n"; } header('Content-Type: text/plain'); fast_call_user_func_array('callback', array(3, 'three')); fast_call_user_func_array('callback', array(2, 'two')); fast_call_user_func_array('callback', array(1, 'one')); would output one (after 1 second) two (after 2 seconds) three (after 3 seconds) rather than three (after 3 seconds) two (after 3 + 2 = 5 seconds) one (after 3 + 2 + 1 = 6 seconds) Main script is intended to be run as a permanent process (TCP server). callback() function would receive data from client, execute external PHP script and then do something based on other arguments that are passed to callback(). The problem is that main script must not wait for external PHP script to finish. Result of external script is important, so exec('php -f file.php &') is not an option.

    Read the article

  • Python modules, classs, functions documentation through Sphinx

    - by user343934
    Hi everyone, I am trying to document my small project through sphinx which im recently trying to get familiar with. I read some tutorials and sphinx documentation but couldn't make it. Setup and configurations are ok! just have problems in using sphinx in a technical way. My table of content should look like this --- Overview .....Contents ----Configuration ....Contents ---- System Requirements .....Contents ---- How to use .....Contents ---- Modules ..... Index ......Display ----Help ......Content Moreover my focus is on Modules with docstrings. Details of Modules are Directory:- c:/wamp/www/project/ ----- Index.py >> Class HtmlTemplate: .... def header(): .... def body(): .... def form(): .... def header(): .... __init_main: ----- display.py >> Class MainDisplay: .... def execute(): .... def display(): .... def tree(): .... __init_main: My Documentation Directory:- c:/users/abc/Desktop/Documentation/doc/ --- _build --- _static --- _templates --- conf.py --- index.rst I have added Modules directory to the system environment and edited index.rst with following codes Welcome to Seq-alignment's documentation! Contents: .. toctree:: :maxdepth: 2 .. automodule:: index.py .. autoclass:: HtmlTemplate :members:Header,Body,Form,Footer,CloseHtml .. automodule:: display.py .. autoclass:: MainDisplay :members:execute,display,tree Indices and tables :ref:genindex :ref:modindex :ref:search When i make html file and view it, apparently i dont get Modules in the content tables but just there is show record and when i click it just i get "index.txt" version in another window. I need your suggestions Thanks

    Read the article

  • Lambda recursive PHP functions.

    - by Kendall Hopkins
    Is it possible to have a PHP function that is both recursive and anonymous (lambda). This is my attempt to get it to work, but it doesn't pass in the function name. $factorial = function( $n ) use ( $factorial ) { if( $n == 1 ) return 1; return $factorial( $n - 1 ) * $n; }; print $factorial( 5 ); I'm also aware that this is a bad way to implement factorial, it's just an example.

    Read the article

  • Excel Functions

    - by dwyane
    =MAX(SUM(A1:A5)) How do i incorporate the above formula into =IF( AND( $H$14<F22, F22<=($H$14+$H$15) ), $I$15, IF( AND( $H$14+$H$15<F22, F22<($H$14+$H$15+$H$16) ), $I$16, IF( AND( $H$14+$H$15+$H$16<F22, F22<=($H$14+$H$15+$H$16+$H$17) ), $I$17, $I$14 ) ) ) It keeps running a circular reference error. Help! The sum value shouldnt exceed 150. If exceed, then replace the cell with zero value.

    Read the article

  • C++: calling member functions within constructor?

    - by powerboy
    The following code raises a runtime error: #include <iostream> #include <iterator> #include <ext/slist> class IntList : public __gnu_cxx::slist<int> { public: typedef IntList::iterator iterator; IntList() { tail_ = begin(); } // seems that there is a problem here void append(const int node) { tail_ = insert_after(tail_, node); } private: iterator tail_; }; int main() { IntList list; list.append(1); list.append(2); list.append(3); for (IntList::iterator i = list.begin(); i != list.end(); ++i) { std::cout << *i << " "; } return 0; } Seems that the problem is in the constructor IntList(). Is it because it calls the member function begin()?

    Read the article

  • JavaScript functions broke my page jumps?

    - by Mark
    Hi everybody, I'm trying to develop a personal website and running into some issues. At the top of my page I had a horizontal table that contained 6 different images (buttons) that linked to different sections of the page. I wanted to spice up the buttons with JavaScript and make the image of the button change onMouseOver and onMouseOut so I found a way to do so online with some JavaScript but the problem now is that the buttons no longer jump to the appropriate section of the page when using Google Chrome or Safari, but in IE 9 they still do work correctly... Here is my old code that worked properly: <html> ... <body> <center> <table border="1" style="color:#D80000;text-align:center"> <tr> <td> <a href="#about"><img src="images/aboutMe.png" alt="About Me"></a> </td> <td> <a href="#courses"><img src="images/courseList.png" alt="Courses"></a> </td> <td> <a href="#work"><img src="images/workHistory.png" alt="Work History"></a> </td> <td> <a href="#places"><img src="images/placesBeen.png" alt="Places I've Been"></a> </td> <td> <a href="#games"><img src="images/gamesPlay.png" alt="Games I Play"></a> </td> <td> <a href="#contact"><img src="images/contactMe.png" alt="Contact"></a> </td> </tr> </table> </center> ... </body> </html> Here is my new code that is now broken: <html> <head> ... <script type="text/javascript"> <!-- if (document.images) { <!-- Preload original Images --> var about_init= new Image(); about_init.src="images/aboutMe.png"; var courses_init= new Image(); courses_init.src="images/courseList.png"; var work_init= new Image(); work_init.src="images/workHistory.png"; var places_init= new Image(); places_init.src="images/placesBeen.png"; var games_init= new Image(); games_init.src="images/gamesPlay.png"; var contact_init= new Image(); contact_init.src="images/contactMe.png"; <!--Preload images for mouseover --> var about_new= new Image(); about_new.src="images/aboutAlt.png"; var courses_new= new Image(); courses_new.src="images/courseAlt.png"; var work_new= new Image(); work_new.src="images/workAlt.png"; var places_new= new Image(); places_new.src="images/placesAlt.png"; var games_new= new Image(); games_new.src="images/gamesAlt.png"; var contact_new= new Image(); contact_new.src="images/contactAlt.png"; } function change_it(the_name) { if (document.images) { document.images[the_name].src= eval(the_name+"_new.src"); } } function change_back(the_name) { if (document.images) { document.images[the_name].src= eval(the_name+"_init.src"); } } //--> </script> </head> <body> ... <center> <table border="1" style="color:#D80000;text-align:center"> <tr> <td> <a href="#about" onMouseOver="change_it('about')" onMouseOut="change_back('about')"><img src="images/aboutMe.png" name="about" id="about" border="0" alt="About Me"></a> </td> <td> <a href="#courses" onMouseOver="change_it('courses')" onMouseOut="change_back('courses')"><img src="images/courseList.png" name="courses" id="courses" border="0" alt="Courses"></a> </td> <td> <a href="#work" onMouseOver="change_it('work')" onMouseOut="change_back('work')"><img src="images/workHistory.png" name="work" id="work" border="0" alt="Work History"></a> </td> <td> <a href="#places" onMouseOver="change_it('places')" onMouseOut="change_back('places')"><img src="images/placesBeen.png" name="places" id="places" border="0" alt="Places I've Been"></a> </td> <td> <a href="#games" onMouseOver="change_it('games')" onMouseOut="change_back('games')"><img src="images/gamesPlay.png" name="games" id="games" border="0" alt="Games I Play"></a> </td> <td> <a href="#contact" onMouseOver="change_it('contact')" onMouseOut="change_back('contact')"><img src="images/contactMe.png" name="contact" id="contact" border="0" alt="Contact"></a> </td> </tr> </table> </center> ... </body> </html> The images properly switch when the mouse is moved over/off them, but the jump to the corresponding page sections seems to be broken, it seems like they're all jumping to the #about section now. Once again, the weirder thing is that this is only the case when I'm using Google Chrome on my laptop running Windows 7 or Safari using my iPhone 4 but when I use the new Internet Explorer 9 on my laptop running Windows 7 all the buttons still link correctly. Any idea what's breaking the links?

    Read the article

  • How to benchmark functions in clojure

    - by Peter Tillemans
    I know I can get the time take to evaluate a function can be printed out on the screen/stdout using the time function/macro. The time macro returns the value of the evaluated function, which makes it great to use it inline. However I want to automatically measure the runtime under specific circumstances. is there a function which returns the elapsed time in some library to hep with this benchmarking?

    Read the article

  • Row/column counter in 'apply' functions

    - by mortalitysequence
    What if one wants to apply a functon i.e. to each row of a matrix, but also wants to use as an argument for this function the number of that row. As an example, suppose you wanted to get the n-th root of the numbers in each row of a matrix, where n is the row number. Is there another way (using apply only) than column-binding the row numbers to the initial matrix, like this? test <- data.frame(x=c(26,21,20),y=c(34,29,28)) t(apply(cbind(as.numeric(rownames(test)),test),1,function(x) x[2:3]^(1/x[1]))) P.S. Actually if test was really a matrix : test <- matrix(c(26,21,20,34,29,28),nrow=3) , rownames(test) doesn't help :( Thank you.

    Read the article

  • Aggregate Functions in Index with IBMDB2

    - by Erkan
    Is there any way to pre aggregate results of aggregate functionts (f.i. count()) and store it in an index? The background is: i want to speed up count() queries. So that: Select count(users) from TE123 where region = 'A'; would be supported by an index like Region Count(Users) A 548 E 458 I know that MQTs would also help for this problem. However, in this case it is not possible to use MQT, as we use kind of an ORM and we don't want to define Entities on MQTs. I just slightly remember - one DBA told me - that there is such a function planned for DB2 V10.

    Read the article

  • Javascript nested functions not returning

    - by Achintha Samindika
    I'm building a phonehap application. I'm using an web sql and everything works fine till data retival. function getItemGroups(){ var items_groups = new Array(); var db = window.openDatabase("merbokDB", "1.0", "MerbokDB", 5232394); db.transaction( function(tx){ tx.executeSql('SELECT * FROM item_groups',[], function(tx,result){ if(result.rows.length > 0){ var len = result.rows.length; for (var i=0; i<len; i++){ items_groups.push(result.rows.item(i).item_group); } console.log(items_groups.join()); } } ,errorCB); }, errorCB); return items_groups; } var myproducts = getItemGroups(); My problem was when I run the code "myproducts" variable is blank. but the I can see console.log(items_groups.join()); following line printing the values in console. Is I'm wrong in the way I returning?

    Read the article

  • filter functions problem

    - by Adam
    I'm working on a search component for an app I'm working on and I needed to add some filters to it. I've found an example and got the first filter working fine. Now I'm trying to add a second filter I'm running into problems... In the example I found they use filterFunctions, but I only get an option for filterFunction, why is that? Here's the example code productsCollection.filterFunctions = [ filterByPrice, filterByType, filterByCondition, filterByVendor ] And this is what I'm trying acData.filterFunction = [filterByStatus, filterByDate] but with this code I get the following error message - 1067: Implicit coercion of a value of type Array to an unrelated type Function. Why am I getting this error and how would I go about add multiple filters to my Array Collection? Thanks!

    Read the article

  • c# template member functions

    - by user3730583
    How can I define a template member function in C# For instance I will fill any collection which supports an Add(...) member function, please check out the sample code below public class CInternalCollection { public static void ExternalCollectionTryOne<T<int>>(ref T<int> ext_col, int para_selection = 0) { foreach (int int_value in m_int_col) { if (int_value > para_selection) ext_col.Add(int_value); } } public static void ExternalCollectionTryTwo<T>(ref T ext_col, int para_selection = 0) { foreach (int int_value in m_int_col) { if (int_value > para_selection) ext_col.Add(int_value); } } static int[] m_int_col = { 0, -1, -3, 5, 7, -8 }; } The ExternalCollectionTryOne<...(...) would be the preferred kind, because the int type can be explicit defined, but results in an error: Type parameter declaration must be an identifier not a type The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?) The ExternalCollectionTryTwo<...(...) results in an error: 'T' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'T' could be found (are you missing a using directive or an assembly reference?)... I hope the problem is clear – any suggestions? ----------------------------- edit -------------------------- The answers with the interface ICollection<.. without a template member works fine and thanks all for this hint, but I still cannot define successfully a member template(generic) function So a more simpler example ... how can I define this public class CAddCollectionValues { public static void AddInt<T>(ref T number, int selection) { T new_T = new T(); //this line is just an easy demonstration to get a compile error with type T foreach (int i_value in m_int_col) { if (i_value > selection) number += i_value; //again the type T cannot be used } } static int[] m_int_col = { 0, -1, -3, 5, 7, -8 }; }

    Read the article

  • Why can't c# calculate exact values of mathematical functions

    - by Timo Willemsen
    Hey everyone, Why can't c# do any exact operations. Math.Pow(Math.Sqrt(2.0),2) == 2.0000000000000004 I know how doubles work, I know where the rounding error is from, I know that it's almost the correct value, and I know that you can't store infinite numbers in a finite double. But why isn't there a way that c# can calculate it exactly, while my calculator can do it. Edit It's not about my calculator, I was just giving an example: http://www.wolframalpha.com/input/?i=Sqrt%282.000000000000000000000000000000000000000000000000000000000000000000000000000000001%29%5E2 Cheers

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >