Does Style Transfer Model can generate variant output? - deep-learning

I am finding the model that can fit 2 requirements:
The generated output have to obey the input style
After each inference, generated output will different but still follow the style.
Thank you all, hope to seeing the answers
I have tried style transfer model but it can't solve the problem. The model cannot give the new output after every inference.

Related

Extract CSS code related to a specific component

Is there a way to extract a component (e.g., button) from an online website without going over the CSS(in case the CSS is complicated)?
Let's say I want to extract this button and only the CSS related to the component.
)
Could it be converting CSS to inline CSS or something similar?
It's easy to get the window.getComputedStyle() of an element, but it would be cluttered with a lot of properties and values that are probably irrelevant to you, and would still miss some important information about where some values came from (for example, if they are calculated by percents or are inherited).
The "computed" tab of the browser's DevTools would give you more clear and detailed information about the values of most properties, but you would still need some manual work. I don't think there is an equivalent JavaScript API that you can use to automate the process, and even if there was, it seems that there isn't a simple criteria to distinguish between the properties and values that are "relevant" and those who are not.

How to visually compare two HTML documents?

I am creating a Windows Forms application in order to compare two HTML documents. The first one is retrieved from an external source and contains some structure mistakes. So an algorithm is applied to transform the HTML text into an optimized document and that corresponds to the second document to compare. After that, I want to visually compare the optimized document to the first one and display differences if they are ones.
I created a form with two webview2 controls, where the first one displays the first HTML document. A button is used to transform HTML text and then I would like to know what is the best way to perform a visual comparison. The ideal behavior would be for the second webview2 to display the transformed HTML document and to display differences with a special color for example.
So my first approach is to use this function:
await webview2.CoreWebView2.ExecuteScriptAsync("window.print();");
And perfom a visual comparison of the two screenshots, but I saw that the control of the print popup window is not possible for the moment with the webview2 component.
So do you think there is a better way to accomplish that? Are there any more suitable components or tools to perform this comparison?
Thanks in advance for your help!
In the algorithm, could you add the changed element ids to a list, take that list, and then change the CSS via javascript to highlight the elements in the list.
I'm working on an implementation of it now to see if its viable.

Bind html to multiple .ts file in angular

I'm currently working on an Angular app, specifically a quite complex table, in terms of styling and features.
My component file currently has 2k lines of code, and it comprehends functions for styling text, styling the table, functions for check if data treated are correct, data formatting and so on...
Many of theese funtions are called directly from the HTML fiel thorugh interpolation.
Is there any way to break up this quite large file into smaller ones?
You can break up your component into smaller ones and nest them.
Typical example:
<app-list>
<app-list-item></app-list-item>
</app-list>
The parent component can then pass its properties down to the child components:
<app-list>
<app-list-item [name]="valueFromParent"></app-list-item>
</app-list>
It is further possible to emit values back up from the child to the parent:
<app-list>
<app-list-item (onChildEvent)="updateParent($event)"></app-list-item>
</app-list>
I tried to keep it simple here, but there is more to it.
I suggest going through the official Angular tutorials, because they explain these concepts pretty well.
You should further try to put as much functionality into Services as possible. This also helps to make your components smaller, easier to reason about and helps testing.
E.g. a functions for check if data treated are correct would be a good example for a service method.

Converting formula/equation in docx to html using docx4j

I'm trying to convert docx containing equations to on Android. I came across docx4j which is great and tested the following sample (HtmlExporterNonXSTL):
https://github.com/plutext/docx4j/blob/android/src/main/java/org/docx4j/convert/out/html/HtmlExporterNonXSLT.java
However I noticed that it doesn't handler equations well - if some symbol or number has some power and/or indices their position is alway in the middle e.g.
k_{n+1}^2 (latex format)
is displayed as:
kn+12 (with 'n+12' having correct smaller font but they are both vertically aligned)
Is there any way to adjust CSS to handle powers and indices? (full formula conversion would be better but I guess it is not so easy). I'm new to docx4j but looks like somehow
handlePPr()
method will need to be modified in HtmlExporterNonXSLT example. Before I would dive into it I thought about asking is it even possible to accomplish it (any way to obtain the offset property of a run?
Disclosure: I'm docx4j project lead
You're welcome to modify HtmlExporterNonXSLT in order to fix your particular example, but as you say, full formula conversion would be better.
Here are links to three prior posts on that subject (newest first):
math-equations-and-docx-to-html-conversion-not-working
need-to-handle-latex-equation
math-expression-issue

Adding ids to HTML tags for QA automation

I have a query In our application we have lots of HTML tags. During development many tags were not given any id because of no requirement.Now the QA team wants to automate the test cases using QTP. In most of the cases this tool doesn't recognizes because it does not find ids for most of the HTML tags.Now we are asked to add ids to all the HTML tags.
I want to know if there will be any effect adding id attribute to these tags. Even positive impact are welcome
I do not think there will be any either positive or negative effect : maybe the size of the HTML page will increase a bit, but probably not that much.
Still, are you sure you need to put "id" attributes on every HTML tag of your pages ? Wouldn't only a few of those be enough ? Like on form fields, on links, on error-messages ; and that's probably about it ?
One thing you must take care, though, is that "id", as in "identifers", must be unique ; which implies it might be good, before starting adding them, to define some kind of "id-policy", to say, for instance, that "ids for elements of that kind should be named that way".
And, for your next projects : have developpers add those when theyr're developping ;-)
(And following the policy, of course)
Now that I'm thinking about it : a positive effect might be that it'll be easier to write Javascript code interacting with your HTML document -- but that'll be true for next projects or evolutions for this one, when those id are already present in the HTML at the time developpers put the JS code in place...
Since there are no QTP related answers yet.
GUI recognition in QTP is object-oriented. In order to identify an object QTP needs a unique combination of object's properties, and checking them better to be as fast as possible - that is why HTML ID would be ideal.
Now, where it is especially critical - for objects that do not have other unique identifiers. The most typical example - html tables. Their contents is dynamic, their number on the page may vary. By adding HTML ID you allow recognition mechanism get straight to the right table.
Objects with other unique properties can be recognized well without HTML ID. For example, if you have a single "submit" link on the page QTP will successfully recognize it by inner text.
So the context-specific answer: don't start adding ids to every single tag. Ask automation guys to prepare a list of objects they have problem with. And add ids to those objects.
PS. It also depends on automation programming skills. There are descriptive programming and dynamic recognition methods. They allow retrieving the right objects even without ids provided.
As Albert said, QTP doesn't rely solely on elements' id, in fact due to the fact that many web applications generate different ids for each session, (as far as I remember) the id property isn't part of the default description for most web test objects.
QTP is pretty good at recognizing most simple web controls and if you're facing problems it may be the case that a Web Extensibility project will help you bridge the gap between the semantics of your web application and the raw HTML it is created in. If a complex control is recognized by QTP as a WebElement (which is actually the div that contains the span that drives the code) you will understandably have object recognition problems since there are many divs on the page but probably many less complex controls.
If you are talking about side-effects - NO. Adding ids won't cause any problems (apart from taking up some extra bytes of course)
If you really have the need to add ids, go ahead and add them.
http://www.w3.org/TR/html4/struct/links.html#anchors-with-id says: The id and name attributes share the same name space. This means that they cannot both define an anchor with the same name in the same document. It is permissible to use both attributes to specify an element's unique identifier for the following elements: A, APPLET, FORM, FRAME, IFRAME, IMG, and MAP. When both attributes are used on a single element, their values must be identical.