Posts

node.js - Dynamically load Javascript functions -

I want to load a dynamically and want to call Javascript functions with a JSON file. This idea is to build a plugin framework that will enable others to add functionality by typing a function and updating the JSON file. For example, with the following JSON: {"plugins": {"random": {"name": "random number generator", "hook": "random"}}} ... and the following plugin: random.js module.export.ron = function () {return mathematics. (Mathematics. RANDOM () * 100); } I want to be able to parse the JSON file and want to call the run function of any plugin How can I load and call the run function on random? Depending on what you have described, just need the requirement module. var plugins = required ('./plins.json'); Var plugins for = objects Kids (plugins); For (var i = 0; i & lt; plugin kios; i ++) plugins [plugin keys [i]]. Func = is required ('.' '[Plugin ki [i]. Hook +' .js...

Ruby on Rails: passing value from view to controller -

I am new to rail. I have calculated some value in a javascript based on user input and now I want to set a variable presence in the controller function at the calculated value. Is it possible to do this or is there a better way? Are you sending an ultimate with javascript? Then just set: @variable = params [: calculation]

dojo - A dgrid row disappears when sorting -

I have implemented dgrid. It is really clear though, when I click on the row to sort it, but All in a row disappears, I am trying to understand how mad is going .... Let's go to it. DGrid, it's a dojo-based data grid, see When using JavaScript and HTML and join the Observavist Memestor, the grid is populated, in which many rows Data is happily displayed. Columns are sortable, that is, you can click on the row / column title. However - and here's the problem - when these row / column headings are clicked to collapse the line row, then all one row disappears One memory (dojo / store / memory) Using Digit Data Store is a good job - that is, to sort the rows successfully; however, when observation (dojo / store / inspection) is used as a data store, then order rows Causes fall Please see the examples given below. Working with memory: function populateGrid (memory, message) {var featureOne = {"id": message [0] .Quality ["id "Call 2": Mes...

ember.js - Returning record(s) after store pushPayload call -

What is a better way to bring back records after DS.Store # pushPayload ? This is what I am doing ... var payload = {id: 1, title: "example"} store.pushPayload ('post', payload); Return store.getById ('Post', Payload.Id); But, regular DS With the store # push you get the record back entered, the only difference between the two, which I can tell, is that D. Store # Pushpeload serializes the payload data with the correct serializer. DS.Store # pushPayload an array of objects is not the only one, and it may contain side-loaded data, it does a complete payload process and requires the route in the payload: {"posts" : [["Id": 1, "title": "title", "comments": [1]}], "comments": [// .. and so on ...]} ds Store # Push Expecting a single record is normalized and does not have any side loaded data (note no root key): {"id": 1, "title": "title", ...

html5 - How to center align Text in carousel? -

I am trying to create simple text carousel using pure css3 (no javascript). With the help of some references; I managed to write the code mentioned below: In this code, the text is being mis-aligned; Can you please help in fixing? Carosuel; Please try it out: & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Style & gt; # Carousel Pe (Text-Alignment: Center; Position: Relative;} # Carousel P: nth-child (1) {Opacity: 1.0; -WebKit-Transform: Translation X (0 pixels); -MOZ-TRANSFORM: Translation X (0 Pixels ); -MMS-Transform: Translator X (0 px); -O-Transform: Translation X (0 pixels); Conversion: Translator X (0 pixels); Animation: Carousel 1 10S Infinite; Webkit-Animation: Carousel 1 10 S Infinity; / * Safari and Chrome * Sarosol P: nth-child (2) {Opacity: 0.0; Animation: Carousel 2 10s Infinite; Webkit-Animation: Carosol 2 10s Infinity; / * Safari and Chrome # / Carrosol P: nth-child (3 ) {Opacity: 0.0; Animation: Carous...

parallel processing - Can you parallelise inexact Jacobian calculation in Julia without special arrays? -

In Julia, you wanted to calculate a false Jacobian based on a vector function, F (x), for which Much is necessary to evaluate the calculation of Jacoban's assessment clearly there is quite a systematic similarity in the concept. My question is, can it be done without the support of the distributed array, shadearere etc in Julia? For example, suppose you have the code: function Jacob (f:: function (x) = 1e-7 delta = eps * eye (length (X) J = Zero (length (x), length (x)) for i = 1: length (x) J [:, i] = (F (x + delta [:, ii]) - F ( X-delta [:, ii])) / 2 / EPS end J & Is it possible to parallel in this way, according to the manual, the sum of the 200000000 random coin flip Can explain parallel? I = 1: 200000000 int (randbool ()) end I've tried nheads = @ parallel (+) something like this: function of yakub (f :: function, x) Required ("testfunc.jl"); EPS = 1e-7 delta = EPS * eye (length (x)) J = zero (length (x), length (x)) for j = @ parallel (+...

nsarray - copy custom array without pointing old array in iOS ARC -

I would like to know how can I make a deep copy of the custom array without pointing to the old array. I have examined almost all stack overflow queries but no solution was found. Please help copy the array without pointing to my old array so that my new array operation does not affect (add, remove) the original / old array. This is my main manifestation manifesto. @ Property (non-dynamic, strong) NSArray * secArray; Add a custom object to the array NSMutableArray * secDataArray = [NSMutableArray array]; [SetRequest.SetMembersEnumerateObjectsUsingBlock: ^ (SetMember * subscriber, NSUInteger idx, block *) {SecData * secData = [secDataArray lastObject]; (Sec SecData.open = Yes; [Second Data Arrayed Object: Second Data]; } And {{secData.lines addObject: member]; }}]; New array in deep copy of custom array NSArray * newSecarray = [[NSMutableArray alloc] initWithArray: secArray copyItems: Yes]; But extracting data from the new array also removes data from the old arr...