Tuesday, March 8, 2022

War on Ukraine and banned weapons

As much of the world is recovering from COVID mask mandates and just watching another Winter Olympics which is supposed to "cultivate human beings, through sport, and contribute to world peace", Russia invades Ukraine, starting major military conflict in Europe not seen since World War II! It has been 10 days and already lots of casuualties on both sides with brutal attacks on civilians. The world is saddened by the totally disastrous waste of thousands of lives and leaving countless destructions and millions seeking refugess.

Waita minute just what causes this? Please someone explain this in layman's terms. According to the under reported news, the 2nd command in the free world VP Kamala Harris says:

So, Ukraine is a country in Europe," Harris explains while speaking slowly. “It exists next to another country called Russia,” she continued. “Russia is a bigger country. Russia is a powerful country. Russia decided to invade a smaller country called Ukraine. So, basically, that’s wrong, and it goes against everything that we stand for.
See here. I'll let you figure out what's wrong with this oversimplistic child-like explanation.

You can see the real reasons when you read news about their ceasefire discussions. So the real reason is Putin demands Ukraine not join NATO as he sees that as a threat. Russia wants Ukraine to not join NATO, de-militarize, "denazify". See here. And want to "amend its constitution to guarantee neutrality, formally cede Crimea to Russia, and recognize the independence of the Russian-backed breakaway republics in eastern Ukraine." See here.

Well those are not acceptible terms and fight will go on.

Russsia lost a lot of troops and military equpment (tanks, planes helicopters etc) and world wide sanctions would make it hard to fight a long war. Eventually Russia will just have to eventually give up.. after losing lots and lots of their troops. Putin definitely need to read up Sun Tzu's Art of War chapter 3 about attacking a castle like swarms of ants isn't a smart thing to do. But Sun Tzu could not dream of the devastating weapons of today 2000 years ago. Somebody in Russia need to detach Putin's nuclear button!

The Ukrainian president hope NATO to set up no-fly zone.. meaning to shoot down any Russian planes if they cross. But everyone is afraid to directly confront the most powerful nuclear power in the world, but not worried at all by providing other assistance such as weapons and humunitarian aide. And of course, the UN is useless to stop this conflict just like the League of Nations couldn't stop WWII. Uh hem, I am not saying this is becoming World War III, which I do not believe will happen. So Ukraine must fight on, NATO aren't sending troops either. But there are brave volunteers to help. Gosh and some of these brave people will probably be sacrificed.

Now in terms of numbers Russia definitely outnumber Ukraine in everything, from troops to tanks to aircrafts. So really should have no problem at all for invasion. But war is not just about numbers, it is about whether you get support from your people, resources allocation and transportations, will to fight, and geography and tactics. And about technology too. A drone with bombs can affectively kill many of you and you can't even detect.

Now the weapons, Russia of course face criticism of using devastation banned weapons like vacuum bomb and cluster bombs. Vacuum bombs pretty much fill a big area with gas and then blow up! No place to hide, it will tear your lungs and entire body apart. Cluster bombs contain little bombs with parachuts that don't blow up immediately. It can be discovered years later and blow you up. So they are "banned". Horrible horrible devastating weapons on civilian. But waita minute, is it not so horrible to shoot civilians with AK-47 and grendades? Geez, STOP KILLING CIVILIANS or STOP KILLING ANYBODY!

This horrible conflict will definitely end, just as every other conflicts. It will leave behind endless pain and sufferings and a new world. Putin will definitely lose. The world will not be the same again.

Wednesday, February 16, 2022

On Flutter

Flutter is Google's multi platform development tool. Mostly it is used to develop cross platform mobile apps.

That is, you can have one code base and can make your app runs on both Android and Apple. Although this isn't the only tool in town to do that I decide to learn this as it looks straightforward and provided by Google.

First it uses it own programming language, Dart. Waita minute just why another language? Does the world have enough languages already? Well nowadays every company likes to create its own language as that frees them to update it anytime they want. It is OO and java like... so learning curve should not be so steep. It can compile to native or can compile to javascript so it runs on browser. Well I am interested in mobile development for now.

Now, to use Flutter, it makes sense to get the official IDE Android Studio for developing for Android. And you may follow the documentation to generate project using a CLI to get started. Now this Dart programming is NOT typical Model-View-Controller web development pattern... in which you separate logic (java or whatever language of your choice) from presentation (html/css). The UI and event handlers are all bundled together. UI isn't as simple as HTML. It will look mouthful and clumsy to build an UI. Good news is there is plenty of documentation and examples available. And look at the gallery. It can do beautiful stuff and has a lot of potential.

When you generate a skeleton project (I like that). Note your source folder is in "lib". This is weird because for java and many other tools it is libraries not to be messed with. The flutter dev site is a good place to start.. and if you have LinkedIn Learning (there should be some free trials) check out the video lessons which may be helpful to you to get started.

UI

