Vaadin 7 and applet - vaadin

0.7 and I want to Call an Applet for use a Token.
I did various tests:
1) Use of AppletIntegration 1.2.9 but when I call applet there's an Exception "ClassNotFoundException PaintTarget"
2) Download Legacy 1.2.10 by https://github.com/Haulmont/AppletIntegration/releases but when I cal the page I have the Exception ""Widgetset does not contain implementation for org.vaadin.applet.AppletIntegration. Check its #ClientWidget mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions. Unrendered UIDL:
org.vaadin.applet.AppletIntegration(NO CLIENT IMPLEMENTATION FOUND)"
3) I create a class AppletCustom
public class AppletCustom extends CustomComponent {
public AppletCustom(String codebase,
String archive,
String code,
String width,
String height,
Map<String, String> params) {
setCompositionRoot(new Label("<div id='appletDiv'></div>", ContentMode.HTML));
StringBuilder sb = new StringBuilder();
/* create the applet */
sb.append("var obj = document.createElement('object');");
sb.append("obj.setAttribute('type','application/x-java-applet');");
sb.append("obj.setAttribute('width','" + width + "');");
sb.append("obj.setAttribute('height','" + height + "');");
sb.append("var codeParam = document.createElement('param');");
sb.append("codeParam.setAttribute('name', 'code');");
sb.append("codeParam.setAttribute('value', '" + code + "');");
sb.append("obj.appendChild(codeParam);");
sb.append("var archiveParam = document.createElement('param');");
sb.append("archiveParam.setAttribute('name', 'archive');");
sb.append("archiveParam.setAttribute('value','" + archive + "');");
sb.append("obj.appendChild(archiveParam);");
sb.append("var param = document.createElement('param');");
sb.append("param.setAttribute('name', 'codebase');");
sb.append("param.setAttribute('value','" + codebase + "');");
sb.append("obj.appendChild(param);");
/* add params to the applet if you like */
if(params != null && !params.isEmpty()){
Iterator<Entry<String, String>> it =
params.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> pairs = (Map.Entry<String, String>) it.next();
sb.append("param = document.createElement('param');");
sb.append("param.setAttribute('name', '" + pairs.getKey() + "');");
sb.append("param.setAttribute('value','" + pairs.getValue() + "');");
sb.append("obj.appendChild(param);");
}
}
sb.append("document.getElementById('appletDiv').appendChild(obj);");
JavaScript.getCurrent().execute(sb.toString());
}
}
and i Call it in the page. The applet is seen correctly but i must to return a value using the method
vaadinUpdateVariable("docName", docName + SIGNED_FILE_SUFFIX, true);
How can i resolve my problem?

you might have have run into one of two Maven GWT plugin bugs: [MGWT-147][1] or [MGWT-148][2] just like [Henri Sara][3] said .
i recommended this blog for you : Vaadin addons and maven and eclipse.
please read this also : Using Vaadin with Maven 2
to help you getting your add-on work . if still n't fixed i refer using [Embedded][6] ui component and avoid the hard coding html tag's.
i wish if i helped you if n't i'm sorry that all i know about Vaadin+applets.
1# jira.codehaus(.)org/browse/MGWT-147
2#jira.codehaus(.)org/browse/MGWT-148
3#vaadin(.)com/c/my_sites/view?groupId=13199&privateLayout=0
4# vaadin(.)com/download/prerelease/7.0/7.0.0/7.0.0.rc2/docs/api/com/vaadin/ui/Embedded.html

Related

Unable to view screenshots in Jenkins reports

My jenkins reports do not show the screenshots captured in the runs. (They are run on a MAC). However, when I run the same job locally (windows machine), the reports have the screenshots.
I see the error as below in the Jenkins report.
When I try to open the image, It shows below. It's unable to find the path to the image actually.
Error : http://*****-mac:8080/job/***Test/job/******/ws/target/screenshots/2019-01-14/Sign%20In20190114154253.png
Actual: http://*****-mac:8080/job/***Test/job/******/HTML_20Report/target/screenshots/2019-01-14/Sign%20In20190114154253.png
I'm using the below code to capture the screenshot. It does capture the screenshots & I can see them in the actual location.
I don't know when I did a mistake, these images are not seen as links/not available in the report:
public void captureScreenshot() throws IOException {
Date date = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String dateForScreenshots = dateFormat.format(date);
File localScreenshots = new File(new File("target/screenshots"), dateForScreenshots);
if (!localScreenshots.exists() || !localScreenshots.isDirectory()) {
localScreenshots.mkdirs();
}
System.setProperty("org.uncommons.reportng.escape-output", "false");// this is to create a link in ReportNG
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
String destination = System.getProperty("user.dir") + "/target/screenshots/" + dateForScreenshots + "/" + getDriver().getTitle() + Utils.generateRandomString() + ".png";
File screenshotName = new File(destination);
//Now add screenshot to results by copying the file
FileUtils.copyFile(scrFile, screenshotName);
Reporter.log("<br> <img src='" + destination + "' height='90' width='160' /><br>");
Reporter.log("");
}
From this line
Error : http://*****-mac:8080/job/***Test/job/******/ws/target/screenshots/2019-01-14/Sign%20In20190114154253.png
I think that Jenkins cannot find the target branch in the workspace folder (ws). Probably you need to specify the workspace folder in the Jenkins job (as in this answer) or just change the destination variable somehow to something like (added /HTML_20Report):
String destination = System.getProperty("user.dir") + "/HTML_20Report/target/screenshots/" + dateForScreenshots + "/" + getDriver().getTitle() + Utils.generateRandomString() + ".png";

