RSS

Tag Archives: Coding

A Post Across Two Blogs

Image

Where did my mind go?

I admit that I have a problem.

That problem is that I have to try-really try to be organized (if any students are reading this, they won’t believe that I am ever organized, even after trying, but that’s only partly correct). It does not come naturally to me and I tend to add complexity when I should be adding simplicity. The good thing is, at least I recognize this and I have a couple solutions, one of which I’ll fess up to right away: When I get lost in my own web, the best thing I can do is put my problem down and come back after a good night’s sleep.

It’s rare that I actually get a good night’s sleep though, but it often works out that any degree of shut-eye will do. And this is just what neurologists have been telling us for a long time. We don’t fully understand sleep, but we do know that it’s important. Recent data has just come out from the University of Wisconsin-Madison lending further support to the hypothesis that sleep is an organizing tool for our brains.

Image

Really, this is an important part of my work.

 

 Dr. Giulio Tononi, of the UW Center for Sleep and Consciousness. “During wake, learning strengthens the synaptic connections throughout the brain, increasing the need for energy and saturating the brain with new information. Sleep allows the brain to reset, helping integrate newly learned material with consolidated memories, so the brain can begin anew the next day.”

We know that sleep functions in many ways to help out brains. Again, from the UW-M website,Indeed, there is evidence that sleep enhances important features of memory, including acquisition, consolidation, gist extraction, integration and “smart forgetting,” which allows the brain to rid itself of the inevitable accumulation of unimportant details.”

Prior work from Brown University also shows that “sleep is not just a waste of time.” While the data from UW-M suggests that sleep is important in the organization, integration and normalization of new material, Masako Tamaki and co-workers from Brown have shown that sleep is necessary in order to learn new motor tasks. This means, that we need sleep not only to make sense of information, but also to be able to retrieve it more efficiently and tie it to specific musculature functions (e.g. riding a bike, playing an instrument).

The other evening I was lost in the complexity of a new programming project I have been working on. I had an idea of how I wanted to attack the task, but it involved learning a number of new methods for handling and retrieving data. The point of the project was to create an program that was incrementally advancing in the way it was crafted – i.e. it was a learning tool for me. There’s no need for this project, just practice for me. Yet, I was doing something that I’ve learned not to do again and again in science. I was adding more than one variable to an experiment and then being frustrated by my inability to work out the kinks and get any meaning.

I needed sleep and knew it. So, I did the nest I could to make notes about what I was dealing with and closed everything (including myself) down.

The next day, I gave myself permission to re-examine the problem from scratch and figure out if I was going about it in the best way possible. The first thing I did was to ratchet back the number of new methods used and made a larger, more cumbersome program, but one that was functionally simpler. I also permitted myself to ‘cheat’ a couple of aspects of the program in order to get it working and then try to re-introduce the items that I cheated by removing before. An example of this was to just use a simple integer, like ‘5’ where I really wanted to generate a random number based on the size of a container that was holding ‘objects’ I used in the program. This meant that I could focus on the use of the data without needing to feed in the ‘real’ information yet.

Most importantly, I feel better about the project now. I think I can finish it with a couple more hours of work and I don’t think I have to throw my computer out of a high window just yet. Take my advice. When working on something that is giving you trouble, give it a good go, then stop, sleep, regroup, and start fresh the next day. Your time is better spent sleeping than spinning your wheels.

code_cpp

goto the code

In fact, I am still having problems, but they are becoming more well defined and manageable. I’m posting the program itself and some discussion of my problems on my other blog, but I thought I would start with a little Neurobiology here first.

Sarah Allen in the Southern Methodist University explains how this works when learning music…

 
4 Comments

Posted by on May 15, 2014 in Uncategorized

 

Tags: , , , , , , , , , ,

Clowns, Psychology and C++

Image

not clowns!

The semester has ended and I’m starting to play with some other projects like C++ coding, working on the next mythology book (this time the educational focus is Latin, rather than science – but I consider it part of the same series) and some other writing projects.  In my most recent C++ coding problems I’ve been trying to get a good handle on how to manipulate objects and create vectors (like arrays) of objects. In order to do this, I’ve made several simple projects to generate a vector of objects (I’ve chosen my vector to be a clown car and my objects to be clowns).

The basic setup was a little tricky (for me), but I managed it with a little help from the good people at dreamincode.org. As the next step in this project, I’m expanding my program to allow for the clowns to interact with one another, eventually kicking one another out of the car. I’ve outlined my basic project on my ayearincoding blog. If you have any interest in coding, take a look there and either learn along with me or help me out.

In looking for some clown art for these posts, I came across an interesting article in smithsonian magazine about the psychology surrounding people’s fear of clowns. The reason I find this particularly interesting right now is two-fold: 1. I’m reading Stephen King’s ‘It’ right now. 2. My wife doesn’t believe me that anyone is afraid of clowns.

 
2 Comments

Posted by on May 13, 2014 in Uncategorized

 

Tags: , , , , , ,

Two Projects

ImageI’ve been playing with a couple computer projects lately. One is trying to pick up some additional HTML / CSS skills so I can have a little better sense of a big picture with my coding club. To this end, I just got a couple of new books, Head First HTML and CSS    and    Head First PHP and MySQL.

So far, I’ve read through a decent amount of the HTML book, which I can skip through pretty easily if I need to as a lot of it is review. However, what I really do find unique about these texts is that they are both comprehensive and interactive. You need to commit to doing the practice exercises as you go along, but seriously, isn’t this what you’re reading this for anyway?

The other project is an infection model. The first iteration of this is similar to the zombie simulations that several people have created online with the exception of having thee classes of people (vaccinated, unvaccinated and infected). As the people wander around in a user-defined room, they may come in contact with one another. In the event that an infected individual comes into contact with an uninfected, unimmunized person, then that person gets infected.

In the currently functional version I can advance one step at a time where all people randomly move on both axes +1, 0 or -1, then are tested for new infections. The next step is to automate the movement and provide reports including how many people are infected each round.

Eventually, I would like to use this to model the spread of infection across the US (using actual state population and size data) and user- supplied info about immunization and infection rates. A similar program exists on the cdc website that simulates the rate of infection spread in a single population. I would like to cross that with a heterogeneous Imagepopulation (different population densities in each state) specific connectivity of states that could mimic regional outbreaks and ultimately a graphical output (this last will likely never happen, but it’s good to have an ideal in mind).

 
Leave a comment

Posted by on September 20, 2013 in Uncategorized

 

Tags: , , , , , , ,

ImageCoding Club today.

There’s a chance I may be getting more takers for my ‘Codecademy’ – based coding club at FSCC soon. Several students have shown interest and I look forward to opening up the class towards becoming a more open space with students (including myself) pursuing a number of projects simultaneously. 

If anyone (local, at least) is interested in joining our group, please feel free. We take all comers and look forward to building our numbers with anyone interested in learning, teaching or challenging themselves.

If you’re not local, I’d still be interested in hearing from you if you’d like to start an online learning community tied to codecademy, code school, or any other online resource.

 
Leave a comment

Posted by on August 30, 2013 in Uncategorized

 

Tags: , , , , , , , , , , , ,

Upcoming Semester

I have about two weeks before the next semester begins. I’m going to be teaching General Biology and MicroBiology in the Fall and the MicroBiology and Ecology in the Spring. During the semester, this blog changes focus to include many more academic topics, but I will still be posting Coding Challenges and other non-biology material. Also, I have moved my comments on film to another page called 100 films in 100 days (a project which I am slightly behind on, but feel like I can still catch up). I have considered splitting my coding posts to another site as well, but I fear that I will fractionate both my audience and my posting frequency in one fell swoop.

As a lead-in to the semester, I thought I would publish the mindmap I constructed for General Biology (I’m hoping to use it as a hyperlinked table of contents in my iBook).

Image

I hope this is readable

 
Leave a comment

Posted by on August 4, 2013 in Uncategorized

 

Tags: , , , , , , ,

Now What?

A number of software development courses, such as Codecademy or even traditional university classes, prepares the student to solve problems using their language of choice, but leaves them unprepared to go to the next step.  This next step is to take what you have created and fold it into something free-standing and usable; Something you can share with friends; Something attractively packaged.

My own dilemma is that I have been taking classes and practicing programming C++ on my mac using XCode as my IDE. Now that I have actually created something (a personal summertime project between classes), I want a good way to present my work. Something more attractive and user friendly than the Terminal environment I currently have.

According to apple, my next step is Cocoa. But, what is Cocoa?

Apple defines Cocoa as “Cocoa is an application environment for both the OS X operating system and iOS, the operating system used on Multi-Touch devices such as iPhone, iPad, and iPod touch.” Which could be meaningful… but not very descriptive to me.

Image

                            Hot Cocoa

