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.

Monday, November 27, 2017

Microsoft hardware

So I visited the Microsoft Store to check out its latest products... the Surface laptops that rivals Mac things. Now I am NOT a Mac fan, especially its wacky wacky interface. But the Mac laptops do look good. I just hate its interface but on the outside Macs are good looking.

Now back to the Windows machines... are they good looking? Yes they are thin... but there are something that makes me think they don't look as good as the Macs or Dells. Maybe the color and stuff... just doesn't seem to look right. And yikes, they ARE expensive. Really no good reason to buy Microsoft machines when you can buy a decent Dell or HP for a lot less.

Look at the new Microsoft arc mouse.

Wow you can even flatten it (I didn't know). But it doesn't scroll nicely as any cheap mouse. This is almost 80 bucks.

Look at this dial thing

You can hit it and bring a wacky radial menu... sorry, this-is-absolutely-useless and this is almost 100 bucks. Maybe it can be used to play Atari Breakout or Arkanoid.

So I think Microsoft things are still too expensive for its attractiveness. Windows's only edge over Mac is its more intuitive interface. But yikes its shell is not as solid as Mac's linux within... and much more prone to virus. (I do NOT surf the web in Windows). Yikes Microsoft things like Office costs extra money when people can go to google docs... So I am afraid Microsoft is losing its strong foothold.

Cyber Monday is useless for me

Ohh Black Friday! Oooh Cyber Monday! Some pople go crazy over the shopping days following Thanksgiving. Sure if you need a huge screen TV this is the time to buy... but I don't. My trusty probably-thicker-than-yours TV is still functional. I do not need a newlaptop now.

But here is what I need: incredibly expensive INK for my printer.

My HP inkjet thing needs EXPENSIVE ink. A pack of ink runs out maybe about 100 pages. Bullshit bullshit information found here that says ~1400 pages. Yet everywhere is same. I looked at Amazon, Staples, etc no one offer any sales on these ultra ridiculous expensive inks. Just how come ink are that expensive? Ok some answers here.

Monday, November 20, 2017

Full of bad dudes

This guy groped women's butts.

That guy groped women's butts.

Even George Bush 41 did. Bad dudes dominate headlines lately.

Well it is complex over there at Hollywood... but for even for people who run for government posts who "stand for Christian conservative"?

And there was even a "pro-life" guy who seek abortion for the affair he had.

What the heck is going on here?!

There was even guy running for governor who bragged about sex history. uh hem, that's actually shame-on-you adultery history.

These SHAMELESS BAD DUDES ought to be a shame of themselves, but problem is... there are still people who support these shameful beings... now that's even more shameful.

Well, is there good dudes out there? Probably there are. but those good dudes don't have supports needed to win elections. America is in such shameful disgrace even the president bragged about "able to do anything" in that "locker room" talk and still win.