.net

What image format is easy to turn into on or off pixels?

I have a hobby project that includes me driving a LCD by my serial port. I'd like to display an image with 128x128 pixels, but I'm not sure what image format to use. I'm limited to either "off" or "on" as a state of each pixel. What image format do you recommend? In case it matters, I'm planning on using one of the .NET frameworks wit...

Why ValidateValueCallback was called twice when constructoring the related type?

Suppose I've the following DependencyObject type, public class Test : DependencyObject { public int Order { get { return (int)GetValue(OrderProperty); } set { SetValue(OrderProperty, value); } } public static readonly DependencyProperty OrderProperty = DependencyProperty.Register("OrderProperty...

SqlDatareader GetValue returning date value acording to system date format

Hi i am reading a value from a table using SqlDatareader, problem is it is always formatting the value acording to the machine date format settings. for example the original date format in the source table is saved as yyyy/mm/dd when i use SqlDatareader.GetValue in a machine that has date set as MM/dd/YY it is atutomatically converted ...

Trying to use reflection to find the first Int32 property of a class

Hi folks, I'm trying to find the first property of a class that is an Integer .. and get it's value. So i've got the following code .. which always returns false: foreach(var property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { var someType = property.PropertyType is int; // Always false. } Why is ...

To find amount of data available in socket

Hai, Without using "Socket.Available". How could we find the number of bytes available in socket in C#. Could anybody found help me. ...

Binary representation of a .NET Decimal

Hey all, quick question: How does a .NET decimal type get represented in binary in memory? We all know how floating-point numbers are stored and the thusly the reasons for the inaccuracy thereof, but I can't find any information about decimal except the following: Apparently more accurate than floating-point numbers Takes 128 bits of...

Is this a namespacing problem?

I am experiencing a strange behavior with very basic web service development. This question might be dumb but I think someone would be able to explain this observation. I am developing a web service with a web method, MyWebMethod MyWebMethod(MyEnum Param, .....) Where, public enum MyEnum : int { Type_1 =1; Type_2 =...

what happens to exe when we sign it?

After signing exe by using VeriSign, if we right click to exe we can see "digital signature" tab which gives information about certificate. Where exactly this information will be stored? I mean how operating system will come to know which certificate is related to which file? Is there anything embed inside exe while signing? How can I wr...

VC++ forms application centralized exception handling similar to C# forms application on .net platform

I am new to VC++ and I have good experience in working with C# on .net platform. Presently I am in a project which is a combination of VC++ and C# on .net platform. I used to add centralized exception handling for all windows form applications developed using C#. What I mean by centralized exception here means something like this http:/...

Entity Framework 4 POCO CRUD Repository - How to perform Smart INSERT/UPDATE?

Hi Guys, This could be a simple solution, but.... If i have a Entity Framework 4 Repository which exposes the following interface: void InsertOrUpdate(Foo foo); And my EDM is done with custom POCO's (no code generation), how do i perform UPDATE's to POCO's? I can INSERT a new object by doing this: var newFoo = new Foo { ... }; rep...

Externalizing the translation of a WinForms application?

I'm working on an application that will be deployed in a lot of different countries, which of course means different languages. The thing is that I would not translate it myself, nor the other developers. One of the user will translate it and he won't have access to Visual Studio. The question is, how to do that? Is there a tool availa...

Do we still need stored procedures when using compiled queries?

When using compiled queries in entity framework (or linq-to-sql) in combination with SQL Server, is there actually still any performance benefit in using stored procedures? Compiled queries will be cached as parameterized queries, so performance should be near equal to stored procedures. Is there any situation where stored procedures wo...

Freeing up of unmanaged code in C#

I call a piece of an unmanaged C++ code from my C# application to calculate fast fourier transform of a discrete time signal. I make a call something like this IntPtr ptr = ComputeFFTW(packetSig, packetSig.Length, (int)samplFrequency,(int)fftPoints); unsafe { double *dPtr = (double*)ptr; for(int l = 0; ...

VB6 .NET Interop - Performance issue

Hello ! I'm trying to use a VB6 app consumed in a C# app. The VB6 App is a Winform app. To do this, I have modified the VB6 App (EXE) to a DLL. Then I've referenced it in my C# app. In my VB App, I've add a new Class with some methods just to open VB forms. Everything works fine... except that if the form has many controls (30), the wi...

put just the key type (id) or the class type for FK in entities, pros and cons

I've seen 2 types of entities, like this: public class Person { public int Id {get;set;} public string Name {get;set;} public Country Country {get;set;} } and like this: public class Person { public int Id {get;set;} public string Name {get;set;} public int CountryId {get;set;} } I think that the 2nd approac...

Problem unloading AddIns using AddInController

I am using System.AddIn to load and unload extra add-ins into my WCF application. The application gets it's load/unload command from another app, then it calls the following code. Dim controller As AddInController = AddInController.GetAddInController(targetAddin) controller.Shutdown() In a plain WPF test harness, this code works as exp...

GACed .net library project succesfully build only on second try

I'm trying to build a project library that needs to be in the GAC, so I added the following line as a post build event: "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe" -if "$(TargetPath)" For every even (second build, forth build, etc...) build execution I get this: ------ Build started: Project: Test.BusinessLog...

Get directory name based on current date

I have to get directory name made by following pattern: two last digits of a year concatenated with month number ( always two digits). For example directory from september 2010 would be "1009". I did it but I found my code quite trashy. How can I improve it? My current code: public string GetDirectoryNameFromDate(DateTime date) ...

Strange exception on WCF endpoint launch

Hey there! I am getting the following exception and don't have much clue about what and how it should be fixed: The operation 'ShowData' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When usi...

Format string using multiple specifiers

Is there a way to use Int32.ToString("<some string format specifier>") with using more than 1 specifiers? Specifically, I want to format an int in Hexadecimal but force the string to be 8-bit long, by adding 0's in the empty spots. For example, I want to parse the number 1234 in decimal to the string "000004D2". The way I wanted to do t...