Wednesday 19 October 2011

To Rename the nameSpace(FolderContainer), ProjectFile, solutionFile constructively

Question Received:
       How to Rename the nameSpace(FolderContainer), ProjectFile,
solutionFile undestructively.


To Rename the nameSpace(FolderContainer), 
ProjectFile, solutionFile
   i. Rename the SolutionFile.
   ii.Open the VS SolutionFile in the MSVisualStudio
   iii.Rename the projectFile.
   iv.Build the solution.
   v. Rename the 'cs' Files, if Yo need
   vi.Re-Build the solution
   vii.Finally, Build the Entire solution once.
   viii.For renaming the namespace, unload and remove the project
        from the solution.
   ix. Rename the projectFolder(nameSpace)
   x. GoTo MSVisualStudio, Add-->ExistingProject-->
      BrowseForProjectFile-->'OK'
   xi.Re-Build the Solution.
   xii.Cheers, It's done.

[Note:] Follow the steps in order, and taking the backup of Entire Project is more advisable.

Thursday 13 October 2011

Settings the controls in Windows Form

Questions Received:
        How to set/unset the controls in the Windows Form

Solution:
        To find the required using the accessible name of the controls, use the 'find' method in
Form.Controls.find().
        public static void set(Control form,string ctrlName,string DBName)
        {
            foreach (Control ctrl in form.Controls.Find(ctrlName, true))
            {
                if (ctrl is CheckBox)
                {
                    CheckBox chk = (CheckBox)ctrl;
                    if (chk != null)
                    {
                        chk.Checked = true;
                    }
                }
                if (ctrl is TextBox)
                {
                    TextBox tb = (TextBox)ctrl;
                    if (tb != null)
                    {
                        tb.Text = DBName;
                    }
                }
            }
        }

[Note:] Assume, Form-->this, ctrlName-->AccessibleCtrlName, DBName-->TextFieldEntry
           You can use this function to manage different controls in the Form

Tuesday 11 October 2011

rmdir command for removing directories[Force Mode]

Questions Received:
        I cannot delete a folder which says, "Access is denied" while trying to delete it thru
GUI mode or thru Command Prompt.

Solution:
       Change the permissions for directories by using the commands,
                           * cacls.exe
                           * icacls.exe
Cacls.exe
   [NOTE:] i. Cacls is now deprecated, please use Icacls.
                ii. Wildcards can be used to specify more than one file in a command.
                    You can specify more than one user in a command.

Description:
        Displays or modifies access control lists (ACLs) of files
Syntax:
 CACLS filename [/T] [/M] [/L] [/S[:SDDL]] [/E] [/C] [/G user:perm]
        [/R user [...]] [/P user:perm [...]] [/D user [...]]
    filename      Displays ACLs.
    /T            Changes ACLs of specified files in
                  the current directory and all subdirectories.
    /L            Work on the Symbolic Link itself versus the target
    /M            Changes ACLs of volumes mounted to a directory
    /S            Displays the SDDL string for the DACL.
    /S:SDDL       Replaces the ACLs with those specified in the SDDL string
                  (not valid with /E, /G, /R, /P, or /D).
    /E            Edit ACL instead of replacing it.
    /C            Continue on access denied errors.
    /G user:perm  Grant specified user access rights.
                  Perm can be: R  Read
                               W  Write
                               C  Change (write)
                               F  Full control
    /R user       Revoke specified user's access rights (only valid with /E).
    /P user:perm  Replace specified user's access rights.
                  Perm can be: N  None
                               R  Read
                               W  Write
                               C  Change (write)
                               F  Full control
    /D user       Deny specified user access.

iCacls.exe
 
ICACLS name /save aclfile [/T] [/C] [/L] [/Q]
    stores the DACLs for the files and folders that match the name
    into aclfile for later use with /restore. Note that SACLs,
    owner, or integrity labels are not saved.

ICACLS directory [/substitute SidOld SidNew [...]] /restore aclfile
                 [/C] [/L] [/Q]
    applies the stored DACLs to files in directory.

ICACLS name /setowner user [/T] [/C] [/L] [/Q]
    changes the owner of all matching names. This option does not
    force a change of ownership; use the takeown.exe utility for
    that purpose.

ICACLS name /findsid Sid [/T] [/C] [/L] [/Q]
    finds all matching names that contain an ACL
    explicitly mentioning Sid.

ICACLS name /verify [/T] [/C] [/L] [/Q]
    finds all files whose ACL is not in canonical form or whose
    lengths are inconsistent with ACE counts.

ICACLS name /reset [/T] [/C] [/L] [/Q]
    replaces ACLs with default inherited ACLs for all matching files.

ICACLS name [/grant[:r] Sid:perm[...]]
       [/deny Sid:perm [...]]
       [/remove[:g|:d]] Sid[...]] [/T] [/C] [/L] [/Q]
       [/setintegritylevel Level:policy[...]]

Say,
To delete the victim folder,
       cacls <FilePath> /T /C /E /G User:Perm
Example, cacls "C:\Folder\*.*" /T /C /E /G User:<F|N|RX|W|R>
And, rmdir /s /d "C:\Folder"

rmdir command for removing directories

Questions Received:
       Removing the directories thru GUI takes much downtime.

Solution:
       Remove the directories thru the command prompt in quiet mode.



'rmdir' command
       Removes (deletes) a directory.

       RMDIR [drive:]path
       RD [drive:]path

Windows 2000 and Windows XP Syntax.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
/S    Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree.
/Q    Quiet mode, do not ask if ok to remove a directory tree with /S.

Examples

rmdir c:\test

Remove the test directory, if empty. If you want to delete directories that are full, use the deltree command or if you're using Windows 2000 or later use the below example.

rmdir c:\test /s

Windows 2000, Windows XP and later versions of Windows can use this option with a prompt to permanently delete the test directory and all subdirectories and files. Adding the /q switch would suppress the prompt.

[Note:] Run the command as Administrator, if needed.

Delete the files thru Command Prompt

Questions received:
        Deleting the file thru GUI takes much downtime.

Solution:
       Deleting the files thru the command prompt makes it passive and quiet.


'DEL' Command
       Delete one or more files.

Syntax
      DEL [options] [/A:file_attributes] files_to_delete

Key
   files_to_delete : This may be a filename, a list of files or a Wildcard

options
   /P  Give a Yes/No Prompt before deleting.
   /F  Ignore read-only setting and delete anyway (FORCE)
   /S  Delete from all Subfolders (DELTREE)
   /Q  Quiet mode, do not give a Yes/No Prompt before deleting.

   /A  Select files to delete based on file_attributes

file_attributes:
   R  Read-only    -R  NOT Read-only
   S  System       -S  NOT System
   H  Hidden       -H  NOT Hidden
   A  Archive      -A  NOT Archive

Wildcards: These can be combined with part of a filename

   *  Match any characters
   ?  Match any ONE character

Examples:

To delete HelloWorld.TXT
DEL HelloWorld.TXT

To delete "Hello Big World.TXT"
DEL "Hello Big World.TXT"

To delete all files that start with the letter A
DEL A*

To delete all files that end with the letter A
DEL *A.*

To delete all files with a .DOC extension
DEL *.DOC

To delete all read only files
DEL /a:R *

To delete all files including any that are read only
DEL /F *

[Note:] Run these commands as Administrator, if needed.

Saturday 1 October 2011

Unblock Wupload in India


Unblock Wupload Blocked In India

Hello all users, as you know that many Internet Service Providers in India are agreed to block file sharing sites in order to prevent piracy as much as possible so I thought of sharing this info with you This topic concerns all wupload.com users form India using BSNL or Tata Photon as their Internet Service Provider. As most of you have noticed, Wupload is not opening. But if you run a check with isup.me, you will find that the site is perfectly working.


What's the solution? 
Wupload is working fine. All you need to do is change your PC or Laptop's DNS server to Google's DNS server i.e. 8.8.8.8 and 8.8.4.4. Once done, you'll find that Wupload is working absolutely fine. Huge thanks to awaiz007.
 How to change the DNS? (Source)

1) Open Network Connections. Start menu > My Computer > My Network Places > View Network Connections.

2) Locate the network connection that is associated with your Internet connection. This may be labeled something like Local Area Connection or Wireless Network Connection. If you have more than one connection to choose from, be sure you determine the right one before proceeding.

 3) Right click on the appropriate connection and select Properties.

 4) In the list that appears under the General tab, double click on Internet Protocol (TCP/IP).

 5) In the window that appears, you want to select the option to Use the following DNS server addresses.

 6) Enter 8.8.8.8 in Preferred DNS Server.

 7) Enter 8.8.4.4 in Alternate DNS Server.

 8) Press OK out of all windows until you are back to the Network Connections window.

    Now open your preferred web browser to find out that Wupload is working!

Reset Form Fields to default NULL Values

Question Received:
         How to reset form fields and controls thru programming?

Solution: 
         To reset the form controls and fields with NULL (or) Empty String,
          Call function ResetFields(this) from any function,
              public static void ResetFields(Control form)
             {
                   foreach (Control ctrl in form.Controls)
                  {
                       if (ctrl.Controls.Count > 0)
                       ResetFields(ctrl);
                       Reset(ctrl);
                  }
             }
             public static void Reset(Control ctrl)
            {
                  if (ctrl is TextBox)
                  {
                       TextBox tb = (TextBox)ctrl;
                       if (tb != null)
                      {
                           tb.ResetText();
                      }
                  }
                  else if (ctrl is ComboBox)
                  {
                       ComboBox cb = (ComboBox)ctrl;
                       if (cb != null)
                      {
                           cb.ResetText();
                      }
                  }
                  else if (ctrl is CheckBox)
                  {
                       CheckBox chk = (CheckBox)ctrl;
                       if (chk != null)
                       {
                           chk.Checked = false;
                       }
                  }
                  else if (ctrl is RadioButton)
                  {
                       RadioButton rb = (RadioButton)ctrl;
                       if (rb != null)
                       {
                           rb.Enabled = true;
                       }
                  }
             }