Search Results

Search found 9 results on 1 pages for 'kirschstein'.

Page 1/1 | 1 

  • HTML.CheckBox persisting state after POST - Refresh ModelState?

    - by Kirschstein
    I have a form that's made up of many items (think order items on an amazon order). Each row has a checkbox associated with them so the user can select many items and click 'remove'. The form is built up a bit like this; <% for (int i = 0; i < Model.OrderItems.Count; i++) { %> <tr> <td><%= Html.Hidden(String.Format("OrderItems[{0}].Id", i), Model.OrderItems[i].Id)%> <%= Html.CheckBox(String.Format("OrderItems[{0}].Checked", i), Model.OrderItems[i].Checked)%></td> <td><%= Html.TextBox(String.Format("OrderItems[{0}].Name", i), Model.OrderItems[i].Name)%></td> <td><%= Html.TextBox(String.Format("OrderItems[{0}].Cost", i), Model.OrderItems[i].Cost)%></td> <td><%= Html.TextBox(String.Format("OrderItems[{0}].Quantity", i), Model.OrderItems[i].Quantity)%></td> </tr> <% } %> The model binder does its magic just fine and the list is correctly populated. However, after I process the request in the action (e.g. remove the appropriate items) and return a new view containing fewer items, the state of the form is 'semi' persisted. Some check boxes remain checked, even though in the edit model all the bools are set to false. I don't have this problem if I return a RedirectToActionResult, but using that as a solution seems a bit of a hacky work around. I think I need to flush/refresh the ModelState, or something similiar, but I'm unsure of the terms to search for to find out how.

    Read the article

  • .NET OCRing an Image

    - by Kirschstein
    I'm trying to use MODI to OCR a window's program. It works fine for screenshots I grab programmatically using win32 interop like this: public string SaveScreenShotToFile() { RECT rc; GetWindowRect(_hWnd, out rc); int width = rc.right - rc.left; int height = rc.bottom - rc.top; Bitmap bmp = new Bitmap(width, height); Graphics gfxBmp = Graphics.FromImage(bmp); IntPtr hdcBitmap = gfxBmp.GetHdc(); PrintWindow(_hWnd, hdcBitmap, 0); gfxBmp.ReleaseHdc(hdcBitmap); gfxBmp.Dispose(); string fileName = @"c:\temp\screenshots\" + Guid.NewGuid().ToString() + ".bmp"; bmp.Save(fileName); return fileName; } This image is then saved to a file and ran through MODI like this: private string GetTextFromImage(string fileName) { MODI.Document doc = new MODI.DocumentClass(); doc.Create(fileName); doc.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true); MODI.Image img = (MODI.Image)doc.Images[0]; MODI.Layout layout = img.Layout; StringBuilder sb = new StringBuilder(); for (int i = 0; i < layout.Words.Count; i++) { MODI.Word word = (MODI.Word)layout.Words[i]; sb.Append(word.Text); sb.Append(" "); } if (sb.Length > 1) sb.Length--; return sb.ToString(); } This part works fine, however, I don't want to OCR the entire screenshot, just portions of it. I try cropping the image programmatically like this: private string SaveToCroppedImage(Bitmap original) { Bitmap result = original.Clone(new Rectangle(0, 0, 250, 250), original.PixelFormat); var fileName = "c:\\" + Guid.NewGuid().ToString() + ".bmp"; result.Save(fileName, original.RawFormat); return fileName; } and then OCRing this smaller image, however MODI throws an exception; 'OCR running error', the error code is -959967087. Why can MODI handle the original bitmap but not the smaller version taken from it?

    Read the article

  • Visual Studio Default Browser (MVC)

    - by Kirschstein
    Possible Duplicate: Visual Studio opens default browser instead of IE I want to change the default browser used by Visual Studio for debugging. Normally the route I'd take to do this is right clicking on an .aspx file and setting the default from the 'browse with' dialog. Unfortunately, MVC views don't have the browse with option. What other ways can you set the default browser? EDIT: FireFox is set to my default browser in Windows, but VS still opens up IE.

    Read the article

  • RESTful Question/Answer design?

    - by Kirschstein
    This is a toy project I'm working on at the moment. My app contains questions with multiple choice answers. The question url is in the following format, with GET & POST mapping to different actions on the questions controller. GET: url.com/questions/:category/:difficulty => 'ask' POST: url.com/questions/:category/:difficulty => 'answer' I'm wondering if it's worth redesigning this into a RESTful style. I know I'd need to introduce answers as a resource, but I'm struggling to think of a url that would look natural for answering that question. Would a redesign be worthwhile? How would you go about structuring the urls?

    Read the article

  • Change Visual Studio Default Browser in an ASP.NET MVC project

    - by Kirschstein
    FireFox is set to my Windows default browser. I want to change the default browser used by Visual Studio for debugging. Normally the route I'd take to do this is right clicking on an .aspx file and setting the default from the Browse With... dialog. Unfortunately, ASP.NET MVC Views don't have the Browse With... option. What other ways can you set the default browser for ASP.NET MVC projects? Related, but NOT ASP.NET MVC Specific: Visual Studio opens default browser instead of IE

    Read the article

  • Multiple Pre-Build Events in Visual Studio?

    - by Kirschstein
    I've followed a blog post by Scott Hanselman for managing configuration with PreBuild Events and have it working fine. I now want to split up my configuration into a couple of different files, so need to exectue the command again before the build. The problem is the PreBuild event text all gets executed as one console command. How can I split it up as several commands?

    Read the article

1