Jquery check radio button selected or Not and default selection code

//code

  <script type="text/javascript">
        $(document).ready(function () {
            if (!$("input[type=radio]:checked").length>0) {
                $("input:radio:first-child").attr('checked', 'checked');
            }
        });
    </script>

Entity framework 3.5 foreign key missing table mapping

 var Budgetlinevalue=Convert.ToInt32(dropdownbudgetline.SelectedValue);

 MstrBudgetLine budgetlineID = db.MstrBudgetLines.Where(x => x.BudgetLinesPkID == Budgetlinevalue).FirstOrDefault();

            Initiative tbl = new Initiative();

  tbl.MstrBudgetLine = budgetlineID;
 db.AddToInitiatives(tbl);
 db.SaveChanges();

Fetch, Insert, Update, Delete Data with “Database First Model Approach” using ADO.NET Entity Framework 3.5

DISPLAY DATA IN THE GRIDVIEW

The following code will help to display the data in the grid view.
 
private void getData()
{
    //Here TestEntities is the class which is given from "Save entity connection setting in web.config"
    TestEntities context = new TestEntities();

    var query = from data in context.Employee
                orderby data.name
                select data;

    //Bind Data to Gridview
    grdEmployeeData.DataSource = query;
    grdEmployeeData.DataBind();
}

Output

Image 8.jpg


INSERT DATA IN THE EMPLOYEE TABLE

Use the following code to add the new employee:
 
private void insertData()
{
    //Here TestEntities is the class which is given from "Save entity connection setting in web.config"
    TestEntities context = new TestEntities();

    // Create a new employee
    Employee objEmployee = new Employee();
    objEmployee.name = "Employee Four";
    objEmployee.address = "Address Four";

    //Add the created Employee object to context.
    context.AddToEmployee(objEmployee);
    context.SaveChanges();
}

Output

Image 9.jpg


UPDATE DATA IN THE DATABASE

You can use the following code to update the employee details:
 
public void updateData()
{
    //Here TestEntities is the class which is given from "Save entity connection setting in web.config"
    TestEntities context = new TestEntities();

    var query = from data in context.Employee
                orderby data.name
                select data;

    foreach (Employee details in query)
    {
        if (details.id == 1)
        {
            //Assign the new values to name whose id is 1
            details.name = "Updated Employee One";
        }
    }

    //Save the changes back to database.
    context.SaveChanges();
}

Output

Image 10.jpg


DELETE THE EMPLOYEE DETAILS FROM DATABASE

You can use the following code to delete the employee details from the database:
 
public void deleteData()
{
    //Here TestEntities is the class which is given from "Save entity connection setting in web.config"
    TestEntities context = new TestEntities();

    var query = (from data in context.Employee
                where data.id == 1
                orderby data.name
                select data).First();

    context.Attach(query);
    //DeleteObject is used to the delete the entity onject.
    context.DeleteObject(query);
    context.SaveChanges();
}
OUTPUT

Image 11.jpg

Improving System Performance without Adding Memory (Windows 8)

Managing startup applications by preventing background applications from loading

A startup application is software that opens when Windows opens. Over time, as you install more and more apps, the number of startup applications increases. Common apps that load and run in the background are security software, Windows Update, instant messaging software, and multimedia apps. You can increase system resources by stopping some of these tasks from loading, or by changing their settings.

Using System Configuration to prevent applications from launching

