FireFox add-on for easily typing in Indian Scripts

April 8th, 2009
6 comments
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes)
Loading ... Loading ...

Many of you are aware of Pramukh Type Pad for easily typing into 9 Indian script. I have also created many IndicIME plugin for TinyMCE 2.x, 3.x, FCKEditor and PramukhLib javascript library to easily integrate it with existing Website and enable Indian script typing for its visitor. This requires the Website to install this plugin/library onto their server. It gives benefit to the Website owner that visitor can easily type in choosen Indian script but if the visitor is avid Indian script writer, s/he has to type in Indian script somewhere else and copy/paste the writing if Website s/he visits does not contain above mentioned script. To alleviate this problem, I have created Add-On for avid Firefox user. It supports Firefox 1.5 - 3.x. You can download this add-on from https://addons.mozilla.org/en-US/firefox/addon/10827. Currently this add-on is under review mode so it requires user to login and then download. Click the link below if you want to download from this blog.

Download Pramukh Type Pad Firefox Add-On

Installation instruction:

If you download from mozilla add-on website, after login, click on “Add to Firefox” button and Firefox will automatically ask you to install it. Click on Install button and restart firefox.

If you download from my blog, it is a zip file. Unzip the file on your computer. The extracted file is “pramukhtypepad-1.0.xpi”. From Firefox, go to File Menu > Open File…. Now locate the extracted file and press “Open”. It will ask you to install it. Click on Install button and restart firefox.

After restarting, it will add Script Menu at the top. You can choose the script you want to type in. This add-on has all the functionality that Pramukh Type Pad has. Pressing F12 will toggle the selected Indian script with English. Also at the bottom right status bar, you will your selected script. This add-on remembers the selected script and when you open up the browser next time, it will automatically select the last selected script for you.

Pramukh Type Pad Firefox Add-on

Enjoy typing in your favourite Indian language.

Indic Resource ,

FCKEditor JSP Integration Error: The server didn’t send back a proper XML response

April 8th, 2009
No comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings)
Loading ... Loading ...

I was having problem to integrate FCKEditor into struts 1.3. I tried to do it as per instruction in the JSP Integration method given on FCKEditor documentation but still I was not able to run it locally. Here is how I installed struts 1.3.

http://localhost/jsptest (Tomcat is running on the top of apache)

FCKEditor file is installed at http://localhost/jsptest/js/fckeditor/…..

Please note that I have put fckeditor under /js directory so I have to change the path in all files listed below from what documentation says. If you have your fckeditor installed in other directory, make necessary changes in the files mentioned below to represent your actual path.

Error Description:

The server didn’t send back a proper XML response

Resolution:

  1. Open fckconfig.js file. Locate “var _FileBrowserLanguage = ‘xxx’;var _QuickUploadLanguage=’xxx’;”. Make sure you put xxx = jsp. This change is needed because I had this value as “php” so apache was delegating the request to php engine and it was throwing error as file not found but if I change it to “jsp”, now apache will delegate the request to Tomcat and it knows from web.xml file how to process this request.
  2. Create a file under WEBROOT/WEB-INF/classes/fckeditor.properties if not exists and put following text
    fckeditor.basePath=/js/fckeditor
    connector.userFilesPath=/images
    connector.resourceType.image.path=/
    connector.resourceType.file.path=/
    connector.resourceType.flash.path=/
    connector.resourceType.media.path=/
  3. Make sure you have connector defined in web.xml file.
    <servlet>
    	<servlet-name>Connector</servlet-name>
    	<servlet-class>net.fckeditor.connector.ConnectorServlet</servlet-class>
    	<load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    	<servlet-name>Connector</servlet-name>
    	<!-- Do not wrap this line otherwise Glassfish will fail to load this file -->
    	<url-pattern>/js/fckeditor/editor/filemanager/connectors/*</url-pattern>
    </servlet-mapping>

JSP , , ,

SQL Server: Stop trace using SQL Command

January 15th, 2009
1 comment
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings)
Loading ... Loading ...

Today I started SQL Profiler and paused it. After some time, none of the buttons were enabled. I can neither resume nor stop the trace. Here are the sql commands that I finally found to stop the trace.

1) Get the trace id

SELECT * FROM ::fn_trace_getinfo(default) WHERE property = 2;

2) Stop trace

DECLARE @TraceID int
SET @TraceID = ?
EXEC sp_trace_setstatus @TraceID, 0
EXEC sp_trace_setstatus @TraceID, 2

SQL Server ,

Change Database Name in SQL Server

December 23rd, 2008
No comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings)
Loading ... Loading ...

SQL Server Enterprise Manager does not let you change your database name once you create it. If you want to change your database name, you may have to manually run the following script to change it. First of all you have to login to SQL Server using osql command line utility. Once you are in, fire following commands to rename database.

ALTER DATABASE OldName SET SINGLE_USER WITH ROLLBACK IMMEDIATE
go

sp_renamedb 'OldName', 'NewName'
go

ALTER DATABASE NewName SET MULTI_USER
go

SQL Server , , ,

ADODB Command.Execute does not return error for RAISERROR

December 4th, 2008
No comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings)
Loading ... Loading ...

Description:

I was executing a stored proc which would halt its execution using RAISERROR. When I tried to run the stored proc in Query Analyzer it worked fine and gave me error but in VBA it couldn’t halt the execution and continued to the next statement. Read more…

MS Access , , ,

MS Access Pass-through query Error: Cannot execute a select query

June 19th, 2008
No comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings)
Loading ... Loading ...

When I tried to run an UPDATE statement from pass-through query, it throwed error “Cannot execute a select query”. This is due to that fact the property ReturnsRecords is set to True which requires the pass through query to return results. If it does not return recordset, it will throw an error. You can correct this error by

  1. Open pass-through query into design mode. Click on Properties button (Alt+Enter) and set Return Records to No
  2. Using program you can set QueryDef object’s ReturnsRecords property to False.

MS Access ,

Check the existence of COM object registered using regsvr32

May 2nd, 2008
No comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings)
Loading ... Loading ...

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.

Tricks n Techniques, Troubleshooting

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

April 18th, 2008
3 comments
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes)
Loading ... Loading ...

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 Access, Tricks n Techniques , , ,

MS Word: Remove watermark from all Word pages using VBA

March 28th, 2008
4 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings)
Loading ... Loading ...

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

MS Word, Tricks n Techniques , ,

CodAddict: A new way to store and manage your code bookmarks/examples

August 12th, 2007
No comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings)
Loading ... Loading ...

It was very difficult for me to remember all my code examples and mingle my code bookmark with my social bookmarks. So I came up with a solution to easily store and manage code examples online. The website name is http://www.codaddict.com. I have come up with this name because I am a code addict. I hope you will also like this website and use it to store your code bookmark and share your knowledge with whole world.

Main Features

  • Its FREE!!!
  • Access your code example from any end of the world
  • Store your code example from any end of the world
  • Dont go through a lengthy article when you need a line of code
  • Make you code example private if you want to.
  • Easily organize your code example
  • Retrive your code example very easily
  • Import/export your code examples with a single click
  • Share your code examples with the world
  • Get new ideas from other geek’s code example
  • Separate your code example bookmark from social bookmark
  • Built by a developer who knows what you need.
  • Takes about 1 minute to join.

Useful Tools