please dont rip this site

NEW202305.TXT

 

ON 20230511@11:06:36 AM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/scenix/keymacs.src#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\scenix\keymacs.src&version=0



ON 20230511@10:23:15 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/java/script/index.htm#45057.9328125
James Newton[JMN-EFP-786] Says
/Techref/language/java/script/operator-overloading.htm
(Fake) Operator Overloading



ON 20230511@10:37:07 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/java/script/operator-overloading.htm#45057.9424421296
James Newton[JMN-EFP-786] Says

Because Javascript will call the <tt>.valueOf</tt> method for an object to coerce the value before applying most operators (like basic math ops, binary ops, comparison ops), you can get tricky and change the value returned on the left to the result of a different operation. 
<P>
<PRE>
    var obj1 = {
        valueOf: function () {
            console.log("valueOf1");
            return 1;
        }
    };
    var obj2 = {
        valueOf: function () {
            console.log("valueOf2");
            return 2;
        }
    };

</PRE>

And now:
<PRE>
obj1 + obj2
    valueOf1
    valueOf2
    3
</PRE>
Because these are called in order, obj1 can set a flag in the prototype and also store it's value in the prototype, but return nothing. Then obj2 will know it's not first, and can do the actual operation, and return the desired complete value, using obj1's value and it's own.



ON 20230511@10:40:12 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/java/script/operator-overloading.htm#45057.9445833333
James Newton[JMN-EFP-786] Code:

<PRE>// This example implements a point class that can do basic math functions, 
// but uses both the x and y elements of the point correctly. It uses a fake
// return value to detect the operation between the objects according to the
// resulting calculation, then replaces it in the end with the same sort of 
// operation, but done with the actual point values. 

function Point(x, y) {
    if (arguments.length === 0) {
        x = 0;
        y = 0;
    } else if (arguments.length !== 2) {
        throw new Error(&quot;Need either 0 or 2 arguments&quot;);
    }
    this.x = x;
    this.y = y;
}
//-------------- Operator overloading

Point.operands = [];

Point.prototype.valueOf = function () {
    Point.operands.push(this);
    // Lowest natural number x where the following are all different:
    // x + x, x - x, x * x, x / x
    return 3;
}
Object.defineProperty(Point.prototype, &quot;_&quot;, {
    set: function (value) {
        var ops = Point.operands;
        var operator;
        if (ops.length === 2 &amp;&amp; value === 0) { // 3 - 3
            operator = this.setSubtract;
        } else if (ops.length === 2 &amp;&amp; value === 1) { // 3 / 3
            operator = this.setDivide;
        } else if (ops.length &gt;= 2 &amp;&amp; (value === 3 * ops.length)) { // 3 + 3 + 3 + ...
            operator = this.setAdd;
        } else if (ops.length &gt;= 2 &amp;&amp; (value === Math.pow(3, ops.length))) { // 3 * 3 * 3 * ...
            operator = this.setMultiply;
        } else {
            throw new Error(&quot;Unsupported operation (code &quot;+value+&quot;)&quot;);
        }
        Point.operands = []; // reset
        return operator.apply(this, ops);
    },
    /**
     * &quot;&quot; + mypoint won't invoke toString(), but valueOf().
     * Work-around: &quot;&quot; + mypoint._
     */
    get: function () {
        return this.toString();
    }
});

//-------------- Operator implementations

Point.prototype.setSubtract = function (l, r) {
    this.x = l.x - r.x;
    this.y = l.y - r.y;
    return this;
}
Point.prototype.setDivide = function (l, r) {
    this.x = l.x / r.x;
    this.y = l.y / r.y;
    return this;
}
Point.prototype.setAdd = function (first) {
    this.x = first.x;
    this.y = first.y;
    [].slice.call(arguments, 1).forEach(function (op) {
        this.x += op.x;
        this.y += op.y;
    }, this);
    return this;
}
Point.prototype.setMultiply = function (first) {
    this.x = first.x;
    this.y = first.y;
    [].slice.call(arguments, 1).forEach(function (op) {
        this.x *= op.x;
        this.y *= op.y;
    }, this);
    return this;
}

//-------------- Various helpers

Point.prototype.toString = function () {
    return &quot;Point(&quot;+this.x+&quot;, &quot;+this.y+&quot;)&quot;;
}
Point.prototype.equals = function (other) {
    return this.x === other.x &amp;&amp; this.y === other.y;
}

//-------------- Sample use

var p = new Point();
var a = new Point(1, 2)
var b = new Point(3, 4)
var c = new Point(5, 6)

p._ = a + b + c;
console.log(p.toString());

p._ = a * b * c;
console.log(p.toString());     

//p._ = a * b + c //can't do this, but...
p._ = a * b
p._ = p + c;
console.log(p.toString());</PRE>



ON 20230511@10:40:47 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/java/script/operator-overloading.htm#45057.9449884259
James Newton[JMN-EFP-786] See also:
https://2ality.com/2011/12/fake-operator-overloading.html




