I'm currently working on a JavaFX program with some fellow students.
We organized everything with GIT - thus, our SVG-files look alike.
We are also doing some animation within our SVG.
The problem is, that when my friends start their NetBeans, the SVG is not displayed correctly. Some parts are missing out. When they open the SVG with their web-browser however - it works.
Here's the part that is missing out on my friends PC.
<polyline id="beampath" stroke="brown" stroke-width="4" fill="transparent">
<animate id="bridgeLeft" attributeName="points" dur="1s"
begin = "0s; bridgeLeft.end + 2.5s "
from="20,62 30,62 35,62 50,62 "
to="20,62 30,62 35,70 45,88"
fill = "freeze"
/>
</polyline>
Does someone have any clue why that's the case?
We're really desperate.
Related
I have an android resume building application. I want to generate a PDF of size A4 from my view. Here's how my layout looks like - At the top I have a Top App Bar, and the whole view in encapsulated in drawer. The main part which contains user's details is encapsulated in nestedScrollView, which contains multiple LinearLayout and TextView. In this screenshot below, I have populated it with mock data, but in actuality, I am fetching data from the Firebase Realtime Database and displaying it on the UI.
I tried to understand iTextPdf solution and multiple question of similar type that has been asked here, but I couldn't find something solid. Please help me out, it would be of great help.
Also, please don't close this question by giving a reason that the question doesn't contain any code. It doesn't because I don't have any. I am trying to solve this problem from scratch. I have tried to describe my problem as much as I could.
try this:
create a WebView and copy the text of your edittext in it:
webview.loadData(youredittext.gettext().tostring, "text/html", "UTF-8");
and convert webview to pdf by below function:
private void createWebPrintJob(WebView webView) {
PrintManager printManager = (PrintManager) this
.getSystemService(Context.PRINT_SERVICE);
PrintDocumentAdapter printAdapter =
webView.createPrintDocumentAdapter();
String jobName = getString(R.string.app_name) + " Print Test";
if (printManager != null) {
printManager.print(jobName, printAdapter,
new PrintAttributes.Builder().build());
}
}
after that user can select page size for example A4
There are a lot of libraries that convert layouts to PDF, but let's opt for popular one so we could find answers if we're stuck.
The libraries I listed works like so : They take screenshot of your layout as bitmap image and convert it to pdf.
- 1st solution: iTextPDF https://github.com/itext/itext7 (New Version).
check this detailed tutorial which treates also the case of taking screenshot of a scrollview https://www.codeproject.com/Articles/989236/How-to-Convert-Android-View-to-PDF-2
and this stackoverflow answer https://stackoverflow.com/a/29731275/12802591
- 2nd solution: PdfMyXML library https://github.com/HendrixString/Android-PdfMyXml just follow the steps in the documentation.
They may be other solutions, but these are the popular ones.
Let Me know if it works for you and also if you're stuck. Thank you!
Im working on a little clipboard electron based app
I made a system which right now displays a popup balloon that says ive copied something
However i want it to actually display what was copied in my electron window and be able to keep a list of things ive copied. is there a specific way to do that?
Also is there any useful clipbaord API's that electron uses?
Thanks,
Code:
const CopyHotkey = globalShortcut.register("Ctrl+C", () => {
if(CopyHotkey) {
tray.displayBalloon({
title: "Good Job!",
content: "You copied something!"
})}});
I have following code to show a picture in an embedded picture in Vaadin
final Embedded currentPicture = new Embedded("Profile picture of " + strusername);
File uploadedPicture = new File(alreadyUploaded);
currentPicture.setSource(new FileResource(uploadedPicture));
This is just a small part of a larger project so this is just a snippet.
The code works fine but gives problem with caching. I know that I can counter the caching by adding a random factor to the URL of the image, but I can't seem to get it working with an embedded picture.
For instance: the value of alreadyuploaded is "/path/to/pic/user.jpg" and Vaadin shows the image as following: http://my.project/picture/APP/global/0/legacy/0/user.jpg when I check the HTML code.
When I refresh I see another picture (still not the right one) and the link is as following:
http://my.project/picture/APP/global/7/legacy/7/user.jpg
Another refresh results in:
http://my.project/picture/APP/global/9/legacy/9/user.jpg
Is there any way I can add a random element to an embedded picture? The example of the Book of Vaadin doesn't work since I don't have streamresource because I used this upload picture example on the Book of Vaadin
I'm developing a ImageJ plugin that It works in my desktop pc but in my laptop it doesn't.
For this reason, now I'm trying to improve and I want to modify the next steps but i can't get it. This is the code:
IJ.selectWindow("example");
IJ.run("Convert to Mask");
IJ.run("Fill Holes");
IJ.run("Set Scale...", "distance=1 known="+pixelSize+" pixel=1 unit=um");
IJ.run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Masks display clear record");
I known that "Analyze Particles" I must to use the ParticleAnalyzer class (I dont sure how to do but... I'm researching the class) but for the other steps I can not find solution.
I hope that someone can help, thank you.
Best Regards.
I didn't get what I wanted it but I left to use the windows and now I am using ImagePus variables and It works better. I put the code:
IJ.run(this.cMask, "Convert to Mask", "");
IJ.run(this.cMask, "Fill Holes","");
IJ.run(this.cMask, "Set Scale...", "distance=1 known="+pixelSize+" pixel=1 unit=um");
IJ.run(this.cMask, "Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 display clear record");
I think that everybody who uses Webdriver for test automation must be aware of its great advantages for web development.
But there is a huge issue if file uploading is part of your web flow. It stops being test automation. The security restriction of browsers (invoking file selection) practically makes it impossible to automate tests.
Afaik the only option is to have Webdriver click the file upload button, sleep the thread, have developer/tester manually select the file, and then do the rest of the web flow.
How to deal with this, is there a workaround for it? Because it really can't be done like this. It wouldn't make sense.
This is the only case I know of when browser security restrictions do not apply:
<script language=javascript>
function window.onload(){
document.all.attachment.focus();
var WshShell=new ActiveXObject("WScript.Shell")
WshShell.sendKeys("D:\MyFile.doc")
}
</script>
Webdriver can handle this quite easily in IE and Firefox. Its a simple case of finding the element and typing into it.
driver = webdriver.Firefox()
element = driver.find_element_by_id("fileUpload")
element.send_keys("myfile.txt")
The above example is in Python but you get the idea
Using AWT Robots is one option, if you're using Java, which you are. But it's not a good option, it is not very dependable, and not clean at all. Look here
I use HttpClient and run a few tests outside of Selenium. That's more dependable and cleaner.
See the code below. You'll need more exception handling and conditionals to get it to suit your job.
HttpClient c = new HttpClient();
String url = "http://" + cargoHost + ":" + cargoPort + contextPath + "/j_security_check";
PostMethod post = new PostMethod(url);
post.setParameter("j_username", username);
post.setParameter("j_password", password);
c.executeMethod(post);
url = "http://" + cargoHost + ":" + cargoPort + contextPath + "/myurl.html";
MultipartPostMethod mPost = new MultipartPostMethod(url);
String fileNameWithPath = this.getClass().getClassLoader().getResource(filename).getPath();
File f1 = new File(fileNameWithPath);
mPost.addParameter(elementName, f1);
mPost.addParameter("action", "upload");
mPost.addParameter("ajax", "true");
c.executeMethod(mPost);
mPost.getResponseBodyAsString();
The suggestion of typing into the text box works only if the textbox is enabled.
Quite a few applications force you to go through the file system file browser for obvious reasons.
What do you do then?
I don't think the WebDriver mavens thought of just presenting keys into the KeyBoard buffer (this used to be a "no brainer" in earlier automation days)
===
After several days of little sleep, head banging and hair pulling I was able to get some of the Robot-based solution suggested here (and elsewhere).
The problem i encountered was that the dialog text box that was populated with the correct file path and name could not respond to the KeyPress/Release Events of terminating the file name with VK_ENTER as in:
private final static int Enter = KeyEvent.VK_ENTER;
keyboard.keyPress(Enter);
keyboard.keyRelease(Enter);
What happens is that the file path and file name are typed in correctly but the dialog remains opened - against my constant hoping and praying that the key emulation will terminate it and get processed by the app under testing.
Does anyone know how to get this robot to behave a bit better?
Just thought I'd provide an FYI to author's original post of using ActiveX. Another workaround would be to integrate with desktop GUI automation tools to do the job. For example, google "Selenium AutoIt". For a more cross-platform solution, consider tools like Sikuli over AutoIt.
This of course, is not considering WebDriver's support for uploads on IE & Firefox via SendKeys, or considering for other browsers where that method doesn't work.
After banging my head on this problem for far too many hours, I wanted to share with the community that Firefox 7.0.1 seems to have an issue with the FirefoxDriver sendKeys() implementation noted above (at least I couldn't get it to work on my Windows 7 x64 box), I haven't found a workaround, but updating to Firefox 8.0.1 seems to have fixed the problem. For those of you wondering, it's also possible to use Selenium RC to solve this problem (though you need to account for all of your target operating systems and the native key presses required to interact with their file selection dialogs). Hopefully the issues I had to work around save other people some time, in summary:
https://gist.github.com/1511360
If you have your are using a grid, you could make the folder of the testfiles open for sharing.
This way you could select the upload input field and set its value to \\pc-name\myTestFiles
If you're not, you should go with local files on each system.