Monday, December 28, 2015

Visual Studio revisited

I have a chance to be on a little C# project on Visual Studio 2015. The last time I really used it for a living was pre .NET. However, in 2009, I even landed on a .NET job I don't get to do .NET code and soon went back to java in another job. Visual Studio has changed quite a bit and still remain recognizable. Visual Basic STILL does not have multi-line comments!

Oh my, look, now it is cross platform, even for mobile. You can theoretically even do native phone apps on Android and iOS? (haven't really tried yet) https://www.visualstudio.com/en-us/features/mobile-app-development-vs.aspx and now .NET things can run on Linux? http://techcrunch.com/2015/04/29/microsoft-launches-its-net-distribution-for-linux-and-mac. Finding that hard to believe. That DLL stuff can be run outside windows nowadays?

Here is some annoyance. When the code is running the Solution Explorer just goes away hiding even if you pin it. Look I want to just see what code am I running. And if I want to edit the file? Boom an Msgbox comes saying you can't. Come on, just edit, not run. Nope, can't. But it is a snap to run with the VCR play button.

SQL Server and its left-hand-side explorer tab still feel strange as ever. You can probably use another db with Microsoft things but perhaps just very difficult. There is even online version of Visual Studio now. wow you can do team chat and even task/bug tracking that other people usually need multiple tools for.

This Model-view-Controller thing is just like what people typically do in Java (as in Spring MVC). Now there is odd Razor thing which looks much like the pre .NET old ASP. http://www.asp.net/web-pages/overview/getting-started/introducing-razor-syntax-c

I need this Visual Studio because I'll be dealing with SignalR.. some push pull thing http://www.asp.net/signalr, based on WebSocket of HTML5. Can I use java with this? theoretically yes, chances are this would be a bit painful. So as always... Microsoft things may work well but you have to put up with any annoyance that you don't like, and you got to use Microsoft for everything. And when they change often and you have to follow them along all the time, probably paying big money along the way.

Have a chance to use a different tool is a good thing for life as a programmer. But people make more money than me just by talking about programming don't have to touch anything.

Wednesday, December 16, 2015

Interesting prime

Came across this article about interesting numbers here.

Oh, learned something new today, the Belphegor's prime number.

1000000000000066600000000000001

Ooh 666 in middle! 13 0's to the left, 13 0's to the right, and bookended by 1's.

I am not going to bother testing rather this is real prime or not (it sure should be). So high school students write little program that test if an integer is a prime? Well this is an integer that too big to fit in your little int types. See, computer integer are not really the mathematics integer.

Download an image locally

To copy any image you want that you found in internet, sure, right-click save-as. But what if you have a ton to do?

You can write a little java program. Boy it takes just 3 lines (or less if you jam everything in 1). These Files and Paths things are in java.nio.file package.

 public static void downloadLocalCopy(String localFile,String urlString) {
  try {
   URL url = new URL(urlString);
   try(InputStream in = url.openStream()){
   Files.copy(in, Paths.get(localFile));
   }
   
  }
   catch (Exception e) {
   e.printStackTrace();
  }

 }
Sample usage: downloadLocalCopy("mycopy.png","https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png");

Yes, this came from a stackoverflow post.

Tuesday, November 17, 2015

A first look at Knockout

Here is another javascript library similar to Angular. I have heard about this for years and now getting my hands on it. This thing is pretty cool with its data-bind thing.

Excellent example from: http://www.knockmeout.net/2011/04/utility-functions-in-knockoutjs.html So you bind attributes with variables and get auto refresh and set observable things. Yes, it may be hair pulling if something not done right.

Changed the example above to something simpler.

Name Country
Add Item

Filter display by name

Filter:

Filter display by country

Filter:

Find first match by name

Search:

Tuesday, November 10, 2015

Starbucks, Trump, Merry Christmas

So Trump talks about boycotting Starbucks over the cup design.

Look, Starbucks can put whatever design it likes on its cups. Whose business is that? It is perfectly ok if they don't put Merry Christmas on it. Put "Happy Holidays" on it, or whatever. He did say "who cares".

Now, just what is the big fuss about "Merry Christmas". We don't force you to say Happy Budda Birthday right? (and that date varies, some time in May). Actually nobody has a clue exactly when Jesus was born. (I mentioned before already: Jesus didn't tell anyone to celebrate his birthday, no one ever bought him a Christmas gift, ok?)

So don't vote for Trump because he will make you say Merry Christmas: "If I become president, we're all going to be saying Merry Christmas again, that I can tell you. That I can tell you. Unbelievable."

Look, Thanksgiving is not here yet, people. No hurry to even talk Christmas.

Thursday, November 5, 2015

Pyramids as Joseph's Grain Storage?

Ben Carson thinks the pyramids are Genesis's Joseph's grain storage, not Pharaoh's tombs. See here.

This is ridiculous. Scientists have mountains of evidence indicating these are tombs. I expect neurosurgeons to be smart people.

Well he is on top of polls now. That article reads "Four national polls currently show Carson ahead of Donald Trump, largely thanks to his support among Evangelicals."

Sadly, these evangelicals supporting him do not think science knowledge is of any importance. Alas, the 2nd place guy is not no better. Look, are you going to put someone who has poor science knowledge be commander-in-chief, with no prior political experience?

Huckabee isn't much better, saying a volcano blast is more than one hundred years of human activity. See here.

We need a president that understands global warming and know some basic science!

Tuesday, October 27, 2015

Learn C "the hard way"

I came across this book stand out among the bookstore's bookshelf.

Seems like some reverse trend of ..For Dummies books. The author actually opens the whole book up on the web so you can look here.