ON 20230511@10:41:09 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/java/script/operator-overloading.htm#45057.9452430556
James Newton[JMN-EFP-786] See also:
https://github.com/rauschma/op_overload




ON 20230513@8:16:15 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/asms.htm#45059.8446180556
James Newton[JMN-EFP-786] See also:
https://github.com/WestfW/structured_gas
Add if, ifelse, else, endif, do, until, while via macros to almost any assembly language supported by the GNU Assembler



ON 20230519@9:54:36 AM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/method/ai/LinearRegresion.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\method\ai\LinearRegresion.htm&version=0



ON 20230520@10:25:47 AM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/method/ais.htm#45066.4345717593
James Newton[JMN-EFP-786] See also:
https://http://www.amazon.com/Artificial-Intelligence-Humans-Fundamental-Algorithms/dp/1493682229/ref=sr_1_1
Recommended by Lloyd Moore of Seattle Robotics Society. He takes a very simplified approach, which doesn't require as much math for an intuitive understanding.



ON 20230520@10:55:33 AM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/methods.htm#45066.4552430556
James Newton[JMN-EFP-786] Says
/Techref/method/controlsystems.htm
Control System Methods



ON 20230520@10:58:06 AM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/methods.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\methods.htm&version=1



ON 20230520@10:58:44 AM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/method/controlsystems.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\method\controlsystems.htm&version=0



ON 20230520@11:06:05 AM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/method/controlsystems.htm#45066.4625578704
James Newton[JMN-EFP-786] See also:
https://en.wikipedia.org/wiki/Smith_predictor
a type of predictive controller designed to control systems with a significant feedback time delay. The idea is to have two control loops, one inner, and one outer control loop. The inner control loop models the expected activity of the external world at a faster pace, and is corrected periodically as data comes in. The outer loop then applies control feedback to the inner loop until data comes it to update this simulation.



ON 20230520@7:47:06 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/method/ai/LinearRegresion.htm#45066.824375
James Newton[JMN-EFP-786] Says

<iframe width="560" height="315" src="https://http://www.youtube.com/embed/my3lsV-VQjs" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



ON 20230522@11:07:29 AM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/method/ai/NeuralNets.htm#45068.4635300926
James Newton[JMN-EFP-786] See also:
https://docs.google.com/spreadsheets/d/1oAwO9nievYRLyyC_2sgkXaHF3AuYlgEr_2kuAN_EQrw/edit?usp=sharing
A spreadsheet which models the operation of a simple Neural Network. This is a Sheets update of an original design for Lotus 1-2-3, from the '90's. It relies on self referencing calculations which are enabled in the settings. See the text copied below the sheet to understand it's operation.



ON 20230523@12:27:02 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/logos.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\language\logos.htm&version=0



ON 20230523@12:27:25 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/logos.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\language\logos.htm&version=1



ON 20230523@12:30:34 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/logos.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\language\logos.htm&version=2



ON 20230523@12:32:21 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/lisps.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\language\lisps.htm&version=0



ON 20230524@6:25:19 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/ccpp/index.htm#45070.7675810185
James Newton[JMN-EFP-786] See also:
https://github.com/xorvoid/sectorc
A very minimal C compiler, written in x86 asm, that compiles to 512 bytes of code.



ON 20230525@8:36:06 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/method/a-star.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\method\a-star.htm&version=0



ON 20230526@9:28:33 AM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/other/incompetence.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\other\incompetence.htm&version=0



ON 20230526@3:29:19 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/html/HTML5webapps.htm#45072.6453587963
James Newton[JMN-EFP-786] See also:
https://jsfiddle.net/ourcodeworld/rce6nn3z/2/
Cause the browser to download a file with content created in the web page. 
<pre>
    var element = document.createElement('a');
    element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
    element.setAttribute('download', filename);
    element.style.display = 'none';
    document.body.appendChild(element);
    element.click();
    document.body.removeChild(element);
</pre>




ON 20230526@3:31:09 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/html/HTML5webapps.htm#45072.6466319444
James Newton[JMN-EFP-786] See also:
https://eligrey.com/demos/FileSaver.js/
Save data created in a web page, including images and rich text / SVG



ON 20230526@3:33:00 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/language/html/HTML5webapps.htm#45072.6479166667
James Newton[JMN-EFP-786] See also:
https://jimmywarting.github.io/native-file-system-adapter/example/test.html
Instead of just file upload and download, if supported, this provides the ability to <OL>
<LI> Get permission from the user for the site to access a folder
<LI> Get files from that folder into the browser
<LI> Save files from the browser into that folder. </OL>



ON 20230526@5:45:59 PM at page:
On a web page you were interested in at:
http://techref.massmind.org/Techref/ideas.htm#
James Newton[JMN-EFP-786] edited the page. Difference:
http://techref.massmind.org/techref/diff.asp?url=\Techref\ideas.htm&version=0



file: /Techref/new202305.txt, 12KB, , updated: 2023/5/26 17:45, local time: 2024/10/12 02:24,
TOP NEW HELP FIND: 
98.84.18.52:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.massmind.org/techref/new202305.txt"> new202305</A>

Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to www.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .