Is it possible to replace the childbrowser url with a database variable? - database

Is it possible to replace the url in the childbrowser with a database variable? The database variable is a url in the database. For example, in the code below res[i].showlink is a database variable that is a url. The child browser works perfectly if I replace the database variable with http://www.google.com. I also know that my database call is pulling the urls correctly with "res[i].showlink". However, when I put in the database variable, the child browser displays a blank screen and reads as loading. I am working with phonegap in Xcode.
function openGoogle(){
var root = this;
cb = window.plugins.childBrowser;
cb.showWebPage("res[i].showlink");
}
If I remove the quotes around the res[i].showlink, then nothing happens when I click on the link. If I put the quotes back on, the childbrowser loads as if it is going to work but the browser remains blank. The childbrowser does seem to be able to determine that the url links from the database are different. If the link is going to google then the childbrowser will display a blank screen and the loading bar will output "about:blank". If the url link is going to a pdf file then the childbrowser will also be blank but the loading bar will actually output "Loading". Weird.
Here is what the Xcode output console displays when I click on a link with the quotes on the res[i].showlink.
2012-07-09 08:01:25.549 MyAppTest[13067:13403] View did load
2012-07-09 08:01:25.551 MyAppTest[13067:13403] Opening Url : res[i].showlink
The output console does not display anything if the quotes are not around the res[i].showlink
Any help will be greatly appreciated! Thank you

You need to remove the quotes. Use:
cb.showWebPage(res[i].showlink);

Related

Can I download an image if it's in base64 format?

I'm developing a React App, and I have a backend in NodeJS.
In my Mongo Schema I have an array that stores multiple strings, these strings are some images.
I saved them as base64. Now I want to display them in my app, works perfectly fine with src from img tag, but I want to create a button that allows the user to download those pictures, is there any solution to this? Can I convert back that string and make it downloadable? Thank you very much for you time, I'm waiting for your ideas!
Note: The examples in the snippets will not work live because Stack Overflow sandboxes snippets without allow-downloads, but they should work on your page.
Depending on your exact use case, you have different options. The easiest one would be using an <a> tag with the download attribute instead of a button, like this:
<a download="myImage.gif" href="data:image/gif;base64,R0lGODdhEAAQAMwAAPj7+FmhUYjNfGuxYYDJdYTIeanOpT+DOTuANXi/bGOrWj6CONzv2sPjv2CmV1unU4zPgISg6DJnJ3ImTh8Mtbs00aNP1CZSGy0YqLEn47RgXW8amasW7XWsmmvX2iuXiwAAAAAEAAQAAAFVyAgjmRpnihqGCkpDQPbGkNUOFk6DZqgHCNGg2T4QAQBoIiRSAwBE4VA4FACKgkB5NGReASFZEmxsQ0whPDi9BiACYQAInXhwOUtgCUQoORFCGt/g4QAIQA7">Download GIF</a>
If you need to keep using a button and you want to trigger the download programmatically, you can create an <a> tag (without displaying it) and trigger a click:
const a = document.createElement('a')
a.download = 'myImage.gif'
a.href = 'data:image/gif;base64,R0lGODdhEAAQAMwAAPj7+FmhUYjNfGuxYYDJdYTIeanOpT+DOTuANXi/bGOrWj6CONzv2sPjv2CmV1unU4zPgISg6DJnJ3ImTh8Mtbs00aNP1CZSGy0YqLEn47RgXW8amasW7XWsmmvX2iuXiwAAAAAEAAQAAAFVyAgjmRpnihqGCkpDQPbGkNUOFk6DZqgHCNGg2T4QAQBoIiRSAwBE4VA4FACKgkB5NGReASFZEmxsQ0whPDi9BiACYQAInXhwOUtgCUQoORFCGt/g4QAIQA7'
a.click()
(If you need to support older browsers, you may have to temporarily insert the tag into the DOM and trigger the click in a setTimeout(..., 0).)
You can also use object URLs like it's shown here but it's probably easier to go the data URI route since you already have such a URI.

Umbraco cms AngularJS Regular Expression Keep appearing

Umbraco uses angularJS as based library and backoffice totally developed on it. The reason telling first is to tell that I have a field on which URL regular expression applied. If someone entered invalid url like below image
it shows error as need.
But if a user try to remove whole text by selecting it and removing at once. It still keep appearing the error like this
However, if a user erase text one by one like this
then the validation error removed and user need to click on button to see error again.
I would to know how screen 3 state can be achievable when user remove all text together? Its really annoying behavior for a user to remove text character one by one to refresh the state of the field. Screen 3 state should be applied on screen 2.
Can anybody tell me how it can fix or achievable? Right now, it seems like a default behavior.
Looking forward to hear from you guys. Suggestions will be much appreciatable.
Regards o
I've looked into this issue. This seems to be a product bug.
When you remove whole text at once, newValue is an empty string and the code responsible for resetting error messages doesn't run. If you have access to the umbraco code, you can easily fix it by removing highlighted check:

