How To: CVS to Mercurial conversion using ConvertExtension

May 2nd, 2011 No comments

For my personal projects, I “was” using CVSNT for version control. I had an old laptop which was crashed few days ago. Fortunately, I had a backup of all the projects CVS files. I got new laptop and I had to install CVSNT but I got another shock. Now for CVSNT, I have to pay $$$ and cannot download older version which I was using. After hours of research, I found the version I was using at http://www.cs.unc.edu/Courses/jbs/tools/downloads/cvsnt/. Finally I installed CVSNT. Now I have installed TortoiseHG for Mercurial and tried its “convert” extension but I was getting following error.

initializing destination hg\GD repository
connecting to :sspi:Administrator@localhost:/cvsdata
abort: unexpected response from CVS server (expected "Valid-requests", but got
'E cvs [server aborted]: Root :sspi:Administrator@localhost:/cvsdata must be an absolute pathname\n')

After struggling a lot with different trial and error methods, I found a solution. Read more…

MS Access: HTML Editor control to use in forms

February 10th, 2011 5 comments

If you want to get HTML editor within MS Access form, there are couple of solutions available. The free solution I know is to get Not So Elegant HTML Editor. The problem with this editor is that

  • After looking at this editor, you will never say “so cool”
  • It is good for basic editing but many important functionality like “Table” editing is missing.

When I had to create HTML Editor within MS Access form, I asked the question to myself “Why to reinvent the wheel?” and the solution I came up with has the main benefits

  • It is completely FREE
  • When users will look at it, they will definitely say “so cooooool”.
  • Rich feature set
  • XHTML compliant code will be generated and hence output can be used anywhere.
  • Plugin based architecture can help add extra cool features

Here is a sample of how this editor would look like Read more…

MS Access VBA: Get/set Javascript Variable in Microsoft Web Browser ActiveX Control

February 5th, 2011 1 comment

In your MS Access application, if you are using Microsoft Web browser, we may have to interact with the Javascript variable inside the loaded page. There is no obvious method exists in the Web browser control but using the following trick you can get/set the Javascript variable in the webpage.

Quick Tip:

Add Javascript function to get/set the value of Javascript variable/ HTML element from/to the hidden field. Execute the function using VBA code with the help of DOM functions available in VBA. Please read further for the details or download the code. Read more…

SharePoint: Remove URL from Lookup columns using JavaScript

January 15th, 2011 1 comment

If you want to remove URL from the Lookup columns in SharePoint, just copy and paste the following code into the page.

<div id="scriptdiv"></div>
<script language="javascript">
var CTXMAX = 5;
function RemoveLookupAfterPageLoad()
{
 var table, i=1, ctx;
 // Remove lookup links
 while(i<=CTXMAX)
 {
 eval("if(typeof ctx" + i + " != 'undefined') ctx = ctx" + i +"; else ctx = null");
 i++;
 if(!ctx)
 break;

 table = document.getElementById(ctx.listName + "-" + ctx.view);
 if(table)
 {
 table = table.parentNode;
 table.innerHTML = RemoveLookupLinks(table.innerHTML);
 }
 }
}

function CreateDynamicFunction()
{
 // Create a function "ExpGroupCallServerg_GUID"
 var scriptdiv = document.createElement("div");
 var i=1, funcExpGroup ="", ctx, val;
 if(browseris.ie)
 document.getElementById("scriptdiv").appendChild(scriptdiv);

 while(i<=CTXMAX)
 {
 eval("if(typeof ctx" + i + " != 'undefined') ctx = ctx" + i +"; else ctx = null");
 i++;
 if(!ctx)
 break;
 funcExpGroup = funcExpGroup + "function ExpGroupCallServerg_{0}(arg, context){\n" +
 "globalArg_g_{0} = arg; globalContext_g_{0} = context;\n" +
 "setTimeout(\"WebForm_DoCallback('ctl00$m$g_{0}',globalArg_g_{0},Interceptor,globalContext_g_{0},ExpGroupOnError,true)\", 0);\n}\n";
 funcExpGroup = funcExpGroup.replace(/\{0\}/g,ctx.view.toLowerCase().replace("{","").replace("}","").replace(/-/g,"_"));
 }

 scriptdiv.innerHTML = "&nbsp;<script" + " defer>" + funcExpGroup + "</" + "script>";
 if(!(browseris.ie))
 document.getElementById("scriptdiv").appendChild(scriptdiv);
 scriptdiv.style.display="none";
}

CreateDynamicFunction();

//Ajax function interceptor
function Interceptor(htmlToRender, groupName)
{
 ExpGroupReceiveData(RemoveLookupLinks(htmlToRender), groupName);
}
//Function which removes links using regex
function RemoveLookupLinks(htmlToRender)
{
 return htmlToRender.replace(/<a[^>]*RootFolder=\*[^>]*>([^<]*)<\/a>/gi,"$1");
}
//Queue up the function to execute after page load
_spBodyOnLoadFunctionNames.push("RemoveLookupAfterPageLoad");
</script>
Categories: Javascript, SharePoint Tags:

InfoPath: Hide command text for conditionally inserting row in repeating table

June 2nd, 2010 4 comments

Problem 1: Allow the users to insert a row in repeating table based on condition evaluation.

Solution:

  1. Select the repeating table, right click on it to open up context menu.
  2. Click on “Repeating Table Properties…” > “Display Tab” > “Conditional Formatting…” button. It will open up “Conditional Formatting” dialog.
  3. Click on “Add…” to open up “Conditional Format” dialog.
  4. Select the condition and check “Don’t allow user to insert or delete this control” as shown in the image below.
  5. Click OK button on every open dialog.
  6. Now preview the form. Based on evaluated condition, clicking on “Add Employee” will either allow or don’t allow you to insert a new row.

Problem 2: Above mentioned solution does not hide the command text “Add Employee” so user may try to click on it but nothing happens. The problem is to hide a command text.

Solution: Read more…

Categories: Infopath Tags:

InfoPath: Conditionally Hide Hyperlink Control

April 30th, 2010 1 comment

You may have been to a situation where you have to conditionally hide the hyperlink control but unlike many other InfoPath controls, hyperlink controls does not support conditions. But there is a way to hide this control. :)

Here is my main data source.

IsVisible is a boolean field and Hyperlink is a string storing URL. I want to show the URL only when IsVisible is “true”.

Solution: Read more…

Categories: Infopath Tags:

InfoPath: A proper way to blank out Whole Number, Date using JScript

April 29th, 2010 No comments

Problem:

When you blank out data in InfoPath using JScript, you would probably use the following method.

XDocument.DOM.selectSingleNode("my:xpath/my:node").text = "";

Above code works well when “my:node” is of data type String. If the data type is Number or Date, above code will work but on the user interface you will see an error “Only integers allowed.” and “Only date allowed.”

Only integer allowed Read more…

Categories: Infopath Tags: , , ,

InfoPath Error: Reference to undeclared namespace prefix “dfs”

March 17th, 2010 3 comments

Error:

If you are trying to get/set values using XPath on Secondary Data Source, you might get the error “Reference to undeclared namespace prefix: dfs”.

Cause:

When you are trying to use XPath expression on Secondary Data Source, you must have to declare the namespace that is going to be used in the code. By default, InfoPath does NOT add namespace for Secondary Data Source. You have to add it manually.

Resolution: Read more…

InfoPath Hyperlink Control: Show Hyperlink Based on Filtered Data

March 11th, 2010 No comments

In InfoPath, Hyperlink control does not support filtering data when you select a field for repeating group. But you can definitely avert this limitation using a trick. For example, I have secondary data source “Data” as xml file with the following content

<?xml version="1.0" encoding="utf-8" ?>
<Settings>
    <Setting Name="Users" Value="2" />
    <Setting Name="WebAddress" Value="http://blog.vishalon.net" />
</Settings>

Now I want to get a hyperlink out of “Value” attribute of “Setting” node whose “Name” is “WebAddress”. Read more…

Extended Function getTagFromIdentifierAndTitle to get Fill-In enabled Dropdown

January 26th, 2010 No comments

The function “getTagFromIdentifierAndTitle” is used by SharePoint particularly for changing form fields. But it is good enough only if you have straight forward fields. If you have enabled “Fill-in” values, it will not be able to find the correct element. Here is a extended version of this function to get the “Fill-in” enabled field.

function getTagFromIdentifierAndTitle(tagName, identifier, title)
{
	var len = identifier.length, colonindex, splittitle, taglen, titlelen = title.length, slen;
	var tags = document.getElementsByTagName(tagName);
	for (var i=0; i < tags.length; i++)
	{
		var tempString = tags[i].id;
		taglen = tags[i].title.length;
		if(taglen<titlelen)
			continue;
		splittitle = tags[i].title.replace(title,"");
		slen = splittitle.length;
		if(slen == taglen || (slen > 0 && splittitle.indexOf(":") == -1))
			continue;
		if ((identifier == "" || tempString.indexOf(identifier) == tempString.length - len))
		{
			return tags[i];
		}
	}
	return null;
}
Categories: Javascript, SharePoint Tags: