Windows November Crapware Update

Tis the season to extort the public for new PC hardware. And the November windows preview is in on the act. Prepare for a memory management exception and a boot loop where media will be required. It definitely is not undoing the changes.

Now to decide what to run coming up to Christmas. Maybe Linux has a few less bribable bibbuble feature additions. You may think this is harsh, but disambiguation of alpha release and preview release is not to be confused at such an “experienced” software organisation.

The user blame game under fitness for “operating” system purpose and provision of sub par malware (which even goes PXE boot without asking for some random jump to code one presumably thinks), M$ has software crap or IME bull.

X16 Millfork Progress

So the basic plot and tile map arrangements are made. Next up is the “open and parse” BMP file from where the currently emulated virtual SD Card will be. This will then allow me to get on with some simple graphics, a compressed large map format and joystick motion of a sprite around the map.

I’m now used to the syntax enough to go for a generic file open routine, and deal with any PETSCII encoding problems. I’ll have to check to see if I can get a list of the directory today. And yes it seems like device 1 is the device to use. The fact that cbm_file library is currently buggy is maybe based on the advice in the programmer’s handbook to use 255 as the auxilliary command, but who knows? It does seem like OPEN <X>, 1, <W(1)/R(0)> is the one, but then the close call crashes as the open failed. The read likely returns a fail code but “works” without a device error.

Millfork and the emulator are now upgraded, and I must try to see what the fixes are, as some breaking changes have been made. Still waiting on the role out of the VSCode plugin update and might have to manual install it from source. Still good for helping with the build and test though. It’s fun although a little frustration when off spec features are yet to be done.

Commander X16

A nice Commodore 64 almost compatible with extensions. Better graphics modes with 128kB of video memory, 512kB of paged system memory, 40kB of main memory, a good emulator, 8 channel FM sound and an FPGA graphics solution.

Good 6502 development tools are available and the ROMs are open source. You can buy nice USB keyboards to help support the project. The 8-bit guy does many YouTube videos on classic microcomputer technology. He has good support of the retro community and if it were not for a design constraint of using as much off the shelf older parts then it would be a single chip thing. But part of it is the hands on experience, as the emulator on a Raspberry Pi would work.

The physical hardware is still under construction. As an 8-bit system without an accelerator it is suitable for new code or conversions of old. The main goal is to prevent scrap by the off shelf requirements and make an easier to code for machine than the Pi. One person can understand it all given time.

I’m doing a factor analysis of the hardware docs now to check how I’d use it. I think a scan limited 512 by 448 graphics 4 bits per pixel mode is one I could use for games and other software development. I’m sure a nice palate of colour can be made for the index and offset constraints of the graphics.

It has 16 hardware sprites and more of the system is becoming finalized. The sound was recently tested and works after sorting out some 8MHz timing issues. Some IO is still in design but it is looking good.

Here’s a community site.

As far as tools to look into Millfork, cc65 and the open repositories such as the VSCode plugin are on my list. It’s all looking quite nice. Getting the directory prepared and a suitable subdirectory for the development of a great library and demo template is going to be handy. It can be kind of a clone of the emulator binary directory as this is where the default loading and saving takes place for the emulator.

This will also keep the emulator relevant for the demo, and updates will be easier to not have to fix things without a schedule as could happen if the “latest” emulator was the default. This also manages postponement of “ROM changes” sufficient for not getting sucked into regression or editing other source and having to wait for pull requests to be merged.

The CTRL+SHIFT+P combination for the VSCode command palette gets access to build commands for millfork with the right configuration. This onlt has to be done for the project once, and a blank main.mfk makes a blank main.prg and so it kind of is setup for further progress. Putting all the right things in the git repo helps to keep the path statement unmodified. The settings are enough to get started.

Here is where I intend to put my development tools and first developments as they become what they become. The low memory and low speed of the system makes for some interesting challenge of design and implementation approximations that will be full of creative potential. Nice!

Happy coding.

UPDATE 2019-10-30: Going quite well. The Millfork works well, and after some errors (simple if you know what the compiler is trying to do), mainly obvious for people who have done assembly. It does indicate that context parsing is done after a dead code tree. The next up is likely a bit of colour in the font, and some file loading of a bitmap.

A New Paper on Computation and Application

https://www.amazon.co.uk/Pipeline-Cache-Big-RISC-Computational-ebook/dp/B07XY9RSHH/ref=sr_1_1?keywords=pipeline+cache+big+risc&qid=1568807888&sr=8-1 is a nice paper on some computation issues, and eventually covers some politics and vitamin biochemistry. Not a fan? Still letting your biome let you shout at the bad people not feeding your hunger?

Shovel in the gammon all you want, and load it up with chips as a little survivor from ancient times takes advantage of the modern high carb diet and digs a hole for you.

Mainly Bio this Week

Facinating stuff. Excellent vitamin B1 experience. I think something in my mind speaks in an abstract way, and the “normal” part is left to decide it as best when minus the paranoic instafill that would be necessary to help immediately. It’s really visual. A fast set of about 4 images per second.

Ok, Thiamine B1 and cod liver oil confirmed ok for intelligent fat people to regain composure.

If you don’t understand the sophisticated dry sense of humour in the use of the word intelligent, then perhaps you need a redose of the catalyst essential to human life that is known as B1. The malty desire and the addition to white carbs explain a lot. Do you vomit on too much beer these days? If you don’t you likely need to cut back on the malty flavour, and just add the very specific B1 in large 100mg amounts per day to your system until you reach the point of having enough and I understand the reaction is to vomit.

There we go, tiny starving japanese amounts of firelighter, as we wouldn’t want to extinguish the slim people with a reasonable dose. This victamin B1 could be considered to have quite a dark side.

It’s so important that an active transport mechanism picks it up fast in the illium, and alcohol does switch this off to a large extent if consumed at the same time, leading to high desire for the malty stuff, and some would say over amounts of some of the more toxic B vitamins. Some would say people shovel carbs to get B1 which frankly is added to staple carbs.

I did find my appitite for carbs drop significantly and my energy increased as ketosis and kinase action became easy again. I would say to be careful if you’ve been a hungering for B1 for a while as all manor of things switch on, and the dose of 100mg is about a week of Jap start, and not full on fatty full replacement.

