« first day (901 days earlier)      last day (4273 days later) » 

00:05
@KendallFrey
I hear you are good with maths?
Depends who is asking? :D
Or what they're asking.
True enough.
@Pawnguy7 I'm better.
:D
00:06
@Pawnguy7 He is^
he has a degree or some sort of voodoo like that
Damn voodoo cost me lots of money
Did you have a question or something?
I just thought of something...
...
So did I.
Oh, yes, I had a question.
Given a set of points, how can I construct a bounding box that encloses them all in least room possible?
00:07
!!/listcommands
cc/listcommands
@Pawnguy7 I assume it's a rectangle? Can it be rotated?
I think you need to... "wake" him.
@KendallFrey the points in this situation belong to a polygon. I want a rectangular bounding box - 2D, as are the points.
Yeah, can it be rotated?
The polygon?
The bounding box.
00:09
Ah. Good. In this case, it will not be rotated, no.
So the top of the rectangle is in line with the highest point, the left is in line with the leftmost, etc.
Correct.
hmm?
@Pawnguy7 a set of points, or 4 points?
Does that answer the question?
No I think he's asking HOW
00:11
I explained how.
From a C# standpoint?
If he has trouble with more specific parts of the algorithm, he can ask.
The points of the polygon are of an undetermined count, but is theoretically indefinite.
I'm not about to just write his code for him.
Oh I thought you were a "code vending machine" :D
00:12
@Pawnguy7 That doesn't matter. All you need is a simple loop.
@Pawnguy7 so the problem is "given an indefinite number of points of a 2D (cartesian) plane, how do I connection those points such that the area is a minimum?"
You are saying, construct the points in that the given side is the most extreme point in that area?
@Pawnguy7 can it be a concave polygon, or will it always be convex?
convex always.
Loop through all the points and keep track of the topmost one. This will be the top of your rectangle.
@Pheonixblade9 I think you're waaaaay overthinking this.
00:13
@Pawnguy7 take the average of all of the points. That is your center point. Does that help?
I think I was thinking about another algorithm, as you descirbed it is should work and is easy.
@Pheonixblade9 I don't think so.
@KendallFrey you're thinking of a programming way to do it. I'm thinking of a maths way to do it
@Pheonixblade9 I don't think this is needed for this case, but I think I can actually use that later, so thanks.
Start by writing all of the points on a piece of paper and then grabbing your graphing calculator. This will be an n step process.
Do you have christmas ornaments available?
00:15
@KendallFrey it's not necessarily a rectangle.
@Pheonixblade9 I don't know what kind of math you are intending to use.
@Pheonixblade9 - He said 2D though. And he said it doesn't rotate. And he said "bounding rectangle".
@Pawnguy7 what is this for?
Seems pretty straightforward
7 mins ago, by Pawnguy7
@KendallFrey the points in this situation belong to a polygon. I want a rectangular bounding box - 2D, as are the points.
00:16
@CCInc collision detection stuffs.
Maybe I'm not understanding what he's asking. Can you please restate your question in full, @Pawnguy7?
hmm, ok.
As I understand it, Kendall has arrived at the answers, and it was simpler than I thought - I was thinking of something else. I believe it is solved at the moment, I will try to implement and get back to you.
can you draw an example? draw.to/new
hmm, ok. I am concerned about the speed of his solution. Bounding boxes are expensive.
Should I sigh or facepalm?
@TravisJ yes.
00:17
aww kendall, I was hoping your bot was on
It... what?
There are established bounding box algorithms... they are fast, and you should use them :)
Must've fallen asleep.
It showed it was on.
I remembered what I was thinking of.
For generating random "Asteroid" polygons, I had planned to generate random points within a given box.
00:18
oh, here's a question. Is the rectangle always going to be parallel with the X/Y axis?
never fear o(n)
or can the bounding box rotate?
The algorithm I was thinking of would be to determine what order to link and which points to make the polygon that emcompasses all the pointers.
You weren't paying attention, were you?
00:19
I think you are overthinking it, Pheonix.
@Pawnguy7 no, I'm just thinking about it from a maths (generic) perspective
that's why I'm asking a lot of questions
@Pawnguy7 the number one performance tip: only loop through the points once, and keep track of all the edges at once.
xmin, xmax, ymin, ymax. One iteration of the full set.
(xmin,ymax) -> (xmax,ymax)
(xmin,ymin) -> (xmax,ymin)
4 points, O(n) since finding min and max are low cost, rectangle win.
I was thinking, hold, say, four ints, for each side.
@Pheonixblade9 No, you're asking because you weren't paying attention.
@Pawnguy7 Exactly!
00:20
And for each point, if it is beyond them, set the according int, then make the box later.
shrug ok, ignore the guy with a math degree >.>
if you have performance problems:
In computational geometry, rotating calipers is a method used to construct efficient algorithms for a number of problems. The method was first used by Michael Shamos in 1978 for determining all antipodal pairs of points and vertices on a convex polygon. The term "rotating calipers" was later coined in 1983 by the computer scientist Godfried Toussaint, who applied this approach to a number of other geometric problems. The name comes from the analogy of rotating a spring-loaded vernier caliper around the outside of a convex polygon. Every time one blade of the caliper lies flat against an ...
xmin = maxint. if newx < xmin, xmin = newx etc.
Dude, you are making waaaaaaaaaaay too complex.
or:
13
Q: How to find an arbitrarily oriented minimum bounding box in c++

