⚾ All "BasesLoaded" = an extension for a variety of base encodings

### There appears to be a problem when trying to compile an app
### with this extension. I am looking into a fix for this.

A simple enough extension prompted by a suggestion by @Peter :wink:

This extension provides for text encoding to Base32, Base45, Base58 ,Base64 and Base85.

Blocks and Usage

AIX
v1
uk.co.metricrat.basesloaded.aix (11.3 KB)
v2
uk.co.metricrat.basesloadedv2.aix (15.8 KB)

Credits
@shreyash for guidance and for RUSH
To all the code writers on github who provided java files to make this happen :wink:

https://github.com/ehn-dcc-development/base45-java
https://gist.github.com/vrotaru/1753908
https://github.com/fzakaria/ascii85

Versions
v1 - Base32, Base45, Base58 and Base64
v2 - Base32, Base45, Base58, Base64 and Base85

Available for use in any MIT AppInventor projects or competitions

#####################################################################
This work by TIMAI2 is licensed under a
Creative Commons Attribution-ShareAlike 4.0 Unported License with attribution.
Please use name = TIMAI2 and link to this source page when giving credit.
#####################################################################

20 Likes

I feel like a trick was missed here with a "All your base are belong to us" reference.

6 Likes

Only because I am out of touch, and never played Zero Wing, my misspent years weren't in the 90's :wink:

image

Also no emoji for Zero Wing :wink:

7 Likes

image

shouldn't this be a base45string?

4 Likes

Well spotted! Yes it should.

3 Likes

Image of blocks and aix corrected :+1:

5 Likes

Great Work.

4 Likes

Nice work!!

FWIW, there's also a Base 85 which will give a slightly more compact representation than base 64:

2 Likes

Base85 encode and decode added with v2 :smiley:

3 Likes

Epic work :star_struck::clap:

1 Like

it compiled just fine :grin:, i just deleted the .rush directory and rebuilt the extension

My guess is there is something in one of the additional "base" java files when used.

:question:

It might compile OK, but when used there may be problems.

I found this:

image

Short lambda expressions:

long zCount = chars.chars().filter(c -> c == 'z').count();

I also checked that you had not enabled Java 11 support that Rush offered.
Also these werent supported until recently when AppInventor upgraded their systems, so it should work fine from now.

To be more on a safer side, just replace

long zCount = chars.chars().filter(c -> c == 'z').count();

with

        long zCount = 0;
        for (char c : chars.toCharArray()) {
            if (c == 'z') {
                zCount++;
            }
        }

and simply compile again after deleting .rush directory

I will have a play with it at some point, also need to add base 91, which is lurking in a separate extension of mine. Thanks for taking the time to look things over.