Now, you decide if you want to endorse this book or learn C from it.

Its Exercise 0 says: get Ubuntu Linux if you're on Windows, and install XCode if you are on Mac (and search online for "installing xcode")

and it also warns against an IDE: Don't use an IDE. An IDE, or "Integrated Development Environment" will turn you stupid.

Exercise 1: where is that #include statement needed to compile puts?

The rest of book... seems to put things out of order of how I would introduce things... uh hem, I saw // this is also a comment, sorry but that is C++.

So I think... this hard way book is just a bit too confusing and not necessarily hard. Yes, C runs fine in Windows too, the author seems to think Linux is the only viable OS in the world. There are plenty of C tutorials out there, I'd go online to search for "learn C" instead of buying this book. and I beg to differ that an IDE turn you stupid.

Monday, October 26, 2015

JSON formatting

JSON is such great alternative to XML as Javascript natively understands it. But it can also get complicated... and there is no description like XML describing what you are looking at. And on the java side, there are many tools too. For example: Jackson. see http://www.mkyong.com/java/jackson-2-convert-java-object-to-from-json/.

A formatter definitely can help you look at it in a clearer way. Here are some:

http://jsfiddle.net/AndyE/HZPVL/
http://www.freeformatter.com/json-formatter.html

Here is jsfiddle that you may find useful.
http://jsfiddle.net/AndyE/HZPVL/

Tuesday, October 6, 2015

Madman shooting again

Before I comment on yet another mad man shooting on campus, first I want to stab one (last) time for Windows 8.

Once upon at time there was a cartoon on the News app that I wanted to alt-print-screen to download but I couldn't. In the cartoon, there was one guy saying something like "Gun Control! We need less guns". The next frame is another guy that says "No, we need MORE guns! Gun laws are useless." Then the next frame says, "See you after the next massacre."

Here we are. How true is this cartoon.

Another unknown man just wants to be known by shooting people then himself. Some details here.

Just how do you prevent such tragedy, everyone carry a firearm to everywhere as "the only way to stop a bad man with a gun is a good man with a gun?"

Some guys say "It is not about gun laws it's about mental illness". Maybe true, but why is the guy legally having so many guns.

And no, I don't think teachers should bring guns to school. I cannot agree more with this gentleman. http://www.cnn.com/2015/10/05/opinions/parini-donald-trump-guns/index.html.

And how many people died in this incident? 10. Many more died in separate incidents in Chicago alone in one day and many of those are probably NOT about mental illness.

Enough of this. People should be working as hard as president-wanna-bes on taking action to implement buy-back program or do what it takes to get guns out just like every other sensible nations out there.

If every household has at least 1 person killed by madmen with guns, perhaps this nation finally will realize.

See you at after the next massacre.

Monday, October 5, 2015

London Revisited

So I visited London again. This time for no reason at all! Theoretically the client has request my presence during launch but it isn't justified in the first place I do not need to be present there physically when there is the internet. Oh well, so the project is delayed again and I just wanted to spend opportunity to do one more walk around.

So I headed for the Buckingham Palace! Not in some remote place but right in middle of London, reachable by the Underground (trains). Yes I saw the famous long black furry hat soldiers marching. A giant building but with crumbling walls. It isn't a castle. There are streets and streets of classic stone buildings all over at uniform height.

Headed for some shopping place on Regents street. London makes Michigan Ave look very pale. At high end stores I only see wealthy Chinese shoppers and even the sales speak to them in Chinese. Now only wealthy Chinese can afford these ridiculously expensive (probably Chinese made) products.

I especially liked the Hamley's toy store. Makes the biggest Toy-R-Us you have seen look pale. I do not know of any big toy stores in Chicago. There are floors of toys and MANY enthusiastic sales people demoing the toys. Not very cheap but everything in London seems so expensive. It is celebrating 255 years. Yes, two hundred fifty five. How old is the United States? London still have a few bookstores. Guess Amazon didn't kill them all yet. But I do not see coffee shop within.

As I have notice before. No half-and-half in Europe. Whole or Skim milk with your coffee, or just black.

Suddenly the tune "London bridge is falling down" came to mind... ah, accessible by train too! Let's go there! The bridge itself is actually not so elaborate but the Tower Bridge next to it is. There is a giant WARSHIP for display.

Unfortunately "Chinatown" did not come to mind until after my day of walking... should have went there to see. Yes, google map street view can take you there. But I want to see what kind of food they serve, hear what language they speak, perhaps talk to a couple people. Oh well.

Shakespeare's Globe Theatre is still around. But unfortunately didn't come to mind either. Hey I didn't know I get to travel around for 1 day.

Now, the most famous dish at London is "Fish-and-chips", which is fried fish fillet and fries. I had some. Tasted just like here. They call fries "chips". What do they call real potato chips? They call it "crisps". I think "crisp" is probably a better term for it.

Now, what about "porridge"? In some Chinese restaurants, it is refer to the tasty morning rice soup. I decided to spend a few pounds to find out. Oh it is oatmeal! Would not have spent that pounds on that if I know.

Finally, on the road there are lots of speed cameras, well those are everywhere else too. But look a that sign

It is the old original camera! They don't use that to capture speeders don't they?

Wednesday, September 23, 2015

Disappointed at Volkswagen

I thought only evil Chinese business do bad things like plastic infant formulas and other fake goods... I would never thought Volkswagon would cheat on the emission tests. See http://www.huffingtonpost.com/entry/volkswagen-ceo-resigns-martin-winterkorn_5602bf8ae4b00310edf95e0f.

I was a proud owner of a Volkswagen in 2001, bought it just months before 9/11, but I probably didn't take care of it real well.. I did not feed it with the most expensive gasoline... it was more expensive to get it fixed when it has problems. That car is probably junked by now after it was cheaply traded in... I knew a Honda Civic or Toyota Corolla is cheaper and probably last longer.... but I wanted something more admirable but not quite the envy-inviting BMW or Lexus. Oh well. I guess Volkswagen's brand name is now damaged quite a bit. But whose fault is it? The CEO?

This is probably tip of iceberg of more lies out there.

My next car is not likely to be VW...ever. Too big and consumes too much gas and too expensive to keep, and too dishonest adds to this list.

Tuesday, September 22, 2015

Please, get to know the Constitution

So a candidate say some unintelligent things (again). http://www.cnn.com/2015/09/22/politics/ben-carson-religious-beliefs-muslim/

"NBC's Chuck Todd asked Carson, "Do you believe that Islam is consistent with the Constitution?" "No, I do not," Carson responded. "I would not advocate that we put a Muslim in charge of this nation. I absolutely would not agree with that."

READ THAT CONSTITUTION. There is absolutely no such religion requirement for ANY post. That Constitution is actually a SHORT document. Less complex than your typical contract when you bought your house. Much simpler than the surgeon's manual I supposed. The Constitution is INTENDED to be simple because the juicy details ought to go to the states. The founding fathers intentionally don't want religion to have anything to do with the Constitution.... and that is a GOOD thing.

Now is there a Muslim running for president? I am not so sure about that.

It is very disappointing that the first place and second place Republican candidate (both outsiders) keep saying things that a real leader shouldn't do. It is just unfortunate.

Looking like the presidency will fall to the Democrats again. And if Joe Biden is to run, my question is why not enter earlier? I predict Hillary victory unless that email server thing really bring her down.

Friday, September 4, 2015

Google's new logo

Before/After

Rationale
It is scalable. Oh the old one wasn't? and they haven't changed it for 15 years or so (but so what?).
http://www.fastcodesign.com/3050613/googles-new-logo-is-its-biggest-update-in-16-years

My take:
I like the original.

Wednesday, September 2, 2015

Plastic Bag Ban

Plastic bags are hard to find these days. There is a Plastic Bag Ban in Chicago since August 1. Now, not that plastic bag are totally prohibited as pure evil. Just grocery stores and department stores give you paper or some other things instead... if you call your favorite restaurant to order things you still get your food in plastic bags. The idea is: use that re-usable bag and save the environment! Certainly good intention. But is it working?

Now without plastic bags what are you going to use for your various garbage cans around your house? How do you pack your lunch? How do dog owners pick up their dog stuff? If you have to buy bags what environmental difference does that make? Your wallet just hurts more. It already hurts you when grocery stores need to pay more for paper bags and their customers (you) will eventually pay for.

Also, see this: http://www.bagtheban.com/multimedia/item/the-truth-about-plastic-bags.

It says grocery bag requires 70% less energy to make than paper bag and takes 7 trucks to carry them for same number of grocery bags.

Now when I go to Panda Express I have to lie to say "to go" even if I eat "for here" in order to take the plastic bag home for collecting garbage at home.

So I think... reward is better than ban. Give people 5 or 10 cents credit if they bring in re-usable bag may be better incentive.. and I think, someone should come up with better bags that is more environmental friendly.

Friday, August 21, 2015

Explosions

Boom! BOOOM! Huge explosion at Tianjin, China a couple weeks ago. Gotta see some video footage to see the power of the blast. Search for it in youtube. For example, here.

Now lots and lots of questions remain and probably never be answers. The government has always been known for reporting much smaller number of deaths than actual numbers. Why? How come so much explosives stored in one place and so close to residential area? So do the firemen even know that there are such chemical things that should not be put out by water and water caused it to explode bigger? Cyanide... why are there so much of these things there. How bad has the air and water been contaminated? So many questions so little answers... OMG, the new cars' tires are melted... some people may have vaporized.

When someone asked a very legitimate question on live news conference: "According to regulations, how far away should hazardous materials be stored from residents?". The broadcast has stopped! This is really a shame. See here. And dude, 1 km is not a very long distance even if that law is enforced.

Thailand explosion is another recent story... probably has something to do with terrorists. I'm like come on. Leave regular people alone! Enough of this non-sense!

Now was Tianjin explosion an accident? or terrorist attack? Any other dangerous ports out there?

Friday, August 7, 2015

Hello Windows 10

Ok, installed Windows 10. It took about 2 hours. The new browser Edge first refuses to open, all I see is the IE logo. Then it starts to work well. During installation process you can tweak some settings otherwise everything you ever do will get sent to Microsoft (perhaps they collect your info anyway)

I think the only suggestion I have for Microsoft is not to use the same IE logo.

Overall this is a positive upgrade. Seems not to occupy disk space that much. Things work smoother. I get mysterious quiet crashes from Metro apps and haven't seen one yet. It will get a while to get used to.

I like thoughtful things. Putting File Explorer in start menu is good idea.

Now I get a search box right next to Start button. Hope that can be moved. I only want short cuts to my apps in the bottom. Whacking the charm bar is a good thing. Now the start button pull in News items and stuff. Well I think I want news only from the News app... do not need distraction.

The entire windowing UI is different now... Launch notepad.exe to see what I mean. Seems not as natural as previous versions.

I wonder what will I talk to Cortana about. Will try to talk to "her" later.

Monday, August 3, 2015

Making America great again?

Look at Trump... he is the front runner (but at just 26%). News here. I am kinda surprised that Jeb is that far behind.

