My $1.5B-USD PowerBall Picker

So today is a big day in the USA. It is not an holiday or anything like that. But is is still big.

Today, the PowerBall Lotto is expected to top $1.5Billion dollar jackpot. That is a lot of $. So like many others, I wade into the crazy frenzy and bought some tickets. But I decided to up it a bit.

Since I let a machine, or rather a computer algorithm pick my numbers when I got the tickets. Why not just come home and implemented some quick code that would pick number too.

From the PowerBall lotto site, on how to play. They said that they pick 5 numbers from a drum of 69 balls. And each ball is numbered. So that must be 1 to 69, since I don’t think they would include 0. Then there is a last 6th number that is from a drum of 26 balls.

Here is screenshot of my code and a run to pick 5 sets of numbers:

Screen Shot 2016-01-13 at 7.14.26 PM

And here is the rather “complex” code in the Groovy programming language:

// pick some number for PowerBall Lotto

// a line is 6 number, 5 numbers between 1-69 and the 6th between 1 and 26

class Line{
int[] numbers;

void draw(){
numbers = new int[6]
Random rand = new Random();

numbers[0] = rand.nextInt((69 – 1) + 1) + 1
numbers[1] = rand.nextInt((69 – 1) + 1) + 1
numbers[2] = rand.nextInt((69 – 1) + 1) + 1
numbers[3] = rand.nextInt((69 – 1) + 1) + 1
numbers[4] = rand.nextInt((69 – 1) + 1) + 1
numbers[5] = rand.nextInt((26 – 1) + 1) + 1
}

String toString(){
draw()
println numbers
}
}

def l = new Line()
println l
println l
println l
println l
println l

 

 

 

 

1 Second Every Day

Yesterday I got a TED video about taking a 1sec video everyday for the rest of your life. That works out to about a 1hour video for the past 10yrs of your life. That seems too awesome to pass up.

So starting yesterday, I am taking at lease 1sec of video of my life. Since I work mostly at home, I don’t expect my videos to be very interesting, but maybe I will be surprise. I will see a year from now and ten years from now.

I am not using the mobile app or website to upload my videos. That is a personal decision. But if you like here are the links to the mobile apps and web site.

No Project Is Too Small To Stop, Think, and Plan

I mentioned a project I have been working on and off for some time now. Unlike before, I am actually making tangible steps forwards. And more importantly, I haven’t had to start over recently. For a good part of the project, I would get some work done, then hit some kind of road block in the technology I had chosen. My solution, start over with something else. But finally, I am using the JHipster web application stack and I am not doing that.

The one thing I do realized now though, is that had I done a bit more planning earlier, things would have gone a lot smoother. I did a lot of stopping and thinking about what I wanted and how I wanted it to work. But, by not writing it down on paper to see if it fits, it was just all in my head where if fits easily and consistently. Regardless of the project size, you will always have changes as it starts to material. So pretty much no amount of planning will change that. But, some planning will help with the number of restarts and stalls.

Yesterday, I realized that my page flow was just too confusing as I added more pages. That right there was something I would have noticed I had spent some time writing it down and going over it. I knew that I would be adding more pages, and in my head, it seemed to have worked so well. Once I thought it up, I just started coding one page at a time. Eventually, I have a few pages and the navigation didn’t work well.

Once I started doing what I should have done before, plan. The ideas I had in my head, I now had some more insight about how they might work. I am planning a bit more now before jumping off again.

There is a delicate balance so observe here. No project is too small for some planning. But too much planning and no work, will just keep you in the planning stage. Sometimes you just have to get going and only then you get some insights, you will know if what you are thinking is even feasible. Of course, that is when you figure out that things don’t work the way you think.

If I had to summarize it, I would say always do some planning, especially on paper. May be something like a Passion Planner journal. Easier than using some computer program and doesn’t take a lot of time. But don’t wait too long to start getting your hands dirty, else you might just lose interest. And once you start, it is ok to take breaks to plan. Even if you might have to back up a bit before going forward.

You will be making progress so long as you are thinking, planning, and doing something. If you are not thinking about your project, you are problem not interested in it anymore. If you don’t do any planning, that will make materializing it harder. Whatever you do, do something that helps your project materialize.

