.net

How to add static list of items in MVC Html.DropDownList()

I would like to assign a static list of items in a SelectList() to a Html.DropDownList() in ASP.NET MVC, what is the best practice? I was about to try to find a way to use new SelectList(new {key = "value"}... but one, that didn't work, and two, would I be breaking a law here, should my static list be declared in ViewData anyway and pas...

Algorithm for sorting a list of objects in c#

Hi, I have a list of object I wish to sort in C#.Net 3.5, the object is as follows id | name | parent_id 1 | Superman | NULL 2 | Batman | 3 3 | Watchman | 1 4 | Wolverine | 2 I know some of you might find this easy, but I need to sort the list based on the parent_id, which is pointi...

Performance issues in FileStream.Write while writing bytes decoded using AsciiEncoding.GetBytes and Convert.FromBase64String

I am facing a performance problem while using the FileStream.Write function. I have a console application that i use to read a Base64 string from a file (~ size is 400 KB) using a StreamReader object. I convert this string to a byte array using Convert.FromBase64String. I then write this byte array to a file using the FileStream obj...

How can I read a stream from a web cam already in use by flash media live encoder?

I have been working on a proof of concept for a project (winforms) in which needs to encode the live feed of the webcam to FLV using Flash Media Live encoder. I am using the command line utility of FMLE to encode the live feed to flv files. The problem is that I need to have a mechanism which will also show me the feed while it is being ...

Any good WebKit wrappers for .Net?

Are there any good (or in active development) WebKit wrappers or ports for .Net? p.s. I am aware of Swift.Net (old and out of date) and GeckoFX (firefox wrapper). ...

Is there a wiring control like the Yahoo Pipes interface for WinForms?

My application's user interface needs to be built soon and the data being represented is chainable; most components have inputs and outputs and can be freely wired together as necessary. Yahoo Pipes is the style of interface I think I need but I'm having trouble finding something suitable for WinForms. TreeGX looks interesting but it on...

describe query with oracle (.Net Connector)

I am using Oracle Express Edition and I want to get table information (column name,type,size,etc..) programmatically , inside my program (.Net C#, Microsoft oracle connector). In SqlPlus, when i give command "desc <tablename>" it works perfectly and print all information about table. Now i want to do it programmatically. I tried to giv...

How can I ease the pain of initializing dictionaries of Lists in C#?

I happen to use this kind of structure quite a lot: Dictionary<string, List<string>> Foo = new Dictionary<string, List<string>>(); Which leads to this kind of code : foreach (DataRow dr in ds.Tables[0].Rows) { List<string> bar; if (!Foo.TryGetValue(dr["Key"].ToString(), out desks)) { bar= new List<string>(); ...

Log files rotation with .net listeners

I have an existing .net service, and I want to configure it to write messages to a log file. I added in the following in the service configuration: <system.diagnostics> <sources> <source name="My.Service" switchValue="All"> <listeners> <add name="text" type="System.Diagnostics.TextWriterTraceListener" initializeData=...

.Net MTP / PTP Wrapper?

I'm writting a hobby project to deal with files on cameras. Previously I found issues with the camera and the FolderBrowserDialog. What I believe is happing is that the camera is using MTP or PTP (Picture Transfer Protocol not peer-to-peer). In order to make interfacing with the camera more seamless I'd like to use PTP or MTP to access...

reference Windows Media Encoder library error

Hello everyone, On Windows Vista/XP, my code works fine. But on Windows Server 2003 x64 edition, after installed x64 version Windows Media Encoder 9 and Windows Media Encoder 9 SDK, in project reference, I need to add reference (in COM Tab) to Windows Media Encoder library, but I cannot find the Windows Media Encoder library on Windows ...

Can I modify [appname].exe.config without having to manually read/write the XMl?

I have created some settings in a C# application using .NET 3.5 and Visual Studio 2008 Express. I have a number of application-scoped settings which I would like to be able to modify from within the application - I can access them through Properties.Settings.Default but they are read only as expected. I do not want to have to make these ...

Properties for custom control using in .NET Compact framework

Hi, I could able to display my custom controls properties in the property window (using EditorBrowsable() attribute). But I have another property which has class as it's return type. So the same property appearing in the window as read only format. I need property it should take the class values at design time just like, Font Name=...

Storing generic List<CustomObject> using ApplicationSettingsBase

I am trying to save a List<Foo> using ApplicationSettingsBase, however it only outputs the following even though the list is populated: <setting name="Foobar" serializeAs="Xml"> <value /> </setting> Foo is defined as follows: [Serializable()] public class Foo { public String Name; public Keys Key1; public Keys Key2; ...

migratordotnet - Run migrations from within application (w/o nant or build)

Hello, is there a way to run migrations from within the application itself? Thanks! ...

Are value types immutable by definition?

I frequently read that structs should be immutable - aren't they by definition? Do you consider int to be immutable? int i = 0; i = i + 123; Seems okay - we get a new int and assign it back to i. What about this? i++; Okay, we can think of it as a shortcut. i = i + 1; What about the struct Point? Point p = new Point(1, 2); p.O...

Simulating MySql's password() encryption using .NET or MS SQL

Hi guys, I'm updating an old ASP/MySql webapp to ASP.NET/MS SQL. We would like to keep the logins from the old website working in the new app. Unfortunately the passwords were stored in the MySql DB using MySql's password() function. Is it possible to simulate MySql's password() function in either .NET or MS SQL? Any help/links ...

ASP.NET MVC hangs when returning View() after performing some web request/response tasks

I have a controller action called UpdateSite(), browsing to this action is a manual way for me to kick off a (normally automated) data-collection process. It's a fairly simple process which has the following work flow: Perform a couple of web requests for data using a web API Parse this data to extract anything I might need If some of...

How to load huge (but simple) hierarchical XML file into an SQL table

I have a very large (2.5GB, 55 million node) XML file with the following format: <TopNode> <Item id = "Something"> <Link>A link</Link> <Link>Another link</Link> <Link>One More Link</Link> </Item> <Item id = "Something else"> <Link>Some link</Link> <Link>You get the idea</Link> ...

Can I safely spawn threads in ASP.NET MVC?

I have a scheduled task that I need to kick off by browsing to a page, my webhost doesn't allow me to use the windows scheduler. One job this task performs is to get some data from a bunch of other websites, due to how slow web-requests can be I've set up the task to use threading. Running this task from an mvc action seems to cause th...