This guy recently made eyebrow-raising comments offensive to Mexicans and POW like John McCain... and gosh a lot more. See some http://presidential-candidates.insidegov.com/stories/5187/23-ridiculously-offensive-donald-trump-quotes.

Why the heck is he leading in polls? I don't get it, politics.

But look this guy IS hugely successful, at least in the amount of money he has... he definitely knows how to do something right.

But will he truly know how to make American 'great' again?

Given the outrageous things he says... I do not think so. If trend continues to go like this it will be Trump against Hillary.

And I would predict Hillary victory if that's the case. Waita minute it could be Trump vs Biden. I am a bit doubtful that Biden will win over Hillary. Waita minute she has her own hard-to-explain emails. So prepare to see another chapter of American history negative ads blasting each other.

So I guess Trump is leading in polls because people want to hear more ridiculous comments... It seems only ridiculous comments get attention these days.

Is there a presidential candidate that truly can make America great again? To maintain world peace... to curb global warming... to lower that national debt.. to prosper the economy...

Nobody can do it all.

Thursday, July 30, 2015

Haven't get my hands on Windows 10 yet

Finally Windows 8 is now in rear mirror as people start getting Windows 10. But I am no hurry to install it yet. Hard disk is running low with bigger-than-ever-picture uploads... I guess I will wait a bit on getting it. Perhaps someone will say Windows 10 may have some severe problems. (Not very likely though) Look forward to play with it at a store when they installed it there.

The return of the Start button is so welcoming. 8.1's start button is better than nothing but not good enough. The guy who suggested taking it out has committed such huge sin that I will never ease my wrath on. Waita minute, but the new start menu is so wide? But I hope that's customizable.

But Mac doesn't have Start button either and nobody complained? Well Mac users don't go Start->Programs and find their things, they have to know the name of it with Command-Space or the spotlight in upper right. They are used to never ever get a list of programs they have. They are used to the horrible Finder. And they are all fanboys who put up with whatever the Mac give them

I've heard the idiot Charm bar is out. Good. Those full screen tiles are such moron (not modern) design.

I've heard minesweeper and Hearts will be gone. Well 8.0 got rid of them too? They just have to kill those classic simple games. I still haven't recovered from losing Chess Titan.

Waita minute... what else am I getting besides the start button. I've learned to use without it. If I need to pull out notepad.exe? I got Windows-R for Run button. I don't need Cortana, never need to talk to a computer like Knight Rider. See some features here.

Tuesday, July 28, 2015

PIXELS

Whoa, huge Pac Man terrorizing town! Whoa huge Galaga thing really attacking us! Donkey Kong throwing barrels! Aliens using video game to attack! Gotta be able to play the game to save the world!

I did not and will not watch the Pixel movie. But I probably captured all the movie try to say. Yes the 80s were great in video games. People who lived through that time all loved the simple entertaining video games. 80s die hard gaming fans should line up to see this movie right? (Despite you may get shot by some crazy guy at the theater and the world just shrug)

But waita minute, but what alien would attack earth with this... This idea is um, sorry, stupid. Look if aliens really copied Pac Man and Donkey Kong they would have been harmless 2D. And Pac Man has NO eyes.

It is very hard to come up with a reasonable good plot with old video game characters to have a winning movie. I didn't watch Wreck-It-Ralph either but I think that plot is being a bit more reasonable. But Ralph is a new character. If you really want a go for video game theme, just focus on one... but Van Damme's Street Fighter was pretty bad. Video games is perhaps best played not watched.

Thursday, July 16, 2015

Pluto flyby

Wow, such great human achievement for New Horizons to go all the way out to Pluto... the last of the original 9 planets. Those great pictures taken would entertain the scientists and enthusiasts for a long time. Now do we have some vivid pictures from stars and galaxies even further away? Saw some of those in over-sized books at bookstores that no one buy.

It is so remarkable to be able to send a little spacecraft that far away to a moving target. Such awesome calculations, who says math is useless? I am not so sure why the Hubble Telescope can't take a good look at Pluto when it can look at things even further away. (Ok, I need to read this, plenty of (basic) math in this explanation, again who says math is useless).

This little planet has 5 little moons... travel in a radically different path than other planets... and now we know there is a heart shaped thing on Pluto. Now this little spacecraft is also quite remarkable. It's got a nuclear battery! Wow it can convert decaying plutoninum into electricity!

This is such incredible milestone of space exploration. I am glad it didn't crash into something in the Asteroid belt. How far can it go? Will it ever lose contact?

Wednesday, July 1, 2015

New York - revisited

I rarely ever travel, but a decade or so ago I traveled to New York and it was winter time, meaning can't stay out for too long and I vowed to come back in a summer and I did this time.

First time ever on American Airline and its got an Android pad on each seat on one flight... There is the 3D World map app that is fun to play with which even give you a cockpit view.

New York is still the big walk-able city and a car is really not so recommended in Manhattan. Yes, its subway is complex and dark but they aren't that bad. They don't use smart card Ventra like Chicago, still magnetic stripes but you have to swipe it (not insert it). Good thing is it tells you balance and the smarter Ventra doesn't until you get the red x for insufficient funds. Yes, traffic jam everywhere in New York. So don't let that ruin vacation mood. Many street musicians there, probably broadway musicians wanting extra cash.

This time I do not see as many graffiti as was a decade+ ago. Still crowded in many places. Still bags of garbage on streets. Its Canal Street Chinatown has shrinked a bit, not many interesting stores, just many grocery stores with live seafood lying around just like Hong Kong. Not that many exciting Chinese restaurants there and still kinda busy. Mandarin Chinese seems to be more mainstream than Cantonese over there. Yes, There are other Chinatowns in Flushing and Brooklyn too worth checking out. Since the fire destruction of Penang restaurant in Chicago Chinatown I just never can find another Malaysian one, there is a couple in the Little Italy. Good food. Chicago need those! Chnatowns have only restaurants, toy shops and ladies clothing shops. Not much else. Not a single men's clothing shop where do they expect men to find clothes?

