About Author
|
 |
Chintankumar Patel
09 Jun, 2008
|
 |
Contact Me
|
Working as a Technical Consultant for Conchango.
Having experience in to IT from 7+ years and working on Microsoft Technologies
|
Tags
|
|
.Net , .Net Framework 2.0 , .Net Graphics , Asp.Net , Boot , C# , Class Library , Coding Standards , Convert File System , Database , DATEDIFF , DATEDIFF Function , Disk Management , Embedded Resources , EnableEventValidation , EnableViewState , EncoderParameter , FAT32 to NTFS , Form Authentication , HDD , High Quality Thumbnail , Intellisense , Linux , Microsoft Access , Microsoft's SQL , Partition , ReadyBoost , ReSharper , Resize Image , Resize Partition , Security , SQLDataReader , SuperFetch , System Restore , USB , Usb device not recognized , Vista , Visual Studio 2005 , What's New , Windows , Windows Application , Windows Errors , Windows Vista , Windows XP , YouTube
|
|
Tag : windows (7 posts)
|
Adding/Using Embedded Resources in .Net Windows Application/Class Library (C#/VB.Net/ASP.Net)
|
Wed, 11 Jun, 2008
|
|
|
In .Net when you don’t want to relay for a file on physical location, then it is very good option to take an advantage of Embedded resources.
Using embedded resources you can add any file type in the assembly/DLL/EXE when they get compiled. And whenever you want to use it, load it from the assembly, the files get stored in the metadata of Assembly.
Here is an example of how to use Embedded Resources.
1. Open Microsoft Visual Studio and create new project for C# Windows Application, here I have created Windows Application named “EmbeddedTest”, even you can use “Class Library” 2. To add a file in the project Right click on the project name in Solution Explorer, select “Add” >> “Existing Item…”
3. Now we have added a file to the project, so it doesn’t mean that it will automatically embedded in the Assembly, for that we need to change the files “Build Action” property to “Embedded Resource”, and compiler will include this file in metatdata. Here I have added Image file(dog.jpg), you can add one or more any kind of files
4. Now use the following code in Form1_Load method to list all the Embedded Resources available in the Assembly
private void Form1_Load(object sender, EventArgs e){Assembly a = Assembly.GetExecutingAssembly(); string[] resources = a.GetManifestResourceNames(); foreach (string resourceName in resources){listBox1.Items.Add(resourceName);}}
5. The following code is used to get the resource from the Manifest of the Assembly when user clicks on the listBox1
private void listBox1_SelectedIndexChanged(object sender, EventArgs e){if (listBox1.SelectedIndex == -1)return; string selectedResourceName = listBox1.SelectedItem.ToString(); Assembly a = Assembly.GetExecutingAssembly(); Stream stream = a.GetManifestResourceStream(selectedResourceName); if (stream != null){pictureBox1.Image = null;try{Bitmap bmp = Bitmap.FromStream(stream) as Bitmap; pictureBox1.Image = bmp;}catch (Exception ex){MessageBox.Show("Selected item is not Image");} }}
In Step 5 the we first got the Stream by using GetManifestResourceStream() and then after we load it in to Bitmap object, if in between error occurs when the Resource is not type of Bitmap an Exception is thrown and error message is displayed.
Download Full Source Code
Download Project EmbeddedTest.zip (349.79 KB)
Download Project With Example of using Class Library (866.59 KB)

|
Adding/Using Embedded Resources in .Net Windows Application/Class Library (C#/VB.Net/ASP.Net)
|
Usb device not recognized - One of the USB devices attached to this computer has malfunctioned : Windows XP Error
|
Fri, 25 Jul, 2008
|
|
|
The Problem
While reconnecting the USB device you may face the following error The contents of the error message in the little message balloon says
"Usb device not recognized" "One of the USB devices attached to this computer has malfunctioned, and Windows does not recognize it. For assistance in solving this problem, click this message."
If you try clicking the message but the troubleshooting assistance is of no help
I tried it on several Windows 2000 machines and two other Windows XP machines and it worked on all of them, so I concluded that it had something to do with computer rather than my hopes that it was just a faulty flash drive that I could exchange to solve the problem.
I did some research online and learned that sometimes the USB ports located on the front of the case don’t have enough power for some USB devices. Sure enough, when I tried copying the exact same directory with the flash drive plugged into one of the USB ports in the back, it worked several times in a row.
The Solution
Here is the solution that worked for me...
1) Remove all oem*.inf files
1. Click start and click run then under the run line type in the command "cmd" (without the quotation marks)
2. In the command line, type in the following (without the quotes) and press enter after each command:
"cd \windows\inf"
"ren infcache.1 *.old"
"ren oem*.inf *.old"
"del C:\windows\setupapi.log"
2) Removing all entries under HKEY_LOCAL_MACHINE/Enum/USB that start with "VID"
Removing the VID entries from the registry will cause them to be redetected at restart. CAUTION: If you have a USB keyboard or mouse, do not remove the VID entry for these devices, otherwise, Windows may not restart correctly.
1. Click Start and click Run. Type regedit and click OK. The Registry Editor window will open. 2. Go to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Enum\USB. 3. Highlight and delete all the VID_…. entries. Permissions may be set allowing the deletion of the VID_ entries by following the steps below: a)Right-click the key to be deleted, and then click Permissions. The VID_… Permissions window will open. b)With Everyone highlighted in the Group or User name section, select Full Control in the Permissions section. c)Click Apply, and then click OK. 4. Turn off the computer.
3) Reconnect the USB device to the computer system:
1. With the computer system turned off, reconnect the USB hub to the the USB port.
2. Restart the computer.
3. A New Hardware Detected window should open and reload the drivers.
|
Usb device not recognized - One of the USB devices attached to this computer has malfunctioned : Windows XP Error
|
How to Convert FAT/FAT32 to NTFS file system
|
Wed, 03 Sep, 2008
|
|
|
DISCLAIMER: This process is a one-way process and all steps must be taken to ensure that data is backed up before attempting. The author is in no way responsible for loss of data, damage to disk, data and the computer as a whole.
Before you begin, please make sure that you know the following terms :
- FAT : File Allocation Table is a computer file system architecture developed by Bill Gates and Marc McDonald in the late 1960s and 1970s. It is the main file system in use for MS-DOS and the earlier versions of Windows up to but not inclusive of Windows NT.
- NTFS : New Technology File System is a relatively newer file system which is used by Windows NT, server 2003/2008, XP, and Vista. It is more powerful than the FAT system and employs newer security features and enhancements.
Now onto the process itself :
- Backup all important files, folders to an external hard drive or DVD.
- The conversion process must be initiated in the command prompt so :
- Click Start -> Programs -> Accessories -> Command Prompt.
OR
- Click Start -> Run -> Type cmd in the box -> Press enter.
- By now the command prompt should have opened up. In case you didn't know, the command prompt is the black screen with white text.
- Now type vol followed by the name of the drive you wish to convert
- Example : For D drive type vol d:
- A name and a serial number will be displayed on the screen. Note down the name as you will need it later.
- Now type convert (drive letter) /fs:ntfs.
- Example : To convert D drive to ntfs type convert d: /f:ntfs
- In the case that your operating system is on the drive you want to convert, the program will ask whether you would like to schedule the conversion for when the system is restarting. If you would like to do so, Click Yes.
- Next, the system will prompt you for the label name of the drive you wish to convert. It will appear as follows :
The type of file system is FAT.
Enter the current volume label for drive d: (or whichever drive you chose)
- Enter the volume name you noted down earlier and press ENTER.
- Once the conversion process is complete you can quit command prompt by typing exit and pressing enter.
- Congrats on your new improved NTFS drive!!
|
How to Convert FAT/FAT32 to NTFS file system
|
Booting from USB Pen/Key/Flash Drive (Windows/Linux)
|
Sun, 07 Sep, 2008
|
|
|
Booting a computer from your USB flash drive may seem like a daunting task, but it is actually quite easy. With the right equipment and some basic knowledge, this very useful technique can be taken advantage of in all sorts of different circumstances.
The first thing you will need to do this is a compatible USB flash drive. Most drives are bootable but some are not, so it pays to ask before making a purchase or to do a bit of research online before picking your drive. This is not something the average salesperson will know nor do most companies make it clear on the packaging, so the internet is your best source here. Try to find a drive which has been used successfully in the past, like Corsair's Flash Voyager. The size of the drive is going to be an issue depending on your requirements. If you need to place an entire operating system on the drive, for example, you may need something a bit larger than what you have lying around.
The next step is to make sure that the motherboard which you are working with supports USB booting. To do this simply enter the BIOS (this can usually be done by press the Delete key while the computer is posting) and go into the menu selection titled something like, "Advanced Features". This process is a bit different for every BIOS so you may have to search a bit. Once here look for the boot devices, which will be placed in order: 1st, 2nd, 3rd, and so on. Normally the computer will attempt to boot from the CD-ROM or a specific hard drive first, but you want to change this to the USB drive. The proper selection to do this varies depending on your BIOS version but it be USB RMD-FDD, USB ZIP, USD HDD, USB CD-ROM, or something close to these. Once these is chosen as the 1st boot device you can move your hard drive and/or optical drive down the line (so they will be used if a USB device is not present) or remove everything (so that the computer will only boot from USB). A little trial and error may be needed here to make sure you have chosen the right boot device.
With the BIOS properly configured all that is left to be done is to save the settings and exit. A quick restart and you will be ready to boot from USB. Of course, this is supposing that your USB flash drive already contains the appropriate data.
This part is either very easy or a bit tricky depending on what you need to do. To properly format the USB flash drive you can either use a utility program or use a specialized tool within the software with which you will be booting. Many USB drives will include some sort of software utility which will allow you to format the drive and make it bootable. If your drive did not your drive did include any software HP has a program available which is quite popular. You can find it here. When formatting make sure to use the FAT file system.
If you looking into booting Linux from a USB flash drive there are a few different options, but I have had the highest success rate with Syslinux. This is a lighweight Linux bootloader mainly used for floppy media. This can be useful for distributions of Linux which are tough to get to boot from USB, but some do not need this. Puppy Linux is extremely easy to get to boot from USB and it actually has a built in tool for formatting a USB drive to do this. Other Linux distributions, like Feather Linux and even Fedora Core 3, have been known to work as well.
The quickest way to install Puppy Linux onto a USB drive is to first use it as a Live CD. With is running as a Live CD all you have to do is:
Setup > Install onto a USB stick > (Answer the questions)
After this is over your USB flash drive will be ready to boot Linux onto practically any system. Puppy Linux is the easiest, but the a similar process can be applied to many other distributions.
Booting from your USB stick is quite simple once you know the basics. When you want to start your computer in DOS mode at the A: prompt, boot into Linux, or something more complex, it just takes a little bit of hardware, a few programs, and some patience.
|
Booting from USB Pen/Key/Flash Drive (Windows/Linux)
|
How to resize a partition in Windows Vista?
|
Wed, 15 Oct, 2008
|
|
|
Because programs such as Partition Magic don’t work on Windows Vista, some of you may be wondering how to resize partitions without losing any data. The good news is that you probably won’t be needing those programs because Windows Vista can manage your partition resizing.
To resize a partition with Windows Vista, follow these steps:
Be sure to back up any valuable information, because there is a slight chance that data can be lost when dealing with partitions.
1) Click on the Start menu
2) Right click on Computer and click on Manage

