WTF?


WTF? and Software Development07 Dec 2007 11:44 am

Most of the time.

So, recently we’ve had a project involving x & z motion, using a few servo drives and some controllers.

The problem came up, that we needed to average 3 angles together, to find a proper location to move…

So, this introduces an excellent time for real math…

Lets take for example this:

Average the following Angles: 0,359,1. The expected answer is actually 0 . Not, 120.
Why? because we care about the Direction, Not the Amount of Rotation actually moved.

So… This is where you actually get to use those trig fuctions to turn everything into vectors…

(cos(359),sin(359)) = (0.999, -0.0175)
(cos(0),sin(0)) = (1, 0)
(cos(1),sin(1)) = (0.999, 0.0175)

Now if we add these vectors and divide by 3, we get

(V1+V2+V3)/3 = (2.998/3, 0) = (0.999, 0)

and then find the direction of the vector given.

tan^-1 of 0 = 0;

Therefore we have an Average of 0 Degree’s in vector direction.

The only problem is, when you have two completely opposing directions. Which for my implementation never happened, but it needed to be accounted for if things when haywire.

If have you a Direction of 180, and 0 then those cancel each other. and you have a null vector. This could create a problem for some implements, but just keep track of them, remove them from the average, before vectorizing, and then take the sample count down by 1.

So, there you have it, a use for trig finally on how to average Angles as a Direction.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]
Internet and My Life and WTF? and Software Development17 Nov 2007 02:10 pm

I’ve been wracking my brain the last couple of months writing some nice C# Stuff. The biggest thing I wanted personally form the project was event-driven, no polling required data flow.

It seems easy enough, and using the datasets/views/list it’s not too hard to make everything “just happen”… but, then comes the head ache.

Custom Controls. I developed a really nice intensity / heat graph. I personally think the most important job of any good program is displaying all valuable data, quickly, and effectively without the use of a scroll bar.

But, how the hell do i get my data over to it my new control? Making the control poll a defined datatable wouldn’t work, because that’ breaks the rules i set myself. NO POLLING for data. let it come to you , otherwise in some way, you’re wasting cpu cycles. And this way, even if you are, it’s someone elses background code just working it’s own magic with events already defined.

So… here we are… we’ve got our own control.. now, you ask, how do we set up databinding?

easy. put a dataView on your control somewhere, and hide it.
then, put this at the top of your user control class..

[System.ComponentModel.ComplexBindingProperties(”DataSource”, “DataMember”)]
public partial class WidgetControl : UserControl
{

then simply add this stuff after the class declaration

public object DataSource
{
get { return dataGridView1.DataSource; }
set { dataGridView1.DataSource = value; }
}

public string DataMember
{
get { return dataGridView1.DataMember; }
set { dataGridView1.DataMember = value; }
}

}
and wa-la, you’ve got data, you’ve got events, you’ve got a life… not much like my own.

Ah, how easy it is…

here’s some quick msdn articles:

Walkthrough: Creating a User Control that Supports Complex Data Binding


Walkthrough: Creating a User Control that Supports Simple Data Binding

j.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]
rustydelux and My Life and WTF? and Deals30 Apr 2007 10:39 pm

I just was informed that I’m now LOADED!

Thank goodness I checked my email!

rich.png

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]
WTF? and Deals and Software Development09 Mar 2007 12:07 pm

Okay.  I’ve got a feeling we’ll see this soon, mark my words!
I bought a D-Link  G132 mini USB WiFi Adapter.   (which are on sale at outpost.com right now for $19 bucks after a $25 rebate…)

Dlink USB

So, The problem?  Drivers. I HATE drivers.

(more…)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]
Internet and WTF? and Deals and Junk07 Mar 2007 01:49 pm

Canada eh?

So, I am trying to buy something in Canada.   I want to pay in Canadian funds.  This seems pretty simplistic.  Well, none of the banks and Post offices around will issue a money order in Canadian Funds.

The Local bank, however, suggest I convert the desired amount, into USD, and send a money order for that amount.  Which, was my plan B.  So… They start to “process” my order.

Now, not everyone may know this, but 50 dollars in the USA is worth roughly 58 dollars in Canadian money.  This often works out as a benefit for Americas like us who live in Michigan, near Canada.

Well, The bank finished their processing and came up with 73.05 was what I had to pay them, in order for my USD to be worth 50 dollars CAD.  Obviously this is completely wrong, as American money is worth slightly more than Canadian money.  Argh.

So, after 20 minutes of teaching them math, we were all set.  50 dollars would cover what I needed.  And then, they tell me its 20 dollars to buy a money order from the bank as a non-member…
What a waste of a lunch.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]
My Life and WTF?06 Mar 2007 10:31 am

There’s a fantastic revolution in computers and peripherals. Smaller is Floppy Disk better. I mean, i remember back in the day, I bought a 1.44mb floppy disk. It was large. I couldn’t really fit much on it, and well honestly… It sucked. Then the CD Burner. It revolutionized personal computing I believe. I mean, look, we don’t even have a floppy drive anymore (unless you need to boot a win98se install for the Fdisk shit…) But, honestly the CD is worthless too… kinda. They allowed us to do simple rewrites, appends and not closing the session. That was somewhat useful, but, never, in my life, did i ever delete the content of a CD-RW and then put completely new stuff on it.

(more…)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]
Picture-A-Day and Internet and My Life and WTF?19 Feb 2007 02:29 pm

Amazing how the witty coffee mug people can always say so much, that we can’t…

Beats the pants off the “Yes, I do know everything” mug I’ve saw floating around the office lately.

I wish I were Dead

for sale here: the onion store

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

Next Page »