Time Square and its many interesting stores surrounding that area are worth checking out. The 9/11 memorial is worth checking out. Gosh how I wish I can visit the Museum of Mathematics. Wish have time to revisit the big Central Park too.

Wednesday, June 3, 2015

Angular - a closer look

Got a bit of time to go through the AngularJS tutorial. See https://docs.angularjs.org/tutorial

This thing moves MVC all into client side... for those who don't want to mess with compiling java and go through pain of configuring Spring. It's got data bind.

Here is my little test app (changed some stuff from the tutorial with Street Fighter chars)... ooh search your data on the fly, not even ajax is needed.

Angular got google in its back. But not everyone like it... and they may actually have a point. See here for example.

Search:

Sort by:

  • {{fighter.name}}

    Country: {{fighter.country}}

    Age: {{fighter.age}}

Wednesday, May 20, 2015

Saving McDonald's

Though billions and billions served... McDonald's sales are falling. (Yea you can easily find some reference article on that).

Now McDonald's has been trying many new things... yet can't easily change it reputation as junk food. Yes, that food is high fat, high calories, high sugar, high salt. (But so are many other restaurants). Think Chipotle is healthier? but that huge portion is going to give you large number of calories too. Chipotle is just too big for lunch. Dinner maybe.

Now back to McDonald's... many people give various ideas to save it... including breakfast all day (?!). Now I am not so sure if you want to really eat breakfast items all day. (I really would like something easier to chew on than that gosh tough-as-steel muffin and less fat like things like that biscuit and McGriddle.).

You got to give them some credit for trying out things... one day I walked in and tried to order a quarter pounder and the cashier suggested some Sirolin sandwiches instead. Big portion! But unfortunately it seems like not taste as good as those made in a grill. How do they make sandwiches? microwave? if microwave then i'm-not-lovin'-it.

Some people suggested vegetarian meals: excellent idea. But that salad they used to make didn't work so well? But I think things like veggie burger may be interesting. They already serve fried potato burger in another country?

I got some suggestions to make it a bit healthier: 1. Get light on that salt. See that salt machine like cranks out salt like watering your lawn? Give customers little salt packs. 2. Offer less sugar drinks. How about carbonated water with some lemon?

Taking out Ronald Mcdonald and add McCafe didn't seem to work... that coffee is too light! Need a darker roast... and some good snacks that goes well with coffee (such as coffee cake?) Hamurger isn't it.

But here is one thing that McDonald's beat everyone else: the price. (Ok except 7-11 hotdogs) For ~$6 I am well fed, with drinks and fries. You need at least $8 just to get food without side or drink in other places.

Wednesday, May 13, 2015

Singapore Prime Minister can write a program to solve Sudoku

You gotta be impressed. A prime minister not only know how to run a country but write code: http://www.itworld.com/article/2917587/open-source-tools/singapores-prime-minister-shares-his-c-sudoku-solver-code.html to solve Sudoku.

You can see his source too. See that link above.

I ensure you not too many people can actually do this despite their degrees in computer science and having inflated titles like "architect" or "software director".

I did this years ago, first a text version, then a GUI version on Android: https://play.google.com/store/apps/details?id=com.optimal.solutions.sudokusolver..

Nobody cared because I am no prime minister. There are much better sudoku solvers out there. Some can even take a picture of puzzle and solve for you. Sudoku however seems to lose its magic... haven't seen people play with one on the train lately. I guess phone games are lot more fun.

But this Sudoku problem really should interest computer science students. Something that involves systematic trial and error deserves a programmatic solution.

So I am impressed, Prime Minister.

Lately, the US is much obsessed of being like Singapore. "Singapore Math" is now a buzzword for teaching math... they are the top of chart, Americans are much more behind. But if I take a brief look at it here... I actually don't see anything too special with it?

But look, math knows no political boundary. There isn't Singapore math or American math... It is just... math. If the media focus less on mocking students who knows a thing or two as nerds, have an environment that encourage learning, of course Americans can do better. If the environment is: football players are cool, math students are uncool nerds, Americans can remain the bottom of the bottom. Gotta lift the status of matheletes! You test test test them and declare them failure... how about telling them right answers. Standardized tests should have a follow up explanation session! That will alone transform education: so kids know what they do wrong and know how to do better next time.

Now another thing about Singapore... The delicious Singapore noodles is actually a Hong Kong invention.

Tuesday, April 28, 2015

A Common Core(?) triangle

This is an actual homework problem from my kids' cousin's 4th grade homework.

Ooh two slashes there... indicating this is an isosceles triangle? Oh all sides are 3. This is an drawn-poorly-out-of-proportion equilateral triangle!

Perimeter is easy. 3+3+3 = 9.

Ok, height = 2. ½ base × height = 3 cm 2. Done?

But look! Waita minute. The height is 2? But this is an equliateral triangle governed by 2 special 1-2-sqrt(3) triangles. So the height is 1.5 × sqrt(3) = 2.598... not 2 even when you do some rounding.

So the area is 1.5 × sqrt(3).

The students in that class has not seen a radical nor have any idea about the Pythagorean theorem. Something is wrong here.

I think I need to go beg the teacher to tell me the right answer.

Now, I need to beg the teacher to tell me another thing: what the heck is this "number model" here?

This post probably isn't going viral.

Wednesday, April 15, 2015

Millions if not billions would be wasted

