Over a million developers have joined DZone.

Digg/RSS Reader

·
Grabs the RSS-feed from digg.com and reads it out
loud using festival.


#!/bin/sh
# Copyright (c) 2005 Davor Babic 
# All rights reserved.
# Usage of the works is permitted provided that this
# instrument is retained with the works, so that any
# entity that uses the works is notified of this
# instrument.
# DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.

url="http://digg.com/rss/index.xml"

echo "Parsing RSS..."
curl --silent "$url" | grep -E '(title>|description>)' | \
        sed -n '4,$p' | \
	sed -e 's///' -e 's/<\/title>//' -e 's/<description>/  /' \
	    -e 's/<\/description>//' | head -5 > digg 
echo "Reading..."
festival --tts digg
rm -rf ./digg
echo "Done."
</code></pre></div>
            <div class="article-bumper article-bumper-bottom"
                 ng-if="articles[0].showLogo"
                 ng-bind-html="articles[0].partner.bottom.text | partnerBumperLinks:articles[0].partner.bottom.id">
                
            </div>

            <div class="article-topics">
                <div class="topic-label">Topics:</div>
                <div class="topics">
                        
                </div>
            </div>

        </div>

    </article>

    <div class="col-md-12 col-sm-12 col-xs-12">
        <th-if-scroll relative-to="bottom" from="-20" to="0" callback="activateB(articles[0])"></th-if-scroll>
    </div>

</div>

<div class="ad-silver row" ng-if="articles[1] && !articles[1].partner.isSponsoringArticle && width >= 768">
    <div class="col-md-12">
        <div ng-if="ads.secondArea.show()" dc-slot="ads.secondArea.slot()" tags="ads.secondArea.tags(articles[1])" class="ad-container" size="ads.secondArea.size()"></div>
    </div>
</div>

<div class="ad-gold row" ng-if="articles[1] && !articles[1].partner.isSponsoringArticle && width < 768">
    <div class="col-md-12">
        <div ng-if="ads.gold1.show()" dc-slot="ads.gold1.slot()" tags="ads.gold1.tags(articles[0])" class="leaderboard-ad" size="ads.gold1.size()"></div>
    </div>
</div>


</div>
<div class="articles-wrap" ng-repeat="article in articles" ng-if="$index > 0 || article.id != 830314" ng-include="'/static/article/article.html'"></div>

<div style="clear: both;"></div>
<th-if-scroll ng-if="!isPreview" relative-to="bottom" from="-50" to="50" callback="loadMore()"></th-if-scroll>
</div></div></div><div class="container-fluid footerOuter" th-element="footerOuter" th-element-groups="[]" ng-hide="$root.isHidden('footerOuter')" data-th-element-name="footerOuter"><div class="row row1" th-element="row1" th-element-groups="['footerOuter']" ng-hide="$root.isHidden('row1')" data-th-element-name="row1"><div class="col-md-12 container2" th-element="container2" th-element-groups="['footerOuter','row1']" ng-hide="$root.isHidden('container2')" data-th-element-name="container2"><div class="container container2" th-element="container2" th-element-groups="['footerOuter','row1','container2']" ng-hide="$root.isHidden('container2')" data-th-element-name="container2"><div class="row footer" th-element="footer" th-element-groups="['footerOuter','row1','container2','container2']" ng-hide="$root.isHidden('footer')" data-th-element-name="footer"></div></div></div></div></div><div class=" sidebar sidebarTapBar oUhbkSMadabbWQbVkcC oUhbkSMadabfWVcC" th-element="sidebar" th-element-groups="[]" ng-hide="$root.isHidden('sidebar')" data-th-element-name="sidebar" data-th-widget="sidebar.tapBar" data-widget-sidebar-tap-bar="" ng-controller="sidebar"><div class="content" ng-if="!$root.botInfo.isRenderBot" sidebar-list>
<div class=" sidebar.content" th-element="sidebar.content" th-element-groups="['sidebar']" ng-hide="$root.isHidden('sidebar.content')" data-th-element-name="sidebar.content"><div class="col-md-12 sidebarContentList7 sidebarContentList oUhbkSMaaqbcdvVkcC" th-element="sidebarContentList7" th-element-groups="['sidebar','sidebar.content']" ng-hide="$root.isHidden('sidebarContentList7')" data-th-element-name="sidebarContentList7" data-th-widget="sidebar.content.list" data-widget-sidebar-content-list="" ng-controller="sidebarContentList7"><ul class="nodes-list" dnd-list="display">

    <div class="header" ng-if="edition">
        <h3><strong>{{ editionName }}</strong></h3>
            </div>


    <li ng-repeat="node in display" id="{{::node.id}}-{{edition}}-{{$index}}" class="list-entry" ng-class="{active: isActive(node)}" sidebar-item="node"
        >
            <div ng-if="node.type != 'article' && node.type != 'ad'" class="resource {{ node.type }}">
                <div class="sidebar-content">{{ node.blurb }}</div>
            </div>
        <div class="sidebar-content ">
            <a ng-class="{badge1: edition}" data-badge="{{$index + 1}}" ng-if="node.type != 'ad'" ng-href="{{ ::node.url }}" ng-click="tap()" sidebar-click="node">
                <div class="sidebar-node-image" ng-if="edition"><img class="imageList" dz-image-fid-width="80" dz-image-fid="{{ ::node.imageUrl }}"></div>
                <div ng-class="{'sidebar-node-title' : edition}">{{ ::node.title }}</div>
            </a>
        </div>
    </li>
    <th-if-scroll relative-to="bottom" from="-100" to="50" callback="loadMore()"></th-if-scroll>
    <th-loader flag="loading()" />
</ul>
</div></div></div>
<span class="tap" ng-class="{tapEdition: edition}" ng-click="tap()" ng-if="!$root.botInfo.isRenderBot">
    <i class="icon-angle-double-left left"></i>
    <i class="icon-angle-double-right right"></i>
</span>
</div><div class=" componentsSlider5 componentsSlider oUhballbvbdSaoUhM" th-element="componentsSlider5" th-element-groups="[]" ng-hide="$root.isHidden('componentsSlider5')" data-th-element-name="componentsSlider5" data-th-widget="components.slider" data-widget-components-slider="" ng-controller="componentsSlider5"><!--<i class="icon-cancel" ng-click="close()"></i>-->

<div class="background" ng-class="{open: _sliderOpen}" ng-if="_ready" ng-click="close()">
</div>

<div class="slider-outer-wrapper" ng-class="{open: _sliderOpen}">
    
    <div class="row slider-inner-wrapper" ng-if="_ready">
<div class=" componentsSlider5.widgets" th-element="componentsSlider5.widgets" th-element-groups="['componentsSlider5']" ng-hide="$root.isHidden('componentsSlider5.widgets')" data-th-element-name="componentsSlider5.widgets"><div class="col-md-12 contentCommentsSlider6 contentCommentsSlider oUhbaqbcaibvnWffWVcC" th-element="contentCommentsSlider6" th-element-groups="['componentsSlider5','componentsSlider5.widgets']" ng-hide="$root.isHidden('contentCommentsSlider6')" data-th-element-name="contentCommentsSlider6" data-th-widget="content.commentsSlider" data-widget-content-comments-slider="" ng-controller="contentCommentsSlider6"><script type="text/ng-template" id="link-article-save.html">
    <div ng-class="{'icon-star gold': status.saved, 'icon-star-empty': !status.saved}" ng-click="save()" class="save"><span class="save-title">Save</span><span ng-if="status.saved" class="d-letter">d</span></div>
</script>


<div class="comment-slider-content">

    <div class="node-info">
        <div class="comment-title">
            <h1 class="parent-title">{{ parent.title || parent.header.title}}</h1>
            <!--<a ng-if="parent.title" ng-href="{{ parent.linkSource }}">-->
            <!--<i class="icon-link-2" tooltip-html-unsafe="Permalink"></i>-->
            <!--</a>  -->
            <h3 ng-if="parent.tldr"  class="tldr">{{ parent.tldr }}</h3>
            <h3 ng-if="parent.title" class="link-description" >{{ parent.linkDescription }}</h3>
            <a ng-if="parent.title" ng-href="{{parent.url}}" class="link-source">{{ parent.urlSource.name }}</a>
        </div>
    </div>
    <div class="author-n-article-info">
        <div class="author-avatar">
            <a ng-href="{{ parent.authors[0].url || parent.authorUrl }}">
                <img dz-image-fid-width="80" dz-image-fid="{{ parent.authors[0].avatar || parent.authorAvatar }}" class="avatar" width="40" />
            </a>
        </div>
        <div class="author-name">
            by <a th-popup="users.profile.mini" popup-data="{user: parent.authors[0].id || parent.authorId }" ng-href="{{ parent.authors[0].url || parent.authorUrl }}">{{ parent.authors[0].realName || parent.author}}

            <div ng-if="parent.authors[0].isMVB || parent.isMVB" class="mbv-award">
                <i class="icon-mvb-1"></i>
            </div></a>

            <div ng-if="parent.authors[0].isMVB || parent.isMVB" class="mvb-partner">
                <user-is-partner user="parent.authors[0].id" ng-if="canDelete(parent)"></user-is-partner>
            </div>

            <div class="zone-leader">
                <user-is-zone-leader user="parent.authors[0].id"></user-is-zone-leader>
            </div>

        </div>
        <div class="publish-date">
            · <span class="author-date">{{ parent.articleDate | date:'MMM. dd, yyyy' }} {{ parent.linkDate | date:'MMM. dd, yyyy' }}</span>
        </div>
        <div class="portal-link">
            · <a href="{{ parent.portal.url }}" id="portal-name" ng-cloak><span class="portal-name">{{ parent.portal.name }} Zone</span></a>
        </div>
    </div>
    <div class="user-actions">
        <div class="like action" ng-if="parent.title">
            <dz-like template="like-article.html" callback="addVoter()" node="parent" ng-if="parent.articleDate"></dz-like>
            <dz-like callback="addVoter()" callback="addVoter()" node="parent" ng-if="parent.linkDate"></dz-like>
        </div>

        <div class="like action" ng-if="!parent.title">
            <dz-like template="like-article.html" callback="addVoter()" node="parent"></dz-like>
        </div>


        <div class="save-article action"><dz-save template="link-article-save.html" node="parent" class="save"></dz-save></div>

        <div class="tweet action">
            <a ng-href="#" ng-click='shareTwitter($event, parent.title || parent.header.title,parent.linkSource || parent.url)' class="title" target="_blank"><i class="icon-twitter"></i>Tweet</a>
        </div>

        <div class="pull-right">
            <div class="view-count action">
                <i class="icon-eye"></i> {{ parent.views }} <span ng-if="!parent.title">Views</span><span ng-if="parent.title" class="action-label">Clicks</span>
            </div>

            <div class="user-n-admin-action action" ng-if="canEdit(parent) || canDelete(parent)">
                <div class="mod-tools" dropdown is-open="dropdown.open">
                    <span dropdown-toggle><i class="icon-cog"></i></span>
                    <ul class="dropdown-menu">
                        <li><a ng-href="/content/{{ parent.id }}/edit.html">Edit</a></li>
                        <li><a href="#" ng-if="canDelete(parent)" ng-click="deleteLink(parent)">Delete</a></li>
                        <li><a href="#" ng-if="canPublish && !parent.title" ng-click="toggleComments(parent)">{{ parent.isLocked ? 'Enable' : 'Disable' }} comments</a></li>
                        <li><a href="#" ng-if="canPublish && !parent.isLocked && !parent.title" ng-click="toggleLimitComments(parent)">
                            {{ parent.isLimited ? 'Remove comment limits' : 'Enable moderated comments' }}
                        </a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div th-defer-until="_sliderOpen">
        <!--<div content-comment-box parent="parent.id" count="parent.nComments" limited="parent.isLimited" class="comment-box"></div>-->
    </div>
</div>

</div></div>    </div>
</div>

</div>

    <div class="row">
        <a href="#" class="back-to-top"><i class="icon-up-big"></i></a>
    </div>



    <script type="text/ng-template" id="/themes/dz20/widgets/header/sections/widget.html">
<span dropdown is-open="dropdown.open" ng-class="{small: width < 768}">
    <span dropdown-toggle class="sections"><i class="icon-menu"></i>
        <span class="menuLabel" ng-if="width < 768"></span></span>
    <ul class="dropdown-menu ul-first" ng-style="width < 768 ? {'top': headerSize + 0 + 'px', 'padding-top': '15px'} : {}">
        <li><a href="/links">Links</a></li>
        <li><a href="/refcardz">Refcardz</a></li>
        <li><a href="/guides">Guides</a></li>
        <li><a href="/about">About Us</a></li>
        <li class="divider"></li>

        <li class="post-title"><span>Zones</span></li>
        <li ng-repeat="topic in portals" class="dropdown">
            <a ng-href="{{ topic.url }}">{{ topic.name }}</a>
        </li>
        <li class="divider"></li>
        <li class="post-title"><span>Post</span></li>
        <li><a href="/links">Link</a></li>
        <li><a href="/article/post.html">Article</a></li>
    </ul>
</span>


    </script>

<script type="text/ng-template" id="dzfollow.html"><button class="btn btn-follow" ng-class="{'btn-success': !status.followed, 'btn-warning': status.followed, 'hidden': followed.id == $root.user.id}" ng-click="follow()"><span ng-if="!status.followed"><i class="icon-plus"></i> Follow</span><span ng-if="status.followed" class="following">Following</span><span ng-if="status.followed" class="hover">Unfollow</span></button></script><script type="text/ng-template" id="dztopicselect.html"><ui-select  ng-if="canAddTopics" ng-model="editing.topics" theme="bootstrap" multiple tagging tagging-label="(add topic)"
           tagging-tokens=",">
    <ui-select-match class="input-tags"><div class="topics-tag">{{ $item }}</div></ui-select-match>
    <ui-select-choices
            refresh="topicsRefresh($select.search)"
            refresh-delay="250"
            repeat="topic in foundTopics | filter: $select.search">
        <div ng-bind-html="topic | highlight: $select.search"></div>
    </ui-select-choices>
</ui-select>
<ui-select ng-if="!canAddTopics" ng-model="editing.topics" theme="bootstrap" multiple>
    <ui-select-match><div class="topics-tag">{{ $item }}</div></ui-select-match>
    <ui-select-choices
            refresh="topicsRefresh($select.search)"
            refresh-delay="250"
            repeat="topic in foundTopics | filter: $select.search">
        <div ng-bind-html="topic | highlight: $select.search"></div>
    </ui-select-choices>
</ui-select></script><script type="text/ng-template" id="dzsave.html"><i class="icon-star-empty" ng-class="{'icon-star gold': status.saved, 'icon-star-empty': !status.saved}" tooltip-html-unsafe="{{status.saved ? 'Saved' : 'Save'}}" ng-click="save()"></i>
<!--<span ng-class="{'gold count': status.saved}">{{ status.count }}</span>--></script><script type="text/ng-template" id="dzupload.html"><span class="btn btn-upload" >
    <div ng-bind-html="label"></div>
    <div class="progress-container" ng-style="{visibility: uploading ? 'visible' : 'hidden'}">
        <progressbar max="100" value="progress"><span>{{ progress }}</span></progressbar>
    </div>
    <input type="file" ng-file-drop ng-file-select ng-file-change="upload($files)" />
</span></script><script type="text/ng-template" id="inline-editable.html"><div class="inline-editable" ng-if="!status.editing" ng-click="edit()" ng-transclude></div>
<div class="inline-editor-wrapper" ng-if="status.editing">
    <textarea class="inline-editor" ng-model="status.editValue" ng-if="type == 'textarea'"></textarea>
    <input class="inline-editor" ng-model="status.editValue" ng-if="type == 'input'"></textarea>
    <div class="inline-editor-tools">
        <button class="btn select-ok" ng-disabled="!status.editValue" ng-click="save()"><i class="icon-check-1"></i></button>
        <button class="btn select-cancel" ng-disabled="!editable" ng-click="cancel()"><i class="icon-cancel-1"></i></button>
    </div>
</div></script><script type="text/ng-template" id="dzlike.html">
<div class="dz-like " ng-class="{liked: status.liked}" ng-click="like()">
    <a href="#">
        <i class="icon-up-dir"></i>
        <span>{{ status.score }}</span>
    </a>
</div>
</script><script type="text/ng-template" id="dzphoto.html"><i class="icon-camera-alt photo" type="file" ng-file-drop ng-file-select ng-file-change="upload($files)"></i></script><script type="text/ng-template" id="followus.html">
<p>Let's be friends:</p>
<ul class="icons-only" ng-class="{open: isOpen}" click-outside="outside()">
    <li class="rss-icon" id="rss-spotlight-1">
        <a href="/pages/feeds"><i class="icon-rss-1"></i></a>
    </li>
    <li class="twitter-icon">
        <a href="https://twitter.com/DZone" target="_blank"><i class="icon-twitter"></i></a>
    </li>
    <li class="facebook-icon">
        <a href="https://www.facebook.com/DZone-259639764711" target="_blank"><i class="icon-facebook-1"></i></a>
    </li>
    <li class="google-icon">
        <a href="https://plus.google.com/+dzone/posts" target="_blank"><i class="icon-gplus"></i></a>
    </li>
    <li class="linkedin-icon">
        <a href="https://www.linkedin.com/company/dzone" target="_blank"><i class="icon-linkedin-1"></i></a>
    </li>

        <ul class="social-dropdown dropdown-menu">
            <li class="rss" id="rss-spotlight"><a href="/pages/feeds"><i class="icon-rss-squared"></i></a></li>
            <li class="twitter" id="twitter-spotlight">
                <a href="https://twitter.com/DZone" class="twitter-follow-button" data-show-count="true"
                   data-show-screen-name="false">Follow @DZone</a>
            </li>
            <li class="fb-like" id="fb-spotlight" data-href="https://www.facebook.com/DZone-259639764711/timeline/"
                data-layout="button_count" data-action="like" data-show-faces="true" data-share="false"></li>
            <li class="google-plus" id="gplus-spotlight">
                <div class="g-follow" data-annotation="bubble" data-height="20"
                     data-href="https://plus.google.com/108688665090780146602" data-rel="publisher"></div>
            </li>
            <li class="linkedin" id="linkedin-spotlight">
                <script type="IN/FollowCompany" data-id="114427" data-counter="right"></script>
            </li>
        </ul>
</ul>
</script><script type="text/ng-template" id="overlay.html"><div class="ngdialog th-overlay">
    <div class="ngdialog-overlay">
        <div class="overlay-box">
            <i class="icon-spin5 animate-spin"></i>

            <p>{{ message }}</p>
        </div>
    </div>
</div></script><script type="text/ng-template" id="dialog.confirm.html"><p>{{ message }}</p></script><script type="text/ng-template" id="dialog.skeleton.html"><div class="dialog-title">
    <h1 ng-if="$dialog.title">{{ $dialog.title }}</h1>
</div>
<div class="dialog-body {{ $dialog.extraClass }}" ng-include="$dialog.template"></div>
<div class="dialog-footer">
    <div class="dialog-buttons" ng-if="$dialog.buttons">
        <button ng-repeat="button in $dialog.buttons" ng-hide="button.hidden" ng-disabled="button.disabled || $dialog.executing"
                class="btn btn-{{ button.type || 'info' }}" ng-click="$dialog.runAction(button)">
            <span class="icon-spin6 animate-spin" ng-if="button.executing"></span>{{ button.label || button.name }}</button>
    </div>
</div></script><script type="text/ng-template" id="dialog.message.html"><div class="message-icon">
    <i class="icon-{{ icon }}"></i>
</div>
<div class="message-text">
    <p class="message-title" ng-bind-html="trustAsHtml(title)"></p>
    <p ng-bind-html="trustAsHtml(message)"></p>
</div>
</script>
<script type="text/javascript">

    var TH_CORE_VARS = {};

    try {
        TH_CORE_VARS.additional = {};

        TH_CORE_VARS.additional.model = [{"content":{"id":"830314","type":"article","plug":"diggrss-reader","creationDate":"2006-04-12 04:18:53.0"},"enableThreadedComments":true,"contentType":"article","metaData":{"title":"Digg/RSS Reader - DZone ","description":"Grabs the RSS-feed from digg.com and reads it out\r\nloud using festival.\r\n\r\n\r\n#!/bin/sh\r\n# Copyright (c) 2005 Davor Babic \r\n# All rights reserved.\r\n# Usage of...","keywords":"programming, software development, devops, java, agile, web, iot, database, mobile, big data, cloud","siteName":"dzone.com","url":"https://dzone.com","img":"https://dzone.com/themes/dz20/images/ArticleImg_5.jpg","imgprop":"og:image:secure_url","twitterImage":null,"type":"snippet","wordCount":78,"canonical":"https://dzone.com/articles/diggrss-reader","noIndex":false,"noFollow":false,"prevPage":null,"nextPage":null,"useEscapedFragment":false,"robots":false,"robotsTag":""},"articleType":"article/snippet"}];
        TH_CORE_VARS.additional.loadedStyles = [["/lib/bootstrap/bootstrap.less","/lib/fontello/css/fontello.css","/lib/fontello/css/animation.css","/lib/angular-ui/select.css","/lib/ngDialog/css/ngDialog.css","/less/ngDialog-theme.less","/less/container.less","/lib/bootstrap-switch/bootstrap-switch.css","/less/dzone20.less","/less/fonts.less","/less/directives.less","/lib/sb/sb.css","/lib/bootstrap-slider/bootstrap-slider.css","/less/layout.less","/widgets/article/content/article-content.less","/widgets/components/slider/widget.less","/widgets/content/commentsSlider/widget.less","/widgets/header/headerV2/widget.less","/widgets/sidebar/content/list/list.less","/widgets/sidebar/tapBar/sidebar-list.less","/widgets/sidebar/tapBar/widget.less"]];
        TH_CORE_VARS.additional.loadedScripts = [["/lib/jquery/jquery.js","/lib/lodash/lodash.js","/lib/moment/moment.js","/scripts/utils.js","/lib/angular/angular.js","/lib/angular/angular-sanitize.js","/lib/local-storage/angular-local-storage.js","/lib/bootstrap/dropdown.js","/lib/angular-ui/bootstrap.js","/lib/angular-ui/select.js","/lib/bootstrap-switch/bootstrap-switch.js","/lib/ngDialog/js/ngDialog.js","/lib/angular-moment/angular-moment.js","/scripts/app.js","/scripts/socket.js","/scripts/services.js","/scripts/ui-services.js","/scripts/directives.js","/scripts/filters.js","/lib/angular/angular-cookies.js","/lib/angulartics/angulartics.js","/lib/angulartics/angulartics-ga.js","/lib/angular-touch/angular-touch.min.js","/lib/elastic/elastic.js","/lib/ng-file-upload/angular-file-upload-all.js","/scripts/dzone.js","/scripts/ads.js","/scripts/social-media.js","/scripts/head.js","/scripts/links.js","/scripts/utilities/directives.js","/scripts/utilities/services.js","/scripts/utilities/editor.js","/lib/bootstrap-slider/bootstrap-slider.js","/lib/bootstrap-slider/directive.js","/lib/sb/sb.js","/lib/angular-draganddrop/draganddrop.js","/lib/flexmenu/flexmenu.min.js","/widgets/article/content/utils.js","/widgets/components/slider/service.js","/widgets/header/headerV2/resize.js","/widgets/sidebar/content/list/service.js","/widgets/sidebar/tapBar/directive.js","/widgets/sidebar/tapBar/service.js"]];
        TH_CORE_VARS.additional.botInfo = [{"isRenderBot":false}];
        TH_CORE_VARS.additional.TH_CSRF = "6503077634686621538";
        TH_CORE_VARS.additional.request = [{"site":{"id":7,"title":"DZone: Programming & DevOps news, tutorials & tools","keywords":"programming, software development, devops, java, agile, web, iot, database, mobile, big data, cloud","description":"Programming, Web Development, and DevOps news, tutorials and tools for beginners to experts. Hundreds of free publications, over 1M members, totally free.","name":"DZone.com"},"dev":false,"cdn":["dz2cdn1.dzone.com","dz2cdn2.dzone.com","dz2cdn3.dzone.com","dz2cdn4.dzone.com"],"theme":"dz20","context":"","user":{"id":2500002,"authenticated":false,"name":"Anonymous","realName":null,"avatar":"https://secure.gravatar.com/avatar/?d=identicon&r=PG","profile":"/users/2500002/anon-user.html"}}];
        TH_CORE_VARS.additional.portals = [[{"topic":8,"id":2,"shortTitle":"agile-methodology-training-tools-news","color":"red","name":"Agile","code":"agile","url":"/agile-methodology-training-tools-news"},{"topic":6129,"id":3,"shortTitle":"big-data-analytics-tutorials-tools-news","color":"green","name":"Big Data","code":"big-data","url":"/big-data-analytics-tutorials-tools-news"},{"topic":30,"id":4,"shortTitle":"cloud-computing-tutorials-tools-news","color":"orange","name":"Cloud","code":"cloud","url":"/cloud-computing-tutorials-tools-news"},{"topic":59,"id":5,"shortTitle":"database-sql-nosql-tutorials-tools-news","color":"purple","name":"Database","code":"database","url":"/database-sql-nosql-tutorials-tools-news"},{"topic":31,"id":6,"shortTitle":"devops-tutorials-tools-news","color":"yellow","name":"DevOps","code":"devops","url":"/devops-tutorials-tools-news"},{"topic":1138,"id":7,"shortTitle":"enterprise-integration-training-tools-news","color":"green","name":"Integration","code":"integration","url":"/enterprise-integration-training-tools-news"},{"topic":48,"id":8,"shortTitle":"iot-developer-tutorials-tools-news-reviews","color":"orange","name":"IoT","code":"iot","url":"/iot-developer-tutorials-tools-news-reviews"},{"topic":1,"id":1,"shortTitle":"java-jdk-development-tutorials-tools-news","color":"purple","name":"Java","code":"java","url":"/java-jdk-development-tutorials-tools-news"},{"topic":29,"id":9,"shortTitle":"mobile-app-developer-tutorials-tools-news","color":"yellow","name":"Mobile","code":"mobile","url":"/mobile-app-developer-tutorials-tools-news"},{"topic":653,"id":10,"shortTitle":"apm-tools-performance-monitoring-optimization","color":"red","name":"Performance","code":"performance","url":"/apm-tools-performance-monitoring-optimization"},{"topic":35,"id":11,"shortTitle":"web-development-programming-tutorials-tools-news","color":"orange","name":"Web Dev","code":"webdev","url":"/web-development-programming-tutorials-tools-news"}]];
        TH_CORE_VARS.additional.matchedUrl = {"name":"dzone:articles:view","mapping":"/articles/**","mappingPatterns":{}};
        TH_CORE_VARS.additional.requiresModule = ["dndLists","generalDirectives","monospaced.elastic","angularFileUpload","ui.bootstrap-slider","angulartics","angulartics.google.analytics","ngCookies","ngSanitize","ui.select","ui.bootstrap","angularMoment","ngTouch","ngDialog","LocalStorageModule"];
            } catch (e) {
        console.error(e);
    }
</script>

<script type='text/javascript'>
    var googletag = googletag || {};
    googletag.cmd = googletag.cmd || [];
    (function () {
        var gads = document.createElement('script');
        gads.async = true;
        gads.type = 'text/javascript';
        var useSSL = 'https:' == document.location.protocol;
        gads.src = (useSSL ? 'https:' : 'http:') +
                '//www.googletagservices.com/tag/js/gpt.js';
        var node = document.getElementsByTagName('script')[0];
        node.parentNode.insertBefore(gads, node);
    })();
</script>
<script type="text/javascript" src="//dz2cdn2.dzone.com/storage/pub/2263137-combined.js" charset="utf-8"></script><script type="text/javascript" src="//dz2cdn2.dzone.com/storage/pub/2263142-combined.js" charset="utf-8"></script><script>
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
        a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

    ga('create', 'UA-410289-1', 'auto');
    ga('require', 'linkid', 'linkid.js');
    ga('set', 'siteSpeedSampleRate', 25);
    //ga('send', 'pageview');
</script>


<script type="text/javascript">
    (function () {
        window._pa = window._pa || {};
        var pa = document.createElement('script');
        pa.type = 'text/javascript';
        pa.async = true;
        pa.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + "//tag.perfectaudience.com/serve/514a05817a82440002000406.js";
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(pa, s);
    })();
</script>


<script type="text/javascript">
    (function() {
            function controller($scope, TH$Dialog, $location, $rootScope, $timeout, TH$SharedVars, $service, TH$LocalStorage) {
    {
        $scope.location = $location.path();
    }

    $scope.searchT ='';

    TH$SharedVars.bind($scope, 'searchT', 'searchTerm', true)

    $scope.loginForm = function () {

        TH$Dialog.open({
            loadWidget: 'users.loginFormV2',
            size: 'loginForm'
        });
    };

    $timeout(function() {
        $(".portals").flexMenu();
    }, 0);


    $scope.isActivePortal = function (portalId) {
        return $rootScope.model.portal && $rootScope.model.portal.id == portalId;
    };

    $scope.allResults = function() {
        window.location='/search';
    }

    $("#search").keyup(function (e) {
        var length = ($scope.searchT) ? $scope.searchT.length : 0;
        $scope.searchT = ($scope.searchT) ? $scope.searchT : '';

        if(e.keyCode == 13 && length > 2) {
            $scope.allResults();
        }else {
            $scope.search();
        }
    });

    $scope.focusSearch = function(){
        $timeout(function(){$("#search").focus();},100)
    }

    $scope.search = function(){
        var length = ($scope.searchT) ? $scope.searchT.length : 0;
        $scope.loading = (length > 2);
        if(length < 3){
            if($scope.nodes || $scope.nodes == [] ){
                $timeout(function(){
                    $scope.nodes = [];
                    $scope.cType = [];
                    $scope.related = [];
                    $scope.pager = [];
                    $scope.searchParam = [];
                    $scope.totalResults = null;

                },100)
            }
            return false;
        }

        var term = $scope.searchT;
        if ($scope.prevTerm == term) {return;}
        $scope.prevTerm = term;


        TH$LocalStorage.value('searchValue', term);
        term = (term) ? term : '';
        $service.nextPage({term: term, pageSize: 7}, null, true).then(function (data) {
            $scope.loading = false;
            var curPage = 1;
            $scope.nodes = data.pages.newest[curPage];
            $scope.haveResults = ($scope.nodes) ? true : false;
            $scope.totalResults = data.totalItems;
        })
    }
}
            var WMODEL_DATA = {};
            WMODEL_DATA.applyFades = true;
        WMODEL_DATA.isAdmin = false;
        WMODEL_DATA.slot = null;
        WMODEL_DATA.user = {"jobRole":null,"website":null,"about":null,"job":null,"avatar":"https://secure.gravatar.com/avatar/?d=identicon&r=PG","country":null,"city":null,"id":2500002,"karma":10,"company":null,"realName":"$$ANON_USER$$","websiteUrl":"","tagline":null};
        WMODEL_DATA.OPTIONS = {};
        WMODEL_DATA.getPortals = null;
        TH.installWidgetController('header.headerV2', 'mainHeader', WMODEL_DATA, typeof controller == 'function' ? controller : null, [{name: 'nextPage', data: false}], ' oUhbWOfRPSwBoUhM', null);
        })();
        (function() {
            function controller($scope, $sce, $analytics, $service, SideBarService, TH$Dialog,$rootScope, TH$Location, $q, $window,
                    /**infoBarService,*/ DZtopicsString, shareThis, $location, TH$Service, DZHeadService, $timeout, ArticleAdsService) {

    var current = ($scope.articles && $scope.articles.length) ? $scope.articles[0] : null;
    var loading = null;
    var lastLoaded = current;
    var cache = {};


    $scope.width = $(window).width();

    $scope.voted = null;

    $scope.canDelete = function(article) {
        return article.canDelete;
    };

    $scope.canEdit = function(article) {
        return article.canEdit;
    };

    $scope.canPublish = function (article) {
        return article.canPublish;
    };

    $scope.loginForm = function () {

        TH$Dialog.open({
            loadWidget: 'users.loginFormV2',
            size: 'loginForm'
        });
    };

    $scope.delete= function(article) {
        TH$Dialog.confirm("Are you sure you want to permanently delete this article?").then(function() {
            TH$Service.action('delete', {type: 'node', id: article.id}).then(function() {
                TH$Dialog.success('Article deleted');
                    newArticle(article.type);
            });
        });
    };

    $scope.publish = function(article) {
        TH$Dialog.confirm("Are you sure you want to publish this article?").then(function () {
            TH$Service.action('nodes.publish', {type: 'node', id: article.id}, {}, true)
                .then(function () {
                    TH$Dialog.success('Article Published', 'Your article was successfully published');
                    article.published = true;
                }, function () {
                    TH$Dialog.error('Article not Published', 'There was an error publishing teh article');
                });
        });
    };

        $scope.shareTwitter = function($event, title, url){
            $event.preventDefault();
            $event.stopPropagation();
            var twitter = 'https://twitter.com/intent/tweet';
            var link = $location.protocol() + '://' + location.host + url;
            var ref = location.host;
            var params = '?text='+title+'&url='+link+'&ref=dzone.com&via=DZone';
            var win = window.open(twitter+params, '_blank');
            win.focus();
        }



    function newArticle(type) {
        current.article = {
            body: '',
            title: '',
            image: null,
            topics: [],
            sources: [],
            notes: '',
            published: false,
            canDelete: false
        };

        current.bodyImages = [];
        setEditUrl(null, type);
    };

    function setEditUrl(id, type) {
        TH$Location.apply(function ($location) {

            var url;

            if (id) {
                if (type == 'article') {
                    url = '/content/' + id + '/edit.html';
                } else {
                    url = '/dzone/staff/' + type + (type == 'refcard' ? 'z' : 's') + '/' + id + '/edit.html';
                }
            } else {
                if (type == 'article') {
                    url = '/content/article/post.html';
                } else if (type == 'refcard'){
                    url = '/dzone/staff/' + type + 'z' + '/add.html';
                }else{
                    url = '/content/article/post.html'
                }
            }
            $timeout(function(){
                $location.path(url);
            },1000);
        });
    };

    function setCurrentInSidebar(article) {
        var title = (article.header) ? article.header.title : article.title;
        var titleEll = (article.header) ? article.header.titleEll : article.title;
        SideBarService.active = article.title ? article : {
            id: article.id,
            type: 'article',
            title:  $scope.edition ? titleEll : title,
            url: article.url,
            imageUrl: article.articleImage
        }
    }

    if (current) {
        loadPartner(current);
        loadRichSnippetData(current);

        setCurrentInSidebar(current);
        //infoBarService.setTitle(current.header.title);
        //infoBarService.setArticle(current);

//        cache[current.id] = current;
        setMeta(current);
        current.fullHtml = $sce.trustAsHtml(current.articleContent);
    }

    function setMeta(current){
        var portal = (current.portal) ? current.portal.name : '';
        var keywords = (current.articleTags) ? current.articleTags.toString() : portal;
        var title = current.header ? current.header.title : current.title;

        if(!title){
            return;
        }

        DZHeadService.title = title+' - DZone '+portal;
        DZHeadService.description = current.metaDescription;
        DZHeadService.keywords = keywords;
        DZHeadService.url = $location.absUrl();
        DZHeadService.canonical = $location.protocol() + '://' + $location.host() + current.url;
        var imageLink = current.header ? current.header.imageLink : current.imageLink;
        var imgUrl = $location.host() + imageLink;

        DZHeadService.img = imgUrl;
        DZHeadService.type = current.articleType;
        DZHeadService.wordCount = (current.articleContent) ? current.articleContent.split(/\s+/).length : 0;
    }

    function getArticle(id) {

        if (cache[id]) {
            return $q.when(cache[id]);
        } else {
            var promise =  $service({article: id});

            promise.then(function(article) {
                article.fullHtml = $sce.trustAsHtml(article.articleContent);
            });

            return promise;
        }
    }

    function loadArticleInList(id) {
        loading = id;

        if (cache[id]) {
            $scope.articles.push(cache[id]);
            lastLoaded = cache[id];
            loading = null;
        } else {
            $scope.articles.push({type: 'loader'});

            getArticle(id)
                .then(function(article) {
                    $scope.articles.pop();
                    $scope.articles.push(article);
                    lastLoaded = article;
                    loading = null;
                    cache[article.id] = article;

                    loadPartner(article);
                    loadRichSnippetData(current);
                });
        }
    }

    $scope.imageUrlBase = $location.protocol() + "://" + $location.host();

    function loadRichSnippetData(article) {

        var rs = {
            bodyProp: 'articleBody',
            date: moment(article.articleDate).format()
        };

        switch (article.articleType) {

            case 'news':
                rs.type = 'https://schema.org/NewsArticle';
                break;
            case 'snippet':
                rs.type = 'https://schema.org/Code';
                rs.bodyProp = '';
                break;
            case 'review':
                rs.type = 'https://schema.org/Review';
                rs.bodyProp = 'reviewBody';
                break;
            case 'tutorial':
            case 'analysis':
                rs.type = 'https://schema.org/TechArticle';
                break;
            case 'opinion':
                rs.type = 'https://schema.org/BlogPosting';
                break;
            default:
                rs.type = 'https://schema.org/Article';
                break;
        }

        article.rs = rs;
    }

    var articleNumber = 1;

    function attachPartner(article, partners) {

        article.showLogo = true;

        if (!_.isNumber(partners.lastUsed)) {
            //partners.lastUsed = 0;
            toUse = partners.lastUsed
        }else{
            toUse = partners.lastUsed + 1;
        }

        if (toUse >= partners.length || !toUse) {
            toUse = 0;
        }

        if(partners){
            article.showLogo = (partners.length < 2 && articleNumber % 2) ? false : article.showLogo;
        }else{
            article.showLogo = false;
        }

        if(!articleNumber || article.partner){
            return;
        }

        article.readyForAd = true;
        article.partner = partners[toUse];
        $scope.partners.lastUsed = toUse;
        articleNumber++;
    }


    function loadPartner(article) {

        var partners = $scope.partners;

        if (!article.portalId) {
            if ($scope.portal) {
                article.portal = _.findWhere($scope.portals, {id: $scope.portal.id});
            } else {
                //_.each(article.articleTagIds, function (id) {
                //    var portal = _.findWhere($scope.portals, {topic: id});
                //
                //    if (portal) {
                //        article.portal = portal;
                //    }
                //});
            }
        } else {
            article.portal = _.findWhere($scope.portals, {id: article.portalId});
        }
        if (article.portal) {
            if (partners[article.portal.id]) {
                var _partners = partners[article.portal.id];
                _partners.lastUsed = $scope.partners.lastUsed;
                attachPartner(article, _partners);
            } else {
                $service.partners({portal: article.portal.id}).then(function(_partners) {
                    partners[article.portal.id] = _partners;
                    attachPartner(article, _partners);
                });
            }
        }

        if (article.readyForAd || article.partner) {
            article.readyForAd = true;
            return;
        }

    }

    $scope.loadMore = function() {

        if (loading) {
            return;
        }

        var next = SideBarService.findNext(lastLoaded ? lastLoaded.id : null);

        if (next) {
            loadArticleInList(next);
        }


    };

    $scope.activate = function(article) {

        if(article.type == 'loader'){
            return;
        }

        $rootScope.model.portal = article.portal
        $scope.addShareCount(article);

        //infoBarService.setnComments(article.nComments);
        //infoBarService.setArticle(article);

        if (current && article.id == current.id) {
            return;
        }

        current = article;
        setCurrentInSidebar(article);

        TH$Location.apply(function($location) {
            $location.path(article.url);
        });

        var title = article.header ? article.header.title : article.title;

        //infoBarService.setTitle(title);
        //infoBarService.setArticle(article);
        setMeta(article);
            $timeout(function(){
                if (!article.viewTracked) {
                    TH$Service.action('nodes.trackView', {type: 'node', id: article.id}, {}, true);
                    article.views++;
                    article.viewTracked = true;

                    if (window.ga) {
                        window.ga('set', 'dimension2', article.articleType ? ('article/' + article.articleType) : 'article');
                        window.ga('set', 'dimension3', moment(article.articleDate).format('YYYY-MM-DD'));
                        window.ga('set', 'dimension4', _.indexOf($scope.articles, article));
                        window.ga('set', 'dimension5', article.zonetop || 'undefined');
                        window.ga('set', 'dimension6', article.pubPlug || 'undefined');
                    }

                    $analytics.pageTrack(article.url);
                }
            },0);
    };

    $scope.toggleComments = function(article) {
        if(!article.isLocked) {
            TH$Service.action('articles.lockNode', {type: 'node', id: article.id}).then(function(result) {
                if(result){
                    article.isLocked = true;
                    TH$Dialog.success('You have disabled all comments for this Article');
                }else{
                    TH$Dialog.error('error','Your requested was denied')
                }
            });
        }else {
            TH$Service.action('articles.unlockNode', {type: 'node', id: article.id}).then(function(result) {
                if(result){
                    article.isLocked = false;
                    TH$Dialog.success('You have enabled all comments for this Article');
                }else{
                    TH$Dialog.error('error','Your requested was denied')
                }
            });
        }
    };

    $scope.toggleLimitComments = function (article) {
        if (!article.isLimited) {
            TH$Service.action('articles.limitNode', {type: 'node', id: article.id}).then(function (result) {
                if (result) {
                    article.isLimited = true;
                    TH$Dialog.success('You have limited comments for this Article. Now all comments will go through moderation.');
                } else {
                    TH$Dialog.error('error', 'Your requested was denied')
                }
            });
        } else {
            TH$Service.action('articles.unlimitNode', {type: 'node', id: article.id}).then(function (result) {
                if (result) {
                    article.isLimited = false;
                    TH$Dialog.success('You removed the limits for comments on this Article');
                } else {
                    TH$Dialog.error('error', 'Your requested was denied')
                }
            });
        }
    };

    $scope.activateT = function(article) {
        $scope.activate(article);
    };

    $scope.activateB = function(article) {
        $scope.activate(article);
    };

    SideBarService.fn.onSelected = function(node) {
        $scope.articles = [];

        loadArticleInList(node.id);

        $scope.activate(node);
        $($window).scrollTop(0);
    };

    $scope.upvoteArticle = function () {

// disabled till we decide how the vote system will work

//        if (!$scope.voted) {
//            $scope.articles[0].upvote_count += 1;
//            $scope.voted = 1;
//        }else {
//            $scope.articles[0].upvote_count -= 1;
//            $scope.voted = null;
//        }
    };

    $scope.addShareCount = function(article){
//        var socials = ['linkedin', 'reddit', 'twitter'];
//        var url = $location.protocol()+'://'+$location.host()+':'+$location.port()+article.url;
//
//        socials.map( function(item) {
//
//            if(article[item] == undefined){
//
//                article[item] = shareThis.countThis(item,url, 'content').then(function(result){
//                    article[item] = result;
//                })
//            }
//        })


    };

    $scope.share = function(socialNet, url, title){
        shareThis.shareThis(socialNet, $location.protocol()+'://'+$location.host()+':'+$location.port()+url, title);
    };

    Object.size = function(obj) {
        var size = 0, key;
        for (key in obj) {
            if (obj.hasOwnProperty(key)) size++;
        }
        return size;
    };


    $scope.share = function(socialNet, url, title){
        shareThis.shareThis(socialNet, $location.protocol()+'://'+$location.host()+':'+$location.port()+url, title);
    };

    $scope.mailShareLink = function(article) {
        var title = article.header ? article.header.title : article.title;
        var link = article.header ? article.header.link : article.link;
        return 'mailto:?subject=' + encodeURIComponent(title) +  '&body=Article: ' + encodeURIComponent('https://dzone.com/' + link);
    };

    $scope.ads = ArticleAdsService($scope.edition, $scope.width);

};


            var WMODEL_DATA = {};
            WMODEL_DATA.edition = null;
        WMODEL_DATA.articles = [{"articleImage":"/themes/dz20/images/ArticleImg_6.jpg","saveStatus":{"canSave":false,"count":0,"saved":false},"portalId":null,"viewTracked":true,"canDelete":false,"bodyProp":"","pubPlug":null,"canEdit":false,"publisher":{"logo":"https://dzone.com/themes/dz20/images/logo.png","name":"DZone"},"id":830314,"authors":[{"id":920027,"name":"davor","realName":"Davor Babic","avatar":"https://secure.gravatar.com/avatar/fffde10858ea53a68c712e85f53e029e?d=identicon&r=PG","isMVB":false,"url":"/users/920027/davor.html","tagline":null,"aboutAuthor":null}],"articleDate":1144815533000,"partner":null,"nComments":0,"published":true,"canonical":"https://dzone.com/articles/diggrss-reader","articleTypePre":"https://schema.org/Code","metaDescription":"Grabs the RSS-feed from digg.com and reads it out\r\nloud using festival.\r\n\r\n\r\n#!/bin/sh\r\n# Copyright (c) 2005 Davor Babic \r\n# All rights reserved.\r\n# Usage of...","image":"https://dzone.com/themes/dz20/images/ArticleImg_10.jpg","canPublish":false,"deleted":false,"likeStatus":{"liked":false,"score":0,"canLike":false},"zonetop":"","articleTags":[],"header":{"id":830314,"title":"Digg/RSS Reader","imageUrl":"/themes/dz20/images/ArticleImg_5.jpg","link":"/articles/diggrss-reader","imageLink":"/themes/dz20/images/ArticleImg_5.jpg","titleEll":"Digg/RSS Reader","type":"article"},"url":"/articles/diggrss-reader","isLocked":false,"draft":false,"articleContent":"","source":null,"modDate":1144815533000,"views":167,"isLimited":false,"tldr":null,"originalSource":"","articleType":"snippet"}];
        WMODEL_DATA.perms = {"canDecidePick":false,"canPublish":false};
        WMODEL_DATA.firstArticleContent = null;
        WMODEL_DATA.isPreview = false;
        WMODEL_DATA.OPTIONS = {};
        TH.installWidgetController('article.content', 'articleContent4', WMODEL_DATA, typeof controller == 'function' ? controller : null, [{name: 'partners', data: true},{name: 'DEFAULT', data: true}], ' oUhbblYOaqbcblYOaqbcC', null);
        })();
        (function() {
            function controller($scope, $service, $location, SideBarService, $timeout) {

    if ($scope.edition) {
        $scope.date = moment($scope.editionDate).utc().format('MMM DD, YYYY');
    }

    SideBarService.ctx.pageSize = $scope.pageSize;
    SideBarService.ctx.isPreview = $scope.isPreview;
    SideBarService.ctx.mode = $scope.mode;

    SideBarService.fn.loader = $service;

    var $window = $(window);

    function checkWidth() {
        var windowsize = $window.width();
        $scope.width = windowsize;
    }
    // Execute on load
    checkWidth()
    // Bind event listener
    $(window).resize(checkWidth);


    if ($scope.edition) {
        SideBarService.ctx.edition = $scope.edition;
    }

    SideBarService.fn.scrollCheck = function() {
        $scope.$emit('thIfScrollCheck');
    };

    var currentFilter;

    $scope.$on('$locationChangeSuccess', function() {

        if (!$location.search().filter) {
            $scope.filter = 'latest';
        } else {
            $scope.filter = $location.search().filter;

            if ($scope.filter == 'latest') {
                $location.search('filter', null);
            }
        }

        if (currentFilter == $scope.filter) {
            return;
        }

        currentFilter = $scope.filter;

        SideBarService.ctx.filter = $scope.filter;
    });

    $scope.display = SideBarService.getList();

    $scope.$watchCollection(function() {
        return SideBarService.getList();
    }, function (n) {
        $scope.display = n;
    });

    $scope.isActive = SideBarService.isActive;

    $scope.isExcluded = SideBarService.isExcluded;

    $scope.loadMore = SideBarService.load;

    $scope.loading = function() {
        return SideBarService.ctx.loading;
    };

    TH.on('TapBarStatusChange', function(expanded) {
        if (expanded) {
            SideBarService.unblock();
        }
    })

}
            var WMODEL_DATA = {};
            WMODEL_DATA.edition = null;
        WMODEL_DATA.editionName = "";
        WMODEL_DATA.pageSize = 20;
        WMODEL_DATA.isPreview = false;
        WMODEL_DATA.editionDate = null;
        WMODEL_DATA.OPTIONS = {};
        WMODEL_DATA.mode = null;
        TH.installWidgetController('sidebar.content.list', 'sidebarContentList7', WMODEL_DATA, typeof controller == 'function' ? controller : null, [{name: 'DEFAULT', data: true}], ' oUhbkSMaaqbcdvVkcC', null);
        })();
        (function() {
            function controller($scope) {
    var $window = $(window);

    function checkWidth() {
        var windowsize = $window.width();
        var $element = $('div.sidebar.sidebarTapBar');
        $scope.width = windowsize;
        if(windowsize <= 1024 && $scope.edition){
            $('.fixContentRight').removeClass('fixContentRight');
            $('.tap').show();
        }else if($scope.edition){
            $('.tap').hide();
            $('.mainContentRow').addClass('fixContentRight');
            $element.removeClass('tapNotExpanded');
            $element.addClass('expanded');
        }
    }
    // Execute on load
    checkWidth();
    // Bind event listener
    $(window).resize(checkWidth);
}
            var WMODEL_DATA = {};
            WMODEL_DATA.edition = null;
        WMODEL_DATA.slot = null;
        WMODEL_DATA.OPTIONS = {};
        TH.installWidgetController('sidebar.tapBar', 'sidebar', WMODEL_DATA, typeof controller == 'function' ? controller : null, null, ' oUhbkSMadabfWVcC oUhbkSMadabbWQbVkcC', null);
        })();
        (function() {
            function controller($scope,  shareThis, TH$Dialog, TH$Service, $location) {
    $scope.getEditUrl = function(id, type) {
        if (!type || type == 'article') {
            return '/content/' + id + '/edit.html';
        } else {
            return '/dzone/staff/' + type + (type == 'refcard' ? 'z' : 's') + '/' + id + '/edit.html';
        }
    };

    $scope.share = function(socialNet, url, title){
        shareThis.shareThis(socialNet, url, title);
    };

//    $scope.mailShareLink = function(article) {
//        return 'mailto:?subject=' + encodeURIComponent(article.header.title) +  '&body=Article: ' + encodeURIComponent('https://dzone.com/' + article.header.link);
//    };

    $scope.canDelete = function(article) {
        return article.canDelete;
    };

    $scope.canPublish = function(article) {
        return article.canPublish;
    };

    $scope.canEdit = function(article) {
        return article.canEdit;
    };

    $scope.toggleComments = function(article) {
        if(!article.isLocked) {
            TH$Service.action('articles.lockNode', {type: 'node', id: article.id}).then(function(result) {
                if(result){
                    article.isLocked = true;
                    TH$Dialog.success('You have disabled all comments for this Article');
                }else{
                    TH$Dialog.error('error','Your requested was denied')
                }
            });
        }else {
            TH$Service.action('articles.unlockNode', {type: 'node', id: article.id}).then(function(result) {
                if(result){
                    article.isLocked = false;
                    TH$Dialog.success('You have enabled all comments for this Article');
                }else{
                    TH$Dialog.error('error','Your requested was denied')
                }
            });
        }
    };

    $scope.toggleLimitComments = function (article) {
        if (!article.isLimited) {
            TH$Service.action('articles.limitNode', {type: 'node', id: article.id}).then(function (result) {
                if (result) {
                    article.isLimited = true;
                    TH$Dialog.success('You have limited comments for this Article. Now all comments will go through moderation.');
                } else {
                    TH$Dialog.error('error', 'Your requested was denied')
                }
            });
        } else {
            TH$Service.action('articles.unlimitNode', {type: 'node', id: article.id}).then(function (result) {
                if (result) {
                    article.isLimited = false;
                    TH$Dialog.success('You removed the limits for comments on this Article');
                } else {
                    TH$Dialog.error('error', 'Your requested was denied')
                }
            });
        }
    };

    $scope.shareTwitter = function($event, title, url){

        $event.preventDefault();
        $event.stopPropagation();
        var twitter = 'https://twitter.com/intent/tweet';
        var link = $location.protocol() + '://' + location.host + url;
        var ref = location.host;
        var params = '?text='+title+'&url='+link+'&ref=dzone.com&via=DZone';
        var win = window.open(twitter+params, '_blank');
        win.focus();
    };

    $scope.edit = function(link) {
        TH$Dialog.open({
            loadWidget: 'links.postPreview',
            widgetArgs: {
                edit: link.id
            },
            size: 'xbig'
        }).then(function (result) {
            $scope.link.title = result.title;
            $scope.link.linkDescription = result.content;
            $scope.link.thumb = result.thumb;
            $scope.link.tags = result.topics;
        });
    };

    $scope.deleteLink = function(article) {
        var title = article.title;
        var type = 'link';
        if(article.header){
            title = (article.header.type == 'article') ? article.header.title : article.title;
            type = (article.header.type == 'article') ? 'article' : 'link';
        }
        TH$Dialog.confirm('Do you want to delete "' + title + '"?').then(function() {
            return TH$Service.action('delete', {type: type, id: article.id});
        }).then(function() {
            article.deleted = true;
        });
    };
}


            var WMODEL_DATA = {};
            WMODEL_DATA.OPTIONS = {};
        TH.installWidgetController('content.commentsSlider', 'contentCommentsSlider6', WMODEL_DATA, typeof controller == 'function' ? controller : null, null, ' oUhbaqbcaibvnWffWVcC', null);
        })();
        (function() {
            
            var WMODEL_DATA = {};
            WMODEL_DATA.name = "commentsSlider";
        WMODEL_DATA.slot = null;
        WMODEL_DATA.OPTIONS = {"name":"commentsSlider"};
        TH.installWidgetController('components.slider', 'componentsSlider5', WMODEL_DATA, typeof controller == 'function' ? controller : null, null, ' oUhballbvbdSaoUhM', null);
        })();
        </script>
    <script type="text/javascript">

        TH.installWidgetDirective('portalSponsor', 'portalSponsor', {"service":{"portal":"="},"extra":null}, 'widget.html', '/widgets/portalSponsor/widget.js', [{name: 'DEFAULT', data: true}], ' oUhbnuWrlqanuWrlqaC', null, ['portalsponsor.less']);
        
        TH.installWidgetDirective('links.sources.mini', 'linksSourcesMini', {"service":{"link":"="},"extra":null}, 'widget.html', '', [{name: 'DEFAULT', data: true}], ' oUhbdhbqvRbefWfSC', null, ['mini.less']);
        
        TH.installWidgetDirective('manage.revisions', 'manageRevisions', {"service":{"node":"=","body":"=","masterTemplate":"=","format":"=","mode":"="},"extra":null}, 'widget.html', '/widgets/manage/revisions/widget.js', [{name: 'revision', data: true},{name: 'DEFAULT', data: true}], ' oUhbXYVajkgpfWVcC', null, ['widget.less']);
        
        TH.installWidgetDirective('header.zonesDropdown', 'headerZonesDropdown', {"service":{"portal":"="},"extra":{"hover":"="}}, 'widget.html', '/widgets/header/zonesDropdown/widget.js', [{name: 'DEFAULT', data: true}], '', null, null);
        
        TH.installWidgetDirective('manage.customNotifications.preview', 'manageCustomNotificationsPreview', {"service":null,"extra":null}, 'widget.html', '/widgets/manage/customNotifications/preview/widget.js', null, ' oUhbXYVMwrjrYVdgpZfnkZfnkM dLgZWBLPpWkKeXB', null, ['preview.less','/lib/froala-2/css/froala_style.min.css']);
        
        TH.installWidgetDirective('assets.mini', 'assetsMini', {"service":{"asset":"="},"extra":null}, 'widget.html', '', [{name: 'DEFAULT', data: true}], ' oUhbcgvWfSoUhM', null, ['widget.less']);
        
        TH.installWidgetDirective('users.profile.mini', 'usersProfileMini', {"service":{"user":"="},"extra":null}, 'widget.html', '/widgets/users/profile/mini/widget.js', [{name: 'DEFAULT', data: true}], ' oUhbwfbqddOeffWVcC', null, ['widget.less']);
        
        TH.installWidgetDirective('links.postV2', 'linksPostV2', {"service":null,"extra":null}, 'widget.html', '/widgets/links/postV2/widget.js', null, ' oUhbdhbnvXZqyBC', null, ['postV2.less']);
        
        TH.installWidgetDirective('links.listV2', 'linksListV2', {"service":null,"extra":null}, 'widget.ftl', '/widgets/links/listV2/widget.js', [{name: 'linkData', data: true},{name: 'list', data: true},{name: 'parseLink', data: true}], ' oUhbdhbdvXVkyBC', ['filters.js','directives.js'], ['listV2.less']);
        
        TH.installWidgetDirective('users.uiPrefs', 'usersUiPrefs', {"service":null,"extra":null}, 'widget.html', '/widgets/users/uiPrefs/widget.js', null, '', null, null);
        
        TH.installWidgetDirective('links.postPreview', 'linksPostPreview', {"service":{"url":"=","edit":"="},"extra":null}, 'widget.html', '/widgets/links/postPreview/widget.js', [{name: 'topics', data: true},{name: 'DEFAULT', data: true}], ' oUhbdhbnvqjXfoUhM', null, ['widget.less']);
        
        TH.installWidgetDirective('manage.customNotifications.test', 'manageCustomNotificationsTest', {"service":{"customNotification":"="},"extra":null}, 'widget.html', '/widgets/manage/customNotifications/test/widget.js', [{name: 'searchGroups', data: true},{name: 'searchUsers', data: true},{name: 'DEFAULT', data: true}], ' oUhbXYVMwrjrYVdgpcgcoUhM', null, ['widget.less']);
        
        TH.installWidgetDirective('header.sections', 'headerSections', {"service":null,"extra":null}, 'widget.html', '/widgets/header/sections/widget.js', null, ' oUhbWOfbRllbgfgpM', null, ['sections.less']);
        
        TH.installWidgetDirective('article.listV2', 'articleListV2', {"service":null,"extra":null}, 'widget.html', '/widgets/article/listV2/widget.js', [{name: 'list', data: true},{name: 'sortCount', data: true}], ' oUhbblYOdvXKuV_VkcC', ['directives.js'], ['article-list.less']);
        
        TH.installWidgetDirective('content.commentBox', 'contentCommentBox', {"service":{"parent":"="},"extra":{"count":"=","limited":"="}}, 'widget.html', '/widgets/content/commentBox/widget.js', [{name: 'post', data: false},{name: 'edit', data: false},{name: 'DEFAULT', data: true}], ' oUhbaqbcaibevMkaqbC', null, ['comments.less']);
        
        TH.installWidgetDirective('users.loginFormV2', 'usersLoginFormV2', {"service":null,"extra":null}, 'widget.html', '/widgets/users/loginFormV2/widget.js', null, ' oUhbwfbjZcprBjZcprBC', null, ['loginFormV2.less']);
        
        TH.installWidgetDirective('refcardz.mini', 'refcardzMini', {"service":{"asset":"="},"extra":null}, 'widget.html', '', [{name: 'DEFAULT', data: true}], ' oUhbfSbmWfSoUhM', null, ['widget.less']);
            </script>

</body>