Iron Python script in spotfire web player - javascript

I have a html page which i display a spotfire report in using the web player. I would like to have the option of refreshing the data by pressing a button i create, and i couldnt find a way to do that using the web player. I know there is a way to do this using script in iron python but i dont understand how exactly it works, i mean, when i click the button i would like the script to run. Where do i write it? How do i call it? My html page controller (im using angular) is in java script.
Thanks :)

Can't create python scripts in webplayer as far as I know. You need the client. There you can create a Text Area and add an Action Control. Select 'Script' (requires scripting privileges to be able to write code in python) and code to refresh the data table:
myDataTable.Refresh()
myDataTable is a script parameter that points to your visualization data table.

Related

Wordpress Custom JS Location

We decided to go to another provider and rebuild the website. Accidently, we moved the old domain as well and we can't access the wordpress backend nor the frontend anymor. Now for the new page, I need a Custom javascript code I entered on a specific page with Elementor. Where can I find my old code now without accessing the homepage? I have FTP and Database access.
Where do you put the code? Depending on the answer you need to look at different locations.
Afaik elementor doesn't support custom js nativly. You can bypass that with a html widget or custom plugin. If you used elementors gui for that it's probably stored like all other elementor related content inside wp_post_meta of your database.
If you don't know the page where it was used I would suggest to export the database as sql and use an editor to search for a text string related to the code (for example the url of the ajax request).
If you know the page you can do the same but faster. Look for the id of the post with the code, search for it in wp_post_meta and go on like mentioned before.
If you havn't used elementors gui the script could lie inside a directory on the server probably inside your theme.

How to extract the dynamically generated HTML from a website

Is it possible to extract the HTML of a page as it shows in the HTML panel of Firebug or the Chrome DevTools?
I have to crawl a lot of websites but sometimes the information is not in the static source code, a JavaScript runs after the page is loaded and creates some new HTML content dynamically. If I then extract the source code, these contents are not there.
I have a web crawler built in Java to do this, but it's using a lot of old libraries. Therefore, I want to move to a Rails/Ruby solution for learning purposes. I already played a bit with Nokogiri and Mechanize.
If the crawler is able to execute JavaScript, you can simply get the dynamically created HTML structure using document.firstElementChild.outerHTML.
Nokogiri and Mechanize are currently not able to parse JavaScript. See
"Ruby Nokogiri Javascript Parsing" and "How do I use Mechanize to process JavaScript?" for this.
You will need another tool like WATIR or Selenium. Those drive a real web browser, and can thus handle any JavaScript.
You can't fetch the records coming from the database side. You can only fetch the HTML code which is static.
JavaScript must be requesting the records from the database using a query request which can't be fetch by the crawler.

html5 communication with server side

In traditional web application i generally write JSP which renders html code to browser and communicate to server using form submit or through Java script. This generally involves page transition from one to another using browser refresh many times.
Now with the improved HTML5 i still can use the same approach but i want to achieve more of a desktop application look and feel which means no browser refresh. But i am really confused how it can be achieved.
Do i need to write a big single html5 file which contains all the web application code and show or hide divisions using java script that we need to show at that point of time. Communicate to server using java script.
Or, Just have a minimal first html5 page where user lands for the first time. Later on create all the HTML5 content dynamically using java script and communicate to server using java script. This looks more difficult.
Or, is there a way we can move from one page to other without the effect of page loading/refresh etc.
In general using HTML5 what should be the approch?
For example of a shopping cart, the first view to the user is list of items to purchase. Then user moves to next view such as details of an item. The next view can be payment.
If you have some resource or example to explain it, it would be great.

Javascript crossdomain widget

I want to create javascript widget similar to linkedin Member profile. https://developer.linkedin.com/plugins/member-profile-plugin?button-type-inline=true
On my site the user can manage some data.
I want to allow for user to copy some HTML code and insert in his site HTML to display the data.
I want HTML code looks like:
<script src="http://mysite.com/code.js?userid=123"></script>
And if user inserts this code in his site then javascript code is loaded and data are displayed (widget displayed)
How to do this? I know about crossdomain restrictions. But in case of linkedin this is not the problem. Their widget works fine.
Thanks.
UPDATE.
As i understand from comments, it is not the problem to display any data in page that includes my javascript file. I am going to do tests.
Either the data is embedded inside the script, or it is loaded via JSON-P

PyQt4: Trigger click on a javascript link

I am trying to scrape some web pages in Python were the information is generated by Javascript.
I managed to retrieve the information generated on page load by using a headless browser with PyQt4 (example here: http://blog.motane.lu/2009/07/07/downloading-a-pages-content-with-python-and-webkit/)
But now, I'm trying to retrieve some information that is generated by having the user click on a Javascript link.
How can I do that?
Thanks
I guess you need Form Extractor Example. The trick is that you can expose any python object to javascript and call its methods. Pytonic version of this example could be found in PyQt distribution.

Categories

Resources