This guy announced running for president. That guy announces running for president.

And yes a ton of other campaigns too for various positions.

Each of them would raise plenty of money, in millions if not billions. And of course there is one winner and the losers lost all that money in their campaign too.

Now that is really wasting a ton of money. Can that be reduced? How about changing the term of president from 4 to 8? Then everyone is a two-term-er!

Ok that would stay in power for too long. What about 6. That messes up the cycle that the Constitution intended too. Oh well, that term is fixed.

If you don't have realistic chance to win, just don't bother running.

I am stumped too on this problem too

There is no escape. Everywhere you look you see this math problem go viral:

http://www.nytimes.com/2015/04/15/science/a-math-problem-from-singapore-goes-viral-when-is-cheryls-birthday.html.

I admit I am stumped too as this is hard because the clues seems to tell you... nothing:

Albert: I don’t know when your birthday is, but I know Bernard doesn’t know, either.

Bernard: I didn’t know originally, but now I do.

Albert: Well, now I know, too!

This doesn't fall into usual logic puzzles of clues... I can't easily put it into conditions or predicates then link them together.

Now, before you say everyone in Singapore is smart in math but all Americans all bad. Just what "math" are we dealing with here? This is some logic puzzle. Logic isn't only appearing in math you know.

Why did Hamlet see his dad's ghost? If Hamlet's dad is dead he may become a ghost then Hamlet may see it! (A quick example of logic in other place)

It is perfectly fine if you can't tell Cheryl's birthday. This seems not to be a typical... not even a good problem that test ability to link logical pieces together.

But it isn't ok for American students to not even know how to add some fractions by 5th grade or so.

Just grab Cheryl's ID card is the quickest way to find her birthday if she isn't telling.

Thursday, March 26, 2015

Windows 7 new trick discovered

Yes I still use Windows 7 at work.... and am glad not using Windows 8, or the Mac. Gosh I hate the Mac though I don't mind its Unix prompt. Without that it is even more unusable.

Alt-Tab to switch between things has been there for ages. Since Windows 3.1. One day I tabbed on the Windows-button instead of Alt. Oh wow, I discovered a new way to switch apps and it is called Flip3D.

See here

This is probably not on Windows 8 as this is Aero.

Now that flat interface of Windows 8... according to some stuff I read is a battery saving feature for laptop and tablets as it is expensive to show half-transparent things in the title bar. Ok I buy that. But this isn't issue for computers plugging in all day. Windows 8 really should give people an option to use Aero... see you spent so much time and money to develop it and you just throw it away.

Another note: that image above has that Windows 7 Gadget thing... sure is neat idea (basically a window less program). But the world just abandoned it due to security issues. See it here. But why can't it be fixed and just abandoned? Well but the wacky Windows 8 Metro (yes I refuse to call it Modern) don't need the gadgets to live on desktop as the entire Desktop is kinda going away for its wacky titles.

Looking forward for Windows 10.

Monday, March 16, 2015

Stop calling people 'dorks'

The π moment of the century has came and gone. Saturday was a special π day. March 14, 15. The moment was 9:26:53 to spell out the first 10 digits of π 3.141592653.

There were numerous articles talking about this and plenty of pies made decorated with π.

Plenty of journalists needing ideas to write wrote about π these days. Most give you a review of the definition of π and that's about it. And you really are uninformed if you need someone to remind you that. Few go any deeper.

This one I like as it gives you more fascinating info. http://theconversation.com/pi-day-is-silly-but-itself-is-fascinating-and-universal-37948.

While yes, it may be silly to eat pie on π day just like eating something that starts with 'e' on Earth Day, I don't see anything wrong with that either.

I am especially not happy with this one: http://www.businessinsider.com/once-in-a-century-pi-day-2015-3 Just who are you calling dorks?

If you have no respect for people you aren't going to get respect.

See, the fact that the π day gets people some attention to math is already worth it. Is there something wrong with eating pies over there?

Oh look there is some interesting thing about math. There is this number that is impossible to complete grasp (write down) and that is in every round thing out there. There is another fascinating number that you can simply make out by sliding a square in its diagonal. That square root of 2 is another irrational number that can't be entirely written down either. (Yet nobody celebrates the square root of 2 either by eating triangular pies).

Most people are too shallow to know another thing about π besides maybe mixing up 2πr and πr2, area of a circle. Most have no clue how you get π=C/d to the area formula = π r2.

How unfortunate.

A better education helps. Although you may think it is absolutely ok not to know anything about it. (It is absolutely ok not to know anything else too)

Some people got tricked by their (clueless) math teacher in elementary school thinking π is exactly 22/7. How unfortunate.

When I was in elementary school I immediately pulled out my calculator and found out it is 3.142857 not quite the same as 3.1416. 22/7 is just an estimate (and a fairly good one). I already wondered: how the heck did you get 3.1416? And I thought people may have ultra good measuring device to measure circumference over diameter to get that. And when I found out π is cranked out in millions of digits I decided to find out how they do it... This itself is already a great topic to explore.

Speaking of approximation of π an ancient Chinese mathemtcian came up with 355/113 but I don't think anyone knows how he get it. Writing down steps of proof just wasn't properly practiced back then.

We should be humbled by gosh there are so many pieces of knowledge out there. And only when we are humble we can learn a thing or two. Mocking others do not get you anywhere.

Stop calling people dorks. That author owes me and every math enthusiasts out there an apology.

Wednesday, February 18, 2015

XLIX

I rarely watch any sports... but I decided to checkout the latest Super Bowl. XLIX.. at least some of it. I watched Katy Perry (and others) great performance on the half time. Wow, how do you turn the football field in such great stage of 3D stuff and change so fast. How does Katy Perry's clothes change so fast? How can her eyes be so widely opened?