So on to sulphur catalyst volcanic chemistry. As one of the few ways the body has of getting sulphur in an organic context vitamin B1 is very special. The other two known ways of obtaining organically relevant sulphur are through methionine and cystine amino acids. These are the other major sulphurs. As the body can make cystine from methionine it is not too critical, but performs the ancient critical function of structural sulphur to sulphur bonding in nails and hair and, and, and …

Methionine is maybe not needed in many protiens in large amount (although it theoretically could, but seems to be a newer addition to protein synthesis), but does form a protein rate expression regulator because it is a mRNA transcription initiator. Thus the amount does control to a good extent the speed of protien synthesis. B cell proliferation for example for antibody production. The biochemistry of the gut can make both these essentials (B1 and methionine) given sufficent organic sulphur precursors and an eggy fart smell is some unwanted bacteria making sulphides of the gas when the precious sulphur is needed. This phase is when the gas emissions start triggering problems for the local Treg cell population, and so the antibody arms are released.

Such sulphur should not be wasted as it prevents the efficient creation of B1 and methionine to absorb. The egg farts disappear and on to the sulphur system things go. You should experience a small apparent decrease in energy at this point, but some of that is due to up regulation of control on to newly freed cerebellum actions.

The transketolase test should perhaps be replaced with a white cell centrefuge and mass spec or NMR (odd? or context spin coupling?) sulphur test.

The possibility that part of the Mediterranean diet benefit is volcano eruption fall, in making the sulphur B vitamins is an interesting one, and needs some correlation data to sub region levels and not just whole countries for better matching. An involved process needing some extended geo data.

So a germ that eats B1? To induce carb consumption, which reduces the saladie goodness, which induces other deficiency and general ill health. Perhaps with a B12 deficiency later, a slim down and chronic.

Large B1 100mg dose to give them something to feed on, and go flat out eating it beyond their “insulin” (or whatever) threshold, and I suppose they excreeted too much hydrogen sulphide for that antibody attack and the cell content “unathorized sulphur chemistry” room clearing experience. I have more B1 in me but yet just the one fart happened on day five (iirc). You might forget the day but unlikely the experience.

Snoooozzzzzzzze

Sounds like a plan. Seems some playing with Caustic 3 android app is also needed. The tiredness which is not tiredness, more of a motor function initialisation deficit. Maybe I’ll get inspired on how to do things today. Maybe some beer. The knot keeps of South American Indians and amino acid chains? I think today has a parallels feel to it.

I suppose a visit to the shops would also generate things to go with this chicken. Which might be nice later. Does it have electrolytes? Maybe some more biochemistry videos and the facinating origins of how tryptophan came to be coded by a stop codon, and speculation on the recruitment of an extra essential amino acid.

Calculus

I don’t always get it wrong.

So it becomes a determined process to integrate. And as the two forms of integration closure are known, the process can be extended as any integration has closed form if the series converge. Integration by parts to a series. So why? The end points can have good integral estimates, and many in-between values of the function do not need evaluation. Series acceleration should be enough. Imagine an integral from zero to (m to power a times n to power b) which equals m times n. If for some a not equal b, the factor of m or n becomes obvious? The calculation would be log of the upper limit in polytime, not linear.

The previous page was:

Think about the f+c as integral of f plus a rectangle making f always positive when offset by c to give defined sign and hence binary search opportunity.

It wasn’t specifically developed to crack public key things, and the motivation was for simplified solutions to differential equations. Anyone who’s done DE solving knows the problem with them. That problem is integration and closing it to be algorithmic is a useful thing. That kind of leaves the Lambert W kind of collection of variables problem for real analytical DEs. Good.

It also sets a complexity limit on integration in terms of an analytic function and series of differential orders. The try a power series multiplied by ln x is seen as good advice, but lacking. Hypergeometric series can be reseen as useful to approach the series of this closure. It maybe helpful to decompose these closures into more fundamental sums of new special operators. And do some cancellation. If you find yourself pedantic about dx or plus C, then might I suggest you forget it and blunder on.

N-IDE Java on Android Fire 7

It looks so simple and efficient. I think git is missing but a simple Total Commander copy into a backed-up directory should be fine for now. It has the basics of Java SE and even can build android GUI apps. I think I’ll keep things console for now and put together some tools to do things I would like to do.

Seems to run a static main just fine. I wonder how it does with arm system libraries and JNI native calls. I don’t think I’ll use much of that, but it might get useful at some point. The code interface is ok, it’s quite lightweight and so does not fill the storage too much. Quite good for a simple editor with code completion and a simple class creation tool. Should do the job.

I think the most irritation will be the need to insert the method names to then do the top-down coding. Kind of obvious, as you can’t autocomplete an identifier without it being typed in the class anyway. But that’s ok as I’d be defining an expected class “interface” anyhow, and I’m not prone to worry too much about as yet unimplemented methods.

ES-64 Architecture (Open Hardware)

I’ve been looking into a native 64 bit architecture design of late ES-64 for the future of 64 as a default. The boot into 32 and 16 is history but frequently done. Trying to flip some design ideas on the head is one thing, but a central build repository is so easy these days. Easier than the VHDL. The aim is eventual code, but at the moment it’s a spreadsheet in PDF format, and an allocation space. Enjoy if you want to sell your hairdryer to the zero share landfill or paid recycling dedopter point.

The initial instruction set looks good for general coding and I decided to at the outset make a large number of opcodes be no operation, giving a certain way to expand to 32 and 48 bit opcodes. It’s inspired by the 68k but has a more RISCy feel. Most addressing modes were sacrificed to allow general operations on Word, Long and Quad as well as Float and Double. Bytes were not considered much apart from some Unicode helper instructions. The machine is word addressed.

A large part of the opcode space was opened up by sensible ideas about stability of certain operations on the PC. So a 20 register machine results with a lot of free opcode space, and a lot of reserved prefixes for things like vectors. A software model for simulation is likely before any VHDL.

The main focus on code density to open data cache bandwidth means some aspects of RISC have to be ignored. A memory to memory model is used instead of a load store model. This can be more dense for things like one off data loads, as the load and indirect are done in the same instruction without the extra bits in code. Quick literals are limited to 5 bits and come with a built in operation. This reduces register requirements and with general width operations 64 bit registers can easily split into 2 times 32 bit register halves or 4 times 16 bit register quarters. Most code will fit well, perhaps as 16 bit threaded code with a few virtual memory pages multimapped for common subroutines and a springboard for 32 and 64 bit subroutines.

The code generator might be more complex with bucket 64k assignment and routine factorization, but that is a task a machine can do well. There are reasonably efficient methods of code factoring to reduce binary size.

Amiga on Fire on Playstore

The latest thing to try. A Cleanto Amiga Forever OS 3.1 install to SD card in the Amazon Fire 7. Is it the way to get a low power portable development system? Put an OS on an SD and save main memory? An efficient OS from times of sub 20 MHz, and 50 MB hard drives.

Is it relevant in the PC age? Yes. All the source code in Pascal or C can be shuffled to PC, and I might even develop some binary prototype apps. Maybe a simple web engine is a good thing to develop. With the low CSS bull and AROS open development for x86 architecture becoming better at making for a good VM sandbox experience with main browsing on a sub flavour of bloat OS 2020. A browser, a router and an Amiga.

Uae4arm is the emulation app available from the Playstore. I’m looking forward to some Aminet greatness. Some mildly irritated coding in free Pascal with objects these days, and a full GCC build chain. Even a licenced set of games will shrink the Android entertainment bloat. A bargain rush for the technical. Don’t worry you ST users, it’s a chance to dream.

Lazarus lives. Or at least Borglaz the great is as it was. Don’t expect to be developing video realtime code or supercomputer forecasts. I hear there is even a python. I wonder if there is some other nice things. GCC and a little GUI redo? It’s not about making replacements for Android apps, more a less bloat but a full do OS with enough test and utility grunt to make. I wonder how pas2js is. There is also AMOS 2.0 to turn AMOS source into nice web apps. It’s not as silly as it seems.

Retro minimalism is more power in the hands of code designers. A bit of flange and boilerplate later and it’s a consumer product option with some character.

So it needs about a 100 MB hard disk file located not on the SD as it needs write access, and some changes of disk later and a boot of a clean install is done. Add the downloads folder as a disk and alter the mouse speed for the plugged in OTG keyboard. Excellent. I’ve got more space and speed than I did in the early 90s and 128 MB of Zorro RAM. Still an AGA A1200 but with a 68040 on its fastest setting.

I’ve a plan to install free Pascal and GCC along with some other tools to take the ultra portable Amiga on the move. The night light on the little keyboard will be good for midnight use. Having a media player in the background will be fun and browser downloads should be easy to load.

I’ve installed total commander on the Android side to help with moving files about. The installed BSD socket library would allow running an old Mosaic browser, or AWeb but both are not really suited to any dynamic content. They would be fast though. In practice Chrome and a download mount is more realistic. It’s time to go Aminet fishing.

It turns out that is is possible to put hard files on the SD card, but they must be placed in the Android app data directory and made by the app for correct permissions. So a 512 MB disk was made for better use of larger development versions. This is good for the Pascal 3.1.1 version.

Onwards to install a good editor such as Black’s Editor and of course LHA and some other goodies such as NewIcons. I’ll delete the LCL alpha units from Pascal as these will not be used by me. I might even get into ARexx or some of the wonderfull things on those CD images from Meeting Pearls or a cover disk archive.

Update: For some reason the SD card hard disk image becomes read locked. The insistent gremlins of the demands of time value money. So it’s 100 MB and a few libraries short of C. Meanwhile Java N-IDE is churning out class files, PipedInputStream has the buffer to stop PipedOutputStream waffling on, filling up memory. Hecl the language is to be hooked into the CLI I’m throwing together. Then some data time streams and some algorithms. I think the interesting bit today was the idea of stream variables. No strings, a minimum would be a stream.

So after building a CLI and adding in some nice commands, maybe even JOGL as the Android graphics? You know the 32 and 64 bit restrictions (both) on the play store though. I wonder if both are pre-built as much of the regular Android development cycle is filled with crap. Flutter looks good, but for mobile CLI tools with some style of bitmap 80’s, it’s just a little too formulaic.

Ideas in AI

It’s been a few weeks and I’ve been writing a document on AI and AGI which is currently internal and selective distributed. There is definitely a lot to try out including new network arrangements or layer types, and a fundamental insight of the Category Space Theorem and how it relates to training sets for categorization or classification AIs.

Basically, the category space is normally created to have only one network loss function option to minimise on backpropagation. It can be engineered so this is not true, and training data does not compete so much in a zero-sum game between categories. There is also some information context for an optimal order in categorization when using non-exact storage structures.

Book Published in Electronic Format. Advanced Content not Beginner Level. Second Edition may Need a Glossary.

The book is now live at £3 on Amazon in Kindle format.

It’s a small book, with some bad typesetting, but getting information out is more important for a first edition. Feedback and sales are the best way for me to decide if and what to put in a second edition. It may be low on mathematical equations but does need an in-depth understanding of neural networks, and some computer science.

AI as a Service

The product development starts soon, from the initials done over the last few weeks. An AI which has the aim of being more performant per unit cost. This is to be done by adding in “special functional units” optimized for effects that are better done by these instead of a pure neural network.

So apart from mildly funny AaaS selling jokes, this is a serious project initiative. The initial tests when available will compare the resources used to achieve a level of functional equivalence. In this regard, I am not expecting superlative leaps forward, although this would be nice, but gains in the general trend to AI for specific tasks to start.

By extending the already available sources (quite a few) with flexible licences, the building of easy to use AI with some modifications and perhaps extensions to open standards such as ONNX, and onto maybe VHDL FPGA and maybe ASIC.

Simon Jackson, Director.

Pat. Pending: GB1905300.8, GB1905339.6

Early Spring Euthenasiasm

Snooze, Ooh look a bird, and a squirrel, the blossom too. Pretty soon all the capitalistic psychos will fill up the parks again. How exciting, and the EU seems to be an ongoing thing or not. The magic of cheap labour and offshore accounting. Whooo, hooo!

Beer, that’s what’s needed. Maybe coffee.

Tomorrow’s Knowledge Base


import 'dart:math';
import 'dart:convert';
import 'package:flutter/material.dart';//flutter part too

part 'kwidgets.dart';

class PseudoRandom {
  int _a;
  int _c;
  int _m = 1 << 32;
  int _s;
  int _i;

  PseudoRandom([int prod = 1664525, int add = 1013904223]) {
    _a = prod;
    _c = add;
    _s = Random().nextInt(_m) * 2 + 1;//odd
    next();// a fast round
    _i = _a.modInverse(_m);//4276115653 as inverse of 1664525
  }

  int next() {
    return _s = (_a * _s + _c) % _m;
  }

  int prev() {
    return _s = (_s - _c) * _i % _m;
  }
}

class _RingNick {
  //alternate strategy of using least and most and lower window
  static bool alt = true;
  static double biasPlus = 0.125;//gen better figure
  final List<double> walls = [ 0.25 - biasPlus, 0.5, 0.75 + biasPlus ];
  int _position = 0;
  final int mostEscaped = alt ? 0 : 1;//the lowest pair of walls 0.25 and 0.5
  final int leastEscaped = 2;//the highest walls 0.5 and 0.75
  final int theThird = alt ? 1 : 0;//the 0.75 and 0.25 walls
  bool _right = true;
  static final PseudoRandom _pr = PseudoRandom();

  int _getPosition() => _position;

  int _asMod(int pos) {
    return pos % walls.length;
  }

  void _setPosition(int pos) {
    _position = _asMod(pos);
  }

  void _next() {
    int direction = _right ? 0 : walls.length - 1;//truncate to 2
    double wall = walls[_asMod(_getPosition() + direction)];
    if(_pr.next() > (wall * _pr._m).toInt()) {
      //jumped
      _setPosition(_position + (_right ? 1 : walls.length - 1));
    } else {
      //not jumped
      _right = !_right;//bounce
    }
  }

  void _prev() {
    int direction = !_right ? 0 : walls.length - 1;//truncate to 2
    double wall = walls[_asMod(_getPosition() + direction)];
    if(_pr._s > (wall * _pr._m).toInt()) {// the jump over before sync
      //jumped
      _setPosition(_position + (!_right ? 1 : walls.length - 1));
    } else {
      //not jumped
      _right = !_right;//bounce -- double bounce and scale before sync
    }
    _pr.prev();//exact inverse
  }

  void __next(bool skip) {
    _next();
    if(!skip) while(_getPosition() == mostEscaped) _next();
  }

  void __prev(bool skip) {
    _prev();
    if(!skip) while(_getPosition() == mostEscaped) _prev();
  }
}

class _GroupHandler {//yes, something goes here
  List<_RingNick> _rn;
  final int _window = 5;
  final int _opportunity = 1;
  final int _favouriteBit = 1 << 27;
  final bool _hypothesisA = true;//mutual information between wall states
  final bool _hypothesisB = true;//mutual information between wall states
  final bool _hypothesisC = true;//no spread required
  final bool _hypothesisD = true;//right bit is better for bias
  //Hypothesis D is perhaps the most interesting one.
  //There was an experiment with 128 walls at one point with the assumption
  //that the higher walls to the right would be more reflective and hence
  //the ring would move left more often.
  //The experiment proved this wrong with central limit statistics after 2 and a bit days ...
  //The explanation was the more "containy" right hand side held the climber
  //closer to the right edge, with an occasional fast zip through the left hand
  //side. The net bias was for rightward motion in the "current code framework"
  //The number 55 was not pulled from thin air, but was the worst case odd "consensus"
  //size of ring nicks.
  //The walls being lower on the left edges of cells was not providing the correct
  //direction of bias in motion.

  _GroupHandler(int size) {
    if(size % 2 == 0) size++;
    _rn = List<_RingNick>(size);
  }

  //BIAS
  //REMAIN (w1 * w2)^N
  //LEAVE (1-w1) + w1 * (1-w2) ...
  //even the switching on the fly of alt?
  //The matrix joke about mining humans as Maxwell demons was quite funny

  //the effect of a _mod1 and its 'right' interaction with the lowest wall?
  //in the most contained, which wall is higher?
  //in the least contained, which?
  //so a more likely turns into ?

  void _next() {
    for(int i = 0; i < _window; i++) {//null bias settling window
      if(!_hypothesisC) if(i == _opportunity) {//1 pre (so 4 of 5)
        for (_RingNick r in _rn) {
          _RingNick._pr.next();
          if((_RingNick._pr._s & _favouriteBit) != 0) {
            //kind of an xor spread to 50:50 cell
            _mod1(r, true);
          }
        }
      }
      for (_RingNick r in _rn)
        r.__next(_hypothesisD);
    }
  }

  void _prev() {
    for(int i = 0; i < _window; i++) {
      for(_RingNick r in _rn.reversed)
        r.__prev(_hypothesisD);
      if(!_hypothesisC) if(i == _window - _opportunity - 1) {//3 post (so 4 of 5)
        for(_RingNick r in _rn.reversed) {
          if((_RingNick._pr._s & _favouriteBit) != 0) {
            _mod1(r, false);
          }
          _RingNick._pr.prev();
        }
      }
    }
  }

  bool _majority() {
    int count = 0;
    for(_RingNick r in _rn) {
      if(_hypothesisD) {
        if(r._right) count++;
      } else {
        if (r._getPosition() == r.leastEscaped) count++; //a main cumulative
      }
    }// the > 2/3rd state would be true
    return (2 * count > _rn.length);
  }

  void _mod1(_RingNick r, bool direction) {
    //if(_hypothesis) r._right = !r._right;// a wall reflection hypothesis!
    //either both are the same or one is worse than the other (non-linear)
    //a more likely turns into ?
    //engineering differential probabilities
    if(_hypothesisD) {
      r._right = !r._right;//basic direction of motion flip
    } else {
      if (r._getPosition() == r.leastEscaped) {
        r._setPosition(r.theThird);
        if ((_hypothesisA ^ direction) || (_hypothesisB ^ !direction))
          r._right = !r._right;
      } else {
        //mostEscaped eliminated by not being used
        r._setPosition(r.leastEscaped);
        if ((_hypothesisB ^ direction) || (_hypothesisA ^ !direction))
          r._right = !r._right;
      }
    }
  }

  void _modulate(bool direction) {
    for(_RingNick r in _rn) _mod1(r, direction);//all modulate
  }
}

class _Modulator {
  final _GroupHandler _gh = _GroupHandler(_RingNick.alt ? 33 : 55);

