Electron: Edit content in preload or main? - electron

What the best practise to edit Content with modules.
I send a array from my renderer, with the preload as bridge, to my main. But i have to edit the array. For the editing i created modules to keep my code tidy. I can't import the modules to my renderer and handle it already there, because of the contextIsolation.
Should i send the raw array to the main and edit it in my main? Or should i edit the array in my preload first and send the edited array after?
I hope you understand what i mean. Thanks :)

Related

YAT: Save final console output to file

I want to save final data from console output to file without intermediate.
How can i do that?
The report module exports all info into html in JSON format. You can get some info from there (cumulative percentiles, for example). You even don't have to modify python code in that case, just add some JS to the page that generates a table.
On the other hand, if you want something more then that info included there, you should implement it in the report module.
What particular pieces of last screen data are you interested in?
P.S by the way, one may create a couple of templates and then provide the template parameter in report section of load.ini to specify which one you want to use.
This screen is good report only for "const" benchmarking. For "line" and "step" ramping the last screen always demonstrates the worst timings and resources. But we are thinking about this feature request.

ViewModel in ZF2

I am working on a project and was wondering if anyone else has messed with the view model much. Im looking for some examples on how to inject other view models i.e header,footer content.
I already have the template and layout path switching Im just trying to figure out the best way to handle if I select layout1 and it has 3 footer content fields, and a slider so how would put a class in front of the render to gather and inject required data
EDIT
Ok I guess I should clarify LOL .... slight ADHD where my mind wanders.
What should I listen for before injecting the viewmodels or can I do this in my onBootStrap() in my main module. I currently
$sites = $e->getApplication()->getServiceManager()->get('Application\Model\Sites');
$sr = $sites->getSiteByDomain();
Since many domains and/or subdomains can point to this and puts info in a session. Maybe im over thinking it and should just extend actionController like I did in ZF1
LOL PHP so many ways to do something ......
Thx for any pointers
There's two helpful links i can give you. One is the playground of Rob Allen alias Akrabat, you can find his playground right over here at github. The other one would be the official documentation which is nicely documented on this part.
If those don't help you, you should specify your question and show us what you've tried so far.

From db to css file?

I have a small set of css items in a db table that I need to turn into a css file to be included on a page. How can I do this in Rails3?
Is there a way I can call this directly from a stylesheet_link tag? Do I need to go through some ruby to open a file and output it in some directory first? Do I do this in a controller?
The css is actually its own model associated to the item using the css.
I do not know and looking for a solution found little yet, so asking here.
EDIT:
Simple when looked at, I was looking toward a sass or less solution and may still, but this is a simple start
I would create a Controller that retrieves the data from the database that uses a View to render the data to a Cascading Style Sheet.
You could then reference the given URL whenever you need to use the resulting stylesheet.
This is the easiest way that I have found http://blog.hasmanythrough.com/2007/10/18/simpler-than-dirt-restful-dynamic-css

Bind functions to elements inserted in the DOM? (Implicitly?)

This is probably jquery basics, but I can't find a solution after much googling.
How do you attach "non-events" to elements inserted in the DOM?
For events, like click, we can use live() or bind().
How would you, for instance, initialize tabs() or addClass() to a new element?
Specifically, I'm trying to get tabs() to work in the content of an ajax loaded dialog, but I think the correct solution should be applicable to any situation.
I did see a trick that involved $('body').mousemove() which did work, but that is still binding to an event and obviously a hack.
For instance, how would you get addClass() to fire on a newly inserted table row?
I mean to do this implicitly, meaning that I don't want to write out specific instructions for every event that adds nodes to the dom, I just want it to "run in the background".
Let me know if this needs clarification, I see many similar questions on SO but no answers that have helped.
EDIT: Simple example: A page calls $('a').addClass('highlight') which works on all anchors in the page. A new anchor is then added to the page dynamically by jQuery, but does not get the class added.
EDIT: I have tried all kinds of bind(), trigger() and change() methods but I'm afraid I'm barking up the wrong tree.
you need to look at livequery it will allow you to apply things to newly added elements
also if your adding the element you can do
$('body')append('<div>some content</div>').tabs();
or something like that
I know that I may contradicting your "non-event" rule here, but just by saying that you want something "triggered", you're already implying some kind of event.
In that case, may I suggest jQuery custom events? You may want to create a custom event, then trigger it manually somewhere in your code. It's not automatic (like when you add a row, BOOM, it fires™), but that's the closest thing I can think of with what you were describing.
Specifically, you may want to look at jQuery's .bind() and .trigger() methods.

Can I add text to page-source dynamically in Ruby on Rails

I would like to add text dynamically to the page source in a particular view. I checked the IO streams, but couldn't find anything. Could you please provide some pointers.
Edit:
Thanks for the reply. I was trying to know how much time each part/component in a particular view takes to render and log it as part of the page-source. Please let me know if I am not clear enough.
You can use JavaScript to modify the Document Object Model (DOM) of a page after Rails has rendered the view. If you edit your question to make it more specific then we can give more specific answers.

Resources