Giter Club home page Giter Club logo

tantalum's People

Contributors

javgoret avatar kingsleyadio avatar koobo avatar mustanaamio avatar paulirotta avatar thomasbielagk avatar tiksa avatar tuokor avatar vivainio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tantalum's Issues

Caching in the file system is not supported

It would be nice to cache much larger data sets, for example on the phone's memory card.

This involves implementing FlashCache for the file system. Only a few methods, but must also handle memory card removal and recover from bad things like user tampering.

Preprocessing disabled

Currently no preprocessing is done for the source files, so the release build is identical to the debug build. We'd need to add a preprocessor into the flow, so that we can create a more compact binary release.

The problem with this is that when we moved over to create JSE-build, we also had to drop the dependency on Antenna. Antenna requires the WTK to be installed, which is not going to be possible on our build infrastructure (I think). We'd either need one of these 4 things to happen:

  1. use antenna with microemu if possible
  2. fork the latest antenna from 2010 to make the preprocessor run without WTK
  3. find another JSE-enabled preproc
  4. write one ourselves (in groovy)

I'm currently looking into 4), but since this will take a few iterations to complete, I'm going to see whether 1) or 2) would actually be faster.
3) doesn't seem to be too easy to find, based on a fierce googling session I had before

Replace UITask by parametrized Task

Since you can chain tasks, we should make tasks that are to be executed in UI thread as just Task objects, with a property that tells whether it should be executed in ui thread or background worker:

t = new Task();
t.setUseMainLoop(true);

Generics (research)

Many Android developers would be reluctant to give up to use a library that lacks generics.

Is there an elegant way to offer the best of both worlds? I've been thinking about some adaptation layer or GenericObject adaptor, but the solution is not simple and preprocessor games seem ill advised.

Refactor Workable / Task / Worker

It's not clear what the "third party" role of Workable is. If developers are not expected to implement this interface, hide it somewhere.

Add class TantalumRuntime

Rename TantalumMidlet to TantalumRuntime, do not sublclass from MIDlet.

Provide start() that is to be executed in MIDlet ctor.

cheat sheet

A 2 page PDF, front and back, showing common use patterns with //insert blah here

Rename doInBackground() to do()

doInBackground is too verbose, and can be confusing when the operation doesn't happen in the background (it can happen on UI task as well)

init() call missing from setProgram for Android

We should call init() for Android init sequence as well:

        try {
            if (Class.forName("android.app.Activity").isAssignableFrom(program.getClass())) {
                platform = PLATFORM_ANDROID;
                platformAdapter = (PlatformAdapter) Class.forName("org.tantalum.android.AndroidPlatformAdapter").newInstance();
                init(logMode); // <=== MISSING
                return;
            }
        } catch (Throwable t) {
            System.out.println("Can not init Android in setProgram(" + program.getClass().getName() + ") : " + t);
        }
        try {
            if (Class.forName("javax.microedition.midlet.MIDlet").isAssignableFrom(program.getClass())
                    || program.getClass().getName().toLowerCase().indexOf("test") > 0) {
                platform = PLATFORM_JME;
                platformAdapter = (PlatformAdapter) Class.forName("org.tantalum.jme.JMEPlatformAdapter").newInstance();
                init(logMode);
                return;
            }
        } catch (Throwable t) {
            System.out.println("Can not init JME in setProgram(" + program.getClass().getName() + ") : " + t);
        }

Put initialization in platform specific classses.

Current "setProgram()" that has switching based on platform is unnecessarily complex.

Let's put the initialization functionality to platform specific classes, which does all the platform specific stuff and then all the necessary cross platform stuff (starting workers etc)
.
It could work like this:

TanlalumJmeRuntime.start(mymidlet, numberofthreads)

or

TantalumAndroidRuntime.start(activity, numberofthreads)

The part of the app where this would be called is never cross platform anyway.

Promises (research)

"Promises" seem to be quite popular/well known already in JS-land. Explore the opportunity to have promise like API (or see whether it's redundant).

JsonGetter doesn't survive if Content-Length is missing

Trying this url, there is no Content-Length header,

http://www.sodexo.fi//ruokalistat/output/daily_json/731/1/1/2013/en?mobileRedirect=false

In HttpGetter::exec, this leads to "length" being 0, and us going to this branch:

L.i(this.getClass().getName() + " exec", "No response. Stream is null, or length is 0");

Instead of:

            } else {
                bos = new ByteArrayOutputStream(16384);
                readBytesVariableLength(inputStream, bos);
                out = bos.toByteArray();
            }

Network capture below:

GET /ruokalistat/output/daily_json/731/1/1/2013/en?mobileRedirect=false HTTP/1.1
User-Agent: ***
Host: www.sodexo.fi
Connection: Keep-Alive
Accept-Encoding: gzip