Flutter/Dart UI is not wysiwyg like a Windows Form. There is no dialog designer that you drag and drop things and get a resource ID like programming in Android SDK. You must handcraft your Dart UI components (textboxes, buttons, etc). Every image asset needs to be declared in the tab sensitive YAML file, which also act like a Maven pom.xml to declare your dependant libraries.

Stateful vs Stateless

And if you want some widget that basically does nothing after it is created (such as say "Hello World" text), you need a stateless widget. If you want it retain some state, such as a lightbulb component in which you click it and remember it is clicked, then you will need a stateful widget. A stateful widget needs an override to "createState" that returns another clsss that extends State with your Widget as the parameter (yes, confusing). Every moving part (state) is a variable that you can update within a setState() {} block.

Function Plotter revisited

I want to build something more meaningful then some HelloWorld. I have done a function plotter in many languages: Delphi/Java/Javascript and I decide to port it. And, I want to make it more powerful than your Texas Instrument, with ability to pan around, and pinch zoom and out.

For this, I'll need a CustomPainter, and GestureDetector, and I need a math expression parser. There are all sorts of odd things I came across to get it to work. It needs to be carefully nested to work. I also have a config dialog which also take a while to get right. It needs to be stateful dialog of its own! Because it needs state to reember checkbox choices and error message when re-rendering. And I cannot complete this without helpful people on StackOverflow helping with odd issues I faced.

and whoa, it can run on chrome without any even rebuilding. On project folder: flutter run -chrome. This is neat.

It is a bit weird and painful to get started but I learned a thing or two in the process... Later I may put it on Google Play...and maybe even Apple Store.

Friday, February 11, 2022

Mobile App Relaunch Ahead

More than a decade ago I followed examples from a Wrox book and created my first Android program on Android Froyo and Gingerbread. Then later on I published several apps on Google Play. I had several hundred downloads! Nope they are no longer there. These old apps no longer work because you will be greeted by message saying it is too old to run on your modern phone. The dot-dot-dot menu is gone so screens (activities) won't be able to launch.

The apps on Developer Console needs constant attention. Need to declare status, ratings, etc, or require more graphics etc. Don't want to bother? Boom removed by google. That's perfectly fine. They were just my experimental apps.

After some time I simply give up updating them. I don't have many new ideas for apps anyway.

They were written in Java, on Eclipse, using the Android SDK. It was fairly straightforward. You get a little form designer, add some widgets and get a constant for each widget.. and you can hook up listeners to react to button clicks etc.

Fast forward 10 years. Android SDK programming still remain mostly the same. But nowadays just about everybody despise Java and Eclipse and fall in love with Kotlin and IntelliJ. In fact, the Android Studio is based off of IntelliJ.

But the problem is still this: more than half people use iPhone. How can your awesome Android apps run on them?

Of course, you can ditch Android SDK and go with HTML/javascript. There are at least several options for that: Cordova, Ionic. Or you can even go C# with Xamarin, or go with React Native (and gosh I hate React).. and gosh, so many options. (just google "cross platform framework").

But I want to try something from the giant google... and that is Flutter. Its Gallery seems dazzling and seems like plenty of resources. to learn from.

I decided to make my apps shine again, modernized AND running on iphones. More on Flutter later. Basically you can toss your HTML/CSS out the window.

Thursday, January 6, 2022

To Vaccine or Not Vaccine

It is 2022 already and Covid-19 is still with us. At of this post there are more than 850,000 Americans dead. Yes we all live in fear in 2020 as there is no cure no vaccine, but now there is. There is endless arguments regarding the COVID-19 vaccines. Some simply won't take it and even go so far as saying "over my dead body". Some are ok with vaccines but just not ok with the mandate as that restricts their freedom they say.

There are many outspoken anti-vax people like radio hosts, pastors and government officials dead already by Covid.

Just why are some people so anti-vax? Here are some arguments:

  1. Vaccine come too fast, can't be trusted.
  2. I got covid already I can fight it off
  3. It turn you to zombie and there is liquid microchip!
  4. I can fight it off
You need to trust medical experts on the effectiveness of the vaccine. You ain't smarter than them. And look, experts say you can get it again even if you had it already so you need the vaccine to protect you. Again you ain't smarter than the experts. Don't get me started on absolute idiots who try horse deworming medicines. For those who think there is microchip and stuff, prove it! For those macho musclemen who think they can fight it off look at testimonies of those who are even stronger than you get it and some died. You ain't more macho then them.

Look if you don't get vaccinated the virus will get you. Simple as that. Idiots say should not let children wear mask as childrens less likely to get it. Dude: one child die is one chld too many to such idiots.

Now, the Chicago Public School teachers refuse to even teach as they think the classrooms are risky. I don't blame them. But the CPS retaliate by not letting them teach online so they don't get paid? This is nuts the kids need to learn something! To stop the cases people need the vaccine. Yes those who get vaccinated still get Covid... but at least fewer of those are jamming the hospitals. The vaccines are the best defense now. Go take it. All of your lame reasons have been debunked.