SharePoint Re-Deployment Bat File


A simple bat file that you can use for redeploying your WSPs:

Copy the following text in a notepad and Save As ‘Deployment.bat

stsadm -o retractsolution -name “ProjectA.Deployment.wsp” -immediate -url “http://localhost:2000/
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name “ProjectA.Deployment.wsp”
stsadm -o addsolution -filename “D:\ProjectA.Deployment.wsp”
stsadm -o deploysolution -name “ProjectA.Deployment.wsp” -immediate -allowgacdeployment -url “http://localhost:2000/” -force
stsadm -o execadmsvcjobs
iisreset
iexplore http://localhost:2000/
pause

Ensure that you modify the filename path in Line 4 to your respective paths and also the Site URL.

Selecting a complex jQuery selector present in a page


Most of time, the moment we see a complex ID like ‘ctl00_m_g_f368f5ab_d679_4436_a6da_938c6bfcd60a_ctl00_SearchCheckBox’ we faint… ūüėČ

And what we end up is start finding some parent which has an ID or see if there is a css class defined for this control. Targeting a control using its parent is good and performance-wise effective. However, using a css class for targeting a control is not advisable.

To work with a control which has a full-grown id like the one mentioned above, all you need is to make use of the CSS 3 selector. Before i proceed, let me clear a wrong notion here…

CSS 3 won’t work in IE6.0 [period], but CSS 3 selectors when used in jQuery on an IE 6 browser will work [period]

Solution:

$(“[id$=_SearchCheckBox]”).css(‘color’,’#737373′);

Steps to write:

$(“”).css(‘color’,’#737373′); //This is what you want at the end

$(“[]“).css(‘color’,’#737373′); //Add square brakets inside

$(“[id$=]”).css(‘color’,’#737373′); //Add id$= inside the square brackets

$(“[id$=_SearchCheckBox]”).css(‘color’,’#737373′); //Add your tail end of your id

Note:

$ in regular expression, is used to match a text that ends with a particular string. You can refer the CSS 3.0 Cheat Sheets to see the other possible options.

 

Solve Flickering jQuery accordion issue in MOSS 2007


MOSS 2007 for the simple reason of missing a DOCTYPE can screw up the smoothness of animations created through jQuery. One of my situations didn’t allow me to add DOCTYPE to my master and my clients ended up seeing flickering animation of the accordion. Seriously that was irritating. Being an ardent admirer and an evangelist of jQuery, it gave me a shock. But after some level of problem analysis and testing, i was able to get hold of a workaround.

One piece of advice: If you could add a DOCTYPE to your masterpage, you can very well get rid of this flickering issue.

Solution:

The sliding down effect of accordion was firing the callback once, while slidingup was triggering the callback twice. That was the catch. All i did was introduce a delay during the slide up operation, so that the first callback is veiled and only one invoke is visible.

Code Fix:

//Pause method which is to be used for the accordion slideup veil

var speed = 300;

function pausejs(millis) {
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while (curDate – date < millis);
}

$(“#accordion h2”).live(‘click’, function() {
$(“#accordion div”).slideUp(speed);¬†¬†¬†¬† //slide up all the accordion children
        pausejs(speed);      //introduce a delay before the next code is executed
if ($(this).next().is(“:hidden”)) {¬†¬†¬†¬†¬†¬†//opens up¬†the respective child
$(this).next().slideDown(speed);
}
});

Explanation:

On clicking any of h2 (accordion headers), slide up all the accordion content/children. Then open up the respective accordion content/children. But before you open up / slideDown the respective child, ensure that the slideUp operation was complete. For this we introduce the delay.

You can also try using the callback argument of the slideUp(speed, callbackfunction) and invoke the slideDown of the respective child on completion of slideUp operation. However, since i did not find the flickering issue not getting resolved, i did not go ahead with that.

Enable Tab navigation for your entire page using jQuery


One of the most commonly faced Accessibility issue is in maintaining the tab order. If you don’t take it the right way, you might end up wasting days and days of effort, when you can just get it done in 2mins using jQuery.

Requirement:

Clicking on tab should go through all the functional controls on my current page.

Solution:

$(function() {
SetTabIndex();//Set tabIndex for all the HTML input elements, dropdowns, anchor tags and any control with classname as ‘linkname’ coming under control with id ‘myId’
});
function SetTabIndex() {
var tabindex = 1;
$(‘input,select,a,#myId .linkname’).each(function() {
if (this.type != “hidden”) {
var $input = $(this);
¬†¬†¬†¬†¬†¬† $input.attr(“tabindex”, tabindex);
tabindex++;
}
});
}

Concept:

It’s very simple, you just need to set the tabIndex property of all the desired controls on your page, when the DOM load is complete.

Word of Caution:

It might look simple to you, but there is an expensive for loop going on inside, hence its desirable to avoid using any classnames and good to target Ids and specific controls. But i did not see much impact on my page which had around 300 links.

Hope this saved your time and effort.

How to insert newline in you excel formulae


To add a newline or a hard return in front of certain text, we try the Find & Replace option, but ends up nowhere. Instead make use of the CHAR(10), MS has provided, in your formulaes.

Usage:

=CONCATENATE(“Heading1”,CHAR(10),”Content under Heading1″)

 

Let me take a complex example also, to get you the feel of the power of CHAR(10):

Before Text:

a. Open Firefox b. Enter the URL as http://www.google.com c. Click on enter

After Text:

a. Open Firefox

b. Enter the URL as http://www.google.com

c. Click on enter

Solution:

=CONCATENATE(IFERROR(MID(C4,SEARCH(“a. “,C4),SEARCH(“b. “,C4)-SEARCH(“a. “,C4)),””),CHAR(10),IFERROR(MID(C4,SEARCH(“b. “,C4),SEARCH(“c. “,C4)-SEARCH(“b. “,C4)),””),CHAR(10),IFERROR(MID(C4,SEARCH(“c. “,C4),LEN(C4)),””))