A simple window size reporter which runs in modern browsers (and even those back to Safari 5 and IE 6). Additionally, the browser agent string is displayed and if feasible, a simple canvas animation. Click here to launch in a new window.
"The only reason for time is so that everything doesn't happen at once." -Albert Einstein
20210403
20200503
Loss of image quality in Word 2007
Finally, a mystery is solved. When saving a document using Word 2007, image quality would decrease. There is an option to fix this issue and it took a long time to find it.
Compression can be disabled on a per-file basis using the following steps:
Click the Office Button, and then click Save As.
Click Tools, and then click Compress Pictures.
Click Options.
Click to clear the Automatically perform basic compression on save check box.
Click OK.
In the Compress Pictures dialog box, click Cancel.
Note: Clicking OK on this dialog will not prevent the issue from occurring.
You can also modify a registry setting to prevent basic compression from occurring by default.
For further details see:
https://docs.microsoft.com/en-us/office/troubleshoot/office/office-docuemnt-image-quality-loss
Update: Another option is to double the size of the document. For example, if targeting a size of 8.5x11, then set the document size to 17x22 and adjust margins and font size to compensate. When saving to PDF, the images will still be down-sampled to 220dpi, however, this translates to 440dpi at double the size. If printing, scale the document to 50% in the printer settings. Images will be crisp. Or...move on to libreoffice.org
Compression can be disabled on a per-file basis using the following steps:
Click the Office Button, and then click Save As.
Click Tools, and then click Compress Pictures.
Click Options.
Click to clear the Automatically perform basic compression on save check box.
Click OK.
In the Compress Pictures dialog box, click Cancel.
Note: Clicking OK on this dialog will not prevent the issue from occurring.
You can also modify a registry setting to prevent basic compression from occurring by default.
For further details see:
https://docs.microsoft.com/en-us/office/troubleshoot/office/office-docuemnt-image-quality-loss
Update: Another option is to double the size of the document. For example, if targeting a size of 8.5x11, then set the document size to 17x22 and adjust margins and font size to compensate. When saving to PDF, the images will still be down-sampled to 220dpi, however, this translates to 440dpi at double the size. If printing, scale the document to 50% in the printer settings. Images will be crisp. Or...move on to libreoffice.org
20191113
20190911
JavaScript popularity
According to the 2019 Stack Overflow survey: "For the seventh year in a row, JavaScript is the most commonly used programming language"
20190630
easeSmoother
Labels:
Computing
,
Mathematics
,
Software
,
Tools
The CSS cubic-bezier timing function creates easing curves using 4 control points.
The first and last control points are fixed at (0,0) and (1,1), while the second and third control points are passed as arguments to create a variety of easing curves.
Sometimes an "in-out" easing is needed which starts slow and ends slow. We experimented to find a curve that best approximates the smootherStep function (see here) which produces a natural acceleration similar to when we change lanes while driving on the highway or when we reach for something (see also this).
Specifying the timing function as "cubic-bezier(.49,0,.51,1)" creates the lowest error compared to the minimum-jerk reference (see code at the bottom of this article). Visualize the timing here using Lea Verou’s cubic-bezier.com (compare to ease-in-out). JSFiddle example: https://jsfiddle.net/intrinsica/9ryqet30
If a preset it created, it could be aliased as easeSmoother or easeInOutSmoother.
The green curve below is the reference min-jerk function. The purple curve is the easeSmoother cubic-bezier.

JavaScript reference (see also):
function MinJerk(t) {
var ts = t * t, tc = ts * t;
return 6*tc*ts - 15*ts*ts + 10*tc;
}
Alternatively:
let MinJerk = t => (6*t*t-15*t+10)*t*t*t;
Below is the L2 error curve, comparing the cubic-bezier to the reference min-jerk function.
The first and last control points are fixed at (0,0) and (1,1), while the second and third control points are passed as arguments to create a variety of easing curves.
Sometimes an "in-out" easing is needed which starts slow and ends slow. We experimented to find a curve that best approximates the smootherStep function (see here) which produces a natural acceleration similar to when we change lanes while driving on the highway or when we reach for something (see also this).
Specifying the timing function as "cubic-bezier(.49,0,.51,1)" creates the lowest error compared to the minimum-jerk reference (see code at the bottom of this article). Visualize the timing here using Lea Verou’s cubic-bezier.com (compare to ease-in-out). JSFiddle example: https://jsfiddle.net/intrinsica/9ryqet30
If a preset it created, it could be aliased as easeSmoother or easeInOutSmoother.
The green curve below is the reference min-jerk function. The purple curve is the easeSmoother cubic-bezier.

