Software Development


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]
My Life and Software Development21 Sep 2007 03:16 pm

I’ve been writing an extensive project in C# replacing an entire software library here at work.

One of my main pushes has been for dynamic user interfaces with “widgets”.

I write A LOT of different data visualization screens, and being able to contain them in a panel, and add them to any project like an OCX would be GREAT. The biggest problem i had was resizing the panel, and moving the panel around on the screen to allow a true dynamic panel.

It sounds stupid, but it was hard because i over thought it.

So, for those interested…

void pnlWidget_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right) { mnuContext.Show(new Point(e.X,e.Y + 75)); }
if (e.Button == MouseButtons.Left)
{

pnl_mousedown = true;
aCurrently.X = e.X;
aCurrently.Y = e.Y;

_mouseposX = aCurrently.X;
_mouseposY = aCurrently.Y;
pnlWidget.BorderStyle = BorderStyle.FixedSingle;
}
}

void pnlWidget_MouseMove(object sender, MouseEventArgs e)
{
if (pnl_mousedown == true && Locked == false)
{
this.Location = new Point(MousePosition.X - _mouseposX, MousePosition.Y - _mouseposY);
}
}

I can’t believe how stupid i was. I was writing it much harder before….

gah!

[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]
My Life and Macintosh and Software Development16 Jan 2007 11:12 am

Graphical Programming. I shake my head at you…

A few years ago, I “dabbled” in LabView. I saw it being useful, but not for application development. The things I was doing at that time were mostly related to business programming and post aquisition processing of information. It was easier to write code than do anything with LabView, so I pretty much put it on the back shelf.

Fast Forward 4 years…..

(more…)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]
My Life and WTF? and Software Development04 Dec 2006 03:16 pm

So, Over the last few days the president of the company has found ways to corner me and talk to me about his new favorite hobby…

Renting Super Cheap coders to do semi-complex jobs for little to no money…

Why Does this bother me so much?

(more…)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]
Internet and My Life and WTF? and Macintosh and Software Development12 Sep 2006 03:08 pm

I think I finally figured more of it out… what drives me that is from a technology standpoint. I like it. I can’t really figure why, but I was reading digg.com today, as most people in my position probably do… And they were talking about Peter Wright.

Someone made the comment that innovation is what has to guide some people… and I think i’m that person.  I love innovation.  More recently I’ve found myself falling in love over the Apple products… Wanting to watch their “key note releases” and actually partisipating in the sepcuation that is their marketing hype.  Why?  because I’m interested in what they’re doing, and they make me want to know… Just like a good TV Show, they kind of leave you hanging… but like a good TV Show, it’s a good plot.  That good Plot is Innovation.   Today’s “Show Time” release, they mentioned the ‘iTV’.   It’s what I’m interested in.  I really want to turn my mac MINI into a “TiVo” Type box once i replace it in the future…

Innovation… I love it.  I like being creative, and because I can’t draw, or paint, or make cool things, innovation for me, is writing sweet code.  The kind you look at after hours and hours, and say “wholy shit. It’s 14 lines long, but you solved the problem xxx, xxx, xxxx and yyyy couldn’t solve at all in their tenure.”  That’s what it’s about.  The drive to create, innovate, produce… make something that is your own.

Peter goes on to talk about people lacking passion.  The apple band wagon, they have passion… Thats what I think is lacking from the windows movement.  It’s like the dull grey suits… looking around … just waiting for what they’re TOLD will be coming… but nothing.   How can a company release 14 billion different things in two years, yet the other company can only replease 14 billion bug fixes… oh wait.  Thats it… they’re fixing the old stuff still…  I digress.

What i’m trying to say is… I have passion, or rather, i Want to have passion from what I’m doing. I often get lost in all the other things while I’m working.  At least this week I will remember It’s passion for innovation and solving problems that makes me do what i do…

Some how i will remember to remind myself of that… Perhaps I’ll put it on my calander.

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

Next Page »