Rss Feed
Tweeter button
Facebook button
Linkedin button
2009
02.26

Last week i visited one of my friend and he was sitting on his computer and removing Thumbs.db file. He told me that this is one virus in his computer and this file comes back after deleting everytime. Initially i laughed but as he is not a computer guy and sit very less on computer i told him details about Thumbs.db file.

Than i thought that this problem is not only 1-2 guy but for lots of people around the globe. so i decided to write down this article.

The default behavior for many folders in Windows XP is to display thumbnail images of the files in the folder. Thumbs.db is Microsoft’s operating system way of caching thumbnail images of any image or movie file in a folder. The idea behind creating a thumbnail cache is to improve the speed of displaying thumbnails the next time you open the folder by caching a set of thumbnails for the image and video files in the folder.

Deleting the Thumbs.db file simply deletes that cache, which is regenerated the next time you view the folder contents. It is possible to configure Windows to never cache thumbnails.

If you hadn’t seen this file in your folders previously it’s likely you didn’t have Show hidden files and folders enabled. In Windows Explorer, click on Tools, and then Folder Options. Now click on the View tab, an scroll down to Hidden Files and Folders:

open Tools > Folder Options in Windows Explorer and click on the View tab.

Please make sure to set Show hidden files and folders, as well as Hide extensions for known file types and Hide protected operating system files. Now you will be able to see Thumbs.db file. Now to turn off caching of file you have to again go to  Tools > Options in Windows Explorer and click on the View tab. Check the box next to Do not cache thumbnails and click OK.

Now from now on you will be not able to chache Thumbs.db file.

2009
02.19

Sometimes due to some virus attack or changes in windows registry make folder option not available to a user in Windows. There are 2 ways to solve this.

1. You can enable Folder Options by simply editing the Windows Registry!

  • Click on Start and Run and type regedit in RUN dialog box and click on OK.
  • Go to the following key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\E xplorer – On the right pane check for a DWORD value named NoFolderOptions. If it is there, change the value to zero or delete it. Now go to Tools -> Folder Option and you are done. The Folder Option is there.

If you are unable to access the registry editor, then it may so happen that due to security purpose, it has been disabled on your computer.

2. You can enable it again by following any of following methods

  • Click on Start and Run and Type gpedit.msc in Run dialog box and goto: User Configuration -> Administrative Templates -> System.
  • In right-side pane, set “Prevent access to Registry editing tools” to either Not Configured or Disabled by right clicking on it.
2009
02.07

Few days back one of our client ask us for Theme changer of web site managed by user only (without page refresh). His idea was like user who is surfing web site can select particular theme for web site in which basic structure of web site remain same but font style, background images, spacer, etc. items which are related to CSS get changed.

if i remember well than www.yahoo.com also have same functionality. They also allow you to switch your layout in narrow and wide area also. so i started to get idea from google and come across one site. This link shows me how can i do this. After reading his tutorial i started developing my code and doing some research work and other stuff i got my code working. Although code in above link is also working but i have slightly made changes in generation and management of cookie with javascript. This code at least works in IE, Firefox and Opera.

ok so lets get started.

We have seen lots of web site in which we found theme changer. just by clicking on particular theme image or icon our theme changes automatically and it is saved in our profile. This is one good theme support of web site. This help users to keep remind your web site with some functionality.

Before starting this tutorial i am assuming that you have good idea regarding CSS and Javascript. Also your HTML must be developed using CSS wherever images and fonts are used with different colors.

You can DOWNLOAD source Code From here.

First we set our basic steps.

  • We have 2 different themes to be install on web site. so we need 2 different cascading style sheet (CSS). For conviency we make two different folder named as style1 and style2. Here Folder will have images folder and say [folder name].css file in it [style1.css for style1 folder and style2.css for style2folder]
  • Our HTML is made properly with CSS. I recommend you to check your html pages with both CSS. Once you are done with that we can move ahead.

Let’s assume that we have the following style sheets defined in our HEAD section

<link href=”http://www.domain.com/css/style/style1.css” rel=”stylesheet” type=”text/css” title=”style1″/>

<link href=”http://www.domain.com/css/style1/style2.css” rel=”alternate stylesheet” type=”text/css” title=”style2″/>

<meta http-equiv=”Default-Style” content=”style1″>

Above code is pretty self explanatory. We are including both CSS to HTML page. Now rel=”alternate stylesheet” means it is and alternative of style1.
Also meta of Default-Style is set as style1. so default will be style1.css when nothing has been selected.

Now you will need to provide some way for your visitors to select the theme they want. There are many ways to do this, by use of radio buttons, drop down selection boxes, normal submit buttons, text links, etc. We will use text links here as it is best usability options.

so we place code like this

<form>Change Theme :<a href=”#” onclick=”switch_style(’style1′);return false;” name=”theme” value=”Old Theme” id=”style1″>Style 1</a> <a href=”#” onclick=”switch_style(’style2′);return false;” name=”theme” value=”New Theme” id=”style2″>Style 2</a></form>

When user clicks any of the buttons, the JavaScript onclick function, switch_style(), will run. The function will be passed either ’style1′ or ’style2′ as its parameters.

Now we create one file theme.js and we use following code in it

var style_cookie_name = “style1″ ;

var style_cookie_duration = 30*30*7 ;

function switch_style ( css_title )

{

var i, link_tag ;

for (i = 0, link_tag = document.getElementsByTagName(”link”) ; i < link_tag.length ; i++ )

{

if ((link_tag[i].rel.indexOf( “stylesheet” ) != -1) && link_tag[i].title)

{

link_tag[i].disabled = true ;

if (link_tag[i].title == css_title)

{

link_tag[i].disabled = false ;

}

}

set_cookie( style_cookie_name, css_title, style_cookie_duration );

}

}

function set_style_from_cookie()

{

var css_title = get_cookie( style_cookie_name );

if (css_title.length) {

switch_style( css_title );

}

}

function set_cookie ( name, value, days, domain )

{

var path = domain ?(”; domain=” + domain) : ” ;

var expires, date;

if (typeof days == “number”)

{

date = new Date();

date.setTime( date.getTime() + (days*24*60*60*1000) );

expires = date.toGMTString();

}

document.cookie = name + “=” + escape(value) +

((expires) ? “; expires=” + expires : “”) +

((path) ? “; path=” + path : “”) +

((domain) ? “; domain=” + domain : “”);

}

function get_cookie ( cookie_name )

{

var nameq = cookie_name + “=”;

var c_ar = document.cookie.split(’;');

for (var i=0; i<c_ar.length; i++)

{

var c = c_ar[i];

while (c.charAt(0)==’ ‘) c = c.substring(1,c.length);

if (c.indexOf(nameq) == 0) return decodeURIComponent(unescape(c.substring(nameq.length,c.length)));

}

return ”;

}

Note that this script includes the set_cookie() and get_cookie() functions by which user can set Cookies of particular browser through javascript. The switch_style() function iterates through all your link tags looking for a style sheet with the same title as the text specified in its argument. If it matches, it sets a special property, called disabled, to false, thus enabling that style sheet. In the meantime, all other relevant style sheets are disabled.

Make sure that the visitors’ style sheet settings remain when they visit other pages of your site, as well as when they reload the page, you will also need to recall one function which checks from cookie that which style is active for current user.

For this you can use following code in head tag

<script type=”text/javascript”>

set_style_from_cookie();

</script>

Due to this when the browser to run the set_style_from_cookie() function when the page is loaded or loading, this function checks for the style-setting cookie, and if present, switches the style sheets accordingly. Otherwise, it does nothing.