Text

A Lesson Learned in Keeping Things Simple.

For nearly three weeks I have been working on this basic counting problem.  I have tried numerous attempts, all of which have resulted in either the code looping infinitely or resulting in breaks in the arithmetic that resulted in failed doctests for certain integer values.  

 Now that my brain has had time to process the logical flow of how Python handles each line of code, I have gained a sense of clarity that resulted in a simple solution for counting the number of even digits in an integer.  

 My initial attempts included the arithmetic needed to strip the integer being assessed within the “while” loop after the test for a positive integer.  This resulted in the value being returned to be either 0, 1, or for the function to continuously loop.  Once I realized that the while loop should be used to asses and count the number of even digits only, I was able to get the function to work better.  

I then moved the logic around so that the integer argument was assessed first for a state of being positive or negative before stripping it down by a base of ten; the logic worked for most values.  

This function would first check whether the integer n was even or odd.  If even, 1 was added to the count.  Else odd, it kept the count at its previous value.  With each pass through the loop, n was being stripped down by a base of ten and the loop was repeated until the value of n was decreased to less than zero.  

In order to anticipate the way in which the value of zero would be handled by this loop, a predetermined branch was needed to evaluate zero properly.  Since zero % 2 == 0, zero had to be treated as an even integer and counted as 1 even digit:

Lastly, a doctest was ran against the function to ensure that it worked for a sample of values.  So far so good.  

While simple enough, this problem has helped me to really understand how straightforward Python is when handling the logical flow of a script.  

Video

thedailywhat:

Mathematical! of the Day: Biola University math teacher Matt Weathers (previously, and, also) gives his Nature of Math class another one of his patented Pranksgiving lectures.

[mdweathers.]

Link
Text

Developing a Programing Flow to Trouble Shoot Bugs

I have been trying for nearly a week and a half to figure out how to construct a Python program that would count the number of even digits in a single integer argument.  Sounds simple enough, right?  

EEEEEEEHHHHHHHNNNNNNNNN!  

 So far I have spun my wheels trying various different approaches.  Sometimes, it will give me the right answer and sometimes it won’t.  

 In order to move forward with this very simple problem so as to reach an effective  solution, I have devised a program flow process in plain English detailing what specific steps the program must execute in order to count the number of even digits in a single integer argument.  This is a technique that I wil need to continue to include for future programing composition tasks.  

 I know that I need to construct a while loop through which an integer can be:

 1. Tested at each base of ten for even or oddness using branching.  I will use the test n % 2 == 0 so that the result evaluates to either even or odd.

 2. If the integer being tested is even, the count is incremented up by one from zero.  Else, the count remains the same as the previous iteration count value.

 3. Before the integer passes back through the loop, it must next be stripped down by a base of 10 for the assessment pass using n = abs(n) / 10 (see previous post). This is where my current logic is breaking down.  I need to learn more about how Python handles such a loop.  My current code has this functionality come after the even/odd test mentioned above inside the while loop.  

 4.  This process must be continued until the result is less than 1 at which point the entire loop will terminate and return the value of the variable named “count”.  

That’s what I have so far.  Will I ever solve this problem?  Stay tuned to find out!  


Text

Buggy Iterations

Today I was tasked with creating a basic counting program that would count the number of digits in any single number passed to the program as the argument n.  The first step was to understand how the number zero would behave in the following function:

Firstly, the arithmetic used to change and reduce the value of n each time it was passed through the “while” loop would return the value 0 for the digit zero, I had to modify the logic to include a condition for handling the digit zero.  Since zero is treated by the math in the original function as the absence of a value, telling the program to watch for zero and assign the arbitrary value of 1 to it would allow the program to exit the function loop and return the proper value of 1: 

The second step was to understand how negative numbers would impact the programing arithmetic.  Since the math used to change and reduce the the value of n iteratively in the original programming would result in an infinite loop whenever n was negative, the data type abs(n) had to be included somewhere in the logic: 

