When using variables in VBA (or any language) eventually every coder will have to make some choices on which type of variable to use for numbers.
The common practice is to either use Integer, Long, or Double (I never bother with single). A quick recap of each of these is that:
Integer uses less memory (2 bytes) but has a range of numbers of -32,768 to 32,767, and does not allow decimals (by definition this is what “integer” means in all programming languages).
Long uses double the memory (4 bytes) but the range of numbers is exponentially–2,147,483,648 to 2,147,486,647 (that’s 2.1 billion vs. 32 thousand on integer). Whole numbers only.
Double is the go-to variable if you may have something over 2.1 billion or if you have decimals. However its overhead is 8 bytes. The range of numbers is massive but Excel can’t handle anything over 15 digits, so it’s always seemed irrelevant to me (in case you care, here’s the supposed range: – 1.79769313486232E308 to –4.94065645841247E–324 or 1.79769313486232E308 to 4.94065645841247E–324
One other variable worth mention is:
Byte is a hardly used variable that can return a whole number from 0 to 255, and only uses 1 byte. Interestingly, this is less memory than a Boolean variable (true or false), which uses the same memory as Integer. It’s tempting to consider using Byte for small numbers to save memory. However, it’s not recommended for reasons I’m unclear about.
What brought this to my attention was an old StackOverFlow post that details how Microsoft claims that they shift all VBA variables from INTEGER to LONG, which essentially nullifies the benefit of EVER using INTEGER.
“In recent versions, however, VBA converts all integer values to type Long, even if they’re declared as type Integer. So there’s no longer a performance advantage to using Integer variables; in fact, Long variables may be slightly faster because VBA does not have to convert them.”
I decided to conduct the VARIABLE OLYMPICS by timing how fast a basic macro ran, but with different variable types.
The results align with what Microsoft says, in that it probably makes sense to just use LONG instead of INTEGER in pretty much every case.
My latest contribution to the Google Chrome Store I think is the most broadly useful tool I’ve developed. It allows you to execute searches on multiple websites at the same time. This can be useful if you frequently search sites like Amazon, Walmart and Target for the same thing such as “Tables”. With this extension you just punch in what you want, and it launches searches on the websites you setup.
This is a GOOD thing and one of the primary reasons I was enthusiastic for Ethereum long before its existence. Private currencies are a great step forward for decentralization. There are almost 500 ERC20 coins now in use on the main network, several with interesting concepts. By next year I bet we see over 2 thousand.
Now the question for the world is… which currency do you trust?? Here’s a hint: currencies that say “In God We Trust” or are named “Doom Best Coin” probably shouldn’t be at the top of your list.
One of the most exciting components with Ethereum is the Augur project, or as I call it, “The Bet on ANYTHING” market!”
Yesterday the project released an updated White Paper found here. The technical details are not for most people, but what is exciting is being one step closer to the possibility of two strangers on the internet being able to place trustless bets on almost anything!
The word “betting” has a negative emotion attached to it in American culture, but being able to assign personal stake in prediction models is incredibly valuable. Indeed it is perhaps a much-needed component in our political system.
As I type this, one of the most hated presidents in American history is addressing the nation in a Statue of the Union. The internet is filled back and forth rage about who is “right” and “wrong”. As the fury between two groups grows, perhaps the ultimate test for the truth can be found if the two opponents can form an agreement of what their disagreement is, and bet on it.
Consider how this could be used in economic debates in uncovering the truth. Politicians (particularly in my home state of California) are incredibly dishonest at presenting understated costs of projects to voters around elections. Augur presents an option to expose what politicians truly believe:
“Do you really think that this project is going to be under what the budget states? Let’s bet on it!”
“Do you want to bet if this is going to truly be a temporary tax?”
Additionally, consider how this tool could be used to hold a politician at their word. During a campaign, candidates could leverage this tool to offer promises to voters: “I’m Joe Nobody running for US Congress and I will not vote in favor of any budget that is not balanced, and I’ve placed a $100,000 bet to assure this in the Augur network!” Such a statement would be much more meaningful than the standard “I promise, I’m a good person!” assurance we get from current candidates.
Hopefully, this goes live soon. Here’s an older video showing its possibilities from 2015:
Cryptocurrency Monero has made some noise recently with its ability to mine on websites, sometimes without user consent. While this probably sounds unethical (which it is), the opportunity to leverage user CPU power as an incentive to visit a website instead of advertisements is an interesting concept.
While I’m still kicking this idea around in my head, does this make Monero potentially the most stable currency option? Measure users’ CPU usage as a function of time?
While you think about this, please see the below is an example of mining using your consent. Please click “start mining” this and leave it running for the rest of your life.
If you’re interested in seeing a less ethical example, checkout this fake page I made that looks like it’s giving VBA advice, when in reality it’s hogging your CPU. Be on the lookout for stuff like this if you’re browsing. If your laptop starts to takeoff, because the fan is going so fast… you may be on a Monero mining website!
I do not like what cryptocurrency Ripple represents, but I do see it as potentially a middle ground, that delays central Bank’s march towards irrelevance. In 2018 as their proof of concept gets rolled out, I can’t imagine that XRP price (currently at about $1.25) doesn’t grow considerably. I’m still a Solidity Coder and Ethereum warrior, but I’m throwing a little in Ripple just because it seems inevitable to grow in value, particularly against the doomed dollar. Always be careful when buying crypto and there are no sure things… yada yada.
I thoroughly The Art of Learning, particularly the first half that explores the cerebral journey found in learning/discovering/troubleshooting. The backstory to this book is author Josh Waitzkin was thrown into fame as a child prodigy chess player. The book/movie Searching for Bobby Fischeris written by his dad (I just recently watched and also highly recommend). Around age 20 the author grew disenchanted with chess (likely due to the huge popularity of the movie) and made the abnormal shift from chess to martial arts. The book describes this journey, how there are similarities, and his approach to learning and mental tenacity.
Three points stuck out:
It’s wrong to tell children “it’s just a game,” when they’re experiencing a loss. This is typical behavior for parents with competitive kids that don’t perform well during big events. If it didn’t matter, then why did they train so much and travel far for something that doesn’t matter? Children know this and it’s disingenuous to tell them their efforts were meaningless. At the time of this writing, Jim Carrey has been making waves saying how “life doesn’t matter.” This is an incomplete statement as it’s not saying who/what is experiencing the matter. Life may not matter TO YOU or TO THE UNIVERSE. But certain things trigger pain and joy– thus some things do matter to people regardless of the significance to others (BTW, I semi agree with Mr. Carrey’s message besides this flaw, maybe I’ll chat about that some other time).
Sometimes the subconscious sees something before the conscious mind does. I’ve experienced this when looking at a coding, or logic problem at work. Sometimes there will be a small flicker that you can’t explain, but you get a hunch that there’s something there that should be continued to explore. I’ve had this sensation on many occasions and have grown to listen very carefully to my body whenever I “feel” like there might be a solution hiding right in front of me that I havent’ seen yet.
The book details an experiment between two types of learners — Entity and Incremental learners. It explores how some children who believe they are smart by innate ability (entity) are less resilient to problem-solving after they are stumped than incremental learners. The study consists of giving kids a problem beyond their capability to solve, so they all fail. Afterwards, they are tested on a problem within their skillset and, predictably, the incremental learners did better. This study was referenced in the book The Fighter’s Mindwhich inspired me in to read The Art of Learning. This illustrates the biggest conflict I feel as a parent — forcing your kids to struggle/suffer is the one of the most effective ways to make them resilient, confident and able to live a healthy life. At the same time… what parent wants to allow their kid to suffer?
Last night I had to evacuate my family in the middle of the night due to a fire. As a former resident of San Diego, where fires are common and specifically a product of the Scripps Ranch High School class whose families were greatly impacted by the historic Cedar Fire, I have always considered fires a real threat. Thus the evening events went semi-predictably for a chaotic event.
At about 8PM after putting the kids to bed, I noticed some incredibly strong winds. I went out to see if a tree might be in danger of falling on my house. I also noted the unusual fact that there wasn’t any clouds in the sky. This indicates dryness, which, when combined with the wind, is a practically a given that a fire is going to break out.
At about 9:30PM the wind continued to alarm me as unknown items fell outside and a few even smashed into the house. I secured a ladder that had been blowing around and brought in anything that could be blown in a dangerous manner. I distinctly remember trying to smell for any signs of a fire, and I did not.
At about 11PM I emailed my father noting the intense wind and lamented the potential danger of a fire or falling tree.
At about midnight, power became intermittently out. Again, no smell of smoke to me, even when I went outside.
I went to bed about 1AM but never feel asleep (a problem for me lately).
At about 2:30 I was alerted of a fire. Going outside, the smoke was unmistakable and a bright orange glow was off in the distance. Most disturbing was that the wind was blowing directly from the direction where the fire was, putting us right in its path. Other neighbors were out with everyone ensuring that everyone else was aware of the issue (nice to know people do that in times of crises!). I began to execute the “GO PLAN”, which really wasn’t too sophisticated, but I had a short list of immediate things to grab.
My kids wokeup before I intended to grab them due to the commotion. I showed them the fire and they behaved as one would expect a 4 year old and 6 year old. Excitement. Nervous. Small fits of panic. Fighting over who gets what color flashlight. However, by and large, they were cooperative and “calm enough.”
At about 3AM with kids in the car I left the house. No more than a minute into the drive, I filmed the below video and posted it on Youtube. I make quick videos like this pretty frequently mostly for the kids to review when they are older, but I rarely publish publicly. However, for this one, I’d gotten two funny replies from both of them, so I decided to share with the world. I didn’t realize it at the time, but of course filming children while escaping a wall of fire while they amusingly talk about “Freaking out!” and “Saving Kitty” is click bait if there ever was any! So it got some views pretty quick.
Later in the day a guy from ABC Media messaged me asking for permission to use the video, which I granted. He also put me in touch with some guy from Good Morning America. The GMA rep was nice enough, but when he heard I didn’t have the kids with me for an interview, I was written off as boring (EVALUATION = TRUE!). I was also pretty nonchalant about my escape to (“no our shoes were not melting or anything interesting…”), so he looked for a more interesting story — which, tragically, there were plenty of.
Anyway, what was interesting about the YouTube post is that I got a bunch of dislikes early on. Strangely a video I made about a year ago equating Donald Trump to “Mr Punish And Enslave” and Hillary Clinton to “Mrs. Corrupt” has NO dislikes! The nature of the video is politically neutral and addresses the inoffensive topic of Instant Runoff Voting, but not a single dislike a year later, while my children evacuation video has 6!?? I’m guessing it’s because I said I’d “cut some people off” and mocked the “Texting and driving laws” although I intended to point out that I wasn’t sure if filming and driving was illegal (I keep meaning to check if writing a letter while driving is against the law!)
The final curious observation with Youtube was the comments I received. About 80% were very nice and wished well. However, there was a noticeable number of individuals who made the creative assertion that the peril I was facing was a direct result of me failing to attend their church, an evil conspiracy from a GMO corporation, or because the government was using Chemicals to poison people. Youtube intelligently filtered most of these and requested I grant permission before posting (I approved the anti-government one… I figured his heart was in the right place!).
Anyway, it’s now about 36 hours later: While I haven’t returned, I’ve heard several reliable confirmations that my house/street survived.
However about a mile away there appears to have been some pretty heavy devastation. Specifically, a trailer park got decimated and 10 people died which is only about 1.25 miles from me (I run by it, hence the accuracy).
In general, this is looking like it’s a pretty serious event for my small town. Lots of damage. Looting apparently has been an issue too, which is sad, but predictable given the nature of some people.
I’m in no rush to return to a city with a spike in crime, bad air, and not a lot of immediate resources like food and water.
Tragic that some people lost their lives. Unimaginable to think about the victims or what the people that knew them are going through.
Thanks for the kind wishes for all that sent them. Thinking back, I don’t think I did anything special. From a numbers standpoint, I’m guessing about 99.99% of grownups that were in my situation with children would have gotten away unscathed. I did remember to bring a couple key travel items, but overall just another day of #DadLife!
As the US National Debt zooms passed the $20 trillion milestone this month, I thought it would be a good to recommend a book that I enjoyed when I was little, How Much Is A Million? This is a great book for little kids to illustrate how big some numbers are. Frankly, it’s a good book for grownups to read too.
Quick… without cheating, take a guess at how big these figures are:
How far would 1 billion US sized dollar extend if they were lined up like a road?
How long is 20 trillion seconds?
Answers are at the end, but suffice to say these big numbers are hard for grownups to fathom, and little kids don’t do much better.
In 2008 Hillary Clinton tried to backtrack on her claim of being under sniper fire by saying. “I say a lot of things — millions of words a day — so if I misspoke, that was just a misstatement.”
Ignoring my favorable or unfavorable opinion of the former first lady, this really bugged me. Here she is talking about misstatements, and then says something, from a numbers perspective, that is completely absurd! Taken literally, this would mean that she speaks more 23 words per second all day long. Even if you don’t know exactly how many seconds there are in a day (86,400), I would hope that you know there’s less than a million!! And the fact that she said millionS. Somebody get her this book!!!
Answers to the questions…
1 billion dollar bills would stretch around the world — 4 times (97 thousand miles).
20 trillion seconds is a really really long time… 634 thousand years.