Tuesday, February 24, 2009

fix for sql injection

SET NOCOUNT ON

DECLARE @stringToFind VARCHAR(100)
DECLARE @stringToReplace VARCHAR(100)
DECLARE @schema sysname
DECLARE @table sysname
DECLARE @count INT
DECLARE @sqlCommand VARCHAR(8000)
DECLARE @where VARCHAR(8000)
DECLARE @columnName sysname
DECLARE @object_id INT

SET @stringToFind = '<>'


SET @stringToReplace = ''

DECLARE TAB_CURSOR CURSOR FOR
SELECT B.NAME AS SCHEMANAME,
A.NAME AS TABLENAME,
A.OBJECT_ID
FROM sys.objects A
INNER JOIN sys.schemas B
ON A.SCHEMA_ID = B.SCHEMA_ID
WHERE TYPE = 'U'
ORDER BY 1

OPEN TAB_CURSOR

FETCH NEXT FROM TAB_CURSOR
INTO @schema,
@table,
@object_id

WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE COL_CURSOR CURSOR FOR
SELECT A.NAME
FROM sys.columns A
INNER JOIN sys.types B
ON A.SYSTEM_TYPE_ID = B.SYSTEM_TYPE_ID
WHERE OBJECT_ID = @object_id
AND IS_COMPUTED = 0
AND B.NAME IN ('char','nchar','nvarchar','varchar','text','ntext')

OPEN COL_CURSOR

FETCH NEXT FROM COL_CURSOR
INTO @columnName

WHILE @@FETCH_STATUS = 0
BEGIN
SET @sqlCommand = 'UPDATE ' + @schema + '.' + @table + ' SET [' + @columnName + '] = REPLACE(convert(nvarchar(max),[' + @columnName + ']),''' + @stringToFind + ''',''' + @stringToReplace + ''')'

SET @where = ' WHERE [' + @columnName + '] LIKE ''%' + @stringToFind + '%'''

EXEC( @sqlCommand + @where)

SET @count = @@ROWCOUNT

IF @count > 0
BEGIN
PRINT @sqlCommand + @where
PRINT 'Updated: ' + CONVERT(VARCHAR(10),@count)
PRINT '----------------------------------------------------'
END

FETCH NEXT FROM COL_CURSOR
INTO @columnName
END

CLOSE COL_CURSOR
DEALLOCATE COL_CURSOR

FETCH NEXT FROM TAB_CURSOR
INTO @schema,
@table,
@object_id
END

CLOSE TAB_CURSOR
DEALLOCATE TAB_CURSOR

Wednesday, February 04, 2009

Apache MyFaces Trinidad

NOTE: some how all the xml related syntax is removed while rendering the post in blogspot.


My team is exploring the use of JSF into one of our applications.

We had smooth sail until we decided to use trinidad components. We wanted to have out of box support for the features we wanted to build into application and tomahawk and trinidad seem to be the way to go.
Some of the dependencies we had in our project POM file(related with myfaces and trinidad) are

org.apache.myfaces.core
myfaces-api
1.2.2
compile




org.apache.myfaces.core
myfaces-impl
1.2.2
compile



org.apache.myfaces.tomahawk
tomahawk
1.1.8
runtime


javax.servlet
jstl


org.apache.myfaces.core
myfaces-api


org.apache.myfaces.core
myfaces-impl





jstl
jstl
1.2
runtime



com.sun.facelets
jsf-facelets
1.1.11




org.apache.myfaces.trinidad
trinidad-api
1.2.1




org.apache.myfaces.trinidad
trinidad-impl
1.2.1


org.apache.myfaces.trinidad
trinidad-build
1.2.1



Contents of web.xml






contextConfigLocation
classpath:applicationContext.xml


org.springframework.web.context.ContextLoaderListener


org.springframework.web.context.request.RequestContextListener


org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL
true


facelets.LIBRARIES
/WEB-INF/tomahawk.taglib.xml


javax.faces.DEFAULT_SUFFIX
.xhtml


facelets.DEVELOPMENT
true


javax.faces.CONFIG_FILES
/WEB-INF/backoffice-config.xml


javax.faces.STATE_SAVING_METHOD
client


org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION
20


org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
true


org.apache.myfaces.COMPRESS_STATE_IN_SESSION
true


org.apache.myfaces.ALLOW_JAVASCRIPT
true


