Monday, September 13, 2010

Build a Script-Only ASP.NET 2.0 Data Editing Page

Webmasters and developers who work with a shared hosting service for their sites know that while they usually provide access to your database via EnterpriseManager or Sql Server Management studio, often times it is useful to have your own separate data access page that allows you to access your database for minor work or checking things, and to be able to do this even from behind a firewall.

While there are some pretty good solutions for this (e.g., the free "Web Data Administrator" reference app), all you really need is a simple page that you can drop into your /admin protected web folder and access from anywhere, without having to rebuild your app and redeploy it.

The page I've put together here requires no building; it is a script-only page with no codebehind file, and a minimal amount of script as well, thanks to the GridView control and the SqlDataSource control for ASP.NET 2.0.

Here's the code - all of it!

     "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/1999/xhtml" > "server">            
"form1" runat="server">
"width: 657px">
"width: 160px"> SELECT COMMAND "TextBox1" runat="server" Width="469px" EnableViewState=true>"width: 3px">
"width: 160px"> UPDATE COMMAND "TextBox2" runat="server" Width="466px" EnableViewState=true>"width: 3px">
"width: 160px"> DELETE COMMAND "TextBox3" runat="server" Width="465px" EnableViewState=true>"width: 3px">
"width: 160px"> GO "Button1" runat="server" Text="Populate Grid" Width="110px" OnClick="Button1_Click" />"width: 3px">
"height: 41px"> Free form SQL:"height: 41px"> "TextBox4" runat="server" Width="469px" Height="144px" TextMode="MultiLine">"width: 3px; height: 41px;"> "Button2" runat="server" Text="Execute" OnClick="Button2_Click" />
"GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" CellPadding="4" ForeColor="#333333" GridLines="None" Width="666px" DataSourceID="SqlDataSource1" EnableSortingAndPagingCallbacks="false" PageSize="5" OnPageIndexChanged="GridView1_PageIndexChanged" OnRowEditing="GridView1_RowEditing" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowUpdating="GridView1_RowUpdating" OnRowDeleting="GridView1_RowDeleting" > "#990000" Font-Bold="True" ForeColor="White" /> "#FFFBD6" ForeColor="#333333" /> "#FFCC66" Font-Bold="True" ForeColor="Navy" /> "#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /> "#990000" Font-Bold="True" ForeColor="White" /> "White" /> "SqlDataSource1" Runat="server" SelectCommand="" UpdateCommand="" DeleteCommand ="" ConnectionString="" />
What the above will give you is a page where you enter in the SELECT, UPDATE AND DELETE command statements, and the Gridview and SqlDataSource take care of the rest - including edit, update, cancel, and paging! Here's an example:



I have also added an additional multiline textbox and button for "Free form SQL". If it is a select, you will get it in the GridView, and if its an update, insert or delete, you'll see the rows affected in the label. In sum, pretty much everything you need for basic database work.

You can download the zip file containing the single db.aspx page here. All you need to do is have the correct connection string in your application's web.config connectionStrings section; there is a sample inside comment markers in the code for the page.

Writing simple ANT build script

This article explains how to write a very basic ANT build script. This does not explain indepth knowledge on building your project using ANT script. But, this writeup will be more useful for the beginners who haben't writen any ANTscript before. Before start writing the script, lets look into how to install the ANT in your machine.

Install Apache Ant

Download the Apache Ant from the link : Download Apache Ant

  • Unzip the files into your machine.
  • Set your system path variable to ANT's bin directory. For example d:/projects/ant/bin"
  • Set the ANT_HOME in your system variables. ANT_HOME should point to your Ant installation directory. For example "d:/projects/ant".
  • Set JAVA_HOME in your system environment variables.
  • Copy tools.jar file into the "JRE/lib" folder.
To test the setup open your command prompt and type as "ant". You will see a message saying
 Buildfile: build.xml does not exist! Build failed 
Set up is done. Let's look into our first simple example program using ANT script.

This example program shows how to create the JAR file after building all the java files.

  
In the above code "sampleProject" is the project name for this prticular build. We are setting base directory as the current directory by just giving .(dot). We are telling the script to start from "jar" target name. The default attribute is used for setting the starting point for the ANTscript.

We call a seperate task as target. We can define as many number of targets inside a build file. If we closely look into the build file, we have many number of targets based its operations. So, ourbuild starts with "jar" target.

Target has depends attribute to indicate, that particular task can be executed only after the certain number of dependencies. In our case, before building the jar file, we have to compile the files. So, jar target calls compile target. That has some dependencies that is executed. Once thebuild is successful, test.jar will be created in the same directory.

build.xml

 































Fix User Account Control-Gadget Conflict

UAC may be decent enough in warning and protecting you of intrusions, but it can also get in the way. One bug in the beta actually turns off your desktop Gadgets if you disable UAC. Here's how you re-enable it.

1. Open the Registry Editor, or regedit.exe. You can search for regedit in the Start Menu.
2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Sidebar\Settings
3. Right-click and create a new DWORD (32-Bit) Value called AllowElevatedProcess.
4. Right-click AllowElevatedProcess and click Modify. Set the value to 1. Close the registry editor. Your gadgets should work with UAC off now

Use Windows 7 Problem Steps Recorder to document your problems

This doesn't work 100%, but if you type "Program Compatibility" into the search bar in the Start menu, you'll find a compatibility wizard that helps make older apps work with Windows 7. (Sometimes, you can get to it by right-clicking an application that is having trouble launching.) Once you find your app—which may take a little bit of disk browsing if it's not displaying under the list—you'll choose one of potential issues and which version of Windows it previously worked for. In at least one case, we found that running through this made a non-starting app start up under Win 7, so it's good to know about.

Make Older Programs Work With Windows 7

This doesn't work 100%, but if you type "Program Compatibility" into the search bar in the Start menu, you'll find a compatibility wizard that helps make older apps work with Windows 7. (Sometimes, you can get to it by right-clicking an application that is having trouble launching.) Once you find your app—which may take a little bit of disk browsing if it's not displaying under the list—you'll choose one of potential issues and which version of Windows it previously worked for. In at least one case, we found that running through this made a non-starting app start up under Win 7, so it's good to know about.

Use Windows 7's Troubleshooting Tool

There's actually a tool, in Control Panel, called Troubleshooting. Open it up and you'll see various options like configuring devices, connecting to a network and checking to make sure your sound card works correctly. We won't go through each individual options here, but it's a very good place to start when you've hit a problem, before you turn to Googling.

Use Windows 7's Troubleshooting Tool

There's actually a tool, in Control Panel, called Troubleshooting. Open it up and you'll see various options like configuring devices, connecting to a network and checking to make sure your sound card works correctly. We won't go through each individual options here, but it's a very good place to start when you've hit a problem, before you turn to Googling.

Fix the Installer Bug

If you've been running Windows 7 for a few days and found that you're suddenly unable to install programs, here's how to fix it. It's an MSI installer issue, and all you have to do is open up a command prompt in Administrator mode and type:
reg delete HKLM\SOFTWARE\Microsoft\SQMClient\Windows\DisabledSessions /va /f and press enter.

What are the interesting new features in Windows 7?

Windows 7 has several improvements to improve the “fundamentals”—performance, reliability, security and compatibility—along with improvements to make it quicker and easier to access information on your computer:

Enhancements to the Aero User Interface (UI) helps you organize your open windows and other desktop components for easier and faster access

An enhanced start menu and taskbar puts commonly-used resources within easy reach

Performance improvements made in Windows Vista SP1 continue with Windows 7, including faster boot times and resume from standby

Battery life is extended through improved power management architecture and settings

Search Federation in Windows 7 provides results from multiple computers, servers, and Web sites, and delivers these results ranked by relevance

In addition, Windows 7 helps you better manage and secure your computer infrastructure:

