RSS

Category Archives: HyperNext Android

9 How To: RSS and News Feeds

RSS is a term that encompasses a number of web feed formats used in the publication of frequently updated works such as information on news-related sites, blogs, forum posts. Articles can contain both text and links to media such as images, movies etc.

What does RSS actually stand for? – there are several expansions of the term RSS such as Really Simple Syndication, Rich Site Summary etc. Here some descriptions of RSS:-

RSS Explained:-
http://www.whatisrss.com/

Wikipedia RSS
http://en.wikipedia.org/wiki/RSS

.
The most commonly used formats are RSS followed by Atom. HAC can process both these formats plus some custom formats as well. It can also process sources from either a URL or a text file. Usually the term RSS is generic and refers to RSS plus Atom and custom formats.
.
With HAC, users do not have to specify the format because HAC tries to be flexible and process as much of each article as possible. For each article it is asked to keep, it saves every field it can parse, and also saves their field names. This allows the programmer/user to decide which fields to use. Fields are created by HAC in the order in which they were found.

Apps handling news feeds need some protection because RSS feeds can potentially be huge and any attempt to download/process the entire feed could cause a memory exception in the app. Therefore HAC allows feeds to be interrogated for their size and has options to process a specified range of articles. For instance, if there were 1000 articles in the source, then the user might like to just look at articles in the range 100 to 150 without downloading/parsing the entire source.
.
.
Example Feeds
Here are some example feeds used in testing the HAC RSS example project.

Atom feed
http://blog.case.edu/news/feed.atom

HAC Forums RSS:-
http://www.tigabyte.com/forum/index.php?action=.xml;type=rss

BBC News Feed:-
http://feeds.bbci.co.uk/news/world/middle_east/rss.xml

Global Sport feed:-
http://globoesporte.globo.com/dynamo/futebol/times/vasco/rss2.xml
.
.
Reading Feeds
There are 3 steps in using RSS

  1. Get feed from URL or a file.
  2. Parse the feed for articles.
  3. Examine or display articles.

The format of articles is explained below.

.

Feeds and Articles

Feeds are comprised from a number of articles and each article can have several named fields although there can be more than one field with the same name. The situation can be more complex though as some sources use custom formats where fields have sub fields etc. Custom formats are more complex to parse and HAC RSS parsing currently doesn’t support them as its parser just looks for top level elements/fields.

The list below shows comparative field names for RSS and Atom although there is nothing to stop sources having their own unique field names:

.
.

EXAMPLE: Creating an RSS Reader

Here we will show you the scripts behind a basic RSS reader that can work with the formats: RSS, Atom and some custom ones. As mentioned above there are 3 stages to reading an RSS feed although HAC combines both the fetch and parse stages into one function. Note, for clarity, it does not show any error checking.

a) Open and Parse Feed

To parse an RSS source use the RssParseSourceFN function. This function returns a count of the number of articles found although if an error occurred it returns -1. It automatically stores any retrieved articles and their field names so later they can be processed or displayed. Note, for app safety, a maximum article limit must be specified so for instance if the feed contained a million articles then your app could limit itself to just 100 articles. There is also a start value that enables a number of articles to be skipped.

The code below shows how to parse an RSS feed:-

@ --- Reads BBC news source ---
Local mode,source,start,max

@ read from URL so set mode = 2 (=1 for file)
PUT 2 INTO mode

@ Set URL
PUT 'http://feeds.bbci.co.uk/news/world/middle_east/rss.xml' INTO source

@ Set limits
PUT 1 INTO start
PUT 100 INTO max

@ Retrieve and parse source
PUT RssParseSourceFN(mode,source,start,max) INTO field 1

@ Display article count found
PUT RssArticleCountFN INTO field 2

.
It you just want to count how many articles are in the source then use the RssParseCountFN function. This parses the source but does not store any articles. Again, for safety it requires the maximum number of articles to parse. The example below shows how to do this.

@ --- Reads BBC news source ---
Local mode,source,max

@ read from URL so set mode = 2 (=1 for file)
PUT 2 INTO mode

@ Set URL
PUT 'http://feeds.bbci.co.uk/news/world/middle_east/rss.xml' INTO source

@ Set limits
PUT 10000 INTO max

@ Parse and count source
PUT RssParseCountFN(mode,source,max) INTO field 1

.

b) Accessing Retrieved Articles

Once the articles are retrieved to memory then they can be processed and displayed. The RssArticleCountFN returns the number of articles previously retrieved and can be used to loop over the articles.

Each article has a number of named fields such as AUTHOR, CATEGORY, DESCRIPTION etc. There is no restriction though on uniqueness of the field names so for example an article might have several fields named DESCRIPTION. Furthermore, articles within the same feed can have different numbers of fields and different field names. The number of field names and a list of their names can be retrieved using the functions RssFieldCountFN and RssFieldNamesFN respectively. Note, all field names are forced to uppercase. There is also a function called RssFieldListFN that returns in list form the name of every field found in the source.
.
The script below shows how to retrieve the contents of a known named field called DESCRIPTION from article number 5.

@ --- Display DESCRIPTION field of article 5 ---

PUT RssFieldByNameFN(5,'DESCRIPTION') INTO field 1

.
.

The script below shows how to loop over all of the fields in article 5.

@ --- Displays article 5 ---
Local aid,count,f

@ set article number
PUT 5 INTO aid

@ how many fields
PUT RssFieldCountFN(aid) INTO count

@ Loop over all fields and place into text field 1
Clear field 1
FOR f=1 TO count
   PUT RssFieldByNumberFN(aid,f) AFTER field 1
ENDFOR

.
.
c) Tidying Up

Once you have finished using the retrieved articles it is a good idea to clean up and free the memory they occupied, especially if hundreds or more articles were retrieved. The RssClear command frees memory used for storing all article headers, fields and articles themselves.

@ --- Clear memory used by RSS ---

RssClear

.
.

.
Summary
This article shows how to create a very simple RSS reader using HAC and briefly looks at a few of its RSS commands/functions. For more details see the project link below.

With HAC an RSS app can:

  1. Read RSS, Atom and some custom formats.
  2. Read from either a URL feed or a text file.
  3. Limit the number of articles parsed
  4. Skip articles and retrieve just a range.

For more information about creating RSS apps with HAC, look at HAC’s built-in help or its HAC Help pdf.

There is an RSS project and its built app on our examples web page http://www.hypernextandroid.com/hnfiles/rescreator.html The project example is only test bed that demonstrates HAC’s RSS functionality.

.

Members of HAC forums can download the latest trial version of HAC, see details here:- http://www.hypernextandroid.com/hnfiles/downloads.html

 

HAC v1.16 with RSS news reading

HAC v1.16 released for Windows (2nd November 2012 )

This update adds parsing of News Feeds(RSS), transparent fields plus better debugging during HAC startup. There are also some memory usage improvements and some minor bug fixes.

The News Feed functionality supports both RSS and Atom formats. It also allows feeds from both URLs and files to be parsed. It can cope with huge feeds and allows the user to skip unwanted articles and just store the sequence they need.

The HAC startup debugging makes it much easier for users with installation problems to find out where the problem is.

For further details see the release notes accompanying HAC and the posts listed in our forums.

HAC apps can run on Android OS API 1.6 up to the latest 4.1 (Jelly Bean).

For further details see the release notes accompanying HAC and the posts listed in our forums

http://www.tigabyte.com/forum/index.php?topic=202.0

Thank you again to our forum users and others for submitting such valuable feedback.

 

Android Apps – No Coding Development?

For anyone wanting to create their own Android app, the options can seem bewildering. Options range from so called No-Coding app makers to the standard Google Android Java approach.

Most of us tend to pick the easiest options, and this can be fine for many tasks. However when creating software it is usually  best to consider the options because they can have long term implications. Choosing the wrong option can waste both your time and your money.

There are basically two quite different approaches to creating Android apps:-

  1. For those comfortable with programming – Eclipse Java and the Android SDK.
  2. For those new to programming – No-Coding Template based app makers.

HAC is in the middle ground as it offers an easy to understand coding language and visual designer.

There are also tools like App Inventor that make programming easy with their coloured blocks/segments although they are harder to use for larger projects.
.

