Sunday, December 20, 2015
I have finally finished reading that code complete book. Before I had been thinking of drawing diagram for every piece of code that I need to build. Now I am thinking that the best way to do everything is to ask a lot of questions at every level. For example, my next program is a back to basics windows program. I have done this dozens of times before so there is no point going over it again. However, while I always got it to work right, I can never get past it to build more complex code. Drawing a diagram or making a plan would not work simply because I have no idea what I am doing. The only way I can fix this properly is to ask a series of simple questions about why each small thing is done. First: What is the point of all this code. This code does three main things. One: It initializes a window object by defining a custom class and then creating it. Two: I runs a message loop to get event messages from the window object. Three: it processes those messages, using them to update the window and close the program. Question: Why does it take so much code to create the window. Windows are very generic objects that are used all over the operating system. They all have to work the same way because they must all work together on the same screen. All these options in the two create functions are there to allow a whole set of customizations that most people will not ever need. You can mostly pick a preference and stick with it. Question: Why do we need the running global variable. The problem with the message loop is that it controls the entire program, but there is not safe way for the loop to know by itself when the program is over. The running variable is set to true before the loop starts, and then set to true when the event procedure receives a message to terminate the entire program. The event loop simply checks each time if running is true, and exits the loop, and the entire program when it is not. Why does the event procedure call a default event procedure. The window objects works entirely by responding to messages. The program can respond to messages that it cares about and modify the window accordingly, it can just ignore the ones it does not need. However there are a large number of messages and some of them will cause the window to not work properly if they are ignored. The default window procedure is there to make sure that everything works properly why allowing a program to just ignore anything it does not need. How can I simplify all this useless code. Creating a window, like most things in coding, can be encapsulated. There are too many details to put it all inside one function, but we can put it inside a class. The parts that are required for the class are the application Instance, and the window procedure. The application Instance is obtained from the first parameter of the win-main procedure, the window procedure is created for each application. Why can't we just encapsulate the window procedure along with everything else. The window procedure is a function that is defined entirely by the operating system, and can only be called by the operating system. There is no simple way to tell it what window class it should be working on. There is a difference between our window class and the window object created by the operating system. While it is possible to make the window object point to our custom class, this is not an elegant solution. On top of all that, the window procedure takes care of things that are unique to each application, so it would not make sense to make a generic one for each class. Is there a point where a generic window procedure would be useful. Yes, there are window classes, like those that require scrolling ability, that need to respond to very specific messages. It would not make sense to have each application know about what those messages are and call the class to deal with them. This is a case where having a class would not make everything simpler.There are some big problems that I will have to solve tin the future if I am going to make this work properly, but this is enough just to get started.
Monday, December 14, 2015
I am really out of shape lately. I am starting an exercise program for the next little while. I am going to start slow to find out what I can do and gradually increase my limit. For today it is just running up and down the thirteen steps in my house for five. Later we will gradually increase as I get better.
1. Monday December Fourteen. Time : Five Minutes. Repetitions : Twenty One.
2. Tuesday December Fifteen. Time : Five Minutes. Repetitions : Twenty One.
3. Wednesday December Sixteen. Time : Ten Minutes. Repetitions : Thirty Seven.
4. Thursday December Seventeen. Time : Fifteen Minutes. Repetitions : Fifty Five.
5. Friday December Eighteen. Time : Fifteen Minutes. Repetitions : Fifty Five.
6. Saturday December Nineteen. Time : Fifteen Minutes. Repetitions : Fifty Eight.
7. Sunday December Twenty. Time : Fifteen Minutes. Repetitions : Fifty.
8. Monday December Twenty One. Time : Fifteen Minutes. Repetitions : Forty One.
9. Tuesday December Twenty Two. Time : Fifteen Minutes. Repetitions : Forty Eight.
10. Wednesday December Twenty Three. Time : Fifteen Minutes. Repetitions : Forty Seven.
11. Thursday December Twenty Four. Time : Fifteen Minutes. Repetitions : Fifty Four.
12. Friday December Twenty Five. Time : Fifteen Minutes. Repetitions : Forty Eight.
13. Saturday December Twenty Six. Time : Fifteen Minutes. Repetitions : Forty Nine.
14. Sunday December Twenty Seven. Time : Fifteen Minutes. Repetitions : Fifty One.
15. Monday December Twenty Eight. Time : Fifteen Minutes. Repetitions : Forty.
16. Tuesday December Twenty Nine. Time : Fifteen Minutes. Repetitions : Fifty Three.
17. Wednesday December Thirty. Time : Fifteen Minutes. Repetitions : Fifty Five.
18. Thursday December Thirty One. Time : Fifteen Minutes. Repetitions : Fifty One.
19. Friday January First. Time : Fifteen Minutes. Repetitions : Forty One.
20. Saturday January Second. Time : Thirty Minutes. Repetitions : One Hundred and Two.
At this point, I have increased the time to thirty minutes and I do not feel anything like when I started. I don't think that I am really going to get any better from this point on. I am still sweating a lot and I feel out of breath while running, but I recover very quickly. At this point I feel like I am just wasting time. I need a way to improve my performance without taking more of my time. The solution that I am thinking of is weights. I have a set of adjustable dumbbells and I think that running with them on my shoulders will give be an extra kick. I am going to start with a low weight and gradually increase as I feel more up to it. I will still keep the time constant and record my score.
21. Sunday January Three. Time : Fifteen Minutes. Weight : Forty Pounds. Reps : Thirty Nine.
22. Monday January Four. Time : Five Minutes. Weight : Fifty Pounds. Reps : Thirteen.
23. Tuesday January Five. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty One.
24. Wednesday January Six. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Eight.
25. Thursday January Seven. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Four.
26. Friday January Eight. Time : Five Minutes. Weight : Eighty Pounds. Reps : Eleven.
27. Saturday January Nine. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Seven.
28. Sunday January Ten. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Four.
29. Monday January Eleven. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Four.
30. Tuesday January Twelve. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty.
31. Wednesday January Thirteen. Time : Five Minutes. Weight : Eighty Pounds. Reps : Ten.
32. Thursday January Fourteen. Time : Five Minutes. Weight : Eighty Pounds. Reps : Twelve.
33. Friday January Fifteen. Time : Five Minutes. Weight : Eighty Pounds. Reps : Fourteen.
34. Saturday January Sixteen. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Six.
35. Sunday January Seventeen. Time: Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Seven.
36. Monday January Eighteen. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Two.
37. Tuesday January Nineteen. Time : Five Minutes. Weight : Eighty Pounds. Reps : Thirteen.
38. Wednesday January Twenty. Time Fifteen Minutes. Weight : Eighty Pounds. Reps : Thirty One.
39. Thursday January Twenty One. ///SKIPPED///
40. Friday January Twenty Two. Time Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Seven.
41. Saturday January Twenty Three. Time Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Seven.
42. Sunday January Twenty Four. Time Five Minutes. Weight : Eighty Pounds. Reps : Ten.
1. Monday December Fourteen. Time : Five Minutes. Repetitions : Twenty One.
2. Tuesday December Fifteen. Time : Five Minutes. Repetitions : Twenty One.
3. Wednesday December Sixteen. Time : Ten Minutes. Repetitions : Thirty Seven.
4. Thursday December Seventeen. Time : Fifteen Minutes. Repetitions : Fifty Five.
5. Friday December Eighteen. Time : Fifteen Minutes. Repetitions : Fifty Five.
6. Saturday December Nineteen. Time : Fifteen Minutes. Repetitions : Fifty Eight.
7. Sunday December Twenty. Time : Fifteen Minutes. Repetitions : Fifty.
8. Monday December Twenty One. Time : Fifteen Minutes. Repetitions : Forty One.
9. Tuesday December Twenty Two. Time : Fifteen Minutes. Repetitions : Forty Eight.
10. Wednesday December Twenty Three. Time : Fifteen Minutes. Repetitions : Forty Seven.
11. Thursday December Twenty Four. Time : Fifteen Minutes. Repetitions : Fifty Four.
12. Friday December Twenty Five. Time : Fifteen Minutes. Repetitions : Forty Eight.
13. Saturday December Twenty Six. Time : Fifteen Minutes. Repetitions : Forty Nine.
14. Sunday December Twenty Seven. Time : Fifteen Minutes. Repetitions : Fifty One.
15. Monday December Twenty Eight. Time : Fifteen Minutes. Repetitions : Forty.
16. Tuesday December Twenty Nine. Time : Fifteen Minutes. Repetitions : Fifty Three.
17. Wednesday December Thirty. Time : Fifteen Minutes. Repetitions : Fifty Five.
18. Thursday December Thirty One. Time : Fifteen Minutes. Repetitions : Fifty One.
19. Friday January First. Time : Fifteen Minutes. Repetitions : Forty One.
20. Saturday January Second. Time : Thirty Minutes. Repetitions : One Hundred and Two.
At this point, I have increased the time to thirty minutes and I do not feel anything like when I started. I don't think that I am really going to get any better from this point on. I am still sweating a lot and I feel out of breath while running, but I recover very quickly. At this point I feel like I am just wasting time. I need a way to improve my performance without taking more of my time. The solution that I am thinking of is weights. I have a set of adjustable dumbbells and I think that running with them on my shoulders will give be an extra kick. I am going to start with a low weight and gradually increase as I feel more up to it. I will still keep the time constant and record my score.
21. Sunday January Three. Time : Fifteen Minutes. Weight : Forty Pounds. Reps : Thirty Nine.
22. Monday January Four. Time : Five Minutes. Weight : Fifty Pounds. Reps : Thirteen.
23. Tuesday January Five. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty One.
24. Wednesday January Six. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Eight.
25. Thursday January Seven. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Four.
26. Friday January Eight. Time : Five Minutes. Weight : Eighty Pounds. Reps : Eleven.
27. Saturday January Nine. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Seven.
28. Sunday January Ten. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Four.
29. Monday January Eleven. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Four.
30. Tuesday January Twelve. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty.
31. Wednesday January Thirteen. Time : Five Minutes. Weight : Eighty Pounds. Reps : Ten.
32. Thursday January Fourteen. Time : Five Minutes. Weight : Eighty Pounds. Reps : Twelve.
33. Friday January Fifteen. Time : Five Minutes. Weight : Eighty Pounds. Reps : Fourteen.
34. Saturday January Sixteen. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Six.
35. Sunday January Seventeen. Time: Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Seven.
36. Monday January Eighteen. Time : Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Two.
37. Tuesday January Nineteen. Time : Five Minutes. Weight : Eighty Pounds. Reps : Thirteen.
38. Wednesday January Twenty. Time Fifteen Minutes. Weight : Eighty Pounds. Reps : Thirty One.
39. Thursday January Twenty One. ///SKIPPED///
40. Friday January Twenty Two. Time Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Seven.
41. Saturday January Twenty Three. Time Fifteen Minutes. Weight : Eighty Pounds. Reps : Twenty Seven.
42. Sunday January Twenty Four. Time Five Minutes. Weight : Eighty Pounds. Reps : Ten.
Wednesday, December 9, 2015
In the past month I made a point to read one full book a day for thirty days. I got there, mostly, but the problem is that I dd not learn as much as I wanted. I don't have that good a memory and most of those books were not that deep. Also I was spending four to eight hours a day reading right after coming from a full day at work. Also most of the time I was doing this reading well after midnight and almost falling asleep. This was not the best way to do things, but it was also not the point. The real point of this exercise was to jump start my self into a new set of habits. My current life plans for the future require that I completely change the way I look at myself and the world. I could have made a point to read a book a week or follow some kind of long term plan that would eventually get me somewhere in a year if I managed to stay with it, but there is no way that was going to happen. My view of how things are done as well as my habits from a month ago would have pushed me along for a few day of a week, but eventually I would have found some excuse to stop and move on to some other thing. The only way I was ever going to move past that was to do something stupid like read a lot of books in a short time and hope that one or more of those books would change my world view into something that could sustain a more healthy habit structure, and I think this is what happened. Every night so far my first thought has been to sit down and read something. I will not do this every night but I am doing other related things that involve absorbing new information. I cannot remember most of the facts that I read but I do remember the general idea. For the next little while, I will work on expanding on that.
Sunday, November 15, 2015
I just finish reading Mastery by Robert Greene. At over a thousand pages, it took over six hours non stop. I put the audio player at the maximum speed where I could still understand what was going on. I have to go to work during the week so I have to wait until the weekend to read a book this long. So far, I have been reading lighter books and have been avoiding the big ones because I am not used to reading this much and I don't want to feel overwhelmed.
So, How was the book itself beside very long. What I got from it is that all the things that I am expecting to accomplish during the next year are completely impossible with my current mindset. Nothing that I can do today is up to the level of my dreams. My only option is to pick a few simple things and do them over and over until I can learn the skills needed to move to the next level. Right now it is past three in the morning, I have just spent over six hours staring at a computer screen, so it is unlikely that I can write anything intelligent here, but I am starting to form some ideas. What I have learned from the book is that big things take time and dedication. I already know this, but also that I need a clear path in my hear as to how I will move forward.
I am falling a sleep here, I will pick this up in the morning.
So, How was the book itself beside very long. What I got from it is that all the things that I am expecting to accomplish during the next year are completely impossible with my current mindset. Nothing that I can do today is up to the level of my dreams. My only option is to pick a few simple things and do them over and over until I can learn the skills needed to move to the next level. Right now it is past three in the morning, I have just spent over six hours staring at a computer screen, so it is unlikely that I can write anything intelligent here, but I am starting to form some ideas. What I have learned from the book is that big things take time and dedication. I already know this, but also that I need a clear path in my hear as to how I will move forward.
I am falling a sleep here, I will pick this up in the morning.
Wednesday, November 11, 2015
I just finished reading another book called the one hundred dollar startup. What I am thinking of right now is how do I start my own business. I do have a YouTube channel that could make money as well as other ideas. But the problem is that I completely fail when it comes to project management. What I am thinking of doing is simply to take programming concepts, sometimes from Wikipedia or other places, and translate them into simple visual explanations. That is clear enough, but the problem is that even the simplest things will have hundreds of sub-projects that will need to be explained separately. Whenever I try to code something, I usually try to do it all at once from memory. Even if I try to make a plan or diagram, I have no real concepts about how to follow a plan and do things step by step. It is easy for someone who knows how to do this sort of thing naturally to not understand how I could have trouble with following a plan, but I have a lifetime of difficulty with this and have only recently learned that breaking down a project into smaller steps was something that you are supposed to do.
For example, what is a suffix tree. I first figured out how to do one of these by drawing a picture. Eventually it was simple enough to understand. When I try to code it, I had some trouble, but I eventually forced my way through it. Even as I am writing this paragraph, the same problem is coming through. I am just writing what comes into my head. There is no way that I could ever run any business this way, but that is just how I think. Before I can move forward, I need to get into the habit of planning before I act. If I can just do this simple thing, everything else will follow.
For example, what is a suffix tree. I first figured out how to do one of these by drawing a picture. Eventually it was simple enough to understand. When I try to code it, I had some trouble, but I eventually forced my way through it. Even as I am writing this paragraph, the same problem is coming through. I am just writing what comes into my head. There is no way that I could ever run any business this way, but that is just how I think. Before I can move forward, I need to get into the habit of planning before I act. If I can just do this simple thing, everything else will follow.
Monday, November 9, 2015
I think I got an idea as to why I can never get anything done, I have no plan. There are many times during the day when I just cannot think of what to do next. For example, I just finished reading a book. I had planned for the book to take four hours because I listen to audio books at double speed while reading the text at the same time. This book only took about three hours and at the end, I just became confused as to what to do next. I figured that it would be time for bed when I was done, and now there is nothing for me to do. If I had a clear to-do list, this would not be a problem at all. One of the books that I recently read told me that habits are just what our brain turn to when there is nothing pulling on us. Like gravity, if we do not push ourselves in the direction we want to go in, we will simply get pulled back towards whatever feels good at the time. Addiction is not a compulsion to do something, it is just what our brain defaults to when it has nothing better to do. If I were to make a to-do list right now, what would be on it. I really don't know for sure. I can pretend like there are those things that I want to do, but those are all random dreams. I really cannot think of anything right now that I very concretely want to do right this moment. There is nothing that is not just a wish like make more money. I could clean my house, wash the dishes, write some JavaScript code, make a YouTube video. All those things are just small disconnected pieces. If you want to learn, there are to be a reason. I would like to learn how to speak Finnish, why? Can I figure out a good way to incorporate that desire into my life goals. I am going to read another book after work tomorrow night, what will I do after I am done. What are my goals, beyond the small things that I would like to do. I really don't know. I keep getting advice from small blogs about how I should write down all I need to do during the day, but what will that do for me. To start with, there is no need to remake your entire life in one day. Having a list of things to do is not a life plan, it is just something to get you started. Making a checklist for a single day and completing everything on it will start you towards something bigger, even if it doesn't look that big at first. At the very least, it is better than nothing.
I really need to update the look of my pages here. Read something about how to get all this to look the way you want.
I really need to update the look of my pages here. Read something about how to get all this to look the way you want.
Books I have been reading, plan to do thirty in thirty days.
1. Saturday November Seven : Charles Duhigg -The Power of Habit.
2. Sunday November Eight : Brendon Burchard - The Motivation Manifesto.
3. Monday November Nine : Gary Vaynerchuk - Crush It! Why NOW Is the Time.
4. Tuesday November Ten : Chris Guillebeau - $100 Startup Reinvent the Way You Make a Living
5. Wednesday November Eleven : Dave Lakhani - The Power of an Hour
6. Thursday November Twelve : Alan Deutchman - Change or Die
7. Friday November Thirteen : Rolf Dobelli - The Art of Thinking Clearly
8. Saturday November Fourteen : Robert Greene - Mastery
9. Sunday November Fifteen : Daniel Coyle - The Talent Code
10. Monday November Sixteen : Alistair Croll - Lean Analytics - Use Data to Build a Better Startup Faster
11. Tuesday November Seventeen : Bill OHanlon - A Lazy Mans Guide to Success 2009
12. Wednesday November Eighteen : Mihaly Csikszentmihalyi - Flow - The Psychology of Optimal Experience
13. Thursday November Nineteen : Dave Logan - Three Laws of Performance
14. Friday November Twenty : Pat Mesiti - The $1Million Reason to Change Your Mind
15. Saturday November Twenty One : Eric Ries - The Lean Startup
16. Sunday November Twenty Two : Ryan Holiday - The Obstacle Is the Way
17. Monday November Twenty Three : Dale Carnegie - How-to-win-friends-and-influence-people
18. Tuesday November Twenty Four : Topher Morrison - Settle For Excellence
19. Wednesday November Twenty Five : Gabriel Wyner - Fluent Forever
************November 26************* House got robbed. No book tonight.
20. Friday November Twenty Seven : Richard Bandler - Using Your Brain for A Change
21. Saturday November Twenty Eight : Richard Bandler - Frogs into Princes
22. Richard Bandler and John Grinder - Reframing - NLP & The Transformation Of Meaning *****************Read two books this day to make up for Thursday.
23. Sunday November Twenty Nine : Maxwell Maltz - Psycho-Cybernetics
24. Monday November Thirty : George Clason - The Richest Man In Babylon
25. Tuesday December First : Josh Linkner - Disciplined Dreaming
26. Wednesday December Second : Howard Dvorkin - Power Up Taking Charge of Your Financial Destiny
27. Thursday December Thrid : Gay Hendricks - The Big Leap
28. Friday December Four : Lisa Haneburg - Two Weeks to a Breakthrough
29. Saturday December Five : Pete Goodliffe - Becoming a Better Programmer
30. Sunday December Six : Theodore Bryant - Self-Discipline in 10 days - How To Go From Thinking To Doing
**** Done the first thirty, but will not stop here.
31. Wednesday December Nine : Gary Keller - The One Thing
32. Saturday December Twelve : Steve Siebold - How Rich People Think
33. Sunday December Twenty : Steve McConnell - Code Complete (2nd Edition)
34. Sunday December Twenty : Gary Vaynerchuk - The Thank You Economy
35. Monday December Twenty One : Jesse Itzler - Living with a SEAL
36. Saturday January Second : Ayn Rand - Ayn-Rand-Atlas-Shrugged
37. Sunday January Eighteen : John Templeton - The Templeton Plan.
38. Monday January Nineteen : Nietzsche, Friedrich - The Birth of Tragedy.
1. Saturday November Seven : Charles Duhigg -The Power of Habit.
2. Sunday November Eight : Brendon Burchard - The Motivation Manifesto.
3. Monday November Nine : Gary Vaynerchuk - Crush It! Why NOW Is the Time.
4. Tuesday November Ten : Chris Guillebeau - $100 Startup Reinvent the Way You Make a Living
5. Wednesday November Eleven : Dave Lakhani - The Power of an Hour
6. Thursday November Twelve : Alan Deutchman - Change or Die
7. Friday November Thirteen : Rolf Dobelli - The Art of Thinking Clearly
8. Saturday November Fourteen : Robert Greene - Mastery
9. Sunday November Fifteen : Daniel Coyle - The Talent Code
10. Monday November Sixteen : Alistair Croll - Lean Analytics - Use Data to Build a Better Startup Faster
11. Tuesday November Seventeen : Bill OHanlon - A Lazy Mans Guide to Success 2009
12. Wednesday November Eighteen : Mihaly Csikszentmihalyi - Flow - The Psychology of Optimal Experience
13. Thursday November Nineteen : Dave Logan - Three Laws of Performance
14. Friday November Twenty : Pat Mesiti - The $1Million Reason to Change Your Mind
15. Saturday November Twenty One : Eric Ries - The Lean Startup
16. Sunday November Twenty Two : Ryan Holiday - The Obstacle Is the Way
17. Monday November Twenty Three : Dale Carnegie - How-to-win-friends-and-influence-people
18. Tuesday November Twenty Four : Topher Morrison - Settle For Excellence
19. Wednesday November Twenty Five : Gabriel Wyner - Fluent Forever
************November 26************* House got robbed. No book tonight.
20. Friday November Twenty Seven : Richard Bandler - Using Your Brain for A Change
21. Saturday November Twenty Eight : Richard Bandler - Frogs into Princes
22. Richard Bandler and John Grinder - Reframing - NLP & The Transformation Of Meaning *****************Read two books this day to make up for Thursday.
23. Sunday November Twenty Nine : Maxwell Maltz - Psycho-Cybernetics
24. Monday November Thirty : George Clason - The Richest Man In Babylon
25. Tuesday December First : Josh Linkner - Disciplined Dreaming
26. Wednesday December Second : Howard Dvorkin - Power Up Taking Charge of Your Financial Destiny
27. Thursday December Thrid : Gay Hendricks - The Big Leap
28. Friday December Four : Lisa Haneburg - Two Weeks to a Breakthrough
29. Saturday December Five : Pete Goodliffe - Becoming a Better Programmer
30. Sunday December Six : Theodore Bryant - Self-Discipline in 10 days - How To Go From Thinking To Doing
**** Done the first thirty, but will not stop here.
31. Wednesday December Nine : Gary Keller - The One Thing
32. Saturday December Twelve : Steve Siebold - How Rich People Think
33. Sunday December Twenty : Steve McConnell - Code Complete (2nd Edition)
34. Sunday December Twenty : Gary Vaynerchuk - The Thank You Economy
35. Monday December Twenty One : Jesse Itzler - Living with a SEAL
36. Saturday January Second : Ayn Rand - Ayn-Rand-Atlas-Shrugged
37. Sunday January Eighteen : John Templeton - The Templeton Plan.
38. Monday January Nineteen : Nietzsche, Friedrich - The Birth of Tragedy.
Sunday, November 8, 2015
I have a slight problem here. There is this Finnish Song that I am trying to learn and my current method is to write down something twenty times, mostly from memory until I know it perfectly well. I have use this method to learn the alphabet backwards and also other small things. The problem is not really learning the song, its the way that I am trying to learn it. Instead of learning parts of the song and then moving on to another part, I just try to learn the whole thing all at once. I have spent two nights now trying to copy every word in a text that I mostly don't understand. My brain has been fighting against the process all the time and I have a lot of trouble getting up the will power to even start doing it. All I can think about is that I have to do this twenty times, that does not make any sense. Right this moment, I have no idea what to do next, nothing really seems to work. But of course, how could anything work, I have never taken the time to really learn anything about learning a language. There are no good books about learning Finnish that I can find, but I could simply read one on learning Spanish and apply some of the same methods to the Finnish language. I have been reading, or at least looking at all I can find on this language for seven years so I do know how it works well enough to get through it, all I need is a method for learning and practicing.
On another note, what I am focusing on? I have all these things that I want to do but there is no one thing that I really focus on during the day. I come home from work and I either go look at my computer all night or look for something that I can do in the house. At best I try to think of new ways to make money or learn something. Tonight I am going to read the book, Brendon Burchard - The Motivation Manifesto. I just got a preview of that and what it shows is that you must say no to most things and focus all of your attention on a single thing in order to move forward.
On another note, what I am focusing on? I have all these things that I want to do but there is no one thing that I really focus on during the day. I come home from work and I either go look at my computer all night or look for something that I can do in the house. At best I try to think of new ways to make money or learn something. Tonight I am going to read the book, Brendon Burchard - The Motivation Manifesto. I just got a preview of that and what it shows is that you must say no to most things and focus all of your attention on a single thing in order to move forward.
This is a video from the author of the book. From this I am seeing how much I have been wasting my time trying to do too many things at once. I am going to start reading the book now. I am not sure how much I can learn from it, but we will see how far this gets me.
Saturday, November 7, 2015
I just had an idea: I have been writing posts, making videos and reading articles about programming of all sorts, but it never really occurred to me to just read a book on the subject. I could simply read a book on game programming, make a number of small programs, then assemble each one of these programs into a fairly good game with relatively little effort. However my life habit has always been to look for the shortcuts or the quick fix. I am the kind of person who will gladly work double shifts at work five days a week. Getting just four hours of sleep every night for months at the time is something I am used to do quite often. Because of these events, I have always assumed that this meant that I was a hard worker, but now I am realizing that it is quite the opposite. The reason why I can work harder than anyone else at my job is because the job does not require any thinking. It is all stuff that can be done with habit, and an ability to remain focused on an endless series of simple tasks. With programming there is not simple task, at least not the way I do it. I can write pages of code and just sit there for hours staring at a screen, as long as it is all stuff I already know. I like the idea of finally figuring out a difficult problem, but when I have a long series of problems with no end in sight, the feeling of accomplishment that I anticipate and crave from being able to last a sixteen or eighteen hour shift at work, or the satisfaction of completing a project the way that I want never shows up. I just lose interest, and soon revert to looking for a simpler, quicker way of getting my fix.
I have been reading this book called The Power of Habit by Charles Duhigg, in it it shows that our behaviors are mostly the product of small subconscious actions that are triggered in ways that we do not even notice. I need to break my habit of looking for short cuts and start setting clearly written programming goals. Before long, I need to have a working game. Before that however, I have to write down what I need to do to get there. I think that the problem is the fact that I never really try to plan anything. At my job, all the planning is done for me. I am assigned a task, I do it as best I can, then I get another on. It does not matter how long I have to work, I never need to try to figure out what to do next. At home however, when I need to get something done, my only strategy is to just sit down and try to do it, without a plan. I am accustomed to just figuring out what to do by simply knowing how to do it. But if something comes along that is too big to hold in my head, my only habit is to just push against it, sometimes for years, until I just give up in frustration. Most things are easy if you can break them down into smaller tasks, and then do those tasks one at the time, but I have never learned how to do that. I have tried to break down tasks, but I quickly give up because it is the complete opposite of how I am accustomed to doing things. That is the real power of habits, I just have to push and break my head on every problem I come across. I have been trying to learn the Finnish language for seven years now. I have spent months of my life trying to translate an entire book form Finnish to English. I have read many articles that shows grammar rules and other aspects of the language. I have forced myself to sit down and do all of those things, but I don't remember ever really trying to follow an actual course. I think I have read books on the subject, but really all I ever did was skim across the pages looking for tricks that would help me learn faster. I never really stopped to plan how I was going to approach the language. I am sure that I could have read a book for real, followed a course plan, and be at least functional in the language by now, but I never did any of this. My only habit is to work harder than anyone else, for as long as it takes. Now I need to change everything and learn to work smarter. The plan for now is to read something about programming and practice it exactly, even when all my instincts are telling me to jump ahead. This is going to be the hardest part, to not just feel as if I know enough and just jump in.
I have been reading this book called The Power of Habit by Charles Duhigg, in it it shows that our behaviors are mostly the product of small subconscious actions that are triggered in ways that we do not even notice. I need to break my habit of looking for short cuts and start setting clearly written programming goals. Before long, I need to have a working game. Before that however, I have to write down what I need to do to get there. I think that the problem is the fact that I never really try to plan anything. At my job, all the planning is done for me. I am assigned a task, I do it as best I can, then I get another on. It does not matter how long I have to work, I never need to try to figure out what to do next. At home however, when I need to get something done, my only strategy is to just sit down and try to do it, without a plan. I am accustomed to just figuring out what to do by simply knowing how to do it. But if something comes along that is too big to hold in my head, my only habit is to just push against it, sometimes for years, until I just give up in frustration. Most things are easy if you can break them down into smaller tasks, and then do those tasks one at the time, but I have never learned how to do that. I have tried to break down tasks, but I quickly give up because it is the complete opposite of how I am accustomed to doing things. That is the real power of habits, I just have to push and break my head on every problem I come across. I have been trying to learn the Finnish language for seven years now. I have spent months of my life trying to translate an entire book form Finnish to English. I have read many articles that shows grammar rules and other aspects of the language. I have forced myself to sit down and do all of those things, but I don't remember ever really trying to follow an actual course. I think I have read books on the subject, but really all I ever did was skim across the pages looking for tricks that would help me learn faster. I never really stopped to plan how I was going to approach the language. I am sure that I could have read a book for real, followed a course plan, and be at least functional in the language by now, but I never did any of this. My only habit is to work harder than anyone else, for as long as it takes. Now I need to change everything and learn to work smarter. The plan for now is to read something about programming and practice it exactly, even when all my instincts are telling me to jump ahead. This is going to be the hardest part, to not just feel as if I know enough and just jump in.
Answer:
First you create a canvas and a context. To get all the numbers to fit neatly in a grid pattern, we need to calculate the position of each cell, and each number. To make everything look better here I will use a margin and patting to make each cell look like a button. You could also use JQuery or something else to get a better look, but this is just to make code that you can replicate and play with. To draw each cell in the right place, we need a nested for loop for the X and Y axis, rows and columns. It is not important here which loop comes first, we just need one inside the other. Because we are making a multiplication table, we need one row and column than is specified. For example, to show a times table for every number from one to twelve, we would need thirteen rows and thirteen columns. Inside the inner loop, we are drawing each cell. At this point you would only need to draw the number at the center of each cell and you are done, but we need to know where the center of the cell is and where to draw the margins. The code also uses different colors for when a cell in a source number or a result number. Red for a result number and green for a source. Because both the loops count from zero, we identify a source number as when the row or column value is zero and set the colors accordingly. If the number in the cell is not a source, then its value is just the value of the first for loop, multiplied by the value of the second for loop. Now to draw the cell. The starting position of the cell begins with the X and Y values from the two for loops, multiplied by the width and height of each cell. The ending position is those values plus the width and height of each cell. But that is not enough in this case, we now need to calculate the padding and the margins. This is used to show a space between cells and to give the appearance of a raised button. Padding and margin at the top of the cell is achieved by just adding the values from the top of the cell. However, because JavaScript function fillRect in the HTML 5 canvas uses heights and width to draw rectangles, we need to calculate the size of the rectangle by taking into account all the sides of the cell. So the width of the rectangle in the middle of the cell is the width of the cell, minus the padding times two. To calculate for both the padding and margin together, just do the same thing by first adding both values before multiplying them by two and subtracting that from the cell's size. Now that we have our separation between our buttoned cells, it is time to draw the number using the JavaScript canvas methods for text drawing. We first set the font, then we align the text to the center of the the position we provide and set the color to white to make it stand out. Now we draw the number. To convert a number to string in JavaScript, we use the toString method. All numbers and strings are objects with their own methods in JavaScript. To calculate the point where we draw the number, we take the position of the cell plus the size of the cell divided by two to get the center. By that is not enough. Even though we specified that the text should be centered, JavaScript and the canvas only centers horizontally, so that the text is above the center of the cell. To compensate, we add half the height of our font to the center of the cell to get the text centered properly. It is possible to calculate the height of the text on the fly using JavaScript HTML5 canvas methods, but this works differently of each browser and I just don't want to get into that here. The result of this code is a simple looking multiplication table. I have also added code to change the color of cells when the mouse comes inside of them. For this to work however, you will have to remember to update the canvas each time you get the JavaScript onMouseMove event. Otherwise, the image will not change. The mouse coordinates are for the window, not the image, so we subtract canvas.offsetLeft and canvas.offsetTop to compensate for the position of the HTML5 canvas on the page.
Subscribe to:
Comments (Atom)