Perform the following steps to selectively prevent items from starting when Windows launches.
CAUTION: Disable only those items that are known and unwanted. Disabling system-critical items might cause problems.
  1. From the Start screen, type msconfig to open the Search charm, and then select msconfigfrom the search results.
    Figure 5: Searching for msconfig
    The search results for msconfig
    If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
    The System Configuration tool displays.
  2. Click the General tab and make sure Selective startup is selected.
    Figure 6: Selective startup
    Image of System Configuration, General tab with Selective startup selected
  3. Select the Startup tab, and click Open Task Manager .
    Figure 7: Open Task Manager
    Image of System Configuration window with Open Task Manager option
    The Task Manager window opens with Startup tab selected.
  4. Select any startup items that do not contribute to the system and are unwanted, and clickDisable .
    Figure 8: Disable a startup application
    Image of the Task Manager Startup tab showing how to disable a startup application
    If you are unsure about an item, write the name down and research it on the Internet. Do not disable an item if you do not know what the item is. For a list of files that are recommended not to remove, refer to the HP support document Microsoft System Configuration (Windows 8) .
  5. If prompted, click Restart to restart the computer.
  6. If Windows or other software stops working after a checkmark is removed from a task, restart the computer and reverse these procedures to replace the checkmark. If needed, you can start the computer in safe mode. For more information, see the HP support documentWindows 8 Safe Mode .
By completing these steps, Windows runs using Selective startup. This means that Windows prevents the selected applications from starting. If Selective startup is disabled in the future, all the selected applications will start again.

Emptying the Recycle Bin

  1. On the Start screen, click the Desktop tile.
  2. On the Windows desktop, double-click the Recycle Bin  .
  3. To restore any mistakenly deleted items, right-click the file(s), and then select Restore .
  4. Click the Manage tab, and then click Empty Recycle Bin .
    Figure 9: Empty Recycle Bin
    Empty Recycle Bin
  5. Select Yes to confirm.
    Windows removes the contents of the Recycle Bin from the hard drive.

Deleting temporary files and directories

Deleting temporary files and folders increases hard disk space and reduces the time Windows takes to access the hard drive. It also resolves problems with spooling print jobs. Windows uses a Temp folder to temporarily store files intended only for temporary use. Over time, these files can build up and cause problems. To delete these files, use the following set of steps:
  1. Close all open software applications.
  2. From the Start screen, type disk cleanup to open the Search charm, and then select Free up disk space by deleting unnecessary files from the search results.
    Figure 10: Searching for disk cleanup
    The field to search for Free up disk space by deleting unnecessary files, with disk cleanup entered into the search field
  3. Select the drive you want to clean up, and then click OK .
    Figure 11: Select drive
    Drive selection in Disk Cleanup
    A message opens telling you that Disk Cleanup is calculating how much space you can free on the drive you chose.
    Figure 12: Disk Cleanup
     Disk Cleanup calculating the space that can be freed on the disk drive
  4. When the Disk Cleanup window appears, displaying a list of Files to delete, place a check next to the types of files you want the Disk Cleanup tool to delete. Temporary files are safe to delete.
    CAUTION:Selecting some options can have a negative effect. Examples: Selecting Hibernation File Cleaner can prevent the computer from entering hibernation. Selecting Setup Log Files deletes the files that online phone support agents use to help troubleshoot setup problems. If you are unsure about what to delete, do not delete the files until you know if the files are not important for your use of the computer.
    Figure 13: Select types of files to delete in Disk Cleanup
    Image of file type selection in Disk Cleanup
  5. Click OK .
  6. Click Delete Files .

Checking for hard disk drive errors

Perform the following steps to check the integrity of the hard disk drive in Windows 8.
  1. Close all open software applications.
  2. From the Start screen, type file explorer to open the Search charm, and then select File Explorer from the search results.
    Figure 14: Searching for File Explorer
    The search field for File Explorer
  3. Right-click the hard disk drive that you want to check, and then click Properties .
    Figure 15: Hard disk drive properties
    Properties encircled in red under Devices and drives
  4. In the Properties window, click the Tools tab.
  5. Under Error checking, click Check .
    Figure 16: Error checking
    Image of Error checking option in hard disk Tools
    If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
  6. On the Error Checking window, click Scan drive .
    Figure 17: Scanning the drive for errors
    The Error Checking window, with the Scan drive selection encircled in red
    Windows checks the hard disk drive for errors.
    If a window opens stating that Windows can't check the disk while it's in use , click Schedule disk check and follow the on-screen instructions to restart the computer and scan the disk for errors.