JavaScript reference (see also):
function MinJerk(t) {
var ts = t * t, tc = ts * t;
return 6*tc*ts - 15*ts*ts + 10*tc;
}
Alternatively:
let MinJerk = t => (6*t*t-15*t+10)*t*t*t;
Below is the L2 error curve, comparing the cubic-bezier to the reference min-jerk function.
20190319
Infinite information
Labels:
Observed
,
Scalability

"We've entered an age of infinite information." -James W. Dunn
20190106
Our 2018 list of top mobile games
In our spare time, the most played games last year were:
1. Battle Bay from Rovio (strategy guide here)
2: BitCity from NimbleBit (strategy guide here)
1. Battle Bay from Rovio (strategy guide here)
2: BitCity from NimbleBit (strategy guide here)
20181219
SimCity 2000 running on Windows 7
SimCity 2000 runs on Windows 7 x64, but crashes when attempting to access the dialog box to save or load a city. After searching for and trying all of the suggested fixes and patches to avoid this crash, we still had no success. Crash, crash, crash!
Alas, there is a solution! Use the command line to invoke the app with a path to a city file to open. For example: "c:> simcity Saved\city.sc2" This will not only open a city, but allow saving it on exit. If a new terrain is desired, use the urban renewal kit.
Alas, there is a solution! Use the command line to invoke the app with a path to a city file to open. For example: "c:> simcity Saved\city.sc2" This will not only open a city, but allow saving it on exit. If a new terrain is desired, use the urban renewal kit.
20180824
p5.js vs processing.js
Labels:
Observed
,
Programming
20180710
BlackScript
Labels:
Observed
,
Programming
,
Tips
Valuable technique in JavaScript class coding: link
The following benchmarks indicate a performance improvement for bulk object creation.
Try this in your own browser here
Update 2025.0106: Ex Nihilo wins in jsbench.me tests on Chrome 131 [left] and Firefox 133 [right]:
Update 2023.0119: Ex Nihilo wins in jsbench.me tests on Chrome 109 and Firefox 109:
Older benchmarks follow for archival reference:
A
benchmark.js
test running on node.js:
________________________________________________________ Research>node --version v10.16.3 Research>node bench.js OldStyleClass x 165,772 ops/sec ±0.38% (106 runs sampled) Ex Nihilo x 180,305 ops/sec ±0.50% (104 runs sampled) Fastest is Ex Nihilo Research>node bench.js NewStyleClass x 163,242 ops/sec ±0.28% (111 runs sampled) Ex Nihilo x 180,219 ops/sec ±0.46% (100 runs sampled) Fastest is Ex Nihilo Research>node bench.js OldStyleClass x 160,930 ops/sec ±0.58% (103 runs sampled) NewStyleClass x 161,634 ops/sec ±0.79% (105 runs sampled) Ex Nihilo x 176,387 ops/sec ±0.44% (107 runs sampled) Fastest is Ex Nihilo
Older runs on jsperf.com:

