handle checkbox and radio button in Angularjs example

Recently I found an article online – credit to http://www.code-sample.com/2014/11/handle-checkbox-and-radio-button-in.html thought I thought was a good resource in regards to AngularJS.

In this topic, I am using the bootstrap css for look and feel UI.
The input textbox view.
The radio button view.
The check box view.
button etc.

angularjs result

The example code as given below.

<!DOCTYPE html>
<html ng-app="formApp">
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
    <script src="http://code.angularjs.org/1.2.13/angular.js"></script>
        var formApp = angular.module('formApp', [])

        .controller('myController', function ($scope) {
            $scope.result = {};
<body ng-controller="myController">
    <div class="col-xs-12">
        <h2>How to handle checkbox and radiobutton in angularjs?</h2>
                <input type="text" class="form-control" name="username" ng-model="result.username">
            <div>Latest js frameworks</div>
                <div class="checkbox-inline">
                    <input type="checkbox" name="frameworks" ng-model="result.frameworks.nodejs">node.js
                <div class="checkbox-inline">
                    <input type="checkbox" name="frameworks" ng-model="result.frameworks.angulaijs">angulaijs
                <div class="checkbox-inline">
                    <input type="checkbox" name="frameworks" ng-model="result.frameworks.knockoutjs">knockoutjs
            <div>You Interested?</div>
            <div class="checkbox">
                    <input type="checkbox" name="Interested" ng-model="result.Interested" ng-true-value="Yes!!" ng-false-value="iWish">Are you Interested?
            <div>Your country?</div>
                <div class="radio">
                        <input type="radio" name="country" value="India" ng-model="result.country">India
                <div class="radio">
                        <input type="radio" name="country" value="USA" ng-model="result.country">USA
            <button type="submit" class="btn btn-success btn-lg">Get Result</button>
        <h2>Result - JSON Object</h2>
        <pre> {{ result }} </pre>

An oldy but goody – CLR functions in SQL Server (RegEx)

CLR functions in SQL Server are amazing to use…erhm…when necessary!  You see there’s been a lot of debate around CLR functions being used in SQL Server in terms of performance. However, sometimes when there’s a simple dirty data update you have to do and want to get it done quickly, or keep a function in your back pocket for “when necessary” cases – then you’d like to know you have it.

A prime example of a nice CLR based function for use with SQL Server is RegEx, regular expressions are not utilized in sql server, in fact, the closest thing I’ve found is PATINDEX which still doesn’t hold a candle to our text sniffing and scrapping regex friend, so, that being said a simple CLR based function is easy enough to whip up.

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Text.RegularExpressions;

public partial class UserDefinedFunctions
    public static SqlString RegEx(string value, string pattern)
        // Put your code here
        //return new SqlString (string.Empty);
        Regex regEx = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline);

        if (regEx.IsMatch(value))
            return new SqlString(regEx.Match(value).Value);
            return null;

After you’ve deployed that solution your sql server you can then utilize it, but only after enabling CLR based code to run on the server by executing the following stored procedure

sp_configure 'clr enabled',1

Hope that helps.

Bundled software and why it SUCKS!

I’d like to take a minute and discuss something that isn’t new, hasn’t been new for some time, and is probably not going anyway any time soon. To often when I talk to friends or clients who ran into trouble and I’m taking a look at their system they usually have a ton of crap installed that they really don’t need.  When I ask about it I get the same reply “I didn’t install that.”

The answer is really quite simple, which is, yes, you did, BUT did you KNOW that you were installing it?  Most likely not.  See a few years ago as the software industry started changing people started looking at ways to develop free software…hey…it’s not a bad thing, but as the old saying goes…nothing’s free.

What happens is in order to make money, or in some cases (like HP) in order to install even more of their proprietary software on your machine (which is used in turn to hook you into using their products and tools) they start bundling packages together.  For instance, when you install Avast! antivirus…by default, the installation comes with Google Chrome (NOT A BAD THING! Google Chrome is IMO the best browser around).  In any case, Google has paid Avast! to bundle Chrome with their product?  Don’t get me wrong, we all win here, Avast! get’s the revenue from Google, Google gets you to use Chrome, and you in turn get two free products installed on your machine, w00t! hat trick my friends! hat trick!

In some cases though you don’t get a nice product like Google Chrome installed on your machine.  In the instance of my installing my own printer software from HP I found that the HP Shop tools were being bundled with the software and that they wanted to install software update tools, they wanted to install internet *hint* tools for when I’m browsing (browser plugins.. yuck when they’re *hint* tools), they wanted to install the solution center, etc, etc, etc, they wanted a drop of my blood, my cc #, my DOB and my SSN…ok..those last few items were just to make sure you were paying attention, in any case you see my point here.

So what can you do about it?  A couple of things actually.

  1. Only install software from vendors and OEM’s that you absolutely trust.
  2. Learn to click around during installations and do “custom” installations…you may be scared if you’re a *starter* user, but don’t worry, you can always uninstall / reinstall if it doesn’t go right the first time :-)
  3. Make a habit of checking the Programs & Features installed programs after performing installations to remove any unwanted possibly installed tools that were included in your package (if you learn to use #2 the most, you won’t run into this issue).
  4. Just be smart about it.
  5. Breathe, it’s not always your fault.

Look, not everyone knows everything and most people are happy enough being able to type documents in Word and Excel, and that’s perfectly OK, all I’m saying is that if you want to stop additional crap from being installed on your computer, learn to click around, software and computers is like anything else, it’s ok to make mistakes…mistakes are lessons learned to improve your future endeavors!  Yay!

Is it the end of the world if you install additional tools that you don’t need?  Absolutely not, it can cause you frustration down the road however when you find 20+ applications starting up with your machine that you don’t recall specifically installing, or when you’re browsing and all of the sudden your experience is completely different and not in a good way.  I would say most of the time, if it’s not malware you can successfully uninstall it via the Programs & Features snap-in via the Control Panel on your windows workstation, very seldom will you require antiviri, a specific fix-it tool, or malwarebytes to uninstall something unless something has gone horribly wrong or you’ve installed something that wasn’t from a trusted source…erhm…torrents anyone?

Anyway, be safe, be smart, be brave, bundled software is a tedious game but you can totally beat it and besides…typically those products are bundled because they were paid and if you enjoy free software, well, unfortunately, those companies do need to  make money some how so keep that in mind :-)

