.net

Attempt to use DLL results in error.

I am using a library (DLL) that uses the Oracle.DataAccess DLL to connect to the database. I am doing in in C# .NET framework 3.5 When I attempt to compile, the compilation takes place, but the executable throws this error message. Could not load file or assembly 'Oracle.DataAccess, Version=2.111.7.20, Culture= neutral, PublicKeyToken=...

Convert numbers to time?

Is there a slick way to convert simple numbers (Army time included) to a time format (am, pm format)? I can do the tedious approach, but I was just wondering if there was another way 0800 => 8:00 am 2317 => 11:17 pm ...

How to avoid duplicate form creation in .net winform?

i am using .net win forms my mdi parent form contains the menu. If clicked the menu the form will be displayed. Up to now no problem. > UserForm uf = new UserForm(); uf.Show(); uf.MdiParent = this; If i click the menu again another duplicate of the form created how to solve this issue? ...

Defining custom attributes in CIL

What is the syntax for defining an array literal in CIL for the purposes of decorating a member with a custom attribute? I am writing some .NET code in CIL (using ilasm.exe to compile it) and I need to decorate a method with a custom attribute. The constructor for that attribute takes an array of integers as its only parameter. How can ...

Is it kosher for me to use HTMLAgilityPack in my free open source C# library?

I'm going to make a movie site scraping library that's free and open source. I want to use HTMLAgilityPack to easily parse web information from HTML source code, but I'm not sure if I legally can? Can I use this library in this way? Thank you. ...

What is a good practice for handling SQL connections within a WCF call?

Suppose I want to create a (stateless) WCF service with three methods exposed on an endpoint: performSqlOperationA(), performSqlOperationB(), and performSqlOperationC(). Each method inserts data into a SQL database. The way I've seen things done at my office, each method would begin with code to initialize a SqlConnection object. Each...

Webservice with .NET

Hi, I have an application that when run as a windows application takes around 4 secs to compute, but when run as a webservice, it takes a long time to compute (until a timeout). Do you have any idea what the problem might be? I am assuming that since the code is exactly the same, there are no problems such as infinite loops ..... it se...

Is it possible to decode and recompile flash using c#?

I'd like to decode a SWF file into its base FLA file and then recompile that back into an SWF. Can this be done using C#? ...

Cannot convert type 'string' to 'HtmlAgilityPack.HtmlDocument'?

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using HtmlAgilityPack; namespace sss { public class Downloader { WebClient client = new WebClient(); public HtmlDocument FindMovie(string Title) { //This will be implemented later on, it w...

How can I verify occurence of an alert using Microsoft.Web.Testing.Lightweight?

If anyone is using the Microsoft.Web.Testing.Lightweight framework, what's the technique for verifying that an alert has occurred? The documentation on exactly what methods are available and how they work is pretty sparse. It consists mostly of examples, and I can't find any examples that are doing what I'm trying to do. ...

WPF TabControl/ScrollIntoView Issue

Hi, I have a TabControl with two tabs containing lists that should always be scrolled to the bottom: <TabControl> <TabItem Header="Tab1"> <ScrollViewer VerticalScrollBarVisibility="Auto"> <ListBox x:Name="List1"> <ListBox.ItemTemplate> <DataTemplate Dat...

How can I extract things from Divs using HTMLAgilityPack?

I'm learning how to use the library for the first time and would like some help. Consider I have this somewhere in my HTMLDocument: <h1>Casablanca <span>(<a href="/year/2010/">2010</a>) <span class="pro-link"><a href="http://pro.imdb.com/rg/maindetails-title/tconst-pro-header-link/title/tt1226229/"&gt;More at <strong>IMDbPro</strong></...

Compiling code at runtime, loading into current appdomain but Type.GetType cant see it.

Hi Im compiling some code at runtime then loading the assembly into the current appdomain, however when i then try to do Type.GetType it cant find the type... Here is how i compile the code... public static Assembly CompileCode(string code) { Microsoft.CSharp.CSharpCodeProvider provider = new CSharpCodeProvider(); ...

Should view render menus or master pages

I've developed my own custom users and roles objects using ActiveRecord that do NOT extend the default Asp.Net providers and therefore I can't get the user from the HttpContext. I can create a custom htmlhelper to render menus but should my views render the menu or the master page? If it's the master page how can I pass to the custom h...

What is the fastest way to get a DataTable into SQL Server?

I have a DataTable in memory that I need to dump straight into a SQL Server temp table. After the data has been inserted, I transform it a little bit, and then insert a subset of those records into a permanent table. The most time consuming part of this operation is getting the data into the temp table. Now, I have to use temp tables,...

StringTemplate: Loading a Template from disk?

I am using StringTemplate in c# and following code to load a template from a subdirectory of my application. StringTemplateGroup group = new StringTemplateGroup("myGroup", "/tmp"); StringTemplate query = group.GetInstanceOf("Sample"); query.SetAttribute("column", "name"); Console.WriteLine(query); I have a template file Sample.st in t...

Download file using webclient

I try to download a file from https site and every time the file is saved to my machine it is only 1KB. The file is supposed to be 1MB. I am using Webclient. string strFile = @"c:\myfile.txt"; WebClient wc = new WebClient(); wc.Credentials = new System.Net.NetworkCredential("userid", "pw"); wc.DownloadFile("https://www.mysite.come/myfil...

Why is my Type.GetFields(BindingFlags.Instance|BindingFlags.Public) not working?

My code can see the non-public members, but not the public ones. Why? FieldInfo[] publicFieldInfos = t.GetFields(BindingFlags.Instance | BindingFlags.Public); is returning nothing. Note: I'm trying to get at the properties on the abstract class as well as the concrete class. (And read the attributes as well). The MSDN example w...

Put buttons inside ListBox [WPF]

I want to create list of buttons, and i want buttons to spread across the list item space. Here is what i have: <ListBox Margin="44,54,134,0" Name="listView1" Height="64" > <Button Height="20"></Button> <Button Height="20"></Button> </ListBox> Result is: First pic I want something like second pi...

TraceSource.TraceTransfer vs TraceSource.TraceEvent(TraceEventType.Transfer ...

When using System.Diagnostics TraceSource for logging/tracing, is there a difference between using TraceSource.TraceTransfer and TraceSource.TraceEvent(TraceEventType.Transfer, ... ? In our environment, we will be developing a number of services that will communicate via WCF. We are also evaluating what platform we should use for loggi...