Code – just instructions

Code is just a list of instructions that tells the computer how to carry out a task.

There is no need to fear coding and if one follows some basic steps then the coding will be easier.

So if you try to break the task into smaller pieces it can be easier to design and create the code.

Perhaps the reason so many people try the No-Coding approach is because the Java approach and its Object Orientated aspects has a tough learning curve. HAC tries to make coding easier as each HAC English-like instruction executes a number of often complex Java instructions so hiding much of the complexity from the coder.
.

No-Coding Approach

The No-Coding aproach is very attractive and can produce some impressive looking apps.

Such app makers work by allowing the creator to select a template for a particular task and then personalise or tune the template to their needs. Usually the template changes are mainly to do with their appearance and content but not with functionality. Changing functionality generally needs code changes.

To make an app that way is very simple. Select the template, modify the template and click the build app button. The built app will then be emailed to you after 10 minutes or will be available to download.

However, what about unsupported functionality? For instance, suppose the template can do a task once but you need it to do the task several times and each time process the data before displaying it. In this case you would need to learn some HTML/Javascript. Unfortunately HTML/Javascript are both limited in the functionality they can provide and have limitations in updating displays and handling user feedback. This might not be a problem for your app but its wise to check the web site’s forum posts to see how they implement the functions your app will need.

If you intend to charge money for your app then you might try to deter piracy by some kind of registration scheme using name/address and a serial number. If you are lucky then the app maker might provide this functionality otherwise you will need to code your own scheme.
.

Where is the Code?

Generally, the code will reside on their No-Coding web server and will be innaccessible inside the template. Although any custom code you made such as HTML and Javascript could be saved onto your own computer.

Being able to see the code can be important if you want to understand how it works, improve it or sell it to someone else.

Of course, if you are happy with the standard template then the issue of code does not arise
.

Who Owns Your App?

The issue of who actually owns your app and its code can be very important.

Ownership of the app can be a grey area as some No-Coding sites say you are only granted non-exclusive rights to your creation. They explain that this is because of the way their template works inside the app’s runtime engine and that the templates are used by others.

There is also the issue of will the app look like your app. That is, will it display you as creator or will it display the No-Coding website’s name.

If you want to own your app then make sure you read their agreement and are happy with it.
.

Subscription Issues

With traditional fixed term licensed software, when the license expires the software keeps on working but cannot be updated. Therefore the owner can keep on developing their apps.

With a No-Coding app maker, what happens when your Subscription expires? Is your app locked or can you still access it, see its details or export it? Also will you still be able to modify or rebuild your app?

Is there a limit of how many apps you can make with the subscription or are there extra charges?

Its worthwhile reading their FAQ to see what the subscription offers.
.

HAC Advantages

Although No-Coding app makers can produce some excellent results they are limited by the number of available templates. With time they will get even better as more templates and functionality are added. However, if you need something special and their template system doesn’t support it, then generally you will have to learn HTML/Javascript and incorporate it into the template.

Comparing HAC to No-Coding app makers:-

  1. Your HAC license lasts forever – no subscriptions.
  2. Security, as your projects and code are stored on your own computer.
  3. Having your own source code puts you in control.
  4. Code is infinitely more flexible than template systems.
  5. To make money, you probably need unique ideas – not templates.

In summary, check out what the No-Coding maker offers and you might find that they offer just what you need.

Bear in mind that HAC doesn’t offer full Android functionality so No-Coding could be the route to go.

Finally, don’t be afraid of coding – its just telling a computer how to carry out a task.

 

HAC v1.15 with Database Support

HAC v1.15 released for Windows (24th August 2012 )

This update adds SQLite database support, status bar notifications, fullscreen mode, AES cypher, Base 64, Toast Message and some further boolean/conversion functions. There are also memory performance improvements and some bug fixes.

The SQLite database functions can work either with database files on an app’s internal protected file space or on the external SD card.

HAC apps can run on Android OS API 1.6 up to the latest 4.1 (Jelly Bean).

For further details see the release notes accompanying HAC and the posts listed in our forums

http://www.tigabyte.com/forum/index.php?topic=190.0

Thank you to our forum users and others for submitting such valuable feedback.

 

HAC v1.14 with UDP Messaging

HAC v1.14 released for Windows (25th May 2012 )

This update adds UDP messaging plus improvements and bug fixes.

UDP messaging is an easy to use communications protocol that is ideal for messaging between apps in local networks such as in schools and businesses. It allows fast communications and can also interact with hardware that supports the UDP protocol.

For further details see the release notes accompanying HAC and the posts listed in our forums

http://www.tigabyte.com/forum/index.php

Thank you to our forum users and others for submitting such valuable feedback.

 
 

HAC Prize Draw

HAC Prize Draw(14th Nov 20011 )

FIVE full versions of HAC to be won!

Enter our Prize Draw and win one of FIVE full versions of HAC.

Just fill in our simple questionnaire about HAC and our website.

Our competition starts Monday 14th November and lasts for 7 days.

Only forums members can enter our Prize Draw:

http://www.tigabyte.com/forum/index.php

 

HAC v1.07 for Presentation Type Apps

This update adds several card commands that are useful for creating presentation type apps such as our Solar System example project whose Android tablet screen shot is shown below. Users navigate the app by touching the planetary objects which then opens a card displaying information about that object. This touch navigation  is implemented by invisible canvases overlaying the card image and is a much simpler method than storing and comparing hot spot coordinates.

Solar System screen shot

HAC v1.07 also has improvements to card loading, canvases and file handling.

For a list of improvements and bug fixes see the release notes accompanying HAC and the posts listed in our forums.

Thank you to our forum users and others for submitting such valuable feedback.

 

HyperNext Android is Launched !

The Tigabyte Team are on a high ! Today, we launched HyperNext Android, the culmination of many tears, much sweat and an ounce or two of gray matter. A big thanks to all those whom participated in the release and an even bigger thanks to our supporters whom have waited patiently for the big day.

What this space for updates…

 
 

Device Roundup

HTC G1 Dream

The HTC G1 Dream is a smart-phone running OS1.6 with a 320×480 capacitive screen and a physical keyboard. Testing on a device with a physical keyboard is a must because the emulator’s soft keyboard has some problems and sometimes getting the soft keyboard out of the Chinese mode when doing API calls to it can be very awkward. Also the G1 is a good test of orientation handling as when its physical keyboard is flipped out an orientation change to landscape is signalled by the OS. Note, G1’s generally don’t come with an SD-Card and one must be fitted for HAC apps to run on it.

HTC Hero

The HTC Hero is a smart-phone very similar to the H1 except it runs OS2.1update 1 and has no external keyboard. It also has a 320×480 capacitive screen and more RAM at 288MB compared to 192MB on the G1 . Both the G1 and Hero use a 528MHz processor.

HiPad IMX515

The HiPad IMX515 is a tablet usually running OS 2.1 although it can be upgraded to OS2.2. It has a 800×600 resistive screen, 512MB RAM and an 800MHz processor. USB seemed to run well on OS 2.1, but after updating to OS 2.2 our USB no longer works reliably necessitating the use of wireless ADB debugging.

EPAD 10

The EPAD 10″ Wireless tablet uses OS2.2 and has 1024×600 resistive screen. It use a 1GHz processor and has 512MB RAM. For input it can use an external USB keyboard and mouse. Ours has problems with USB debugging as apparently there are no USB drivers for it yet, but wireless debugging is very reliable.

Debugging and ADB Connectivity

For the Android developer the main issue is of getting one’s apps to run under ADB on the device so they can be debugged by the debugger. Unfortunately, many devices have poor or non-existant USB debugging so for them the only option is to use wireless debugging and for this some of them must be rooted (either fully or partially).

Both HTC devices have excellent USB debugging, although they lack wireless. On the other hand, our two tablets have poor or non-existant USB debugging, but wireless debugging works very well for them.

Conclusions

If you are serious about the quality of your app then you need to test on at least one Android device. Which device you need depends upon the functionality of your software. Our G1 has serious problems playing most media, but is great for many other things, including testing keyboard functionality. Our tablets have large screen areas and can show how your app will scale up from a smart-phone screen. As our tablets use newer Android OS they are more likely to play the media you need and also offer greater OS functionality. All our Android devices are budget buys from eBay, but once you start developing on an Android device then the emulators seem very slow and archaic even though they are still a must for testing purposes.