  int _putBit(bool bitToAbsorb) {//returns absorption status
    _gh._next();
    if(_gh._majority()) {//main zero state
      if(bitToAbsorb) {
        _gh._modulate(true);
        return 0;//a zero yet to absorb
      } else {
        return 1;//absorbed zero
      }
    } else {
      return -1;//no absorption emitted 1
    }
  }

  int _getBit(bool bitLastEmitted) {
    if(_gh._majority()) {//zero
      _gh._prev();
      return 1;//last bit not needed emit zero
    } else {
      if(bitLastEmitted) {
        _gh._prev();
        return -1;//last bit needed and nothing to emit
      } else {
        _gh._modulate(false);
        _gh._prev();
        return 0;//last bit needed, emit 1
      }
    }
  }
}

class StackHandler {
  final List<bool> _data = [];
  final _Modulator _m = _Modulator();
  int _lenCode = 0;

  int _putBits() {
    int count = 0;
    while(_data.length > 0) {
      bool v = _data.removeLast();
      switch(_m._putBit(v)) {
        case -1:
          _data.add(v);
          _data.add(true);
          break;
        case 0:
          _data.add(false);
          break;
        case 1:
          break;//absorbed zero
        default: break;
      }
      count++;
    }
    return count;
  }

  void _getBits(int count) {
    while(count > 0) {
      bool v;
      v = (_data.length == 0 ? false : _data.removeLast());//zeros out
      switch(_m._getBit(v)) {
        case 1:
          _data.add(v);//not needed
          _data.add(false);//emitted zero
          break;
        case 0:
          _data.add(true);//emitted 1 used zero
          break;
        case -1:
          break;//bad skip, ...
        default: break;
      }
      count--;
    }
  }

  //STACK BLOCK FUNCTIONS 32 BIT

  int _putBlock(int lastCount) {
    explode(lastCount);
    return _putBits();
  }

  void putBlock() {
    _lenCode = _putBlock(_lenCode);
  }

  int _getBlock(int count) {
    if(count <= 0) throw Exception('Kodek empty below accumulated depth.');
    _getBits(count);
    if(_data.length < 32) throw Exception('Kodek hacked bad terminal.');//an empty is min 32
    return implode();
  }

  void getBlock() {
    _lenCode = _getBlock(_lenCode);
  }

  //BASIC UNIT OF EXTERNALIZED

  void explode(int x, [int c = 32]) {
    for(int i = 0; i < c; i++)
      _data.add(x & (1 << i) != 0);
  }

  int implode([int c = 32]) {
    int result = 0;
    for(int i = 0; i < c; i++)
      result &= ((_data.removeLast() ?? false) ? 1 : 0) << (c - 1 - i);
    return result;
  }

  void load() {
    for(_RingNick r in _m._gh._rn) {
      if(_data.length <= 0) throw Exception('Bad Kodek block length.');
      while((r._position = implode(2)) == 3) implode(1);//BILBO
      r._right = implode(1) == 1;
    }
    _lenCode = implode();
    _RingNick._pr._s = implode();
  }

  void save(bool reset) {
    explode(_RingNick._pr._s);
    explode(_lenCode);
    for(_RingNick r in _m._gh._rn.reversed) {
      explode(r._position, 2);
      explode(r._right ? 1 : 0, 1);
    }
    if(reset) _lenCode = 0;//reset
  }

  void explodeString(String s) {
    if(s == null) {
      explode(0, 1);
      return;
    }
    List<int> bytes = utf8.encode(s);
    int len = s.length;
    for(int i in bytes) explode(i, 8);
    explode(len);
    explode(1, 1);//not null marker
  }

  String implodeString() {
    if(implode(1) == 0) return null;//string terminal
    int len = implode();
    List<int> bytes = [];
    for(int i = 0; i < len; i++) bytes.add(implode(8));
    return utf8.decode(bytes.reversed);
  }

  String getB64() {
    if(_data.length != 0) throw Exception('Kodek must be fully packed.');
    save(false);
    List<int> chars = [];
    while(_data.length >= 8) {
      chars.add(implode(8));
    }
    int i = _data.length;
    chars.add(implode(8));
    chars.add(i);//length bits
    return base64Encode(chars);
  }

  void setB64(String s) {
    List<int> chars = base64Decode(s);
    int x = chars.removeLast();
    if(x > 7 || x < 0) throw Exception('Bad Kodek block alignment.');
    explode(chars.removeLast(), 8);//8 bits
    while((x++) < 8) implode(1);//remove bits
    while(chars.length > 0) explode(chars.removeLast(), 8);//explode kodek content
    load();
  }
}

class BlockChainTXStack {//A singleton is best, as the interaction between multiples is not order 'safe'
  final StackHandler _k = StackHandler();
  String _saved;

  String send(String s) {
    _k.explodeString(s);
    _k.putBlock();
    return _k.getB64();
  }

  List<String> receive(String s, [int down = 1, bool terminal = true]) {
    List<String> ls = [];
    _k.setB64(s);
    while(down-- > 0) {
      _k.getBlock();//top
      ls.add(_k.implodeString());
    }
    if(!terminal) ls.add(_k.getB64());//might as well make it easy to get a handle on lower ones again?
    return ls;
  }

  String nest() {//does not save push/pop states
    send(_k.getB64());//don't need result yet
    return send(_saved);
  }

  void fledgling(String s, [int nestDown = 1, bool destroyPop = false]) {//in pairs
    List<String> ls = receive(s, 2 * nestDown);//don't need terminal hook
    if(destroyPop) {
      _saved = ls.removeLast();//the saved stack
    } else {
      ls.removeLast();//dump
    }
    _k.setB64(ls.removeLast());//the kodek active
  }

  void push() {//state save
    String tmp = _k.getB64();
    if(_saved != null) _k.setB64(_saved);
    _saved = send(tmp);
    _k.setB64(tmp);//restore
  }

  void pop() {//state reload
    _k.setB64(receive(_saved, 1, false).removeLast());
  }

  void popNest() {
    String k = _k.getB64();//don't need result yet
    String tmp = _saved;
    pop();
    send(k);
    send(tmp);//stack the temporary pushed scope as a nest in the pop scope
  }

  void pushFledgling([int nestDown = 1, bool destroyTree = true]) {
    String s = _k.getB64();
    if(destroyTree) receive(s, 2);//2DROP
    push();//save scope
    fledgling(s, nestDown);//extract from self
  }
}

