Monday, September 13, 2010

NTLDR is missing Press CTRL+ALT+DEL to restart on Windows XP Pro SP3

Saturday, decided to defragment my old laptop since I didn't remember when it was the last time that was done.  My laptop runs on Window XP professional with SP3. As I looked at the analysis graph, it was indeed heavily fragmented.  I left the laptop alone while defragmenting.  Couple hours later, I shut it down.  The next time when I booted it up, I got the following error message:


NTLDR is missing
Press CTRL+ALT+DEL to restart.


And the system would not boot .  I searched the web for solutions and found a bunch of posts on that topic.  Some of them are risky (could damage the hard disk partitions) while others require a floppy drive which my laptop doesn't have.  After much thinking and praying, the solution was quite simple:

  1. Load the XP Pro OS CD/DVD into the drive
  2. Reboot the laptop and press F12 (this could be different depending on your laptop manufacturer) to load boot devices option
  3. Select to boot from CD/DVD drive
  4. The OS installation will start but don't panic it's not going to overwrite anything yet
  5. When options are presented to install, repair or quit installation, choose 'R' for repair
  6. And then select the OS you want load.  By default you'll see: 1. c:\windows.  In this case, type "1" and press enter
  7. And then put the admin password
  8. After you've logged in, you'll be presented with command prompt C:\Windows
  9. Type D: plush Enter
  10. Copy file NTLDR from the OS drive to root C:

    1. copy d:\i386\ntldr c:\.

  11. Reboot the computer
  12. It should reboot correctly
Hope this will work for you as well.  Naturally, if your cause is different, this will not work for you.

Wednesday, September 1, 2010

Tuesday, August 31, 2010

When to use and when not use Asynchronous actions

Mvc 2 has a really cool feature: asynchronous actions.  You can implement actions so it can be called asynchronously and your route is the same as synchronous call when making the request.  Just read and article on msdn when to use asynchronous actions and when not to:

  • When to use

    • the operations in the actions are network-bound or I/O bound
    • Parallelism is more important than simplicity of code
    • You want to provide a mechanism to allow users to cancel long-running request

  • When not to use

    • operations a CPU bound
    • operations are simple and short-running


Monday, August 30, 2010

Organizing View Models with Namespaces

In Asp.Net MVC, each view should, preferably, have a strongly typed view model.  For a given controller, it could serve up multiple views through actions or simply by rendering partial views.  Sometimes using same view model name for different views make sense while the view model implementations are quite different.  For instance, I might have a view model named ProductForm for a view named Index as follows

public class ProductModel
{
  [DisplayName("Product Id")]
  public Guid Id { get; set; }
  public string Name { get; set; }
  public string Category { get; set; }
}

and I also have a view model for a view named Edit:

public class ProductModel
{
  [DisplayName("Product Id")]
  public Guid Id { get; set; }
  [Requried]
  public string Name { get; set; }
  [Requried]
  public Category Category { get; set; }
}

public enum Category
{
   Hardware,
   Software,
}
The difference between the two models are obvious.  In this case, to distinguish the two models, I could use different names for each or separate them using name space.  I find it easier to use namespace the models and it also follows the pattern convention which Mvc uses to locate a view for a controller as follows:


Models
  |---Home (controller name)
       |--- Index (view name)
            |--- ProductModel.cs (view model)








       |--- Edit (view name)
            |--- ProductModel.cs (view model)


So the name space looks like as follows:
UI.Home.Index.ProductModel
UI.Home.Edit.ProductModel

About Cullen

My photo
Christian, Father, Software Developer/Architect who enjoys technology and using it to make people's lives easier!

Followers