Example Code

NI Stats VI Utility

Code and Documents

Attachment

The NI Stats VI Utility enables you to easily monitor key statistics for items posted on the NI Community web site - without using a web browser! Monitor and update the statistics manually or based on a configurable time interval. Run the NI Stats VI Utility to see how you can use it to monitor items that you or others have posted on the NI Community web site.

blue-starburst-sm.png
  • The NI Stats VI Utility now reports the number of views for each displayed item

  • The NI Stats VI Utility now reports the rating for each displayed item

  • The NI Stats VI Utility now enables  you to open the web page for a displayed item by right-clicking in the table and selecting "Open in browser"

Readme file for NI Stats VI Utility

Description

The NI Stats VI Utility enables you to easily monitor key statistics for items posted on the NI Community web site - without using a web browser!

Use the NI Stats VI Utility to see how you can use it to monitor items that you or others have posted on the NI Community web site.


Application Software

LabVIEW 2010 or later.

Driver Software

None.

Concepts Illustrated

The NI Stats VI Utility illustrates the following concepts:

  • State machine architecture

  • Using DataSocket to read the web page source for items on the NI Community web sit

  • Using the Sort 2D String Array VI  to sort a 2D array of strings that contains both plain text strings and strings representing real numbers (Download the Sort 2D String Array VI).
  • Using the Selection Dialog VI to enable the user to select items from a list and manage the selected items (Download the Selection Dialog VI).
  • Using the SnapToPanel VI to position a sub-panel relativeto the main window (Download the Snap To Panel VI)

  • Using the Busy Indicator VI to provide an indication to the user that the system is busy. (Download the Show Busy Indicator VI)

  • Using the numdays.vi by BetterVIEW consulting to calculate the number of days between two dates (Download the numdays VI at: http://www.bettervi.com/Media/NUMDAYS.ZIP)

Description of Operation

The NI Stats VI Utility enables the user to easily check the status of files posted on the NI Community web site.

The user can select files to monitor and update the statistics for those files manually or based on a configurable time interval.

To easily add files to the list of files to monitor, copy the URL string from your web browser and paste it into the URL String column of the table shown in the Select Files to Monitor window.

The user can also sort the displayed data based on user-selectable sort options.

The user can also open the NI Community web page for an item in the table by right-clicking an item and selecting "Open in browser".

The NI Stats VI Utility stores the list of files to monitor at the following path:

NIStats\Data\ FilesToMonitor.txt

The NI Stats VI Utility stores a log file at the following path:

NIStats\Data\ Community Stats Log.txt

The Community Stats Log.txt file is updated once per day that the NI Stats VI Utility runs.

The Community Stats Log.txt file is formatted so that you can import the data into a spreadsheet program if you want to perform a more detailed analysis of the data.

Extracting the files

The NI Stats VI Utility is supplied as a zip archive containing all required items.

Additional Information

Additional information related to the use and operation of the NI Stats VI Utility may be accessed via:

  • The block diagrams of all included VIs

  • The documentation within all included VIs

Developed by

Mark Ridgley

Mark.Ridgley_LabVIEW.Developer@comcast.net

Change Control:

04-08-2012

Added the number of views to the information displayed for each item in the table.

Added the rating to the information displayed for each item in the table.

Added the ability to open the web page for displayed items by right-clicking in the table and selecting "Open in browser?".


11-29-2008

Modified the NI Stats - Parse Download Count From Community Page Source.vi to remove commas from the number of downloads string that is parsed from the page source.

Modified the NI Stats.vi so that the sort options selected by the user are retained even if the NIStats VI utility is stopped and  re-started.

Modified the NI Stats.vi so that the user can sort the displayed data at any time by pressing the "Sort Data Now" control on the front panel.

11-11-2008
Added new functionality that allows the user to sort the displayed data based on user-selectable sort options.

Updated the NI Stats - Parse Title From Community Page Source.vi to account for changes to the NI Community web page title record.

Updated the NI Stats - Parse Number of Comments From Community Page Source.vi to account for changes to the NI Community web page comment record.

Updated the NI Stats - Parse Download Count From Community Page Source.vi to report the total number of downloads for all items listed in the community page source. This ensures that the download count is reported correctly for pages that have multiple items available for download.

07-29-2008: Modified the NI Stats - Update Stats.vi to parse the Title immediately after reading the page source. This accounts for the change to the NI Community web page structure that no longer includes the title of submitted items in the URL.

07-29-2008: Modified the NI Stats - Parse Title From Community Page Source.vi to account for the change to the NI Community web page title record so that "NI Communities: " is not displayed in the File Name field of the main interface VI.

07-29-2008: Modified the first search string in the NI Stats - Parse Download Count From Community Page Source.vi to reflect the new tag used in the page source.

Updated links to other example code to account for the change to NI Community URL formatting for submitted items.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
sshearman
Member
Member
on

Hi Mark,

This is a very nice utility! Useful as both a tool and as an example of clean LabVIEW coding. I'm not sure if the number of views is available through the ni.com/community, but that would also be a nice stat to track.

--Sam

Sam Shearman
Contributors