If you could only afford one device then a tablet covers most options as in HAC you can set your card/screen size to say 320×480 and use the unscaled option that employs absolute pixels so the card appears as smart-phone size. HAC also has fit option to scale proportionally your card so it appears in the centre of the screen. The last display option is stretch, which fills the entire screen. The distortion can be unsightly, however.

There is a lot to consider when buying an Android device but hopefully this very short blog might help when you look for that bargain on eBay or you hit the high street.

 

Tags: , , , ,

Developing Apps on Android Devices

Work on HAC is progressing nicely and its being tested on both Emulators and Android devices. To make sure it works and gives us no unpleasant surprises we currently test builds on four different Android devices with more coming soon.
We chose a variety of devices running versions of Android from 1.6 to 2.2 although for OS 2.3 and later we currently just use the emulator. Official Android statistics show that few people are now using devices operating OS 2.1 and lower but we found on eBay that there are still many people buying smart-phones such as the G1 which uses OS 1.6. These older smart-phones are still an excellent way to start out developing your Android apps even though they miss out on later functionality like media playing.

It is really essential to use at least one Android hardware device because the emulators although excellent do have their problems notably very slow with some graphics/media and awkward with keyboards.

 

Device Roundup

The HTC G1 Dream is a smart-phone running OS1.6 with a 320×480 capacitive screen and a physical keyboard. Testing on a device with a physical keyboard is a must because the emulator’s soft keyboard has some problems and sometimes getting the soft keyboard out of the Chinese mode when doing API calls to it can be very awkward. Also the G1 is a good test of orientation handling as when its physical keyboard is flipped out an orientation change to landscape is signalled by the OS. Note, G1’s generally don’t come with an SD-Card and one must be fitted for HAC apps to run on it.

The HTC Hero is a smart-phone very similar to the H1 except it runs OS2.1update 1 and has no external keyboard. It also has a 320×480 capacitive screen and more RAM at 288MB compared to 192MB on the G1 . Both the G1 and Hero use a 528MHz processor.

The HiPad IMX515 is a tablet usually running OS 2.1 although it can be upgraded to OS2.2. It has a 800×600 resistive screen, 512MB RAM and an 800MHz processor. USB seemed to run well on OS 2.1 but after updating to OS 2.2 our USB no longer works reliably necessitating the use of wireless ADB debugging.

The EPAD 10″ Wireless tablet uses OS2.2 and has 1024×600 resistive screen. Its use a 1GHz processor and has 512MB RAM. For input it can use an external USB keyboard and mouse. Ours has problems with USB debugging as apparently there are no USB drivers for it yet but wireless debugging is very reliable.

 

Debugging and ADB Connectivity

For the Android developer the main issue is of getting one’s apps to run under ADB on the device so they can be debugged by the debugger. Unfortunately many devices have poor or non-existent USB debugging so for them the only option is to use wireless debugging and for this some of them must be rooted(either fully or partially).

Both HTC devices have excellent USB debugging although no wireless. On the other hand our two tablets have poor or non-existent USB debugging but wireless debugging works very well for them.

 

Conclusions

If you are serious about the quality of your app then you need to test on at least one Android device. Which device you need depends upon the functionality of your software. Our G1 has serious problems playing most media but is great for many other things including testing keyboard functionality. Our tablets have large screen areas and can show how your app will scale up from a smart-phone screen. As our tablets use newer Android OS they are more likely to play the media you need and also offer greater OS functionality. All our Android devices are budget buys from eBay but once you start developing on an Android device then the emulators seem very slow and archaic even though they are still a must for testing purposes.

If you could only afford one device then a tablet covers most options as in HAC you can set your card/screen size to say 320×480 and use the unscaled option that employs absolute pixels so the card appears as smart-phone size. HAC also has fit option to scale proportionally your card and have it appear in the centre of the screen. The last display option is stretch which fills the entire screen but the distortion can be unsightly.