Saturday, January 16, 2016

There is fun in solving problems!!!

Here's my problem - drawing round corners when lines join, something like this:


sure, this looks very simple right.  It is simple depending on the technology being used.  If its HTML5, you can use CSS to define the radius of the corner. But imagine if you were doing in c# using the drawing classes in .net.

Before, I saw any other words, let me say there are many ways to solve this problem.

So, I spent numerous hours trying to solve this problem last weekend, and I miserably failed, I failed due to couple of things.  A line can have many bends, so the above dotted line has a bend lets say bottom left and a bend at top right.  So here's an example:






















Let's identify each corner as shown in the above pic, Top Left (TL), Top Right (TR), Bottom Left (BL), Bottom Right (BR).  The other thing that I realized was each corner has two possibilities, here's what I mean, lets take the Top Left (TL) corner, depending on the source and destination of the points, there are 2 possible corners for the Top Left (TL).  Here's what I mean:



So as you can see, depending on direction of the line, the corner has 2 possibilities.  So, I called these the following:

  • Top Left - West South
  • Top Left - North East
So here are my actual notes that I did in OneNote trying to figure out what these corners should be called and how to determine what corner is what based on 3 points, point 1, midpoint, and  point 2.


So once I figured out the corners, their computations, off the drawing board into coding.  I wrote the algorithm, and guess what I failed. It did not work, I was not taking into account multiple bends of the line.  So using my research I decided to try a different algorithm. Draw the lines as if they are straight lines and then erase the corners. So something like this.

Then erase the corners by drawing white rectangles on the corners (this goes back to my first assignment at Algonquin college - community college then - any my first assignment was to draw a ball on the screen and move it from left to right, so the lesson I learned here was smoke and mirrors in programming, if you draw a red ball on the screen, you can erase that ball by drawing same ball using the background color.  So if you draw white boxes on the corners, this is what you get.

























So the corners are gone now, and we know where the corners are, now we can draw round corners (also called ARCs in math). So we end up with something like this.

























I know the corners don't look great, I just drew these using my surface pen.  But here's a real example from our cDevWorkflow product with nice round corners for the lines.





























Don't these lines look very nice.  So this algorithm is used by our cDevWorkflow product's graphics engine when generating graphical representation of a Workflow definition or instance.

It's fun to innovate, technology is changing every day, so keep innovating..........

Finally a tablet/laptop for developers

I have been a software engineer for a very long time, and problem solving is my thing. I at least believe that I can fix anything, even if I can't I will try, that is my philosophy.

For many years, I have had laptops as developments machines, mainly because of portability, I can open a dev tool no matter where I am, in taxi, airport, airplane, upstairs, downstairs..........

So I have gone through many, many laptops. Last couple of years, I was so impressed by the tablets, really wanted one but the problem was not the cost, but the lack of hardware performance.  As a software engineer and manager of a development team, I review a lot of stuff. When I review, I comment, I suggest, but it was becoming difficult to do with a laptop keyboard and a mouse.  When I see people using a stylus on a tablet to review a document and go through pretty well by marking the document with a pen instead of selecting and typing.

I have to say, I am not a fan of Mac, they have good hardware but not software.  I want productivity, not a device that will consume my time and life.  So finally, I found my match, I found the Microsoft Surface Book.

Surface book, love it.  Its a tablet, laptop, machine, piece of art that can really keep up with my brain. And my brain runs fast, super fast and even at quantum speeds.  I am able to dot it all using the Surface book, it has the speed/performance.  Ended up getting the i7 CPU with 16 GB of RAM, 500 GB of hard drive space. I was thinking of getting the 1 TB drive, but then I thought when I get 1 TB I collect more junk, so with 500 GB I can clean up and have the things I really want on the machine.  Move all the unnecessary things to a portable SSD drive.

With the use of the machine, I am able to do 2 things really well.  When I write code, could be c#, jquery, html5, even some vb.net, I am able to write, compile and execute code without any issues. And the second most thing is to review stuff from my developers.  I am able to take the screen of the keyboard, take the pen/stylus and start reviewing the app.  These days I mostly review functionality and UI for our cDevWorkflow product.  My favorite browser is Chrome, but for reviewing our app, I use Microsoft Edge to review and markup screen, with 2 clicks its sent of to my developers through email.  I have to say, it is very productive for me.  What used to take 2 hrs to do now takes me 20 minutes to do.

So, here's an example of markup that I sent to my development team, its right out my email:



Tuesday, September 11, 2012

Tools by cDevWorkflow

We have started to really show the power of cDevWorkflow, we have implemented a bunch of tools fully powered using cDevWorkflow, check it out at

http://cdevworkflow.innovativeglobal.com/cdevworkflowtools/Default.aspx

The first tool is simple, given 2 dates, it computes the number of days betweent the 2 dates

Sunday, February 19, 2012

BPMGarden - launched by cDevWorkflow

cDevWorkflow has launched a new site to plant and grow your process.  FB has millions of users, let's collaborate and grow your process......

http://www.facebook.com/#!/pages/BPMGarden/214581435305994

www.cDevWorkflow.com