Sunday, May 28, 2017

wpf, prism, inotifydataerrorinfo and fluent validation

Time for a technical post. Recently my team began work on a new product and the architecture that was selected was WPF, Prism with Unity. Yea I know ..... but we went with WPF because of the intensiveness of the graphics we need to use. The design patterns we choose was Prism with Unity and MVVM. The following samples were taken from efforts to collect data needed to create a connection string for a Maria DB.



As we began looking at a validation implementation, we looked at Fluent Validation. After tinkering around, it seemed very well like by the community and seemed like a great way to manage validation rules.

We started constructing our base class. We created our own ValidatableBindableBase class which which inherits from Prism's BindableBase and INotifyDataErrorInfo. With the INotifyDataErrorInfo, we're implementing the interface with a dictionary, adding and removing items to the dictionary when the DataErrorsChangedEventArgs fires.

So this is the model in which our classes will be built upon. Nothing special, just defining our properties in our model. Notice the model also inherits from our base class - ValidatableBindableBase.

Using Fluent Validation, we created our validation rules based on our model. Fluent Validation makes it incredibly easy to construct rulesets using lambda expressions. Just pass in the entity type to the AbstractValidator base class.


Here I'm showing the view (a partial view of our view) which demonstrates the controls. We are using DevExpress controls here. The controls bind to the viewmodel properties and uses the ValidatesOnNotifyDataErrors attribute set to True. Now the control subscribes to the error raised in the changed DataErrorsChangedEventArgs.

Lastly, the viewmodel. During the construction of the viewmodel, the Save delegate is registered. When the user clicks the save button, the validation is fired. What a joy it was to see the validation fields light up.


It took a little while to get it constructed just right, but I really like this implementation.

Sunday, May 14, 2017

rain barrel 2.0

This year I was ready to begin my rain barrels 2.0. My goal is to have full pressure spray from my rain barrels, powered by solar. Well .... let's start by cleaning them up. 


I pulled them from under the deck (where they are stored for the winter) and cleaned them out really good.



I got them for $45 from my local water treatment plan several years ago. They work great, except the pressure is not enough to get water through them. I ended up using water pails to move water to my garden. Not much fun or efficient.



I didn't use them last year and of course, no rain most of the summer. Not jinxing this summer, bring them out.


I went off to the nearest big box store and purchased about 3 of these.


Couple of coats and a few days later .... all done.


Next, I purchased a highly recommended water pump from Amazon. It is the cutest, little portable guy. It is electric .... so this year, I'll plug it in. Next year though ...... solar power!



We plugged in the hose and turned on the pump. And TA-DA, pull pressure!


Nice solid pressure directly from the rain barrels.


Now ... I have the coolest rain barrels that provide full pressure to a garden hose. Look out garden, full organic rain water - all for you.



Sunday, April 16, 2017

papa's hat

Between our vacation to Frankfort last year and the recent trip to Myrtle Beach, I've been very inspired by the beach. When we returned from Frankfort, I added white linen window treatments and made new slip covers for the furniture .... the color of the ocean.


Now it was time to think about new art. 

This was a picture I took of Matthew at Myrtle Beach in South Carolina. He was intimidated by the ocean waves and wouldn't go near the water, but he had fun with the sun, sand and water from the bucket.


After I got back from the Myrtle Beach trip, I finished this almost done painting for the art portion of my beach theme for the living room.


Then I began my second painting, inspired by this picture of Matthew.


I printed off the picture on this great little photo printer.


OK, it's a little blurry, but it's a Canon Selphy CP900. I absolutely love this thing! It's wireless and uses a heat to transfer the ink to the paper, so no more ink drying out before you can use it. The color is amazing and the photos turn out spectacular. I printed out the photo so I can use it as reference during the painting process.


I transferred the photo to this little projector I bought Holly a few years ago for her birthday. She never uses it and I snatched it up for painting. It's great for projecting photos onto my canvases. There's more about this product during my blog post here.



I wait until night so the picture is very clear without the sunlight washing parts of it out. I adjust the projector so it fills the canvas. Using my pencil, I draw the outline.


The next morning I got set on blocking in the canvas with mostly neutral colors. I used a piece of masking tape to paint the distinction between the water and sand and then blended it a bit.


The sand and water, I went ahead and used the right color values.


The body and buckets I used light, medium and dark neutral tones just to get the color values in place. I let it set for about a week before I could find time to return to it.


Bringing out my arsenal of supplies, I got to work.


And finished up with the right color values.


I really love how well it came out. It'll have a prime spot in my living room. What I really appreciated about this painting is just how well it came together. Quick too. There was less time thinking about values and composition. Within a week, and I'm done. Sometimes when I paint, I'm not always sure when I'm done. I agonize and criticize over the composition and my skills. This time .... I knew I was done.

The memory of this moment brings me happiness.

Sunday, April 9, 2017

myrtle beach, south carolina

This year for Christmas instead of buying gifts that will be lost, damaged, or just irrelevant over time - I offered the kids an opportunity to join us on vacation in Myrtle Beach. All but one took us up on the offer, so I booked us a three bedroom condo on the north end of Myrtle Beach and some airline tickets. It was one of my favorite vacations, and here are some of my favorite moments.


