|
I assume you are talking about C# client side comparing with DataTable object(s).
It that is the case you should check this: www.dotnetperls.com/datatable-compare-rows
|
|
|
|
|
I didn't undersrand this code, is it for both moving polygons, (I said both)
bool AxisSeparatePolygons ( Vector N, Polygon A, Polygon B, Vector Offset, Vector Vel, float &t, float tmax)
{
float min0, max0;
float min1, max1;
CalculateInterval(N, A, min0, max0);
CalculateInterval(N, B, min1, max1);
float h = Offset dot N;
min0 += h;
max0 += h;
float d0 = min0 - max1; // if overlapped, do < 0
float d1 = min1 - max0; // if overlapped, d1 > 0
// separated, test dynamic intervals
if (d0 > 0.0f || d1 > 0.0f)
{
float v = Vel dot N;
// small velocity, so only the overlap test will be relevant.
if (fabs(v) < 0.0000001f)
return false;
float t0 =-d0 / v; // time of impact to d0 reaches 0
float t1 = d1 / v; // time of impact to d0 reaches 1
// sort the times.
if (t0 > t1)
{
float temp = t0;
t0 = t1;
t1 = temp;
}
// take the minimum positive
taxis = (t0 > 0.0f)? t0 : t1;
// intersection time too late or back in time, no collision
if (taxis < 0.0f || taxis > tmax)
return true;
return false;
}
else
{
// overlap. get the interval, as a the smallest of |d0| and |d1|
// return negative number to mark it as an overlap
taxis = (d0 > d1)? d0 : d1;
return false;
}
}
it will only calculate time of velocity to overlap one of them to the other not both, but my exe make the right moment of collision, how that happens in sat? calculate next frame for both and use thales equation, because that's what I do.
from http://elancev.name/oliver/2D%20polygon.htm[^]
|
|
|
|
|
Is this C++ code?
(The float &t is clearly NOT C#)
This is in the wrong forum.
It should be in: C / C++ / MFC[^]
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G.K. Chesterton
|
|
|
|
|
anyway I can answer my post, it was the relative velocity, that make the right moment yep
|
|
|
|
|
Hi All,
Greetings!!.
I have got a requirement where in i need to write a C# code which should do the following tasks.
1) Pushing the files from ETL landing zone to Share point site(2013 version).
2) Once the files have been copied a mail has to be send to group of people with that share point URL.
This is a bit urgent.
Hence immediate response along with the step by step source code would be highly appreciated.
Thanks in advance.
Regards,
Nanda Kishore.
|
|
|
|
|
Naga Nanda Kishore wrote: Hence immediate response along with the step by step source code would be highly
appreciated. You are paying as much as the others and are equally important as everybody else; it is not urgent to me.
Having an alert mailed of a library changes should be simply a matter of configuration. Since I don't know what ETL is (and I'm too lazy to Google) I can't say how to get that into a library. Still, you could simply take the webservice (sharepoint has those), upload it and mail some list yourself.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
It doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.
But be aware: you get what you pay for. Pay peanuts, get monkeys.
And BTW: It may be urgent to you, but it isn't to us. All that your stressing the urgency does is to make us think you have left it too late, and want us to do it for you. This annoys some people, and can slow a response.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Use C# and the SharePoint client side object model (CSOM).
If you get it right the first time, it should take about a month to build.
|
|
|
|
|
Gerry Schmitz wrote: it should take about a month to build I could do it in half that time, with twice the amount of bugs
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Using the samples, yes. A new or existing data model? Maybe. No SharePoint experience? Good luck.
|
|
|
|
|
..wasn't intended seriously, but since I also confuse them often, a serious response;
Gerry Schmitz wrote: Using the samples, yes. Ofcourse.
Gerry Schmitz wrote: A new or existing data model? Maybe. If you change the specs, then either the deadline or the price moves.
Gerry Schmitz wrote: No SharePoint experience? Some, that is why I said "twice the bugs".
Your chances of a succesfull demo in that case would equal zero; "some" means that there is always a prominent bug during a demo.
..and a similar big one right after the first release
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I was being rhetorical and not addressing anyone in particular
Just saying there are other considerations like data integrity, external user authorization, error handling and recovery, SharePoint "lists" maintenance ... which are all reflected in the code base.
|
|
|
|
|
I've had no problem in the past using WCF's DataContract/DataMember Attributes and serializing to XML with complex objects, including generic Dictionaries. But, after a few hours of reading up on WCF serialization, and reading posts on the usual places, I am stuck.
Here's a (down to the bare-bones for the sake-of keeping this short, .NET 4.5 code) example illustrating what I am trying to do.
using System;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.IO;
namespace WhatEver
{
public interface ISomeInterface
{
DateTime Date { set; get; }
}
public class BunchOfISomeInterface : Dictionary<Type, List<ISomeInterface>>
{
}
[DataContract]
public classLite : ISomeInterface
{
[DataMember]
public DateTime Date { set; get; }
}
[DataContract]
public classRegular : ISomeInterface
{
[DataMember]
public DateTime Date { set; get; }
[DataMember]
public extraString { set; get; }
}
public static class WriteMe
{
private static DataContractSerializer serializer;
static string filepath = @"C:\test.xml";
public static void Write(BunchOfISomeInterface bunch)
{
using (FileStream writer = new FileStream(filepath, FileMode.OpenOrCreate, FileAccess.Write))
{
serializer = new DataContractSerializer(typeof(BunchOfISomeInterface));
serializer.WriteObject(writer, bunch);
}
}
}
} If you call/use the above code using this in some .NET Class:
using WhatEver;
private void SomeTestClass()
{
BunchOfISomeInterface currentBunch = new BunchOfISomeInterface();
Lite lite1 = new Lite();
lite1.Date = DateTime.Now;
Regular regular1 = new Regular();
regular1.Date = DateTime.Now;
regular1.extraString = "extra";
currentBunch.Add(0, new List<ISomeInterface>());
currentBunch[0].Add(lite1);
currentBunch.Add(1, new List<ISomeInterface>());
currentBunch[1].Add(regular1);
WriteMe.Write(currentBunch);
} You'll get this error:
"An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in System.Runtime.Serialization.dll
Additional information: Type 'WhatEver.Lite' with data contract name"
I've tried several things here:
1. putting the [DataContract] Attribute on BunchOfISomeInterface: that gives an error that Bunch... cannot be serializable.
2. putting [DataContract] [KnownType(typeof(BunchOfISomeInterface))] Attributes on WriteMe: doesn't change the error.
3. I tried changing the ISomeInterface to be a Class rather than an interface: same error; that surprised me:
[DataContract]
public class ISomeInterface
{
[DataMember]
public DateTime Date { set; get; }
} That results in the same error message.
This thread on StackOverFlow suggests that you can't serialize Interfaces: [^], but I am not at a level with C# that I can grok if that's relevant here.
In other experiments I am getting the error: "Type 'System.RuntimeType' with data contract name"
thanks, Bill
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
modified 14-Sep-15 11:18am.
|
|
|
|
|
I don't know WCF, nor the DataContract, but..
..as which type of Duck would I deserialize an IFlying interface?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi, Eddy, thanks for the "moral" support
Once you start using WCF's DataContract and DataMember Attributes to serialize/de-serialize, I predict you'll have a mighty "aha" moment, and never use any other technique. Just, as I found out the hard way, never think about using them to serialize some data collection of instances of an Interface.
By using the 'EmitDefaultValue option on the Attribute
[DataMember(EmitDefaultValue = false)]
public string OriginalValue { set; get; }
You can control whether the serialized file will contain, or omit, writing any description of a field if the field's value is the default value for that Type.
cheers, Bill
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
BillWoodruff wrote: Once you start using WCF's DataContract and DataMember Attributes to
serialize/de-serialize, I predict you'll have a mighty "aha" moment, and never
use any other technique. I like how all those different techniques aren't easily interchangeable.
BillWoodruff wrote: Just, as I found out the hard way, never think about using them to serialize
some data collection of instances of an Interface. Dunno if WCF supports it, but if the objects in the collection are serializable, then the collection is serializable.
..but you will have to know what type you actually are; the cannot be serialized as being IFlying, it has to be a MallardDuck or something. Then at deserialization you know what to recreate; since the type did not change, it will still have the same interface and can be added to a list.
BillWoodruff wrote: You can control whether the serialized file will contain, or omit, writing any
description of a field if the field's value is the default value for that Type. I'll give a try next time I need to serialize a POCO at work
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The concrete classes implementing ISomeInterface have to be known on both the server and the client. All those types which can be used here must be listed with a ServiceKnownType attribute.
And I'd suggest to replace typeof(BunchOfISomeInterface) with bunch.GetType() .
|
|
|
|
|
Bernhard Hiller wrote: And I'd suggest to replace typeof(BunchOfISomeInterface) with bunch.GetType() .
Why? Unless you're using a derived class, they'll both produce the same output, but the GetType call will be slower than the typeof call.
(See Jon Skeet's SO answer[^] for a benchmark.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks, Richard,
Of interest to me is that if you do use the technique of creating a field with a reference to the Type as Skeet suggests:
private static readonly Type BunchType = typeof(BunchOfStuff); While there's no problem using this as the 'Type argument to create a new 'serializer, if you are de-serializing, none of these will work:
public static Dictionary<string, List<Stuff>> Read()
{
using (FileStream reader = new FileStream(filepath, FileMode.Open, FileAccess.Read))
{
serializer = new DataContractSerializer(BunchType);
return (Dictionary<string, List<Stuff>>) serializer.ReadObject(reader);
} So, that's two places you've got to use the 'naked' Type declaration.
Perhaps you are aware of another method to avoid writing the 'naked' Type ?
cheers, Bill
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
You should be able to use:
public static BunchOfStuff Read()
{
using (var reader = File.OpenRead(filepath))
{
var serializer = new DataContractSerializer(BunchType);
return (BunchOfStuff)serializer.ReadObject(reader);
}
}
which at least avoids repeating the generic type definition.
However, there's no way to define a variable/field/parameter/property/return type using a type stored in another variable. The content of BunchType isn't known until run-time, but the return type needs to be known at compile-time.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks; what I can see (verified by experiment) is that if what you are serializing is a Class with the [DataContract] Attribute, you are correct.
The reason why I could not make that work is (hypothetically) that I was serializing a data-structure, not a class instance.
I'm going to assume that standard/best practice is to serialize a Class instance, and use ... that.
cheers, Bill
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
Thanks for replying, Bernard. I am just doing straightforward coding in .NET here, no client, no server.
After far too much wasted time, I have concluded that my question here is stupid in 2 ways:
1. experimentation suggests you can never use WCF to serialize some whatever/collection of instances of Interfaces, period.
2. what I wanted to achieve can be easily done by using the optional 'EmitDefaultValue parameter to the 'DataMember Attribute. I had just forgotten about that
cheers, Bill
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
hi,
I have written the following code to export data from Excel
string tempPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "Report.csv");
GView.SelectAllCells();
GView.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader;
ApplicationCommands.Copy.Execute(null, GView);
String result = (string)Clipboard.GetData(DataFormats.CommaSeparatedValue);
GView.UnselectAllCells();
System.IO.StreamWriter file1 = new System.IO.StreamWriter(tempPath);
file1.WriteLine(result);
file1.Close();
Excel.Application app = new Excel.Application();
Excel.Workbook workbook = app.Workbooks.Open(tempPath);
Excel.Worksheet ws = workbook.Worksheets[1];
I have 2 columns contain dates. both of them looks dd/MM/yyyy on the data grid which is correct.
once out on excel they change to american date format!?
the weired thing is, before the 13th of every month they are in american format. after the 13th they show UK format.
can some guru help me please
|
|
|
|
|
You need to format the cells in Excel.
|
|
|
|
|
I'm currently in a trade-school type program to become a .NET developer, and am in a 'project management' mini course that has a project that requires me and my teammates to gather 30 interviews with .NET developers. To simplify this, we have created a simple survey that asks the questions we need answered.
It would help us out a lot if you could give us some feedback! I promise this isn't spam! Here is a link to the survey (via Google Forms).
https://docs.google.com/forms/d/1A6c8YrD0zUZ-EEBeW4Coybum8dgwAXkFW-bZvg714Qc/viewform[^]
|
|
|
|
|