c#-4.0

how to change the directory location in command prompt using C#?

蓝咒 提交于 2020-01-12 07:59:46
问题 I have successfully opened command prompt window using C# through the following code. Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.WorkingDirectory = @"d:\pdf2xml"; p.StartInfo.WindowStyle = ProcessWindowStyle.Normal; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardInput = true; p.Start(); p.StandardInput.WriteLine(@"pdftoxml.win32.1.2.7 -annotation "+filename); p.StandardInput.WriteLine(@"cd D:\python

MVC 2.0 dynamic routing for category names in an e-store

坚强是说给别人听的谎言 提交于 2020-01-12 07:56:06
问题 I'm currently working on an e-store using ASP.NET MVC 2.0. I already got most of it up and running, but the part that's been bothering me is routing. I want this: http://mystore.somewhere/my-category-1/ So far I've been able to solve it by using: routes.MapRoute( "Category", "{alias}/{pageNumber}", new { controller = "Categories", action = "Browse", pageNumber = 1 }); But this catches way too much than just what I'd like. After reading through some questions and answers around this site, I

Dynamic view of anonymous type missing member issue - MVC3

谁说胖子不能爱 提交于 2020-01-12 04:04:53
问题 I have an MVC3 site that I've setup for testing another site - most of it has been quick and dirty, and so I've not gone to town creating model and view model types for all the views - only where input is requried from the user. Okay so I have a controller method that projects a Linq sequence and sets it into ViewBag . ViewBag.SomeData = Enumerable.Range(1,10).Select(i=> new { Value = i }); In my view (Razor C#) I then want to read this - quite simple: @foreach(dynamic item in ViewBag

ASP.Net MVC Editor template for dynamic view data / forms

回眸只為那壹抹淺笑 提交于 2020-01-12 04:00:11
问题 I am implementing a MVC3/Razor web application that retrieves some of its "fields" a user can edit from other services so the list of properties to edit in a view is completely dynamic and unknown at compile time. I wrote some partial-view and HTML-helpers that loop through the groups and properties retrieved from the other services. Now I am at the point where I have to build the tags for the various property types and thought why not re-use the MVC editor template system for this? There is

Regular expression is being too greedy

给你一囗甜甜゛ 提交于 2020-01-11 13:20:15
问题 I am trying to write a regular expression but it’s being too greedy. The input string could be in either of the following formats: STUFF_12_1234 or STUFF_1234 What I want to do is to create a regular expression to grab the characters after the last _ . So in the above examples that would be the numbers “1234”. The number of characters after this last _ varies and they could be a combination of letters and numbers. I have tried the following expression: _(.*?)\Z This works for “STUFF_1234” by

Windows Server 2008 r2 + IIS7: .mp4 files can not be played

雨燕双飞 提交于 2020-01-11 12:37:11
问题 I have the strange trouble.Folder of web application in my server (IIS7.5, Windows Server 2008 R2). Web application has Video player. <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <video src='<%# ResolveUrl(GetVideoHandler(Eval("id"))) %>' width="900" height="400" controls="" preload=""></video> </ItemTemplate> </asp:Repeater> It can play .mp4 on my local System, but it don't play on live server when i accessing a video on other system.i have a Value gettong in ResolveUrl

Create a Repeater control in ASP.Net

喜欢而已 提交于 2020-01-11 12:06:39
问题 I'm using two drop down and bind values to that drop down. Now am adding a new button add_new. I want to create the above drop downs below when I click the add button and maintain the previous selected values. Please help me to do this. 回答1: You can achieve the desired result using Repeater control of ASP.Net. You can create any type of template as you wish, see the code below: ASPX: <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <asp:DropDownList ID="DropDownList1" runat="server

Create a Repeater control in ASP.Net

南楼画角 提交于 2020-01-11 12:03:21
问题 I'm using two drop down and bind values to that drop down. Now am adding a new button add_new. I want to create the above drop downs below when I click the add button and maintain the previous selected values. Please help me to do this. 回答1: You can achieve the desired result using Repeater control of ASP.Net. You can create any type of template as you wish, see the code below: ASPX: <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <asp:DropDownList ID="DropDownList1" runat="server

Access Channels in ANTLR 4 and Parse them separately

瘦欲@ 提交于 2020-01-11 11:58:17
问题 I have included my comments in to a separate channel in ANTLR 4. in my case it is channel 2. This is my lexer grammar. COMMENT: '/*' .*? '*/' -> channel(2) ; I want to access this channel 2 and do a parse on this channel to accumulate comments. So I included that as in parsing grammar as below comment :COMMENT ; In the program string s = " paring string" AntlrInputStream input = new AntlrInputStream(s); CSSLexer lexer = new CSSLexer(input); CommonTokenStream tokens = new CommonTokenStream

Adjusting image brightness

别说谁变了你拦得住时间么 提交于 2020-01-11 11:42:49
问题 For windows phone app, when I am adjusting brightness by slider it works fine when I move it to right. But when I go back to previous position, instead of image darkening, it goes brighter and brighter. Here is my code based on pixel manipulation. private void slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { wrBmp = new WriteableBitmap(Image1, null); for (int i = 0; i < wrBmp.Pixels.Count(); i++) { int pixel = wrBmp.Pixels[i]; int B = (int)(pixel & 0xFF); pixel