We'll start with my favorite sunrise photo during the week.


We left Detroit on this guy's 16th birthday. I'm not exactly sure how he got to be 16 already. Who allowed that? Happy birthday to an awesome grandson!


Our hotel room faced the east, so we got the beautiful sunrises coming through our condo windows.


I actually slept through this one, but Burke grabbed my camera and took some amazing shots.


I booked us on a ocean tour, dolphin watching boat ride through Express Watersports. We were all super excited to go.


The waves were a little rough and motion sickness set in pretty quickly.


It became hard to enjoy the ride - but we did see some dolphins. The crew was very nice and really tried to help with our motion sickness. The boat was very nice too - plenty of room to move around.


This picture was taken right before he went out like a light. Slept through most of the trip, which was probably to combat his motion sickness.


The next day was much nicer and we spent the day at the beach, collecting shells and enjoying the sun.


I got my camera out and started shooting some pictures.


Looking for inspiration for my next painting.


This guy walked up and down the beach for miles.


Looking specifically at the shape and flow water makes for my painting research.


This was the condo where we stayed. It was very lovely, 3 bedrooms and 3 baths. Every room had a perfect view of the ocean. The owners, Diane and Jim made our trip really comfortable and we enjoyed staying here. If you're interested, you can find the rental info here.  Matthew kept calling this place, "The Tower", so ..... forever named.


Burke found a dead jelly fish on the beach. All the tentacles were torn off, but the body was so interesting.


I got out my macro lens and took some close ups. 


This really was just a clump on sand along the shoreline. Cool right?


I booked the kids to go to an Escape Room where you find clues to get out of the room. They had a great time. While they were gone, me and this guy went on our own adventure. We set out for a walk along the beach and boardwalk with my camera.


We came across this singing bird.


And some sandcastles.


There were wind advisories out and the wind kept trying to take his hat. He kept yelling, "my hat Nana!"


I finally got up in time one morning for the sunrise and I wasn't disappointed. This was taken from the balcony off the condo. The weather was rainy and stormy most of the week. We saw several severe storms and even had a tornado warning.



On our last day, we checked out of the condo and had several hours to kill before heading to the airport. We ended up going to Vereen Memorial Historical GardensFranklin G Burroughs, we played putt putt golf, and walked around the Market Common. Laney insisted I take his photo here at Putt Putt even though the sign clearly said to not stick your hands inside the sharks mouth. But ... it didn't say anything about heads, soooo.....

Then we headed back home to more wind, snow, sleet, and cold.



Relaxing at home, I was able to finish my painting adding the little research touches I found during my trip.

Time to start my next beach painting.

Saturday, February 25, 2017

robotics

I been distracted lately from writing new articles, so today I'll do a little catching up.  I started a new job AND began mentoring for the Saline Singularity Robotics Programming team for Saline High School, all about the same time. Our six week build cycle ended last Tuesday and now it's time to take a breath.


The last Saturday of the build, I brought my camera in for some fun pictures. It didn't take too much coaxing to get these guys out doors on a beautiful sunny day for some team photos. Michael (on the end, left) is the Team Lead.


This is the programming team, minus 2 guys. And this .... is their best robot pose. Haha!


And finally, the robot. The game released from FRC was themed "SteamPunk" and the game was all about powering and flying an airship. Cool. You have to fill a airship with balls (steam) and put together a rotor. Lastly, the robot has to "fly" by grabbing on to a rope and pulling itself up.


Let's rewind a little. Kickoff began like this. Everyone gathered in the Hornet Hub to socialize and watch the kickoff video from FRC (First Robotics Competition). The room was filled and the excitement was contagious. Then ... the plan was created. Represented here is 4 of the 5 leads for each area.... Business, Electronics, Programming, and Cad. Where the heck is mechanical?


Ah, there he is. The guy standing up on the right.



It's nice being in a school district that has it's own metals lab. The whole thing was designed and built at Saline High School. So the mentors and students got busy designing and making the robot. 


And testing it.


And fixing it.


And testing it some more.


Initially when I was asked to mentor, I thought, "Great!" Sounds like fun!


I said, "I've never built a robot, but it would be fun to try."


I know a little something about coding, and I was excited.


Basically every tool and language was different than what I've used in the past. Some similarities - but new. Great .... (hangs head). Eclipse, Java and Git. Even the scouting app was done with Android studio for the client and a Raspberry Pi web server running Python. Does no one use Microsoft stuff anymore?


So we all learned a lot this past six weeks.  Not only did we program motors and controllers, but we learned about setting up and coding autonomous mode using a vision system and mouse odometry.  We put together systems for making the robot sense where it is and where it needs to go using USB cameras and 6 wired optic mice.

It certainly was the most exhausting and exhilarating time. We met everyday from 5:30-8:30pm, and every Saturday from 10am to 4pm. 

The technology was so interesting and these nerds ..... well they are the best group of guys to work with. Their parents should be so proud of each and every one of them. I know I am - and so is our school district.

Now on to competition! 

Go Saline Singularity 5066!