VercasSo let's say I have a list of N pairs of positive long coordinates (points). How do I find the smallest rectangle containing all of them? The rectangle can also have floating coordinates and be rotated in any angle and further shrunk... Not just X, Y, Width and Height! I already know how t...

I think I was thinking of convex hulls.
00:23
Oh. Did you decide they were too complex?
@Pheonixblade9 No, he said rotation is not required.
ok, that makes the problem a lot easier, then :)
On a related note, have you tried to use static in order to avoid using the new keyword?
@Pheonixblade9 Dude, we told you that like 3 or 4 times and you only get it now?
@KendallFrey sorry, I'm trying to do my job while I answer...
That can be complex.
So what you are trying to say is... what?
00:25
@Pheonixblade9 I bet you're not doing well at that either.
Sorry, the expert bot taught me how to troll
@KendallFrey nope. I should really pick one or the other, but I like helping you guys.
Stupid bot.
Therefore, abandon your work.
But I'm doing TDD for this project... so it should be fine, right?
00:26
I think so. What you need to do is inject bacon into the constructor.
YES.
Also.
Sometime later, not now, I need to figure out how to check if polygons collide.
Polygons, or bounding boxes?
Polygons.
Neither rectangles or circles would look quite right I fear.
Convex, or concave?
Convex.
Actually...
Hm.
How much of a difference does it make?
Quite a bit.
convex collision is a fair bit simpler.
for simple nonconvex polygons:
double determinant(Vector2D vec1, Vector2D vec2){
     return vec1.x * vec2.y - vec1.y * vec2.x;
 }

 //one edge is a-b, the other is c-d
 Vector2D edgeIntersection(Vector2D a, Vector2D b, Vector2D c, Vector2D d){
     double det = determinant(b - a, c - d);
     double t   = determinant(c - a, c - d) / det;
     double u   = determinant(b - a, c - a) / det;
     if ((t < 0) || (u < 0) || (t > 1) || (u > 1)) {
         return NO_INTERSECTION;
     } else {
         return a * (1 - t) + t * b;
     }
for convex: Draw a line from the center of both. Find the edge the line breaks on both. Determine if those lines are intersecting.
00:31
I think asteroids would look neat if they could be concave, but having more radial convex wouldn't be that much of a change.
I'm pretty sure the original asteroids game didn't use concave collision.
If I had to guess, I'd say it used circles.
Probably.
@KendallFrey just sprites.
Your physics doesn't necessarily need to match your UI.
@Pheonixblade9 How does sprite collision work?
Nice concave asteroids anyway :D
00:33
@KendallFrey it just makes it a lot easier. You can use rectangles/squares for everything and check for collisions that way.
I guess I could use a smaller circle on the ship...
Think using a frameset of many static images, rather than drawing stuff dynamically.
Think I should just use circles to check?
Very few games use the same shape for physics and UI. Physics is almost always simpler.
@Pawnguy7 I think so.
00:34
@Pawnguy7 circles are harder, I'd rather use a combination of rectangles than use a circle
for asteroids, circle is easy, I am more concerned about the ship though.
It is... rather pointy.
The ship is small enough that it won't be a big difference.
It's also simple enough that you could create a triangle collision box fairly simply.
box would probably be better than circle in this case.
It might be useful to have two collision shapes, and have it check the simpler, larger one first.
full radial then box?
00:37
I was thinking box then triangle.
How do you do triangle collisions?
Because of the shape of the triangle, you could use some fancy math instead of a full-blown polygon collision.
So that the accuracy of the ship collisions are as accurate as the thing it is colliding with?
I can't explain what I'm thinking of, and it's probably not important anyway.
00:39
@Pawnguy7 Well, if one of your bodies has an inaccurate collision box, all its collisions will be inaccurate.
On a purely visual basis, would you prefer convex or convave asteroids?
Concave.
Use concave polygons for the UI, but use circles for the physics.
Sounds like a plan.
I guess all that leaves is how to generate it in a...
correct order.
And mostly radial.
Generate what?
The asteroid shapes.
00:42
Just create some decent-looking polygons at compile time, like the original game.
As in hardcoded, or as in generate them dynamically, but before any gameplay?
Hardcoded.
There's no need to use code to generate the asteroids.
It appeals to my random generation senses :D
However, making them mostly radial in nature would be a bother, I think you are right.
If you want to, go right ahead!
I used random generation for my maze game.
It worked beautifully.
I think what I will do is, get the things working as we have discussed (mostly the simpler things), and then if I want to, I will explore these new areas.
00:47
You are a very intelligent newbie :)
I feel like that is not the same perspective as the lounge :D
Much better than people who can't ask a question, and can't accept an answer.
Wait... who cannot ask questions?
Hellow
I'm not going to mention any names, for example, Peter Jennings.
00:51
The bounding box algorithm appears to be working good.
Your left side is off, and it looks like the top is a bit too.
Oh.
Somehow I didn't notice that -_-
@KodeSeeker hi
@CCInc sup
00:53
meh
Oh.
I remembered why I thought it worked.
Before, I had forgot to incriment the box by the center position of the polygon, and so I couldn't see the left side.
@CCInc long time no speak
if (points[i].Y < box.Min.Y)
box.Min.Y = points[i].Y;

if (points[i].Y > box.Max.Y)
box.Max.Y = points[i].Y;


if (points[i].X < box.Min.X)
box.Min.X = points[i].X;

if (points[i].X > box.Max.X)
box.Max.X = points[i].X;
@jozefg yah indeed
I don't see where it would be though. Each point[i] or box.Min(or Max) is a vector with an X anad Y
box.Min is top left, box.Max is bottom right.
00:56
how ya been?
I bet box.Min is being initialized with values that are smaller than the points.
both min and max were set to 0 in all components.
I think you are right.
That is invalid, isn't it.
But if I set it to a point, it will correct itself.
Ideally, you would set Min to infinity before starting.
That would work. And max to... negative infinity? Hm.
Yeap.
Dear credit card company,

Please do not send me an email informing me my bill is due after I have already paid it.

Sincerely,
Kendall Frey
01:01
Yep, you were right.
Works good, this time.
Not sure why I didn't think of that. I guess the "always initialize your variables to zero" is getting to me :D
Always initialize your variables to a meaningfully meaningless value.
Unless they really should be 0 :D yes, your right.
I recall a tutorial saying that. Something like setting numCats to -1.
Anyone got thoughts on this one
0
Q: Error trying to validate XML against XSD

KodeSeekerIm trying to create an XML validator using the following code static void Main(string[] args) { string xmlUri = File.ReadAllText("G:\\test.xml"); Console.WriteLine(xmlUri); string xsdUri = File.ReadAllText("G:\\test.xsd"); Console.WriteLine(xsdUri); Co...

Because, you know, it is normal to have a negative number of cats.
@Pawnguy7 That sounds good. That way if a stray cat comes around, there are still no cats.
01:04
Was an XSD that thing that is sort of a formatting skeleton for XML? Say, it must containX, which has attribute Y, etc?
Yes.
> the XML perfectly conforms to the XSD
Prove it.
That is a pretty good example of the one thing I didn't like about geometry.
What if the site is wrong?
I give up
Multiple sites?
01:11
It's probably right, but to be sure, another pair of eyes would help.
well I was hoping to get those from SO .D:
You didn't even share your XSD.
01:28
@KendallFrey check again.
Anybody here used XNA?
@Pawnguy7 yes, but it's dead now.
hi
I'm going home. It's 6:30. Later kids.
Ah. Bye.
01:35
@Pheonixblade9 laterz
man i have a problem and i dont even know how to ask this shit
im binding a textbox to a dataset table field, e.g. txtFirstName.DataBindings.Add(New Binding("Text", dsCustomers, "Customers.FirstName"))
when they click an edit button, i allow the fields to be editable, when they click cancel i want to get rid of the changes, so i figured i could just set the data table window back to its original position, but the changes aren't discarded, i even tried repopulating the datatable
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
Dim strSQLCmd As String = "Select * From Customers"
DBAdaptCustomers = New OleDbDataAdapter(strSQLCmd, strConn)
dsCustomers.Tables.Clear()
DBAdaptCustomers.Fill(dsCustomers, "Customers")
BindingContext(dsCustomers, "Customers").Position = currentPosition

ToggleButtons()
ToggleTextBoxEnabled()
txtId.Enabled = False
End Sub
what the fuck is it doing
02:09
@marhs08
 
1 hour later…
03:35
hellow
hey @CCInc, you around mate?
Ish
Ish? :P
@CCInc could we talk a bit , privately?
 
2 hours later…
05:27
hi, after loading dropdownlist with cascading dropdownlist with web services... i want to find the dropdown count, is it posible in page load event
which page event will fire after loading CascadingDropDownNameValue() web method
 
2 hours later…
07:15
wassup guys . dont see you around anymore
HI
i want to print crystal report on custom paper size (A6)
but print always take printout on A4 Size
07:49
Hi guys :)
08:02
posted on April 04, 2013 by Scott Hanselman

I have a "whenever I get around to doing it" Newsletter of Wonderful Things. Why a newsletter? I dunno. It seems more personal somehow. Fight me. Still, it's one more site to check and it's a hassle for some of you  Dear Readers. Therefore, I will still do the newsletter, but I'll post each newsletter to the blog some weeks later. You can view all the previous newsletters her

 
1 hour later…
09:18
hello
anyone here can help with an asp question
Hi - bit of advice please. Got a .csv file I want to query on asp.net... best way?
Can anyone help me about twitter status update with linqtotwitter in a Windows 8 metro app?
09:42
C# Wiki Page Version 2 - More content, still might get more features.
2
bon jour peeps
Bonjour :)
10:44
Hello
10:58
hello
can someone help me with clearing the forms in my asp.net page?
user142019
Good hello.
Too many greetings here
user142019
@Sisyphe Console.WriteLine("Hello, world!");
Im using a dropdownlist to get different data from the database into a form of textboxes and dropdownlists
but sometimes the dropdownlist has data which no data stored inside yet, so i want to clear all my form, so there is not info inside textbox or dropdownlist from the previous item i chose from my main-dropdownlist
user142019
11:15
I should actually start working on my compiler and complete it at least to the point where it can generate machine code for a hello world program.
bsically like this
protected void dropdownmain(){
if(!IsPostBack){
getAlldata();
}else
{
clearAll();
}
}
user142019
Indent or no.
11:38
Hi does anybody has an idea on Amazon MWS
i had a small doubt in it regarding code
hello
11:51
Does anyone know the reason WHY Nullable<T> allows null to be assisned to their objects?? because Nullable<T> itself is a struct. And struct cant be assigned Null.
Nullable<T> is not a simple struct, it's a generic struct
So is there any thing special about generic structs?? I mean could they allow null?
Are you there @Sis
12:12
A type is said to be nullable if it can be assigned a value or can be assigned null, which means the type has no value whatsoever. Consequently, a nullable type can express a value, or that no value exists. For example, a reference type such as String is nullable, whereas a value type such as Int32 is not. A value type cannot be nullable because it has enough capacity to express only the values appropriate for that type; it does not have the additional capacity required to express a value of null.
The Nullable class provides complementary support for the Nullable<T> structure. The Nullable class supports obtaining the underlying type of a nullable type, and comparison and equality operations on pairs of nullable types whose underlying value type does not support generic comparison and equality operations.
Straight from the docs
:)
So you mean that assigning null to nullable object is because it overloads operators? like == operator?
Think of it as a wrapper for a value type
Guys, is there an easy way to fill up a List from another list with specific start and end index ? I have a list that has 512 items in it, I want to create another list that should contain for example items of indexes betweeen 100 and 200 of the other list.
myList.Skip(100).Take(200).ToList() ?
Take 100
sorry
hmm let me try
12:21
The power of LINQ
user925777
12:32
hey, how is this possible? puu.sh/2tFvf "_selectedMovingPlatform" is null and throws an exception even though I have a null check right over it
user925777
it works fine without that "_world.UnselectGameObjects();" line, but I cant see how it could affect the value of a local variable
user925777
oh my god
user925777
i just realized
user925777
:|
user925777
yeah... when "World.SelectedGameObject" event is fired, the value of "_selectedMovingPlatform" is changed
user925777
12:34
..
:)
user925777
I was stuck on that for like 30min and already started googling if there was some bug in C# or something :)
Occums Razor ?
:D
13:15
@Saeid87 did it work?
13:43
@Darek Well it compiles and seems to be working, but there are some problem with my own List I'll have to figure that out first :D Here is the related question mayeb you have some ideas? stackoverflow.com/questions/15812123/…
> starting and ending with byte 126
Does that mean the packet is one one byte?
Or does it mean the value?
noo
its like 126 69 ..............som more bytes .......126
packet is a byte sequence
Is it like 126 this is packet a 126 this is not a packet 126 this is packet b 126 ...
but it starts with 126 and ends with 126
Kendall to the rescue as always :D
so in that example data you see in the question this is the byte sequence I want to have :
Is that how the packets are organized?
13:47
126 69 0 0 1 0 2 2 34 6 0 5 232 125
yes
sorry
126 69 0 0 1 0 2 2 34 6 0 5 232 125
cant paste it hereI will update the questionnow
That situation must suck if you ever happen to have 126 in the sequence of data you want to send.
noo
if 126 is inside the packet it will be replaced by 2 bytes like 126 96
the protocol will take care of that
I mean if 126 is happen to be inside the packet, it will be replaced by 2 other bytes
What a crazy protocol.
is one of those 2 bytes a 126?
its in the protocol
yah
13:51
Well, that's fucking stupid.
@KendallFrey no if 126 happen to be inside, its converted to 2 other bytes
I ll give a link to protocol now just wait :D
Yes, what are those bytes?
Is it 126 96?
What protocol is this?
its Zigbee
@KendallFrey No let me correct myself, if any byte inside the packet, except the starting and ending , be 126 it will be escaped with 2 other bytes that I dont remembe, but certinately 126 will not be inside the packet data itself
Oh, good.
I could write two methods that would return an IEnumerable<IEnumerable<byte>>
7e 40 09 00 be ef 05 7d 5d 06 01 02 03 04 05 7e

Note that the group 0x7d is escaped to 0x7d 0x5d. The protocol field (P) is 0x40 (64), corresponding to SERIAL_PROTO_ACK (in Serial.h).
Are you familiar with yield?
lazy coding? well I have heard of it but never used it
maybe its a good time to go with that :D
13:57
you are the boss
posted on April 04, 2013 by Eric Lippert

The C# compiler has a /langversion switch that is rarely used; most people do not know what it is for, and if asked to guess, most guess wrong. So let me disabuse you of your wrong guess right away: the … Continue reading →


« first day (901 days earlier)      last day (4273 days later) »