Extend data encryption to removable media. News reports are rife with stories about companies losing control over sensitive information. In some industries, this is an issue with grave legal implications, while in other situations the issue is inconvenience. Regardless, smart compliance policy dictates that sensitive information be safeguarded in the event of a lost or stolen laptop. Further, preventing sensitive information from being removed from corporate resources is a pillar of effective compliance management. Windows 7 includes BitLocker™ technology, first implemented in Windows Vista, which now provides full encryption of all boot volumes on a computer, along with introducing BItlocker To Go that offers data protection on portable storage, such as USB flash drives. In addition, BitLocker Drive Encryption and BitLocker To Go can be managed via Group Policy, placing more control over sensitive information in the hands of the professionals.

Automate routine tasks with powerful scripting. To help IT administrators better maintain a consistent environment and improve personal productivity, Windows 7 includes an updated graphical scripting editor, Windows PowerShell™ 2.0—a powerful, complete scripting language that supports branching, looping, functions, debugging, exception handling, and internationalization.

PowerShell 2.0 has an intuitive, graphical user interface that helps make script generation easier, especially for administrators who are not comfortable in command-line environments.

PowerShell 2.0 supports two types of remoting—fan-out, which delivers management scripts on a one-to-many basis, and one-to-one interactive remoting to support troubleshooting of a specific machine. You can also use the PowerShell Restricted Shell to limit commands and command parameters to system administrators, and to restrict scripts to those who have been granted rights.

PowerShell 2.0, with the Group Policy Management Console (available as a separate download), allows IT professionals to use scripting to manage Group Policy Objects and to create or edit registry-based group policy settings in Windows 7. Similarly, you can use PowerShell to configure computers more efficiently, using richer logon, logoff, startup, and shutdown scripts that are executed through Group Policy.

Create, deploy, and manage images more efficiently. Windows 7 includes several tools to streamline the creation and servicing of the deployment image, and to get users up and running as quickly as possible.

The Deployment Image Servicing and Management (DISM) tool in Windows 7 provides a central place to build and service Windows images offline. With DISM, you can perform many functions with one tool: mount and unmount system images; add, remove, and enumerate packages and drivers; enable or disable Windows features; configure international settings, and maintain an inventory of offline images that contain drivers, packages features, and software updates. Windows 7 also enables the same processes and tools to be used when managing virtual machine (VHD) and native file-based (WIM) image files.

Windows 7 also includes Dynamic Driver Provisioning, where device drivers are stored independent of the deployed image and can be injected dynamically based on the Plug and Play ID of the hardware, or as predetermined sets based on information contained in the basic input/output system (BIOS). Reducing the number of drivers on individual machines reduces the number of potential conflicts, ultimately minimizing setup time and improving the reliability of the computer.

When you are ready to deploy Windows 7, Multicast Multiple Stream Transfer enables servers to “broadcast” image data to multiple clients simultaneously, and to group clients with similar bandwidth capabilities into network streams to permit the fastest possible overall transfer rate while optimizing bandwidth utilization.

Provide better support for client virtualization. Windows 7 delivers a richer experience when users are connected to a virtual desktop—much closer to the experience provides by a native Windows desktop. For example, Windows 7 provides multi-monitor support, bi-directional audio to enable Voice over Internet Protocol (VoIP) and speech recognition applications, and access to local devices, such as printers.

Provide enhanced troubleshooting tools. Windows 7 provides rich tools to identify and resolve technical issues, often by the end users themselves. If a help desk call is unavoidable, Windows 7 includes several features and troubleshooting tools to help speed resolution.

The Problem Steps Recorder allows end users to reproduce and record their experience with an application failure, with each step recorded as a screen shot along with accompanying logs and software configuration data. A compressed file is then created that can be forwarded to support staff to help troubleshoot the problem.

Windows 7 includes a suite of troubleshooting packs, collections of PowerShell scripts, and related information that can be executed remotely by IT professionals from the command line, and controlled on the enterprise basis through Group Policy Settings.

