-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.xml
3240 lines (2558 loc) · 210 KB
/
atom.xml
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
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Udooz!]]></title>
<link href="http://udooz.github.io//blog/atom.xml" rel="self"/>
<link href="http://udooz.github.io//blog/"/>
<updated>2014-06-25T17:17:02+05:30</updated>
<id>http://udooz.github.io//blog/</id>
<author>
<name><![CDATA[M Sheik Uduman Ali]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Don’t use elephant for your garden work]]></title>
<link href="http://udooz.github.io//blog/2014/06/dont-use-elephant-for-your-garden-work/"/>
<updated>2014-06-19T00:00:00+05:30</updated>
<id>http://udooz.github.io//blog/2014/06/dont-use-elephant-for-your-garden-work</id>
<content type="html"><![CDATA[<p>While learning the new Tez engine and query vectorization concepts in Hadoop 2.0, I came to know that the query vectorization is claimed as 3x powerful and consume less CPU time in actual Hadoop cluster. Hortonworks tutorial uses a sample sensor data in a CSV that is imported into Hive. Then a sample has been used to explain the performance.</p>
<p>The intention of this post is neither explaining Tez engine and query vectorization nor Hive query. Let us familiarize the problem I have worked before get to know the purpose of this post. <img src="http://udooz.net/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p>One sample CSV file called ‘HVAC.csv’ contains 8000 records that contain temperature information on different building during different days. Part of the file content:</p>
<p>Date,Time,TargetTemp,ActualTemp,System,SystemAge,BuildingID<br/>
6/1/13,0:00:01,66,58,13,20,4<br/>
6/2/13,1:00:01,69,68,3,20,17<br/>
6/3/13,2:00:01,70,73,17,20,18<br/>
6/4/13,3:00:01,67,63,2,23,15<br/>
6/5/13,4:00:01,68,74,16,9,3<br/>
…<br/>
In the Hive, following configurations are specified to enable Tez engine and query vectorization.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>hive> <span class="nb">set </span>hive.execution.engine<span class="o">=</span>mr<span class="p">;</span>
</span><span class='line'>hive> <span class="nb">set </span>hive.execution.engine<span class="o">=</span>tez<span class="p">;</span>
</span><span class='line'>hive> <span class="nb">set </span>hive.vectorized.execution.enabled<span class="p">;</span>
</span><span class='line'> hive.vectorized.execution.enabled<span class="o">=</span><span class="nb">true</span>
</span></code></pre></td></tr></table></div></figure>
<p>I execute the following query in my sandbox that surprisingly took 48 seconds for a ‘group by’ and ‘count’ on 8000 records as shown below:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="k">select </span>date, count<span class="o">(</span>buildingid<span class="o">)</span> from hvac_orc group by date<span class="p">;</span>
</span></code></pre></td></tr></table></div></figure>
<p>This query groups the sensor data by date and count the number of building for that date. It produces 30 results as shown below:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>Status: Finished successfully
</span><span class='line'>OK
</span><span class='line'>6/1/13 267
</span><span class='line'>6/10/13 267
</span><span class='line'>6/11/13 267
</span><span class='line'>...
</span><span class='line'>Time taken: 48.261 seconds, Fetched: 30 row<span class="o">(</span>s<span class="o">)</span>
</span></code></pre></td></tr></table></div></figure>
<p>Then I plan to write simple program without MapReduce castle, since it is just 8000 records. I created a F# script that read the CSV (note that I did not use any CSV type provider) and using Deedle exploratory library (again, LINQ can also help). I achieved the same result as shown below.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
</pre></td><td class='code'><pre><code class='fsharp'><span class='line'><span class="k">module</span> <span class="nn">ft</span>
</span><span class='line'>
</span><span class='line'><span class="o">#</span><span class="n">I</span> <span class="s">"..</span><span class="err">\</span><span class="s">packages</span><span class="err">\</span><span class="s">Deedle.1.0.0"</span>
</span><span class='line'><span class="o">#</span><span class="n">load</span> <span class="s">"Deedle.fsx"</span>
</span><span class='line'><span class="k">open</span> <span class="nn">System</span>
</span><span class='line'><span class="k">open</span> <span class="nn">System.IO</span>
</span><span class='line'><span class="k">open</span> <span class="nn">System.Globalization</span>
</span><span class='line'><span class="k">open</span> <span class="nn">System.Diagnostics</span>
</span><span class='line'><span class="k">open</span> <span class="nn">Deedle</span>
</span><span class='line'>
</span><span class='line'><span class="k">type</span> <span class="nc">hvac</span> <span class="o">=</span> <span class="o">{</span> <span class="n">Date</span> <span class="o">:</span> <span class="n">DateTime</span><span class="o">;</span> <span class="n">BuildingID</span> <span class="o">:</span> <span class="n">int</span><span class="o">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">let</span> <span class="nv">execute</span> <span class="o">=</span>
</span><span class='line'> <span class="k">let</span> <span class="nv">stopwatch</span> <span class="o">=</span> <span class="nn">Stopwatch</span><span class="p">.</span><span class="n">StartNew</span><span class="bp">()</span>
</span><span class='line'>
</span><span class='line'> <span class="k">let</span> <span class="nv">enus</span> <span class="o">=</span> <span class="k">new</span> <span class="n">CultureInfo</span><span class="o">(</span><span class="s">"en-US"</span><span class="o">)</span>
</span><span class='line'> <span class="k">let</span> <span class="nv">fs</span> <span class="o">=</span> <span class="k">new</span> <span class="n">StreamReader</span><span class="o">(</span><span class="s">"..</span><span class="err">\</span><span class="s">ml</span><span class="err">\</span><span class="s">SensorFiles</span><span class="err">\</span><span class="s">HVAC.csv"</span><span class="o">)</span>
</span><span class='line'> <span class="k">let</span> <span class="nv">lines</span> <span class="o">=</span> <span class="n">fs</span><span class="o">.</span><span class="n">ReadToEnd</span><span class="bp">()</span> <span class="o">|></span> <span class="o">(</span><span class="k">fun</span> <span class="n">s</span> <span class="o">-></span> <span class="n">s</span><span class="o">.</span><span class="n">Split</span><span class="o">(</span><span class="s">"</span><span class="se">\r\n</span><span class="s">"</span><span class="o">.</span><span class="n">ToCharArray</span><span class="bp">()</span><span class="o">))</span>
</span><span class='line'>
</span><span class='line'> <span class="k">let</span> <span class="nv">ohvac</span> <span class="o">=</span> <span class="n">lines</span><span class="o">.[</span><span class="mi">1</span><span class="o">..(</span><span class="nn">Array</span><span class="p">.</span><span class="n">length</span> <span class="n">lines</span><span class="o">)</span> <span class="o">-</span> <span class="mi">1</span><span class="o">]</span>
</span><span class='line'> <span class="o">|></span> <span class="nn">Array</span><span class="p">.</span><span class="n">map</span> <span class="o">(</span><span class="k">fun</span> <span class="n">s</span> <span class="o">-></span> <span class="n">s</span><span class="o">.</span><span class="n">Split</span><span class="o">(</span><span class="s">","</span><span class="o">.</span><span class="n">ToCharArray</span><span class="bp">()</span><span class="o">))</span>
</span><span class='line'> <span class="o">|></span> <span class="nn">Array</span><span class="p">.</span><span class="n">map</span> <span class="o">(</span><span class="k">fun</span> <span class="n">s</span> <span class="o">-></span> <span class="o">{</span><span class="n">Date</span> <span class="o">=</span> <span class="nn">DateTime</span><span class="p">.</span><span class="n">Parse</span><span class="o">(</span><span class="n">s</span><span class="o">.[</span><span class="mi">0</span><span class="o">],</span> <span class="n">enus</span><span class="o">);</span> <span class="n">BuildingID</span> <span class="o">=</span> <span class="n">int</span><span class="o">(</span><span class="n">s</span><span class="o">.[</span><span class="mi">6</span><span class="o">])})</span>
</span><span class='line'> <span class="o">|></span> <span class="nn">Frame</span><span class="p">.</span><span class="n">ofRecords</span>
</span><span class='line'>
</span><span class='line'> <span class="k">let</span> <span class="nv">result</span> <span class="o">=</span> <span class="n">ohvac</span><span class="o">.</span><span class="n">GroupRowsBy</span><span class="o">(</span><span class="s">"Date"</span><span class="o">)</span>
</span><span class='line'> <span class="o">|></span> <span class="nn">Frame</span><span class="p">.</span><span class="n">getNumericCols</span>
</span><span class='line'> <span class="o">|></span> <span class="nn">Series</span><span class="p">.</span><span class="n">mapValues</span> <span class="o">(</span><span class="nn">Stats</span><span class="p">.</span><span class="n">levelCount</span> <span class="n">fst</span><span class="o">)</span>
</span><span class='line'> <span class="o">|></span> <span class="nn">Frame</span><span class="p">.</span><span class="n">ofColumns</span>
</span><span class='line'>
</span><span class='line'> <span class="n">stopwatch</span><span class="o">.</span><span class="n">Stop</span><span class="bp">()</span>
</span><span class='line'> <span class="o">(</span><span class="n">stopwatch</span><span class="o">.</span><span class="n">ElapsedMilliseconds</span><span class="o">,</span> <span class="n">result</span><span class="o">)</span>
</span></code></pre></td></tr></table></div></figure>
<p>In the FSI,</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='fsharp'><span class='line'><span class="o">></span> <span class="o">#</span><span class="n">load</span> <span class="s">"finalTouch.fsx"</span><span class="o">;;</span>
</span><span class='line'><span class="o">></span> <span class="k">open</span> <span class="nn">ft</span><span class="o">;;</span>
</span><span class='line'><span class="o">></span> <span class="n">ft</span><span class="o">.</span><span class="n">execute</span><span class="o">;;</span>
</span><span class='line'><span class="k">val</span> <span class="n">it</span> <span class="o">:</span> <span class="kt">int64</span> <span class="o">*</span> <span class="nn">Deedle</span><span class="p">.</span><span class="n">Frame</span> <span class="o">=</span>
</span><span class='line'><span class="o">(</span><span class="mi">83L</span><span class="o">,</span>
</span><span class='line'><span class="n">BuildingID</span>
</span><span class='line'><span class="mi">01</span><span class="o">-</span><span class="mi">06</span><span class="o">-</span><span class="mi">2013</span> <span class="mi">12</span><span class="o">:</span><span class="mi">00</span><span class="o">:</span><span class="mi">00</span> <span class="n">AM</span> <span class="o">-></span> <span class="mi">267</span>
</span><span class='line'><span class="mi">02</span><span class="o">-</span><span class="mi">06</span><span class="o">-</span><span class="mi">2013</span> <span class="mi">12</span><span class="o">:</span><span class="mi">00</span><span class="o">:</span><span class="mi">00</span> <span class="n">AM</span> <span class="o">-></span> <span class="mi">267</span>
</span><span class='line'><span class="mi">03</span><span class="o">-</span><span class="mi">06</span><span class="o">-</span><span class="mi">2013</span> <span class="mi">12</span><span class="o">:</span><span class="mi">00</span><span class="o">:</span><span class="mi">00</span> <span class="n">AM</span> <span class="o">-></span> <span class="mi">267</span>
</span><span class='line'><span class="mi">04</span><span class="o">-</span><span class="mi">06</span><span class="o">-</span><span class="mi">2013</span> <span class="mi">12</span><span class="o">:</span><span class="mi">00</span><span class="o">:</span><span class="mi">00</span> <span class="n">AM</span> <span class="o">-></span> <span class="mi">267</span>
</span><span class='line'><span class="o">...</span>
</span></code></pre></td></tr></table></div></figure>
<p>The is completed within 83 milliseconds. You may argue that I comparing apple with orange. No!. My intention is to understand when MapReduce is the savior. The parable of the above exercise is that be cautious and analyze well before moving your data processing mechanisms into MapReduce clusters.</p>
<blockquote><p>Elephants are very effective in labor requiring hard slogging and heavy lifting. Not for your gardens!! <img src="http://udooz.net/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p>Note that the sample CSV files from HortonWorks is clearly for training purpose. This blog post just take that as an example to project the maximum data-generation capability of a small or medium size application for a period. The above script may not scale and will not perform well with more than the above numbers. Hence, this is not anti-MapReduce proposal.</p></blockquote>
<p><a style="display: none;" href="http://www.codeproject.com" rel="tag">CodeProject</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Unpacking Apache Storm in developer box]]></title>
<link href="http://udooz.github.io//blog/2014/04/unpacking-apache-storm-in-developer-box/"/>
<updated>2014-04-18T00:00:00+05:30</updated>
<id>http://udooz.github.io//blog/2014/04/unpacking-apache-storm-in-developer-box</id>
<content type="html"><![CDATA[<p>It is a long time pending task to evaluate and learn Apache Storm. Storm infrastructure needs Nimbus and Zookeeper.</p>
<p>My intention is to install Storm in my regular Ubuntu single box instead of any cluster environment/VMs, the reason is Apache Storm is just a jar file.</p>
<p>Zookeeper was already installed in my machine as single-cluster mode. I already have other prerequisites Java 6 or greater and Python 2.6.6 or greater.</p>
<p>I simply extract apache-storm-0.9.1-incubating.tar.gz into my app directory. We need to play around with two directories as like<br/>
apache-storm-0.9.1<br/>
|_<strong>_</strong> bin<br/>
|_<strong>_</strong> conf</p>
<p>Update the following settings in conf/storm.yaml.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>storm.zookeeper.servers:
</span><span class='line'> - <span class="s2">"127.0.0.1"</span>
</span><span class='line'>storm.zookeeper.port: 9191
</span><span class='line'>storm.local.dir: <span class="s2">"/mnt/storm"</span>
</span><span class='line'>nimbus.host: <span class="s2">"127.0.0.1"</span>
</span><span class='line'>supervisor.slots.ports:
</span><span class='line'> - 6700
</span><span class='line'> - 6701
</span><span class='line'> - 6702
</span><span class='line'> - 6703
</span></code></pre></td></tr></table></div></figure>
<p>
Open three terminal windows, switch to super user and type the following commands respectively from the bin folder.
</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>./storm dev-zookeeper
</span><span class='line'>./storm nimbus
</span><span class='line'>./storm supervisor
</span><span class='line'>./storm ui
</span></code></pre></td></tr></table></div></figure>
<p>
The last command opens Storm UI portal at localhost:8080 in browser.
</p>
<p>
<a style="display: none;" href="http://www.codeproject.com" rel="tag">CodeProject</a>
</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Book Review – Heroku up and running by Neil & Richard – O’Reilly]]></title>
<link href="http://udooz.github.io//blog/2013/07/book-review-heroku-up-and-running-by-neil-richard-oreilly/"/>
<updated>2013-07-29T00:00:00+05:30</updated>
<id>http://udooz.github.io//blog/2013/07/book-review-heroku-up-and-running-by-neil-richard-oreilly</id>
<content type="html"><![CDATA[<p> </p>
<div id="__tbSetup">
</div>
<p><a href="http://udooz.github.io//blog/images/2013/07/hrk_rc_cat.gif" rel="prettyPhoto[573]"><img class="alignnone size-full wp-image-575" alt="hrk_rc_cat" src="http://udooz.github.io//blog/images/2013/07/hrk_rc_cat.gif" width="180" height="236" /></a></p>
<p>Neil is a Ruby developer and deploying many applications in Heroku. His book “Heroku Up and Running” is in early release stage. Most of the contents are ready and hence review has been made.</p>
<p>As like Heroku ecosystem’s simplicity, this book has only 100 pages with 8 chapters.</p>
<p>As a cloud developer, the first chapter “What is Heroku” is bit bored. The second chapter “How Heroku Works” is pretty straightforward, simple and nicely written. A conceptual/flow diagram is the only missing point. Reader has to go with full load of text. The third chapter explains performance and scalability on “Dynos” and Postgres database. It is worth read.</p>
<p>Chapter 4 covers Heroku Regions – Is it that much worth?</p>
<p>Chapter 5 is fully dedicated for Postgres which is helpful for the respective people. It is a good resource.</p>
<p>Chapter 6 starts with deployment best practices followed by “HOWTO”. It is well written.</p>
<p>Chapter 7 and 8 are really much needed for any people who want to deploy their app on Heroku. Neil really puts good effort to on these two chapters to differentiate highly from Heroku manual. <img src="http://udooz.net/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p>The book would be even better if it provide some simple samples than syntax examples.</p>
<p>This book gives me mixed feeling but I suggest this book for its chapter 6, 7, and 8.</p>
<p>You can buy this book at <a href="http://shop.oreilly.com/product/0636920027409.do">http://shop.oreilly.com/product/0636920027409.do</a></p>
<p> </p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Book Review – See What I Mean – O’Reilly]]></title>
<link href="http://udooz.github.io//blog/2013/07/book-review-see-what-i-mean-oreilly/"/>
<updated>2013-07-15T00:00:00+05:30</updated>
<id>http://udooz.github.io//blog/2013/07/book-review-see-what-i-mean-oreilly</id>
<content type="html"><![CDATA[<p><a href="http://udooz.github.io//blog/images/2013/07/cat.gif" rel="prettyPhoto[562]"><img class="alignnone size-full wp-image-563" title="cat" src="http://udooz.github.io//blog/images/2013/07/cat.gif" alt="" width="180" height="270" /></a></p>
<p>For techies, this book might not be the regular lunch.</p>
<p>It is my long wish to express my learning through mind-friendly way like comics and videos. Couple of years before, I used Pixton.com and written a blog post <a href="http://udooz.net/blog/2010/12/wcf-sts-federation-claims/">http://udooz.net/blog/2010/12/wcf-sts-federation-claims/</a>. After that, I simply left that direction due to lack of comic plots. It is quite surprised when I saw this book in O’Reilly that teaches you how to draw comics on yourself with paper and pencil.</p>
<p>Good part is this book do not bore you with comprehensive text, instead with nice comics.</p>
<p>Properties of Comics explains the comic formats and four properties of comics followed by a chapter explains face theory (!) and properties. Writing the story is one of my favorite chapter where there is a crash course in Script writing.</p>
<p>Last 5 chapters explains layout, drawing/refining and application in real world.</p>
<p>Recommend this book to seasoned technical bloggers and presenters. Convey your thoughts more user (mind) friendly way.</p>
<p>Buy this book at <a href="http://shop.oreilly.com/product/9781933820279.do" target="_blank"><a href="http://shop.oreilly.com/product/9781933820279.do">http://shop.oreilly.com/product/9781933820279.do</a></a>.</p>
<div id="__tbSetup">
</div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Adopting Event Sourcing in SaaS using Windows Azure]]></title>
<link href="http://udooz.github.io//blog/2013/07/adopting-event-sourcing-in-saas-using-windows-azure/"/>
<updated>2013-07-15T00:00:00+05:30</updated>
<id>http://udooz.github.io//blog/2013/07/adopting-event-sourcing-in-saas-using-windows-azure</id>
<content type="html"><![CDATA[<div id="__tbSetup">
</div>
<blockquote><p><div>
This blog post was originally published at <a href="http://blog.aditi.com/cloud/adopting-event-sourcing-saas-windows-azure/" target="_blank"><a href="http://blog.aditi.com/cloud/adopting-event-sourcing-saas-windows-azure/">http://blog.aditi.com/cloud/adopting-event-sourcing-saas-windows-azure/</a></a>.
</div></p></blockquote>
<div>
People in the enterprise application development and strong attachment with relational world feel ill-chosen when suggesting to adopt event sourcing. There are some reasons for that. This blog post specifies you the candidate places in SaaS development using Windows Azure where event sourcing will be useful. Before that let us understand what is event sourcing.</p> <h2>
Event Sourcing
</h2>
<p>
Let us take an order management SaaS system as depicted in the below figure.
</p>
<p>
<a href="http://udooz.github.io//blog/images/2013/07/1_domainmodel.png" rel="prettyPhoto[567]"><img class="alignnone wp-image-568" title="1_domainmodel" src="http://udooz.github.io//blog/images/2013/07/1_domainmodel.png" alt="" width="716" height="223" /></a>
</p>
<p>
Assume that <em>Order</em> is the main entity (in DDD world, this is further specialized as “AggregateRoot” or simply “Aggregate”). Whenever, a request to make an order in this system through service layer, a lifecycle of an Order instance will be started. It is started with OrderQuoted and ends with OrderShipped/OrderReturned.
</p>
<p>
In the typical relational world, we will persist the order instance as
</p>
<table width="633" border="1" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="47">
PKey
</td>
<td valign="top" width="123">
Order ID
</td>
<td valign="top" width="142">
Status
</td>
<td valign="top" width="113">
ModifiedBy
</td>
<td valign="top" width="208">
ModifiedOn
</td>
</tr>
<tr>
<td valign="top" width="47">
<strong>1</strong>
</td>
<td valign="top" width="123">
<strong>OD30513080515</strong>
</td>
<td valign="top" width="142">
<strong>OrderBooked</strong>
</td>
<td valign="top" width="113">
<strong>Sheik</strong>
</td>
<td valign="top" width="208">
<strong>2013-06-16 12:35PM</strong>
</td>
</tr>
<tr>
<td valign="top" width="47">
2
</td>
<td valign="top" width="123">
OD20616150941
</td>
<td valign="top" width="142">
OrderShipped
</td>
<td valign="top" width="113">
John
</td>
<td valign="top" width="208">
2013-05-22 10:00 AM
</td>
</tr>
<tr>
<td valign="top" width="47">
..
</td>
<td valign="top" width="123">
..
</td>
<td valign="top" width="142">
..
</td>
<td valign="top" width="113">
..
</td>
<td valign="top" width="208">
..
</td>
</tr>
</table>
<p>
If the order OD30513080515 is delivered, then we will simply update the record # 1 as
</p>
<table width="633" border="1" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="47">
<strong>1</strong>
</td>
<td valign="top" width="123">
OD30513080515
</td>
<td valign="top" width="142">
<strong>OrderDelivered</strong>
</td>
<td valign="top" width="113">
Milton
</td>
<td valign="top" width="208">
2013-06-18 02:10PM
</td>
</tr>
</table>
<p>
The Event Sourcing approach enforces to persist domain object using an immutable schema. In this case, the data store will look like:
</p>
<table width="633" border="1" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="47">
DbId
</td>
<td valign="top" width="123">
Order ID
</td>
<td valign="top" width="142">
Status
</td>
<td valign="top" width="113">
ModifiedBy
</td>
<td valign="top" width="208">
ModifiedOn
</td>
</tr>
<tr>
<td valign="top" width="47">
<strong>1</strong>
</td>
<td valign="top" width="123">
<strong>OD30513080515</strong>
</td>
<td valign="top" width="142">
<strong>OrderBooked</strong>
</td>
<td valign="top" width="113">
<strong>Sheik</strong>
</td>
<td valign="top" width="208">
<strong>2013-06-16 12:35PM</strong>
</td>
</tr>
<tr>
<td valign="top" width="47">
2
</td>
<td valign="top" width="123">
OD20616150941
</td>
<td valign="top" width="142">
OrderShipped
</td>
<td valign="top" width="113">
John
</td>
<td valign="top" width="208">
2013-05-22 10:00 AM
</td>
</tr>
<tr>
<td valign="top" width="47">
..
</td>
<td valign="top" width="123">
..
</td>
<td valign="top" width="142">
..
</td>
<td valign="top" width="113">
..
</td>
<td valign="top" width="208">
..
</td>
</tr>
<tr>
<td valign="top" width="47">
1
</td>
<td valign="top" width="123">
<strong>OD30513080515</strong>
</td>
<td valign="top" width="142">
<strong>OrderDelivered</strong>
</td>
<td valign="top" width="113">
<strong>Milton</strong>
</td>
<td valign="top" width="208">
<strong>2013-06-18 02:10PM</strong>
</td>
</tr>
</table>
<p>
You are now under the impression that event sourcing is nothing but audit log and if this approach is taken in the main stream database we will be end up with underperforming query and unnecessary database size. Let us understand the benefits of event sourcing before discussing these concerns:
</p>
<ul>
<li>
Business sometimes needs tracking changes with relevant information happened in the entity during its lifecycle. For example, before shipping the order, if the system allows the customer to add or remove items in the order, “OrderItemChanged” will play important role to recalculate pricing by track back to the previous “OrderItemChanged” events.
</li>
<li>
With the immutable persistent model, this would be a fault tolerance mechanisms so that at any point in time we can reconstruct the whole system or to a particular point by rewinding the events happened on a particular entity.
</li>
<li>
Data analytics
</li>
</ul>
<p>
The above two points keep specifying the term “event”. A business system is nothing but performing commands (technically Create, Update, and Delete operations) on business entities. Events will be raised as a yield of these operations. For example, making an order in the above SaaS system will create an event OrderBooked with following facts:
</p>
<p>
{
</p>
<p>
“name” : “orderBooked”,
</p>
<p>
“entity” : “Order”,
</p>
<p>
“occrredOn” : “2013-06-16 12:35PM”,
</p>
<p>
“orderDetail” : {
</p>
<p>
“orderId” : “OD30513080515″,
</p>
<p>
“orderItems” : [{ “productId” : “PR1234”, “quantity” : 1}] <p>
}
</p>
<p>
}
</p>
<p>
In the distributed domain driven design approach, the above domain event will be published by Order aggregate and the service layer receives the event and publish itself to the direct event handler or via event publisher. One of the main subscriber could be a event store subscriber that persist the event into the event store. The event can also be published to an enterprise service bus so that it can be subscribed and handled by wide variety of other subscribers. Most likely the schema for an event store looks like below:
</p>
<p>
<a href="http://udooz.github.io//blog/images/2013/07/2_scheme.png" rel="prettyPhoto[567]"><img class="alignnone size-full wp-image-569" title="2_scheme" src="http://udooz.github.io//blog/images/2013/07/2_scheme.png" alt="" width="656" height="285" /></a>
</p>
<p>
The various implementations of event sourcing use different terminologies and slightly different schema. <em>For example, main stream event sourcing implementation will have the whole aggregate object itself on every change.</em>
</p>
<p>
Hence, event sourcing has following characteristics:
</p>
<ul>
<li>
Every event should give a fact about that and it should be atomic
</li>
<li>
The data should be “immutable”
</li>
<li>
Every event should be “identifiable”
</li>
</ul>
<h2>
In the SaaS World
</h2>
<p>
By this time, you understand that event sourcing is not “one size fit for all”. Particularly, in the enterprise world. Based on the SaaS system and organization eco system, you can suggest different methodologies:
</p>
<ul>
<li>
Use Event Store as main stream data store and use query friendly view data stores such as document or column friendly databases. This would handle all queries from client systems. This is likely to be CQRS approach.
</li>
<li>
Enterprises where you feel relational is the right candidate for main stream database, then use event store as a replacement for audit log, if the system and regulations permit. This would help you to address the use cases where past event tracking is the business requirement.
</li>
</ul>
<h2>
Right storage mechanism in Windows Azure
</h2>
<p>
When you are building applications in Windows Azure, you have three official storage options as of now. Let us see these a whole:
</p>
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="46">
S.No
</td>
<td valign="top" width="180">
Storage
</td>
<td valign="top" width="189">
Pros
</td>
<td valign="top" width="189">
Cons
</td>
</tr>
<tr>
<td valign="top" width="46">
1
</td>
<td valign="top" width="180">
Blob Storage
</td>
<td valign="top" width="189">
Flexible and simple to implement the above mentioned schema
</td>
<td valign="top" width="189">
Majorly none
</td>
</tr>
<tr>
<td valign="top" width="46">
2
</td>
<td valign="top" width="180">
Table Storage
</td>
<td valign="top" width="189">
Read friendly
</td>
<td valign="top" width="189">
Unfriendly for write when you take different serialization approach for event body apart from simple JSON serialization.
</td>
</tr>
<tr>
<td valign="top" width="46">
3
</td>
<td valign="top" width="180">
Windows Azure SQL
</td>
<td valign="top" width="189">
Based on your relational schema, this could be read and write friendly
</td>
<td valign="top" width="189">
Lacks scalability</p> <p>
Cost</td> </tr> </tbody> </table> <h2>
Summary
</h2>
<p>
Event sourcing is more than just an audit log that can be well adopted into SaaS system. You should take right approach on how to use this in your system. Windows Azure blob storage is one of the nice option as of now since there is no native document or column oriented database support in Windows Azure.
</p>
<p>
Few event sourcing frameworks in .NET:
</p>
<p>
<a href="https://github.com/NEventStore/NEventStore">https://github.com/NEventStore/NEventStore</a>
</p>
<p>
<a href="https://github.com/elliotritchie/NES">https://github.com/elliotritchie/NES</a>
</p></div>
<pre><code> <p>
</p>
</code></pre>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Book Review: Python for Data Analysis by Wes – O’Reilly]]></title>
<link href="http://udooz.github.io//blog/2012/12/book-review-python-for-data-analysis-wes-oreilly/"/>
<updated>2012-12-27T00:00:00+05:30</updated>
<id>http://udooz.github.io//blog/2012/12/book-review-python-for-data-analysis-wes-oreilly</id>
<content type="html"><![CDATA[<p><a href="http://udooz.github.io//blog/images/2012/12/rc_cat.gif" rel="prettyPhoto[551]"><img class="alignnone size-full wp-image-552" title="rc_cat" src="http://udooz.github.io//blog/images/2012/12/rc_cat.gif" alt="" width="180" height="236" /></a></p>
<p>Python getting become the heart of data analysis works. You can see variety of books taught machine learning, data analysis and big data processing based on Python. To get into that world, this book is the basic to learn Python ecosystem for data analysis.</p>
<p>Pandas is one of the notable data analysis library along with the famous NumPy and SciPy libraries. Wes McKinney who has implemented Pandas has written this book.</p>
<p>As a primer for data analysis, this book has been well written. With the enough sample data for learning purpose, Wes explains NumPy, Pandas and matplotlib libraries in addition to the knowledge required on file handling, data loading, storage, wrangling and aggregation.</p>
<p>Wes spent a worthy spaces for IPython – an elegant command line IDE for Python data analysis.</p>
<p>As a basic learning book, notable effort taken for the sample data like MovieLens, US Baby Names, USD food database. These helps the reader to understand those libraries practically.</p>
<p>Sometime you may get a feel of 470 pages is a very detail oriented for just learning Python libraries. It is up to your comfort level to make short cut.</p>
<p><strong>Python for Data Analysis would be your first and good stepping stone</strong> for to work on “Data Analysis or Machine Learning” field. This book is worth buy.</p>
<p>For book details: <a href="http://shop.oreilly.com/product/0636920023784.do" target="_blank"><a href="http://shop.oreilly.com/product/0636920023784.do">http://shop.oreilly.com/product/0636920023784.do</a></a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Authorization request signing for Windows Azure Storage REST API from PowerShell]]></title>
<link href="http://udooz.github.io//blog/2012/11/authorization-request-signing-for-windows-azure-storage-rest-api-from-powershell/"/>
<updated>2012-11-17T00:00:00+05:30</updated>
<id>http://udooz.github.io//blog/2012/11/authorization-request-signing-for-windows-azure-storage-rest-api-from-powershell</id>
<content type="html"><![CDATA[<p>Recently, while working on one of the Windows Azure migration engagement, we were need to have a simple and portable utility scripts that manipulate on various Windows Azure Storage (WAS) services APIs like “Get all blob metadata details from selected containers”. This is further enabled to perform various manipulations for the business.</p>
<p>There are various options like LINQPad queries, WAPPSCmdlets or Azure Storage Explorer + Fiddler. However, in-terms of considering the computation post to the WAS invocation, repetitiveness of the work and considering the various type of users environment, simple PowerShell script is the option. So, I have decided to write simple PowerShell script using WAS REST API. This does not require any other snap-in or WAS storage client assemblies. (Re-inventing the wheel?!)</p>
<p>One of the main hurdle is creating Authorization header (signing the request). It should contains the following:</p>
<ul>
<li>HTTP verb</li>
<li>all standard HTTP headers, or empty line instead (canonicalized headers)</li>
<li>the URI for the storage service (canonicalized resource)</li>
</ul>
<p>A sample string for the signing mentioned below:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class=''><span class='line'><div id="LC1">GET\n /*HTTP Verb*/</div>
</span><span class='line'><div id="LC2">\n /*Content-Encoding*/</div>
</span><span class='line'><div id="LC3">\n /*Content-Language*/</div>
</span><span class='line'><div id="LC4">\n /*Content-Length*/</div>
</span><span class='line'><div id="LC5">\n /*Content-MD5*/</div>
</span><span class='line'><div id="LC6">\n /*Content-Type*/</div>
</span><span class='line'><div id="LC7">\n /*Date*/</div>
</span><span class='line'><div id="LC8">\n /*If-Modified-Since */</div>
</span><span class='line'><div id="LC9">\n /*If-Match*/</div>
</span><span class='line'><div id="LC10">\n /*If-None-Match*/</div>
</span><span class='line'><div id="LC11">\n /*If-Unmodified-Since*/</div>
</span><span class='line'><div id="LC12">\n /*Range*/</div>
</span><span class='line'><div id="LC13">x-ms-date:Sun, 11 Oct 2009 21:49:13 GMT\nx-ms-version:2009-09-19\n /*CanonicalizedHeaders*/</div>
</span><span class='line'><div id="LC14">/udooz/photos/festival\ncomp:metadata\nrestype:container\ntimeout:20 /*CanonicalizedResource*/</div></span></code></pre></td></tr></table></div></figure>
<p>Read <a href="http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx" target="_blank"><a href="http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx">http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx</a></a> and particularly the section <a href="http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx#Constructing_Element" target="_blank"><a href="http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx#Constructing_Element">http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx#Constructing_Element</a></a> for request signing of “Authorization” header.</p>
<p>I have written a simple and dirty PowerShell function for blob metadata access.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
</pre></td><td class='code'><pre><code class='powershell'><span class='line'><span class="k">function</span> <span class="n">Generate-AuthString</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'><span class="k">param</span><span class="p">(</span>
</span><span class='line'><span class="no">[string]</span><span class="nv">$url</span>
</span><span class='line'><span class="p">,</span><span class="no">[string]</span><span class="nv">$accountName</span>
</span><span class='line'><span class="p">,</span><span class="no">[string]</span><span class="nv">$accountKey</span>
</span><span class='line'><span class="p">,</span><span class="no">[string]</span><span class="nv">$requestUtcTime</span>
</span><span class='line'><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="nv">$uri</span> <span class="p">=</span> <span class="nb">New-Object</span> <span class="n">System</span><span class="p">.</span><span class="n">Uri</span> <span class="n">-ArgumentList</span> <span class="nv">$url</span>
</span><span class='line'>
</span><span class='line'><span class="nv">$authString</span> <span class="p">=</span><span class="err"> </span> <span class="s2">"GET</span><span class="p">$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)</span><span class="s2">"</span>
</span><span class='line'><span class="nv">$authString</span> <span class="p">+=</span> <span class="s2">"x-ms-date:"</span> <span class="p">+</span> <span class="nv">$requestUtcTime</span> <span class="p">+</span> <span class="s2">"</span><span class="p">$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)</span><span class="s2">"</span>
</span><span class='line'><span class="nv">$authString</span> <span class="p">+=</span> <span class="s2">"x-ms-version:2011-08-18"</span> <span class="p">+</span> <span class="s2">"</span><span class="p">$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)</span><span class="s2">"</span>
</span><span class='line'><span class="nv">$authString</span> <span class="p">+=</span> <span class="s2">"/"</span> <span class="p">+</span> <span class="nv">$accountName</span> <span class="p">+</span> <span class="nv">$uri</span><span class="p">.</span><span class="n">AbsolutePath</span> <span class="p">+</span> <span class="s2">"</span><span class="p">$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)</span><span class="s2">"</span>
</span><span class='line'><span class="nv">$authString</span> <span class="p">+=</span> <span class="s2">"comp:list</span><span class="p">$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)</span><span class="s2">"</span>
</span><span class='line'><span class="nv">$authString</span> <span class="p">+=</span> <span class="s2">"include:snapshots,uncommittedblobs,metadata</span><span class="p">$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)</span><span class="s2">"</span>
</span><span class='line'><span class="nv">$authString</span> <span class="p">+=</span> <span class="s2">"restype:container</span><span class="p">$(</span><span class="no">[char]</span><span class="n">10</span><span class="p">)</span><span class="s2">"</span>
</span><span class='line'><span class="nv">$authString</span> <span class="p">+=</span> <span class="s2">"timeout:90"</span>
</span><span class='line'>
</span><span class='line'><span class="nv">$dataToMac</span> <span class="p">=</span> <span class="no">[System.Text.Encoding]</span><span class="p">::</span><span class="n">UTF8</span><span class="p">.</span><span class="n">GetBytes</span><span class="p">(</span><span class="nv">$authString</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="nv">$accountKeyBytes</span> <span class="p">=</span> <span class="no">[System.Convert]</span><span class="p">::</span><span class="n">FromBase64String</span><span class="p">(</span><span class="nv">$accountKey</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="nv">$hmac</span> <span class="p">=</span> <span class="nb">new-object</span> <span class="n">System</span><span class="p">.</span><span class="n">Security</span><span class="p">.</span><span class="n">Cryptography</span><span class="p">.</span><span class="n">HMACSHA256</span><span class="p">((,</span><span class="nv">$accountKeyBytes</span><span class="p">))</span>
</span><span class='line'><span class="no">[System.Convert]</span><span class="p">::</span><span class="n">ToBase64String</span><span class="p">(</span><span class="nv">$hmac</span><span class="p">.</span><span class="n">ComputeHash</span><span class="p">(</span><span class="nv">$dataToMac</span><span class="p">))</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p> </p>
<blockquote><p>Use [char] 10 for new-line, instead of “`r`n”.</p></blockquote>
<p>Now, you need to add “Authorization” header while making the request.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='powershell'><span class='line'><span class="no">[System.Net.HttpWebRequest]</span> <span class="nv">$request</span> <span class="p">=</span> <span class="no">[System.Net.WebRequest]</span><span class="p">::</span><span class="n">Create</span><span class="p">(</span><span class="nv">$url</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="p">...</span>
</span><span class='line'>
</span><span class='line'><span class="nv">$request</span><span class="p">.</span><span class="n">Headers</span><span class="p">.</span><span class="n">Add</span><span class="p">(</span><span class="s2">"Authorization"</span><span class="p">,</span> <span class="s2">"SharedKey "</span> <span class="p">+</span> <span class="nv">$accountName</span> <span class="p">+</span> <span class="s2">":"</span> <span class="p">+</span> <span class="nv">$authHeader</span><span class="p">);</span>
</span></code></pre></td></tr></table></div></figure>
<p>The complete script is available at my GitHub repo <a href="https://github.com/udooz/powerplay/blob/master/README.md" target="_blank"><a href="https://github.com/udooz/powerplay/blob/master/README.md">https://github.com/udooz/powerplay/blob/master/README.md</a></a>.</p>
<p>The real power when accessing REST API from PowerShell is the “XML processing”. I can simply access ListBlob() atom fields like</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='powershell'><span class='line'><span class="nv">$xml</span><span class="p">.</span><span class="n">EnumerationResults</span><span class="p">.</span><span class="n">Blobs</span><span class="p">.</span><span class="n">Blob</span>
</span></code></pre></td></tr></table></div></figure>
<p>Happy Coding.<br/>
<a style="display: none;" href="http://www.codeproject.com" rel="tag">CodeProject</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Book Review: Cloud Architecture Patterns by Bill Wilder – O’Reilly]]></title>
<link href="http://udooz.github.io//blog/2012/11/book-review-cloud-architecture-patterns/"/>
<updated>2012-11-14T00:00:00+05:30</updated>
<id>http://udooz.github.io//blog/2012/11/book-review-cloud-architecture-patterns</id>
<content type="html"><![CDATA[<p><a href="http://udooz.github.io//blog/images/2012/11/cat.gif" rel="prettyPhoto[526]"><img class="alignnone size-full wp-image-527" title="cat" src="http://udooz.github.io//blog/images/2012/11/cat.gif" alt="" width="180" height="236" /></a></p>
<p>Bill Wilder who is a MVP in Windows Azure has taken nice initiative in the cloud computing space with cloud architecture patterns. Good collections.</p>
<p>Cloud computing relatively new and evolving technology, where we are facing so many recurred problems when dealing with application migration. Bill introduces the basic tenants of cloud computing and design principles as Cloud Computing architecture patterns in this book. There are 14 basic and common cloud computing patterns in this book.</p>
<p>The whole chapter 1 discusses on Scalability in depth. I really liked his explanation on Performance vs Scalability. Also, he listed out the characteristics of Cloud-Native applications.</p>
<p>Though it is not well fit into ‘pattern’, Horizontally Scaling Compute pattern discusses all design and anti-design aspects. The Queue-centric workflow discusses the loosely coupled aspects. It covers the asynchronous programming characteristics of cloud-native applications. However, asynchronous and end user responsiveness related problems not covered in this, or as a different pattern.</p>
<p>He well touched the CAP theorem, sharding, fan-out quite well. The multitenancy pattern can be explained much more better way.</p>
<p>The colocate and valet key patterns are nicely covered efficient use of network and trust with third party service integration.</p>
<p>The patterns try at best to vendor-neutral. Fortunately, it lights up more on Windows Azure.</p>
<p>This book is very useful for people who are new to cloud computing space and going to construct/migrate application on this.</p>
<p>For well experts and people who have already spend their life on cloud computing, would be a refresher.</p>
<p>Well attempt for basic cloud computing architecture concepts.</p>
<p>You can buy this book at <a href="http://shop.oreilly.com/product/0636920023777.do" target="_blank"><a href="http://shop.oreilly.com/product/0636920023777.do">http://shop.oreilly.com/product/0636920023777.do</a></a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[WAS StartCopyFromBlob operation and Transaction Compensation]]></title>
<link href="http://udooz.github.io//blog/2012/11/azure-startcopyfromblob-transaction-compensation/"/>
<updated>2012-11-12T00:00:00+05:30</updated>
<id>http://udooz.github.io//blog/2012/11/azure-startcopyfromblob-transaction-compensation</id>
<content type="html"><![CDATA[<p>The latest Windows Azure SDKs v1.7.1 and 1.8 have a nice feature called “<a href="http://msdn.microsoft.com/en-us/library/jj682832.aspx" target="_blank">StartCopyFromBlob</a>” that enables us to instruct Windows Azure data center to perform cross-storage accounts blob copy. Prior to this, we need to download chunks of blob content then upload into the destination storage account. Hence, “StartCopyFromBlob” is more efficient in terms of cost and time as well.</p>
<p>The notable difference in version 2012-02-12 is that copy operation is now asynchronous. It means once you made a copy request to Windows Azure Storage service, it returns a copy ID (a GUID string), copy state and HTTP status code 202 (Accepted). This means that your request is scheduled. Post to this call, when you check the copy state immediately, it is most probably in “pending” state.</p>
<h2>StartCopyFromBlob – An TxnCompensation operation</h2>
<p>An extra care is required while using this API, since this is one of the real world transaction compensation service operation. After making the copy request, you need to verify the actual status of the copy operation at later point in time. The later point in time would be varied from very few seconds to 2 weeks based on various constraints like source blob size, permission, connectivity, etc.</p>