cannot access a closed file – FileUpload in ASP.NET

Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags , with 14 Comments on cannot access a closed file – FileUpload in ASP.NET

This was very interesting error, i got during development of file upload control in ASP.NET.

On my local system, every thing was just fine. but when i deployed my application on development server, my control was able to upload only small size files.

whenever i tried to upload large size file i got error “cannot access a closed file”

After going through MSDN i found that there is one new element added in ASP.NET 2.0 known as httpRuntime.

So i just added this new Tag in my web.config and every thing was right.

<system.web>
<httpRuntime  maxRequestLength="15360" requestLengthDiskThreshold="15360"/>
</system.web>

Note :

requestLengthDiskThreshold should not exceed the maxRequestLengthattribute.

To read more about this, please visit http://msdn.microsoft.com/en-us/library/e1f13641(VS.80).aspx

XML Parsing Error: no element found

Author posted by Jitendra on Posted on under category Categories ASP.NET, Tech Tips and tagged as Tags , with 3 Comments on XML Parsing Error: no element found

Few Days ago, i found strange error like “XML Parsing Error: no element found“.

I was unable to find the exact root cause. Most of the times it happens if you are missing any closing tag in your ASPZ application. I checked my complete page and reconfirmed but error still persist.

somehow i found that ASP.NET treat the response of page as XML document and that’s why we receive XML Parsing Error: no element found error.

so explicitly i set the response type of my page as text/HTML. Response.ContentType = “text/HTML”.

And this line tells the ASPX that page is HTML, not XML.

WordPress Error: “missing A Temporary Folder.” After Uploading A File

Recently i got the error

“missing A Temporary Folder.” After Uploading A File

After digging lots of sites, i was unable to fix the problem.

Maximum sites offer solution like change php.ini etc. but changing configuration file and using shell command can be avoided by a simple trick.

Go to Plugins Tab in wordpress after Login.

Then click on Install, you will get below Screen.

click on Add New and search FCKEditor, Install It -> Activate.


And thus your problem solved.

you want to use that editor then use or Simply Deactivate but don’t uninstall.


Display author name in wordpress

Author posted by Jitendra on Posted on under category Categories Tech Tips and tagged as Tags , with 1 Comment on Display author name in wordpress

Look in the default theme’s index.php file for the proper template tag:


<code><?php the_author() ?></code>

and a good place to put it.

Display Author’s ‘Public’ Name

Displays the value in the user’s Display name publicly as field.

<p>This post was written by <?php the_author(); ?></p>

Get Author link


<p>Written by:
<?php echo get_the_author_link(); ?></p>

The Author’s Post

<p><?php the_author(); ?> has blogged <?php the_author_posts(); ?></pre>
</div>
<pre>posts</p>

The Author’s Post Link

<p>Other posts by <?php the_author_posts_link(); ?></p>

for more info check below URL
http://codex.wordpress.org/Template_Tags/the_author

Install the OS on CD/DVD/Flash/Pen Drive

Author posted by Jitendra on Posted on under category Categories Tech Tips and tagged as Tags with 3 Comments on Install the OS on CD/DVD/Flash/Pen Drive

Pocket PC..

This article will show you how to install Windows XP on your CD/DVD/USB Pen drive/ Flash Drive/ thumb Drive.

Procedure:-

1) Make sure that your system ( to be booted ) has about 500MB of free disk space!

2) Download the latest PE Builder version (self-installing package) and install it. Follow me to Download.
3) Start PE Builder (pebuilder.exe). When you start PE Builder for the first time it will ask if you agree with the license agreement.

4) Now PE Builder will ask to search for windows installation files. If you don’t have your windows XP setup/installation files on your system you must insert the original Microsoft WIN XP installation/setup CD . Click “yes” to start searching. PE Builder will now search all fixed- and CD-Rom drives for Windows installation files. This will take some time. When more than one valid location is found, a dialog will appear where you can select which location you want to use.

5) For making Bootable CD/DVD :

At the main PE Builder dialog, select the “Burn to CD/DVD” option. When you are using an erasable medium, make sure that the “AutoErase RW” option is enabled. The “burn using” option should be set to “StarBurn”. Select your CD writer device from the Device list.

Click on  “build” button. PE Builder will now ask you to create a BartPE directory, answer with “yes”.

The license for your Microsoft Windows XP product is shown. Read it and agree to it to continue.

PE Builder will now start building BartPE. This will take a few minutes.
You will see a lot of files getting copied and/or decompressed, the ISO image build and the data recorded to your CD/DVD writer.
If the data verify was correct and there where no errors reported you can boot the CD/DVD!

6)For making bootable Pen Drive:

Follow the above instructions and copy the files to the pen drive.

Enjoy your new preinstalled XP environment and use it for system Rescue Purposes…

Install OS From Your Flash/Pen Drive.

Author posted by Jitendra on Posted on under category Categories Tech Tips with Leave a comment on Install OS From Your Flash/Pen Drive.

Simple way to take your Desktop PC into your pocket via USB.

Most PC users have got very much habituated in installing Windows Operating system on their computer using the Windows Installation CD’s, but what if a user does not have a CD-ROM to read them and if he has a option of only using a Pen Drive? Then here is a small tutorial on how to get started and install a complete Operating System using the Pen Drive as Booting Medium and a drive to Store the Setup files.

First of all you need to make sure that you have got a Pen Drive with a total capacity of minimum 256Mb for the storage of the Setup Files though you can opt for the higher capacity drives and you need to make sure that the format of the Disk is correctly set before the installation process. Hence here we are going to use a tool  HP USB Disk Storage Format Tool for Formatting a USB Drive into the right File System which can be downloaded (Open Source Software- HP USB Disk Storage Format Tool – v2.1.8 ). Since most BIOS wont accept any drive and would only accept FAT File System you need to make sure that you have formatted the USB Flash Drive using this tool.

