.net

C#: Hiding a console window ?

Question: I have a console program that shouldn't be seen. (It resets IIS and deletes temp files.) Right now I can manage to hide the window right after start like this: static void Main(string[] args) { var currentProcess = System.Diagnostics.Process.GetCurrentProcess(); Console.WriteLine(currentProcess.MainWindowTitle); ...

How can I create transparent controls in .Net Compact Framework ?

Hi All, I need to create a transparent control in .Net Compact Framework. Does anyone has any idea how to make it ? ...

Automating DDL in .Net

I maintain a product that has a home-grown data access layer, programmed in C++/COM for use with a Windows-based web application designer and it is at least 10 years old. This DAL is modularized with something akin to Data Providers so that it can generate basic SQL and DDL for a specific database type. In the process of migration anal...

How to decrypt the key

Using C#, JavaScript & mysql In the database i have the column like sign, sign ONr3XHNaUuROnolZpGSsdI+/b3mfOuXnBW7bW7M7cEBqE1RljubGNyc3f1ilFB1qJC9RkeZgaYcWFF1Z7DbgdHES78AAFYIcGMg5kzQdjR0wr1EQgmW+Z4TfmdmMlwNzbsdCPn6s0Bmlxt5HJ893KLrBGYhIRQre2JVje6u85Qk= cqz+/tEn2q2Hc7Cwa7bXGYY6K77v37bZOW2HMfSCdmwh/qoFyFCvWo8wH9JpUnHV5V5359ak1fy3/jkO/bIED...

How to capture from webcam in Linux using Mono?

How can I capture a frame from a video-4-linux device (e.g.: /dev/video0) using Mono and C#? OS is Angstrom Linux running on BeagleBoard. ...

CollectionViewSource and sorting (Danish alphabet)

Hello, I would like to sort some objects that have a Name property. These objects are stored in CollectionViewSource. I add sorting description in the following way: MyCollectionViewSource.View.SortDescriptions.Add(new SortDescription("Name"),direction)); where direction is Ascending/Descending. Everything works fine except one case...

Impact of Microsoft Security Advisory (2269637) on .NET coding

Microsoft released Security Advisory (2269637) Insecure Library Loading Could Allow Remote Code Execution. The note refers to a tool that will help to detect this problem and programming guidelines on Dynamic-Link Library Security. How do these guidelines translate to .NET development? I assume this only affects Platform Invoke. Does...

Converting System.Decimal to System.Guid

I have a big dictionary where the key is decimal, but the GetHashCode() of System.Decimal is disasterously bad. To prove my guess, I ran a for loop with 100.000 neigboring decimals and checked the distribution. 100.000 different decimal numbers used only 2 (two!!!) different hashcodes. Decimal is represented as 16 bytes. Just like Guid!...

what is the difference between "managed" vs "unmanaged"?

I hear/read about it sometimes when talking about .NET, for example "managed code" and "unmanaged code" but I have no idea what they are and what are their differences. What are their difference, by definition? What are the consequences of using either of them? Does this distinction exist in .NET/Windows only? ...

Entity Framework : ExecuteStoreQuery not found in ObjectContext

Hello, I'm using Visual Studio 2010 Express with Framework 4.0 and if I am correct, it comes with Entity Framework 4. My ObjectContext is defined as: public partial class CreaturesEntities : global::System.Data.Objects.ObjectContext I tried to use ExecuteStoreQuery : using System.Data.Objects; using System.Data.Entity; [...] contex...

Component for playing video frame by frame

Hi, I need a component (.NET or COM) which can plays video frame by frame. I've tried wmp.dll (axWindowsMediaPlayer) but no luck on playing frame by frame. any suggestion? ...

Nhibernate Interceptor is never called

I used NHibernate 2.1.2 and FluentNhibernate 1.1, database SQLITE In Memory (For unit testing purposes). Purposes of interceptor is to make proxy object returned by create criteria. I think i already register the interceptor to configuration correctly. but create criteria only return the naked object not proxied at all. I tried to put a ...

How do I allow a ComboBox to have a selected value that is not in ItemsSource?

I have a ComboBox like this: <ComboBox IsEditable="True" ItemsSource="{Binding SelectableValues}" SelectedValue="{Binding SelectedValue}" /> SelectableValues is a list of double and SelectedValue is a double. If the user chooses a value from the list or manually enters one of those values, my SelectedValue propert...

Security of ClickOnce application

I have an application (exe) that uses some strongly named dll's. If I understand that correctly, nobody can replace the dll's with their own, prepared versions, because they will not be signed. Nobody can replace the exe too, because it's secured by signing the manifest. But what if somebody prepares their own exe and changes the signat...

wcf connection handling best practice

Hi All, I have a wcf client. What is the best way of handling connections ? Is it to open and close every time you need to contact the service: void doSomething(){ MyService service = new MyService(); //try service.doThis(10); ... service.doThat(20); service.Close() // catch } Or should I...

Using one class instead of another

I remember .Net had a feature (don't remember whether it was a configuration option or assemby attribute) which would replace one class with another. For example I have AmbiguousClass in some referenced assembly which uses locale-unaware strings. What I want to do is inherit AmbiguousClass with LocalizedAmbiguousClass and point to .Net ...

Literal in Code behind

Hi. why I cant access to literal in behind Code of my asp.net page? <%@ Page Title="" Language="VB" MasterPageFile="~/UI/Masters/Window.master" AutoEventWireup="false" CodeFile="HelpViewer.aspx.vb" Inherits="UI_Pages_HelpViewer" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %> <asp:Content ID="Content1" ContentPlaceH...

When I try to upload a file in ASP.NET MVC, it shows as null

For some reason the paramater OriginalLocation is always null in the following code. What am I doing wrong? Controller: [HttpPost] public ActionResult File(HttpPostedFileBase OriginalLocation, FileModel model) { byte[] binaryData = null; if (OriginalLocation != null && OriginalLocation.ContentLength > 0) { bi...

Aggregation versus Inheritence in C#, or alternatives.

Let's say I have the following two classes: public class Person { public string Name { get; set; } public string Address { get; set; } } public class Customer: Person { public string CustomerNumber { get; set; } public string PaymentTerms { get; set; } } Now, if I have a person that I want to make a customer, I have, t...

best practice for handling connection errors

What is the best workflow taken when connection error occurs. Let say we have a client that connects to the middle tier. class MyClient{ ... void callServer(){ try{ middletier.saveRecord(123); }catch(...){ // log the error // what to do next (notify the user, take the same step again)? ...