Windows 7 also includes Unified Tracing to help identify and resolve network connectivity issues in a single tool. Unified Tracing collects event logs and captures packets across all layers of the networking stack, providing an integrated view into what’s happening in the Windows 7 networking stack and aiding analysis and problem resolution.

Extend the reach of desktop search. Search Federation in Windows 7 provides out-of-the-box support for searching beyond the user’s computer, including network document repositories, search engines, Web applications and proprietary data stores—all from within the familiar Windows interface. IT professionals can publish important search locations through Group Policy, and can deploy up to five search scopes on user’s computers to help them find the information they need more easily. In addition, Windows 7 desktop search supports the public OpenSearch standard, so with a few minor updates, Web developers can take advantage of existing investments in RSS lists to quickly return results to Windows 7.

Windows 7 Troubleshooting

Windows 7 is an updated version of operating system provided by Microsoft. Windows 7 comes with enhanced features to maximize the speed and performance of your computer. However, there are chances that some errors and problems may occur with Windows 7. It becomes extremely necessary to troubleshoot issues related to Windows 7 in order to ensure that your PC works at its optimal pace.

Call 1877-466-7165 microsoft certified tech experts They provide quick and easy troubleshooting support for all problems associated with Windows 7. We will identify and fix software and hardware compatibility issues, driver errors, synchronization problems, and many more. Our Microsoft Certified technicians will troubleshoot errors that occur while restarting Windows 7, changing screen resolution, upgrading video card, etc. Just give us the green light and we will remotely access your computer through the Internet to troubleshoot problems related to Windows 7 operating system.

Monday, July 26, 2010

Change the Maximum Number of Most Frequently Used Program Shortcuts

Windows XP automatically adds shortcuts to your most frequently used programs to the bottom left of the Start Menu. Since there is a good chance that you will regularly use the same programs, this feature can be a real efficiency booster. Shortcuts to programs you often use are likely to stay right there in the most easily accessible area of the Start Menu.



You can also configure this feature to a degree by altering the maximum number of most frequently used program (MFU) shortcuts that can be displayed.

Here's how:

1. Right-click the "Start" button and click "Properties" to open the "Taskbar and Start Menu Properties" window.

2. Click the "Customize" button to open the "Customize Start Menu" window.

3. Change the number in the dropdown box labelled "Number of programs on Start menu". (This only alters the number of programs listed in the most frequently used program area of the Start menu.)

4. After you have chosen the maximum desired number of program shortcuts to be displayed, click "OK" to exit the "Customize Start Menu" window and "OK" again to exit the "Taskbar and Start Menu Properties" window.


Change the number of Most Frequently Used Programs

Naturally, if you select too high a number, the Start menu will run out of room and not all of the program icons will be displayed. The highest number that you can select in step 3 above is normally 30, although I would suggest that 10 or 12 would be a more practical upper limit. However, you can make sure that as many icons as possible are displayed by selecting "Small Icons" in the "Customize Start Menu" window.

If you would prefer that no icons at all be displayed in the most frequently used program area, you can simply select "0" in step 3 above.

Quickly Change The Start Menu Picture

The Windows XP Start Menu displays a picture that helps to identify the user account that is currently active. This picture and other user account options can be changed via the "User Accounts" Control Panel applet.

Start menu Picture



However, there is a quicker way to change the Start menu picture "on the fly".

1. Click "Start" and then click directly on the picture. This will give direct access to the User Account option that allows you to change the picture.

2. To choose a new picture, double-click one of the pictures displayed or click "Browse for more pictures" to find another suitable picture stored elsewhere on your computer.

3. Exit the "User Accounts" window.


Your new picture should now be displayed on the top of the Start menu and on the Windows XP "Welcome" screen.

Hide or Show the Common Tasks Sidebar in Folders

By default, Windows XP displays a "Common Tasks" sidebar in folders. As the name implies, this sidebar allows users to more quickly carry out such common tasks as creating a new sub-folder, sharing the folder, or rapidly accessing other important places on the computer.