Update 20200627: None of the newer versions of the browsers run Ex Nihilo faster. Optimization wins!
Update 20201006: Additional server-side tests:
________________________________________________________ Research>node --version v12.19.0 Research>node bench.js OldStyleClass x 153,207 ops/sec ±0.95% (84 runs sampled) NewStyleClass x 150,535 ops/sec ±0.32% (93 runs sampled) Ex Nihilo x 166,850 ops/sec ±1.84% (91 runs sampled) Fastest is Ex Nihilo ________________________________________________________ Research>node --version v13.14.0 Research>node bench.js OldStyleClass x 151,339 ops/sec ±0.76% (86 runs sampled) NewStyleClass x 147,369 ops/sec ±0.27% (95 runs sampled) Ex Nihilo x 164,624 ops/sec ±0.26% (93 runs sampled) Fastest is Ex Nihilo ________________________________________________________ Research>node --version v14.13.0 Research>node bench.js OldStyleClass x 147,954 ops/sec ±1.03% (87 runs sampled) NewStyleClass x 144,716 ops/sec ±0.37% (93 runs sampled) Ex Nihilo x 160,388 ops/sec ±0.47% (89 runs sampled) Fastest is Ex Nihilo
20161107
Faster hypot for JavaScript
Labels:
Computing
,
Mathematics
,
Maximize
,
Programming
When the distance between two points is required, one method of computation in modern browsers is a function called Hypot. Implementation of this function is often not optimized and ultimately calls on
Math.sqrt
at the last step. Performance tests indicate a calculation bottleneck with JavaScript's standard Math library implementation. Here then is an improvement of hypot
at the cost of a fractional error (0.05%):
function hypot(x, y) { // expects: abs(x) and abs(y)
var a = Math.max(x,y),
b = Math.min(x,y)/a,
c = 1 + b*b;
return a * ((-0.0705613450914645*c + 0.624084374908536)*c + 0.447383574908535);
}
Note, this function expects absolute values (which can be computed on the call).
The formula in the return is a polynomial approximation of the square root of values in the range from 1 to 2. Caveat: your mileage may vary!
20161102
Neural Network in 12 lines of JavaScript
Labels:
Computing
,
Mathematics
,
Observed
,
Unit Operations
Inspired by Andrew Trask's article about coding a neural network in 11 lines of Python, I wondered if this could be accomplished as succinctly in JavaScript. Part of the brevity of the Python solution is the use of a common numeric library called Numpy which helps manipulate matrix mathematics. For something comparable, I rolled my own JavaScript matrix library to assist with some of the notation and computation. The implementation converges quickly on the XOR solution as represented by the box moving toward the outlined target.
Explore the solution on the newly revamped OpenProcessing website and embedded here:
20161112 Update: Just noticed this similar implementation.
20161112 Update: Just noticed this similar implementation.
20160306
Sphiral Minima
Labels:
Circular
,
Computing
,
Mathematics
1000 dots perform a coordinated dance. How many combinations could there be? It's surprising! Tap/click to advance along the time continuum (the x value is added to the timeline, so clicking near the left side advances more slowly than clicking near the right side)...amazing harmonic patterns await. WARNING: there is a naturally occurring stroboscopic effect at times. This sketch is a reduction of http://hakim.se/experiments/html5/sphere.
20150702
BlueStacks memory allocation
Unfortunately, BlueStacks tends to use a lot of memory and then forgets to cover its tracks resulting in memory bloat and starvation of other tasks. To free up memory, after closing BlueStacks, go into Windows Task Manager and on the Services tab, shut down the following:
BstHdAndroidSvc
BstHdLogRotatorSvc
BstHdUpdaterSvc
Then, on the Processes tab, right-click on the entry HD-Agent.exe and select "End Process".
On my system, this frees up 1.8GB of memory.
BstHdAndroidSvc
BstHdLogRotatorSvc
BstHdUpdaterSvc
Then, on the Processes tab, right-click on the entry HD-Agent.exe and select "End Process".
On my system, this frees up 1.8GB of memory.
20150328
Gameforge: War-Game Strategy Guide
The following advice/opinion is primarily for War Game (present level 216), but also applies somewhat to Knight Game.
Reinvest collected hourly payments and objective earnings into income production. Spend attribute points primarily on attack offensive strength and secondarily on oil(fortitude) - this helps perform assignments(quests). An assignment in Fireland requires 95 oil while later, in Hawaii, an alliance size of 973.
Realize that these games are not continuous play...after depleting resources on objectives, attack opponents, build up income production and then set the game aside. Opponents take 8% per successful attack and can be repeated several times until health is below 24.
Sometimes a higher level player attacks unprovoked. If this happens, check to be sure the opponent is not in the alliance(order). Remove the player if they are poaching.
Each player's country flag is displayed. It might be advantageous to attack an opponent during their sleep cycles.
At some levels/ranks and alliance/clan size combinations, some or all opponents may be artificial players with random names. Watch for player profiles where the number of assignments(quests) and battles(duels) won/lost are displayed as a dash (-). Also, there is no comment tab on these players. These opponents are dynamically generated for an even match up and often yield little rewards. They can be useful to bring health down below 24.
One major difference in Knight Game, is the lack of dedicated defense objects. Instead, this function is performed by Vassals, which also produce income. Tip: buy as many Beggars as possible. ALL of them are used in duels.
Additional links:
http://mafiagameapp.blogspot.com
http://www.gamefaqs.com/boards/669052-war-game/64582658
http://www.gamefaqs.com/boards/669052-war-game/64582709
Reinvest collected hourly payments and objective earnings into income production. Spend attribute points primarily on attack offensive strength and secondarily on oil(fortitude) - this helps perform assignments(quests). An assignment in Fireland requires 95 oil while later, in Hawaii, an alliance size of 973.
Realize that these games are not continuous play...after depleting resources on objectives, attack opponents, build up income production and then set the game aside. Opponents take 8% per successful attack and can be repeated several times until health is below 24.
Sometimes a higher level player attacks unprovoked. If this happens, check to be sure the opponent is not in the alliance(order). Remove the player if they are poaching.
Each player's country flag is displayed. It might be advantageous to attack an opponent during their sleep cycles.
At some levels/ranks and alliance/clan size combinations, some or all opponents may be artificial players with random names. Watch for player profiles where the number of assignments(quests) and battles(duels) won/lost are displayed as a dash (-). Also, there is no comment tab on these players. These opponents are dynamically generated for an even match up and often yield little rewards. They can be useful to bring health down below 24.
One major difference in Knight Game, is the lack of dedicated defense objects. Instead, this function is performed by Vassals, which also produce income. Tip: buy as many Beggars as possible. ALL of them are used in duels.
Additional links:
http://mafiagameapp.blogspot.com
http://www.gamefaqs.com/boards/669052-war-game/64582658
http://www.gamefaqs.com/boards/669052-war-game/64582709
20150327
Facebook video problems
Labels:
Observed
Running Facebook in the latest Chrome browser, we encountered some Flash video stuttering or choppiness during playback. To fix, see https://forums.adobe.com/thread/891337 and turn off hardware acceleration for Flash. Leave hardware acceleration enabled in Chrome.
20150213
A memorable approximation of pi
Labels:
Circular
,
Mathematics
,
Observed
One of the best-known approximations of π is the fraction 22/7. Another is 355/113 which is easy to memorize by remembering the first three odd numbers, 1,3, and 5. Next, double the digits: 11 33 55, then group as 113 355, and finally slide the 113 under the 355.
Upon examining how close the result of 355/113 comes to the real value of π, it made sense to find another memorable fraction that approximates that difference which could then be summed. Repeating the process once more yields a formula accurate to the first 17 digits of π. (Perhaps we'll name it the "Dunn Approximation of Pi" after its discoverer.)
which, when computed carefully, yields: 3.1415926535897932 762597293465706
(which is greater than π by a mere 37.8 quintillionth, or more precisely, 3.7797085963291064091099708947939e-17)
(which is enough accuracy to compute the diameter of the earth with an error of only 1 nanometer. For reference, the thickness of a sheet of paper is about 100,000 nanometers!)
Most importantly, for memorization: the second term can be thought of as 33 78 99 (then slide the first three digits under the last three, just like we did with the first term). Next, think of the final term as 10 777 (this time, invert the slide, moving the last two 77s under the 107). What remains to be remembered are the signs and the adjusting multipliers of "7" (notice there are five of them in the equation) and "12" (which is, of course, five higher than 7).
In JavaScript, the formula looks like: var pi=355/113-1e-7*899/337+1e-12*107/77;
(yields 3.141592653589793 56009 )
In Excel or LibreOffice Calc, paste into a cell: =355/113-1e-7*899/337+1e-12*107/77
(3.14159265358979 00000)
In Java:
double t1=(double)355f/(double)113f;
double t2=(double)1e-7*(double)899f/(double)337f;
double t3=(double)1e-12*(double)107f/(double)77f;
double pi=t1-t2+t3;
(3.14159265358979 05)
Upon examining how close the result of 355/113 comes to the real value of π, it made sense to find another memorable fraction that approximates that difference which could then be summed. Repeating the process once more yields a formula accurate to the first 17 digits of π. (Perhaps we'll name it the "Dunn Approximation of Pi" after its discoverer.)
which, when computed carefully, yields: 3.1415926535897932 762597293465706
(which is greater than π by a mere 37.8 quintillionth, or more precisely, 3.7797085963291064091099708947939e-17)
(which is enough accuracy to compute the diameter of the earth with an error of only 1 nanometer. For reference, the thickness of a sheet of paper is about 100,000 nanometers!)
Most importantly, for memorization: the second term can be thought of as 33 78 99 (then slide the first three digits under the last three, just like we did with the first term). Next, think of the final term as 10 777 (this time, invert the slide, moving the last two 77s under the 107). What remains to be remembered are the signs and the adjusting multipliers of "7" (notice there are five of them in the equation) and "12" (which is, of course, five higher than 7).
In JavaScript, the formula looks like: var pi=355/113-1e-7*899/337+1e-12*107/77;
(yields 3.141592653589793 56009 )
In Excel or LibreOffice Calc, paste into a cell: =355/113-1e-7*899/337+1e-12*107/77
(3.14159265358979 00000)
In Java:
double t1=(double)355f/(double)113f;
double t2=(double)1e-7*(double)899f/(double)337f;
double t3=(double)1e-12*(double)107f/(double)77f;
double pi=t1-t2+t3;
(3.14159265358979 05)
In numcalc.com with 192-bit precision:
355/113-10^-7*(899/337)+10^-12*(107/77)
(yields 3.1415926535897932 76259729346570553471632750013044648164525)
Rational approximations were explored and computed using a modified version of this tool written in Perl.
See also this visualization of π approximations.
For reference, here are additional digits of π: 3.1415926535897932 3846264338327950288419716939937510 58209749445923078164062862089986280 348253421170679821480865132823066470 9384460955058223172535940 812848111745028410
Rational approximations were explored and computed using a modified version of this tool written in Perl.
See also this visualization of π approximations.
For reference, here are additional digits of π: 3.1415926535897932 3846264338327950288419716939937510 58209749445923078164062862089986280 348253421170679821480865132823066470 9384460955058223172535940 812848111745028410
20150119
HP-16C
Labels:
Computing
,
Programming
The newest addition to the computing family here at the studio is a museum-quality specimen of the Hewlett Packard 16C Computer Scientist acquired through eBay.
Take a look at this great article titled "Long Live the HP-16C" by Valentin Albillo here.
Love this device! Of course, the HP Museum site has useful information about this and many other HP calculators. If seeking the missing manual, there is a scanned version here.
Also, Cameron Paine has a faithful simulation running on the Windows OS here. (Select the menu item View...Classic for the nostalgic visual replica.) Another version for the browser is meh.
Update 20150227:
One Voyager was not enough! We added a near-flawless HP-11C.
Additional internal data
Take a look at this great article titled "Long Live the HP-16C" by Valentin Albillo here.
Love this device! Of course, the HP Museum site has useful information about this and many other HP calculators. If seeking the missing manual, there is a scanned version here.
Also, Cameron Paine has a faithful simulation running on the Windows OS here. (Select the menu item View...Classic for the nostalgic visual replica.) Another version for the browser is meh.
Update 20150227:
One Voyager was not enough! We added a near-flawless HP-11C.
Additional internal data
20140306
Referrals
Labels:
Mechanics
Article on the imminent conversion of games to HTML/canvas (or svg!): jump
Great article on the mathematics of experience points (XP) as a progression mechanism in games: jump
Helpful tool to figure out a formula given a set of numbers (such as XP at each level up): jump
Super impressive chess program in just 1023 bytes!: jump
Great article on the mathematics of experience points (XP) as a progression mechanism in games: jump
Helpful tool to figure out a formula given a set of numbers (such as XP at each level up): jump
Super impressive chess program in just 1023 bytes!: jump
20140130
Clash of Clans Strategy Guide
Labels:
Design
,
Mechanics
,
Strategy
,
Tactics
,
Unit Operations
Below are tips for Clash of Clans, serving as guidance from level 4 onward. First, focus on upgrading resource acquisition and storage. Note that upgrading the gold mine requires elixir while upgrading the elixir collector requires gold. Be aware that operations are halted during upgrade of the mine and collector, thus sometimes it is necessary to simply wait for resources to build up before proceeding.
After upgrading the Town Hall beyond the first level, build additional mines/collectors so only one is down during upgrade. Remove obstacles to find gems. Be careful with some of the interface elements as it is easy to accidentally spend hard-earned gems. Save every gem to eventually afford a third builder hut for 500 gems.
The first 19 levels is mostly about building a solid home-base with good resource collectors, seeking opponents with weak defenses, and collecting trophies. Difficulty might be found in the single-player "Fool's Gold" and "Immovable Object" challenges...these levels require some ingenuity or additional research at the laboratory.
Build a strong defense by creating a double-wall around cannons, archer towers, and resource storage. Mines can benefit from defense protection when placed just outside the wall within range of defense units. Check that opponents cannot deploy forces within the wall...when moving an object, watch for the highlighted areas on the ground to be certain there are no holes. Lay traps and bombs on the interior and reinforce the inner wall around the secure area. (see diagram above) The interior can serve for resource storage or for housing the town hall and eventually additional defenses like the wizard tower.
When attacking an opponent, if there are undefended buildings in the corner areas, deploy a troop to each building at the start of the battle rather than waiting for the collective to spend valuable time running to every corner near the end.
The gem box yields 25 gems and recurs every 8 days (on average).
Additional strategy...
General: jump
Attack: jump
Layouts: jump
Top 6: jump
Further reading:
http://clashofclans.wikia.com/
http://toucharcade.com/2013/09/30/clash-of-clans-guide-how-to-win-without-spending-real-money/
CoC shares mechanisms found in other games: building construction (like OGame), resource collection and management (like Edgeworld), multi-player combat (like Edgeworld), clearing obstacles (like DragonVale), re-arming defenses after use (like Edgeworld), and freemium play (like Dark District).
http://www.gamasutra.com/view/news/185406/Clash_of_Clans_5_keys_to_success.php
http://en.wikipedia.org/wiki/Strategy_video_game
Also interesting are the copies of Clash of Clans: jump
Subscribe to:
Posts
(
Atom
)