|
Check the existence of COM object registered using regsvr32
05/02/2008
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 objVariable Set 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.
Feedback(0)|
Rate Entry

|
|
|
|
MS Access: Check If The Normal Form Or Subform Form Is Loaded
04/18/2008
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 Function ErrorHandler: Resume SkipElement End Function
Feedback(0)|
Rate Entry

|
|
|
|
MS Word: Remove watermark from all Word pages using VBA
03/28/2008
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
Feedback(0)|
Rate Entry

|
|
|
|
CodAddict: A new way to store and manage your code bookmarks/examples
08/12/2007
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.
Feedback(0)|
Rate Entry

|
|
|
|
Flash File (.swf) is not loading in IE, works fine in FF
07/17/2007
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>
Feedback(6)|
Rate Entry

|
|
|
|
Wordpress Comment Spam Even with Comments Disabled for Blog
04/27/2007
I have my wordpress blog at http://diary.vishalon.net. Every day I am getting hundreds of comment spam. I had installed comment spam fight plugin and it seems like worked for few days but again I was getting spam comments. I changed the settings of blog so that only logged in user can put a comment. I even disabled comments completely but all efforts were in vein. I tried to find some information on google but couldn't get it So I thought let me debug the application and check it out why I am getting hunderds of comments everyday. For this, in wp-comments-post.php file I wrote a code to write all parameters in a text file so I can check out what's wrong with application. I can post my comment and see the log file but for spam, there was no log trail. It seemed to me that comments are coming from other files. so I moved that code into config file and I found that those comments are actually trackbacks. If you want to check if the comment is trackback or not, check the Email value of comment. If you see it empty, it means it is a trackback. I disabled trackback by loggin in site > Options > Discussion and disabling trackback and pingback.
Now I am relieved of spam comments(actually trackbacks).
Feedback(1)|
Rate Entry

|
|
|
|
php.ini changes have no effect
04/13/2007
Today I tried to install PHP and MySQL on my local Windows XP Pro machine. Both were working fine individually but I couldnot connect to the MySQL from PHP code. I tried to change php.ini file but no matter what I do, changes were not reflected when I tried phpinfo() function.
It was showing Configuration File (php.ini) Path = C:\php\php.ini which is correct and I did not have any php.ini on any other location. Everytime I make changes, I was restarting the IIS Server but any how changes were not reflected. In resetting IIS what I was following is go to Control Panel > Administrative Tools > Internet Information Services > Expand [Computer Name] > Expand Website > Right Click on Default Website and press Stop button and again start it. But after sometime I found that this is NOT IIS restart. It is just Website restart. For IIS restart run the following command on Dos prompt.
iisreset /restart
And boom. I got my php correctly configured and now I can connect to MySQL from PHP code.
Feedback(2)|
Rate Entry

|
|
|
|
How to Enable Windows XP Language Toolbar?
04/12/2007
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
Feedback(9)|
Rate Entry

|
|
|
|
WordPress Yearly/Monthly/Weekly Post Repeater Plugin
04/08/2007
Post Repeater plugin is a boon when you need to repeat a single post every year/month/week of the day. You may achieve this functionality by editing timestamp manually, but using this plugin you can automate this task. This plugin is very useful when you are blogging about weekly/monthly/yearly/historical events, famous persons etc. All the posts which needs to be repeated are listed on the top of your blog posts for that day.
Features - Uses custom field
- No change required in theme
- No cron job
- No change in original timestamp of post
Version Supported WordPress 2.1 and greater WordPress Mu 1.1 and greater
Installtion Procedure: - Download the plugin and unzip it
- Put the PostRepeater.php file into your wp-content/plugins/ directory
- Go to the Plugins page in your WordPress Administration area and click "Activate" for Post Repeater Plugin
So easy hmmm.......
How to repeat your post? It is even simpler than installing your plugin. Choose the post you need to repeat and open it in edit mode. This plugin uses custom field to tag the repeater post. Here is the custom field settings Key = REPEATON, Value = MM/DD for yearly repeat Key = REPEATON, Value = DD for monthly repeat Key = REPEATON, Value = Sun/Mon/Tue/Wed/Thu/Fri/Sat for weekly repeat
Custom Field Settings Example Key = REPEATON, Value = 04/24 will repeat the post on 24th April every year. Key = REPEATON, Value = 09 will repeat the post on 9th of every month. Key = REPEATON, Value = Fri will repeat the post on every friday.
Dont forget that you must have to put two digits for date and month number.
Known Issue If your repeating post is very latest and comes on the front page of your blog, it will be repeated. (This post will be shown as a repeating post and as a regular post)
FAQ's 1) I activated plugin but cannot see repeating post. Check your wordpress version. It must be WP 2.1 or > or WPMU 1.1 or >. Check the custom field name and make sure that you spelled it correct. Check the custom field value is set to proper format MM/DD (with leading zero)
2) I would like to activate Sticky Post Plugin as well Dont do that mistake. It is going to throw mysql error.
3) I got wierd mysql error This plugin changes query for showing posts. It is possible that you have another plugin which also modifies the query and hence the resultant query is a junk query which MySQL is not recognizing. so now you have to deactivate any one of the plugin.
Feedback(5)|
Rate Entry

|
|
|
|
WordPress Yearly Repeater Plugin
04/05/2007
Update: This plugin is modified and created new Post Repeater Plugin which is capable of repeating the post yearly/monthly/weekly bases.
Yearly Repeater plugin is a boon when you need to repeat a single post every year on a particular day. You can achieve this by editing timestamp manually every year, but using this plugin you can automate this task. This plugin is very useful when you are blogging about historical events, famous persons etc. All the posts which needs to be repeated are listed on the top of your blog posts for that day.
Download WordPress Repeater Plugin
Version Supported
WordPress 2.1 and greater WordPress Mu 1.1 and greater
Installtion Procedure
1) Download the plugin and unzip it 2) Put the Repeater.php file into your wp-content/plugins/ directory 3) Go to the Plugins page in your WordPress Administration area and click "Activate" for Yearly Repeater So easy hmmm.......
How to repeat your post?
It is even simpler than installing your plugin. Choose the post you need to repeat every year and add custom field Key = REPEATON and Value=MM/DD, press Add Custom Field button, save the post and you are done!!!. For example, if you need to repeat the post on 24th April, set the custom field Key = REPEATON and Value = 04/24. Dont forget that you must have to put two digits for date and month.
Known Issue
If your yearly post is very latest and comes on the front page of your blog, it will be repeated. (This post will be shown as a repeating post and as a regular post)
FAQ's
1) I activated plugin but cannot see repeating post. Check your wordpress version. It must be WP 2.1 or greater or WPMU 1.1 or greater. Check the custom field name and make sure that you spelled it correct. Check the custom field value is set to proper format MM/DD (with leading zero)
2) I would like to activate Sticky Post plugin as well Dont do that mistake. It is going to throw mysql error.
3) I got wierd mysql error This plugin changes query for showing posts. It is possible that you have another plugin which also modifies the query and hence the resultant query is a junk query which MySQL is not recognizing. so now you have to deactivate any one of the plugins.
Feedback(3)|
Rate Entry

|