I’m working on an Ionic v2+ app that requires some extra logic to be executed when a toggle switch, also known as a radio button, is changed. In Ionic this component is called an ion-toggle. I tried using the normal Angular.io decorators like (change) or (click) but none of them were firing. What I didn’t realize, mainly because I didn’t see it in the Ionic documents was that in order to handle changes in the state I needed to use the (ionChange) decorator on the component. With this I could pass in more details to the function being executed.
(ionChange)="onChildSelection(parent.name, child.name, child.selected)">
In the above example the id of the component is being set to include the name of the parent and child. The state is based on the child.selected state which in this case is a boolean value.
How often have you been at a stoplight waiting for it to turn green and there is no one else on the road? It is 3am and every soul for fifty miles is sleeping except for you and the local police and there you are waiting for the light to change. This waiting shouldn’t be happening.
We should have traffic signals that utilize multiple sensors to see what traffic is currently at the lights as well as the traffic coming down the road from a farther distance. If the traffic lights for a local area are all connected then they can communicate with each other to pass along details about the number of vehicles, speed of travel, and size of the vehicles to the lights nearby. With this information traffic should be able to flow more efficiently by timing the lights so that lanes with more vehicles will have longer green light times. And when a signal senses that there are no other vehicles on the road except for the single person waiting to turn left at 3am it will turn all other lights red except for that person.
The technology is here. By using thermal, video, LIDAR, and many other types of sensors the signals can get a good understanding of the road. May signals are already wired up to communicate with each other so that they stay in sync so there shouldn’t be a need to lay down new wires for the communication. If anyone knows of research already being performed in this area let me know.
It is three weeks into the new year and how many of us are still being loyal to our resolution? Hopefully whatever was picked for this year is obtainable and not something like winning the PowerBall. Each year I tend to pick a personality trait and something health related as my goal for the year. Usually it is something generic enough that by the end of the year I have no real idea on if the goal was actually accomplished. This would leave me not feeling too bad about the goal at the end of the year but I also felt that I really hadn’t changed. So last year I decided to try something different.
I’ve never really enjoyed salads but knew I needed to start eating healthy. There was no way I could just dive in and start eating a salad everyday so I made it simple. Each week I would eat one salad. If I missed a week then I would double up another week to make it up. To add another level to it I teamed up with a coworker who decided to give up smoking. I made a deal to myself that as long as he kept to his goal I had to keep to mine, no matter what. There really is no tie in between our goals but I knew that if I add another person to the mix then I will have a better chance at keeping my goal.
2015 has come and gone and I have had at least 52 salads and my coworker didn’t smoke once last year. Now that we’re in 2016 I’ve upped the ante and now have to eat two salads a week. Nothing exciting, but with any luck I’ll not only get myself to enjoy salads but will also get to the point where I don’t need goals to keep me eating healthy. It will just become a habit.
Earlier this month HBR IdeaCast had a podcast covering ways to keep your goals. I suggest listening to it, at 20 minutes in length it isn’t going to take up much of your time. Check it out at HBR IdeaCast, Achieve Your Goals (Finally). Some of the advice they gave were to keep the goal were to be specific about what you want to accomplish, be flexible, try replacing a bad behavior with a good one, and be prepared for temptation. Putting these strategies together should help you to keep your resolution this year and end the year on a success.
With that said I’ll hopefully have my first real post up in the next two weeks.