I’ve been meaning to get my thoughts down for quire some time.
Mrs. ParrTech and I went to Vegas last year for our 30th anniversary. After having visited Vegas many times previously, I was completely disappointed, and here’s why.
Miscellaneous
I’ve been meaning to get my thoughts down for quire some time.
Mrs. ParrTech and I went to Vegas last year for our 30th anniversary. After having visited Vegas many times previously, I was completely disappointed, and here’s why.
I looked up how to count the number of Sundays between two dates…. the so-called answer shocked me. There are a couple of popular answers, but they are horribly inefficient.
Let me show you a better way…..
Update 4/22/2025
Due to a severe copy and paste error, the formulas were completely wrong. 8-(
These have now been corrected.
Let’s say we have the following cells:
A | B | |
1 | Start | 1/1/2025 |
2 | End | 5/1/2025 |
3 | Which Day | 1 |
We will follow the Excel convention, where Sunday = 1, to find the number of “1” days (cell B3) between 1/1/2025 (cell B1) and 5/1/2025 (cell B2).
Between the two dates:
=INT((B2-(B1+B3-WEEKDAY(B1)+7))/7)+1
Correctly returns 17
Between and including the two dates:
=INT((B2-(B1+B3-WEEKDAY(B1)+7))/7)+1+IF(WEEKDAY(B1)=B3,1,0)
Correctly returns 17. If we were to change B1 to 1/5 (a Sunday), the result would be 16 without the extra IF term.
For a more detailed explanation…
Update, 5/14/2023: Version 3.2
Update, 5/11/2023: Version 3.1. Original: Version 2
I wrote a javascript calculator while I was waiting for something the other day. Here it is:
Permalink: Here
Technical Details
To Do
(Updated, 5/11/2023)
Funny Story about 3.1 vs 3.2
I uploaded version 3.1, and patted myself on the back for having done such a great job. Right-click, save as HTML, fire it up in Chrome, and…everything was rendering twice.
What happened??
The UI is dynamic, but the saved version of the page had BOTH a static copy of the dynamically-generated HTML, as well as the javascript code to dynamically generate the HTML. So every UI element was rendered TWICE. Worse, if you modify the Javascript at the top of the file to alter the constants or the display size, you would have one copy that’s correct because it’s dynamic, but the static copy would still be wrong.
Interestingly, if you View Source and save from there, it won’t have that problem, but that’s not what I was after.
To fix this, I changed from document.write to using extra SPANs for each block of UI elements, and setting innerHTML. Despite the fact that saving the file includes a static copy of the HTML, the dynamic code simply overwrites it each time the page is loaded. So if you change a Javascript variable and reload, the dynamic code blows away the static HTML and replaces it with a correct version.
Do you like it? Feel free to copy it. Click the permalink. Then right-click the calculator, and select “Save as html”.
Ideas or suggestions? Please feel free to leave me a comment.
After 7 months of continuous issues, I think I finally beat the problems with the front gate, but the way I did it might surprise you.
Why did the quantum chicken cross the road?
Why did the quantum cat cross the road?
As a follow-up to Monitor and TV Buying Guide – 2022, I built a simple calculator to tell you the approximate width and height of the screen, given its diagonal measurement and aspect ratio.
Permalink: Screen Size Calculator
In 2015, I wrote this post: Justin’s Rules for Buying a House.
These were things that I had learned when I was shopping for a house in 2002, and solidified in to a tangible list when a couple of friends of mine were house shopping in 2015.
After shopping for a house in 2019 and moving out to the country, here are a few more things I’ve added to my list.
Updated to v1.2 on 1/3/2023.
Although it’s widely agreed that field-level data encryption provides the best protection against data breaches, it also limits an application’s ability to perform ranged searches, where an inequality comparison is performed against search terms.
Although there are existing strategies which use search trees, these depend on complex key management schemes, or trees with fixed intervals.
Another common approach is to assign artificial search keys, but the general problem with this approach is that it can result in information disclosure as well as key collisions. If the keys are regularly-spaced, this can lead to an inference about the underlying data values, and if the spacing is too narrow, this can lead to insufficient search keys when presented with a large quantity of data values for given key interval.
In the scheme proposed herein, a binary tree is used to generate integer search keys, called comparators, that are non-sequential but maintain the same ordinal relationship as the underlying data. Because comparators have no fixed relationship to each other, they don’t leak any information, but because they maintain an ordinal relationship, they can be searched with a ranged query.
Click here to view or download:
I’m sure someone has stumbled upon this before, but I thought I would share a revelation I had while working on a technical issue.
To get to the 404 page for any website, go to:
[website]/404
Unless the website in question specifically has content published at the path “/404”, you’ll get the 404 (not found) page.
Some examples:
For some reason facebook.com/404 redirects to some person’s page – not sure if that’s intentional, or maybe a sly back door left by a clever developer.
We moved in 2019, and the new house has a gate opener. After three years of loyal service to us, and who knows how many years of service to the previous residents, it finally died.
After some troubleshooting, I called Mighty Mule tech support (A+ by the way!) to discuss my options.
Faced with a cost of $350 for a new controller board for my now-obsolete MM560, or buy a new MM571W for about $100 more, buying a whole new unit made much more sense.
Here’s the full details of my troubleshooting and installation efforts: