Now-a-days, XQuery and XPath are used heavily in all applications as XML has become a standard for data exchange in most of the applications. The modularization phase in any application development creates a need to manage the location of data dynamically.
In XPath/XQuery we all know that it doesn’t support dynamic evaluation of XPath from STRING without using EVAL function from 3rd party which is quite performance inefficient for large data. But the need for having a configuration for XPath from a specific element/node is still there.
This is again a solution to address the modularization of XQuery implementation and to address the CONSTANTs mapping for XPath which can be used by a specific XQuery dynamically.
Now, to set the context, we use XQuery LIB/SUB module to manage our constants or global data. I am taking advantage of this functionality to get a bit closer to the target goal. Below is what I configured.
1. Create a Sub/Lib module to manage the XPath which are required to be fetched dynamically from one source or different sources.
2. Create 1 liner functions for each XPath that needs to be generated dynamically.
3. Pass the source to each function in the Sub/Lib module as a start reference.
4. HardCode the exact XPath post the source in that XQuery function.
5. The XQuery functions becomes your constant XPath variable to be used.
6. Use the XQuery function as a constant in your Main XQuery.
Advantages of this approach are that it decouples the constant mapping from main XQuery file to a dedicate XPath configuration file. The only difference is that we use functions instead of variables.
Below is an example.
1. This is a sample XML for the example.
2. This is a sample LIB Module for the XQuery – Dynamic XPath function.
3. This is the main XQuery module calling 4 ways to generate the result.
Hello again! This particular post is again an actual solution to one of the problem that my team faced. As you all know that we use VISIOs in every project to make process flows, organization chart and lot of other non-project things 🙂 to present the information in a very nice manner.
Also, the VISIOs are normally kept together in pages of a single VSD file. It happen to be the case that we were asked to create PNG/Images from the VISIOs – all pages and embed into word document. There were 4 VISIO files with 40 pages each and it was damm time consuming to do -> File -> SaveAs -> PNG for all VISIO pages.
I happened to know a bit of VB programming under VISIO and wrote a small piece of code. This code requires a new VSD to be created and give input the VISIO/VISIOs to save all pages to a PNG file based on the page name.
Now, my team is using this utility to manage the change reflect all the PNG in fraction of sections.
Procedure to use this code:
1. Create a new VSD file
2. Enable Macro
3. Open Code Editot Alt+F11
4. Paste the Code
Today, someone asked me how to search of list all the attachements in Outlook 2010. I was searching that it has this calendar view where it only shows days and then you can go to date and view the attachment.
It really sometimes required to find attachments from all calendar invite that you have received till date. There is a feature provided for this by Outlook itself but is not readily visible. Most of you might know it already but for the sake of other, here is it..
When you choose the list view, outlook displays all calendar invites as a list and then you can search on it or you can directly search using the outlook fast search as below.
This post is about a situation I ran into last week. I was supposed to prepare a very-long WBS (we all know how long a WBS can be for a quite significant program). I was putting sections in the WBS with indentation and grouping as normally all of us do. Hence I prepared something like below (of course this was not my WBS 🙂 but on the same line)
After preparing a WBS with ~800+ rows, I came across the complete view of the WBS where I have to put in the index and that too as per the INDENTs as below for example:
You can assume how much time it could take to index w.r.t the indents manually. Also, take into consideration the N number of reviews that happen in WBS and result in addition or deletion of rows. So, I thought of using Macro in EXCEL for this situation. Finally after some time, I was able to automate it with just a click of button! I loved it!
Just download the module for the macro HERE and import into excel application. Save it. Just use the function in the CELL as shown in the below:
Automation can be useful!
“The secret to creativity is knowing how to hide your sources.”