Wednesday, October 10, 2018

"1984" Quote applicable in today's programming world

You may have heard of this famous 1984 novel with these quotes:
war is peace
freedom is slavery
ignorance is strength

This are remarkable quotes in that world because these are totally opposite in the logical world but not in the brainwashed world... and are we in such world? See https://www.enotes.com/homework-help/novel-1984-what-do-3-slogans-mean-201861 for more explanation.

Now this world is totally applicable with this javascript thing called "redux".

Don't be fooled by all the fancy talk about reducers, middleware, store enhancers—Redux is incredibly simple.
See https://redux.js.org/basics. This is incredibly verbose ugly syntax and wacky terminology and you call it simple. This idiot reducer isn't reducing anything. Revolt against tyranny is what people should do!

Transforming XML

Suppose you have an XML file with your favorite data, such as your CD collection
<catalog>
  <cd>
    <title>Greatest Hits</title>
    <artist>John Doe</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
  </cd>
  <cd>
    <title>Favorite Songs</title>
    <artist>Mary Doe</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>9.90</price>
    <year>1988</year>
  </cd>

</catalog>
How do you change it to the following in HTML?

My CD Collection

Title Artist
Greatest Hits John Doe
Favorite Songs Mary Doe

Sure you can write a little program,in java, for example, to use one of the many fairly-difficult-to-use XML library to turn it into an object then rewrite it in html. But there is an perhaps easier way. You can just transform the XML into something else, like HTML. This is actually a very old problem, and it is called XSLT... That actually is tricky to get right, and hard to come up with entirely by hand. Gotta give credit for those who put good tutorials. https://www.w3schools.com/xml/xsl_intro.asp.

Tuesday, October 9, 2018

Think you know Javascript?

Javascript are now way more than little functions that let you change something on your page. What happened to its once simple syntax. It used to be simple and free you from variable types and semicolons.

Here are some never things I never heard of before... gee how are you supposed to keep up with endless changes.

Look at this dot-dot-dot thing that turns an array into individual argument: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

What the heck is this function * thing? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function*.

oh and you can have a void operator?