Thursday, January 18, 2018

Amazon 2nd headquarter suspense

So now Amazon has a finalist list of 2nd headquarter and just have to keep you in suspense.

http://www.chicagotribune.com/business/ct-biz-chicago-amazon-finalist-h2q-20180118-story.html.

This is huge. If your city become 2nd headquarter the real estate market will go to the roof. Thousands of talented people will flock to that city and buy up all the apartments. This means: if you buy a crappy one now and someone will want it and you make instant money right there. Real Estate buy-sell can earn you money that takes years and years to make. But that's only when Amazon choose your city or you still have a crappy house but eventually you will probably get a buyer.

Is Chicago going to win? There are better cheaper places with less violence and also warmer. Ooh Amazon coming meaning jobs jobs jobs, well ONLY if you know a thing or two about AWS I guess. Why does Amazon give you a finalist list and not tell you result right away? It is a long while.

Tuesday, January 9, 2018

HTML input type=number

HTML5 gives you a lot more input types. Well you may be required to support browsers that does NOT support it, well that's too bad.

Suppose you want a field that you want to only limit number, like a quantity field, phone number field or a credit card number CVV field, you can you input type="number".

https://www.w3schools.com/html/html_form_input_types.asp

Well this thing will give you annoying up/down arrow. Make sense for a quantity field, but not for a phone number field ok? Good news: CSS can hide it.

Since the dawn of HTML (I think) there is a maxlength field on the input type="text" but it won't work with "number"! so you can't put a maxlength=10!

Here you can play: https://www.w3schools.com/html/tryit.asp?filename=tryhtml_input_number Ah, there is "min" and "max" property for input type=number. BUT IT DOESN'T WORK. You can type more than 5 in Chrome, for instance. Firefox give you an error when you hover but you still can type. So I can't make it min=1 max=9999999999 if I want a 10 digit max.

Fortunately some CLEVER DUDES figured out how to do this.


<style>
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}
</style>

<input name="phonenumber"
oninput="maxLengthCheck(this)"
type = "number"
maxlength = "10"
min = "1"
max = "9999999999" />

<script>

  function maxLengthCheck(object)
  {
    if (object.value.length > object.maxLength)
      object.value = object.value.slice(0, object.maxLength)
  }
</script>
Well a number here is not whole number, but it can take decimal point too, it even takes more than 1 decimal point. and that decimal point is still annoying... there are people who use keypress event to limit 0..9 only but may not work on some phones.. oh there is the pattern attribute, but does not work! https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_pattern (it took more than 3 letters for me in Chrome)

Book Fury

Oh wow, a book about the Trump White House has been center of attention.. and now that's Fire and Fury.

https://www.washingtonpost.com/news/post-politics/wp/2018/01/07/white-house-adviser-stephen-miller-calls-bannon-an-angry-vindictive-person-over-comments-in-wolff-book

Of course Trump's fans will say Fake News Fake Book... and Trump has to defend his own sanity: tweeting he is "stable genius"

Now, this guy is a billionaire and have towers named after him. Not many people else can. Ran for president with 0 experience and still win beating all odds. Is it really his genius or voters' not-so-genius? No genius would brag about his nuclear button when the Koreas agree to talk.

Well I haven't read the book and of course Trump supporters will of course deny everything in there if anything negative about Trump. Americans now cannot tell what is true and what is false.

But denial can only get you so far... until real actual truth come in. But can truth prevail?

Ok, Democrats are now seriously looking at the 25th amendment to remove Trump and find a way to remove him through impeachment. Forget it! Not until the mid term election give you more democrats.

Now, if D > R, you get Obamacare, if R > D, you get endless attempts to try repealing of it. if D > R, tax the rich guys! if R > D, tax relief the rich guys!

Is cycling back and forth a good way to run a country? I guess still better than dictatorship.

This certainly is an interesting chapter in American history. An even more interesting chapter if Oprah runs and wins in 2020.