Where I think good, genuine code comes from

Good code is like a good story, or a good quote.  It answers something.  Whether it be a need, a fantasy, a want, or simplifying something, good code should always solve a problem.

When I first started out with Soomya I was full of life, excited and passionate about an idea of multi-peer video communication and video messaging.  We had a working demo too, sure, it was laggy, but it showed immense potential.  To make a long story short we sacrificed, what did we sacrifice?  Our integrity. Our products lifeline, our goals switched from making a fantastic product that improved communications to trying to make a buck.  Sure, businesses need to make money, that’s a no brainer.  That being said, you have to be passionate about your products, you have to believe in them, if you do that’s when you’ll go the extra mile for them. Ideas are like plants, they need plenty of sunlight and water to survive, getting side tracked by trying to turn a back can often take your attention away from caring for your ideas.

Think about your product – Does it answer a question? Does it have a marketplace? Who would use it? Why? Does it solve a problem or simplify something? Is it fun or productive? If your answer was “no” to all of these questions then I’ll allow you a moment to face palm yourself right now, because you my friend, are developing a dud. One of my favorite developers Jeff Atwood openly talks about his projects on his blog and why he developed them, why he chose the languages he did, why he chose the platforms, and what the intentions of the projects were from start. Something was crappy, we hated it, so we changed the way it worked . Simple, that’s it, that’s all it takes – an idea or motive to no longer be frustrated by the intricacies of proprietary software and user-flows from the 90’s. Go figure.

Have a clear vision of what you want, and don’t stray away from it, follow it, down the rabbit hole – you may be surprised where it leads you. Don’t accept things for how they are, challenge them, challenge everything! Do you want to know how to adopt change? Focus on it, get involved with it, focus on changing things for the sake of improving them, question things that you never used to, why not? The idea being that so you’re so involved, so wrapped up in the change that you don’t even have time to stress or think about “the way things were”. Be passionate, that’s where good code comes from.

Side note, we are now focusing on rebuilding Soomya and it is pumped up with all types of new life and new creativity that I am personally excited about! A re-imagining – if you will, sometimes you have to fail at the first attempt so that the second one can blossom! One last tip, don’t give up!

A simple short unique ID in C# without using GUID revised and reposted.

Original post:  https://schroedman.wordpress.com/2012/01/19/short-unique-id-in-c-without-using-guid/
Note: This post has been revised and reposted using information found in the comments of the previous post.

Today I wanted to generate short unique IDs in C#.  I stumbled upon an article here that helps you shorten GUID’s, here is the link: http://www.singular.co.nz/blog/archive/2007/12/20/shortguid-a-shorter-and-url-friendly-guid-in-c-sharp.aspx.  I still thought that the IDs this generated were a bit lengthy and ugly for what I was looking for.  What I decided to use instead was the number of server ticks  to generate a URL friendly code / key that isn’t as long as a GUID or as obvious as a database auto-incremented record ID.  In any case, here’s the REVISED approach that I took.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace uniqueId
    class Program
        static int count = 0;
        static bool isrunning = true;
        static Thread[] threads = new Thread[30];
        static void Main(string[] args)
            for (var i = 0; i < threads.Length; i++)
                Thread thread = new Thread(new ThreadStart(uniqueCode));
        static void uniqueCode()
            while (isrunning)
                string characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#";
                string ticks = Thread.CurrentThread.ManagedThreadId.ToString() + DateTime.UtcNow.Ticks.ToString();
                if (count >= threads.Length)
                    count = 0;
                var code = "";
                for (var i = 0; i <= ticks.Length; i += 2)
                    if ((i + 2) <= ticks.Length)
                        var number = int.Parse(ticks.Substring(i, 2));
                        if (number > characters.Length - 1)
                            var one = double.Parse(number.ToString().Substring(0, 1));
                            var two = double.Parse(number.ToString().Substring(1, 1));
                            code += characters[Convert.ToInt32(one)];
                            code += characters[Convert.ToInt32(two)];
                            code += characters[number];
                if (count > characters.Length - 1)
                    var t_count = count;
                    for (var i = 0; i < t_count.ToString().Length; i++)
                        code += characters[int.Parse(t_count.ToString().Substring(i,1))];
                    code += characters[count];

