.net

Having problems with this Linq/Lambda statement :(

Hi folks, Update - I fixed the query below. I had the wrong query/error statement :( I have the following statement: var posts = BlogPostRepository.Find() .Where(x => x.Tags.Where(y => y.Name == tag)) .ToList(); It's giving me a compile time error with the 2nd (inner) Where clause, saying :- Error 1 Cannot convert...

How can I render this data, into a Grid, in an ASP.NET MVC view?

Hi folks, I want to copy StackOverflow's TAG's page, where they have a list of Tags (or whatever) and display them into a few columns, with the first column being the first 10 records, the second column being record 11->20 .. etc. and of course I have my data already paged. I'm not sure what this type of view is called? is this a grid...

What are the official FrameworkNames?

.NET 4 has a new FrameworkName class. An example of this being used is NuPack and its package directory naming convention. What are the FrameworkNames for Microsoft's .NET Frameworks? ...

connection string issue in web.config of ASP.Net

Hello everyone, I am using VSTS 2010 + C# + .Net 4.0 to develop an ASP.Net application using SQL Server 2008 Enterprise as database. I am learning someone else's code. I notice code like this, I am not sure whether the usage is correct and so I come here to ask for advice. In the code, I see some code like this, I want to know whether ...

Help: Shifting to ubuntu and opensource from Microsoft stack

Hi Guys, I love SO and have been using it for the last 2 years. I've never posted any questions on it (because I found most answers though SO's search). I have high hopes for this question. I have been a .NET developer for the last 7-8 years (ASP.NET, ASP.NET MVC etc) and now i want to learn something new, especially outside Wi...

Apply changes to mainforms Form.Icon at runtime

I have a System.Windows.Forms.Form and want to change the Form.Icon at runtime to display a status. I've managed to load the icon from the projects ressources: Type type = this.GetType(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(type.Namespace + ".Properties.Resources", this.GetType().Assembl...

.net: Please help me understand why this is completely legal in .net?

Suppose we have declared these two classes: public class Animal { //..... } public class Dog : Animal { //..... } Well, my question is: why below line of code is valid? Animal animal = new Dog(); EDIT: In e-book, "Professional C# 2008", there is a paragraph that says: It's always safe to store a derived type within a b...

Unregistering old versions of a .net assembly

Hello, I have an assembly that has a lot of old registered versions. The only dll I have is the last one. How can I unregister all versions of the assembly? Thanks. EDIT : I want to do this at runtime so I want something like regasm -u... or some other script-y solution. ...

How many variables point to the object and which [.net]

I want to make my own xml-serializer class because I need other formatting than the System.Xml.Serialization.XmlSerializer does. My idea is to treat properties of primitive type (such as Integer, Double, String) as XmlAttributes. To properly implement a usable Xml-Serialization I need to know which variables point to the same object (th...

Coding kata sites for C#.

Are there any coding kata sites that include C# as a language? I really like the way things are done on the Coding Kata site, but they only support JVM based languages - these do include JVM versions of Ruby, Python, and JavaScript; I'm keen on the JavaScript - and I would really like to work through problems in C#. ...

Reloading and refreshing flash files inside a windows form

Using DOTNET 3.5 . I have a app which shows load a flash movie in form, using this code axShockwaveFlash1 = new AxShockwaveFlashObjects.AxShockwaveFlash() axShockwaveFlash1.LoadMovie(0, Form1.currentGame); The problem is that whenever I make a changes in the flash hosted in our application and try to refresh the to see the changes, ...

OpenfileDialog - Window is not popping out

Hi, i am working on form . i want small window to pop up when i click button and to will select XML file of my chois from various folder. I guess, this OPenfileDialog will help me. check the code. private void button3_Click(object sender, EventArgs e) { / OpenFileDialog OpenFileDialog1 = new OpenFileDial...

what process lock a file

trying to figure out what progress lock a file using the class below. can anyone explain whats going wrong here. call: private void button1_Click(object sender, EventArgs e) { Console.WriteLine(Win32Processes.GetProcessesLockingFile("locked_file.dll").ToString()); } output: System.Collections.Generic.List`1[System.Diagnostics.Pr...

Parallelism and Synchronization

Imagine you are utilizing Parallelism in a multi-core system. Is it not completely possible that the same instructions may be executed simultaneously? Take the following code: int i = 0; if( blockingCondition ) { lock( objLock ) { i++; } } In my head, it seems that it is very possible on a system with multiple cores a...

Lambda expressions, captured variables and threading

I know that .NET lambda expressions can capture outer variables. However, I have seen it a lot of times that variables are passed explicitly to the lambda expression as a parameter, and the .NET library also seems to support that (e.g. ThreadPool.QueueUserWorkItem). My question is that what are the limitations of these captures? How abo...

Update every column in every table

My database has recently been hacked by SQL injection leaving tags throughout data in all columns in all tables in my database. Is there a quick way of running a REPLACE UPDATE on all tables? Something like: UPDATE [all tables] SET [all columns]=REPLACE([all columns], '<script>....</script>', '') ...

WPF: Bitmap doesn't show

I want to create some kind of simulation. There will be numerous sprites floating around. Because I think that rendering every frame thousand times the same primitives which make up a sprite, will be slow, I want render them once into a bitmap and then show this sprite every frame. But it doesn't seem to work, the screen stays white. M...

How to drag and drop an email, from Outlook, into a .NET application?

I am trying to figure out how to drag and drop an email from Outlook 2010 into my .NET application. I've seen quite a few articles, most with very complex solutions. My thought is it shouldn't be that complex ... but I could be wrong. Any help would be much appreciated! ...

How to build WCF REST services with .NET 3.5 and Visual Studio 2010?

I'm about to build some RESTful web services using WCF and .NET 3.5 in VS2010. I've not done this before so am looking for some pointers as to the easiest approach. For deployment reasons I cannot use .NET 4 but must stick with .NET 3.5 SP1. It seems the WCF REST Starter Kit doesn't work with VS 2010 (I'm not certain about this - maybe ...

REST client HTTP multipart support

Hi, I have a 3-rd party REST domain that requires doing HTTP multipart POST requests in order to create/update resources. Moreover, getting resource representation is done by a GET request where the response is expected to be a multipart HTTP (the multipart HTTP messages are used for 2 main purposes: 1 - attaching binary files to the res...