.net

Bitwise operations in T-SQL

I have a bitmasked int field in my database. Usually I manage it through c# code, but now I need to flip a bit in the mask using T-SQL How do I accomplish the following: The bit i want to flip: 1 << 8 (256) The mask value before i flip: 143 The mask value after i flip: 399 I'm not exactly a bit-flipping wizard but this c...

How do I programatically save an image from a URL?

How do I progromatically save an image from a URL? I am using C# and need to be able grab images from a URL and store them locally. ...and no, I am not stealing :) ...

How to get the rowid back from an ExecuteOracleNonQuery in C#

I'm using an ExecuteOracleNonQuery in C# to INSERT a record into my Oracle database using a stored procedure but can't seem to get the ROWID to return. In C# ... using (OracleConnection oc= new OracleConnection(AppConfiguration.ConnectionString)) { OracleCommand myCommand = new OracleCommand("PKG_TEST.INSERT", oc); myComma...

get object type and assign values accordingly

I have an arraylist that gets different type of values in it, 1st value->string,2nd value-> datetime, 3rd value--> boolean and 4th value is int, how do I find thier type and assign those values accordingly, any help is appreciated:) here is my Code: foreach (object obj in lstTop) { if(obj.GetType() == string...

I can't turn off Request Validation for an ASP.NET MVC Controller

I am trying to turn off Request Validation for all action methods in a controller by doing this: [ValidateInput(false)] public class MyController : Controller { ... The reference I am using says this is possible and tells me to do it this way, but for some reason it's not working. If I submit any html (even a simple <b> tag) thro...

WinForms interthread modification

Whenever I want to modify a winform from another thread, I need to use ->Invoke(delegate, params) so that the modification occurs in the winform's own thread. For every function that needs to modify the gui, I need another delegate function. Is there some scheme which allows me to limit the number of delegate functions needed? I have...

Hosting a WCF Service to spawn local processes via remote command.

I have need for a work project to run a controller application on PC A, which farms out tasks to PC's B-E. Originally I was planning on using something like psexec or WMI to remotely spawn processes with parameters that then connect back to PC A via WCF, but now I'm leaning towards using WCF as a windows service on B-E and having A conne...

.NET / C# - Proper Method to Use Here - LINQ

I'm a total newb to LINQ. Here is the code I have so far: public class Folder { public Folder(string path) { string[] files = Directory.GetFiles(path); IList<FileInfo> fis = new List<FileInfo>(); files.SomeMethod(x => fis.Add(new FileInfo(x))); } } What is the correct method name to replace SomeMet...

What is the best approach to manipulate assets in Drupal from .Net application?

I'm beginning work on a project that will access a Drupal site to create nodes on the site. This includes file uploading, as the project is to allow people to upload pictures en mass to a Drupal site with minimal ado. Note that my application is written in .Net. What I would like to know is the best approach to achieve the same? Based ...

File logger in C#

I am looking for a .net class to deal with logging various information to a file. The logger should have timestamps, categories for the logged data (to be able to differentiate between notificiation and errors), severity levels for errors, to be able to split the log file after it exceeds a certain size. ...

I thought the managed heap grew dynamically?

If I'm understanding this correctly about garbage collection in .NET CLR, then GC occurs when space for a reference types allocation is needed but there is no more room on the managed heap. So does the managed heap have a limit as to how big it will get? Thanks. ...

How are regular expressions implemented in .NET? (C#)

I have just read this interesting article about the implementation details for various languages that support regular expressions. It describes an alternative implementation of regular expressions that uses non-deterministic finite automatons (NFAs) versus deterministic ones (DFAs). It claims that back-tracking DFA implementations (t...

LINQ to SQL (CE) speed versus SqlCe

I'm making an application that will analyze real-time data that has been stored to a SQL CE database. When I test the application as it is built now, with LINQ to SQL, I get slow results and I need to rethink how to do this. To save me some time, can I trust that L2S is just as fast as the 'old' SqlCe methodes were? I like L2S and would...

Can I catch a missing dll error during application load in C#?

Is it possible to catch the exception when a referenced .dll cannot be found? For example, I have a C# project with a reference to a third-party dll; if that dll cannot be found, an exception is thrown. The exception is a System.IO.FileNotFoundException, but I am unable to determine where to catch it. The following code did not seem t...

Loading large swf embeded swf file on an aspx page

Hi there, On the home page of one of our web sites we embed a .swf file which is essentially just marketing. Typicaly in the past they've been about 300kb, but the designer has passed us one to put up that is a little over a 1MB. What are the performance concerns with this? What should be used as a max size for these if there are con...

Converting an HtmlElement into an Image?

I'm using a WebBrowser control in VB.Net to load a website. At that point, the WebBrowser.Document.Images property returns a collection of HtmlElement that are considered images. What I'm trying to do at this point, is take a particular HtmlElement that represents an image and turn it into a System.Drawing.Image so that I can manipulat...

How to delete multiple rows based on a collection of non-primary key field items using LINQ-TO-SQL?

I have this columns id int primary key, code int not null I want to delete all items where code equals to one of the items in a IEnumerable<int> someEnumerable One possible way is using iteration. But I wanna do it without explicit iteration (for, foreach). Another way is by doing this: var result = db.table.Where(a => someEnumera...

Can NHibernate Criteria Pull From Cache

I'm loading a lot of data into the database with NHibernate. As I'm inserting, I want to check for duplicates. I call saveorupdate in each loop without flushing the session. Is there a way to query this session for duplicates without flushing? ...

How to determine the type of the returned value within the generic method

Hello to all, We've created a generic method like so: public TReturnType GetValue(string key) { var configurationParameter = (from cp in _repository.ConfigurationParameters where cp.ConfigurationParameterKey == key select cp).FirstOrDefault(); var returnValue (TReturnType)Convert.ChangeType(configurationParamete...

Data-Binding a WPF DataGrid Control to a System.Data.DataTable Object?

What do I need to do to get my WPF DataGrid control to bind to a DataTable object? I've been suffering over this for several days now. Even when the binding and the query both work correctly, and there is observable data in the table - nothing shows up in the data grid. My XAML code resembles this: <Window x:Class="DataGridTest....