Shutdown timer on Windows desktop

Create a shutdown timer for Windows

To create a shutdown timer manually, open Command Prompt and type the command shutdown -s -t XXXX. The “XXXX” should be the time in seconds you want to elapse before the computer shuts down. For instance, if you want the computer to shut down in 2 hours, the command should look like shutdown -s -t 7200.

If you want to restart your computer on a delay, use shutdown -r -t XXXX instead.

To cancel the timer, open the Run window or Command Prompt again and enter shutdown -a.

Create a shutdown timer shortcut

If you need to use a shutdown timer regularly, you can take this trick one step further by turning it into a desktop shortcut.

shutdown-timer-windows-shortcut.png
  • Right-click on the desktop, hover over New and select Shortcut in the side menu.
  • In the path field type “shutdown -s -t XXXX” and click Next.
  • Enter a name for the shortcut (for example, “Shutdown 1 Hour”) and click Finish.

Any time you double-click the shutdown shortcut, the timer will start. To cancel the timer, you can create a second shortcut using shutdown -a or enter the shutdown -a command in Command Prompt.

To change the time on the shutdown timer, right-click the shortcut icon, select Properties and change the seconds value in the Target field. From within Properties, you can also assign a different image as the icon.

Tagged

How to access ASP.NET Controls from code-behind inside a LoginView control

I almost created a completely new project as i thought it was one of those unexplained Visual Studio phenomenons. As a last measure I consulted Dr.Google and voila!

The following example holds true for any control, just make sure to add the corresponding attributes and values for casting.

(All codes in VB,NET)

To access a TextBox Control

Dim tbox As TextBox = DirectCast(LoginView1.FindControl("TextBox3"), TextBox)
tbox.Text = "WOW"

To access a Image Control

Dim picture As Image = DirectCast(LoginView1.FindControl("img1"), Image)
picture.ImageUrl = "pics/thumbs/what.png"

To access a Label Control

Dim labelname As Label = DirectCast(LoginView1.FindControl("label1"), Label)
labelname.Text ="last"
Tagged , ,

Visual Studio 2013: The System Cannot Find The File Specified. (Exception From HRESULT: 0x80070002)

I clicked Create New Project, and accepted all the defaults: New Project Application Defaults

However, immediately following pressing the Create Project button above, I get this message:

The system cannot find the file specified. (Exception from HRESULT: 0x80070002) Error message

To get this resolved you need to do the following:

  • Within VS, Tools > Extensions and Updates

VS-01

  • Expand Online and choose Visual Studio Gallery

VS-02

  • Search for NuGet Package Manager for Visual Studio

VS-03

  • Download and install
  • Restart VS

VS-04

  • Create your project and error will disappear and you will have files in the Solution Explorer

Via Just another IT blog

Tagged ,

How to Fix “The Selected Disk is of the GPT Partition Style” Issue during Windows Installation

The Selected Disk is of the GPT Partition Style

When will we meet with this situation?

There are many discussions about this in PC forum. Now I take some for examples:

  • I’m trying to install Windows 7 on a separate 100GB partition beside my Windows 8 partition (dual boot). The disc boots fine, but I can’t select my partition (Disk 0 part 5) because of the error: “The selected disk is of the GPT partition style”.
  • I tried to install Windows Server 2008 R2 on my partition. When I select the partition, I got the error message: “Windows cannot be installed on this disk. The selected disk is of the GPT partition style”.
  • While trying to Wipe Windows 7 and install Windows 8 on my Zenbook, I have encountered an annoying error message: “Windows cannot be installed to this disk. The selected disk is of the GPT partition style”. No other information is given.

How to Solve This Problem with the Simplest Way?

Notice that I said “the Simplest Way”. Although there are many solutions we can find from the forum, I’d like to suggest you use the simplest way: convert GPT to MBR disk.

Convert GPT to MBR with Diskpart

In some technology or computer forum, some technicians give some advice that convert GPT to MBR with Diskpart, which is run by program code. The specific steps are following below:

  • Enter system installing interface by using Win 7 disc or USB hard drive boot. and then press “Shift”+”F10” to open the command prompt.
  • Input “Diskpart” (do not input quotation mark, the following as well), and then press “Enter”to enter operating interface.
  • Input “list disk”: to check hard disk properties. Pay more attention to capacity of hard disk to select. Usually, disk 0 is hard disk, and disk 1 is the usb dirve where wins 7 install.
  • Input “select disk 0”: to select disk 0 as the disk that is operating.
  • Input “clean”: to clean up current hard disk’s partition.
  • Input “convert mbr”: to convert GPT into MBR.
  • Input “create partition primary size = xxx”: in MB (megabytes) to create the size of primary partition.
  • Input “format fs = ntfs quick”: to format disk to NTFS quickly.
  • Input “exit”: to finish operating.
  • Input “exit”: to shut down the command prompt.