3) You may get a User Account Control dialog here; just click Continue
4) In the left pane, open up the Storage category and click on Disk Management

5) Here, you will find your partitions for your disks. Right click on the partition you’d like to modify.

6) Click on Extend Volume or Shrink Volume to extend or shrink the selected partition.
Note : Do it on your own risk
|
How to resize a partition in Windows Vista?
|
How to work with partitions in Windows Vista / XP when Disk Management doesn’t work
|
Wed, 15 Oct, 2008
|
|
|
Windows Vista’s Disk Management tool can be quite deceiving. It allows you to work with partitions at ease in a presentable GUI format - but with problems. There have been a lot of complaints and confusion as to why Windows Vista grays out the extend volume and shrink volume properties. In response to this, I have found an alternative way to work with partitions, allowing you to easily resize, delete, and create partitions.
Diskpart.exe does a very good job at working with partitions. Unlike Disk Management, Diskpart actually works!
Before continuing, make sure that you:
- Backed up all important files
- Do not run diskpart.exe with Dynamic Disks
1) First, you’ll want to pull out your Start Menu and type diskpart.exe (Windows XP users might have to download diskpart.exe )
This will open a command-prompt like window. At this window, type list disk. This will list all your available hard disks.

2) Proceed by typing select disk <disk number> to select the disk you want to work with.
Creating a Partition or Volume: (skip) At this point in time, you can create a partition. Type create and a set of new options will be presented to you. To proceed, just type create <new option>. (e.g. create volume)
What kind of partition should I create?
Primary: Primary partitions are limited to four per hard disk. If you are planning to install an operating system into a partition, you’ll want to choose primary since it is the only one that can be made bootable.
Extended: If you are planning to have more than four partitions, you’ll want to work with extended. An extended partition counts towards the limit of four, but you are then allowed to create logical volumes within these extended partitions. You’ll want to use extended partitions for backup or storage purposes only since they are not bootable.
3) Now we want to see which number is associated with the volume we want to work with. To obtain this list, type list volume