Final tip, as much as restarting a project might seem like running in the same place. Don’t be afraid to throw out something that is not working and start over. What you throw out or throwing out to early, will be something you will have to figure out. But don’t get bend out of shape for having to start over, if that is the smart thing to do. Better to correct going down the ‘wrong’ path as early as possible, than later.

Progress, Slowly

There is this app I have been working on for some time, well. I am not sure if it the same app.

Let me put is this way. If you are building a house, but before you can finish. You tear it down, and start over. Possibly with different contractors and different materials especially. Otherwise, it would be really silly to be doing it the same house design, with the same material, if all you changed was the workers every time you started over.

Well, I am kind of in that boat. The look of the app hasn’t really evolved over the months since I conceived and started working on it. There are visual changes to be sure, but those are more like whether it was the mobile or the desktop version. Not so much between desktop versions.

What I found myself doing, is starting over a lot. I would get to a certain point, and stall. Basically, the technology I would be using for my backend, would have some hole that slowed me down. For example, I started out using Java backend based on Spring Framework. I have used Spring a number of times and I love it. But as I worked on my app, I was getting tired of spending time on house keeping. Like if I had an entity, I had to do a lot of work to protect it. I couldn’t just add and entity, and move on to make forms and services to use it. I had to say, well, how do I secure it and expose it appropriately.

That began to get to me and I felt like I needed a web stack that would do most of that lifting. Something that would free me up to work on the core features of the app. Instead of all that side stuff the app required but wasn’t really part of the problem I wanted to solve. that other stuff, user management, security, etc., that wasn’t part of what I had conceived. That just got bolted on as requirements for a modern web app.

Anyway, after many restarts, I am not once again pretty happy with where I am on how it is going. I finally landed on a framework stack that has taken away all that those keeping grunt work. JHipster is my new buddy. It is really filling the gap where MeteorJS, Angular + BaasBox, or Angular + Spring, or Ionic + BaasBox, or Ionic + Spring couldn’t fill.

The funny thing is, JHipster is Angular + Spring and then some. It is just that it has so many other things, that I don’t need to worry about security. That is taken care of. I don’t have to worry about metrics, that is taken care of too.  And the list just goes on.

The only thing slowing me down now is having time to work on it. Because, with a full work day and other things too do, there just isn’t enough hours in a day to get every thing I want to do, done.

In a few weeks, I might revisit just how JHipster is helping or not helping my project.

WaveMaker – A Really Productive Way To Create Java Web Apps

I first started creating Web applications using JSP/JSF pages and Servlets.  I really followed the J2EE standard on creating Web apps.  Then I thought that was too cumbersome and started looking for alternatives.

I landed on Apache Struts 2, Apache Wicket Framework, Symfony, PHP Zen, and quite a bit more. Even tried Ruby on Rails for a little bit.  Eventually, I was back at the J2EE way of doing things, except using Grails.

With Grails,  things were so much easier than having to deal with all the issues you have when creating a web application.  There is the routing, services, db integration, and just wiring up the whole thing.  That is not what you are trying to solve. So Grails made all of that go away nicely, while staying with Java.  So no need to learn another language.

a UI library called Zk and Grails to back it up.  It was fairly easy to construct a UI in Zk.  Even though it was xml and mostly by hand. But I manage to force my friends to use it and we created an application for a client.  I think using Grails too was a stretch for them, as they didn’t have the background in Spring.

I kind of regret using that so extensively, when there were other things that might have worked just as well with less pain.

I enjoyed the Grails way of things without Zk and did my own thing, while my friends pursued using Jdev extensively.  For them, having been burned with Zk and a lot of hand coding of forms and configuration, they wanted a WYSIWYG type of development.

I have tried Jdev, I really have.  It is a steep learning curve and I still don’t seem to get it.  So when I got really busy with my new job, well. It was just impossible to continue on that road.

At worked, we do things the ‘harder’ way some might say. We have embraced using the Spring framework and JSF 2 via PrimeFaces UI JSF library.  A few teams have taken an exception to this, and started doing things using NodeJS and Single-Web-App.