HTTP/1.1 200 OK
Server: nginx/1.0.11
Date: Fri, 19 Apr 2013 06:35:54 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.3.8
X-Drupal-Cache: MISS
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Fri, 19 Apr 2013 06:35:54 +0000
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
ETag: "1366353354"
Set-Cookie: SESSee97dcf51c4e7f072056872f1ea10323=TNNdXst9Gv6iTXOWLbGzooI13tCzSLijWwl_ZewOzCc; expires=Sun, 12-May-2013 10:09:14 GMT; path=/; domain=.sodexo.fi; HttpOnly

90
{"meta":{"generated_timestamp":1366353354,"requested_timestamp":false,"ref_url":"http:\/\/www.sodexo.fi\/node\/","ref_title":null},"courses":[]}
0

Streaming get / post

Instead of dealing with byte[] in ram, we should allow POST/GET to/from stream directly.

interface StreamWriter {
   void writeReady(OutputStream out);
}

interface StreamReader {
   void readReady(InputStream in);
}


HttpPoster p; ...
p.setStreamWriter(new StreamWriter() {
  ... write directly to socket instead of going through intermediate byte[] buffer...
});

HttpGetter g;
g.setStreamReader(...)

Agree on "full name" of project

You find instances of "Tantalum mobile toolkit", "Tantalum mobile" etc.

We need an agreed "fully qualified name" to use in documentation, presentation etc.

"Tantalum mobile"

"Tantalum mobile toolkit"

"Tantalum Java library"

"Tantalum cross platform toolkit"

"Tantalum cross platform mobile framework"

etc. etc.

Personally no strong preference (yet), but let's pick one and be consistent.

"App with Tantalum" minimal example

We need a minimal "tantalum app" that does nothing but initializes Tantalum with TantalumRuntime, has minimal LCDUI Form and logs "hello world" with L.i().

Purpose is to convert it to SDK template

Continuous integration for Tantalum

Hi!

Part of the reason of originally moving the build over to Gradle was to enable us to have a repeatable build, and more importantly, CI for the project. JME has proved to be the tricky part, as none of the open providers seem to support JME/WTK-builds. The situation has not improved with the latest releases, which only run on Windows. We could trick the process to work (I've been able to build using Windows jars on my OS X) but I think we'd break several EULAs and would most probably get no support for setting this up.

In order to tackle the problem, we've talked with Paul to have the core library be built in standard Java, and only the platform specific builds require special frameworks and tools to build. This would also make the test setup a lot less intimidating, as we no longer need to have separate test projects to make it work. I've worked on this in the 'java_se_build'-branch, and finally got it working now. The results can be seen here:
https://travis-ci.org/TantalumMobile/Tantalum/

Travis supports a lot of nice things, so it will e.g. build all new pull requests so that they can automatically be discarded would there be any problem with them. Travis also builds all the pushed branches, so there is no need for any extra config for that part.

The problem at the moment is that the only branch that actually supports CI-builds is the java_se-branch, as the other ones will fail due to missing Java ME-installation. My suggestion would be to verify that this branch works as expected also with the WTK-build, and then merge it in to master as soon as possible. Until we do so, most of the builds in Travis will be failed.

Please have a look, and let me know what you think. If we find it useful, I will write down some more details about this in the Wiki.

JSONModel.move()

Add "move" method to JSONModel that retuns JSONObject currently contained in it, and sets JSONObject to null within the model

CI for Tantalum

@vivainio, @paulirotta
One of the promises of using Gradle for building Tantalum was that we would have a repeatable build, and also be able to have a CI for the project. Unfortunately I've found no OSS CI providers that would support JME/WTK-builds out-of-the-box, and now that the new WTK:s are only running on Windows, it's not very likely they will in the future either.

In order to make this happen, I've experimented with building TantalumCore in Standard Edition context, and including it as a library in the JME/Android builds. My branch 'java_se_build' is pushed, and seems to pass all tests, but I have yet to test it on a JME-device. However, since it is SE, I have now been able to enable CI for TantalumCore on this branch over here:

https://travis-ci.org/TantalumMobile/Tantalum

Currently Travis builds all branches, and also all pull requests, but the only builds that will actually succeed are the ones on the java_se-branch, as it's the only one that has the required config (a .travis.yml-file in the root). Also, since all the other builds depend on WTK, they will not work properly even if this config is added. There are some caveats, which I'm not sure we'll be able to fix, but let's see.

  1. Only TantalumCore is built now. TantalumJME would require either stubbing of JME-classes, or some other magic to happen
  2. Only the Tantalum-enabled branches will currently succeed in building.
  3. We currently don't have a way to pull the artifacts of the CI-machine, so e.g. findbugs- or cobertura. reports would have to be generated locally. This should be fixable, though (http://about.travis-ci.org/blog/2012-12-18-travis-artifacts/)

Could you please have a look at this, and give me comments on it. We naturally still need to verify that everything works as expected, but I would hope we could merge this to master as soon as we've dealt with any issues we might have.

Geocoder examples need to be updated

There are two examples of a simple JSON service that converts a text string into latitude and longitude.

Some updates are needed:

  • Google changed the API. I started to update it, but got lost in JSON and Google API fiddle, did not have time to Finish. Either parse the right fields from google or replace with a different simple JSON service.
  • The apps were created quickly, live in a training, using Netbeans drag-and-drop UI. Combining both apps into a simple Eclipse-friendly Form UI would be much more clear for "this is how easy JSON is, result1 is parsed but gets from sever every time, result2 is not parsed so you get the cached result if you have previous searched for this address"

If time permits, it is nice to demonstract in this app the offline AJAX-style live update from cache as you type. Each key press in the Form input field can trigger a StaticWebCache.getAsync(currentTextFieldText.trim(), StaticWebCache.GET_LOCAL) which updates the field with any cached values which match, before you click a SEARCH button. PicasaViewer has a more complex version of this on a Canvas UI, but Form is more accessible.

Blackberry port

Kingsley is looking to fork and create the BB port. Not for the T5 release but probably T6.

Let him know if you can help.

Fix Linux build

Can't build the project on Linux, probably due to older SDK version (latest ones not available for Windows). .jar file names are probably different (didn't check).