For anyone familiar with Apple lore, Cocoa was first introduced as NeXTSTEP in 1989: A product of Steve Jobs’ successor company NexT. “You can use several programming languages when developing Cocoa software, but the essential, required language is Objective-C … You can even mix C++ code with your Cocoa code and link the compiled code into the same executable.”  It is this last phrase that gives me hope that I can figure out how to possibly use the work I have don’t so far and weave it (somehow) together with cocoa to add a friendlier appearance to my work. Furthermore, it looks like I could also use Ruby or Python with Cocoa, two languages that I have been working with and find to be somewhat less awkward at times than C++.

So, how to actually put this together: C++ and Cocoa?

            -I’ve been sifting through resources for a couple days now trying to identify some starting point to this without much luck.

-Perhaps this is the wrong way to go about using my C++ code, but is there another way?

 
Leave a comment

Posted by on August 4, 2013 in Uncategorized

 

Tags: , , , , , , , , , ,

New Coding Challenge – The Quincunx!

ImageThe Quincunx – A triangular pegboard that will create a nice normal distribution as balls are dropped from the top and bounce down randomly over the triangular array of pegs.

Society’s greatest achievement, The Price Is Right, demonstrates the use of a plinko board in this video with the most excited player ever.

The coding challenge is to design a quincunx that demonstrates each of the following four points… No animation is required, simply (1)show the board as an array of X’s with a (2) user-determined number of rows (1-20) and the (3)resulting bins filling with integers as a (4)user-determined number of balls (1-100,000) is dropped. This time, I’m awarding prizes to the cleanest, most clearly documented entries in each language represented on Codecademy (Ruby, JS, Python).

As always, the prizes are bragging rights, presentation of your code on my blog with full attribution to you and a promo copy of any of my eBooks on iPad for you to share with the youngster in your life (or keep yourself). Each of my books presents educational material  in the form of a story (Heracles and the Gas Laws, Sisyphus and the Laws of Motion, Zombies and Fractions).

Happy Coding!

(submit your entries as links in the comments below)

 
Leave a comment

Posted by on July 10, 2013 in Uncategorized

 

Tags: , , , , , , , , ,

RubyMonk

ImageI mention codecademy all the time here and rant about how great a way it is to learn a variety of languages and markups online, on your own time and free. I’ve been following both the web programming track and the Ruby tracks aggressively lately (I’m on a 20 day streak presently). However, I have to also mention another free site that does much the same thing. RubyMonk offers free online courses in Ruby (and Python, under PythonMonk). The Monk websites are clean, well structured and provide an element of atmosphere as well.

Unfortunately, RubyMonk does not provide a forum where I can pitch my project challenges – er, I mean Koans. But if you are learning Ruby or Python with the Monk, please feel free to come here from time to time to see if there are any simple programming challenges open.

 
Leave a comment

Posted by on June 28, 2013 in Uncategorized

 

Tags: , , , , , , , , ,

Winding down Coding Challenge I

ImageI’ve received several entries answering my coding challenge to demonstrate / test Goldbach’s Conjecture that all even numbers > 4 are the sum of two primes. So far python has been the language of choice for entries.

 

I will be closing down this challenge as of June 30 at 11:59pm.

Once I take a look at the entries, I’ll award the prize, a copy of my iBook, In Parts to the winner and post the code here with a walkthrough to show how the problem was tackled as well as any interesting comparisons between entrants.

 
Leave a comment

Posted by on June 26, 2013 in Uncategorized

 

Tags: , , , , , , , , , , , , ,

Coding Challenge II: Make Mine a MASTERmind

ImageDon’t worry, Coding Challenge I is still open, but someone was writing about games to develop in the codecademy discussion groups. 

A while ago, when I was first following the JavaScript pathway, there, I decided to write a MasterMind program. Many of the versions I saw prohibited players from using the same number/color more than once, but I felt that was a cop-out. My solution works, but as usual for me, had some tortuous logic.

So, here’s the challenge:

In any language, write a MasterMind game where the computer chooses the numbers and the user deduces them.

1. use numbers (four of them,#s1-4, randomly chosen by the computer), rather than colors

2.  that allows multiple uses of the same numbers, i.e. ‘1122’

3. provides appropriate feedback to the user to help them close in on the correct sequence.

4. keeps track of the number of turns taken

5. (optional) can also be played with 2 users -or- user sets the code and computer guesses

6. (optional) allow user to select # of positions and range of numbers used.

 

simple code trumps tangly code. I prefer languages I can read (C++, javascript, python) but all are welcome.

 
Leave a comment

Posted by on June 22, 2013 in Uncategorized

 

Tags: , , , , , , , ,