By itself, the original programming could not allow a negative number to ever equal the value assigned to the variable called count.  This is due to the output of n always being a negative number or less than the value of zero.  In order for the function to terminate, the value of n must at some point be equal to zero.  

 Finally, a basic doctest was ran against the program in order to test its logic to ensure that it was properly handling the values being passed as n into its function.  I was frustrated to find that the doctest was failing on one of the tests, but not because of faulty programing.  No, instead the doctest was expecting a result but it still “got” the same right, result.  I searched online and found the following solution 

Turns out that this “failure”was due to there being an extra space (cursor point) after the expected value for the “failed” doctest parameter.  Once I removed the extra space, the doctest passed!

 

Note how the last test had a space after the assigned value of n == -12345.  I had to backspace to that point to find the extra cursor mark since it would not going to show up otherwise. 

I removed that space and then returned the value “5” to the right spot in the dockets parameters.  

I am glad that I took the time to work through this basic program.  I feel as though this computer science stuff is finally starting to sink in!   

Video

laughingsquid:

How Much Does The Internet Weigh?

This is so awesome.  I wonder what the long term ramifications of having all those electrons moving about in set patterns could have on humans and the rest of the physical world.  At present, maybe the effect is of no consequence.  

Since mankind will most likely continue to create and store increasingly complex data structures, at what point could this become an issue as the speed of data transfers increases along with our networking capabilities?  Considering that in nature, electrons are all over the place moving about in somewhat random trajectories given the physical constraints acting on them, maybe there are other more threatening masses to concern oneself with.  But, what happens when we start guiding electron paths into specified constructs on an incresingly smaller scale than say the electrical wiring within a skyscraper?  If those electrons are no longer seemingly adrift within the conduits that channel them, does not their potential become more awesome?  

Or am I just jive talking?  Again.

Text

Hello folks!

I have been really enjoying my time here on Tumblr!  Lots and lots of creative and fun people contributing to the collective landscape here.  And there are some jerks, but never mind the jerks, right?  

Anyhoo, I have finally determined what this blog should be about!  

:DRUMROLL:

I will be using this blog to post about my n00bish journey through the world of programming with Python, Java, and user interface design, along with a dash of cute cat pics and a pinch of of memes, just to keep things fun.  

Since I am just learning my way around a terminal, I have a lot of unanswered questions about the programming logic I need to compose in order to complete the problem sets found in the textbooks I am studying.    

Additionally, I hope to chronicle all the fun little bugs and subsequent solutions for said bugs I find so that my efforts may serve as a reference point for other n00bs to use in their attempts to figure this stuff out.  

Finally, I’ll be posting about my musings regarding the impact information technology has on civilization and our perception of the world around us.  I promise not to go completely off the deep end in doing so.  

So get set, get ready, and be prepared for my blog posts!  I promise I’ll try not to bore you to tears in the process.  All that I ask is that you don’t laugh at me directly.  Please, have the decency to at least wait until I have my headphones in, my music on, and my back turned the other direction before scoffing at my efforts!  

Toodles 

Photo
thedailywhat:

Genuine Happiness of the Day: Redditor TheLakesnapped this heartwarming photo of a Kenyan kindergartner who just finger-painted for the very first time.
They explain:

I took this photo while studying abroad in Kenya during the Spring of 2010. A few friends and I were about to climb Mt. Longonot when we stumbled upon a pre-primary (kindergarten) school. A week later we returned with school supplies for the 30+ students who attended the school. We have since started a non-profit organization to raise money to provide the children with a daily meal, school supplies, de-worming medicine, and a new school.

Thanks to the nonprofit, construction of a brand new school for the kids is scheduled to begin in January.
[reddit.]

thedailywhat:

Genuine Happiness of the Day: Redditor TheLakesnapped this heartwarming photo of a Kenyan kindergartner who just finger-painted for the very first time.

They explain:

I took this photo while studying abroad in Kenya during the Spring of 2010. A few friends and I were about to climb Mt. Longonot when we stumbled upon a pre-primary (kindergarten) school. A week later we returned with school supplies for the 30+ students who attended the school. We have since started a non-profit organization to raise money to provide the children with a daily meal, school supplies, de-worming medicine, and a new school.

Thanks to the nonprofit, construction of a brand new school for the kids is scheduled to begin in January.

[reddit.]

Photo
catasters:

And now...sleep

catasters:

And now...sleep

Photo
meanjollies:

Finally, I will say that learning to create software changes you and makes you different. Not better or worse, just different. You may find that people treat you harshly because you can create software, maybe using words like “nerd”. Maybe you’ll find that because you can dissect their logic that they hate arguing with you. You may even find that simply knowing how a computer works makes you annoying and weird to them.
To this I only have one piece of advice: they can go to hell. The world needs more weird people who know how things work and who love to figure it all out. When they treat you like this, just remember that this is your journey, not theirs. Being different is not a crime, and people who tell you it is are just jealous that you’ve picked up a skill they never in their wildest dreams could acquire.
You can code. They cannot. That is pretty damn cool.
-Zed Shaw

Amen.  Considering how far we as a human race have come, why any person would purposely choose not push the very boundaries of their intellect is beyond me.  No matter what one’s inclinations may be, I believe we owe it to all the rest of humanity to push the envelope by making ourselves incrementally better each day.  Nothing good ever comes from mediocrity.  
Sure, it’s hard to change, at first.  But once you get the “fly wheel” of the intellect going, there’s just no turning back!  
I highly recommend Shaw’s Learn Python The Hard Way for anyone looking to break into programming.  Also, How to Think Like a Computer Scientist: Learning with Python v2nd Edition (Elkner, Downey, Meyers)  is another fantastic, human friendly, look into how computer programs are constructed.  

meanjollies:

Finally, I will say that learning to create software changes you and makes you different. Not better or worse, just different. You may find that people treat you harshly because you can create software, maybe using words like “nerd”. Maybe you’ll find that because you can dissect their logic that they hate arguing with you. You may even find that simply knowing how a computer works makes you annoying and weird to them.

To this I only have one piece of advice: they can go to hell. The world needs more weird people who know how things work and who love to figure it all out. When they treat you like this, just remember that this is your journey, not theirs. Being different is not a crime, and people who tell you it is are just jealous that you’ve picked up a skill they never in their wildest dreams could acquire.

You can code. They cannot. That is pretty damn cool.

-Zed Shaw

Amen.  Considering how far we as a human race have come, why any person would purposely choose not push the very boundaries of their intellect is beyond me.  No matter what one’s inclinations may be, I believe we owe it to all the rest of humanity to push the envelope by making ourselves incrementally better each day.  Nothing good ever comes from mediocrity.  

Sure, it’s hard to change, at first.  But once you get the “fly wheel” of the intellect going, there’s just no turning back!  

I highly recommend Shaw’s Learn Python The Hard Way for anyone looking to break into programming.  Also, How to Think Like a Computer Scientist: Learning with Python v2nd Edition (Elkner, Downey, Meyers)  is another fantastic, human friendly, look into how computer programs are constructed.  

(via hackedy)

Photo
This is one shot from Rebecca Finch’s “Sleepwalker” series.  I love the mood of these pics.  

This is one shot from Rebecca Finch’s “Sleepwalker” series.  I love the mood of these pics.  

Photo
I do believe my inner child is in fact, George Costanza…

I do believe my inner child is in fact, George Costanza…

(via dwight-you-ignorant-slut)

Photo
salveo:

Joanna Newsom

She is such an amazing artist.  Her vocal style can be a bit off-putting the first time you hear her sing a song.  But, after listening to the passion her music conveys, it becomes evident that she is in fact creating the music from a part of her own being, deeply organic and deeply human.  As such, her music then takes on a refreshingly semantic charm that is quite easy to immerse oneself within.   

salveo:

Joanna Newsom

She is such an amazing artist.  Her vocal style can be a bit off-putting the first time you hear her sing a song.  But, after listening to the passion her music conveys, it becomes evident that she is in fact creating the music from a part of her own being, deeply organic and deeply human.  As such, her music then takes on a refreshingly semantic charm that is quite easy to immerse oneself within.   

Photo

(Source: samwitwicky, via mostsmartest)

Photo