Error (on "gradle build") is

* What went wrong:
Could not resolve all dependencies for configuration ':Examples:testRuntime'.
> Could not find wtk:midp_2.1:.
  Required by:
      Tantalum:Examples:unspecified
> Could not find wtk:cldc_1.1:.
  Required by:
      Tantalum:Examples:unspecified
> Could not find wtk:jsr172_1.0:.
  Required by:
      Tantalum:Examples:unspecified
> Could not find wtk:jsr177_1.0:.
  Required by:
      Tantalum:Examples:unspecified
> Could not find wtk:jsr280_1.0:.
  Required by:
      Tantalum:Examples:unspecified

In WTK lib dir:

ville@ville-tp:~/WTK/lib$ pwd
/home/ville/WTK/lib
ville@ville-tp:~/WTK/lib$ ls
checkbox_off.png      date_up.png            jsr082.jar  jsr239.jar           popup_scrolldown.png  soundbank.dls
checkbox_on.png       defaultFont.svg        jsr179.jar  jsr75.jar            popup_scrollup.png    system.config
cldcapi10.jar         gauge_leftarrow.png    jsr180.jar  link_horizontal.png  radio_off.png         ticker_border.png
cldcapi11.jar         gauge_rightarrow.png   jsr184.jar  link_vertical.png    radio_on.png          trustedmidlet_icon.png
continuous_strip.png  incremental_strip.png  jsr211.jar  midpapi10.jar        satsa-apdu.jar        trusted_prompt.png
crlf_bw.png           initialFont.svg        jsr226.jar  midpapi20.jar        satsa-crypto.jar      untrusted_prompt.png
date_down.png         internal.config        jsr229.jar  midpapi21.jar        satsa-jcrmi.jar       wma11.jar
date_left.png         j2me-ws.jar            jsr234.jar  mmapi.jar            satsa-pki.jar         wma20.jar
date_right.png        j2me-xmlrpc.jar        jsr238.jar  popup_arrow.png      security_query.png

USB debug is difficult to setup

Kingsley Adio is reporting problems with USB debug not starting reliably on some phones.

I'll refactor that initialization of this setup (where your phone is connected by USB cable and dumps error logs to a terminal window) for speed, easier start and reliability.

PENDING can replace several states

Simpler standard FP nomenclature for a future / promise
Less state transitions good for speed
Associated changes to fork priority state continue to check at point of error so the developer is warned with clear exceptions of attempts to multi-fork-chain

Study: Explicit LWUIT support

Right now LWUIT is treated as a special case of JME in PlatformUtils, but as a result some functionality does not work out of the box. Most notable is creating a StaticWebCache of com.sun.lwuit.Image objects.

If LWUIT-JME and LWUIT-Android were promoted as "platforms" we can make some of the JME support like StringUtils work out of the box for LWUIT developers.

For example StringUtils and LWUITImageTypeHandler are currently copy-paste and modified in TantalumeLWUITBBCReaderExample were moved into the library. Each LWUIT developer creating an Image cache would need to either find or re-invent these changes. There may be a LWUIT replacement for StringUtils- not sure.

LWUIT has own Font and Image classes that hide the JME Font and Image. There may be other touch points, these are the ones I'm aware of.

Build env: eclipse

Allow running with standard eclipse.

Approach; add "apply plugin: 'eclipse'" in root build.gradle.

Run "gradle eclipse".

In eclipse, import the directory as "existing project". You should now have something you can build and run.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.