Google AdWords Script AdGroupBidModifierService

I found this script at Google AdWords Script API. https://developers.google.com/adwords/api/docs/guides/adgroup-bid-modifiers
But I get error at line 2: "Missing ; before statement (line 3)". I can't seem to find the problem.
// Get the AdGroupBidModifierService.
AdGroupBidModifierServiceInterface bidModifierService = adWordsServices.get(session, AdGroupBidModifierServiceInterface.class);
// Create selector.
Selector selector = new Selector();
selector.setFields(
new String[] {"CampaignId", "AdGroupId", "Id", "BidModifier"});
selector.setPaging(new Paging(0, 10));
// Make a 'get' request.
AdGroupBidModifierPage page = bidModifierService.get(selector);
// Display bid modifiers.
if (page.getEntries() != null) {
for (AdGroupBidModifier modifier : page.getEntries()) {
String value = (modifier.getBidModifier() == null) ?
"unset" : String.valueOf(modifier.getBidModifier())
System.out.println("Campaign ID " + modifier.getCampaignId()
+ ", AdGroup ID " + modifier.getAdGroupId()
+ ", Criterion ID " + modifier.getCriterion().getId()
+ " has ad group level modifier: " + value);
}
} else {
System.out.println("No bid modifiers were found.");
}
Anyone else experienced problem with this code? Also is it possible to get it to work with AdWords.App?
First: You can not use Java code in AdWords Scripts, you must use javascript. See more about Adwords Scripts in: https://developers.google.com/adwords/scripts/
Second: You can not get the CPC for old dates, just the current CPC bid
Are you doing this as part of a Java application, or within the Google AdWords script editor?
If the latter, that's the problem. The Google Script editor works off Google Script (which is essentially JavaScript)

Why throws me an error Local Report Services in MVC when is deployed?

Something so rare is happening.
In my rdlc report, I set some textboxes to display as a PDF in the MVC 4 project and if I running it in localhost mode, it works so good.
But if I deployed the solution, throws me the following error.
Parameter is not valid. [ArgumentException: Parameter is not valid.]
System.Drawing.Graphics.GetHdc() +1144409
Microsoft.ReportingServices.Rendering.RichText.LineBreaker.Flow(TextBox
textBox, Graphics g, FontCache fontCache, FlowContext flowContext,
Boolean keepLines, Single& height) +57
Microsoft.ReportingServices.Rendering.RichText.TextBox.MeasureFullHeight(TextBox
textBox, Graphics g, FontCache fontCache, FlowContext flowContext,
Single& contentHeight) +500
Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.DetermineVerticalSize(PageContext
pageContext, Double topInParentSystem, Double bottomInParentSystem, ....
[LocalProcessingException: An error occurred during local report
processing.]
Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format,
Boolean allowInternalRenderers, String deviceInfo, PageCountMode
pageCountMode, CreateAndRegisterStream createStreamCallback,
Warning[]& warnings) +338
Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format,
Boolean allowInternalRenderers, String deviceInfo, PageCountMode ...
NOTE: I've noticed if a remove those textboxes in my rdlc (I mean removing everthing), generate a blank PDF. So, I realized that the textboxes are the trouble, but I don't know why only when I deployed.
What am I missing?
The code which I'm using is the next one:
public ActionResult SampleReport()
{
LocalReport localReport = new LocalReport();
localReport.ReportPath = Server.MapPath("~/Reports/Report1.rdlc");
string reportType = "PDF";
string mimeType;
string encoding;
string fileNameExtension;
//The DeviceInfo settings should be changed based on the reportType
//http://msdn2.microsoft.com/en-us/library/ms155397.aspx
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.5in</MarginTop>" +
" <MarginLeft>1in</MarginLeft>" +
" <MarginRight>1in</MarginRight>" +
" <MarginBottom>0.5in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
//Render the report
renderedBytes = localReport.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
//Response.AddHeader("content-disposition", "attachment; filename=NorthWindCustomers." + fileNameExtension);
return File(renderedBytes, mimeType);
}
UPDATE:
When I start to dig about how to create PDF using Report Services, I only followed these guides:
http://weblogs.asp.net/rajbk/archive/2009/11/25/rendering-an-rdlc-directly-to-the-response-stream-in-asp-net-mvc.aspx
Publishing Web site without installing Microsoft Report Viewer
The last one is because, I have to include as Referenced Libraries three of them, Microsoft.ReportViewer.Common, Microsoft.ReportViewer.WebForms and Microsoft.ReportViewer.ProcessingObjectModel because, when I deploy my solution does not count with these libraries, so I added manually.
And that's it!

Updating issue with JIRA rest api 4.4

I am trying to update the fixVersion of an issue via the JIRA rest api. The JIRA version is 4.4.3#663-r165197. It is the instance hosted by codehaus, not sure if that makes a difference or not.
The request looks like:
curl -u [username]:[password] -X PUT -H 'Content-type: application/json' \
-d "http://jira.codehaus.org/rest/api/latest/issue/GEOS-[id]"
{
"update":{
"fixVersions":[
{
"set":[
{
"name":"2.2-beta3"
}
]
}
]
}
}
But I get back a 405, method not allowed error. Which makes sense if I look at the rest api docs for that version [1]. They seem to indicate there is no way to update an issue in this manner. BUt if I look at the docs for the latest version [2] they seem to indicate it is possible.
So I guess the question is how do I update an issue in this manner in JIRA 4.4? Or is it not possible?
Thanks!
[1] https://developer.atlassian.com/static/rest/jira/4.4.1.html#id151460
[2] http://docs.atlassian.com/jira/REST/latest/#id165544
For 4.4 you have to use the SOAP updateIssue method. 5.0 fixed this.
Prepare Json data as below(Here java as technology i had used), and pass using put method/API.
public static String generateJson(String customFieldId, Object value,
String attribute) {
if (isBlankOrNull(attribute)) {
return "\"" + customFieldId + "\":" + "\"" + value + "\"";
} else {
return "\"" + customFieldId + "\":{\"" + attribute + "\":\"" + ""
+ value + "\"}";
}
}
public static int invokePutMethod(String auth, String url, String data) {
int statusCode = 0;
try {
Client client = Client.create();
WebResource webResource = client.resource(url);
ClientResponse response = webResource
.header("Authorization", "Basic " + auth)
.type("application/json").accept("application/json")
.put(ClientResponse.class, data);
statusCode = response.getStatus();
return statusCode;
} catch (Exception e) {
Constants.ERROR.info(Level.INFO, e);
// vjErrorLog.info(Level.INFO, e);
}
return statusCode;
}
attribute could be key, id, name, value etc,
In case of fix version or components, you may have one more way to prepare json data
return "\"" + customFieldId + "\":[{\"set\" :[{ \"" + attribute
+ "\" :" + "\"" + data + "\"}]}]";
and invoke put method with above json data.

vlcj:: Unable to load library 'libvlc' in 64bit OS

I am using 64 bit OS Windows 7 and i have 32 bit VLC versioned 1.1.8.
I have added these libraries
jna.jar
platform.jar
vlcj-1.1.5.1.jar
I am not able to stream using jVlc
public class HelloVLC {
/**
* #param args
* #throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.out.println( WindowsRuntimeUtil.getVlcInstallDir());
NativeLibrary.addSearchPath("libvlc", "C:\\Program Files (x86)\\VideoLAN\\VLC");
String media = "dshow://";
String[] options = {" :dshow-vdev=Integrated Webcam :dshow-adev= :dshow-caching=200", ":sout = #transcode{vcodec=theo,vb=800,scale=0.25,acodec=vorb,ab=128,channels=2,samplerate=44100}:display :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep"};
System.out.println("Streaming '" + media + "' to '" + options + "'");
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();
final HeadlessMediaPlayer mediaPlayer = mediaPlayerFactory.newMediaPlayer();
mediaPlayer.playMedia(media, options);
}
}
I am getting the error Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libvlc': The specified module could not be found.
Kindly help. Is there any way to get this code work in 64 bit OS????
have you tried running it with a 32-bit JVM?
if you are using windows 7 then search for a file libvlc.dll and libvlccore.dll files in to your vlc installation and add their path to code that you've written in
NativeLibrary.addSearchPath() also add...
this worked me in my case windows 7.
NativeLibrary.addSearchPath(
RuntimeUtil.getLibVlcLibraryName(), ""c:/Program Files/VideoLAN/VLC/");
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
LibXUtil.initialise();
VLCj comes with automagic discovery methods, os-independent, that adds the relevent path to JNA:s search path:
NativeDiscovery nd = new NativeDiscovery();
if (!nd.discover()) {
System.out.println("VLC not found");
System.exit(-1);
}
String vlcLibName = RuntimeUtil.getLibVlcName();
String vlcLibCoreName = RuntimeUtil.getLibVlcCoreName();
Native.loadLibrary(vlcLibName, LibVlc.class);
...etc
for a good tutorial on how to load the VLC natives, see
http://capricasoftware.co.uk/#/projects/vlcj/tutorial/first-steps
(See also the previous steps in that tutorial)!

Resources