-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
556 lines (356 loc) · 32.6 KB
/
atom.xml
File metadata and controls
556 lines (356 loc) · 32.6 KB
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
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Andy Sinesio]]></title>
<link href="http://asinesio.github.com/atom.xml" rel="self"/>
<link href="http://asinesio.github.com/"/>
<updated>2013-05-21T19:12:51-05:00</updated>
<id>http://asinesio.github.com/</id>
<author>
<name><![CDATA[Andy Sinesio]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[The Big Ball of Lights]]></title>
<link href="http://asinesio.github.com/blog/2013/05/20/the-big-ball-of-lights/"/>
<updated>2013-05-20T19:08:00-05:00</updated>
<id>http://asinesio.github.com/blog/2013/05/20/the-big-ball-of-lights</id>
<content type="html"><![CDATA[<p>Year after year, your software grows. Developers are building new systems more quickly than old ones are retired.</p>
<p>Eventually, your mix of services, queues, and applications will probably look like this:</p>
<p><img src="http://asinesio.github.com/assets/2013-05-20/ball-of-lights.jpg" alt="Christmas Vacation Ball of Lights" /></p>
<p>Of course, you may not realize how tangled it really is until you decide to upgrade or migrate some key part of the infrastructure.</p>
<p>If you’re lucky, you may end up having this conversation <em>prior to deployment</em>:</p>
<blockquote><p>You: “We’re updating ‘Awesome Web Service’ to a new API revision this weekend.”<br/>Developer: “Cool. Did you notify Team Clueless?”<br/>You: “No. Why would they care?” <br/>Developer: “Last year, they needed some data from the ‘Awesome Web Service’, so they started using it. And they didn’t tell anybody and didn’t update the documentation.”</p></blockquote>
<p>When this occurs, you’ll be tempted, a la Rusty Griswold, to give up out of frustration.</p>
<p>If you had thought to implement a basic HTTP call tracking strategy, this would not have happened!</p>
<!-- more -->
<h2>Plan for Unexpected Use.</h2>
<p>Plan for the scenario that someone is going to use your services <em>without your knowledge</em>.</p>
<p>One strategy is to enforce that every HTTP request includes tracking information in the HTTP headers. (For simple queries from web browsers, you can also allow the caller to pass them as query parameters or form data.)</p>
<p>If you don’t want to implement a true authentication/authorization model, you can simply use a scheme like this:</p>
<pre><code>X-MyCompany-CallingApplicationName: NeatApp
X-MyCompany-CallingApplicationInstance: NeatApp-Customer-X
X-MyCompany-CallingUser: bill@customer-x.com
</code></pre>
<p>(An API key scheme would be preferable but more complicated; the tradeoff being that you can track users at a much finer grain.)</p>
<h2>Enforce and Emit Tracking Data.</h2>
<p>Once you’ve done this, you can route all requests through a reverse proxy or enterprise service bus to enforce this scheme on every HTTP request.</p>
<p>If the fields are not there, the ESB can respond with a <code>400 Bad Request</code> or <code>403 Forbidden</code> response, thus enforcing your scheme.</p>
<p>Once enforced, you can use several methods for tracking this information.</p>
<h3>Step 1: Log it.</h3>
<p>This may seem obvious, but uou can set up your web server of choice to automatically log the custom HTTP headers. In Apache Tomcat, you configure an AccessLogValve like this:</p>
<pre><code><Valve
className="org.apache.catalina.valves.AccessLogValve"
directory="${catalina.base}/logs"
prefix="access"
fileDateFormat="yyyy-MM-dd.HH"
suffix=".log"
pattern="%h %l %u %t &quot;%r&quote; %s %b NAME:%{X-MyCompany-CallingApplicationName}i INSTANCE:%{X-MyCompany-CallingApplicationInstance}i USER:%{X-MyCompany-CallingUser}i"
/>
</code></pre>
<p>Parse the access log, and you can find out who is calling Awesome Service.</p>
<h3>Step 2: Emit to StatsD/Graphite.</h3>
<p>The central enterprise service bus can emit the data via UDP to a <a href="http://codeascraft.com/2011/02/15/measure-anything-measure-everything/">StatsD/Graphite server</a> with a naming scheme that parses the URL and includes the calling app name and instance.</p>
<p>For example: <code>services.{domain}.{callingAppName}.{callingAppInstance}</code></p>
<p>This would give you a very quick and easy way to see which applications are calling which services in your infrastructure; also, it would not interfere with throughput or introduce unreliability since it’s using a fire-and-forget UDP packet.</p>
<p>A simple metric of <code>stats.services.awesome-service.\*.\*</code> yields a dynamic graph that shows all clients of Awesome Service.</p>
<p><img src="http://asinesio.github.com/assets/2013-05-20/graphite.png" alt="Graphite graph" /></p>
<h3>Step 3: Map a Service Registry.</h3>
<p>Once you have the data, you can use something like <a href="http://d3js.org">d3.js</a> to draw a <a href="http://www.findtheconversation.com/concept-map">map of all of your applications</a>.</p>
<p>(You could plug it into a CMDB, if you have one, as well.)</p>
<h2>Knowledge is power.</h2>
<p>At this point, your graph of application dependencies is updated automatically as the web service is used.</p>
<p>And, armed with this graph, the big ball of lights is just as tangled – but at least you know where to look to get it unravelled.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Blink is not the coming of the apocalypse]]></title>
<link href="http://asinesio.github.com/blog/2013/04/05/blink-is-not-the-coming-of-the-apocalypse/"/>
<updated>2013-04-05T00:54:00-05:00</updated>
<id>http://asinesio.github.com/blog/2013/04/05/blink-is-not-the-coming-of-the-apocalypse</id>
<content type="html"><![CDATA[<p>Since Google <a href="http://blog.chromium.org/2013/04/blink-rendering-engine-for-chromium.html">announced they were forking WebKit</a>, I’ve seen nothing but <a href="http://prng.net/blink-faq.html">universally negative reactions</a>.</p>
<p>The primary points seem to be that Blink is bad because:</p>
<h4>“Developers will now have another major browser rendering engine that they will need to test.”</h4>
<p>This is just not true. If you’re building quality web software, you are already testing your site on both Chrome and Safari (Mobile and desktop).</p>
<p>A <a href="http://en.wikipedia.org/wiki/Internet_Explorer_6">web monoculture</a> is bad for everyone. A healthy web ecosystem consisting of equal parts Chrome, Safari, Firefox, Opera, and Internet Explorer means that the users will have a choice, because all web apps will generally need to work with all browsers.</p>
<h4>“WebKit and Blink will diverge and re-implement each other’s features, thus slowing progress.”</h4>
<p>Google already <a href="https://news.ycombinator.com/item?id=5490242">wasn’t contributing</a> much of their code back to WebKit. The announcement of Blink is truly just formalizing what was already happening.</p>
<h4>“Google is going to use this to invade my privacy and track me across the Web.”</h4>
<p>Yes. They were doing that anyway, and they haven’t exactly had a great <a href="http://www.pcmag.com/article2/0,2817,2411916,00.asp">track record</a> of protecting your privacy. If you were concerned about this, you wouldn’t be using Chrome anyway.</p>
<p>Think about it; Google forked WebKit for the same reason Apple replaced Google Maps - Google wants to control their own destiny.</p>
<p>Blink is not the coming of the web browser apocalypse (but it does have a terrible name).</p>
<p>The apocalypse happened when Internet Explorer crushed Netscape. We’ve recovered from that, and we’re never going back.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Gamification of Code Quality]]></title>
<link href="http://asinesio.github.com/blog/2013/03/05/gamification-of-code-quality/"/>
<updated>2013-03-05T20:35:00-06:00</updated>
<id>http://asinesio.github.com/blog/2013/03/05/gamification-of-code-quality</id>
<content type="html"><![CDATA[<p>Quality is one of the most difficult things to define. There have been <a href="http://en.wikipedia.org/wiki/Zen_and_the_Art_of_Motorcycle_Maintenance">entire books written</a> about the topic.</p>
<p>Unsurprisingly, it’s also difficult to define when it comes to software. However, most developers will readily agree that writing <a href="http://en.wikipedia.org/wiki/Unit_testing">unit tests</a> and practicing <a href="http://en.wikipedia.org/wiki/Test-driven_development">test-driven development</a> are tools for writing higher quality software.</p>
<h3>Tests are great, why aren’t you writing them?</h3>
<p>After a few laps on a recent project, I noticed that despite our “test-driven development” goals, our test coverage was lacking. We were hoving around 50% lines/50% methods complete.</p>
<p>After prodding our developers and “vowing to get better”, it wasn’t happening. So I came up with a new plan.</p>
<!--more-->
<h3>The Test Coverage Game</h3>
<p>We implemented a friendly game on the team to improve test coverage.</p>
<ol>
<li><p>Invent a scoring system to award “quality points” to developers.</p></li>
<li><p>Display scores in public locations, but keep it lighthearted.</p></li>
<li><p>A program collates the results and awards points to the team members after each build.</p></li>
</ol>
<p>We focused the scoring and made it simple:</p>
<ul>
<li>1 point for covering a line that was not previously covered by a unit test.</li>
<li>3 points for covering a method that was not previously covered by a unit test.</li>
<li>< 50% is an F, 50% and higher is a C, 70% is a B, and 80% is an A.</li>
</ul>
<h4>Tools</h4>
<ul>
<li><a href="http://cobertura.sourceforge.net">Cobertura</a> to track code coverage.</li>
<li><a href="http://www.hudson-ci.org">Hudson/Jenkins</a> for builds.</li>
<li>A custom script to parse the coverage results (coming soon).</li>
<li>A <em>whiteboard</em> for posting scores.</li>
</ul>
<h4>Does it work?</h4>
<p>After one two-week lap, code coverage jumped from 50% to 60%. It continued to climb as developers strove to contribute and wanted their contributions to be visible to the public.</p>
<p>Universally, it was welcomed by the team, and after a month, test coverage was at 70% – and developers enjoyed getting there. It had a successful, nearly bug free launch, too.</p>
<h3>Percentage-based scoring</h3>
<p>Lines of code is a bad way to judge a developer’s effectiveness: removing lines of code is often a way to improve software quality. So, a better scoring system would track percentages of the project that are covered by tests rather than lines of code.</p>
<p>The key was <em>public visibility</em>. Developers strove to contribute tests when they knew their work was visible.</p>
<p>Due to the success of the code coverage game, we decided to roll out a percentage-based scoring system across all software. Give it a try, if you haven’t yet – something like it may be more effective than you think.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[A software update is required.]]></title>
<link href="http://asinesio.github.com/blog/2013/02/26/a-software-update-is-required/"/>
<updated>2013-02-26T21:40:00-06:00</updated>
<id>http://asinesio.github.com/blog/2013/02/26/a-software-update-is-required</id>
<content type="html"><![CDATA[<p>My brother gave me <a href="http://us.gran-turismo.com/us/">Gran Turismo 5</a> for Christmas. I’ve played all of the other GT games and loved them. GT5 had been out for awhile, but I was still excited to give it a try.</p>
<p>I returned home from Christmas; after a few days, I finally had a free hour or two, so I booted up the PS3 and threw in the game. And I was greeted by this:</p>
<p><img src="http://asinesio.github.com/assets/2013-02-26/ps3-update.jpg" alt="The latest update data was found." /></p>
<p><em>14 hours later</em>, the game finally finished updating and allowed me to play. Too bad that I no longer had the free hour or two, so it took another week before I was able to actually play the game.</p>
<p>It reminded me of this nefarious monstrosity:</p>
<p><img src="http://asinesio.github.com/assets/2013-02-26/windows-update.png" alt="Windows Update restart nag" /></p>
<p>“But, I don’t want to update <em>at all</em>,” I plead.</p>
<p>The system scoffs. “Tough shit, buddy. You’re going to have to deal with this now because I don’t value your time.”</p>
<!--more-->
<h4>This is the typical experience of today’s console gamer.</h4>
<p>The advent of attached hard drives and broadband internet in consoles, without any software design, brought this ugliness from the PC to the living room.</p>
<p>It’s so bad, in fact, that at Sony’s ill-advised PlayStation 4 news conference, they made sure to announce that <a href="http://www.mcvuk.com/news/read/ps4-to-have-background-firmware-updates/0111249">background firmware updates would be part of the new system.</a> This was astounding because they did not even <em>show any games or an actual PlayStation 4</em> – but they mentioned background updates.</p>
<p>This isn’t enough, though. Updates also need to be <em>optional</em> and <em>taken at the user’s convenience</em>.</p>
<h4>Will it matter?</h4>
<p>The sad thing is that this is just a microcosm of the usability issues with console systems. Others:</p>
<ul>
<li>Insanely long load times.</li>
<li>A Herculean effort <em>just to type a password with a controller.</em></li>
<li>Exclusive use of a television set.</li>
<li>Expensive, silly, useless peripherals.</li>
<li>Lack of downloadable and affordable games.</li>
</ul>
<p>I don’t see the next generation PlayStation addressing these issues. Or the Xbox, for that matter.</p>
<p>That’s why the iPad is the next generation console.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[The Perils of the Grails Searchable Plugin]]></title>
<link href="http://asinesio.github.com/blog/2013/02/23/the-perils-of-the-grails-searchable-plugin/"/>
<updated>2013-02-23T00:05:00-06:00</updated>
<id>http://asinesio.github.com/blog/2013/02/23/the-perils-of-the-grails-searchable-plugin</id>
<content type="html"><![CDATA[<p>The <a href="http://grails.org/plugin/searchable">Grails Searchable Plugin</a> is generally where developers end up when they are looking to add full-text searching to their Grails application.</p>
<p>It’s got a lot going for it:</p>
<ul>
<li>Simple, embedded Lucene index with minimal initial setup.</li>
<li>Automatic GORM mirroring of changes.</li>
<li>Widely used; according to Grails.org, it’s installed in almost <em>7% of Grails projects</em>.</li>
<li>Fast and simple, it works out of the box.</li>
</ul>
<p>Before I go further: know that I really like the Searchable plugin. It’s a great way to get search in a smaller application.</p>
<!--more-->
<h3>Adding Searchable to a Project: A dramatization</h3>
<p>You’re working on a project. The end of the lap is near, and your task is to implement a simple search screen.</p>
<p>You find Searchable and decide to try it out.</p>
<p>Installation’s easy. <code>grails install-plugin searchable</code> or <code>:searchable:0.6.4</code> in your BuildConfig. Tweak some settings, and within an hour, you’ve got an embedded full text search engine.</p>
<p>“Man, that’s cool,” you think to yourself. “And so easy to use. I love it.”</p>
<p>You proudly show it off to your project sponsors: “Look! Embedded Google, right in the app! Look fast it is!”</p>
<p>Everyone loves it. Your manager thinks you’re a rock star. Life is great.</p>
<p>Your QA team notices some searches randomly failing while testing the app, but you can’t reproduce it. You research it for hours, can’t determine the cause, and eventually blame some random piece of infrastructure for your concerns.</p>
<p>“I know the network guys were scheduled to do that switch firmware upgrade, that must have been it.”</p>
<h4>Then, Production Deployment.</h4>
<p>Your users are loving the full text search. Your app is a success and everyone pats you on the back.</p>
<p>Meanwhile, your search index is adding rows by the minute as your database grows. The random failure from QA is lurking there, in the shadows, planning the perfect moment to jump up and bite you.</p>
<h4>Six months later…</h4>
<p>…your app suddenly crashes, hard. No data updates are happening – database transactions are timing out like crazy. You frantically turn up logging and throw your full effort at debugging. Since it’s a transaction timeout, you focus on the database.</p>
<p>You’ve got your ops team, your DBAs, and your network team frantically checking to see what could be causing the issue.</p>
<p>After hours of fruitless troubleshooting, you finally remember the bug that you ignored. Now you see that the “random search problem” wasn’t random at all.</p>
<p>Further research reveals that <em>storing the Compass index on an NFS mount</em> was the cause of the problem. It’s in the documentation. While researching, you find:</p>
<h5><em><a href="http://www.compass-project.org">Compass</a>, a core library used by Searchable, is no longer maintained.</em></h5>
<p>You realize with surprise that the most popular search plugin for Grails uses an obsolete library to map GORM objects to it’s Lucene search index.</p>
<p>The author has abandoned Compass and created <a href="http://www.elasticsearch.org">Elastic Search</a>, which, now that you look at it, looks to be a much better solution.</p>
<h5><em>Nobody uses Searchable with indexes that are shared and mirrored across multiple app instances.</em></h5>
<p>You weren’t a total idiot when you built your app – you decided to launch several Tomcat instances and load balance them. In order for updates made in one node to show up in the others, you enabled mirroring in all nodes.</p>
<p>What you didn’t realize is that in order to share the index files, you had to use something like an NFS mount to share them among instances.</p>
<p>Then, suddenly, it hits you like a ton of bricks:</p>
<h5><em>Tbe most popular Grails plugin for searching – Searchable – is great for a quick solution. But it is not designed for scaling to multiple instances very well.</em></h5>
<p>You start work porting the app to a different search technology – like <a href="http://lucene.apache.org/solr/">Apache Solr</a> or <a href="http://www.elasticsearch.org">Elastic Search</a> – and writing a <a href="http://asinesio.github.com/blog/2013/02/23/the-perils-of-the-grails-searchable-plugin/">blog post</a> to help prevent others from making the same mistake.</p>
<h3>What did you learn?</h3>
<ol>
<li><p>Much like high school kids, the popular plugins are not necessarily the best plugins.</p></li>
<li><p><em>Pay attention to what libraries are used by your dependencies before you choose them</em> or you may end up with dead-end software in your application.</p></li>
<li><p>The simplest solution may not be the best solution.</p></li>
</ol>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Powerful Admin Interfaces with Graphite and StatsD]]></title>
<link href="http://asinesio.github.com/blog/2013/02/19/powerful-admin-interfaces-with-graphite-and-statsd/"/>
<updated>2013-02-19T22:02:00-06:00</updated>
<id>http://asinesio.github.com/blog/2013/02/19/powerful-admin-interfaces-with-graphite-and-statsd</id>
<content type="html"><![CDATA[<p><a href="http://graphite.wikidot.com">Graphite</a> paired with <a href="http://github.com/etsy/statsd">StatsD</a> is a simple, powerful way to get dramatic insight into your application’s behavior.</p>
<p>The seminal <a href="http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/">Etsy blog post</a> on this subject explains it well:</p>
<blockquote><p>If Engineering at Etsy has a religion, it’s the Church of Graphs. If it moves, we track it. Sometimes we’ll draw a graph of something that isn’t moving yet, just in case it decides to make a run for it.</p><footer><strong>Ian Malpass, Etsy</strong> <cite><a href='http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/'>Measure Anything, Measure Everything</a></cite></footer></blockquote>
<h4>With Graphite, you get:</h4>
<ul>
<li>Beautiful, near real-time graphs of metrics.</li>
<li>A simply awesome API to embed graphs and source data in nearly any other system.</li>
</ul>
<h4>Combined with StatsD:</h4>
<ul>
<li>Fire-and-forget (UDP-based) metric data emission and aggregation.</li>
<li>Metrics that make sense.</li>
<li>Brain dead simple API that works in any language, from Groovy to shell scripts.</li>
</ul>
<h3>Knowledge is Power</h3>
<p>What are the first items that get cut from most software projects? <em>Effective support and administrative tools.</em></p>
<p>Without easy tools at your disposal, how many times have you written some code and thought:</p>
<blockquote><p>“What do I do if something goes wrong? Hmm, that’s hard. I guess I’ll just log the error for now.”</p></blockquote>
<p>I’m certainly just as guilty of this transgression as anyone else. Why would I waste valuable time writing a screen to manage the failures – something that may never be used?</p>
<!--more-->
<h3>A Simple Answer</h3>
<p>What if the code was this simple:</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>
</pre></td><td class='code'><pre><code class='java'><span class='line'><span class="kd">private</span> <span class="n">StatsDClient</span> <span class="n">statsdClient</span><span class="o">;</span>
</span><span class='line'>
</span><span class='line'><span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">doLogin</span><span class="o">(</span><span class="n">String</span> <span class="n">user</span><span class="o">,</span> <span class="n">String</span> <span class="n">pass</span><span class="o">)</span> <span class="o">{</span>
</span><span class='line'> <span class="kt">boolean</span> <span class="n">result</span> <span class="o">=</span> <span class="n">loginService</span><span class="o">.</span><span class="na">doLogin</span><span class="o">(</span><span class="n">user</span><span class="o">,</span> <span class="n">pass</span><span class="o">);</span>
</span><span class='line'> <span class="k">if</span> <span class="o">(</span><span class="n">result</span><span class="o">)</span> <span class="o">{</span>
</span><span class='line'> <span class="n">statsdClient</span><span class="o">.</span><span class="na">incrementCounter</span><span class="o">(</span><span class="s">"login.success"</span><span class="o">);</span> <span class="c1">// Nice.</span>
</span><span class='line'> <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
</span><span class='line'> <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
</span><span class='line'> <span class="n">log</span><span class="o">.</span><span class="na">warn</span><span class="o">(</span><span class="s">"User "</span> <span class="o">+</span> <span class="n">user</span> <span class="o">+</span> <span class="s">" failed login."</span><span class="o">);</span>
</span><span class='line'> <span class="n">statsdClient</span><span class="o">.</span><span class="na">incrementCounter</span><span class="o">(</span><span class="s">"login.failed"</span><span class="o">);</span> <span class="c1">// Nefarious attempt? Not sure.</span>
</span><span class='line'> <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
</span><span class='line'> <span class="o">}</span>
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>Two additional lines of code (if you don’t count injecting the <code>statsdClient</code>) and all of a sudden you’ve got a incredibly useful graph like Etsy’s:</p>
<p><img src="http://etsycodeascraft.files.wordpress.com/2011/02/logins2.png?w=500&h=300" alt="Graph showing login failures" /></p>
<p>When it’s that easy, <em>developers will use it by default.</em> You won’t have to include tracking these things in project estimates, steering committees, and testing plans. It will <em>just happen</em>.</p>
<h3>Show off your graphs. Publicly.</h3>
<p>Because Graphite has a <a href="https://graphite.readthedocs.org/en/latest/render_api.html">fantastic API</a>, all you need to do in order to show the number of failed logins in your admin interface is include a URL to Graphite’s render API in an <code><img></code> tag in your Admin interface.</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='html'><span class='line'><span class="nt"><img</span> <span class="na">src=</span><span class="s">"http://graphite.mycompany.com/render?target=stats.counts.login.success&from=-6hours&format=png"</span><span class="nt">></span>
</span></code></pre></td></tr></table></div></figure>
<p>With three lines of code, you’ve created a real time graph in your admin interface that shows login activity.</p>
<p>Some other places that are great to show a graph:</p>
<ul>
<li>A large TV in your workspace.</li>
<li>The app’s Wiki page and documentation.</li>
<li>In an email to team members.</li>
</ul>
<p>When a key graph is shared like this, the entire team – developers, system admins, and support engineers – will use it. After a time, they will find it indespensable – because it will make them more productive.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Your iPad app sucks.]]></title>
<link href="http://asinesio.github.com/blog/2013/02/15/your-ipad-app-sucks/"/>
<updated>2013-02-15T00:00:00-06:00</updated>
<id>http://asinesio.github.com/blog/2013/02/15/your-ipad-app-sucks</id>
<content type="html"><![CDATA[<p>Yeah. It’s harsh, but you know it’s true. Your iPad app probably sucks – <em>when compared to your web site.</em></p>
<p>Web browsing on an iPad is a blissful, unique, and sublime experience. It is, in my estimation, the single greatest advancement in web browsing since the advent of <code>XMLHttpRequest</code>.</p>
<p>On an iPad:</p>
<ul>
<li>Want to scroll? Grab the page and slide it over <em>like a piece of paper.</em></li>
<li>Is the text too small or too large? Stretch or pinch it <em>like silly putty.</em></li>
<li>Want to do something special with a word on the page? <em>Touch and hold.</em></li>
</ul>
<p>These interactions are so brilliant and obvious that it makes browsing almost any website – even this one – <em>fun</em>.</p>
<!--more-->
<p>Companies know this fact. And they also know that:</p>
<ul>
<li>Visitors are <em>precious</em>. The company has spent millions of dollars on their fancy web site to attract users like you.</li>
<li>iPads are used for nearly <a href="http://appleinsider.com/articles/12/09/27/apple-ipad-dominates-tablet-based-web-browsing-with-98-share-report-says">all tablet web browsing</a>.</li>
<li>iPad users are great customers – they’re generally <a href="http://www.nbcnews.com/technology/technolog/ipad-owners-trending-older-wealthier-now-157765">wealthy</a> and willing to spend money.</li>
<li>Pop-up advertisements <a href="http://liesdamnedliesstatistics.com/2009/07/consumers-annoyed-with-internet-ads.html">annoy the hell</a> out of customers.</li>
<li>First impressions are everything.</li>
<li>The iPad app isn’t as functional as the full-fledged web site.</li>
</ul>
<p>Knowing this, companies still somehow decide to show their precious visitors this monstrosity (source: <a href="http://www.xkcd.com">XKCD</a>)</p>
<p><img src="http://imgs.xkcd.com/comics/app.png" alt="XKCD coming showing a popover ad for an iPad app" /></p>
<p>Maybe their iPad app is wonderful. I’ll never know, though, because that ad – and by extension, the app – sucks.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Switching Grails Versions]]></title>
<link href="http://asinesio.github.com/blog/2013/02/13/switch-grails-versions/"/>
<updated>2013-02-13T00:00:00-06:00</updated>
<id>http://asinesio.github.com/blog/2013/02/13/switch-grails-versions</id>
<content type="html"><![CDATA[<p>This is my #firstpost, so I thought I’d share a useful Grails shell script.</p>
<p>(<strong>Update: you really should use <a href="http://gvmtool.net">gvm</a> instead of this script.</strong> It is a similar idea but also handles installation, path setup, and other tools like Gradle, vert.x, and Griffon.)</p>
<p>One of the annoying things about using <a href="http://www.grails.org">Grails</a> from the command line is dealing with multiple Grails versions on your system.</p>
<p>This isn’t an issue if you’re using an IDE that can refer to a Grails version outside of your $PATH. However, I find that using a command-line Grails in combination with an IDE like STS or GGTS is the most productive way for me to write Grails code.</p>
<!--more-->
<p>If you do nothing special, you’ll find yourself adding the following to your <code>~/.bash_profile</code> to make Grails work from a command line:</p>
<pre><code>GRAILS_HOME = /Users/asinesio/dev/tools/grails-2.1.0
export PATH=$PATH:$GRAILS_HOME/bin
</code></pre>
<p>Of course, you now have to change your <code>.bash_profile</code> every time you switch projects. Fail.</p>
<p>The obvious solution is a simple shell script that leverages the following ideas:</p>
<ol>
<li>Use a symbolic link from something like <code>/Users/asinesio/dev/tools/grails</code> to the actual Grails version you want to use.</li>
<li>Set this link as <code>GRAILS_HOME</code>.</li>
<li>Add <code>GRAILS_HOME/bin</code> to your <code>PATH</code>.</li>
<li>Use a <a href="https://gist.github.com/asinesio/4946855">shell script</a> on your path to automatically change the symbolic link to point to the correct Grails version.</li>
</ol>
<p>Once you’ve done that, changing is as easy as running: <code>grails-switch-version.sh 2.2.0</code></p>
<div><script src='https://gist.github.com/4946855.js?file=grails-switch-version.sh'></script>
<noscript><pre><code>#!/bin/bash
# This script will switch the active version of Grails. Tested on Mac OS X 10.7 and 10.8. Read install directions first!
#
# This software is copyright (c) 2012 Andy Sinesio. It's distributed under the MIT License: http://opensource.org/licenses/mit-license.php
#
# Installation steps:
# - Make sure GRAILS_HOME is pointing at a symbolic link that points one of your actual grails installations.
# 1) ln -s ~/dev/tools/grails-2.2.0 ~/dev/tools/grails
# 2) Set GRAILS_HOME in ~/.bash_profile to be the symlink, e.g. ~/dev/tools/grails
# - Place this file in any directory (preferably on your PATH, e.g. ~/bin) with execute permissions
# - Change GRAILS_INSTALL_DIRS to the folder on your computer that has all of your downloaded Grails installs, if needed.
#
# Usage: grails-switch-version.sh 2.1.0
GRAILS_INSTALL_DIRS="$HOME/dev/tools"
GRAILS_DIR_PREFIX="grails-"
NEW_GRAILS_DIR="$GRAILS_INSTALL_DIRS/$GRAILS_DIR_PREFIX$1"
if [ -L "$GRAILS_HOME" ] && [ -d "$NEW_GRAILS_DIR" ]; then
echo "Removing existing symlink version of Grails at $GRAILS_HOME, linking to $NEW_GRAILS_DIR"
rm $GRAILS_HOME
ln -s $NEW_GRAILS_DIR $GRAILS_HOME
$GRAILS_HOME/bin/grails --version
else
echo "Usage: grails-switch-version.sh <<VERSION_NUMBER>>, e.g. grails-switch-version.sh 2.2.0"
echo "Make sure that GRAILS_HOME ($GRAILS_HOME) is a symbolic link and grails versions are extracted in $GRAILS_INSTALL_DIRS"
fi</code></pre></noscript></div>
]]></content>
</entry>
</feed>