Where is Tampermonkey's "Storage" tab to edit the storage content?

According to the FAQ of Tampermonkey:
Q400: I want to edit/view the values stored by a userscript. How can I
do that?
A400: Open Tampermonkey's Dashboard and click at the script's name.
Click at the 'Storage' if present and check or modify the stored data
as needed. If there is no 'Storage' tab, then the script has no data
stored.
I can't find the Storage tab, can anyone confirm me it works? Screenshot of where is the tab? (pretty sure my script has data stored in it because when I use GM_getValue I get something).
Here is a screenshot of my script without the Storage tab. After running it, the value is stored according to my console.log, but still no tab.
Requirements for the Storage tab to appear:
The script has must have actually saved a datum using GM_setValue().
The Config mode must be set to Advanced:
After that,
To see it:
Open Tampermonkey's editor on/for the script in question.
Click the Storage tab.
Data there is in JSON format. If you edit it, recommend checking with a JSON validator before hitting the Save button.
Here's the sequence in screenshots (Click for a larger image):

SSRS Report Manager set default zoom level

I have deployed around 40 report parts to my reporting server which are all working correctly.
The problem is my zoom is default 100 for all of them, I want a number of them to default to 75.
I have tried creating a portal with links to all report parts and using the &rc:Zoom=75
on the end of the URL for the link but it still defaults to 100.
Can anyone suggest how I can achieve what I want?
Instead of going to :
http://mysqlservername/Reports/
and getting the full URL from here (plus &rc:Zoom=75)
I went here:
http://mysqlservername/ReportServer
Which is like the back end.
From here I went to the report part I wanted to default to 75 and right clicked and selected'copy shortcut'
I then pasted this into the 'Go to URL' box along with the
&rc:Zoom=75
What's your full URL? I realized that the zoom doesn't work if I also have &rc:toolbar=false. If I add &rc:Zoom=25 to a standard report it work's fine.
Try removing any other tags than you may have on the URL to see which one is preventing the Zoom from working.

Dynamic Hyperlink in Livecycle Form

I am trying to figure out how to make a hyperlink in a Livecycle Form which points to a URL which will change on different days that the form is rendered. For example on one day I might want the hyperlink to point to:
mywebsite/mypage?option=XXX
and on another day I want it to point to:
mywebsite/mypage?option=YYY
The XXX and YYY can be passed into the form's data pretty easily as XML, but I just don't know how to make it so that the hyperlink is changed to correspond to this.
Any suggestions?
This can be accomplished with JavaScript in LiveCycle Designer. The following script, placed on the Form's docReady event will let you dynamically change the URL of a text object.
form1::docReady - (JavaScript, client)
// If this code is running on the server, you don't want it to run any code
// that might force a relayout, or you could get stuck in an infinite loop
if (xfa.host.name != "XFAPresentationAgent") {
// You would load the URL that you want into this variable, based on
// whatever XML data is being passed into your form
var sURL = "www.stackoverflow.com"; // mywebsite/mypage?option=xxx
// URLs are encoded in XHTML. In order to change the URL, you need
// to create the right XHTML string and push it into the Text object's
// <value> node. This is a super simple XHTML shell for this purpose.
// You could add all sorts of markup to make your hyperlink look pretty
var sRichText = "<body><p>Foo</p></body>";
// Assuming you have a text object called "Text1" on the form, this
// call will push the rich text into the node. Note that this call
// will force a re-layout of the form
this.resolveNode("Text1").value.exData.loadXML(sRichText, false, true);
}
There are a couple of caveats: URLs in Acrobat are only supported in Acrobat 9.0 and later. So if someone using an older version of Acrobat opens your form, the URLs won't work.
Also, as you can see from the "if (xfa.host.name !=...)" line, this code won't run properly if the form is being generated on the server, because forcing a re-layout of a form during docReady can cause problems on certain older versions of the LiveCycle server. If you do need to run this script on the server, you should probably pick a different event then form::docReady.
I a number of complaints from users in WorkSpace that clicking links opened them in the same tab so they lost their WorkSpace form, and there's no option to change that in Designer 11. I think the solution I came up with for that would work for you too.
I made buttons with no border and no background, and in their click event have this line (in Javascript, run at client)
app.launchURL("http:/stackoverflow.com/", true);
It would be easy to add some logic to choose the right URL based on the day and it doesn't cause any form re-rendering.
In some spots where the hyperlink is in line with other text, I leave the text of the link blue and underlined but with no hyperlink, and just place the button (no background, no border, no caption) over it. Does require positioned and not flowed subforms for that to work, so depending on your layout it could get a little clunky.
Wow, just realized I am super late to the party. Well, for anyone using ES4 facing a similar problem . . .
Ended up using a 3rd party component to manipulate the PDF's hyperlinks...wish there was a better solution as this one costs about $1000.

Resources