.net

Mutex in C# for the same assembly

We have an assembly that is called repeatedly by different executables and it shares these states how its like not thread safe because they call the code at same time what kinda mutex to use ...

Why does GetSqlDecimal throw when GetDecimal doesn't?

I have a database table that has a column of type money, allowing nulls. Using a SqlDataReader named reader, I can do decimal d = reader.GetDecimal(1); which works, unless of course we're reading a null. If I try using SqlDecimal instead--and I thought the whole point of the SqlTypes was to deal with nulls--then I get an invalid cast,...

Exception when calling stored procedure: ORA-01460 - unimplemented or unreasonable conversion requested

I'm trying to call a stored procedure using ADO .NET and I'm getting the following error: ORA-01460 - unimplemented or unreasonable conversion requested The stored procedure I'm trying to call has the following parameters: param1 IN VARCHAR2, param2 IN NUMBER, param3 IN VARCHAR2, param4 OUT NUMBER, param5 OUT NUMBER, param6 OUT ...

Reading from a oracle temp table in a separate procedure than the one it was populted in

I have a 2 stored procedures, the first creates an oracle temp table and the second reads from it. The temp table only has scope for that session. I'm calling the procedures from .Net and the second procedure never returns any results. However if I use the same sprocs and parameters in SQL*Plus it works fine. I've tried creating an Orac...

Date/Time formatting in .NET (Devexpress Gantt charts to show time rather than date)

I have some data about a day's events that I'm trying to visualise as a Gantt chart using Devexpress XtraCharts. Devexpress's example here shows the chart being populated by date. However, I'd like it to be populated by time to compare the events throughout one day. My X-axis is displaying correctly - done like so: ganttDiagram.AxisY.D...

Tips/tricks/gotchas for using System.Diagnostics.Process and Process.Start

I've used Process.Start to shell out and call 7zip to archive stuff I've also used it to call ffmpeg to compress video files. That was a while ago..but I rememeber there was some issue about the pcocess stalling if you don't read off the standardoutput/error. I don't remember everything about it. Does anyone have experience using Syste...

Is it impossible to secure .net code (intellectual property) ?

I used to work in JavaScript a lot and one thing that really bothered my employers was that the source code was too easy to steal. Even with obfuscation, nothing really helped, because we all knew that any competent developer would be able to read that code if they wanted to. JS Scripts are one thing, but what about SOA projects that h...

Check to See if File is in Repository with SharpSVN

How do I check if a file is already in a repository (or NOT in the repository) so I can determine whether I need to 'add' it first before doing the check in? (For the record, I have check-in working, but I get an exception when I try to check in a file that has not yet been added to the repository.) ...

minimize button for winforms form with sizabletoolwindow style

Any tips on how to simulate the minimize button & behaviour UPDATE - the minimize button needs to be on the caption bar as screen real estate is @ a premium ...

Combine master-detail databinding

I have created data sources from my objects in my project, some of which have other objects as members. When I want to bind a some objects to a data grid I would like to display some of the values from the member objects in the data grid as well but the examples I have come across seem to use an entire other datagrid or controls to displ...

Command-Line Parsing API from TestAPI library - Type-Safe Commands how to

Library at http://testapi.codeplex.com/ Excerpt of usage from http://blogs.msdn.com/ivo_manolov/archive/2008/12/17/9230331.aspx A third common approach is forming strongly-typed commands from the command-line parameters. This is common for cases when the command-line looks as follows: some-exe COMMAND parameters-to-the-command ...

Croping images with no loss using .NET

I am trying to understand why after croping an image in .NET i end up with an image 3 times the size of the original image. Listed below is the code i am using to crop the image Private Shared Function CropImage(ByVal img As Image, ByVal cropArea As Rectangle) As Image Dim bmpImage As Bitmap = New Bitmap(img) Dim bmpCrop A...

Close tag on closing brace using Html Helper in ASP.net MVC

Hi, How can I create a helper like the Html.Form helper, which closes the tag when you close the braces? ...

How to store a function pointer in C#

Let's say I want to store a group of function pointers in a List<(*func)>, and then later call them, perhaps even with parameters... Like if I stored in a Dict<(*func), object[] params> could I call the func with the parameters? How would I do this? ...

Unable to run .exe application using C# code

I have an exe that I need to call from my C# Program with two arguments (PracticeId, ClaimId) For example: Suppose I have an application test.exe, whose functionality is to make a claim according to the given two arguments. On cmd I would normally give the following command as: test.exe 1 2 And it works fine and performs its job of c...

read a file with both text and binary information in .Net

I need to read binary PGM image files. Its format: P5 # comments nrows ncolumns max-value binary values start at this line. (totally nrows*ncolumns bytes/unsigned char) I know how to do it in C or C++ using FILE handler by reading several lines first and read the binary block. But don't know how to do it in .Net. ...

How to extract innermost table from html file with the help of the html agility pack ?

I am parsing the tabular information from the html file with the help of the html agility pack. Now I can do it and it works. But when the table what I want to extract is inner most. Or I don't know at which position it is in nested tables.And there can be any number of nested tables and from that I want to extract the information o...

web.config + asp.net MVC + location > system.web > authorization + Integrated Security

Hi guys I have an ASP.Net MVC app using Integrated Security that I need to be able grant open access to a specific route. The route in question is '~/Agreements/Upload' and the config I have setup looks like this: <configuration> ... <location path="~/Agreements/Upload"> <system.web> <authorization> ...

Changing an Actual Parameter in C#

In C++, I have a function: void MyFunction(int p) { p=5; } Assume, I have: int x = 10; MyFunction(x); // x = 10 MyFunction(&x); // x = 5 How to archieve this in C# with condition: I create only one MyFunction. ...

.Net - using FileIOPermission with mask in file name

Hello! I would like to apply FileIOPermission on set of files using mask in file name, ex. on all txt files in folder C:\TMP: [type: FileIOPermission(SecurityAction.PermitOnly, Read = @"C:\TMP\*.txt")] class SomeClass { static void testPermissions() { Console.WriteLine("allowed action"); File.OpenRead(@"C:\TMP...