Tuesday

handlebars.js subtemplate example


step1.create subtemplate
<script id="nutri" type="text/x-handlebars">
    <p>
     This is subtemplate in Handelbars
     </p>
</script>

step2.register it in javascript

<script type="text/javascript">
    Handlebars.registerPartial('nutri', $('#nutri').html());
</script>

step3. use it into another subtemplate

<script id="package-list-bottom" type="text/x-handlebars-template">
    <div class='po-qty form-el bottom'>        
                <p>
                {{> nutri}}
                </p>
    </div>
</script>

why my app is not popular on appstore?

You finished app uploaded it on appstore and .... nothing happens. You probably was expecting skyrocketing installs and in-app sales but after days,weeks you got some 10,20 installs. And you thinking what is wrong with my app.

The best way to look at this situation is to look at app like art-artifact. Let's say when you have painting picture or sculpture you are not expecting it to look like Rembrant's or Michelangelo's aren't you ? So why it is different in regards of apps ?

Probably because at first look all applications are looking alike and have unified interface and same buttons and UI elements. But the most important things are in details, in iterations between application and user.

The best way to handle this situation is to continue perfecting and creating more apps and make them looks closer to perfect apps every day and learn. As Michelangelo said : "I am still learning."

Monday

c# custom webservice logging and error handling

//step1.declare delagate
public delegate T UnSafeProcedure<T>();

/*step2. add performance and error handling methods */
        public string Concat(params object[] arguments)
        {
            StringBuilder sb = new StringBuilder();
            foreach (var item in arguments)
            {
                sb.AppendFormat("\"{0}\",", item);
            }
            return sb.ToString();
        }

        public T RunSafe<T>(UnSafeProcedure<T> s, params object[] arguments)
        {
            DateTime st = DateTime.Now;
            try
            {
               return  s();
            }
            catch (Exception e1)
            {
                {
                    Debug.Write("Error," + Concat(arguments) + "\r\n" + e1.ToString());
                }
                return default(T);
            }
            finally
            {
                var sec = DateTime.Now.Subtract(st).TotalSeconds;
                if (sec > 20)
                {
                    string tm = ">20sec,start," + st.ToLongTimeString() + ",End," + DateTime.Now.ToLongTimeString();
                    Debug.Write(tm+ Concat(arguments));
                }
            }
        }

/*3.performance counting procedures will looks like:*/

public Receipt VerifyUser(int Id, string username, string password)
{
           return  RunSafe<Receipt>(delegate()
            {
                //internal procedure that needs to be chcked troubleshooted
                using (var service = Instance())
                {
                    return service.VerifyAccount(Id, username, password);
                }

            }, "VerifyUser,facilityId",Id,"username",username,"password",password);
}

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...