After finishing operating, shut down the command prompt and install windows system on computer in normal way. The steps seems be concise, but the greatest shortage is that all data and files will be clean up. If you don’t have backup files in GPT disk, you will be crying and anxious for that.

Convert GPT to MBR with the third-party software

Of many kinds of third-party software, AOMEI Partition Assistant is a not bad tool to help user to convert disk. It’s the greatest strengthen is to convert disk from GPT to MBR without data loss.

You can check it out here: http://www.disk-partition.com/download-pro.html

Via AOMEI Technology

Tagged , ,

Fixing the Telerik RadGrid Filter Case Sensitive Issue

By default the filter option for the RadGrid is set to be case-sensitive (true). You can change this on the .aspx page by specifying it tn the declaration of the grid.

GroupingSettings-CaseSensitive="False"
Tagged , ,

Reducing the Filter Menu Options in a Telerik RadGrid

You can reduce the filter menu options to display only a subset of the available filter functions. There are two possible approaches – client-side and server-side. I personally prefer the server-side approach and the following example shows how to reduce the set of filter functions so that the filter menu can only show the NoFilter, Contains, EqualTo, GreaterThan and LessThan items:

Private Sub RadGrid1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.Init
    Dim menu As GridFilterMenu = RadGrid1.FilterMenu
    Dim i As Integer = 0
    While i < menu.Items.Count
        If menu.Items(i).Text = "NoFilter" Or _
           menu.Items(i).Text = "Contains" Or _
           menu.Items(i).Text = "EqualTo" Or _
           menu.Items(i).Text = "GreaterThan" Or _
           menu.Items(i).Text = "LessThan" Then
            i = i + 1
        Else
            menu.Items.RemoveAt(i)
        End If
    End While
End Sub
Tagged ,

How to Reset Identity column in SQL Server

You might find the need to reset the identitity column count after deleting all records form a table or for any other purpose. The following code does just that!

DBCC CHECKIDENT('tablename', RESEED, 0)

Tagged

Twitter Bootstrap Modal immediately disappearing issue

If you face a  problem where, as soon as you click on the button for a modal popup, the modal fades in and then immediately disappears, then the problem is because this is typical behavior for loading the Modal plugin JavaScript twice. Please check to make sure that you have either bootstrap.js OR bootstrap-modal.js, but not both. The former includes the latter.

Tagged

Twitter Bootstrap CSS – box-sizing issue

Easiest Way

Safe only if you don’t use other bootstrap components Add the following css after the bootstrap css is loaded:

*,
*:before,
*:after {
  -webkit-box-sizing: content-box;
     -moz-box-sizing: content-box;
          box-sizing: content-box;
}

.container .row *,
.container .row *:before,
.container .row *:after {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

This will use the border-box sizing only for elements within the grid system. This won’t work if you have custom widgets within the grid as they would still have border-box applied.

More targeted approach

Safe only if you don’t use other bootstrap components Alternatively, you could add a custom col class to every column div which already have a col-*-*applied like so:

<div class="container">
    <div class="row">
        <div class="col-md-3 col">Grid still works</div>
        <div class="col-md-9 col">:)</div>
    </div>
</div>

Then use the following css instead:

*,
*:before,
*:after {
  -webkit-box-sizing: content-box;
     -moz-box-sizing: content-box;
          box-sizing: content-box;
}

.container .row .col,
.container .row .col:before,
.container .row .col:after {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

This works fine if you ONLY need to use the bootstrap grid system in your project. If you intend to use other bootstrap components however, I don’t recommend this approach either since other bootstrap components would depend on the border-box being set.

Cherry-pick each containing element to fix

A still better way would be to just override the box-sizing as content-box on a specific parent element for a widget like this:

.your-custom-widget-class *,
.your-custom-widget-class *:before,
.your-custom-widget-class *:after {
  -webkit-box-sizing: content-box;
     -moz-box-sizing: content-box;
          box-sizing: content-box;
}

This approach offers the best forward compatibility with future bootstrap components, even if it seems to be working for you now. Source StackOverflow

Tagged ,