<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mick B on Medium]]></title>
        <description><![CDATA[Stories by Mick B on Medium]]></description>
        <link>https://medium.com/@therealmickben?source=rss-7911dc040508------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*skxD3pjkTpZjty7OGtAF4g.jpeg</url>
            <title>Stories by Mick B on Medium</title>
            <link>https://medium.com/@therealmickben?source=rss-7911dc040508------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 04:22:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@therealmickben/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why you should stop using Google Alerts]]></title>
            <link>https://therealmickben.medium.com/why-you-should-stop-using-google-alerts-3cf46fc48eb8?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cf46fc48eb8</guid>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[google-analytics]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[google-alerts]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Mon, 09 Nov 2020 02:42:39 GMT</pubDate>
            <atom:updated>2022-07-08T14:55:33.683Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is for users of Google Alerts who feel frustrated by its inconsistency, its lack of social media coverage, or its limited integration options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mHQ97dRhOMG3j-Yg" /><figcaption>Photo by <a href="https://unsplash.com/@mitchel3uo?utm_source=medium&amp;utm_medium=referral">Mitchell Luo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This is Google Alerts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/0*e3ENzP0f4V-p0ak4.png" /></figure><p>Google Alerts lets you “monitor the web for interesting new content”. It has some strengths:</p><ul><li>It’s easy to use.</li><li>It offers alert result previews.</li><li>It offers easy-to-use RSS.</li><li>Since you probably already have a Google account, you don’t need to sign up for yet another service. It just works.</li></ul><p>But it also has some weaknesses. Let’s talk about them, and how PMAlerts addresses each.</p><h3>It doesn’t find things as-they-happen.</h3><p>Google Alerts depends on Google’s web crawler, which means that you have to wait for Google’s crawler to find things before Google Alerts will notify you.</p><p>Google’s crawler wasn’t designed to support social media monitoring and alerting, so it finds things slowly. Google Alerts has to wait for Google’s crawler to find things:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/0*wicicMeqDSPJCGot.png" /></figure><p>This can be a problem if you’re using social media monitoring to manage customer relationships, because <strong>response times matter</strong>. According to <a href="https://www.arise.com/resources/blog/customer-service-frustrations-series-email-response-times">this study by Arise</a>, 81% of respondents expect businesses to respond to emails within 24 hours. The <a href="https://sproutsocial.com/insights/data/index/">2020 Sprout Social Index</a> contains similar findings for communications on social media: 79% of consumers expect a response time within 24 hours of reaching out.</p><p>PMAlerts was built to help you engage quickly. It’s optimized to find things as quickly as possible. It asks Google for results, but it also asks social media platforms directly, hundreds of times throughout the day:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*l8GCytmZATtxIgP9.png" /></figure><p>This means that you can use PMAlerts to capture relevant conversations <em>just about</em> as soon as they happen, which gives you an easy way to exceed customer expectations.</p><p>Using Google Alerts is like standing on top of a tower to monitor an area’s activity. You’ll catch the big stuff after it’s happened, but if you want to get on the ground and engage with precision, PMAlerts can help.</p><h3>It doesn’t monitor social media.</h3><p>There are probably a lot of relevant conversations happening on social media that Google Alerts isn’t telling you about.</p><p>PMAlerts was built to solve this problem. It monitors the following sources by default:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/0*j_r3k0_RcTGc_LMg.png" /></figure><p>You can even select the <strong>Custom </strong>option to monitor a specific website, or the entire internet.</p><h3>It doesn’t have many integrations.</h3><p>If you’re using PMAlerts for customer service, you probably want to share relevant results with your peers, or maybe even assign them as work items. PMAlerts makes this easy: if you mention <a href="https://www.karma.fm/@/PMAlerts">@PMAlerts</a> on Slack, Telegram, Teams, or Discord, PMAlerts will pipe results into your conversation(s):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/0*Dfz0f04GraPibXcD.png" /></figure><h3>It doesn’t support webhooks.</h3><p>Piping results into Slack and Discord may be useful, but what if you want to pipe results into an arbitrary system? PMAlerts lets you do this via webbooks.</p><p>You can use PMAlerts webhooks to continuously emit its social media monitoring results into your own sentiment analysis tools, project management software, databases, and more:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/0*VBrX2E75DMyiEPPX.png" /></figure><p>With a single click, you can tell PMAlerts to push new results into your app whenever it finds things.</p><h3>It doesn’t have SMS notifications.</h3><p>You might care about something that’s time-sensitive. If you’re monitoring Quora for questions about your area of expertise, you probably want to be one of the first people to answer whatever questions are asked. A text message can help cut through the noise of traditional app and email notifications. PMAlerts makes it easy to configure SMS alerts on a per-alert basis.</p><h3>It doesn’t give you an easy way to filter your results.</h3><p>You might want to filter out results that contain spammy language or bad words. PMAlerts makes <strong>custom filtering </strong>easy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/0*BXebtxpQxpeHZ5PX.png" /></figure><p>PMAlerts gives you three types of filtering:</p><ol><li><strong>Content filtering</strong>: This can be useful if you want to filter out specific words or phrases.</li><li><strong>Domain filtering</strong>: This can be useful if you’re monitoring the entire web and want to filter out results from specific websites.</li><li><strong>Username filtering</strong>: This can be useful if you want to mute results being published by a specific user.</li></ol><p>This is how filtering looks in the app:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/0*uj5c3dq4usUb9d_h.png" /></figure><h3>It doesn’t have customer service.</h3><p>If you have a problem with Google Alerts, who do you call? If you have a feature request, where do you submit it? PMAlerts has an accessible human being behind it — and he’s <em>extremely</em> incentivized to care about your needs.</p><h3>It’s not improving.</h3><p>Google Alerts hasn’t changed much over the past ten years. Any improvements made to Google Alerts would probably yield a relatively low return on Google’s investment when compared to their core portfolio of advertising products. Google might actually be <em>more</em> incentivized to kill Google Alerts and reallocate their resources to more clearly profitable endeavors.</p><p>There are alternatives to Google Alerts, but from what I’ve seen, they exclusively target enterprise consumers and are either expensive or bundled with other things that you probably don’t need.</p><p>PMAlerts was built to do one thing, really well: <strong>listen to the internet for mentions of keywords that you care about</strong>. It’s not brand management software, or an analytics suite, or a post scheduler, or an enterprise collaboration tool. It’s a social listening tool.</p><h3>It’s owned by Google.</h3><p>/eom</p><h3>Check out PMAlerts!</h3><p>PMAlerts is simple, <a href="https://www.pmalerts.com/">easy to try</a>, and <a href="https://www.pmalerts.com/upgrades">free to use</a> for anyone who can’t afford it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/0*5dP-UNYuXaSb12lZ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cf46fc48eb8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enterprise DevOps — Configuration Management]]></title>
            <link>https://therealmickben.medium.com/enterprise-devops-configuration-management-b15bd201bee8?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/b15bd201bee8</guid>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Sat, 25 Nov 2017 00:52:05 GMT</pubDate>
            <atom:updated>2022-07-27T17:55:10.074Z</atom:updated>
            <content:encoded><![CDATA[<p>My current customer has what we call “configuration sprawl”: many types of configuration supporting many different environments living in many different places.</p><p>They have hundreds of environments supporting a suite of applications, each supported by a diverse collection of infrastructure and release tools. The configuration supporting these environments is being duplicated across components and stored in many different ways which means that updating something as simple as a server credential is extremely risky. Below is a high-level overview of the problem and how I’m tackling it.</p><p><strong>The Problem</strong></p><p>My initial goal was small: Automate smoketests. The customer was manually running a series of Visual Studio webtests to smoketest their applications post-deployment before progressing a built to the next stage in their deployment pipeline. Environment-specific parameters were manually provided to these smoketests at runtime, most of which were being sourced from a version-controlled excel spreadsheet, a few csv files and some other sources. This was an error-prone and time-consuming process, so in the spirit of DevOps I wanted to see if the pain points surrounding smoketest automation were a symptom of a larger problem. Their “configuration story” looked something like this:</p><ul><li><strong>Infrastructure:</strong> ARM templates were being used with environment-specific json configuration files checked into source control.</li><li><strong>Deployments:</strong> The customer is using a combination of VSTS Release (vNext) and Release Management to orchestrate their deployments. Deployment configuration was being stored within (and duplicated between) these tools.</li><li><strong>Application</strong>: Application configuration was managed through a combination of environment-specific .config files and transformations within application code that were applied at build. This means that if config changes were needed, rebuilds would be needed.</li><li><strong>Testing</strong>: Configuration was being stored in a combination of Excel and CSV files that were used to manually drive the webtests.</li></ul><p>The problems are numerous here:</p><ul><li>Environment-specific configuration was stored in source-controlled ARM templates, in two different release tools (vNext and Release Management), in excel, in CSVs, in source-controlled environment-specific config files and in transforms. This is a serious level of sprawl.</li><li>Configuration was being duplicated between these locations.</li><li>Changing configuration usually meant that both a rebuild and redeploy were needed.</li></ul><p>The goals became:</p><ul><li>Centralize config to address sprawl and duplication.</li><li>Standardize the application of this config across Infrastructure, Deployments, Code, and Test.</li></ul><p>I don’t know if there’s an industry-standard approach to this problem, but here’s my train of thought:</p><ul><li>Since we have two different Release tools (Release Management for legacy apps and VSTS Release for newer stuff) we can’t store the configuration in the tool. This would require a duplication of efforts and configuration. Even if we had a single tool, this customer has a high number of environments with hundreds of configuration entries each. The VSTS Release UI is great for a smaller sets of configuration but isn’t intended to manage this volume.</li><li>Since we have configuration needs that span from code to deployments to infrastructure and test, source-controlled config-per-environment would get very messy very quickly.</li><li>If config can’t be stored in the release tools, and it can’t be stored in source control, then we need to store it in a custom, centralized config store. Table storage or SQL for example.</li><li>This also means that we need some standardized way to extract config from this config store at deploy time and apply it to whatever files require configuration. Things like appsettings.json, web.config, app.configs, ARM json files, etc.</li><li>The “hydration” of config should not be a “consumer” concern. This needs to be a release concern. This way we are not imposing additional overhead into the components that require configuration. For example — instead of having the smoketest tool pull config via a data source binding or HttpClient plugin at runtime — have the release tool inject config into a settings file at deploy time.</li></ul><p>The initial plan is as follows:</p><ol><li>Starting with the smoketest tool, move the necessary configuration away from excel/CSV and store it in a config store that lives behind an API.</li><li>Build a basic CRUD app to manage this configuration via a hosted GUI with secured API access.</li><li>Use a `settings.xml` file to store environment-specific configuration alongside the smoketest project. Use a corresponding `settings.xml.token` file with tokens that the release tool <em>injects configuration into</em> at deploy time.</li><li>Create a custom release task (a Powershell script that runs a custom EXE) that requests configuration key/value pairs from the config store API and then hydrates the target token files, converting them into usable configuration files.</li><li>Gradually move configuration from all applications and environments into this tool, create `.token` files, and extend the capabilities of this solution to suit additional components as needed.</li></ol><p>This seems appealing to me because it means we’re standardized, centralized and tooling-agnostic. We can use TFS Release, Release Management, Jenkins, whatever. <strong>I see this as a form of dependency injection: we’re decoupling the config from the build and injecting it as a dependency somewhere along the build/release pipeline.</strong></p><p>One issue with this approach is that we will have .config and .token files living next to each other; once a developer makes a change to the structure of their .config file, they also need to make the same change to the corresponding .token file. Given how infrequently config <em>structure</em> usually changes, I think this can be addressed by forcing a peer review or dev lead approval when making changes to .config files.</p><p><strong>Creating the Configuration Store</strong></p><p>The MVP approach to the configuration store looks something like this:</p><ul><li>An Azure SQL database with two tables: Environments and ConfigurationEntries. One-to-many there.</li><li>A barebones CRUD MVC app to administer these.</li></ul><p>A utility was then written to move the excel data to the database. Throw an API endpoint on top and we’re ready to automate smoketesting.</p><p><strong>Creating a Custom Release Task</strong></p><p>We don’t want the application or test code to be responsible for pulling config. The release tooling should <em>push</em> config into the target applications.</p><p>Since we’re now using a custom config store, we can’t use the OOB release tasks. We need to create a custom task that:</p><ul><li>Requests config from the config store for a particular environment</li><li>Hydrates token files with these values and transforms them into config files</li></ul><p>With this in place, we’ve now centralized config and standardized its consumption, reducing risk and enabling automation in the process.</p><p>Here’s the before picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*sLtUhq8EI1Qj4ybAnQDaxQ.png" /></figure><p>And here’s the after:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mbqDJ192JTmdJzsv_Ly3AQ.png" /></figure><p>Much simpler — config has been centralized and it’s applied at deploy time. The overall result here is cost savings in the form of risk reduction and automation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b15bd201bee8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is DevOps?]]></title>
            <link>https://therealmickben.medium.com/what-is-devops-f97ffc85267d?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/f97ffc85267d</guid>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Mon, 30 Oct 2017 02:24:05 GMT</pubDate>
            <atom:updated>2022-07-08T15:03:58.373Z</atom:updated>
            <content:encoded><![CDATA[<p>Software development is tough, but software <em>delivery</em> is tougher.</p><p>Development is just the tip of the iceberg. Delivery involves coordination between testing, QA, UI/UX, product management, project management, database administration, architecture, business needs, marketing, leadership, infrastructure, and of course — the end-users of the software you’re building.</p><p><strong>Figuring out how to orchestrate software delivery while keeping all stakeholder interests in mind </strong>is what DevOps is all about.</p><h4>Defining DevOps</h4><p><strong>DevOps</strong> is an organization’s combination of culture, philosophy, process, and tools that allows teams to translate code to customer value at minimal cost. It’s everything that goes into the <em>operationalization</em> of software development.</p><p>DevOps excellence can be achieved through:</p><ul><li><strong>Simplifying </strong>the processes that bring your products to your users. Sometimes this means simplifying your products.</li><li><strong>Automating </strong>as much as possible. Human intervention is risk; risk is expensive.</li><li><strong>Experimenting continuously </strong>to generate units of learning.</li><li><strong>Cultivating culture</strong> that embraces failed experiments as a cost of good business.</li></ul><p>The practice of DevOps boils down to <strong>continuous risk reduction in all areas of your delivery pipeline</strong>. It’s less about prescribing best practices, and more about building a culture that values simplicity, automation, and continuous experimentation.</p><p>The ideas presented here aren’t meant to be interpreted as universally applicable —feel free to take what works and discard the rest.</p><h4>Pipeline maturity</h4><p>A mature DevOps pipeline can be characterized by the following:</p><ul><li>Your developers can make changes and <strong>push them to production with confidence</strong> and “on demand” — within a few hours of making them — thanks to automated builds, tests, and deployments.</li><li>Pushes to production are <strong>observable within minutes</strong>.</li><li>Runtime observability is prioritized over complex testing that’s difficult to maintain.</li><li>It’s easy to <strong>roll changes out of production</strong> if needed, ideally through some form of feature flagging.</li><li>The time your team spends on <strong>production support is minimal</strong>.</li><li>Your builds, tests, deployments, monitoring, and infrastructure are all <strong>automated</strong>.</li><li>Your QA team is focused primarily on <strong>exploratory testing</strong> as opposed to repetitive testing. They aren’t hunting for regressions; they’re using the product and identifying opportunities to automate tests targeted at the most critical paths. Unit tests targeted at critical components should protect you against catastrophic regressions.</li><li>Your team does not feel like a firefighting unit — <strong>“fires” are infrequent</strong> or nonexistent.</li><li>Your team has the luxury of <strong>baking unit tests into estimates</strong> at sprint planning.</li><li>Your team participates in <strong>sprint planning</strong> and retrospectives.</li><li>Production sees <strong>frequent, small changes</strong> instead of massive, infrequent ones.</li><li><strong>Feedback from users is captured early and often</strong> based on these frequent changes yielding shorter feedback loops.</li><li>Your <strong>technical debt is measured</strong> and continuously improved.</li><li>Your services are outfitted with <strong>centralized logging and exception handling</strong>.</li><li>If you must use staged releases, as you move from one environment to another along your deployment pipeline, <strong>the only things that change are configuration, tests, and scale</strong>. If you’re taking advantage of staging slots in production, consider using staging slots in every other environment. The more consistency you have between environments, the lower the risk there is of surprises in production that impact customers.</li><li>Deployments to environments are <strong>idempotent and reversible</strong>.</li></ul><p>DevOps isn’t just about building a pipeline though. Building a culture to support that pipeline — and one that sticks — is just as important.</p><h4>Culture maturity</h4><p>A mature DevOps <strong>culture </strong>can be characterized by the following:</p><ul><li>Your entire <strong>team is aware</strong> of exactly what it takes for a code change to find its way from a developer’s box to production.</li><li>Your team is constantly <strong>learning through experimentation </strong>across technical and nontechnical areas.</li><li>High-bandwidth, low-politic <strong>feedback loops are available</strong> to facilitate rapid iteration, collaboration and knowledge-sharing between the various groups within your team.</li><li><strong>Criticism and doubt are embraced</strong>. Persuading and transitioning are huge hurdles, but <em>ensuring that this value persists</em> means that doubts must be surfaced and addressed before they manifest into regressions. Fostering a culture of oppenness and transparency means that the value you’re offering can stand up to (or evolve in response to) critical inquiry — as it should.</li><li><strong>Blame culture is eradicated</strong>. You’re delivering as a team — and that team by nature is a hedge against the risks that come with being human. Post-mortems should be blameless and should yield corrections and enhancements, not fear. Individual criticisms can be offered privately while praise is offered publicly to incentivize an open, collaborative dynamic instead of one characterized by competition, the withholding of information, and a fear of experimentation.</li><li><strong>Generalism is encouraged as a defense against regression</strong>. We need to ensure continuous improvements and defend against regressions. Part of this defense involves controlling the perception of the changes you’re championing. Effecting perception requires an active effort at all levels of a team to involve participants so that they are tuned into the evolution you’re facilitating. This means that the specialists, influencers, and leaders within your team should become aware of the bigger picture and how it’s improving over time — ideally through data that demonstrates cost reduction. This collective perception will hedge against the risk of someone introducing regressions when you’re no longer there. To encourage this, I like to frame involvement as “skillset enhancement” that improves each individual’s overall value to both their team and the industry at large.</li></ul><h4>Summary</h4><p><strong>DevOps is all about helping your team deliver software in a way that keeps all stakeholders happy. </strong>This can be achieved through continuous automations, simplifications, and experiments. “Good DevOps” is a state in which your code flows from developers’ minds to production with <strong>max confidence and min stress</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f97ffc85267d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How GuardMyPad.com Uses WebRTC]]></title>
            <link>https://therealmickben.medium.com/how-guardmypad-com-uses-webrtc-96e8c010d47e?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/96e8c010d47e</guid>
            <category><![CDATA[webrtc]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Sun, 29 Oct 2017 23:19:12 GMT</pubDate>
            <atom:updated>2019-10-08T01:38:56.330Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.guardmypad.com/"><strong>GuardMyPad</strong></a> is a web application that allows you to turn the devices you already own into a home security solution. This means you can use any of the following to remotely monitor your space:</p><ul><li>Your old Android Phone</li><li>Your spare laptop</li><li>Your old desktop computer</li><li>Your Chromebook</li><li><em>Soon:</em> Your iOS devices</li></ul><p>This is really exciting because it <em>significantly reduces the cost</em> of security setup. You can now secure and monitor your space as easily as you can watch Netflix — no installations, no phonecalls, no shipping hardware. GuardMyPad facilitates this by extending your cameras’ capabilities with motion detection, audio detection, video recording, image capturing, live streaming and more.</p><p>This is all made possible by <a href="https://webrtc.org/"><strong>WebRTC</strong></a><strong> </strong>and other closely related technologies that are significantly reducing the cost and complexity of real-time communications implementation. The following is a brief technical overview of how GuardMyPad uses WebRTC.</p><h3>How GuardMyPad Uses WebRTC</h3><p>The mission: build a cross-platform home security solution that offers an unencumbered, full-featured, <strong>free core product</strong> to its users. At a minimum, the solution should provide:</p><ul><li>Motion Detection</li><li>Video Recording / Image Capture</li><li>Cross-platform Streaming</li><li>Flexible Media Storage</li></ul><p>Given how easy it is to build<strong> </strong><a href="https://electron.atom.io/"><strong>desktop apps with web technology</strong></a>, I decided to target “all the things” by building a Chromium-first app using HTML and JS.</p><h4>Motion Detection</h4><p>Motion detection on the browser is tough. Clientside image processing is needed to ensure speedy detection, alerts, and media capture, all with JavaScript, all without choking the browser. Somehow.</p><p>It’s currently handled as follows: Once a locally connected camera’s stream is captured using <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia"><strong>getUserMedia</strong></a>, a “motion detector” module is plugged into the stream. This motion detector then siphons images off the stream at whatever rate it can comfortably handle — somewhere between 2–4 images per second.</p><p>The images that it analyzes are significantly reduced in size on their way off the stream. The motion detector then starts analyzing the pixels of these micro-images — starting at the edges — to calculate the <a href="https://en.wikipedia.org/wiki/Color_difference"><strong>color difference</strong></a> between the pixels along the way, progressively constructing the coordinates of a motion detection box and skipping pixels as it can to finish as quickly as possible. These coordinates are then scaled back up to the displayed resolution, resulting in the cool effect you see when GuardMyPad detects motion:</p><p><em>You can see this “under the hood” UI in action if you click the GuardMyPad logo in-app while a camera is locally attached and motion detection is enabled.</em></p><h4>Video Recording</h4><p>The first version of GuardMyPad simply waited for motion to be detected and then kicked off a <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder"><strong>MediaRecorder</strong></a> to record the camera’s MediaStream for as long as was necessary. This is a bit of a naive implementation though because it was often missing the interesting frames. A burglar might break down your door and by the time the MediaRecorder started recording, the door was already off its hinges.</p><p>To solve this, <em>buffered </em>recording was needed: captured videos should be buffered by around five seconds of video on each end to ensure that the events leading up to and following whatever it was that crossed the motion (or audio) detection threshold are captured.</p><p>Queuing was used to solve this. Given a segment without motion, queue it as a potential “head”. If motion is detected in the next segment, keep both and continue to save segments until the first non-motion segment is queued as the “tail” of the video.</p><p>Easier said than done because once you start a MediaRecorder, its first segment is the only one that can be the head of the video. This means <em>two</em> tandem MediaRecorders were needed to guarantee that we would always have a 5-second lead on any motion that was detected.</p><h4>Streaming</h4><p>This is where WebRTC really shines. While motion detection alerts and video capture are handy, being able to see live footage of your camera(s) is an essential feature in any home security app.</p><p><em>At the time of this writing, streaming will only work across non-iOS devices. This is </em><a href="https://webkit.org/status/#"><em>soon to change</em></a><em> though.</em></p><p>The first version of GuardMyPad modeled “browsers as devices” building connections with other remote browsers. This meant that you would have one computer or mobile device as a “guard” with a camera attached, and another as a “remote” that would view the guard. This was simple in implementation but made for a complex and limited user experience, especially when thinking about multiple cameras and desktop use.</p><p>The current version of GuardMyPad models “cameras as devices” building connections of their own. This means you can now add 2 cameras to a desktop computer upstairs, 2 cameras to your laptop downstairs, and experience the same UX across devices.</p><p>This change was completed in a matter of <em>hours</em> thanks to the simplicity of WebRTC’s <a href="https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection"><strong>RTCPeerConnection</strong></a> spec.</p><h4>Flexible Media Storage</h4><blockquote>“I don’t want some random company to see or control my private media.”</blockquote><p>GuardMyPad defaults to GMP Cloud Storage, but you can use personal cloud storage (like Dropbox or Google Drive) or device storage if you want. With these options, your storage capabilities depend only on how much storage you want to purchase <em>outside </em>of GuardMyPad — a low fixed cost for device storage, or a low recurring cost for cloud storage providers. <em>Low cost</em> is key here. This is how GuardMyPad can offer a free core product — if users opt out of GMP Cloud Storage, platform costs are reduced to metadata and signalling.</p><p>Personal cloud storage providers are uninteresting in this context — you upload your data and it’s accessible from any device with a connection.</p><p>Device storage is where WebRTC comes to the rescue, yet again. By using WebRTC’s <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Simple_RTCDataChannel_sample"><strong>Data Channels</strong></a>, GuardMyPad is able to store your data on your device and then transfer it directly to your other devices, automatically, without any third party ever getting its hands on it. Isn’t that cool? This means if a bad guy destroys your laptop, incriminating media will have already been transferred to your other devices.</p><p><em>This particular functionality is currently “experimental”.</em></p><h4>In Closing</h4><p>WebRTC is changing the way real-time web applications are built. If you haven’t played with it yet, Google has some <a href="https://codelabs.developers.google.com/codelabs/webrtc-web"><strong>great codelabs</strong></a> available.</p><p>If you’re interested in using GuardMyPad, it’s now in private beta. This means:</p><ul><li>It requires an access code — you can use “<strong>webrtc</strong>”.</li><li>There’s a lot of work left to do — especially around performance and stability.</li><li>You may experience some buggy behavior as the product evolves.</li></ul><p>I hope you like it! Thanks for reading,</p><p>Mick</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96e8c010d47e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GuardMyPad.com — An Overview]]></title>
            <link>https://therealmickben.medium.com/guardmypad-com-an-overview-c5991654986e?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5991654986e</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Sun, 29 Oct 2017 18:26:45 GMT</pubDate>
            <atom:updated>2017-10-30T04:28:26.947Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auhNxmDlZFMWePcUBXgmnw.png" /></figure><p>WebRTC is exciting technology. It’s lowering the cost of communications by equipping browsers with peer-to-peer technology that supports voice and video transmission without the overhead of VoIP hardware and its integration costs.</p><p>I wanted to get my feet wet with WebRTC; I learn by building so I decided to apply the technology to the home security domain. The result: <a href="https://www.guardmypad.com/">GuardMyPad.com</a>.</p><p>GuardMyPad is a web application that allows you to repurpose the devices you already own into a free home security solution.</p><p>My mission was to offer a beautiful, easy-to-use, free core product that offers the following:</p><ul><li>Cross-platform support</li><li>A dead-simple user experience</li><li>Motion and audio detection</li><li>Video and image capture</li><li>Flexible media storage options</li></ul><p>GuardMyPad now offers all of the above. You may use your Chromebook, laptop, tablet, spare phone, or even desktop computer to monitor your home with your web browser and any attached camera(s). GuardMyPad will use these cameras to detect motion and transmit live streams to any other device you’re using (among other things).</p><p>Some examples of how GuardMyPad may be used:</p><ul><li>Connect a webcam to your computer and monitor your pets and kids while away from home.</li><li>Set up your desktop computer to be the “command center” for any number of motion-detecting, live-streaming webcams placed throughout your home or business as a cheap alternative to buying dedicated hardware.</li><li>Monitor your room with your laptop or spare phone and receive alerts when someone enters your space.</li><li>Use GuardMyPad to keep an eye on your belongings while staying in a hotel.</li><li>Leave a spare phone in your suitcase to see if a TSA agent opens up your checked bag.</li></ul><p>It’s <em>easy </em>to do all of the above with GuardMyPad.</p><blockquote><strong>But I don’t want some company to see my media.</strong></blockquote><p>This is important — <strong>you control your media</strong>. You may configure GuardMyPad to store all captured media in your personal Google Drive account, on Dropbox, or even right on the device — with options for data caps and rolling storage so you don’t have to worry about managing available space.</p><p>Our biggest achievement here is cost reduction. You can now easily set up a “better than nothing” home security solution for free. Who wouldn’t want free peace of mind?</p><p>GuardMyPad was an exercise in WebRTC technology. In my opinion, home security solutions are quickly becoming more sophisticated and less expensive. Even if there’s a segment that would pay for this type of product, I believe that segment is shrinking as dedicated hardware solutions become more accessible.</p><p>It’s a cool demonstration of WebRTC capabilities but I have doubts that the overall “user experience” of repurposing your devices is one that people would pay for.</p><p>GuardMyPad is in private beta. To be notified when the product enters public beta, head over to <a href="https://www.guardmypad.com/beta">guardmypad.com</a> and submit your email address. This link may also be used to gain early beta access if you’re cool with using something in development.</p><p>Thanks for reading!</p><p>Mick</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5991654986e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating MarkdownSharp and Pagedown into your MVC App]]></title>
            <link>https://therealmickben.medium.com/integrating-markdownsharp-and-pagedown-into-your-mvc-app-9dc3d7936840?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dc3d7936840</guid>
            <category><![CDATA[markdown]]></category>
            <category><![CDATA[appdev]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Sun, 29 Oct 2017 06:15:03 GMT</pubDate>
            <atom:updated>2017-10-29T18:37:26.282Z</atom:updated>
            <content:encoded><![CDATA[<p>One of my apps uses Markdown for content editing, just like StackOverflow. Fortunately, the folks over at SO decided to open-source their code for that feature set. It’s broken into two parts:</p><ol><li><a href="https://code.google.com/p/markdownsharp/">MarkdownSharp</a>: Serverside markdown compiler</li><li><a href="https://code.google.com/p/pagedown/">Pagedown</a>: Clientside markdown converter/preview generator</li></ol><p>So, why do we need both of these?</p><p>Well, you could just stick with pagedown, store the markdown in your server, and serve the markdown back up to browsers for them to render every time they load some markdowned content. But there are a few problems with this:</p><ol><li>Search engines won’t see the content since they don’t run the JS you’ll need to convert the markdown to html</li><li>Users without JS won’t even be able to read your site’s content for the same reason</li><li>Do you really want to use your browser’s precious resources compiling html for every view?</li></ol><p>You can use Pagedown on the client to actually compose your markdown, and then shoot it off to a serverside controller that compiles valid html using MarkdownSharp. Store both versions in the db. Why store both? Well, for view-only access, you just need the generated html. But what if you allow your users to edit their content? Then you need to pull up the original markdown.</p><p>Ok, now for the implementation. Here are the steps:</p><p><strong>Clientside — Pagedown</strong></p><ol><li>Get your textbox ready:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*_6U--SPE1yl6tCftYmDQSQ.png" /></figure><p>2. Include Markdown.converter.js, Markdown.Sanitizer.js, and Markdown.Editor.js in your solution, along with wmd-buttons.png and the css from demo.css</p><p>3. Add the js from demo.html to your page’s js — this hooks up the pagedown functionality. Make sure you either use onReady or ensure that the js loads after your elements are ready.</p><p>4. Tie the wmd-input, wmd-button-bar, and wmd-preview ids up like demo.html. Optionally include the CSS.</p><p>5. Enjoy clientside markdown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*skfaKWSuj052-eip69Hdxg.png" /></figure><p><strong>Serverside — Markdown</strong></p><p>1. Copy the Markdown.cs file into your project</p><p>2. Instantiate that and use it to store html alongside your raw text:</p><pre>private readonly Markdown _compiler; <br>_compiler = new Markdown {<br>   AutoHyperlink = true, AutoNewLines = false<br>}; // I do this in a BaseService <br>string html = _compiler.Transform(newPost.Content);</pre><p>Thanks for reading!</p><p>Mick</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dc3d7936840" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance Tuning: Entity Framework vs Dapper]]></title>
            <link>https://therealmickben.medium.com/performance-tuning-entity-framework-vs-dapper-3de16d31fd26?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/3de16d31fd26</guid>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Sun, 29 Oct 2017 06:05:58 GMT</pubDate>
            <atom:updated>2017-10-29T18:36:54.049Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>In summary: Start with EF when you need to remain nimble. Move to Dapper when you’re ready to commit to your business logic and optimize performance.</strong></p><p>Entity Framework vs Dapper. Which do you pick?</p><p>Entity Framework and other ORMs are convenient, but they come with a catch. Performance isn’t all that great if you’re comparing them to raw SQL due to the costs of abstraction.</p><p>Dapper might not be as accessible, but it’s a step away from stored procedures in terms of performance and a couple steps away from ORMs in terms of developer experience (you have to know a bit of SQL).</p><p>My strategy when developing new products and solutions is:</p><ul><li>Develop all of the DAL using Entity Framework first — accumulate some technical debt in exchange for flexibility in the early stages of your product development.</li><li>As your product’s features are validated (via testing, QA, user feedback, etc), evaluate performance across your application and convert your EF queries into Dapper queries where needed. Find the bottlenecks and embrace the commitment.</li></ul><p>Fun fact: Dapper was made by the team over at StackOverflow. Probably one of the fastest sites you’ve been on.</p><p>Thanks for reading!</p><p>Mick</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3de16d31fd26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced Cache-busting with Single-Page-Apps and .NET Framework]]></title>
            <link>https://therealmickben.medium.com/advanced-cache-busting-with-single-page-apps-and-net-framework-e96b8b568a1f?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/e96b8b568a1f</guid>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Sun, 29 Oct 2017 05:58:55 GMT</pubDate>
            <atom:updated>2017-10-29T18:35:58.908Z</atom:updated>
            <content:encoded><![CDATA[<p>Busting cache in MVC is pretty easy stuff — just leverage .NET MVC <a href="http://www.asp.net/mvc/overview/performance/bundling-and-minification">bundling</a> to detect changes and append a unique identifier to your bundles.</p><p>Things get trickier when users aren’t always refreshing though. Consider the following scenario:</p><ol><li>Frank visits FStop.fm and downloads the FStop v1.0 SPA from your site to his browser. He uses it nonstop without refreshing his browser because your app is awesome.</li><li>You ship an update, FStop v1.1.</li><li>Frank hasn’t refreshed his browser in a <em>year</em> because he’s been glued to FStop.</li><li>Frank’s v1.0 client-side code makes a request to v1.1 API endpoints, which are delivering v1.1 payloads. Frank’s app errors out or crashes.</li></ol><p>How do you prevent this from happening? It turns out it’s not so bad. We need some way for your SPA to know what version of client-side code it is. Then, we need to append the version number to AJAX responses that our API returns. Finally, we need to compare the two at every response on the client, and if they’re different, advise Frank that it’s in his best interest to reload when he has the chance.</p><p><strong>Part 1: What version do I have on the browser?</strong></p><p>Your code needs to know what version it is. So, as part of every initial payload that gets sent down with your SPA, append the BuildVersion:</p><pre>// C# ViewModel <br>viewModel.VersionNumber = Assembly.GetExecutingAssembly().GetName().Version.ToString();</pre><p>Then serialize this into your app’s context when it hits the browser on your Index.cshtml:</p><pre>&lt;script type=&quot;text/javascript&quot;&gt; <br>   window.appContext = @Html.Raw(JsonConvert.SerializeObject(Model)) <br>&lt;/script&gt;</pre><p>Now your clientside viewmodels and services have access to the cached version.</p><p><strong>Part 2: How do I tell the client that there’s a new version available?</strong></p><p>Now your WebAPI requests need to be decorated with a little versioning. This was achieved by creating a custom Filter and registering it globally:</p><pre>public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { <br>   var version = Assembly.GetExecutingAssembly().GetName().Version;  <br>   actionExecutedContext.Response.Content.Headers.Add(&quot;BuildVersion&quot;, version.ToString()); <br>}</pre><p>Responses from the server will contain this header:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*peHoDGAmBJKFMNQM1l_o6g.png" /></figure><p><strong>Part 3: How do I decide when to notify the user?</strong></p><p>Your app needs to ask this of every subsequent AJAX request it makes by reading the Header value we just created. So in your base AJAX service (or wherever your requests get sent from — hopefully not a bunch of places), implement a check like the following:</p><pre>if (!warned){<br>  var newVersionNumber = response.getResponseHeader(&quot;BuildVersion&quot;);<br>  if (newVersionNumber != cachedVersionNumber){<br>    doSomething();<br>  }<br>}</pre><p>This means that if the app errors out because of a mismatch, you force a refresh. Otherwise, just tell Frank once that there could be some bugginess if the he doesn’t refresh.</p><p>Thanks for reading!</p><p>Mick</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e96b8b568a1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Powershell to Resize Images for Gamma Gallery]]></title>
            <link>https://therealmickben.medium.com/using-powershell-to-resize-images-for-gamma-gallery-6274f57fed1?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/6274f57fed1</guid>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Sun, 29 Oct 2017 05:40:40 GMT</pubDate>
            <atom:updated>2017-10-29T18:35:36.951Z</atom:updated>
            <content:encoded><![CDATA[<p>One of my colleagues fell in love with this photo gallery: <a href="http://tympanus.net/codrops/2012/11/06/gamma-gallery-a-responsive-image-gallery-experiment/">Gamma Gallery</a></p><p>It uses the device width to determine which images to load to achieve a fluid, responsive, mobile-friendly image grid. Cool stuff. But it requires that seven different sizes be available for each image. For him, that meant manually resizing around 100 photos, or trying to find a tool that could do it. We couldn’t find anything so I created a script for it.</p><p>If you look at the plugin, it requires the following:</p><pre>&lt;ul class=&quot;gamma-gallery&quot;&gt; <br>   &lt;li&gt; <br>      &lt;div data-alt=&quot;img01&quot; data-description=&quot;&lt;h3&gt;Assemblage&lt;/h3&gt;&quot; data-max-width=&quot;1800&quot; data-max-height=&quot;2400&quot;&gt; <br>      &lt;div data-src=&quot;images/xxxlarge/1.jpg&quot; data-min-width=&quot;1300&quot;&gt;&lt;/div&gt; <br>      &lt;div data-src=&quot;images/xxlarge/1.jpg&quot; data-min-width=&quot;1000&quot;&gt;&lt;/div&gt; <br>      &lt;div data-src=&quot;images/xlarge/1.jpg&quot; data-min-width=&quot;700&quot;&gt;&lt;/div&gt; <br>      &lt;div data-src=&quot;images/large/1.jpg&quot; data-min-width=&quot;300&quot;&gt;&lt;/div&gt;          <br>      &lt;div data-src=&quot;images/medium/1.jpg&quot; data-min-width=&quot;200&quot;&gt;&lt;/div&gt; <br>      &lt;div data-src=&quot;images/small/1.jpg&quot; data-min-width=&quot;140&quot;&gt;&lt;/div&gt; <br>      &lt;div data-src=&quot;images/xsmall/1.jpg&quot;&gt;&lt;/div&gt; <br>      &lt;noscript&gt; <br>         &lt;img src=&quot;images/xsmall/1.jpg&quot; alt=&quot;img01&quot;/&gt; <br>      &lt;/noscript&gt; &lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;!-- ... --&gt; &lt;/li&gt; &lt;!-- ... --&gt; &lt;/ul&gt;</pre><p>So, for each image, we need to drop a resized version of it into one of seven folders. Here’s the powershell script that does just that:</p><pre>$targetFolders = @{ <br>   &quot;xxxlarge&quot;=1800 <br>   &quot;xxlarge&quot;=1300 <br>   &quot;xlarge&quot;=1000 <br>   &quot;large&quot;=700 <br>   &quot;medium&quot;=300 <br>   &quot;small&quot;=200 <br>   &quot;xsmall&quot;=140 <br>} </pre><pre>$myEncoder = [System.Drawing.Imaging.Encoder]::Quality <br>$encoderParams = New-Object System.Drawing.Imaging.EncoderParameters(1) <br>$encoderParams.Param[0] = New-Object System.Drawing.Imaging.EncoderParameter($myEncoder, 100) <br>$myImageCodecInfo = [System.Drawing.Imaging.ImageCodecInfo]::GetImageEncoders()|where {<br>   $_.MimeType -eq &#39;image/jpeg&#39;<br>} <br>[void][System.Reflection.Assembly]::LoadWithPartialName(&quot;System.Drawing&quot;) <br>$originalImagesDirectory = &quot;C:\YOURDIRECTORY\originalImages&quot; $newImagesDirectory = &quot;C:\YOURDIRECTORY\newImages&quot; </pre><pre>Remove-Item $newImagesDirectory\* </pre><pre>$targetFolders.GetEnumerator() | <br>   % { <br>      New-Item ($newImagesDirectory +&#39;\&#39; + $_.key) -type directory <br>     } </pre><pre>Function ResizeImage ($targetWidth, $targetImage) { </pre><pre>   #compute the ratio to use - width dependent only <br>   $ratio = $targetWidth / $bmp.Width; </pre><pre>   #create resized bitmap <br>   $newWidth = [int] ($bmp.Width*$ratio) <br>   $newHeight = [int] ($bmp.Height*$ratio) <br>   $bmpResized = New-Object System.Drawing.Bitmap($newWidth, $newHeight) <br>   $graph = [System.Drawing.Graphics]::FromImage($bmpResized) <br>   $graph.Clear([System.Drawing.Color]::White) <br>   $graph.DrawImage($bmp,0,0 , $newWidth, $newHeight) <br>   return $bmpResized <br>} </pre><pre>Get-ChildItem $originalImagesDirectory | <br>Foreach-Object{ <br>   $fileLocation = $_.FullName <br>   $fileName = $_.Name <br>   if (!(Test-Path $fileLocation)){throw( &quot;Cannot find the source image&quot;)} <br>   $bmp = [System.Drawing.Image]::FromFile($fileLocation) </pre><pre>   $targetFolders.GetEnumerator() | <br>      % { <br>         $newTarget = ($newImagesDirectory +&#39;\&#39; + $_.key + &#39;\&#39; + $fileName) <br>         Write-Host &quot;targeting image $fileLocation to be dropped at $newTarget&quot; <br>         if ($bmp.Width -gt $_.value){ <br>           $newImage = ResizeImage -targetWidth $_.value -targetImage $bmp <br>           $newImage.Save($newTarget, $myImageCodecInfo, $($encoderParams)) <br>           $newImage.Dispose() <br>         } <br>         else{ <br>             Copy-Item $fileLocation $newTarget <br>         } <br>      } <br>  } </pre><pre>Write-Host &quot;done&quot;</pre><p>Thanks for reading!</p><p>Mick</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6274f57fed1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Local Tokenizer for Teams Leveraging Release Management]]></title>
            <link>https://therealmickben.medium.com/building-a-local-tokenizer-for-teams-leveraging-release-management-4890975f364f?source=rss-7911dc040508------2</link>
            <guid isPermaLink="false">https://medium.com/p/4890975f364f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Mick B]]></dc:creator>
            <pubDate>Sun, 29 Oct 2017 05:21:08 GMT</pubDate>
            <atom:updated>2017-10-29T18:38:06.280Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.visualstudio.com/en-us/explore/release-management-vs.aspx">Release Management</a> brings a lot to the table as far as DevOps go. Automating and controlling your releases is hairy business; this tool takes a swing at making it easy. While the original on-prem product is a bit rough around the edges, it’s good enough that we use it for my current customer — a school district serving almost a million students.</p><p>One feature of Release Management is Tokenization. This is an alternative to Web.config transforms and allows you to leverage Release Manager’s component paradigm to — in its most common use-case — define web.config values from within your various release templates (corresponding to environments) via the RM UI.</p><p>There’s a problem though — this means that you have to create a web.config.tokenfile, as well as a web.config file. The web.config file is used by developers while the web.token.config file is used by RM. When your development team makes changes to web.config, Release Management doesn’t care because it’s only looking for your .token file.</p><p>This means that your developers need to make changes to both web.config AND web.config.token. This is less than ideal.</p><p>The solution? Remove web.config, and leverage web.config.token to generate a web.config pre-build using a local file that contains the token values. This means that changes to web.configneed only happen once. Changes to the structure of the file or anything that does not change between environments would be made to web.config.token while changes to the token values would be made to the local token values file.</p><p>How can we achieve the above? Powershell, baby.</p><p><strong>Step 1:</strong> Add a web.tokens file. This is an XML file containing the keys/values that you’d like to tokenize:</p><pre>&lt;Root&gt; <br>   &lt;Token&gt; <br>      &lt;Key&gt;Title&lt;/Key&gt; <br>      &lt;Value&gt;This Blog Rocks&lt;/Value&gt; <br>   &lt;/Token&gt; <br>   &lt;Token&gt; <br>      &lt;Key&gt;Debug&lt;/Key&gt; <br>      &lt;Value&gt;true&lt;/Value&gt; <br>   &lt;/Token&gt; <br>&lt;/Root&gt;</pre><p><strong>Step 2:</strong> rename your web.config to web.token.config and update your values with tokens. For example:</p><pre>&lt;appSettings&gt; <br>   &lt;add key=&quot;Title&quot; value=&quot;__Title__&quot; /&gt; <br>   &lt;add key=&quot;webpages:Version&quot; value=&quot;3.0.0.0&quot; /&gt; &lt;add key=&quot;webpages:Enabled&quot; value=&quot;false&quot; /&gt; <br>   &lt;add key=&quot;ClientValidationEnabled&quot; value=&quot;true&quot; /&gt; <br>   &lt;add key=&quot;UnobtrusiveJavaScriptEnabled&quot; value=&quot;true&quot; /&gt; &lt;/appSettings&gt;</pre><p><strong>Step 3:</strong> Add this killer powershell script to the root of your project to generate a web.config for your local deployments using tokenization (mimicking what RM does behind the scenes):</p><pre>try { <br>   # get xml <br>   [xml]$tokens = (New-Object System.Net.WebClient).DownloadString($tokenConfig) </pre><pre>   # iterate through each line <br>   $initiated = $FALSE </pre><pre>   write-host Beginning iteration </pre><pre>   foreach($token in $tokens.Root.Token) { <br>      $key = $token.Key <br>      $value = $token.Value </pre><pre>      write-host Replacing __${key}__ with $value <br>      <br>      # find and replace corresponding token in web.config <br>      if ($initiated){ <br>         (Get-Content $targetConfig) | <br>         Foreach-Object {$_ -replace &quot;__${key}__&quot;, &quot;$value&quot;} | <br>         Set-Content $targetConfig <br>      } else { <br>         (Get-Content $tokenizedWebConfig) | <br>         Foreach-Object {$_ -replace &quot;__${key}__&quot;, &quot;$value&quot;} | <br>         Set-Content $targetConfig <br>      } </pre><pre>      $initiated = $TRUE; <br>   } <br>} catch { <br>   write-host Error hydrating $webconfig with $tokens <br>}</pre><p><strong>Step 4:</strong> Add a Pre-Build event to your project to tie all this stuff together:</p><pre>powershell.exe -file &quot;$(ProjectDir)tokenize.ps1&quot; -tokenizedWebConfig &quot;$(ProjectDir)web.config.token&quot; -tokenConfig &quot;$(ProjectDir)Web.tokens&quot; -targetConfig &quot;$(ProjectDir)Web.config&quot;</pre><p>There you have it — now your developers don’t need to worry about updating two files with the same changes. You just need to update their development process to leverage the new token values file to change their values, and to update the token.config file instead of the web.config if they need to make changes to the actual web.config. Without this bit of risk (cost) reduction, the district would be wasting thousands of dollars any time someone forgot to manually update two files with the same change.</p><p>Thanks for reading!</p><p>Mick</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4890975f364f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>