So I have noticed XLIX. Is that some form of Linux? No it is the Roman Numeral. I remember Super Bowl 30 had an exotic title of XXX. I had some trouble interpreting XLIX at first... oh what does "L" stand for? It is 50.

So the Roman Numeral evaluates to: (50-10)+(10-1) = 49. Now that's wacky... Next year it would be Super Bowl 50 or Super Bowl L?

But No. NFL is actually not going to go "Super Bowl L". See http://ftw.usatoday.com/2014/06/nfl-super-bowl-50-roman-numerals-l.

Now before you say Roman are dumb, it just isn't so obvious how to create a number system. You take the Hindu-Arabic system for granted because you're taught that way. In the old times such system does not even yet exist or known. The Romans just didn't come up with the place-value system like we use today. But I see that they want to prevent keep using I to represent 1's. Like for 4 they use IV to prevent IIII and for 9 they use IX instead of VIIII. See, using a symbol to represent 5 is quite intuitive (number of fingers you have in 1 hand). So numbers... is an human invention, and gosh, the invention of zero and negative numbers are such important milestones of mathematics.

Thursday, February 12, 2015

Hello London

Over the past 20 years of working I never get sent to business travel. For most of my career I maintain things. Even when I make new things clients either are local or they come talk to me instead of me going to meet them.

So I get to meet a client in London... to see how their product currently works and see how to integrate that into the things I am working on. I met some fine gentlemen with some British/French accent. It is a challenge to understand everything they say perfectly. My trip lasted just 2 days.

London, Great Britain has such great influence around the world. Why do Americans (mostly) speak English? Even the history biggest don't-carers know that the original colonies belong to the British. There were so many British colonies all over the world but seems no one need to fight a war to gain independence besides the Americans. Oh well that's another topic. These guys took over Hong Kong for close to 100 years and able to develop it into a great city (at least it used to be). But that wasn't their original intent! let's not forget the Opium wars! I despise those uneducated Chinese people I met who have not even heard of this piece of history.

Now London is a great classic city with Gothic style architecture all over. Houses are generally not as modern as those found here. Unfortunately I only get 2 hours to tour around. I got off at the Westminister stop of the Underground to see the Big Ben (the clock tower) and the big ferris wheel London Eye, then walk along to see the front door of the National Gallery and saw the Big Blue Chicken . Then end up in the Convent Garden for dinner at the Union Jack.

Look, it all started here. The Industry Revolution is kicked off in Great Britain. The United States is started here as British colony and so was Hong Kong. Newton is from same place. Much of the world is influenced by UK. We are surrounded by Indians because of that Great Britain influence on them.

People from Hong Kong may feel right at home at the roads... it is on the left. There is the red-yellow light before the green light. The road sign designs are just like those in Hong Kong. The double decker bus look like the oldie Kowloon bus in Hong Kong. Yes they use 220 volt and you will need an adapter to use North American electronic devices.

Here are some interesting observations of small cultural shocks.

  • The emergency signs such as Fire Exit are green, not red
  • The men's room have the guys icon open legs not close legs
  • Besides cookie is called biscuit...they also call potato chips differently, the call it "crisps"
  • Their coffee shop have no half-and-half! Only skim milk! Man they are health conscious.
  • The taxi have 4 seats facing each other and no trunk!
  • Some British coins use SEVEN sided figures! Now that's difficult to counterfeit. But who is counterfeiting 20 pence and 50 pence?

Tuesday, January 27, 2015

Asteroid has a moon

Asteroids getting close to earth is no news... In fact, many little asteroids strike the earth and our atmosphere just burn much of it up.

But a huge one can destroy dinosaurs in the past and can destroy everything on earth here today.

It looks like none of the big ones are coming yet but this one "2004 BL86" is coming pretty close. But the news item is that it has a little moon of its own. See here.

Having a little moon is some status isn't it. Our fellow inner planets Venus and Mercury do not have one. Well you know the Earth has one. Saturn and Jupiter have 60+. Even the little demoted planet Pluto has 5. Even Mars has 2. And even if Venus has one and someone live there, they will NOT able to see it because of that thick cloud of death (greenhouse effect is real, my friend).

Now where do moons come from (especially our own moon)? There is actually not a written-in-stone solid answer. There are just theories like it is knocked out from earth or earth's gravity caught it. See here for 5 theories.

Look folks, it is gravity at work. That makes things fly around. It's the same (somewhat mysterious) force that keeps you on the ground.

Now this reminds me of a classic video game called Asteroids. In reality, even if you are at the Asteroid belt, asteroids would be quite sparse that you are not so likely to be surrounded by it. ooh hyperwarp! That's such great sci-fi idea. but you may get blown up in the process.

Now unless an asteroid destroys your town or land on your head, most of us (except astronomy enthusiasts) don't really care. We can barely see ANY object in the sky except the moon as we live in dense light and fog polluted cities. So go ahead gravity do your thing to push/pull, destroy stars and stuff while scientists continue to make a living to connect you to that Standard Model somehow. We other earthlings take gravity for granted and continue to just mind our own business here with our feet on the ground.

Will one day an asteroid come by so close that our earth's gravity pull it as moon #2? now THAT would be interesting.

Wednesday, January 21, 2015

Boy did not go to Heaven

Oh, so the boy behind "The Boy Who Came Back from Heaven" admitted he actually didn't go to heaven.

See here.

So the book's profit isn't going to the kid... the names are used without permission. How horrible is this "Christian" publisher.

This is slap at the Christian faith... after infamous failed prediction of Christ's second coming, etc.

