Success!! Ok and some failures with AllJoynJS #WhyWait #QuallComm #AllJoyn

DSC_0019

The third episode of the hackathon has been published. As the deadline of the contest is looming, I’m definitely creating synthetic stress upon myself. There are awesome advantages to using AllJoyn in our project, but also a few problems created by friction of complexity. Regardless, we’ll push through!

http://whywait.kinja.com/what-bright-idea-will-the-teams-create-in-the-whywait-1718090122

I know the episodes are short, but I hope you guys enjoy them!

In the meantime, I wanted to share this post with those who run into the nefarious message while working with AllJoynJS, the Arduino Yun and any input output pins. If you see the following message

ALERT: Error: Failed to configure digital output pin: 022
ajs_io.c:211
light_00409bf0_0002 light strict preventsyield
global .js:10 preventsyield

It’s possible that you just need to run the following script

/usr/bin/lininoio start

To get things going again.

The comprehensive setup will come real soon, I promise! In the meantime, enjoy!

Shocking surprise in the 2nd Episode of the #WhyWait #Qualcomm challenge!

Episode two has been released and this “voted” component thing truly is a shocker! I’m already losing sleep without any additional features, but I suppose you play with the hand that you are dealt with.

More things to read up on and in the end, that means more content to create tutorials for!

Enjoy all!

http://whywait.kinja.com/meet-the-innovators-competing-to-win-the-whywait-inven-1717554111

Episode 1 of the #WhyWait Hackathon is available to watch!

The first episode of the hackathon is out. I’m not entirely aware of how much of the build it will show as the episodes are brief, but fear not! Once it’s all done, I will create tutorials and walkthroughs!

http://whywait.kinja.com/watch-two-teams-of-innovators-compete-in-the-whywait-i-1716856087

Otherwise, enjoy!

Selected to be part of the #Qualcomm #WhyWait Hackathon!

WhyWait Medium

Recently I was selected to be a contestant of a hackathon sponsored by Qualcomm to build basically any green fielded idea pairing an Arduino Yun and an Android phone. The first episode will be aired online in the next week or so. Please support me by spreading the word, to any nerd!

I’m super excited for this opportunity to play mad scientist with some IOT/IOE devices and hope we win!

Following the series, I plan on making various tutorials on how we accomplished what we did and frameworks involved from the coding side. I’ll try to do my best to explain the fabrication side, but that’s what I’m leaning on my team mates for!

Resurrecting Persistent Windows

Well, my amazing Wife gave me the green light on ordering 3x Dell P2415Q 4K monitors. So I enthusiastically connected them all via DisplayPort on my NVidia 970GTX card on my desktop and low and behold the windows are exhibiting the crazy re-arranging behavior!

Thus, I’m reviving the project and now since I’ll be able to test it immediately(Instead of building it at home, running it on my work desktop, shipping log files home back home to diagnose), I should be able to improve it even more.

Stay tuned for updates!

Displayport & AMD Radeon with latest Catalyst drivers

AMD_Radeon_graphics_logo_2014.300

Thanks AMD!

The DisplayPort issue is fixed and no longer re-arranging windows across my monitors when I lock my screen!

It seems as though my PersistentWindows utility is no longer necessary for ATI cards. I’ve just validated it on multiple machines and life is returning to normal with DisplayPort!

Looking at the feedback from the surveys, it seems as though my utility works on 50% of the use cases reported and hopefully NVidia also resolves the issue at a driver level.

While I appreciate all the feedback on the PersistentWindows tool, unless I’m back fighting the issue, it’s unlikely that I’ll put more work into it. The code is available to anyone else who wants to pick it up and I’m happy to provide assistance for those who are curious about WinAPI, PInvoking or anything else.

Otherwise, back to my other hobby projects!

Persistent Windows 1.0.7 released – NotifyIcon mingling with WPF

Recently, I’ve been distracted from my pet projects due to various life events and also Diablo 3 – Season 2. While I still haven’t been able to get new Random Coding or Top Coding content out, I did find a convenient survey plug-in for Word Press to get some feedback on Persistent Windows.

Based on some user feedback, Persistent Windows now runs in the SysTray and I removed the platform setting so it should work for people who are on 32 bit versions of Windows. I don’t personally have any 32 bit machines anymore, so I’m going to just wait for feedback to find out if it works or not. If I get feedback indicating that it still doesn’t work, then I may fire up a VM to test, validate and resolve.

As an interesting technical detail of this change. There is no native “NotifyIcon” implementation for WPF(At least none that I could find). I did find some other custom solutions on the internets for those who want a WPF context menu and all that jazz, but there really isn’t value in it for the scope of this tool. Thus, I converted the WPF shell project to a class library project, created a brand new WinForm shell project(which frames the SysTray icon) then referenced the WPF shell dll to re-use the existing diagnostic screen that I created, but also get the SysTray feature in.

Go check it out if you haven’t already – Persistent Windows

The code is open source and available to view for those who are curious and I know it’s a really old problem that seems to have been answered in a number of different ways in different places, but here is yet another example of how you can do so.

Thanks again for all the kind words and the awesome feedback!

Keep on coding on!

** Update ** EntityFramework detecting complex type with database first