class BlockTreeManager {
  final BlockChainTXStack tx = BlockChainTXStack();

  void insert() {

  }

  String select() {
    return null;//TODO
  }
}

Today’s Thought


import 'dart:math';

class PseudoRandom {
  int a;
  int c;
  int m = 1 << 32;
  int s;
  int i;

  PseudoRandom([int prod = 1664525, int add = 1013904223]) {
    a = prod;
    c = add;
    s = Random().nextInt(m) * 2 + 1;//odd
    next();// a fast round
    i = a.modInverse(m);//4276115653 as inverse of 1664525
  }

  int next() {
    return s = (a * s + c) % m;
  }

  int prev() {
    return s = (s - c) * i % m;
  }
}

class RingNick {
  List<double> walls = [ 0.25, 0.5, 0.75 ];
  int position = 0;
  int mostEscaped = 1;//the lowest pair of walls 0.25 and 0.5
  int leastEscaped = 2;//the highest walls 0.5 and 0.75
  int theThird = 0;//the 0.75 and 0.25 walls
  bool right = true;
  PseudoRandom pr = PseudoRandom();

  int _getPosition() => position;

  int _asMod(int pos) {
    return pos % walls.length;
  }

  void _setPosition(int pos) {
    position = _asMod(pos);
  }

  void _next() {
    int direction = right ? 0 : walls.length - 1;//truncate to 2
    double wall = walls[_asMod(_getPosition() + direction)];
    if(pr.next() > (wall * pr.m).toInt()) {
      //jumped
      _setPosition(position + (right ? 1 : walls.length - 1));
    } else {
      //not jumped
      right = !right;//bounce
    }
  }

  void _prev() {
    int direction = !right ? 0 : walls.length - 1;//truncate to 2
    double wall = walls[_asMod(_getPosition() + direction)];
    if(pr.s > (wall * pr.m).toInt()) {// the jump over before sync
      //jumped
      _setPosition(position + (!right ? 1 : walls.length - 1));
    } else {
      //not jumped
      right = !right;//bounce -- double bounce and scale before sync
    }
    pr.prev();//exact inverse
  }

  void next() {
    _next();
    while(_getPosition() == mostEscaped) _next();
  }

  void prev() {
    _prev();
    while(_getPosition() == mostEscaped) _prev();
  }
}

class GroupHandler {
  List<RingNick> rn;

  GroupHandler(int size) {
    if(size % 2 == 0) size++;
    rn = List<RingNick>(size);
  }

  void next() {
    for(RingNick r in rn) r.next();
  }

  void prev() {
    for(RingNick r in rn.reversed) r.prev();
  }

  bool majority() {
    int count = 0;
    for(RingNick r in rn) if(r._getPosition() == r.leastEscaped) count++;//a main cumulative
    return (2 * count > rn.length);// the > 2/3rd state is true
  }

  void modulate() {
    for(RingNick r in rn) if(r._getPosition() == r.leastEscaped) {
      r._setPosition(r.theThird);
    } else {
      //mostEscaped eliminated by not being used
      r._setPosition(r.leastEscaped);
    }
  }
}

class Modulator {
  GroupHandler gh = GroupHandler(55);

  int putBit(bool bitToAbsorb) {//returns absorption status
    gh.next();
    if(gh.majority()) {//main zero state
      if(bitToAbsorb) {
        gh.modulate();
        return 0;//a zero yet to absorb
      } else {
        return 1;//absorbed zero
      }
    } else {
      return -1;//no absorption emitted 1
    }
  }

  int getBit(bool bitLastEmitted) {
    if(gh.majority()) {//zero
      gh.prev();
      return 1;//last bit not needed emit zero
    } else {
      if(bitLastEmitted) {
        gh.prev();
        return -1;//last bit needed and nothing to emit
      } else {
        gh.modulate();
        gh.prev();
        return 0;//last bit needed, emit 1
      }
    }
  }
}

class StackHandler {
  List<bool> data = [];
  Modulator m = Modulator();

  int putBits() {
    int count = 0;
    while(data.length > 0) {
      bool v = data.removeLast();
      switch(m.putBit(v)) {
        case -1:
          data.add(v);
          data.add(true);
          break;
        case 0:
          data.add(false);
          break;
        case 1:
          break;//absorbed zero
        default: break;
      }
      count++;
    }
    return count;
  }

  void getBits(int count) {
    while(count > 0) {
      bool v;
      v = (data.length == 0 ? false : data.removeLast());//zeros out
      switch(m.getBit(v)) {
        case 1:
          data.add(v);//not needed
          data.add(false);//emitted zero
          break;
        case 0:
          data.add(true);//emitted 1 used zero
          break;
        case -1:
          break;//bad skip, ...
        default: break;
      }
      count--;
    }
  }
}

Statistics and Damn Lies

I was wondering over the statistics problem I call the ABC problem. Say you have 3 walls in a circular path, of different heights, and between them are points marked A, B and C. If in any ‘turn’ the ‘climber’ attempts to scale the wall in the current clockwise or anti-clockwise direction. The chances of success are proportional to the wall height. If the climber fails to get over a wall, they reverse direction. A simple thing, but what are the chances of the climber will be found facing clockwise just before scaling or not a wall? Is it close to 0.5 as the problem is not symmetric?

More interestingly the climber will be in a very real sense captured more often in the cell with the highest pair of walls. If the cell with the lowest pair of walls is just considered as consumption of time, then what is the ratio of the containment time over the total time not in the least inescapable wall cell?

So the binomial distribution of the elimination of the ’emptiest’ when repeating this pattern as an array with co-prime ‘dice’ (if all occupancy has to be in either of the most secure cells in each ‘ring nick’), the rate depends on the number of ring nicks. The considered security majority state is the state (selected from the two most secure cell states) which more of the ring nicks are in, given none are in the least secure state of the three states.

For the ring nick array to be majority most secure more than two thirds the time is another binomial or two away. If there are more than two-thirds of the time (excluding gaping minimal occupancy cells) the most secure state majority and less than two-thirds (by unitary summation) of the middle-security cells in majority, there exists a Jaxon Modulation coding to place data on the Prisoners by reversing all their directions at once where necessary, to invert the majority into a minority rarer state with more Shannon information. Note that the pseudo-random dice and other quantifying information remains constant in bits.

