-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
996 lines (547 loc) · 30.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Proven Style</title>
<meta name="author" content="Michael Dudley">
<meta name="description" content="I finally upgraded my Visual Studio to 2015 and the transition has been pretty smooth! However, today I had an issue that took me a little while to …">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://provenstyle.github.io">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="Proven Style" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/lib/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-53803911-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body >
<header role="banner"><hgroup>
<h1><a href="/">Proven Style</a></h1>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:provenstyle.github.io" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
<li><a href="/projects">Projects</a></li>
<li><a href="/presentations">Presentations</a></li>
<li><a href="/about">About Me</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2015/10/02/Visual-Studio-2015-Windows-Authentication-And-IIS-Express/">Visual Studio 2015, Windows Authentication, and IIS Express</a></h1>
<p class="meta">
<time datetime="2015-10-02T13:00:00-05:00" pubdate data-updated="true">Oct 2<span>nd</span>, 2015</time>
</p>
</header>
<div class="entry-content"><p>I finally upgraded my Visual Studio to 2015 and the transition has been pretty smooth! However, today I had an issue that took me a little while to solve. An Asp.net MVC web app that uses Windows Authentication, had been working great, but was suddenly gave me the following error:</p>
<pre><code>Access is denied.
Description: An error occurred while accessing the resources required to serve this request.
The server may not be configured for access to the requested URL.
Error message 401.2.: Unauthorized: Logon failed due to server configuration.
Verify that you have permission to view this directory or page based on the credentials
you supplied and the authentication methods enabled on the Web server. Contact the Web
server's administrator for additional assistance.
</code></pre>
<p>I learn several things trouble shooting this. The first is that IIS Express configuration has moved from <code>C:\Users\YourUserName\Documents\IISExpress\config\applicationhost.config</code> out of the My Documents IISExpress folder and into the new <code>.vs/configuration</code> folder.</p>
<p>The second thing I was reminded of is that there is another place to edit properties for your project. I almost never press f4 on my project. I right click and go down to properties, but that is a very different set of properties than you get when you press f4.</p>
<p>The solution to my authorization issue was to go into the f4 project properties and set the following:</p>
<p>Anonymous Authentication – Disabled</p>
<p>Windows Authentication – Enabled</p>
<p>Apparently these properties update the IIS applicationHost.config directly. It adds the following to the config.</p>
<pre><code><location path="Project.Name.Here">
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
<anonymousAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</location>
</code></pre>
<p>It is irritating that you can’t save these somewhere in the .csproj file instead, but not a big deal once you know it is there.</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/07/17/AspNet-Identity-User-Names/">Asp.net Identity User Names</a></h1>
<p class="meta">
<time datetime="2014-07-17T13:00:00-05:00" pubdate data-updated="true">Jul 17<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p>I’ve been working on the web site for the <a href="https://DallasTechFest.com" title="Dallas Tech Fest">2014 Dallas Tech Fest</a> and it has been such a fun project! A huge part of that is because of <a href="https://twitter.com/uxward">Brandon Ward’s </a>amazing designs.</p>
<p>One unexpected challange was using twitter for the authorization. After 30 people had already signed up on the site with no issue, there was one user that was stuck in an authentication loop. Everytime he authenticated with twitter, he was asked to log in again.</p>
<p>It turns out he was the first user on the site, that I know of, to have a user name starting with an underscore. By default Asp.net Identity will only accept alphanumeric user names, and I was using his twitter username as the username for the site. You would have the same issue if you tried to allow an email as the username.</p>
<p>To fix it, I went into the constructor for the Account controller and created a new UserValidator.</p>
<pre><code>public AccountController(UserManager<ApplicationUser> userManager)
{
UserManager = userManager;
UserManager.UserValidator =
new UserValidator<ApplicationUser>(UserManager)
{AllowOnlyAlphanumericUserNames = false};
}
</code></pre>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/07/09/FFMPEG-Inspection/">FFMPEG: Analyzing Audio and Video Files</a></h1>
<p class="meta">
<time datetime="2014-07-09T17:00:00-05:00" pubdate data-updated="true">Jul 9<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p><code>ffmpeg -i c:\temp\video.mpg</code></p>
<p><code>-i</code> is the input argument. By specifying an input, but no output, FFMPEG will inspect the file and give you lots of information such as:</p>
<h3>Video</h3>
<ul>
<li>Encoding</li>
<li>Streams</li>
<li>Bit Rate</li>
<li>Aspect Ratio</li>
<li>Frame Rate</li>
</ul>
<h3>Audio</h3>
<ul>
<li>Encoding</li>
<li>Bit depth</li>
<li>Sampling Frequency</li>
<li>Channels</li>
</ul>
<h3>Example Output</h3>
<pre><code>ffmpeg.exe -i "C:\temp\audio\image\VIDEO_TS\VTS_01_1.VOB"
ffmpeg version N-42347-g299387e Copyright (c) 2000-2012 the FFmpeg developers
built on Jul 8 2012 15:44:54 with gcc 4.7.1
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r -enable libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 64.100 / 51. 64.100
libavcodec 54. 33.100 / 54. 33.100
libavformat 54. 15.102 / 54. 15.102
libavdevice 54. 1.100 / 54. 1.100
libavfilter 3. 1.100 / 3. 1.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[mpeg @ 01edf700] max_analyze_duration 5000000 reached at 5016000
Input #0, mpeg, from 'C:\temp\audio\image\VIDEO_TS\VTS_01_1.VOB':
Duration: 00:03:06.80, start: 0.500000, bitrate: 6265 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 104857 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc
Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s
At least one output file must be specified
</code></pre>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/06/30/FFMPEG-Documentation/">FFMPEG: Where Is the Documentation?</a></h1>
<p class="meta">
<time datetime="2014-06-30T13:00:00-05:00" pubdate data-updated="true">Jun 30<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p>It seems like the version of FFMPEG that I am using on projects is never that same version covered in the documentation on the website. You can get version specific documentation with FFMPEG from the console with the -h argument.</p>
<p><code>ffmpeg -h</code></p>
<p>You can dump the ffmpeg documentation to a text file for easier reading and searching by redirecting the output.</p>
<p><code>ffmpeg -h > c:\temp\ffmpeg.txt</code></p>
<p>You can also view a list of the supported codecs for your version of FFMPEG
<code>ffmpeg -codec > c:\temp\supportedCodecs.txt</code></p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/06/27/Bundling-Multiple-Spas/">Durandal: Bundling Multiple Spas With Weyland</a></h1>
<p class="meta">
<time datetime="2014-06-27T13:00:00-05:00" pubdate data-updated="true">Jun 27<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p><a href="http://bit.ly/DurandalBlog">Durandal.js: Get Started</a></p>
<p>By default Weyland expects a configuration file called <code>weyland-config.js</code> This caused me problems when I added multiple SPA pages to my solution. I wanted to create two different bundled files. One for each SPA.</p>
<p>Its not in the documentation, but you can specify the config file as an optional parameter <code>--config</code>. To make this work I also had to use the trick of appending <code>%~dp0</code> to the config file name to include the full path of the config file. More information on <code>%~dp0</code> can be found by typing <code>for /?</code> into a command prompt and reading the help. If you don’t do this weyland will not find your config file and continue to look for the default config.</p>
<p>In the end this worked for me.</p>
<pre><code>weyland build --config "%~dp0customConfigFile1.js"
weyland build --config "%~dp0customConfigFile2.js"
</code></pre>
<h2>Important</h2>
<p>I was also reminded the hard way that JavaScript is case sensitive. This mean that node is also case sensitive. So I spent several hours trying to figure out why my bundling was not excluding the files I told it to exclude. It turns out I had a mismatch in the casing of a directory name. On the file system its name was capitalized, and in the config file I had used lowercase. It was very frustrating, but looking on the bright side, I was forced to learn how to debug node application using the console.</p>
<p><a href="http://bit.ly/DurandalBlog">Durandal.js: Get Started</a></p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/01/20/deploying-sql-server-compact/">Deploying SQL Server Compact</a></h1>
<p class="meta">
<time datetime="2014-01-20T17:46:00-06:00" pubdate data-updated="true">Jan 20<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p>I wrote an application that stores information in a SQL Server Compact database. It worked on my machine, but when QA installed it they received the following error:</p>
<pre>
Exception occured while configuring the databaseSystem.ArgumentException:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
at System.Data.Entity.Infrastructure.SqlCeConnectionFactory.CreateConnection(String nameOrConnectionString)
at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
at System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName()
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.CreateObjectContextForDdlOps()
at System.Data.Entity.Database.Exists()
</pre>
<p>I had added references to the following dll’s and they were in my bin directory:</p>
<ul>
<li>System.Data.SqlServerCe.dll</li>
<li>System.Data.SqlServerCe.Entity.dll</li>
</ul>
<p>but SQL Server Compact has other dependencies of which I was not aware. Namely SQL Server Compact needs its own native components. These can either come from the GAC or from a local copy installed in the applications file path.</p>
<h2>Reproducing the issue</h2>
<p>I had installed SQL Server Compact 4.0 on my machine several months back and didn’t realize these libraries were installed in the Gac on my machine. To reproduce the issue all I had to do was uninstalled SQL Server Compact 4.0.</p>
<h2>Possible Solutions</h2>
<ol>
<li><p>Install SQL Server Compact on the target machine for my application.</p></li>
<li><p>Include a local copy of the SQL Server Compact native components with my application.</p></li>
</ol>
<p>I chose option two because the whole idea of using SQLCE on this project was so that the users did not have to install a database.</p>
<h2>First I had to get the Microsoft SQL Server Compact files</h2>
<p>I installed Microsoft SQL Server Compact 4 on my machine again and in the <code>C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\Private</code> folder are all the files I needed to deploy SqlCE with my application. After I got the files I needed I uninstalled SqlCE again.</p>
<h2>Next I had to add a post build event</h2>
<p>This copies two processor specific folders into the bin directory</p>
<pre>
if not exist "$(TargetDir)x86" md "$(TargetDir)x86"
xcopy /s /y "$(SolutionDir)..\Lib\Microsoft\SqlServerCe\x86\*.*" "$(TargetDir)x86"
if not exist "$(TargetDir)amd64" md "$(TargetDir)amd64"
xcopy /s /y "$(SolutionDir)..\Lib\Microsoft\SqlServerCe\amd64\*.*" "$(TargetDir)amd64"
</pre>
<h2>Then I had to configure my Data Provider</h2>
<pre><code><system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
</code></pre>
<h2>Lastly I needed an assembly redirect</h2>
<p>Here is the error I encountered.</p>
<pre>
Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
</pre>
<h3>Assembly Redirect</h3>
<pre><code><dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
</code></pre>
<h2>Also noteworthy</h2>
<p>I had already configured Entity Frame work to use SqlCE</p>
<pre><code><configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="lvsData" connectionString="Data Source=C:\temp\appData.sdf;Max Database Size=4000;" providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</code></pre>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/01/06/using-apply-to-call-a-function-in-javascript/">Using Apply in JavaScript</a></h1>
<p class="meta">
<time datetime="2014-01-06T18:33:00-06:00" pubdate data-updated="true">Jan 6<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p>Today I went a little deeper into JavaScript! The problem I was facing was:</p>
<blockquote><p>“How do I call a function and provide the arguments as an array instead of a comma separated list?”</p></blockquote>
<p>My arguments were not know until runtime and there could be 0 to 4 arguments.</p>
<h2>Function.prototype.apply() to the rescue</h2>
<p>The apply() method lets you invoke a function with arguments as an array.</p>
<p>Here I am making a service call to stopStreaming for every vehicle in my array. This service call returns a promise that I push into an array. I can then use <code>$.when.apply(this, promises).always()</code> to wait for <em>all</em> the calls to return before I resolve my deferred.</p>
<p>Here is the full code.</p>
<pre><code>vm.stopAll = function () {
var deferred = $.Deferred();
var promises = [];
for (var i = 0; i < streamingVehicles.selectedVehicles.length; i++) {
var vehicle = streamingVehicles.selectedVehicles[i];
var promise = stopStreaming(vehicle);
promises.push(promise);
}
$.when.apply(this, promises).always(function() {
deferred.resolve();
});
return deferred.promise();
};
</code></pre>
<p>Incidentally, this is also a nice demonstration of using the promise pattern and the jQuery Deferred object.</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/01/04/durandal-system-dot-js/">Durandal - system.js</a></h1>
<p class="meta">
<time datetime="2014-01-04T12:36:00-06:00" pubdate data-updated="true">Jan 4<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p>The Durandal core is made up of 8 modules. The system.js module provides core functionality to Durandal and it is also useful for any custom modules we write in our own apps.</p>
<h3>Features</h3>
<ul>
<li>Logging</li>
<li>Debug mode</li>
<li>Object Type Testing</li>
<li>noop function</li>
<li>console.log polyfill</li>
<li>Object.keys polyfill</li>
<li>gets and sets the __moduleId__ of an object</li>
<li>Creates seam to use your preferred promise implementation</li>
</ul>
<h3>Architecture</h3>
<ul>
<li>AMD Module</li>
<li>system is an object literal. There is only one instance.</li>
<li>Lines: 427</li>
<li>Documentation is done with <a href="https://github.com/yui/yuidoc">YUIDoc – Javascript Documentation Tool</a></li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>requireJs</li>
<li>jQuery</li>
<li>No other durandal dependencies</li>
<li>Every module in durandal depends on system</li>
</ul>
<h2>Debug mode</h2>
<pre><code>system.debug(true);
</code></pre>
<ul>
<li>turns debug mode on</li>
<li>logs to the console and throw errors</li>
</ul>
<p>Debug is off by default</p>
<pre><code>system.debug(false);
</code></pre>
<ul>
<li>turns debug mode off</li>
<li>no logging and no error throwing</li>
<li>uses the noop function until turned on</li>
</ul>
<h2>Interesting uses of JavaScript</h2>
<h4>Reflection</h4>
<pre><code>Object.keys(obj);
Returns an array of strings representing all the enumerable property names of the object
</code></pre>
<h4>Make shortcuts to native JavaScript functions</h4>
<pre><code> var nativeKeys = Object.keys,
hasOwnProperty = Object.prototype.hasOwnProperty,
toString = Object.prototype.toString,
nativeIsArray = Array.isArray,
slice = Array.prototype.slice;
</code></pre>
<h4>The noop function (No Operation)</h4>
<pre><code> var noop = function() { };
Define a function that does nothing and set it as a default
to be replaced later during configuration if desired.
</code></pre>
<h4>Arguments and parameters</h4>
<p>You can refer to a functions parameters by name or by using the arguments array</p>
<p>Test the number of arguments and take different actions.</p>
<pre><code>if (arguments.length == 1) {};
</code></pre>
<p>Refer to arguments by index</p>
<pre><code>var first = arguments[0];
</code></pre>
<p>Accept n number of arguments in a function.</p>
<pre><code>function(obj) {
//do something with obj
var rest = slice.call(arguments, 1);
for (var i = 0; i < rest.length; i++) {
var source = rest[i];
if (source) {
//do something with the rest of the arguments
}
}
}
</code></pre>
<h2>Public Api</h2>
<p><a href="http://durandaljs.com/documentation/api/#module/system">Official system.js documentation is here >></a></p>
<h4>My summary of the api</h4>
<pre><code>version - durandal version
noop - no operation function
getModuleId - gets \_\_moduleId\_\_
setModuleId - sets \_\_moduleId\_\_
resolveObject - returns either the object or news it up from a function
debug - turns debug mode on and off
log - logs to console. noop by default
error - noop by default
assert - throws and error only in debug mode
defer - wraps the jquery defer. Lets you replace it with a different implementation
guid - simple guid
acquire - returns modules from requireJs
extend - copies properties from n number of functions onto an object and returns the extended object
wait - waits specified number of seconds and returns a promise
keys- polyfills the getKeys behavior
</code></pre>
<h3>is Functions to test object types</h3>
<pre><code>isElement
isArray
isObject
isBoolean
isPromise
isArguments
isFunction
isString
isNumber
isDate
isRegExp
</code></pre>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/08/19/registering-asp-dot-net/">Registering ASP.NET in IIS</a></h1>
<p class="meta">
<time datetime="2013-08-19T16:32:00-05:00" pubdate data-updated="true">Aug 19<span>th</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>Every time I have set up a new development environment in the last three years I have forgotten to register Asp.net with IIS. When I was first learning it would derail me for a quite a while. I have done it so many times now that I recognize what is going on when I see the errors, but it is still irritating. What was that command again? I am putting it here so I never have to Google it again!</p>
<pre><code>aspnet_regiis
</code></pre>
<p>“Not a recognized command!” you say?
Yes, you have to change directories into the .net version that you are using.</p>
<pre><code>cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
</code></pre>
<p>Now run the command.</p>
<p>What? That didn’t do it either? Don’t forget to add the install flag.</p>
<pre><code>aspnet_regiis -i
</code></pre>
<p>Still not working? Don’t forget to start your command prompt as admin, and yes now you have to cd directories all over again into your .net version.</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/07/31/setting-permissions-for-your-app-pool/">Setting Permissions for Your App Pool</a></h1>
<p class="meta">
<time datetime="2013-07-31T08:37:00-05:00" pubdate data-updated="true">Jul 31<span>st</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>How the heck do you reference an IIS application pool user when you need to give it access to a directory? I never can remember either! I flounder around trying different combinations. I question whether it needs quotes. I look for the right stack overflow question and never seem to find it. So here it is for you and I to remember. Don’t worry about the spaces and no need for quotation marks.</p>
<pre><code>IIS AppPool\application pool name
</code></pre>
</div>
</article>
<div class="pagination">
<a class="prev" href="/blog/page/2/">← Older</a>
<a href="/blog/archives">Blog Archives</a>
</div>
</div>
<aside class="sidebar">
<section>
<h1>Pluralsight Course</h1>
<a href="http://bit.ly/DurandalBlog">Durandal.js: Get Started</a>
<h1>Recent Posts</h1>
<ul id="recent_posts">
<li class="post">
<a href="/blog/2015/10/02/Visual-Studio-2015-Windows-Authentication-And-IIS-Express/">Visual Studio 2015, Windows Authentication, and IIS Express</a>
</li>
<li class="post">
<a href="/blog/2014/07/17/AspNet-Identity-User-Names/">Asp.net Identity User Names</a>
</li>
<li class="post">
<a href="/blog/2014/07/09/FFMPEG-Inspection/">FFMPEG: Analyzing Audio and Video Files</a>
</li>
<li class="post">
<a href="/blog/2014/06/30/FFMPEG-Documentation/">FFMPEG: Where Is the Documentation?</a>
</li>
<li class="post">
<a href="/blog/2014/06/27/Bundling-Multiple-Spas/">Durandal: Bundling Multiple Spas With Weyland</a>
</li>
</ul>
</section>
<section>
<h1>GitHub Repos</h1>
<ul id="gh_repos">
<li class="loading">Status updating…</li>
</ul>
<a href="https://github.com/provenstyle">@provenstyle</a> on GitHub
<script type="text/javascript">
$(document).ready(function(){
if (!window.jXHR){
var jxhr = document.createElement('script');
jxhr.type = 'text/javascript';
jxhr.src = '/javascripts/libs/jXHR.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(jxhr, s);
}
github.showRepos({
user: 'provenstyle',
count: 5,
skip_forks: true,
target: '#gh_repos'
});
});
</script>
<script src="/javascripts/github.js" type="text/javascript"> </script>
</section>
</aside>
</div>
</div>
<footer role="contentinfo"><p>
Copyright © 2015 - Michael Dudley -
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
</p>
</footer>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#appId=212934732101925&xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script type="text/javascript">
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = '//platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>
</body>
</html>