[{"data":1,"prerenderedAt":248},["ShallowReactive",2],{"article-namespace-your-javascript":3},{"article":4,"tags":72,"previous":87,"next":171},{"id":5,"title":6,"author":7,"body":8,"createdAt":61,"description":62,"extension":63,"img":55,"meta":64,"navigation":65,"path":66,"seo":67,"stem":68,"tags":69,"updatedAt":61,"__hash__":71},"articles\u002Farticles\u002Fnamespace-your-javascript.md","Namespace your JavaScript","[object Object]",{"type":9,"value":10,"toc":58},"minimark",[11,22,26,29,33,52],[12,13,14,15,18,19,21],"p",{},"There are a couple of ways to create namespaces for your code.  This format allows you to intentionally expose functions as public or keep them internal\u002Fprivate.  I like the following version…",[16,17],"br",{},"\n ",[16,20],{},"\nvar mynamespace = new function () {",[23,24,25],"blockquote",{},"  \nvar internalFunction = function() { \n     \u002F\u002FTODO: code \n};  \n",[23,27,28],{},"  \nthis.publicFunction = function() { \n    \u002F\u002FTODO: code \n};  \n",[30,31,32],"strong",{},"Simple, now why the heck do this?",[34,35,36,40,43,46,49],"ul",{},[37,38,39],"li",{},"A namespace is a container and allows you to bundle up all your functionality using a unique name",[37,41,42],{},"In JavaScript a namespace is really just an object that you have attached all further methods, properties and objects",[37,44,45],{},"Without the usage of namespaces every function will be in the global (aka window) namespace (this occurs by default if you do not use a namespace).  It is a good practice not to clutter the global namespace",[37,47,48],{},"Using namespaces prevents the overwriting of existing function names",[37,50,51],{},"Using namespaces is one step in the direction of object-oriented which promotes modularity and code re-use",[53,54],"img",{"src":55,"alt":56,"style":57},"\u002Farticles\u002Fimages\u002Fns.png","","display:none;",{"title":56,"searchDepth":59,"depth":59,"links":60},2,[],"2015-04-20T08:07:13.6900000-04:00","How to use namespaces within your JavaScript","md",{},true,"\u002Farticles\u002Fnamespace-your-javascript",{"title":6,"description":62},"articles\u002Fnamespace-your-javascript",[70],"javascript","hpUwRZUyAy5HzKNcCB4a57Dnyk7v34btaAKN8B18S4o",[73],{"id":74,"title":75,"body":76,"description":80,"extension":63,"img":81,"meta":82,"name":70,"navigation":65,"path":83,"seo":84,"stem":85,"__hash__":86},"tags\u002Ftags\u002Fjavascript.md","Javascript",{"type":9,"value":77,"toc":78},[],{"title":56,"searchDepth":59,"depth":59,"links":79},[],"JavaScript is a programming language adhering to the ECMAScript spec.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598425237654-4fc758e50a93?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fjavascript",{"description":80},"tags\u002Fjavascript","wqzmOtgcvcAeeB0QinMxw2OqnSglrJN0TeWQ-fulunM",{"id":88,"title":89,"author":7,"body":90,"createdAt":162,"description":163,"extension":63,"img":159,"meta":164,"navigation":65,"path":165,"seo":166,"stem":167,"tags":168,"updatedAt":162,"__hash__":170},"articles\u002Farticles\u002Felement-is-already-the-child-system-windows-markup-xamlparseexception-pivotcontrol-error.md","Element is already the child \u002F System.Windows.Markup.XamlParseException --> PivotControl Error",{"type":9,"value":91,"toc":160},[92],[12,93,94,95,18,97,99,100,18,102,104,105,109,110,113,115,116,118,119,121,122,124,125,127,128,130,131,18,133,18,135,137,138,18,140,142,143,18,145,147,148,18,150,152,153,18,155,157],{},"I have been working with Silverlight PivotViewer control and recently came across problem with the display of the control. \nI have a solution with multiple projects one of which is a Silverlight application.  Everything would compile without any error. \nWhen browsing to the form\u002Fpage with the control I would immediately get an exception on the InitializeComponent(); method within the Silverlight UserControl. \nThis method is called before loading any pivot cxml data.",[16,96],{},[16,98],{},"\nI have seen this component through odd errors or fail to load when there is javascript errors on the page or a failure of any ajax method. \nThe error that is thrown is as follows…",[16,101],{},[16,103],{},"\n{System.Windows.Markup.XamlParseException: Set property 'System.Windows.FrameworkElement.Style' threw an exception. ",[106,107,108],"span",{},"Line: 15 Position: 43"," ---> System.Windows.Markup.XamlParseException: Element is already the child of another element. ",[106,111,112],{},"Line: 0 Position: 0",[16,114],{},"\n   at MS.Internal.XcpImports.CreateFromXaml(UnmanagedMemoryStream stream, String sourceAssemblyName, Boolean createNamescope, Boolean requireDefaultNamespace, Boolean allowEventHandlers)",[16,117],{},"\n   at System.Windows.Controls.Control.GetBuiltInStyle(IntPtr nativeTarget, IntPtr& nativeStyle)",[16,120],{},"\n   --- End of inner exception stack trace ---",[16,123],{},"\n   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)",[16,126],{},"\n   at PivotView.Viewer.InitializeComponent()",[16,129],{},"\n   at PivotView.Viewer..ctor()}",[16,132],{},[16,134],{},[16,136],{},"\nIf searching Google you will see a number of posts on errors surrounding ‘XamlParseException’, ‘Styles’, ‘Element is already the child’ etc.  Without help from these posts, I finally came across the solution.  I found the error was the result of some missing references in the Silverlight project.  The components missing can be found in C:\\Program Files (x86)\\Microsoft SDKs\\Silverlight\\v4.0\\Toolkit\\Apr10\\Bin (which is installed as part of the most recent Silverlight Toolkit).  References to the following components was necessary.",[16,139],{},[16,141],{},"\nSystem.Windows.Controls.Layout.Toolkit.dll\nSystem.Windows.Controls.Toolkit.dll\nSystem.Windows.Controls.Toolkit.Internals.dll",[16,144],{},[16,146],{},"\nIf you're having issues, rename the xap file (adding .zip) and take a look to ensure those dlls are included.",[16,149],{},[16,151],{},"\nI thought I would post this information for others as well as a reminder to myself.  If you have any questions, let me know.",[16,154],{},[16,156],{},[53,158],{"src":159,"alt":56,"style":57},"\u002Farticles\u002Fimages\u002Fpivotviewer.jpg",{"title":56,"searchDepth":59,"depth":59,"links":161},[],"2015-04-20T08:07:13.7700000-04:00",null,{},"\u002Farticles\u002Felement-is-already-the-child-system-windows-markup-xamlparseexception-pivotcontrol-error",{"title":89,"description":163},"articles\u002Felement-is-already-the-child-system-windows-markup-xamlparseexception-pivotcontrol-error",[169],"silverlight","MwzE74POWqzTSnbetCRmaz5deTYzJG440Jb4tLUMo7w",{"id":172,"title":173,"author":7,"body":174,"createdAt":239,"description":240,"extension":63,"img":233,"meta":241,"navigation":65,"path":242,"seo":243,"stem":244,"tags":245,"updatedAt":239,"__hash__":247},"articles\u002Farticles\u002Fjson-know-more.md","Json–know more",{"type":9,"value":175,"toc":234},[176,193,198,202,207,210,214,217,231],[12,177,178,179,181,184,185,187,188,190,192],{},"{“People”:{",[16,180],{},[106,182,183],{},"\n{“name”:”frank”, “age”:”21”},\n{“name”:”joe”,”age”:44”}\n",",",[16,186],{},"\n“Markeing”:",[106,189,183],{},[16,191],{},"\n} }",[194,195,197],"h4",{"id":196},"squiggles-squares-colons-and-commas","Squiggles, Squares, Colons and Commas",[199,200,201],"ol",{},"  \n* Squiggly brackets act as 'containers'   \n* Square brackets holds arrays   \n* Names and values are separated by a colon.   \n* Array elements are separated by commas  \n",[203,204,206],"h3",{"id":205},"json-is-like-xml-because","\nJSON is like XML because:",[199,208,209],{},"  \n* They are both 'self-describing' meaning that values are named, and thus 'human readable'   \n* Both are hierarchical. (i.e. You can have values within values.)   \n* Both can be parsed and used by lots of programming languages   \n* Both can be passed around using AJAX (i.e. httpWebRequest)  \n",[203,211,213],{"id":212},"json-is-unlike-xml-because","JSON is UNlike XML because:",[199,215,216],{},"  \n* XML uses angle brackets, with a tag name at the start and end of an element: JSON uses squiggly brackets with the name only at the beginning of the element.   \n* JSON is less verbose so it's definitely quicker for humans to write, and probably quicker for us to read.   \n* JSON can be parsed trivially using the eval() procedure in JavaScript   \n* JSON includes arrays {where each element doesn't have a name of its own}   \n* In XML you can use any name you want for an element, in JSON you can't use reserved words from javascript  \n",[12,218,219,220,224,225,230],{},"On the server-side you can easily serialize\u002Fdeserialize your objects to\u002Ffrom JSON. For ",[221,222,223],"code",{},".net"," programmers you can use libraries like ",[226,227,229],"a",{"href":228},"http:\u002F\u002Fwww.newtonsoft.com\u002Fproducts\u002Fjson\u002F","Json.net"," to do this automatically for you (using reflection i assume), or you can generate your own custom code to perform it even faster on a case by case basis.",[53,232],{"src":233,"alt":56,"style":57},"\u002Farticles\u002Fimages\u002FJSON.gif",{"title":56,"searchDepth":59,"depth":59,"links":235},[236,238],{"id":205,"depth":237,"text":206},3,{"id":212,"depth":237,"text":213},"2015-04-20T08:07:13.6000000-04:00","{“People”:{\n{“name”:”frank”, “age”:”21”},\n{“name”:”joe”,”age”:44”}\n,\n“Markeing”:\n{“name”:”frank”, “age”:”21”},\n{“name”:”joe”,”age”:44”}\n\n} }",{},"\u002Farticles\u002Fjson-know-more",{"title":173,"description":240},"articles\u002Fjson-know-more",[246,70],"aspnet","OoXmULq_Ve1WX5OVc1z-FhmnTNctKTJ7RjuIMoBl31Q",1781574764699]