In JasperReports Server Pro 4.5, is there any way to force the program to open reports/repository elements in a new browser tab or window?
You should be able to fix that by updating the relevant JavaScript file to force everything to open in a new tab. In JRS 4.5.1 it's line 766 in the file .../jasperserver-pro/scripts/repository.search.actions.js
repositorySearch.RedirectAction.createRunResourceAction = function(resource, inNewTab) {
if (!resource) {
resource = resource ? resource : repositorySearch.model.getSelectedResources()[0];
}
var factoryMethod = repositorySearch.runActionFactory[resource.typeSuffix()];
if (factoryMethod) {
/* return factoryMethod(resource, inNewTab); this was the original */
return factoryMethod(resource, true);
} else {
return new repositorySearch.Action(function() {
alert("Run action for resource type '" + resource.resourceType + "' is not implemented!");
});
}
};
I cannot claim credit for figuring it out. Thanks to Igor Nesterenko for this solution.
Related
i am try to download asset bundle from an url but the request keep on cancelling after downloading 63kb. Can anyone explain to me why this may be happening?
My Code :
public IEnumerator DL()
{
string downloadlink = "https://drive.google.com/file/d/1OGyrB4-MQfo-HVom9ENvV4dn312_wL4Q/view?usp=sharing";
string filepath = Application.persistentDataPath + "/electroplatingNN";
//Download
UnityWebRequest dlreq = new UnityWebRequest(downloadlink);
dlreq.downloadHandler = new DownloadHandlerFile(filepath);
dlreq.timeout = 15;
UnityWebRequestAsyncOperation op = dlreq.SendWebRequest();
while (!op.isDone)
{
//here you can see download progress
Debug.Log(dlreq.downloadedBytes / 1000 + "KB");
yield return null;
}
if (dlreq.isNetworkError || dlreq.isHttpError)
{
Debug.Log(dlreq.error);
}
else
{
Debug.Log("download success");
}
dlreq.Dispose();
yield return null;
}
As already mentioned in the comments the issue is not in the UnityWebrequest but rather Google Drive doesn't simply download your file as you expect.
Instead the data you download is actually only the web page which would allow you to download it. If I simply open your file in a browser I get a page looking like this
where I now could download your file.
There are packages like this or this which implement the necessary stuff for actually download files from Google Drive API in Unity.
I make a basic plugin on netbeans 8.0.2 and I'm a little confused because I want to read the code in some way to provide errors or other notifications to the user you are writing code but not how.
This should print out all the text in all the open windows.
TopComponent tcArray[] = WindowManager.getDefault().findMode("editor").getTopComponents();
for (TopComponent tc : tcArray) {
System.out.println("tc = " + tc);
Collection<? extends FileObject> fileobjs = tc.getLookup().lookupAll(FileObject.class);
for (FileObject fo : fileobjs) {
try {
String text = fo.asText();
System.out.println("text = " + text);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
}
In order to use it you need the following modules added as dependencies.
File System API
Lookup API
Utilities API
Window System API
I'm looking now in Bloomberg Data License Web Services. Note, that this is different from Bloomberg API ( Session/Service/Request, b-pipe, etc ). It is SOAP-based solution to retrieve reference data from Bloomberg DBs. I created a test application just to quickly evaluate this solution:
var client = new PerSecurityWSClient("PerSecurityWSPort");
client.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2("{path-to-certificate}", "{password}");
client.ClientCredentials.UserName.UserName = "";
client.ClientCredentials.UserName.Password = "";
client.ClientCredentials.Windows.ClientCredential.Domain = "";
var companyFields = new string[] { "ID_BB_COMPANY", "ID_BB_ULTIMATE_PARENT_CO_NAME" , /* ... all other fields I'm interested in */ };
var getCompanyRequest = new SubmitGetCompanyRequest {
headers = new GetCompanyHeaders { creditrisk = true },
instruments = new Instruments {
instrument = new Instrument[] {
new Instrument { id = "AAPL US", yellowkey = MarketSector.Equity, yellowkeySpecified = true },
new Instrument { id = "PRVT US", yellowkey = MarketSector.Equity, yellowkeySpecified = true }
}
},
fields = companyFields
};
var response = client.submitGetCompanyRequest(getCompanyRequest);
if(response.statusCode.code != SUCCESS) {
System.Console.Error.WriteLine("Response status is " + response.statusCode);
return;
}
var retrieve = new RetrieveGetCompanyRequest { responseId = response.responseId };
RetrieveGetCompanyResponse getCompanyResponse = null;
do {
System.Console.Write("*");
Thread.Sleep(1000);
getCompanyResponse = client.retrieveGetCompanyResponse(retrieve);
} while (getCompanyResponse.statusCode.code == DATA_NOT_AVAILABLE);
if (getCompanyResponse.statusCode.code != SUCCESS) {
System.Console.Error.WriteLine("Response status is " + response.statusCode);
return;
}
System.Console.WriteLine();
foreach (var instrumentData in getCompanyResponse.instrumentDatas) {
Console.WriteLine("Data for: " + instrumentData.instrument.id + " [" + instrumentData.instrument.yellowkey + "]");
int fieldIndex = 0;
foreach (var dataEntry in instrumentData.data) {
if (dataEntry.isArray) {
Console.WriteLine(companyFields[fieldIndex] + ":");
foreach(var arrayEntry in dataEntry.bulkarray) {
foreach(var arrayEntryData in arrayEntry.data) {
Console.WriteLine("\t" + arrayEntryData.value);
}
}
}
else {
Console.WriteLine(companyFields[fieldIndex] + ": " + dataEntry.value);
}
++fieldIndex;
}
System.Console.WriteLine("-- -- -- -- -- -- -- -- -- -- -- -- --");
}
The code looks somewhat bloated (well, it is indeed, SOAP-based in 2015). Hence is my question -- I assume there should be some wrappers, helpers, anything else to facilitate reference data retrieval, but even on SO there is only one question regarding BB DLWS. Is here anyone using DLWS? Are there any known libraries around BB DLWS? Is it supposed to be that slow?
Thanks.
I'm just getting into this myself. There are two options for requesting data: SFTP and Web Services. To my understanding, the SFTP option requires a Bloomberg application ("Request Builder") in order to retrieve data.
The second option (Web Services) doesn't seem well-documented, at least for those working with R (like myself). So, I doubt a library exists for Web Services at this point. Bloomberg provides an authentication certificate in order to gain access to their network, as well as their web services host and port information. Now, in terms of using this information to connect and download data, that is still beyond me.
If you or anyone else has been able to successfully connect and extract data using Bloomberg Web Services and R, please post the detailed code to this Blog!
I tried to checkout a file using sharpsvn from remote repository,but i found sharpsvn can not to checkout single file only checkout folder,please help me to know how to checkout a file?Thx.
My code
SvnUpdateResult result;
SvnCheckOutArgs checkoutArgs = new SvnCheckOutArgs();
string target = txtRepository.Text.Trim();
SvnUriTarget url = new SvnUriTarget(target);
string fileName = url.FileName;
string path = folder + "\\" + fileName;
using (SvnClient client = new SvnClient())
{
try
{
client.CheckOut(url,txtLocalFilePath.Text.Trim(),out result);//.Update(path,updateArgs,out result);
if (result != null)
{
WriteCheckOutTime(txtRepository.Text.Trim(), result.Revision);
MessageBox.Show("Check out success!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch (SvnException svnException)
{
MessageBox.Show(svnException.Message + "Check out error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
catch (UriFormatException uriException)
{
MessageBox.Show(uriException.Message + "Check out error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
The smallest element you can check out with Subversion is a directory. It is not possible to check out a single file.
You can check out a directory, but leave it empty, via the Sparse Directories feature. Then update only the file you're interested in. But you must start with a directory.
FYI if you want to checkout empty use following syntax
//first define args
SvnCheckOutArgs args = new SvnCheckOutArgs();
// then for checkout only forlder empty
args.Depth = SvnDepth.Empty;
//checkout folder
client.CheckOut(url,txtLocalFilePath.Text.Trim(),args,out result)
I am having a HttpUnit code,in which I am trying to access google''s official website.Here is my code:
/** everything you need to start is in the com.meterware.httpunit package **/
import com.meterware.httpunit.*;
/** This is a simple example of using HttpUnit to read and understand web pages. **/
public class Example {
public static void main(String[] params) {
try {
WebConversation wc = new WebConversation();
String url = "https://www.yahoo.com";
WebRequest request = new GetMethodWebRequest(url);
WebResponse response = wc.getResponse(request);
// WebLink httpunitLink = response.getFirstMatchingLink(
// WebLink.MATCH_CONTAINED_TEXT, "HTML" );
// response = httpunitLink.click();
System.out.println("The yahoo main page '" + url + "' contains "
+ response.getLinks().length + " links");
} catch (Exception e) {
System.err.println("Exception: " + e);
}
}
}
I am getting the below exception on running the code.I am using eclipse as IDE.
org.mozilla.javascript.EcmaError: TypeError: Cannot read property "className" from undefined (httpunit#3)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3235)
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3254)
at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3267)
at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1324)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2816)
at script(httpunit:3)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:172)
at org.mozilla.javascript.Context.evaluateString(Context.java:1132)
at com.meterware.httpunit.javascript.ScriptingEngineImpl.runScript(ScriptingEngineImpl.java:92)
at com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:88)
at com.meterware.httpunit.parsing.NekoDOMParser.runScript(NekoDOMParser.java:151)
at com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:150)
at com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131)
at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:249)
at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:367)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1015)
at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:888)
at org.cyberneko.html.HTMLScanner$SpecialScanner.scan(HTMLScanner.java:2831)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:809)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:478)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:431)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:48)
at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:271)
at com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1301)
at com.meterware.httpunit.WebResponse.getFrames(WebResponse.java:1285)
at com.meterware.httpunit.WebResponse.getFrameRequests(WebResponse.java:1024)
at com.meterware.httpunit.FrameHolder.updateFrames(FrameHolder.java:179)
at com.meterware.httpunit.WebWindow.updateFrameContents(WebWindow.java:315)
at com.meterware.httpunit.WebClient.updateFrameContents(WebClient.java:526)
at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:201)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:183)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:122)
at Example.main(Example.java:14)
Exception: com.meterware.httpunit.ScriptException: Script '//used for perf beacons in 3pas
rtTop = Number(new Date());
document.documentElement.className += ' jsenabled';
if (!("ontouchstart" in document.documentElement)) {
document.documentElement.className += " no-touch";
}
(function(){var k=13,d=4,j=0,a=document.documentElement,b=[a.className],f,c=navigator.plugins,g=k;if(c&&c.length){f=c["Shockwave Flash"];if(f&&f.description){j=parseInt(f.description.match(/\b(\d+)\.\d+\b/)[1],10)||0}}else{while(g--){try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+g);j=g;break}catch(h){}}}b.push("flash-"+j);while(j-->d){b.push("flash-gt"+j)}a.className=b.join(" ")})();
(function(){var j=this,n=/^(on)?load/,b=/^on/,i="addEventListener",f="attachEvent",e="_oc",h="detachEvent",g="removeEventListener",l=j[i],m=j[g],p=j[f],a=j[h],k={},d=0;function c(r,s,q){if(!r||!s){return;}if(n.test(r)){if(!s[e]){var t=++d;s[e]=t;k[t]=s;}}else{if(p&&b.test(r)){p(r,s);}else{if(l){l(r,s,q);}}}}function o(r,s,q){if(!r||!s){return;}if(n.test(r)){var t=s[e];if(t){delete k[t];}}else{if(a&&b.test(r)){a(r,s);}else{if(m){m(r,s,q);}}}}j.OnloadCache={enable:function(){if(l){j[i]=c;j[g]=o;}if(p){j[f]=c;j[h]=o;}},disable:function(){if(l){j[i]=l;j[g]=m;}if(p){j[f]=p;j[h]=a;}},dispatch:function(){var r={type:"load"},q;for(q in k){if(k.hasOwnProperty(q)){k[q](r);}}},reset:function(){k={};}};})();
OnloadCache.enable();
var setJSCookie = true;
(function () {
var cookieName = "FBJSC=";
var cookieValue = "1409123746";
var cookieIndex = document.cookie.indexOf(cookieName);
if(cookieIndex >= 0) {
var oldValue = document.cookie.substr(cookieIndex + cookieName.length, cookieValue.length);
if(cookieValue <= oldValue) {
setJSCookie = false;
}
}
if(setJSCookie) {
document.cookie = cookieName + cookieValue;
}
})();' failed: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "className" from undefined (httpunit#3)
Any help would be greatly appreciated.Thanks.enter code here
As one of the httpunit committers I'd recommend reading the FAQ:
http://httpunit.sourceforge.net/doc/faq.html
JavaScript support of httpunit is limited. The Error you are getting is showing that you ran into JavaScript code that is more complicated than what httpunit can handle. As a work-around you might want to switch off javascript altogether (if that is possible in your use case).
The following is from HttpUnit's developer FAQ:
HttpUnit 1.x support of Javascript is limited. There is a new Javascript engine in development but the development is almost stalled due to limited resources.
To work around the issue you might want to
try the new scripting engine
switch off javascript
if you get an org.mozilla.javascript.EcmAError ... undefined ... find the missing javascript function, implement it and supply the patch for the community see "6. How can I suggest modifications to httpunit?"