Common Tasks Sidebar



However, there are, of course, other ways to achieve these tasks and you may feel that the "Common Tasks" sidebar just wastes your folder real estate, especially if you have folders that contain a large number of files or subfolders. If so, you can easily turn the sidebar off and on as required.

Here's how:

1. Open a folder, click on "Tools" on the Menu bar, and then click on "Folder Options" to open the "Folder Options" window.

2. With the "General" tab selected, click "Use Windows classic folders" to turn off the sidebar or "Show common tasks in folders" to turn on the sidebar.

3. Click "OK" to exit the "Folder Options" window.


Show or Hide common tasks sidebar

Folders should now hide or display the common tasks sidebar depending on your choice in step 2 above. Note that the change will be reflected in all folders, not just the one in which you were working.

Clear the Most Frequently Used Programs List

Windows XP automatically adds shortcuts to programs you use often to the most frequently used programs (MFU) area of the Start menu. These shortcuts are displayed on the bottom left of the Start menu.

This feature can increase your computing efficiency by providing rapid access to programs you use a lot. However, it also allows casual observers or other people who share the use of your computer to see what programs you have been using recently and you may feel that this impinges on your privacy somewhat. You might also want to give the MFU area a fresh start from time to time by clearing the listed programs.
Either way, Windows XP makes clearing the MFU list very simple.

Here's how:

1. Right-click the "Start" button and click "Properties" to open the "Taskbar and Start Menu Properties" window.

2. Click the "Customize" button to open the "Customize Start Menu" window.

3. In the "Programs" area, click the "Clear List" button.

4. Click "OK" to exit the Customize Start Menu" window and "OK" again to exit the "Taskbar and Start Menu Properties" window.


Clear the Most Frequently Used Programs List

The bottom left area of the Start menu should now be blank and ready to begin displaying shortcuts to your frequently used programs all over again.

For another tip about the most frequently used programs area, see:
Change the Maximum Number of Most Frequently Used Program Shortcuts

Activate a Screen Saver Instantly.

If you want to keep casual observers from seeing what you are working on when you step away from your computer, or you just want to enjoy your favourite screen savers without the wait, you can create a screen saver shortcut that allows you to activate a screen saver instantly.

Part 1: Locate Screen Saver Files

1. Click "Start" and then click "Search" to open the "Search" window.

2. In the "Search Companion" area, click "All Files and folders".

3. Click the "More advanced options" arrow.

4. Ensure that there are ticks in the "Search system folders" and the "Search sub-folders" check boxes.

5. In the field labelled "All or part of the file name:" enter *.scr

6. In the drop-down list labelled "Look in:", choose the drive where system folders are likely to be stored (probably the "C" drive"). Your search should look like the screenshot shown below.

7. Click the "Search button" to begin searching for screensaver files.

8. When the search is completed, a list of available screen saver files should be displayed in the search window.


earching for Screen Savers

Part 2: Create a screensaver shortcut

1. Choose the screen saver you wish to use. You can double-click on a file to view a preview of the screen saver.

2. Right-click the chosen file and select "Send To" in the context menu.

3. In the "Send To" sub-menu, click "Desktop (create shortcut).


A shortcut icon for your chosen screen saver should now be displayed on the Windows XP desktop. Double-click on this icon any time you wish to activate your screensaver.

If you like, you can even create several screen saver shortcuts on the desktop so that you have a range of instant screen savers to choose from.

Notes:
You may be able to locate suitable screen saver files more quickly by using advanced search options or navigating directly to the files within Windows Explorer.

Activating an instant screen saver via a desktop shortcut will not change the default screen saver you have set in Display Properties. If you have not activated an instant screen saver via a shortcut, the default screen saver will still activate automatically after the amount of idle time specified in Display Properties.

Instant screen savers will not request a password on resume even if you have your normal screen saver configured to require a password in Display Properties.