Archive

Archive for the ‘Tricks n Techniques’ Category

How to enable canonical Url for SEO in DotNetNuke 5.x?

September 15th, 2009 2 comments

Recently DotNetNuke 5.x has changed much of Url rewriting. I had updated my website running on DotNetNuke 4.9 to 5.x and now I have lost all my Google rank which were depending on old URLs.  Now all new URL seems very search engine friendly but I need my Google rank back to the new URL but is not possible because I have to create duplicate pages with new permanent redirect. Of course, there is another way of getting it back and even for future, we can save our google rank using Canonical URL.  Now we will learn what is canonical url and how we can add it in existing DotNetNuke installation. Read more…

Firefox 3.5.2: How to view cookie dialog?

September 9th, 2009 1 comment

Today I wanted to view my cookies but I couldn’t find it when I navigated to Tools Menu > Options > Privacy. It showed me only History and Location Bar frames but previously I used to see Show Cookies button. Finally I found where it was hidden. Read more…

Categories: Tricks n Techniques Tags: ,

Restore internet connection and system tray icon after spyware/virus removal

September 2nd, 2009 1 comment

While I was surfing internet, I don’t know where I clicked and it opened up a website which in turn opened a popup window. Within a matter of few seconds, my FireFox browser froze and in the system tray icon, it showed me little nice blue icon with a pop up saying “Your computer is infected with virus. Click here to fix it.”. (Who says Firefox 3.5 is a secure browser?). I killed the Firefox process from Task Manager but I was running as admin of the computer so it created much problem for me as it might have injected lot of spyware/virus. Even Norton Anti-virus could not detect anything while it was running. I immediately disconnected computer from internet so that it won’t affect any other machine and/or send any information from my computer to outside world. Read more…

Check the existence of COM object registered using regsvr32

May 2nd, 2008 No comments

I had a chance to work on project which was using a COM object. This object was registered using regsvr32. During application migration to another server, I wanted to check the if this object exists on new server or not. I don’t wanted to write VB application to just check that object so suddenly a thought came in my mind. If I write down a vbs script file, with few lines of code, I can check out quickly. Here are the instructions to do it.

For this, you need to create a file checkobject.vbs on your computer and copy/paste the following code in it.

On Error Resume Next
Dim objVariableSet objVariable = WScript.CreateObject ("Wscript.Network1")
If Err.Number <> 0 Then
	Msgbox "Object is not found", vbCritical
	Err.Clear
Else
	Msgbox "Object found"
End If
Set objVariable = nothing

Now if you double click on that file, VB Script will be executed and appropriate message will be shown.

MS Access: Check If The Normal Form Or Subform Form Is Loaded

April 18th, 2008 1 comment

If you need to check if MS Access form is loaded or not, you can easily check it using the folloing code

If CurrentProject.AllForms("FORMNAME").IsLoaded = True Then
	' DO SOMETHING
End If

This code is good until you are using single form application. This code will fail if the form is used as subform. To search all the forms including subform, I have created a function calling which will search for all the loaded forms and gives the result as boolean value. Here is the example to check if the form is loaded or not

Dim IsLoaded as Boolean
IsLoaded = IsFormLoaded("FORMNAME")

The function IsFormLoaded will search each and every control within each form to find the form FORMNAME. Of course, this is a overhead to the application so to reduce the amount of search, two optional arguments can be provided which can be very helpful in searching subform. If you already know the parent form name of the subform and the controlname which holds subform within parent form, the time to search subform will be reduced. For example

Dim IsLoaded as Boolean
IsLoaded = IsFormLoaded("FORMNAME","PARENTFORMNAME")

will search all the controls withing PARENTFORMNAME form while

Dim IsLoaded as Boolean
IsLoaded = IsFormLoaded("FORMNAME","PARENTFORMNAME","CONTROLNAME")

will search for the CONTROLNAME control within PARENTFORMNAME form to check if the FORMNAME form is loaded.

The above mentioned functions are here.

Public Function IsFormLoaded(strFormName As String,
		Optional LookupFormName As Form,
		Optional LookupControl As Control) As Boolean
    Dim frm As Form
    Dim bFound As Boolean

    If Not (IsMissing(LookupFormName) Or IsNull(LookupFormName)
		Or LookupFormName Is Nothing) Then
        If Not (IsMissing(LookupControl) Or IsNull(LookupControl)
 		Or LookupControl Is Nothing) Then
        On Error GoTo ErrorHandler:
            If LookupControl.ControlType = acSubform Then
                If LookupControl.Form.Name = strFormName Then
                    bFound = True
                End If
            End If
        Else
            Call SearchInForm(LookupFormName, strFormName, bFound)
        End If
    Else
        For Each frm In Forms
            If frm.Name = strFormName Then
                bFound = True
                Exit For
            Else
                Call SearchInForm(frm, strFormName, bFound)
                If bFound Then
                    Exit For
                End If
            End If
        Next
    End If
ErrorHandler:
    IsFormLoaded = bFound
End Function

Public Function SearchInForm(frm As Form, strDoc As String,
 			bFound As Boolean)
On Error GoTo ErrorHandler
    Dim ctl As Control

    For Each ctl In frm.Controls
        If ctl.ControlType = acSubform Then
            If ctl.Form.Name = strDoc Then
            'If ctl.SourceObject = strDoc Then
                bFound = True
            Else
                Call SearchInForm(ctl.Form, strDoc, bFound)
            End If
SkipElement:
            If bFound Then
                Exit For
            End If
        End If
    Next
    Exit FunctionErrorHandler:
            Resume SkipElement
