How to calculate the load time of a xpages - xpages

Try to store the date in a session scope and make a difference but it don't work at all
On click
sessionScope.StarTime=new Date()
On display
var wTime=new Date()
var wDiff=wTime-sessionScope.StartTime
"Temps de chargement " + wDiff + " ms"
Thanks

There is no "onDisplay" event, so I presume you added the second part of the code into a computed field. For starters you have a typo in your code StarTime ws. StartTime. If you did copy & paste to get the code into the question -> there's your problem.
You also want to learn about the XPages lifecycle, so you can measure it better. There is a free MasterClass for it. You also want to have a look at the XPages Toolbox that allows you profile your application.
Finally: Watch your network speed too and what it does to your app. Firebug or the Google Chrome developer tools help quite a bit. Is is a bit dated (quite some improvements since then), but this presentation gives more information on performance

Related

Web Scraping into Excel

I would like to create a spreadsheet that I can refresh and pull in each weeks English premier League fixtures, each week I would like to refresh this and see the weeks future fixtures. I have tried to use the import function from Data/From Web and selected the box with the table of fixtures however no data gets pulled into the spreadsheet.
The website I am using is - "http://data.7m.com.cn/matches_data/92/en/index.shtml"
I am open to understand a better way of doing this import and also if there is a better website to use I am also happy to change. I have chosen this one as it seems to have the most simplified listing of the fixtures.
I have also tried this website - https://www.premierleague.com/fixtures
When the import completes it actually skips all the fixtures and returns all the other information.
Should i be looking to some of the HTML elements within the script of the web page to extract the data?
For example on the following site - https://www.premierleague.com/fixtures I am looking for a file received by the website that updates the fixtures each week (after some direction from Google) I hit the F12 command and look within the "Network" tab however I cant understand how the website, this or the others quoted create the weekly fixtures.
Any suggestions on how to pull this into Excel or another tool would be fantastic.
Welcome to [so]! it sounds like you haven't done as much research as you could have. Your first link, in the top corner has links to "Free Feed" which take you to customizable widgets and from there is a link to a customizable live template.The first page also has a link to "Data" , I'm not sure what that consists of or whether it will help (since I'm not much of a sports fan on my continent, and even less on yours!
As for importing into Excel, I didn't have an issue with the table I could see, but once again I'm not clear on what data you're trying to get and what you want to do with it.
On the ribbon's Data tab click From Web.
Enter the first URL from your question and hit Enter
When the Navigator window loads, click "Table 1" and then click Load.
Below is what Excel then automatically loaded as a table:
If instead of clicking Load, you were to click Edit then you are brought into the Power Query Editor, where you can customizable tons of stuff. The one I was interested in was Use First Row on Headers. After choosing that, and clicking Close & Load, and 30 seconds of formatting later I had:
With Power Query you can choose, remove, split, or combine columns from this or other tables. It's fairly advanced but you should be able to find a good Power Query tutorial online, to see examples of what you can do, to learn about other ways you can customize the import and/or analysis of the data.
Edit:
More Information:
Here are the instructions for all versions:
Office Support : Connect to a web page (Power Query)

VBA-Explorer drop down menu selecting

I am a rookie to programming and am pretty sure that I am way over my head, but here is my problem. I work at a manufacturing facility that has a server that I do not have (and cannot have) access to. In order to retrieve and analyze data I have to go onto our Quality Management website which presents multiple drop down menus to select from. The first one is "Manufacturing date", then time, then machine ID, and then run the search. This then opens a new window that contains the data I need to insert into a previously written macro to organize. My buddy from work found this program:
Sub GoogleSearch()
Set objIE = CreateObject("InternetExplorer.Application")
WebSite = "http://mant6websrv1.thermatru.com/QMS/QualityReporting/Reports/LDMasterQueryReport.asp"
With objIE
.Visible = True
.navigate WebSite
Do While .Busy Or .readystate <> 4
DoEvents
Loop
Set Element = .document.getElementsByName("q")
Element.Item(0).Value = "Hello world"
.document.forms(0).submit
'.quit
End With
End Sub
It was originally a google search program that opens google in explorer and then searches the phrase "hello world". By simply replacing the website with our Quality Management address we have been able to get it to open the correct site, but I have no idea how to get it to select the options I want. I tinkered around a bit with the webdeveloper for explorer and even found the ID names for the boxes I need to fill out...but have no idea how to get the program to select them, and then insert the dates I want and run the search. Any ideas??
p.s. when I say I am a rookie I mean that this is my third day writing macros with vba so please be as simplistic and clear as possible with any answers. I am starting to really enjoy this stuff and want to learn as much as possible. Thanks everyone.
Try using the web macro recorder in Open Twebst. Record the actions you want to take and put the code in Excel's VB editor. In your case you can use VBScript, which can for the most part also be used with VBA. You might not get perfect result immediately with a recording, but it's a good tool to help you get on the right track, even if you may need to tinker with the code a bit and look through the HTML of the site to get perfect control.
Note however that it has its own framework for web automation, it's not recording using the standard Microsoft web libraries for it.

How to print a multi-page map with data from excel, MapPoint and VBA maybe?

I have an excel file with information on my company's customers including addresses and latitude and longitude. I need to generate printed street maps showing a reasonable level of detail with pins showing the customers and bubbles displaying their info. Essentially I need to create something that looks like a Thomas Guide except with our customer info layered on to the street maps. I've been looking for DAYS and can't find any software to automate this process.
Currently I'm importing the data into Microsoft MapPoint, which does a fine job of generating the map with all necessary data. However MapPoint can only print what's currently displayed on the screen. So I'm stuck printing at a close zoom level, scrolling over, printing again, and continuing this process ad nauseum.
Is there maybe a way to automate this with VBA in MapPoint? I can find almost no info online about VBA for MapPoint.
Or maybe there's a piece of software out there that can do this at the push of a button. Printing a multi-page map of an area doesn't seem like that crazy of a demand.
Any help would be appreciated.
MapPoint's API is actually pretty well documented in the MapPoint help file, and most of the examples use VB6, which should be adaptable for VBA - you will need to add a reference to MapPoint's object model.
Yes you can automate the printing. Other approaches include copying to the clipboard; save to web page (and extract the Map's GIF image); or to use the GetPictureFromObject(). I recently wrote an article about using the latter from C# (it would be simpler from VB6 or VBA)
You could also print to a very large PDF, see the tips from this newsletter --
http://www.mp2kmag.com/update/mappoint.newsletter/2013-02-18/
Here's a direct link to the article --
http://www.mapforums.com/print-large-multiple-sheet-maps-any-printer-27603.html
Eric

Masked Text Box issue

i m using the rad masked control for phone field.
telerik:RadMaskedTextBox ID="txtPhone1" runat="server" EnableAjaxSkinRendering="False" Mask="(###) ###-####" Skin="Hay" ZeroPadNumericRanges="False" MaxLength="20" TabIndex="30" Width="200px"></telerik:RadMaskedTextBox
when i m trying to add phone using watir, using this code
browser.text_field(:id => 'ctl00_ContentPlaceHolder1_Registration2_txtPhone1_text').set '7893457889'
only last value has been added. kindly help me out. how to fill masked value.
Using Watir-webdriver and the example from Teleriks demo site, and IE browser, I was able to set the value with
browser.text_field(:id,"RadMaskedTextBox1_text").set '1234567890'
This seemed to work just as expected, added the formatting, and seemed functional to me.
With Watir I was able to set it via using
browser.text_field(:id, 'RadMaskedTextBox1_text').value='1234567890'
However although the value showed up in the field, it was not formatted and I was never able to get it to actually validate that input. I tried firing various events such as onchange, to get the client side code to process it, but no joy. If I was using this tool I might consider calling the vendor or getting on their site and asking them for assistance at this point. (provided you need to use Watir)
If watir-webdriver is not a viable option for you (I like it for cross browser testing) then perhaps someone else can spend the time to dig a bit deeper. (I'm personally past the point where digging into this control to extend my own knowledge is worth my employers time...)
Possibly there might be some way around this with Rautomation, but I'm new enough with it where I don't immediately see an easy solution there.
OMG. This is so old. But I am going to add to it. When dealing with masked elements, I am successful using the following sendkeys technique instead of injecting the value into the inner element text. Send Ctrl-A to highlight everything, then start typing, then tab out of control.
e = #browser.text_field(id: OrderEntryPOM.stop_window_start_date)
e.send_keys [:control, 'a'], start_date, :tab

Live updates in website? (streamerapi)

I was in http://finance.yahoo.com/ and checked the europe tab ( markets are open here atm) you ll see trades updating live, I went to firebug to the Net tab and there was no updates... so I wonder how are they doing that?
I can see there is a streamerapi.finance.yahoo.com that actually makes fiddler throw an error.
Anyone knows anything else about this live update?
Really interested in this, would really like to know if they are constantly polling , the updates seem to happen at irregular intervals
found some info here
Please note my interest is on the seeminly push aspect of it ( ie view is updated when there is new information)
Cheers
It is called Comet.
http://en.wikipedia.org/wiki/Comet_(programming)
It is a comet system using a hidden iframe technique. A step by step description of what is going on with streamerapi as well as a simple debug HTA to consume the feed is available on my site: AJAX Push – Comet.

Resources