Welcome!

Machine Learning Authors: Liz McMillan, Janakiram MSV, Roger Strukhoff, Yeshim Deniz, Pat Romanski

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
Cloud-Native thinking and Serverless Computing are now the norm in financial services, manufacturing, telco, healthcare, transportation, energy, media, entertainment, retail and other consumer industries, as well as the public sector. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long development cycles that produce software that is obsolete at launch. DevOps may be disruptive, but it is essential. DevOpsSUMMIT at CloudEXPO expands the DevOps community, enable a wide sharing of knowledge, and educate delegates and technology providers alike.
In a recent survey, Sumo Logic surveyed 1,500 customers who employ cloud services such as Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP). According to the survey, a quarter of the respondents have already deployed Docker containers and nearly as many (23 percent) are employing the AWS Lambda serverless computing framework. It's clear: serverless is here to stay. The adoption does come with some needed changes, within both application development and operations. That means serverless is also changing the way we leverage public clouds. Truth-be-told, many enterprise IT shops were so happy to get out of the management of physical servers within a data center that many limitations of the existing public IaaS clouds were forgiven. However, now that we've lived a few years with public IaaS clouds, developers and CloudOps pros are giving a huge thumbs down to the...
Kubernetes is an open source system for automating deployment, scaling, and management of containerized applications. Kubernetes was originally built by Google, leveraging years of experience with managing container workloads, and is now a Cloud Native Compute Foundation (CNCF) project. Kubernetes has been widely adopted by the community, supported on all major public and private cloud providers, and is gaining rapid adoption in enterprises. However, Kubernetes may seem intimidating and complex to learn. This is because Kubernetes is more of a toolset than a ready solution. Hence it’s essential to know when and how to apply the appropriate Kubernetes constructs.
To enable their developers, ensure SLAs and increase IT efficiency, Enterprise IT is moving towards a unified, centralized approach for managing their hybrid infrastructure. As if the journey to the cloud - private and public - was not difficult enough, the need to support modern technologies such as Containers and Serverless applications further complicates matters. This talk covers key patterns and lessons learned from large organizations for architecting your hybrid cloud in a way that: Supports self-service, "public cloud" experience for your developers that's consistent across any infrastructure. Gives Ops peace of mind with automated management of DR, scaling, provisioning, deployments, etc.
xMatters helps enterprises prevent, manage and resolve IT incidents. xMatters industry-leading Service Availability platform prevents IT issues from becoming big business problems. Large enterprises, small workgroups, and innovative DevOps teams rely on its proactive issue resolution service to maintain operational visibility and control in today's highly-fragmented IT environment. xMatters provides toolchain integrations to hundreds of IT management, security and DevOps tools. xMatters is the primary Service Availability platform trusted by leading global companies and innovative challengers including BMC Software, Credit Suisse, Danske Bank, DXC technology, Experian, Intuit, NVIDIA, Sony Network Interactive, ViaSat and Vodafone. xMatters is headquartered in San Ramon, California and has offices worldwide.