4) Select the desired volume by typing: select volume <number> or select partition <number>
You then have a list of options to choose from. Below is a list of commands you can type in depending on what you want to do with your selected volume. If you don’t input a number for size, the program will automatically use all the space available for your operation. For the purpose of this tutorial, I have decided to work with 10GB. (1000MB = 1GB)
- Shrink desired=10000 minimum=2000 (Shrinks the volume by 10GB. If that’s not possible, this command makes sure that you at least shrink the volume by 2GB.)
Disk Management can be quite a nuisance since it decides to gray out certain properties on any given day. Please spread the word about diskpart.exe if you know someone who has had trouble working with partitions; as I am sure there are lots who are having similar problems.
Note : Do it on your own risk
|
How to work with partitions in Windows Vista / XP when Disk Management doesn’t work
|
Disable System Restore in Windows Vista
|
Thu, 04 Dec, 2008
|
|
|
The Windows Vista System Restore feature will make sure that software installations, drivers, and other updates can be rolled back. The only price to this feature is some disk usage. If you want to disable System restore, which is a bad idea, it's really pretty simple.
Just to make sure you understand… Windows Vista has just been released. There are bugs. Things will crash. Disabling System Restore will keep you from rolling back changes.
So, you've read this far. Now let's disable it. Type system into the start menu search box, and pick the 4th item down, just labeled "System". (You could also right-click the computer icon and choose properties)

Now click the System protection link:

You'll see the checkboxes next to your different disks:

Once you uncheck the drive, click the "Turn System Restore Off" button.

Now you've got system restore disabled. Living on the edge, eh?
|
Disable System Restore in Windows Vista
|
|
|