|
please delete duplicate entry
Jibesh V P
|
|
|
|
|
|
This isn't exactly a C# question is it?
|
|
|
|
|
I see you're pretty sharp today
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Hello,
How can I check if my graph stays connected, after removing one or more edges from it?
I try to implement Christofides heuristik, and in some cases my code works (that is when the graph dosent disconnect under the process). Unlucky that is not the case for all the graphs.
I use Dijkstras to check if there is a route from my last node in the edge I am to remove, to other nodes. But, how du I see that "this" edge if removed is disconnecting the graph, so I can leave the edge and try the next one?
Thanks...
It would be easier to understand if I could post a picture of the problem.
|
|
|
|
|
how about a visited bool flag on each node.
make it false on all node
then start visit the graph from a root to all its connected node recursively and set the visited flag to true for each visited node
when finished review all node, those with the false to false are disconnected, voila!
For your information this is roughly what the GC is doing to find object to collect!! ^^
|
|
|
|
|
I want to be able to tell what objects, connections, and/or files are still open when a C# 2008 windows application is about ready to end.
To be able to tell what objects or connections are open when the C# 2008 wndows application is about to end, I placed a break point in the code before the application ended.
I looked in the 'locals' window and the only thing I was was the parameters that were passed to the application when it first started.
Thus my question, is there other window(s) I can use to see what is open before the application finishes executing?
If there are other windows can you tell me what window(s) to use and give me an order of what is the best debug window to use?
|
|
|
|
|
I am sorry its really hard to understand the problems from your question.
Quote: I want to be able to tell what objects, connections, and/or files are still open when a C# 2008 windows application is about ready to end. was it a windows form application?
what do you mean by objects,connection and files?
was it database connections,and by files you mean files opened by your application?
Locals Window[^]- will display the variables which is local to the current context. which means if you put a break point in a method and you define 2 variables it will display only those two variables.
You can use the Watch window [^] to view contents of the member variable and its member if available
Jibesh V P
|
|
|
|
|
classy_dog wrote: I want to be able to tell what objects, connections, and/or files are still open when a C# 2008 windows application is about ready to end.
The IDE does not track which files you open your application opens.
classy_dog wrote: what is the best debug window to use?
There is no "best" debug-windows. Depending on what you're doing, you'd pick the appropriate window.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Source code:
XElement Listings = new XElement("Listings");
XNamespace root = "http://website.RFGCommonSpecListingSchema";
XNamespace xs = "http://www.w3.org/2001/XMLSchema";
XNamespace b = "http://schemas.microsoft.com/BizTalk/2003";
Listings.Add(new XDeclaration("1.0", "utf-8", null),
new XElement(xs + "schema",
new XAttribute("xmlns", root.NamespaceName),
new XAttribute(XNamespace.Xmlns + "b", b.NamespaceName),
new XAttribute(XNamespace.Xmlns + "xs", xs.NamespaceName),
new XAttribute("targetNamespace", "http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema"),
new XAttribute("elementFormDefault", "qualified"),
new XAttribute("attributeFormDefault", "unqualified")));
XElement Listing;
string command = getQuery();
using (SqlConnection sqlCon = new SqlConnection(connMain))
{
sqlCon.Open();
using (SqlCommand cmd = new SqlCommand(command, sqlCon))
{
using (SqlDataReader Row = cmd.ExecuteReader())
{
while (Row.Read())
{
featureIN.Clear();
#region XML build
Listings.Add(Listing = new XElement("Listing"));
Listings.Add(
new XElement("ListingKey", Row[3].ToString()),
new XElement("ListingIdentifier", Row[3].ToString()),
new XElement("Type", Row[4].ToString()),
new XElement("ProviderName", "CWS"));
result:
- <Listings>
="1.0"="utf-8"
<xs:schema xmlns="http://website.RFGCommonSpecListingSchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" />
<Listing />
<ListingKey>1311618</ListingKey>
<ListingIdentifier>1311618</ListingIdentifier>
<Type>Residential Sale</Type>
<ProviderName>CWS</ProviderName>
<Listing />
<ListingKey>1715675</ListingKey>
<ListingIdentifier>1715675</ListingIdentifier>
<Type>Residential Sale</Type>
<ProviderName>CWS</ProviderName>
<Listing />
I need the header tags above the 'Listings' tag like this:
="1.0"="utf-16"
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Listings">
<xs:complexType>
<xs:sequence>
<xs:element name="Listing" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
Anyone have a code that would work? Where am I going wrong with this?
|
|
|
|
|
You need a root XDocument to contain the XElement Listings . That is where the declaration and schema tags need to be. And I'd guess that you don't need the schema element, but put the namespace attributes on the Listings (you aren't declaring a schema here, and you can't have two root elements in a valid XML file):
XNamespace root = "http://website.RFGCommonSpecListingSchema";
XNamespace xs = "http://www.w3.org/2001/XMLSchema";
XNamespace b = "http://schemas.microsoft.com/BizTalk/2003";
XElement Listings = new XElement(root + "Listings",
new XAttribute(XNamespace.Xmlns + "b", b.NamespaceName),
new XAttribute(XNamespace.Xmlns + "xs", xs.NamespaceName),
new XAttribute("targetNamespace", "http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema"));
XDocument listingDoc = new XDocument(new XDeclaration("1.0", "utf-8", null), Listings);
XElement Listing;
string command = getQuery();
This gives the following XML:
="1.0"="utf-16"
<Listings xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema" xmlns="http://website.RFGCommonSpecListingSchema" />
The Listing element(s) will be contained in the Listings element (that I've shown as empty).
Be sure when you create the contained XElement (s) that you create them in the same namespace as the Listings element. I.e., new XElement(root + "Listing") or new XElement(root + "ProviderName") , etc.
|
|
|
|
|
|
ClosedXML won't work with an xls file:
Nope. ClosedXML only supports Excel 2007/2010 format (.xlsx).
There are various tools which support the xls format. For example:
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
my mistake thank you!
dev
|
|
|
|
|
In the past I have used NPOI for .xls and eeplus for .xlsx
xlsx has been around for a good while now and isn't going anywhere so if possible I would suggest insisting on .xlsx and using eeplus.
|
|
|
|
|
|
Thanks, but before I dive into it, which one of these ...
a. doesn't require client installation of driver library
b. if we do need driver library, 64 bit compatible? (For instance I heard Excel interop not 64bit friendly)
dev
|
|
|
|
|
|
how can I dedicate a Data source to a chart manualy ??
(by writing commands and not by wizard?)
tanx a lot.
|
|
|
|
|
|
How do you add the:
="1.0"="utf-16"
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://website.RFGCommonSpecListingSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
for the headers with Xelement?
|
|
|
|
|
by using the XmlSerializerNamespaces[^] you can add the namespaces to your Xmlheader.
sample:
XmlSerializer serializer = new XmlSerializer(typeof(OrderedItem));
OrderedItem i = new OrderedItem();
i.ItemName = "Widget";
i.Description = "Regular Widget";
i.Quantity = 10;
i.UnitPrice = (decimal) 2.30;
i.Calculate();
XmlSerializerNamespaces ns =
new XmlSerializerNamespaces();
ns.Add("inventory", "http://www.cpandl.com");
ns.Add("money", "http://www.cohowinery.com");
Stream fs = new FileStream(filename, FileMode.Create);
XmlWriter writer =
new XmlTextWriter(fs, new UTF8Encoding());
serializer.Serialize(writer, i, ns);
writer.Close();
Jibesh V P
|
|
|
|
|
Using XElement from System.Xml.Linq :
XNamespace root = "http://website.RFGCommonSpecListingSchema";
XNamespace xs = "http://www.w3.org/2001/XMLSchema";
XNamespace b = "http://schemas.microsoft.com/BizTalk/2003";
var doc = new XDocument(
new XDeclaration("1.0", "utf-8", null),
new XElement(xs + "schema",
new XAttribute("xmlns", root.NamespaceName),
new XAttribute(XNamespace.Xmlns + "b", b.NamespaceName),
new XAttribute(XNamespace.Xmlns + "xs", xs.NamespaceName),
new XAttribute("targetNamespace", "http://rfg.realogy.com/Btt/Listingfeed/Import/2011/07.RFGCommonSpecListingSchema"),
new XAttribute("elementFormDefault", "qualified"),
new XAttribute("attributeFormDefault", "unqualified"),
)
);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
How to put videos, with alpha channel, on the image using Windows Forms c#
|
|
|
|
|
I've been looking at a problem for the last couple of days, that hopefully someone has an answer for. When I get my variable (cr) as shown below, I can't use the variable and then step into the next method call and code that once worked is now not working. When I look into the class definition inside cr, it says "could not evaluate expression" edfed for the variable inside the class (cr).
I've searched the internet and found a couple of sources that seem to be saying that I have something that's null, but I'm not seeing why edfed would be null here.
http://stackoverflow.com/questions/9558498/could-not-evaluate-expression-activator-createinstancet[^]
This is where I obtain my class definition of cr:
cr = factory.GetCR(type);
I can show you the factory GetCR method, but I don't think there's an issue there:
public iCR GetCR(CRType type)
{
iCR cr = null;
switch (type)
{
case CRType.CR5:
cr = new CR5_new.CR5();
break;
}
}
In my CR5 class, this is how I define edfed. (It's possible that I could do something more in a C# way here and less of a C++ way like I'm familiar with; feel free to make suggestions):
using Sec_;
namespace CR5_new
{
public class CR5:iCR
{
Sec edfed = null;
public CR5()
{
edfed = new Sec();
System.Diagnostics.Debug.WriteLine("edfed definition: " + edfed);
}
...
I also tried defining edfed in CR5 as follows and get the same result:
using Sec_;
namespace CR5_new
{
public class CR5:iCR
{
Sec edfed = new Sec();
public CR5()
{
System.Diagnostics.Debug.WriteLine("edfed definition: " + edfed);
}
...
I'm hoping someone has a good suggestion of what I could do to fix this. It's really stumping us. Thanks.
|
|
|
|
|