org.apache.myfaces.DETECT_JAVASCRIPT
false


org.apache.myfaces.PRETTY_HTML
true


org.apache.myfaces.AUTO_SCROLL
true


org.apache.myfaces.SECRET
NzY1NDMyMTA=


org.apache.myfaces.VALIDATE
true


org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS
true


org.apache.myfaces.ADD_RESOURCE_CLASS
org.apache.myfaces.renderkit.html.util.DefaultAddResource


org.apache.myfaces.RESOURCE_VIRTUAL_PATH
/faces/myFacesExtensionResource


org.apache.myfaces.CHECK_EXTENSIONS_FILTER
true


javax.faces.PARTIAL_STATE_SAVING_METHOD
false



extensionsFilter
org.apache.myfaces.webapp.filter.ExtensionsFilter

uploadMaxFileSize
100m


uploadThresholdSize
100k



extensionsFilter
*.jsf


extensionsFilter
/faces/*


org.apache.myfaces.webapp.StartupServletContextListener


Faces Servlet
javax.faces.webapp.FacesServlet
1


Faces Servlet
*.jsf


index.jsp
index.html


trinidad

org.apache.myfaces.trinidad.webapp.TrinidadFilter



trinidad
Faces Servlet


resources

org.apache.myfaces.trinidad.webapp.ResourceServlet



resources
/adf/*



org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER
com.sun.facelets.FaceletViewHandler



facelets.VIEW_MAPPINGS
*.xhtml





faces-config.xml content is



org.springframework.web.jsf.DelegatingVariableResolver


org.apache.myfaces.trinidad.core




Eclipse design time didnt handle trinidad tags properly (no UI rendering for tr components),but it worked fine.

What I needed was to select rows in table using radio button option. It looks simple functionality but always it created problem. I remember doing some custom java script implementation to handle it, then we had difficult time even in .Net development. Now in java also we spent few days in fixing some very basic issue.
It is not technology which need to be blamed all the time. if we started with the formal instructions, it would have been very easy for us.

VMWare Server 2.0 on Ubuntu - Guest windows 2003 server

I had a need to refresh my M$ Knowledge and tried to do that.

As my laptop (inspiron 1525) runs with Ubuntu, I have downloaded vmware server 2.0 (available for free from vmware site). And then installed windows 2003 on it.

Few issues and how I resolved it.

1. default windows desktop size was very small.
fix: increase the resolution, and it made my windows desktop to use full laptop screen.
2. Login problem:
I was not able to send Ctrl+Alt+Del signal after installing it, but then some one on internet suggested to try
Ctrl+Alt+ PrintScrn combination, it worked.
3. Keyboard problem: Del button and arrow keys were not working. probably some other keys were too not working. down arrow was behaving as if it is the windows button, and backspace was working as del button. Yes I had no way of backspacing my text.

Fix: I followed this link and found the fix working.

I tried solution 3 mentioned in the blog post.
i.e login as root and execute 'echo "xkeymap.nokeycodeMap = true" >> ~/.vmware/config'
It worked for me. Yes it is not the typical sudo. sudo didnt work for me (also mentioned in the article). Opened new shell and logged in as root. then executed this command.

Surprising, it worked. now I am very much comfortable in the vmware win2k3 image.


Yes, as it is free ware, vmware might have left some known issues along with it. But then I am able to solve the issues in front of me.

Now, I can stick to Ubuntu and occassionally use windows by vmware server web console for specific needs.

I am happy.

Wednesday, January 21, 2009

JOSSO 1.8

Today I tried playing with JOSSO, I spent around 4 to 5 hours. Wanted to setup JOSSO with NTLM authentication, but not successful yet.

Here is the log of what I have done.

Follow instructions from
http://www.josso.org/confluence/display/JOSSO1/Quick+Start
there is some confusion here, as the article talks of using commands to install josso, but the downloaded file is not having the stuff related with the documentation.

Download Josso 1.8 release from sourceforge.net download lcoation.

http://sourceforge.net/project/showfiles.php?group_id=116854&package_id=129496&release_id=653379

you can download the .tgz file which is around 42MB. this contains josso-gsh shell, which can be used to deploy the war file (documents on josso confluence site use this shell to deploy, it took a while for me to identify which file has this gsh file)
gateway install --target "D:/servers/Tomcat 6.0" --platform tc60


Either you can do this or download the tomact version and use it directly/build from source and use it.


in case if you need any further information best option is to google and if the josso site pages are not coming properly (in my case its getting timedout) then read the google cache.

As the 1.8 release happened almost a week back, we might face problems in setting up things propely, more help might come into internet in the comming weeks.

Thursday, January 15, 2009

Friday, January 02, 2009

Open source alternatives for visio

As I am moving away from use of microsoft softwares, I was trying to find a proper alternative for visio, the famous microsoft modeling tool.

There seem to be 2 of them as proper alternatives(dia and drawing of open office), but dia leads the way because of the similarity with visio and certain special objects which make it better in casual designing. http://projects.gnome.org/dia/.

Check the URL for more details. It is a wondeful contribution by Free Software Foundation.

Wednesday, December 31, 2008

Maven

Maven comes really handly when it comes to managing project structure, building code etc. Its flexible dependency management is the best feature I go for.

In case if you want to start with maven, and looking for a starting point, Download latest maven (comes as a zip file, unzip it) and set your PATH environment variable to bin folder.
Now type "mvn archetype:generate" it lists out possible project types available. the follow up steps are self explanatory.

If you are looking for a specific project type (like a simple web application with springs configured etc), you might need to google for it. With little bit of effort you will get to find proper archtypes.

One problem I faced with maven POM (Project Object Model) files is with specific dependencies (jar files) which are not at all available on internet. I resolve them by creating similar structure locally and getting the near best possible jar file (yes I create folder strtucture, file name as required).

Tuesday, December 30, 2008

RESTful web services

RESTful services are a nice way of integrating how the web interacts with Humans and Machines in the simplest format. Though developer community doesn't feel any pain in building standard web services using SOAP, WSDL over HTTP, there is lot of complexity behind implementing web services.

RESTful web services offer simplest solution, making same HTTP protocol used for web services as well.

There are 2 important aspects in RESTful services.

1. Web method
2. Scope

When we use standard web services, web service method name is very important. RESTful removes this overhead. Just use the standard HTTP GET, POST,PUT,DELETE etc methods for any transaction.


Scope of the request is similar to the query string logic of HTTP. Query string must be able to define the scope of a client request, on what he needs to be done.

I will post more about it as and when I get time.

Saturday, December 27, 2008

Sify broadband from Ubuntu/Kubuntu

Here are the instructions to install sify broadband client in Kubuntu/Ubuntu 8.10

Download the client from the location http://202.144.65.70:8090
When I clicked the link for linux, it opened up a PDF file with the details. look for the li. for ux client link http://202.144.65.70:8090/bbandclient_v30/sify_bbclient-3.0.tar.gz

then execute the following commands (after downloading the file).

gunzip sify_bbclient-3.0.tar.gz
tar -xvf sify_bbclient-3.0.tar

From the exploded location, execute install.sh

execute sudo ./install.sh

gksudo ln -s /usr/lib/libcrypto.so /usr/lib/libcrypto.so.4

gksudo ln -s /usr/lib/libssl.so /usr/lib/libssl.so.4

now, you can execute "sifyconnect" command from terminal and it pops up sify bb client.

Make sure you call sify customer care to register your system/laptop physical address so as you can connect without any problem.

Saturday, June 02, 2007

killing oracle session

select s.username, s.osuser, s.sid, s.serial#, p.spid
from v$session s,v$process p
where s.paddr = p.addr
and s.username is not null;


This will return the database username, the operating system username, the session id, the serial number, and the system process id (SPID). Then, a DBA user can issue the following (using the SID and SERIAL# information from the previous query):

ALTER SYSTEM KILL SESSION 'sid,serial#';
ALTER SYSTEM KILL SESSION '9,203';

Wednesday, February 14, 2007

disabling browser back button

Its a very common question that many of the developers need often.

I am too interested how we can do this.
Oftent he problem is that after logout, if user clicks back in the browser and is able to see content, this is not expected. there will be many advantages if we can disable back button especially when we require it.

Cache control:
one of the best and easiest way to handle issues popup because of clicking back button is to set no cache for the pages.

setting no cache:



You can use client-side code to force the user's browser to not cache a Web page.

<html>
<head>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">

<meta http-equiv="Pragma" CONTENT="no-cache">
</head>

There are a couple things to keep in mind when using the above method to force a browser to not
cache a Web page:


  • Pragma: no-cache prevents caching only when used over a secure connection.
    A Pragma: no-cache META tag is treated identically to Expires: -1 if used in a
    non-secure page. The page will be cached but marked as immediately expired.



  • Cache-Control META HTTP-EQUIV tags are ignored and have no effect in Internet
    Explorer versions 4 or 5.


You can use both in your code. I tried this but this was not the solution because it did not work in all the
browsers so I guess if one had an intranet environment where there was some control in place then they could
use this method.


Javascript
My next area of research focused on the various rewiring the back button suggestions. An article by TJ
Sylvester, Rewiring the Back Button, makes interesting reading but I
noticed that when one clicks back it does not indeed take you to the page you entered the data but if I
clicked back twice it does and we would not want that too. Basically a determined user could always figure
out a way to circumvent the preventative measures.


Another way to "disable the back button" is to use client-side JavaScript code to open a new window that
doesn't have the toolbar. (This makes it harder (not impossible) for the user to go back to the previous
page.)
Another, more failsafe approach (although quite annoying) is, when a form is submitted, to open a new window
and close the window that the form existed in. I didn't give this method serious thought because
I would not like my site opening up a new window everytime a user submitted a form.


Next I examined the possibility of adding client-side JavaScript code on the page that we do not want to let
the user return to. Such JavaScript code could be used to have the effect of hitting the forward button, which would
counter any action by a user clicking the back button. The JavaScript code to accomplish this can be seen below:






<script language="JavaScript">
<!--
javascript:window.history.forward(1);
//-->
</script>


Again this is workable but it is far from the best way.
I was then given the suggestion to use location.replace to navigate form one page to another.
What this does is it replaces the current history entry with the new page so only one page will be maintained
in the history and the back button will never get enabled. This is, I guess, what a lot of people are looking
for, but again this would not be the best answer in all cases.


For one thing you will have to use client side script for this. For an anchor tag this will be easy by just
using:






<A HREF="PageName.htm" onclick="javascript:location.replace(this.href); event.returnValue=false; ">No back button when you do this.</A>

[Try out the above link!]


The above technique has its disadvantages: simply using Response.Redirect will not work, since,
each time a user jumps from one page to another, you need to clear out the location.history field
through client-side code. Also, keep in mind that this will just remove the last history entry, not all
of them. Go ahead and click the above hyperlink, you will be taken to a simple HTML page. Try clicking the back button
and you will notice you will be taken to the page you were visiting before you came to this page! (Assuming,
of course, you have client-side JavaScript code enabled in your browser.)


After my exhaustive search I found that there is still no way of truly disabling the back button for all cases.
All the methods I discussed in this article will, with varying degrees of success, prevent the
user from viewing the previous page, but they, of course, all have their limitations. The best solution involves
a mixture of both client-side and server-side script; regardless, there is no way to completely disable the back
button


JSP
%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>

ASP.NET

Response.CacheControl = "no-cache";

Proxy Server Caching-

Response.CacheControl = "private";

It disables the proxy server caching and page is cached on local machine.

Response.CacheControl = "public";

Proxy server cache is enabled.

Users request pages from a local server instead of direct from the source.

Thursday, February 01, 2007

Setting default browser

To make Internet Explorer the default web browser,

In Internet Explorer -> View menu -> Internet Options -> Programs
Enable
'Internet Explorer should check to see whether it is the default web browser'



To make firefox as your default browser

Go to Tools -> Options.
under general tab, check the check box for "Firefox should check to see if it is the default browser when starting".

or you have a button "check now" if you click that you will get an alert if firefox is not the default browser. if you click yes, then it will become default browser.

Thursday, January 18, 2007

Browser detection

Using the navigator object to detect client's browser
Until one browser remains standing on the web (if ever), browser detection will continue to be part of any good JavaScripter's life. Whether you're gliding a div across the screen or creating an image rollover, it's fundamental that only relevant browsers pick up on your code. In this tutorial we'll probe the navigator object of JavaScript, and show how to use it to perform browser detection, whether the subject is Firefox, Internet Explorer 6, or even Opera 8.
The navigator object
The navigator object was conceived back in the days when Netscape Navigatorreined supreme. These days it serves as much as an irony of NS's diminished market share as way of probing browser information.
The navigator object of JavaScript contains the following core properties:
Properties
Description
appCodeName
The code name of the browser.
appName
The name of the browser (ie: Microsoft Internet Explorer).
appVersion
Version information for the browser (ie: 4.75 [en] (Win98; U)).
cookieEnabled
Boolean that indicates whether the browser has cookies enabled. IE4 and NS6+.
language
Returns the default language of the browser version (ie: en-US). NS4 and NS6+ only.
mimeTypes[]
An array of all MIME types supported by the client. NS4 and NS6+ only. Array is always empty in IE.
platform[]
The platform of the client's computer (ie: Win32).
plugins
An array of all plug-ins currently installed on the client. NS4 and NS6+ only. Array is always empty in IE.
systemLanguage
IE4+ property that returns the default language of the operating system. Similar to NS's language property.
userAgent
String passed by browser as user-agent header. (ie: Mozilla /4.0 (compatible; MSIE 6.0; Windows NT 5.1))
userLanguage
IE4+ property that returns the preferred language setting of the user. Similar to NS's language property.
Let's see exactly what these properties reveal of your browser:
with (document){
write("AppCodeName: "+navigator.appCodeName+"")
write("AppName: "+navigator.appName+"")
write("AppVersion: "+navigator.appVersion+"")
write("UserAgent: "+navigator.userAgent+"")
write("Platform: "+navigator.platform+"")
}
AppCodeName: MozillaAppName: Microsoft Internet ExplorerAppVersion: 4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)Platform: Win32
At a glance
You probably think you have a very solid idea now of how to utilize the navigator object to detect your client's browser type. At its most basic form, the following two properties are used:
navigator.appNamenavigator.appVersion
For example:
//detect Netscape 4.7+
if (navigator.appName=="Netscape"&&parseFloat(navigator.appVersion)>=4.7)
alert("You are using Netscape 4.7+")
However, depending on the browser you're trying to detect, you'll find the above two properties too limiting.
Detecting Firefox 1.0+
Take for example, Firefox 1.0+. It shares the same "appName" value as older Netscape browsers, which is "Netscape." The appVersion value returned is also out of wack, which is "5." So we need to look to another property, which turns out to be "UserAgent." For Firefox 1.04 for example, its userAgent property reads:
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Ah ha, the text at the end of the string apparently contains the information we want. Based on this new found discovery, the below code detects if you're using Firefox 1.0+:
if(navigator.userAgent.indexOf("Firefox")!=-1){
var versionindex=navigator.userAgent.indexOf("Firefox")+8
if (parseInt(navigator.userAgent.charAt(versionindex))>=1)
alert("You are using Firefox 1.x or above")
}
The code assumes that all Firefox versions contain the string "Firefox/" immediately followed by the version number (ie "1").
Detecting IE 5.5+
Detecting IE using the navigator object also poses a similar problem as Firefox, since its "navigator.appVersion" property contains more than just the version number of IE:
4.0 (compatible; MSIE 5.5; Windows 98; Hotbar 3.0)
If we were to use parseFloat to try and extract out the browser version in "navigator.appVersion", we'd get 4.0, instead of the correct number (5.5). This is due to the way parseFloat works- by returning the first number it encounters. So, how does one go about getting the version number in IE? As with Firefox, it really comes down to how you wish to approach the issue. Lets stick with using the "navigator.appVersion" property this time, though you can certainly use "navigator.userAgent" as well:
//Detect IE5.5+
version=0
if (navigator.appVersion.indexOf("MSIE")!=-1){
temp=navigator.appVersion.split("MSIE")
version=parseFloat(temp[1])
}
if (version>=5.5) //NON IE browser will return 0
alert("You're using IE5.5+")
In the above, string.split() is first used to divvy up navigator.appVersion into two parts, using "MSIE" as the separator:
4.0 (compatible; MSIE 5.5; Windows 98; Hotbar 3.0)
As a result temp[1] contains the part after "MSIE", with the browser version appearing first. Doing a parseFloat() on temp[1] therefore retrieves the browser version of IE.
The Opera pitfall
Using the navigator object to screen for Opera is even a little more complex, as Opera by default identifies itself as IE, with Opera 8 identifying itself as IE6, inside "navigator.userAgent." The rationale for this is so that scripts screening for IE would also allow Opera through, so that Opera will render these pages properly. Lets take a look at what the userAgent of Opera 8.5 returns depending on what it is set to identify as:
As IE6: Mozilla/4.0 (compatible; MSIE 6.0; Windows XP) Opera 8.5 [en]As Moz5: Mozilla/5.0 (Windows XP; U) Opera 8.5 [en]As Opera: Opera/8.5 (Windows XP; U) [en]
"What's the problem? Opera 8.5 appears in each case." you may say. Well, look closer, and notice how when Opera is set to identify as itself, the Opera string returned is slightly different ("Opera/8.5" versus "Opera 8.5"). So ironically enough, the expressionif (navigator.userAgent.indexOf("Opera 8.5")!=-1)
will fail if the user has their browser set to identify as Opera, but not if any other browser!
Despite this oddity, the code to detecting Opera need not be any different than the one used to detect Firefox:
if(navigator.userAgent.indexOf("Opera")!=-1){
var versionindex=navigator.userAgent.indexOf("Opera")+6
if (parseInt(navigator.userAgent.charAt(versionindex))>=8)
alert("You are using Opera 8 or 9")
}
This also assumes that all Opera versions contain the string "Opera" immediately followed by either a space or "/", then the version number (ie "8"). And since it only looks at the first number within the version, it can only detect up to Opera 9, not 10 for example.


Using object detection to sniff out different browsers
Since different browsers support different objects, you can use Object Detection as a quick though less than infallible way of detecting various browsers. For example, since only Opera supports the property "window.opera", you can use that to instantly separate an Opera browser from the herd. Here are a few sample test cases, and what they *imply* about the browser running it:
Example objects used to "rough" detect a particular browser
Scheme
Description
document.getElementById
Detects modern browsers in general, which covers IE5+, Firefox1+, and Opera7+
window.getComputedStyle
Detects Firefox1+ and Opera 8+
Array.every
Detects Firefox1.5+ (method detection)
window.Iterator
Detects Firefox2+
document.all
Detects IE4+
window.attachEvent
Detects IE5+
window.createPopup
Detects IE5.5+
document.compatMode && document.all
Detects IE6+
window.XMLHttpRequest
Detects IE7, Firefox1+, and Opera8+
window.XMLHttpRequest && document.all
Detects IE7. Note: Will fail if visitor explicitly disables native xmlHTTPRequest support (under Toolbar-> Internet Options-> Advanced)
document.documentElement && typeof document.documentElement.style.maxHeight!="undefined"
Another way of detecting IE7 that is more reliable than the above.
window.opera
Detects Opera (any version).
* Since Opera by default also identifies itself as IE (apart from Opera), with support for many of IE's proprietary objects, the IE detection schemes above will also return true for Opera. Use "window.opera" in combination to filter out Opera browsers.
It's important to mention that object detection's chief purpose is to help you detect within your script whether the browser supports a particular object/method/property before using it, not browser detection. As the later it may be convenient over probing the Navigator object, but is only as reliable as your understanding of which objects are supported in which browsers. In other words, it's not a 100% reliable way of sniffing out the user's browser. Having said that, the below uses object detection to test for IE7:

Again object detection is really about feature detection. It detects whether your browser supports the feature your script intends to use and manipulate. For the lazy, that will substitute for browser detection just fine!

Task Manager menu /tabs disappear

last one or 2 days when ever i open task manager to kill some process, it just shows up without any menu bar/ tabs

i thought it could be a virus effect or something, but when i searched on net it gave a solution.


SYMPTOMS
loadTOCNode(1, 'symptoms');
When you start Task Manager, the menu bar and tabs may not be visible.

Back to the top
CAUSE
loadTOCNode(1, 'cause');
This behavior can occur if Task Manager is running in Tiny Footprint mode. When you double-click the empty space in the border around the tabs, Task Manager switches to this mode.

Back to the top
RESOLUTION
loadTOCNode(1, 'resolution');
To switch Task Manager to its normal display mode, double-click the top border of the window.

Back to the top
WORKAROUND
loadTOCNode(1, 'workaround');
To work around this behavior, perform the following steps:
1.
Click Start, and then click Run.
2.
Type taskmgr.exe.
3.
Hold down CTRL+ALT+SHIFT at the same time, and while holding them down press ENTER.

Reference :http://support.microsoft.com/kb/193050

Service unavailable


Hi guys,

Service unavailable error in IIS 6 (Windows 2003 server) is really a painful one.

It is occurring because the application pool supporting your asp.net application has just crashed.

One way to get away from this error is to increase the error condition.

Set the health condtions as shown in the image. increase threshold of error count.
I am not sure if this is the right solution, but this worked for me.

Your HTML and javascript source

I found this site to be informative.
http://www.yourhtmlsource.com/

You can learn

check this you can learn site. got lot of tips that might help us

Thursday, January 11, 2007

System internals

http://www.microsoft.com/technet/sysinternals/default.mspx

The Sysinternals web site was created in 1996 by Mark Russinovich and Bryce Cogswell to host their advanced system utilities and technical information. Microsoft acquired Sysinternals in July, 2006.

client application - intermittently receiving an error

A client application may intermittently receive an error message when a client application tries to create a COM+ component
View products that this article applies to.
Article ID : 911359
Last Review : January 20, 2006
Revision : 2.0


SYMPTOMS
When a client application tries to create a Microsoft COM+ component, the client application may intermittently receive an error message. Microsoft C++ applications may receive the following error message:
E_INVALIDARG: "The parameter is incorrect" (0x80070057/-2147024809)
Microsoft Visual Basic 6.0 applications may receive the following error message:
Run-time error '5': "Invalid procedure call or argument" (0x800a0005/-2146828283)
Client applications that are built on the Microsoft .NET Framework may receive the following error message:
System.ArgumentException: "The parameter is incorrect." at System.Runtime.Type.CreateInstanceImpl(Boolean publicOnly) at System.Activator.CreateInstance(Type type, Boolean nonPublic) (with _HResult = 0x80070057/-2147024809)
The COM+ application will typically function without error for some time immediately after the COM+ application is opened. The problem occurs intermittently, but increases in frequency over time until the application eventually fails on every activation request.

Note When the client application is running on a remote computer, the following error message is logged in the system event log on the client computer:
Event Type: Error
Event Source: DCOM
Event Category: None
Event ID: 10006
Description:
DCOM got error "One or more arguments are invalid " from the computer SERVERNAME when attempting to activate the server: GUID

Back to the top

CAUSE
This problem occurs because the "COM initialization count" for a thread is incremented and decremented when the CoInitialize function and the CoUninitialize function are called. When this count reaches zero after you call the CoUninitialize function, COM will be uninitialized on the thread. When a COM+ STA ThreadPool thread is uninitialized, the thread's apartment activator is destroyed. The next activation request that is routed to this thread will fail with the E_INVALIDARG error message. This problem occurs because the thread apartment activator is no longer available. Only activation requests that are routed to the particular uninitialized thread will fail. As more COM+ ThreadPool threads become uninitialized, a larger percentage of requests will fail. When all COM+ ThreadPool threads become uninitialized, all requests will fail. If the process is restarted, the problem will recover for some time. However, the cycle will be repeated.
Back to the top

RESOLUTION
To resolve this problem, remove the CoInitialize calls and the CoUninitialize calls from the affected COM DLL. A COM DLL that exposes COM components and is loaded through COM calls from a client should not call the CoInitialize function or the CoUninitialize function on any thread that is used to load or to start the DLL. These threads are owned by the client application, by the COM runtime, or by the COM+ runtime. Only the COM DLL should call these APIs on additional threads that were explicitly created by the COM DLL. However, it is a common bug for COM DLLs to call the CoInitialize function and the CoUninitialize function in response to attach events and detach events in the DllMain function.

Note It is correct for a standard Win32 DLL that is not loaded through COM to call these APIs if the standard Win32 DLL plans to use COM APIs. However, these functions should not be called from the DllMain function.

For more information about the CoInitialize function, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/0f171cf4-87b9-43a6-97f2-80ed344fe376.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/0f171cf4-87b9-43a6-97f2-80ed344fe376.asp)
For more information about the DllMain function, visit the following MSDN Web site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dllmain.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dllmain.asp)
Note One Microsoft component that contains this bug is the Cdo.dll component. This component is not supported in multithreaded environments. Instead, we recommend that you use the Cdosys.dll component or the Cdonts.dll component. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
247288 (http://support.microsoft.com/kb/247288/) CDO applications are not supported in MTS or COM+