Not ACPI Compliant? Foxconn A78AX 3.0 Series


So recently I purchased a new motherboard for my computer at home.  I purchased the Foxconn A78AX 3.0 Series.  Ordered the board, got it shipped, was super excited, installed, took my time with everything, made sure all of the cabling was tight and that everything looked clean inside only to turn the computer on with my newly installed 16gb of ram and find that I received a BSOD ACPI Compliance error….crap…I immediately hit the internet reading forums and any type of literature I could find.  Many suggestions from people saying to disable legacy USB, to changing IRQ ports, all type of stuff really.  No settings worked…not kidding, none.  doh!

Considering I had bought new RAM with the mobo I figured I’d try removing some of the chips and seeing if it worked (I’ve run into BSOD issues before and the ACPI compliance issue isn’t very descriptive considering all boards have been ACPI compliance since…well, a long time)…in any case, I removed the first chip and started the computer….walaa! Windows setup started with ease….OK…so then I decided to see if it was a bad chip or perhaps a bad RAM spot on the board, perhaps a bad memory controller, etc.  So I moved the second RAM chip to the first slot, leaving the suspected bad RAM chip out of the machine…(queue the music) duh duh DUUUH…damn it, the machine didn’t load again, same issue…So now I’m thinking somethings wrong with the board itself or perhaps the bios, makes sense right?  I mean after all it’s a new board…if I can’t get it working I’ll just RMA it….

I check the Foxconn website for the bios to no avail, ok, so I run their live update windows flashing tool, again no avail…Damn it…So for a few days I ran the computer with only 12gb of RAM installed, which is more than sufficient, but as a computer user, nerd, advocate of shit working when you purchase it (whatever kind of label you want to give it) this is not good enough for me…I planned on the mobo and the RAM and the CPU, etc because I knew the package would play nicely together, so WTF happened?  Have I lost my touch…no my friends…I did not….Here’s why…

Today I simply had enough, either Foxconn was going to help me with my motherboard or ship me a new one, either way, this was getting resolved….the fourth ram chip just sitting on the office sofa….staring at me, taunting me, laughing in my face….I wasn’t going to take it anymore, I called Foxconn after Binging their number (yes I use Bing, don’t judge me, it’s not bad lately).  I call hoping that they’re still open…score! they were…I dial the number associated with tech support…much to my surprise when I called someone immediately answered within two rings, and not a corny “press 1 if you like pizza, 2 if you like sleep” sort of thing (which would’ve left me pressing 21 because I love both of those things!).  Yeah, I got a tech on the phone, almost immediately (now I’m upset with myself for not calling before).  After literally 5 minutes of talking to the tech I give him my motherboard model number and the BIOS ID….Yep, he says they have an update for it and then he sends it to me via e-mail in a 7zip…nice! (by the way 7zip rules your ass, just so you know).  In any case, I load up the Foxconn live update windows client, select the ROM (after extracting it of course) and restart…

NOTE once you restart it will complain about the checksum, no big deal, just enter the setup load the optimal defaults and then save and exit…you’re back in action.

So I do that, restart, and BAM!  Windows boots right up accepting my 16gb of RAM, recognizing it most importantly and I am now a happy camper…Well, I have to ask the tech (so that I don’t cry myself to sleep with such a simple fix), “Was this BIOS something that I could’ve just downloaded from your website, or is this a special compile that I had to get from you?”  Guess what ladies and gents…It was indeed a special compile that is NOT, I repeat NOT publicly available on the website….So in short, I’m happy I called, I’m happy with the Foxconn board and honestly I can’t complain (well I could, but why?).   Truth is, the entire process with installing the new BIOS, talking the tech, re-inserting the RAM chip and all discussions with him in between took me all of 10 minutes…It actually took me longer to write this blog post…no joke…

So, if all else fails, don’t beat your head against the wall, call the support and find out if there’s a special compilation ROM for your mobo,   A++ to the support, I was very impressed, there’s not a lot to be said for someone simply taking the call right away, especially nowadays when you get stuck in the dial of death loop…1 if you want butter, 2 if you want to kill yourself because you’ve heard the main menu 18 times…etc.  Computers up and running, good times, don’t be afraid to make the call, especially if your board is still under warranty…Plus, now I feel better about myself not being able to find the BIOS update since it is a special release to only some of those mobo’s that left the factory with a bad bios on them…although, in all honesty, that seems like something they could easily (and should probably) make public.  It would’ve saved them a phone call from me at least.

Anyway, any of you using this board with that error, I hope this helps.  Happy trails my friends.