Follow this link To download the USB Format Software

Boot menu may vary.
Modal Boot Page

Next you need to get ready loading the OS files into the Flash Drive, following which you need to setup the Boot Device in the Advanced BIOS Features. The new version MotherBoards would have a option called “˜USB-HDD’ before the Hard Drive option and if you dont find this available you need to update your BIOS. If you find it, you need to change the order of booting and make sure that the USB-HDD is in the first option. Next save the BIOS settings and restart the computer.

There can be other names also listed for these Pen Drives which can be likely Removable Device, Removable Storage Device etc whom you need to select and make sure they are in the first position in the Boot Device Priority Section as that we do during booting xp from CD drive..

Regards–

Nikhil Naoghare.

Windows 7 theme in XP

Author posted by Jitendra on Posted on under category Categories Tech Tips with Leave a comment on Windows 7 theme in XP

First,  download some of the themes you like to your Windows XP or Vista desktop.

dowload windows 7 themes

These files have a unique .themepack extension which is just another zip format containing all of the elements of a theme including the background images, Aero glass colors, sounds, cursors, icons, screen savers, etc.

To use these files on an older version of Windows, you first need to extract them as only Windows 7 can natively understand the themepack format. You can either change the file extension of the Windows 7 theme file from .themepack to .cab and then extract the files with a right-click, or install the free 7 zip  utility as 7-Zip can automatically hand the themepack file format.

windows 7 themepack file Extract themepack with 7-Zip Rename to CAB and extract in Explorer

Once extracted, your theme files will now be in a new folder that has the same name as your original themepack.

Most Windows 7 themes consist of multiple background images and Windows 7 will automatically change your desktop background at periodic intervals using one of the images from the themepack. Windows Vista and XP do not support desktop slideshows, but you can easily bring that feature use the excellent and free John’s Background Switcher program.

To create a desktop slideshow, click the add button and choose “A folder on your computer.” Now select the Windows 7 theme folder that contains all the background images. The program allows lot of tweaking but you can skip that because the default settings are very similar to what you need for simulating Windows 7 behavior on your XP or Vista computer.

Add folder containing Windows 7 wallpapers Choose your Windows 7 Theme Folder

However, John’s Background Switcher by default shows the name of the image in the top right hand corner of the picture.  To remove this, click the “More…” button that has a gear icon on it.  Uncheck the box beside the 3rd entry which says “Show picture info on the top-right corner of the screen.”  Now click Ok, and then click Ok in the main window, and your desktop slideshow is all ready.

ClearType in IE

Author posted by Jitendra on Posted on under category Categories HTML and tagged as Tags , , with Leave a comment on ClearType in IE

Recently, during development i encountered in interesting issue related to internet explorer.

There is one property in IE known as cleartype, which results in different display of font.

you can see in below snap :

clear type font style in IE
clear type font style in IE

The Browse button at left side has shadow effect in font or we can say Cleart type is enable for that control.

the control at right side is normal Button control of HTML. you can see difference very clearly.

Remove ClearType property from IE:

To remove clearType property, we just need below trick in CSS.


<style type="text/css">
body {
filter:none
}
</style>

By using property filter:none we can remove the cleart type behavior of IE.

Text without clear type
Text without clear type

Style File upload control in ASP / HTML

Author posted by Jitendra on Posted on under category Categories HTML and tagged as Tags , , , with 2 Comments on Style File upload control in ASP / HTML

As most of us know that we cannot style the file upload control to much level, still we can give it a stunning effect with the help of CSS.

There is nothing in code to explain.

I took three upload control and one button to give effect.

Lets say upload control is in ASP.net or in HTML.

<asp:FileUpload ID="FileUpload1" CssClass="Cntrl1" runat="server" />
Or
html file upload
<input id="readFile" type="file" runat="server" class="Cntrl1" />

Then create a simple CSS class of name “Cntrl1”.

  <style id="cssStyle" type="text/css" media="all">
       .Cntrl1
      {
       background-color:#abcdef;
       color: Yellow;
       border: 1px solid #AB00CC;
       font: Verdana 10px;
       padding: 1px 4px;
       font-family: Palatino Linotype, Arial, Helvetica, sans-serif;
      }
</style>

Out put in different browsers will look like :

Output in Chrom
Output in Chrom
Output in Mozilla
Output in Mozilla
Output in Internet explorer
Output in Internet explorer

View Demo of FileUpload

Highlight Current field using JQuery

Author posted by Jitendra on Posted on under category Categories HTML and tagged as Tags , , , with 1 Comment on Highlight Current field using JQuery

Write below HTML code :

This will create two text boxes.

<form>
	<div>
		<label for="Name">Name:</label>
		<input name="Name" type="text"></input>
	</div>
	<div>
		<label for="Email">Email:</label>
		<input name="Email" type="text"></input>
	</div>
</form>

Using jQuery, we can watch for an event where an input form comes into focus:

Add link to JQuery file in script tag as shown in below line:

<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" />

Now, add below CSS in document.

div.curFocus {
background: #fdecb2;
}

Then at last write JQuery / javascript code on focus event and blur event (opposite of focus event in javascript ) .

$(document).ready(function(){

$("input").focus(function() {

$(this).parent().addClass("curFocus")

});

$("input").blur(function() {

$(this).parent().removeClass("curFocus")

});

});

We are using the advantage of jquery of adding and removing the CSS class. we cannot left blank to CSS class, as it may remove the existing other class from the tag.

$(document).ready(function(){

This line causes the execution of jquery after complete loading of page.

Output:

Selecting field using jquery
Selecting field using jquery

View Demo