Now waita minute, although the boy did not go to heaven, does it actually disapprove heaven? Like, in a bar, someone bragged about going to a fancy restaurant but actually couldn't afford and didn't go.. does that prove the fancy restaurant does not exist?

Even if he insisted he went to heaven... is that a proof? That could be easily explained by a dream, hallucination etc.

I know somebody who really really hoped to see their dead relatives... I hope they are not in despair... cause one boy's account is not sufficient for proof or disproof.

Faith... requires no proof otherwise it is called "science"?

I really am sorry for the boy... paralyzed... Drive safely... put that seatbelt and car seat on.

Now that Bible is really full of hope! Oh Jesus healed a blind man! Oh Jesus cast that demon out (so many demons out there?) Oh Jesus healed paralyzed man! Oh Jesus fed thousands! Don't I wish he is still around. 40 days is not that long a stay? If He is still around we can ask him directly what Heaven is like. He actually didn't say too much about it in the Bible.

Thanks to the boy for being so honest.

Tuesday, January 13, 2015

Why didn't Obama go?

This is quite remarkable... world leaders join hand-in-hand... united in outrage against the Charlie Hebdo attack.

But more remarkable is President Obama didn't show up. Nor the Vice President nor the Secretary of State.

That little known ambassador just isn't high ranking enough.

Now, just why didn't he go? No one seems to know... is it not enough advance notice to get arrangement to Paris? Does he think it isn't so important to go? Did he play golf at somebody's wedding?

This is going to be in the history books.

Did he not go on purpose or by mistake?

Is he going to say Je suis désolé to the president of France?

What about leaders of the east? Did China send somebody? Did Japan send somebody? Are anyone outraged that the east didn't send their top leaders?

Now, 12 people dead is a lot... but here in Chicago, this many deaths by gun shots can probably be achieved in about 2 days.

Who is there to march hand-in-hand against violence right here? (Yea there were probably some but unfortunately most people who showed up are much lower profile that they don't matter)

Monday, January 12, 2015

Violence in France

Bam! Violence on journalism in France... you don't hear much terrorist activities in there until recently...

Why would someone violently shoot with that AK-47? The answer is right there: "Allahu Akbar", Arabic for "God is great". Of course, the nature of this "God" here is a never settling question.

I am not sure exactly what satire Charlie Hebdo wrote to offend these people... obviously it is extremely offensive to them.

One must think. Gosh why do these people do such violent acts! This is because of their education, their beliefs. But before you blast their beliefs look at what are in your children books.

Remember David vs Goliath? Goliath is big and everyone is scared and this little David had the courage and God is with him therefore he wins. See 1 Samuel 17.

What do you teach your kids? If you have faith in the almighty God there is nothing to be afraid of, even the mighty Goliath.

Um, this is exactly what the terrorists think! This is exactly what caused most mayhem in this world.... too many times.

Most people just remember this much and never even look closely. This (little) David is actually a mighty impossibly incredible kid not just a regular little sheep-looking kid. He can even kill a lion and a bear.

34 But David said to Saul, “Your servant has been keeping his father’s sheep. When a lion or a bear came and carried off a sheep from the flock, 35 I went after it, struck it and rescued the sheep from its mouth. When it turned on me, I seized it by its hair, struck it and killed it.

Your children book probably does not include the detail of chopping Goliath's head off.

51 David ran and stood over him. He took hold of the Philistine’s sword and drew it from the sheath. After he killed him, he cut off his head with the sword.

If this is any old TV/movie/story you would think man what is this author writing! We are talking about a kid to kill lion and bear and defeat a huge guy and chop his head off, but it is the Bible you know. (Then why the heck does he need to run away from his own son Absalom?).

Please, journalists, watch what you write.

Sunday School teachers... are you telling the whole story to the kids? (You probably should hide the violent parts to prevent nightmares but you should read it yourself)

Violence beget more violence. This is a vicious cycle.

Saturday, January 10, 2015

Searching this blog

This is weird. I see a Blogspot search bar at the top of the page of this blog (if you are not running the mobile view). But apparently not everyone has it. Not sure where this get turned on or not.

Now blogspot is customizable... I can add a search box gadget! Easy to do. Click click done.

It somewhat works. Type in something and it will do some search. However, it is not finding everything! Gotta be some indexing issue or something.

But look, you can actually search by appending parameter in URL: /search?q=search text. For example: http://josephmak2007.blogspot.com/search?q=Barbie.

That gave me the right search results.

Thanks Google for providing a channel for me to post things... but I appreciate if you fix your search gadget.

Tuesday, January 6, 2015

Now that's a sophisticated New Year note

Apple co-founder Steve Woz wrote a very interesting new year note:

Happy New Year from the New Zealand waters. May each of us find the things we need in life, and the things we enjoy, and good friendship in 2015.

2015 is mathematically sound. 20 is 4*5 and 15 is 3*5. 2015 is 5*13*31. 13 and 31 are reversed digit prime numbers. In binary 2015 is 11111011111, a palindrome. 2015 is also 3737 in base 8 (octal) and 37 is the most special number of all in my opinion. For one thing, it's the best age. For another, it's the first irregular prime number! best to all, wOZ”

See http://www.cultofmac.com/307568/woz-wishes-us-mathematically-sound-new-year/ for full article.

Now that's a lot of observation about the number 2015. Oh, just what is a regular or irregular prime number? Wow, looking it up revealing I actually don't know much about prime numbers (I thought I know a thing or two). (See here for instance).

So this year starts with bad news... Shanghai stampede, more violence in Chicago, 2-year-old-shooting-mom, etc.

I hope you have a mathematically sound and safe and happy new year.