Defragmenting the hard disk drive

The Optimize Drives tool takes all the scattered bits of program data and groups them together in more efficient areas of the drive. Use these steps to defragment the hard drive:
  1. Close all open software applications. This includes background apps, such as virus scanners.
  2. From the Start screen, type defragment to open the Search charm, and then selectDefragment and optimize your drives from the search results.
    Figure 18: Defragment and optimize your drives
    Image of Settings Search results for defragment
    NOTE:If Optimize Drives repeatedly starts, a hidden background program is still accessing the hard drive. Restart the computer in safe mode and try again. For more information, see the HP support document Windows 8 Safe Mode
  3. Select the drive to defragment and then click Optimize .
    Figure 19: Optimize Drives
    Optimize Drives menu, with Optimize button selected
    Defragmenting the drive could take a few minutes or a few hours, depending on the amount of data on your hard disk drive. You have the option to click Stop if you need to stop the tool.

Preventing memory allocation problems

Allocated memory space from software applications that are no longer open can cause problems. Over time, this unused memory space can build up, causing Windows to slow down and use the hard drive more. These memory leaks are causing the system to slow down if the computer runs well when first turned on, but performs noticeably slower after several programs are opened and closed.
Memory leaks can happen when software is closed before it has fully opened. Always allow apps time to fully open before closing them. As a rule, wait five seconds after an app opens before closing it again, even if the app was opened unintentionally.
On rare occasions, an incompatible app might continue to allocate memory while it is running, causing the system to slow down and eventually lock up.
To immediately fix memory leaks, restart the computer. For a permanent fix, isolate software applications that might be causing the leaks by using the following steps:
  1. Start with a fresh session of Windows by restarting the computer.
  2. From the Start screen, type task manager to open the Search charm, and then select Task Manager from the search results.
    Figure 20: Task Manager
    The search for Task Manager
    Task Manager opens.
  3. Click More details at the bottom of the Task Manager window.
    Figure 21: Task Manager
    The Task Manager window, with More details encircled in red
  4. Select the Performance tab, and then click Memory to view the amount of available physical memory.
    Figure 22: Performance tab in Task Manager
    Image of Performance tab in Task Manager
  5. Click Open Resource Monitor to view how your computer is using the memory.
    Figure 23: Open Resource Monitor
    Open Resource Monitor
    If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
  6. In the Overview tab, click the arrow to expand the Memory section, and then scroll down to view which apps are using memory.
    Figure 24: Resource Monitor
    Image of Resource Monitor
  7. Open an app suspected of causing the computer to run more slowly.
  8. Check the percentage of Used Physical Memory and write it down.
  9. Close and reopen a suspected app repeatedly and check the percentage of Used Physical Memory, comparing this number to the one recorded. Each time, wait about 10 seconds before opening the app again.
  10. If the percentage of Used Physical Memory continues to increase, a memory leak is occurring. Contact the software manufacturer for available patches or fixes.
  11. If the Used Physical Memory percentage returns to the same numbers or similar each time, the suspected app is probably not creating a memory leak.

Freeing up space on the hard drive

Windows uses unused space (free space) on the hard drive for different types of operations, such as caching and virtual memory. The computer might not run reliably if the free disk space drops below five percent of the total disk space.
CAUTION:You might see a RECOVERY (D:) or FACTORY_IMAGE (D:) hard drive. This hard drive is reserved for system recovery and should not be used for anything else.
To view the amount of free space on the hard drive:
  1. From the Start screen, type file explorer to open the Search charm, and then select File Explorer from the search results.
    Figure 25: Searching for File Explorer
    The search field for File Explorer
  2. Right-click the hard drive (C: is most common), and then click Properties .
  3. View the amount of space available next to Free space.
    Figure 26: Free space
    Image of hard drive properties showing amount of free space available
Use the following steps to remove unwanted software applications and increase hard drive space:
  1. From the Start screen, type programs and features to open the Search charm, and then select Programs and Features from the search results.
    Figure 27: Searching for Programs and Features
    The search field for programs and features
  2. On the Programs and Features window, right-click the app you want to remove, and selectUninstall .
    Figure 28: Uninstall
    Uninstall a program
  3. Read and respond to any messages that might open while the software is being removed from your computer.

Adjusting System Restore settings

System Restore is a feature of Windows that can revert system software and settings back to a particular date. System Restore does this by saving the changes made to system files in a restore point. These restore points use a large amount of hard drive space. System Restore uses up to four percent of the hard drive with restore points if left unadjusted, regardless of the size of the hard drive.
CAUTION:If you are experiencing system problems and may need to restore your computer to an earlier time, DO NOT remove the restore points.
CAUTION:Selecting Turn off system protection will prevent the system from creating future restore points. You cannot restore the hard drive without restore points.
Use the following steps to reduce the space System Restore uses for restore points:
  1. From the Start screen, type file explorer to open the Search charm, and then select File Explorer from the search results.
    Figure 29: Searching for File Explorer
    The search field for File Explorer
  2. Select the Computer tab, and then click Properties .
    Figure 30: Computer Properties
    Image of Computer tab with Properties selected
  3. From the tasks pane on the left, click System protection .
    Figure 31: System protection
    Image of System protection
    If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
    The System Properties window opens with the System Protection tab selected.
  4. Click Configure .
    Figure 32: Configure System Protection Settings
    Image of System Protection tab in System Properties
  5. Reduce the amount of hard drive space the system reserves for system restores by sliding theMax Usage: slider bar to 2%. You can choose a higher or lower percentage depending on how many restore points you want and the capacity of your hard drive.
    Figure 33: Max Usage
    Image of the Max Usage slider in System Protection
  6. Click OK .

Creating a restore point

System Restore automatically creates restore points each week or when system changes are made. You can manually create a restore point to save your current system files.
To create a restore point:
  1. From the Start screen, type file explorer to open the Search charm, and then selectFile Explorer from the search results.
    Figure 34: Searching for File Explorer
    The search field for File Explorer
  2. Select the Computer tab, and then click Properties .
    Figure 35: Computer Properties
    Image of Computer tab with Properties selected
  3. From the tasks pane on the left, click System protection .
    Figure 36: System protection
    Image of System protection
    If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
    The System Properties window opens with the System Protection tab selected.
  4. Click Create .
    Figure 37: Create a restore point
    Create a restore point in System Properties
  5. Type a description for the restore point and click Create .
  6. After the restore point is created, click Close .

Updating software

Software conflicts can cause the system to slow. HP, Microsoft, and other software manufacturers release updates to address these problems. Make sure that you go to HP's software download site and use Windows Update tool regularly.

Turning off nonessential graphical features

Graphical features and applications can use a lot of system resources. Turning off these features can improve system performance. This section explains how to adjust visual effects for best performance.

Adjusting visual effects for best performance

Follow these steps to adjust visual effects, such as menu and window graphics, to optimize performance:
  1. From the Start screen, type file explorer to open the Search charm, and then selectFile Explorer from the search results.
    Figure 38: Searching for File Explorer
    The search field for File Explorer
  2. Select the Computer tab, and then click Properties .
    Figure 39: Computer Properties
    Image of Computer tab with Properties selected
  3. From the tasks pane on the left, click Advanced system settings .
    Figure 40: Advanced system settings
    Image of Advanced system settings
    If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
    The System Properties window opens with the Advanced tab selected.
  4. Under Performance, click Settings .
    Figure 41: Advanced system settings
    Image of System Properties, Advanced tab with Settings selected
    The Performance Options window opens.
  5. Click the Visual Effects tab.
  6. Select Adjust for best performance , and then click OK .
    Figure 42: Adjust for best performance
    Image of Performance Options window with Adjust for best performance selected

Search This Blog

Arsip Blog

Powered by Blogger.

Recent

Comment

Author Info

Like This Theme

Popular Posts

Video Of Day

Sponsor

Most Popular