End Function

MS Word: Remove watermark from all Word pages using VBA

March 28th, 2008 6 comments

You can create watermark in MS Word document by going to Format Menu > Background > Printed Watermarks… Here you will be able to set Text Watermark in each page. Now if you want to remove the watermark from all pages, use the following VBA script.

   Dim section As Word.section
   Dim pheadertype As Long
   Dim hdr As Range
   Dim sp As Shape
   Dim str As String
   For Each section In ActiveDocument.Sections
      With section
         Set hdr = .Headers(wdHeaderFooterFirstPage).Range
         For Each sp In hdr.ShapeRange
            str = sp.Name
            If InStr(str, "PowerPlusWaterMarkObject") > 0 Then
               sp.Visible = msoFalse
             End If
          Next
          Set hdr = .Headers(wdHeaderFooterPrimary).Range
          For Each sp In hdr.ShapeRange
             str = sp.Name
             If InStr(str, "PowerPlusWaterMarkObject") > 0 Then
                 sp.Visible = msoFalse
             End If
           Next
       End With
    Next

Flash File (.swf) is not loading in IE, works fine in FF

July 17th, 2007 22 comments

I have some video tutorial uploaded on my website. I tried it on FF and it worked perfectly but when I tried on IE, I did not get anything. I checked on google and after spending much time, I found the problem. I am explaining with example.

<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="banner"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
 border="0" width="754" height="64">
<param name="movie" value="banner.swf">
<param name="quality" value="High">
<embed src="http://www.domain.com/video/banner.swf"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" name="banner"
width="754" height="64" quality="High">
</object>

Now IE uses param movie tag to download swf file and FF uses embed src tag to download swf. Now you realized why IE is not displaying flash object. Correct code would be

<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="banner"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
border="0" width="754" height="64">
<param name="movie" value="http://www.domain.com/video/banner.swf">
<param name="quality" value="High">
<embed src="http://www.domain.com/video/banner.swf"
pluginspage="http://www.macromedia.com/go/getflashplayer"type="application/x-shockwave-flash"
name="banner" width="754" height="64" quality="High"></object>

Note: Due to some legal issues, IE had a “Click to Activate” restriction on swf and flash files. It requires the user to click on the control to load swf file. Above mentioned issue is different than this one. To learn more about the resolution visit http://www.adobe.com/devnet/activecontent/articles/devletter.html. It contains latest change and how to work around the IE restriction issue. (Thanks to Baljeet for bringing this issue up)

Categories: Tricks n Techniques Tags:

How to Enable Windows XP Language Toolbar?

April 12th, 2007 42 comments

I was completely frustrated with Languge toolbar as it was enabled in some computer and not enabled in other computer. I tried many methods and after some trial and error, I found few things which might help you get your Windows Language Toolbar back. This solution is given for Windows XP user.

Method 1:
Right click on the Taskbar and go to toolbars. If Language Bar option is there check it by clicking it. and you will get Language Toolbar.

Method 2:
Go to Start menu > Control Panel > Regional and Language Options > Languages Tab > Text Services and Input Languages Box> Details… > Settings Tab > Preferences Box > Language Bar…
Now tick the option “Show Language bar on desktop” and you will get Language bar on your task bar.

Make sure that Start menu > Control Panel > Regional and Language Options > Languages Tab > Text Services and Input Languages Box> Details… > Advanced Tab > System Configuration Box
Make sure that Turn off advanced text service is unchecked.

Method 3:
Language bar is a core component in Windows XP. When you are opening any Office XP application, this program starts running. Sometime, this program runs on startup. If you want to check if this program is running or not, to to task manager by clicking ctrl+Shirt + Esc or by right clicking on Taskbar and choosing Task Manager > Processes tab. Check if the process ctfmon.exe is running or not. If it is not running, go to Start > Run… Type ctfmon and press Enter. This will start the process and you will be able to see Language Bar.

Method 4:
Go to Start > Run… type regedit. This will open up registry. Browse to HKEY_CURRENT_USER\Software\Microsoft\CTF\LangBar
Here you will see
1) ExtraIconsOnMinimized = 1
2) Label = 1
3) ShowStatus = 4
4) Transparency= ff

Out of these four options, ShowStatus is very important and it is responsible for actually showing the Language Bar on Taskbar. If you dont have this option set to 4, set it 4, close regedit browser, kill the process ctfmon.exe if it is there and start it by following steps in Method 3.

I hope now you would have got your Language Toolbar.

Click here for Video Tutorial on How to Enable Language Toolbar in Windows

Categories: Tricks n Techniques Tags:

Microsoft Access: why qdf.execute is not showing any warning?

May 31st, 2006 No comments

I had an application in which I had a code like

Dim qdf as QueryDef
qdf = new QueryDef("Query")qdf.execute

The query was not running because of error but the application was not breaking at the time of error generation. To force the application to break/throw exception write the statement like

qdf.execute dbfailOnError

and by this way we can catch all errors.

How to get the default login page in dotnetnuke?

January 26th, 2006 6 comments

Soemtimes it is possible that you have updated the login page information in dotnetnuke and after that you dont have any way to get back this login page. Ironically, you cannot even login to change the login page. You are completely stuck. Now only one way to get back this login page is directly updating the database entry.

Login to the dotnetnuke database using SQL Server Enterprise Manager. Open the “Portals” table. Select the row for which you want to get back the login page. Locate the column “LoginTabID”. Press ctrl+0 to enter NULL value in that column.

Now type the URL of your website and login to your dotnetnuke portal with a smile!!!

Categories: Tricks n Techniques Tags: