Welcome!

Machine Learning Authors: Pat Romanski, Liz McMillan, Yeshim Deniz, Elizabeth White, Zakia Bouachraoui

Related Topics: Machine Learning , Java IoT

Machine Learning : Article

How To Write an RSS Reader in AJAX

IBM Developers work has a tutorial on how to build an RSS reader using AJAX

From Yakov Fain's Blog

IBM Developers work has a tutorial on how to build an RSS reader using AJAX.  The amount of code you need to write is scary (and this is not the complete code). Adobe Flex 2 plus a simple Java programming to support DB interaction allows you to achive the same functionality using A LOT LESS coding.Just  take a look at this screen:

The Flex 2 code  below populates the bottom portion of the screen with financial news based on the selected stock on top ( (it does not work with a DB to store the RSS source so it'd add some 50 lines of  Java code ). The data come from the Yahoo! Finance RSS feed. The URL looks as follows: http://finance.yahoo.com/rss/headline?s=MSFT
The suffix can be MSFT or whatever is selected on top is being passed to the code below.  
Flex <mx:HTTPService> object is used through  a proxy deployed under Tomcat or any other servlet container.
The entire application code and its description can be found in this article.

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"
    title="News" width="100%" height="100%"     >
    <mx:DataGrid id="newsGrid" width="100%" height="100%"
        dataProvider="{newsFeed.lastResult.channel.item}"  variableRowHeight="true">
      <mx:columns>
            <mx:DataGridColumn headerText="Date"  dataField="pubDate" width="200"/>
            <mx:DataGridColumn headerText="Title"  dataField="title"   wordWrap="true" />
            <mx:DataGridColumn headerText="Description"  dataField="description"  wordWrap="true"   />
            <mx:DataGridColumn headerText="Link"   width="130">
                <mx:itemRenderer>
                    <mx:Component>
                        <mx:LinkButton label="{data.link}"   click="navigateToURL(new URLRequest(data.link), '_blank')"/>
                    </mx:Component>
                </mx:itemRenderer>
            </mx:DataGridColumn>
      </mx:columns>
    </mx:DataGrid>
         
    <mx:HTTPService id="newsFeed" useProxy="true"  
         destination="YahooFinancialNews"     concurrency="last"
        resultFormat="e4x" fault="onFault(event)"  >
    </mx:HTTPService>
   
    <mx:Script>
        <![CDATA[
            import mx.utils.ObjectProxy;
            import mx.rpc.events.*;
            public function set security(value:String):void {
                this.title = "News: " + value;
                newsFeed.send({s:value});
            }

            private function onFault(event:FaultEvent):void {
                mx.controls.Alert.show
                (
                   "Destination:" + event.currentTarget.destination + "\n" +
                   "Fault code:" + event.fault.faultCode + "\n" +
                   "Detail:" + event.fault.faultDetail, "News feed failure"
                );
            }
        ]]>
    </mx:Script>
</mx:Panel>

More Stories By Yakov Fain

Yakov Fain is a Java Champion and a co-founder of the IT consultancy Farata Systems and the product company SuranceBay. He wrote a thousand blogs (http://yakovfain.com) and several books about software development. Yakov authored and co-authored such books as "Angular 2 Development with TypeScript", "Java 24-Hour Trainer", and "Enterprise Web Development". His Twitter tag is @yfain

Comments (10)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


CloudEXPO Stories
Every organization is facing their own Digital Transformation as they attempt to stay ahead of the competition, or worse, just keep up. Each new opportunity, whether embracing machine learning, IoT, or a cloud migration, seems to bring new development, deployment, and management models. The results are more diverse and federated computing models than any time in our history.
On-premise or off, you have powerful tools available to maximize the value of your infrastructure and you demand more visibility and operational control. Fortunately, data center management tools keep a vigil on memory contestation, power, thermal consumption, server health, and utilization, allowing better control no matter your cloud's shape. In this session, learn how Intel software tools enable real-time monitoring and precise management to lower operational costs and optimize infrastructure for today even as you're forecasting for tomorrow.
"Calligo is a cloud service provider with data privacy at the heart of what we do. We are a typical Infrastructure as a Service cloud provider but it's been designed around data privacy," explained Julian Box, CEO and co-founder of Calligo, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Isomorphic Software is the global leader in high-end, web-based business applications. We develop, market, and support the SmartClient & Smart GWT HTML5/Ajax platform, combining the productivity and performance of traditional desktop software with the simplicity and reach of the open web. With staff in 10 timezones, Isomorphic provides a global network of services related to our technology, with offerings ranging from turnkey application development to SLA-backed enterprise support. Leading global enterprises use Isomorphic technology to reduce costs and improve productivity, developing & deploying sophisticated business applications with unprecedented ease and simplicity.
While a hybrid cloud can ease that transition, designing and deploy that hybrid cloud still offers challenges for organizations concerned about lack of available cloud skillsets within their organization. Managed service providers offer a unique opportunity to fill those gaps and get organizations of all sizes on a hybrid cloud that meets their comfort level, while delivering enhanced benefits for cost, efficiency, agility, mobility, and elasticity.