Dedicated to Kurt Godel … I am number 6. 😀

Flutter and Android Development

So after some install minor trouble in IntelliJ due to minor bugs in the Flutter Dart plugin, the system works quite nice. Hot reloads are the best. There are however some issues. Like the following.

  1. The produced files are multi-megabyte resource hogs. This may just be the debug version, but even with building production APK, not having JDK 8 options in pro-guard, a simple 1 page GUI hits 6 MB. (Be careful of libraries).
  2. There is little configure-ability in the default demo project. Things like default used SD card for install and other sensible options, mean trips into the Android base code and XML more often than should be necessary. (I can’t edit my MainActivity.java with source highlights and error locations).
  3. The state-container split is weird, especially as all the sub-containers are in the state. I do like the templating though in IntelliJ. (The documentation on preserving state is scarce).
  4. Generic functions are nice, and so is some of the library support. There are still a few inconsistencies, but these should iron out over time.
  5. I’m about to discover the GC of PaintRecorder panic on my graphical reserves. I assume this is making GL shaders in the background.
//looks different now, ... The package dart:ui has issues!!&lt;br /&gt;//and a duplicate Image, Rect, ... classes
  void atlasUsing(SmartCanvas sc) {
    sc.drawRawAtlas(hi, _transforms,
        _getCharacterRect(),
        Int32List colors,
        BlendMode.srcOver,//should check for mixing foreground and background
        CanvasManager.unit,
        sc.normalPaint);
  }

A bit of work later, and the dart analyser does not crash as often. I think it really is important to not go too low level without some knowledge. The classes collide, and it is best to import dart:ui as an as (I picked ‘Hood’ for under the hood), so as to avoid many of the issues. This does mean that I will have to abstract many of the functions of the low level to be easy functions working with high level (non Hood) Paint, Rect and others. But it was a fun journey!

The channel interface to native is quite an interesting journey as well. It has all the memories of Java and switching back from dart, some things are missed. I’m using the Android platform to generate some sound in the current project. There is not too much in the way of basics to play sound files in the Flutter libraries. Custom AudioTrack stuff is a definite return to Java and a MethodChannel.

The next thing is some code to put the sound together, and some code to add in some convenience methods for putting animation on the CanvasWidget I’ve put together. The IntelliJ dart analyser keeps failing but is restartable after a bit of editing. The code is quite simple for many tasks. There is some complexity when dealing with Future<X>, which infects its way up the stack, needing some setState() for eventually filling in the data on the future resolution. You’d have thought that a return await would have resolved and made the async wait for a resolved future. Because, the documentation is unclear on many things.

It’s not a perfect language isn’t dart, but it is quite nice to use. Flutter is actually very good. I’d suggest ScopedModel and quite a few of the better packages to be included in most projects you’d make.

Kindle Android Memory Hogging Apps

The apps I have decided to hate because of simple things like move to SD card not being enabled, or even if moved to SD is OK, there is some other “feature” which is annoying (especially high memory use due to lazy programming).

  1. Twitter – on the surface a good app. No SD card, and very large for a texting app. Also should use multi-notifications, but the bird tweets each and every one.
  2. Facebook – this is on the SD card, but will not stop putting over 256 MB into the on-device flash memory. This is likely an arse elbow use of libraries and no common goal to lower the memory usage as it would interfere with competing apps for ad shows.
  3. Messenger – yes another 200 MB of flash busting erm, what exactly?
  4. Basically anything larger than Chrome which doesn’t do something very impressive.

So this on my kindle is (bold for not that impressive), Turmux, Google Play services, Messenger (replaced with Messenger Lite), Facebook (replaced with Facebook Lite), Google Sheets, Java N-IDE, Google Docs, Office Lens, LinkedIn (it went in the bin first, as it was just too big and sucks video bandwidth without options), YouTube and then Chrome. I think this in large part is due to a lack of a move to SD card, and/or then not compressing SQLite databases by using tokenization to an external resource file which can be moved to the SD Card, not compressing resources, adding in much useless animation. I have about 800 MB free. I wonder how long the bold shall last.

There is also the new firmware updates which prevent chrome from saving to the SD card. I think all write permissions are voided except in specific to app directories. The default SD save directory though is not writable. I know it’s new firmware as it used to work before the updates.

Kindle Fire (Pt. III)

A general complaint about Android devices is that when you’re low on power, and it always wants to switch on and waste it rather than wait until you press the on button. It’s part of the global always on spy network, designed for idiots with money and not for intelligent or off-grid people. Alexa likely wants to know your inside leg measurement. As I said this is general to all Android devices, so I suppose expecting more from Amazon was just too much.

I suppose it would be too much to edit things like the above equation on the device, but I will try to see if there is such an equation editing tool. Plenty of good calculators, but few typographical tools. I sometimes would like to do this. It’s not as though I need the mathematical assistance, more typographical layout, for including in documents.

It seems there is nothing which will do this offline. Maybe an app opportunity? Likely a long development. It depends on other tools such as MathML being hack-able into something else. Of course n=k in the above equation. A bit of maths in the “analytic closure of integration” to make it a deterministic process for a CAS (Computer Algebra System). It replaces integration (hard for computers to pattern match, and based on a large and incomplete knowledge base) with simultaneous equations and factorization.

There seem to be some downloaded episodes of some series happened this morning. Three free episodes (Number 1) of some random TV shows. I assume this is to get people into watching exciting stuff. I feel a bandwidth suck in the making. Ah, so it’s called “On Deck“, and although kind of interesting, it would be nice to make it only use certain WiFi networks. While on 4G hotspot proxy, it will make my bank account sad.

Sideloaded Kindle Fire (Pt II)

It’s been a few days, and the best benefit as yet has been the Libby app. This gets your library card hooked up to the database of books and audio books to lend. There is quite a lot of “feature fight” between the Amazon and Google. The latest being what happens when there is an update of permissions to an app. It seems that although it does suspend an Amazon overwrite, Amazon will not stop bugging you about some updates which are available (but I have yet to analyze exactly how much this consumes in bandwidth, as the firmware update seemed to consume loads of data).