Originally, I posted a question on StackOverflow

http://stackoverflow.com/questions/21630431/entityframework-detecting-complex-type-with-database-first

While we’re still not using complex types, we’ve worked out a mechanism to preventing our developers from breaking the autogenerated models when re-generating from the DB.

We’ve altered the T4 template generated by EF.

First we’ve created a method in the CodeStringGenerator class

public string BaseClassAndInterfaces(EntityType entity)
{
    var properties = new List<EdmProperty>(_typeMapper.GetSimpleProperties(entity));
    bool hasAuditFields = false;
    if (properties.Exists(property => _code.Escape(property) == "CreatedBy") &&
        properties.Exists(property => _code.Escape(property) == "CreatedDate") &&
        properties.Exists(property => _code.Escape(property) == "UpdatedBy") &&
        properties.Exists(property => _code.Escape(property) == "UpdatedDate"))
    {
        hasAuditFields = true;
    }
 
    return string.Format(" : {0}", hasAuditFields ? "Auditable" : "NotificationObject");
}

If it detects that a table contains those auditing fields, then it prepares to generate the class with a base class “Auditable”, which has those four properties. You’ll notice that if we don’t see the auditing properties, we then set the base class to NotificaitonObject. That’s because we’re still using our own variant of the deprecated Prism NotificationObject.

Next in the T4 template, in the class declaration, we do the following.

<#=codeStringGenerator.EntityClassOpening(entity)#><#=codeStringGenerator.BaseClassAndInterfaces(entity)#>

This basically outputs the

public class MyAwesomeAuditableModel : Auditable

Next it gets a bit messy. However, the goal of the following lines is to prevent the T4 template from autogenerating the columns that are already defined in the base class.

var simpleProperties = new List<EdmProperty>(typeMapper.GetSimpleProperties(entity));
if (simpleProperties.Any())
{
    bool hasAuditFields = false;
    if (simpleProperties.Exists(property => code.Escape(property) == "CreatedBy") &&
        simpleProperties.Exists(property => code.Escape(property) == "CreatedDate") &&
        simpleProperties.Exists(property => code.Escape(property) == "UpdatedBy") &&
        simpleProperties.Exists(property => code.Escape(property) == "UpdatedDate"))
    {
        hasAuditFields = true;
    }
 
    foreach (var edmProperty in simpleProperties)
    {
        if (!hasAuditFields ||
            (code.Escape(edmProperty) != "CreatedBy" &&
             code.Escape(edmProperty) != "CreatedDate" &&
             code.Escape(edmProperty) != "UpdatedBy" &&
             code.Escape(edmProperty) != "UpdatedDate"))
        {
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
        }
    }
}

That’s it! Now, we have our dev team, re-generating models all day long, high five-ing and hugging each other all through the days because of how awesomely convenient things are now.

Below is a link to the actual T4 template file that you can play with and see how it’ll impact your generated output classes. If you decide to use it, you will likely have to tweak it, to conform to the conventions in your environment.

http://www.ninjacrab.com/randomcodingdownloads/Example.tt

Keep on coding on!

PersistentWindows 1.0.5 and other updates!

Well 2014 has come and gone in a blink of an eye! Updates have been delayed due to various priorities as I was blessed with the birth of my second child the past year. I haven’t posted a new video, nor made updates to my little pet projects because it’s really hard to when you have an infant sleeping in the room adjacent to your “recording studio/living room”. That’s Manhattan living for you, but I still love it!

Regardless, mostly because of my amazing wife, I finally am able to get a full nights rest and continue delivering on my hobbies and ideas.

So first project update. I received such a motivating email from a random user who picked up PersistentWindows thanking me for the time I spent on it. I don’t ever expect to make any money off of that project and it was really intended to solve a problem that I was constantly dealing with at work myself. I did recently make some updates, based on some feedback and will continue to make some slow progress on the project, but just mostly out of necessity when pain drives change. 1.0.5 is released and has slightly smarter logic on when/how to capture the modified windows. Before, I was trying to capture based upon Windows Events, specifically if I received an event of a power change mode, I was going to capture the window changes and then when I receive a display change settings I could ignore the windows changing positions. However, what was actually happening was that the windows were moving prior to power event being broadcasted and thus my logic failed.

Now, I just wrote some logic that tries to determine if a number of windows larger than “X” change within one second. Currently X is 4 and My Theory is that no human can reliably modify the location of 4 windows in one second. If it turns out that people can, then I will bump up X or make it configurable, but so far at work that setting is doing just fine.

Second project update, I have received a few more awesome comments from generous people asking for more and as the subscribers are almost hitting 200, I’m disappointed that I can produce more content at the moment. I do have another video ready, based on user feedback, the problem is solved and script written, it’s just that almost every time I want to record I wake up the little one and have to stop. Some of my friends have suggested, “Make a funny video”, “Bait people in with a intro photo” or some other suggestion that would basically taint the reason I’m creating videos in the first place. My goal is to teach and spread knowledge and there are already so many more people out there funnier and more attractive than me. So with that, I will stay on topics and themes and hope that some how I can be a tiny impact in the direction that gives me satisfaction.

So with that, I do hope that this month or next I can finally get out another video!

“Keep on coding on” my fellow programmers!