I really enjoyed using Spring a long time ago, but just couldn’t convinced my buddied to embrace it when we did apps.  So now, I am back in Spring land at work and at home, as I jump head first into WaveMaker.  I already see that WaveMaker today, does not solve all my problems, and there is one frustrating thing, using external JAR libraries.  To use an external jar, you have to write a Java class, which both exposes methods to WM and delegates to the JAR library.  This is just too much extra work.  WM should find some way to generating delegating calls for straight calls.  But that is basically my only complaint at the moment.

What is infinity?

That is a really hard question and people have spent their lives studying and thinking of this.  And guess what?  They are no closer to an answer than when they started out.

But there are some very insightful things about infinity that really make this world and our idea of existence interesting, to me anyway.   Here is a brief-ish introduction of infinity from Gizmodo.  They do a really good job of presenting the problems that infinity presents.  That is, once you start thinking of it too much, you might very well go mad or get a splitting headache.  Never mind though, you can read their introduction, even if you think know what infinity it, there is some really good information and illustrative examples of different kinds of infinities.

Yes, you read that correctly.  There are different types of infinities.  Infinity by itself is trouble enough.  Infinity-of-infinities is well, infinitely more troublesome.  Hence, why I believe that infinite as an idea is fine, but in any practical sense is just a figment of our imagination, if we are real.  If infinity is real, if the universe is indeed infinite, then we are not real, but rather a simulation, hence making it possibly to render an infinite entity (timeline, number, world, etc.).  In a simulation, I can driver forever, if that simulation is given enough rules to generate more road and artifacts.

So that is my crazy idea, we are a simulation if there are infinite anything.

Split Brain, The War Within

Okay, so I am being a bit sensational with the title, but not by much.  Consider this, have you ever said I am of “two minds” or “part of me wants to, but another part doesn’t”?  If so, then you are experience the conflict of the many part of your brain competing for control of your action.

I experience something like this almost every day.    Often, I eat not because I am hungry, but because it is time to eat.  Having been eating three times a day as a kid, I still like doing so.  But when I am about to eat, there is this voice/feeling that hey, you are not hungry, don’t eat.  But then another part of me is like, never mine, let’s eat anyway.  So I have always wondered about who is saying don’t eat and who is dismissing that messenger?  This seems to give rise to this idea of me and the other sub-me engaged in decision making.

Another example, this one is from the book “Incognito: The secret lives of the brain” by “Dr. David Eagleman”.   We were told something in secret; we are keeping confidence and want to do that.  But we also want to spill the beans.  The part that wants to spill, knows that keeping secrets is not healthy for us.  So we are always having this tug of war between the part that wants to talk and the part that wants to keep secrets.

What is really cool about listening to the author talk about this is that I often wondered why we said things like I am still deciding or I have to think about it.  It is as if we are waiting for the competing parts to submit their arguments for or against some course of actions.  And then we vote on one.  Listen to the author discuss this here.

Apple Wants To Approve Free Giveaways

Yes, you read that correctly.  Apple, the company behind iPod, iPad, iArm (not a real product, yet), iPhone, etc.  Has issued a doc stating that anyone wishing to give a free iPads for example, in lots of 250 or more.  Must get approval from Apple.  Image that?

Assume I wanted to buy every student in my old high school an iPad.  That is more than 250 students.  I will need to contact Apple first, even though I am paying for the devices and in noway using a discount from Apple.

Fortunately, I am a nut case and don’t support Apple by using any of its products.  I found this story here:

Apple Nixes iPad Giveaways

Posted by samzenpus on Wednesday June 01, @07:34PM
from the too-good-for-free dept.
KingSkippus writes “According to a story at CNN, Apple has begun enforcing third party promotion guidelines (PDF) that, among other things, restricts organizations from giving away iPads, using the word ‘free’ to describe any Apple products in a prominent manner, or promoting giveaways of iPod Touches in lots of less than 250 and with Apple’s explicit approval.”

Education in 2020

Predicting the future is almost always a bad way to start out.  Only one thing needs to change to throw a lot of other things off course and there goes your prediction.  Who could have predicted the impact of social networks?

Anyway, I saw this article “21 Things That Will Be Obsolete by 2020” and I think many of the things here, however, seems like reasonable predictions.  Considering the trends of the past few years and what we have learned in education.

What do you think?  Add your own predictions using comments.