There are some really nice apps which blossom on the 7″ screen, and were just too tiny on a phone. It is good to not be limited to such a small screen now. A list of apps which are almost essentials will follow, as some of the “features” such as adding files (.mp3 for example) to a folder on the Kindle SD, will just not show up. This is likely of the form of marketing from the South Park cable guy school of what no services? Buy here.

So after getting Play Store up and running, what to install?

  1. Chrome – for all your browsing needs.
  2. Outlook – I actually like this from Microsoft, and it does pick up gmail after Chrome is installed. (Not before).
  3. Google Docs and Sheets – these are quite good with Word and Excel files, but do need settings altering for saving in those formats. (Naughty Google).
  4. Facebook, Twitter – although Twitter does need to employ someone with experience of multi-notifications. Maybe it’s a birds everywhere logo-ego design.
  5. Skype – actually not that bad.
  6. USP Spectrum Emulator – don’t tell everyone. It’s excellent if you’re into your retro.
  7. Libby – an excellent public library resource.
  8. Free42 – some consider this to be the pinnacle of calculators before needing to crack open a Mathematica workbook. (An excellent open source reworking not using any HP ROMs). The simple facts that it has such a wide range of open source utilities already written for the backward compatible HP-41 range, and has over 1MB available memory reported, makes it worth getting a Kindle just for this.
  9. VLC – this is quite a nice player of audio and video, and does work with the screen off (with audio). It also reads those hidden by “the cable guy” directories.

If you purchased it using a free Amazon gift voucher, I agree with your choice. Only time will tell the battery service life and the resultant reliance on sticky gum as an assembly procedure for confounding future recycling farce-sillities.

Amazon Kindle Fire 7″ (Minus Ads) + Raspbian PC

Well, they say it’s in the post. It should arrive before Christmas. This review will get longer as I test it out. I had to get the 8GB version as the lack of adverts was something that was essential. Maybe I’ll get better use of PDFs, and free up quite some space on my mobile by not needing all the document apps on it. I just wonder how much “junk” is installed by default, and how much can’t be disabled. Exciting! Alexa, swear like a sailor!

Quick side notes: I’m replacing my Debian by Raspbian Desktop for PC (Ooooooh). It’s going to be the standard OS of Linux in the company. Just updating the development with node, fpc and git. Along with httpd2, mariadb-server and php.

More gigs of android updates this morning. Why can’t android developers trim their code? The tools are available, but they seem not to be used, and the insistance of stuffing apps with excessive graphical resources continues. How many gig for a texting app?

So it was a little weird. First make sure you have plenty of data, as it will do a system update within a few hours. Get all the apps you can find off the AmazonStore (after you sign in) and be aware that not all the ones you want will be found. Then enable side loading of apps, and get the four needed .apk files for google store. Install these in the correct order, and open play store. Sign in. Get the play apps you want.

A note on compatibility. Microsoft Outlook will required Chrome to use gmail. The play store may try to download updates for some of your apps. This is OK, but some will give errors. This can be divided into 3 groups.

  1. Things like LinkedIn – Likely using a strange hack but it does work.
  2. Kindle app – Play store tries to update and fails, it needs setting to not automatic update in the play store (on the menu of the app listing in the store). This then seems to disappear after the firmware update.
  3. Things like Whatsapp – Just not compatible as there is no phone device.

Luckily the Fire does not try to auto-update apps which were sideloaded (or downloaded from play store). It tells you this in the library updates section, so don’t be tempted to enter update fight hell. This could be problematic. Some notes on the options I chose to ignore on the first setup.

  1. Ignore the Amazon, Facebook and Twitter integration. I mean you could try it, but I haven’t, as the play store apps work just fine.
  2. You must enable sideloading. This can be a problem later if you don’t understand the implication of downloading a .apk file. Remember the play store is the guest store, and so needs sideloading to work. But any random internet site could have a downloadable with bad intent.
  3. Alexa seems to want to work, but she hasn’t said anything yet. Maybe I’m just doing it wrong. This is the most likely option.

After a bit of connection to ADB, it looks like the Alexa service uses about 10% of the processor power just waiting for the word “Alexa”, which is a bit extreme for me. Gag ‘Lexa, oh yes!

Amiga Forever

Quite nice front end to WinUAE, with all the necessary ROMs and .adf files. There is then the process of finding some older freeware CD images, and you have a great retro Amiga system. Ummm, joystick. Hopefully there will be a cross compiler still working for the 3.1 OS, to provide back conversions of any software I may make.

There is then the process of setting up the 3.X image to my liking, and quite a lot is already done. There is also some games and other software included. This is good. The only strange thing was the 1GB hard file install of a vanilla OS, which did not seem to be used so I deleted it. … Seems it was for some lower version WB, and I’m not really using that.

After configuring the (included with some versions) Amiga Explorer it became easy to see the machine. This is not strictly necessary, but might be useful in future for remote access or some other test setup. I’ve got a Free Pascal for the 68k-amigaos, so I’ll be looking to do some back porting of anything I develop.

Interesting AROS PC edition refuses to boot today, a bad .vdi file error as seen by the guest OS. This may have been related to adding an extra network interface, but that should not do that, so I have to assume there is still some unwanted stability issues. AROS is not really necessary with a JIT compiler in WinUAE. I’m quite happy with the RTG 3.X Workbench as a general tool for doing things outside Windows and Linux. I’ll get on to installing some cover disk stuff from some “ancient” ISO files over Christmas. 600MB is a lot in Amiga world.

It does seem that OS 3.X needs an update to move the ENV-Archive off of the system boot disk, so as to fix the security to read-only. I can drop any “update” from the Windows 10 side. A good compromise is using Windows to control the access rights. This way I can be the administrator, and other users can have read-only permission on all but the Shared volume. This hopefully keeps the binaries intact for general guest users. It also provides a good excuse to fix up the Windows 10 security on the public user directory.

GEM Unification

The further result of adding in Coulomb force gradients into the theory of Uncertain Geometry. The GEM (Geometry/Gravity and Electro-Magnetism) Unification hints at the above table of particles. A mass genera of “Dark” matter (B), and some strange matter (A). The paper so far can be downloaded from Google Drive. I’m currently on the search for a suitable equation relating to the Weak force. I have no proof yet that it would be emergent, but the particle grid already includes a “dark matter” column (including a dark neutrino (yellow)), and a “not so dark” but very strange and heavy particles type A.