Thursday, September 16, 2010

CS106B, Libraries, and following along with the Videos

I was able to sucessfully complete the Free CS106A course - Programming-methodology- available online from Stanford University and was excited to start the second course in the series - CS106B - Programming Abstractions. The first course was fantastic and I learned a lot including learning a new programming language, Java, which I had very little experience with. I had a bit more experience with C and some C++ but not enough that I would consider myself to be a developer. Well... getting back into the C/C++ world, starting CS106B, reminded me just what a nightmare using Visual Studio could be.

For starters, when I reviewed the material I needed for the course, I had no end of trouble tracking down the text book. For the CS106A course I was able to go to Amazon.com and order - "The Art & Science of Java" by Eric Roberts which was expensive but invaluable when taking this class online. I was hoping something similar would be available for this course. While there was something available called "Programming Abstractions in C" it was made clear that the course would actually use a new version that had been updated for C++. I searched all over until I finally found it available for download on scribd. It cost money for me to sign up for the day to download the text but at the time I felt it was totally worth it! ($5 for a textbook... what a bargain!). However, later I found that the reader is available free for download from the CS106B website.

Now that I had the text, I was excited to dive in and start! I watched the first 4 videos online, read the first 3 chapters and got ready to boot up my development environment and dig in! Of course things didn't go smoothly. For starters, the CS106B Windows libraries that you download for the course are built into an installer which requires that you have VS2005 installed on your machine. My machine had 2008 and 2005 installed but the installer still refused to run and after various attempts to dig the files out of the installer manually I went looking elsewhere for the libraries. I tried various ways of getting the libraries and making them work with the programs downloaded with the lecture videos to no avail. Linker errors galor! Oh Visual Studio how I love thee! :)

Finally I stepped back and started fresh and came up with the following steps to get these older programs (circa 2006) with the new libraries from the 2010 class:

Steps to Make CS106B projects Work with new Libraries

Assumes you’ve already downloaded the Full set of materials and unzipped the seven programming assignments into their own folders.

1.) Download one of the latest projects from the Stanford CS106B Website:

http://www.stanford.edu/class/cs106b/spring/assignments/assn-0-narcissism-pc.zip

2.) Unzip the project and find its subdirectory \CS106. This is the folder that contains all the library (CS106CPPLib.lib) and header files for the CS106 program.

3.) Copy this folder as a subdirectory to one of your assignment folders (ex. C:\Assignment1\CS106.

4.) Startup Visual Studio2008 and click File->New->Project… When given the choice choose to create a new Console program.

5.) You’ll then be presented with a new project with multiple files including stdafx.h, stdafx.cpp and similarly named files for whatever you named your project when prompted earlier. DELETE/ REMOVE all these files from the project.

6.) Right click the Source File Folder and choose Add->Existing Item… Choose the first assignment file (Assign1warmup.cpp).

7.) If you compile at this point you’ll realize that it’s still looking for the stdafx.h precompiled header. Let’s fix that. Go to Project->Assignment1 Properties… (or whatever your project might be named). Go to the option in the “tree” menu for Configuration Properties->C/C++->Pre-Compiled Headers . Under the option for Create/Use Precompiled header, choose the drop down option for Not Using Precompiled headers.

8.) While you’re in this section, take the time now to also select the location for the header files for this project. Under the Configuration Properties->C/C++->General section choose the Additional Include Directories option and use the … to browse and select the CS106 folder that you copied to your project folder earlier.

9.) One last thing you should change here is in the Configuration Properties->C/C++->Code Generation section. Change the default (which I believe is for a Multi-Threaded Debug .DLL) to just Multi-Threaded Debug (or just Multi-Threaded if you are doing your release build).

10.) Lastly, we’ll need to let the linker know where to find the CS106 library file. To do that you’ll need to make 2 additional settings. One is in the Configuration Properties->Linker->General section where you can select the location of your additional library files in the section titled appropriately enough – “Additional Library Directories”. You’ll also need to add your library to the project through the “Additional Dependencies” section which is under Configuration Properties->Linker->Input. Just type in CS106CPPLIB.lib.

Note: I found that there seems to be some difference in the menus you get and the settings that get saved depending on what your selection is at the moment in the solution Explorer Window. I originally made all my changes while I was selecting the actual source file, but there were no linker menus at that point. I had to move up to the Source File Folder level to get additional menus where I could set my linker options. Also important to note is that if you make your settings at the lower level (ie. Cpp file) they seem to supersede whatever is set in the level above it.

At this point the project should correctly build with the selection of the Build->Rebuild Solution command.

Happy programming!

Some may wonder why I didn't just use the new sample programs with the updated materials. The main reason is that I didn't have access to the online videos related to those classes. If the CS106B videos are anything like the CS106A classes there will likely be references made to the assignments during the lectures to help make certain things more clear. Also, with the new assignments I really wasn't sure at what point I should "take them on" during the course since it seemed possible that they might address different material in the newer classes or at the very least approach things in a different order or time frame. I may try some of the updated projects after the course or along the way but for now I'm satisfied that I can now use the assignments that came with the lecture videos.

Hope this helps someone else who may have similar problems.

Wednesday, June 9, 2010

On Day 9...

So I've decided to continue this fast for 10 days. My last day will be tomorrow. So far I've lost 11 pounds in the first 7 days I did this and I feel a bit more alert at the moment but ultimately I'm not feeling a huge difference in the way I feel. Plus, frankly, I'm just bored of drinking juice day after day. My hope is too switch over to eating more healthy after this, more salads and vegetables in general along with healthy sources of protien and probably most importantly for me, less pasta. I figure if I can cut down on the grains and make up for the amounts in vegetables I'm doing well.

Tuesday, June 8, 2010

Finished day 7

One week of juice fasting down! It is now Tuesday morning of the 8th day and I'm not sure how much longer I'll continue my fast. Last night I didn't feel that well after drinking probably the worst juice I've made so far - asparagus, celery, vidalia onion and cucumber. I think the problem was that I assume the vidalia onions would be very "sweet" so I threw them into the juicer by the handful. Well... let me tell you, they're not really sweet at all raw. They're more like a milder version of a yellow onion. I downed about 2/3 of the juice chased by some fruit juice before I finally gave up and flushed the rest down the sink. Afterwards I got a little "sick" and found myself thinking, "Why am I doing this?" I will say that some of the benefits are nice. I pretty much always have energy, my mind is clear, as is my skin and of course I'm losing weight. But the downsides kind of mirror the good - I don't always sleep well, I have trouble focusing, my balance is off, and of course I miss eating solid food. Anyways, I ended last night thinking about ending my juice fast but continuing to eat healthy - starting with raw vegetables and salads and moving back to eating healthy proteins by this weekend. We'll see...

Sunday, June 6, 2010

Day 6

It's my 6th day of the juice fast and overall feeling pretty good. I'm not really feeling any hunger pangs and I'm able to think of the foods I love without feeling like I need to go out and have it now! In fact solid food right now seems like an abstract concept. That's not to say I'm not looking forward to the day when I can go back and eating "real" food again, but right now it's no longer owning my thoughts.

I did experience some loose bowels this morning but I attribute that as much to the humid hot weather (which my body never handles well) as much as to the liquid diet. Overall I felt pretty good today though with a pretty clear head, no real tiredness and as I said before, no real hunger.

Today menu:

Breakfast: Strawberrie Smoothie
Lunch: Pineapple, Peach and Ginger juice
Dinner: Carrot, Jalapeno and Broccolli juice with some bottle fruit juice after to "cool" my palllete.

Saturday, June 5, 2010

Day 5

It's the fifth day of my juice fast and I'm surprised at how my overall energy and mood varies so much from day to day. Last night I was again feeling extremely hungry for something solid and I felt so tempted to throw in the towel and make a nice salad. Instead I had a beet, carrot, garlic, broccoli juice which actually wasn't too bad. I had a lot of energy most of day 4 but by late evening I felt pretty tired so I went to bed around 11pm and didn't wake up till almost 9am this morning. That is very unusual for me and today I've felt an overall tiredness which is very different then that way I had been feeling the previous day where I had lots of energy and alertness. Perhaps my body is now doing some healing and I just need a little more rest at this point. On the plus side I haven't really felt all that hungry at all today. However, I did notice that my balance was off. I kept running into things and especially when I would first stand up and try to walk I was a bit off kilter. My mind is alert but I don't feel like I'm thinking as clearly as I normally do. Anyways, here's what I had today:

Breakfast: Mixed Berry Smoothie (frozen fruit, pea protein and water)
Lunch: Peach, Grape, Spinach and Ginger juice. Was actually quite yummy!
Dinner: A broth that I made from spinach, carrots, beets, garlic and celery. It was okay but was definitely more watery than the juices I was making from my juicer. It was nice and hot though which was a nice change from the luke-warm juices I've been drinking.

Pretty soon I'll have to hit the grocery store for another round of fresh vegetables. I think I won't buy so much fruit the next round since I still have most of a watermelon and a pineapple left. Plus I notice with the fruit juices, particuarly those with citrus, I tend to get heartburn afterwards. I'll probably get many of the same vegetables as last time plus I'm thinking I'll try a fresh tomatoe juice and maybe also get some bell peppers.

Now, time to get back to my movie... The Grudge 2. Creepy!

Friday, June 4, 2010

Day 4 is almost done

Day 4 and I'm still wanting regular food. :( Last night I had awful hunger pangs so I decided to just go to bed and sleep it off. Now it's almost 5pm on Day 4 and I'm feeling hungry again. I think the evenings are the hardest. Perhaps because that was when I was normally eating my largest meals. It's not even the hunger itself right now but the desire to cook something tasty. I've got my workout in a half hour so hopefully that will help distract me. Then I'll make a nice vegetable juice with some strong flavors to try and curb my appetite.

Thursday, June 3, 2010

Day 3 - Juice Fast

Yesterday was a tough day for my fast. All day long I felt hungry and annoyed and just wanted to go home and cook up something warm and yummy, eat and watch movies. But instead, I excercised, made up a very spicey Beet, Carrot, Jalapeno, Celery and Garlic juice, and watched a little bit of Rome and Buffy the Vampire Slayer. Oh did I not mention before that I've become a huge fan now of that show? After falling in love with Firefly and finding out Joss Whedon was also responsible for Buffy, I decided it was time to check out the show that I previously had little interest in watching. And I have to say, I'm totally hooked. The plot and dialog has that same Joss Whedon style that loved when I watched Firefly. Unlike Firefly Buffy had more than just one season of course, and I have to say Seasons 2 and 3 were easily my favorites. I'm in Season 4 now and so far it's pretty blah. Still looking forward to the "musical" episode in Season 6 which I've heard it great.

Anyways, it's day 3 of the juice fast and I'm definitely feeling a lot better today. More alert, less hungry and not at all tired. I'm in a fairly decent mood but I find I can lose my temper pretty quickly and get frustrated more easily then normal, but it's not terribly bad at this point. I'm hoping for further improvements in Day 4! Stay Tuned!

-Melissa

Wednesday, June 2, 2010

It has begun...

So I began my juice fast on June 1st as expected. Well... okay, I cheated a little. I had spent the weeks prior basically emptying out my cupboards of all the foods I had in there that might distract me from my juice fast - beans, pasta, mac and cheese... Yum! I thought I had gotten everything before I started, but after I came back from the grocery store with my slew of vegetables I found a small cube of cheese stuffed in the back of the refrigerator and a little cup of applesauce. So... lunch yesterday was apple sauce and cheese. But for breakfast I did a a frozen fruit smoothie with just frozen strawberries, water and a scoop of pea protein. And dinner I had an interesting juice cocktail made from 1 cucumber, 4 carrots, a jalapeno and some ginger. Spicey! It definitely made it taste more like "dinner" that way I think. I'm using a Jack Lalanne Power Juicer for my juicing and it works pretty well so far. The only downside is it is quite messy. It says it's easy to clean, which I guess is true in the sense that it comes apart and allows you to wash all the pieces in the sink, but the juice pulp is on every piece. I mean it literally covers everything!

Anyways, this is now my 2nd day on the modified juice fast and I've again chosen to have the fruit smoothie in the morning. I plan to continue that until I'm done with the frozen fruit. Granted it's not strictly all juice, but it's not far off and I figure the extra fiber and carbs that I get out of it will help me ease into this a little easier. Especially since I didn't prepare very well by eating fresh veggies beforehand. My plan for lunches is going to mostly be organic bottle juices. From what I've read fresh juice looses a lot of it's potency very quickly after juicing. Also, the bottled juices are more convenient for bringing to work and keep well in their individual containers so I don't need to do any refrigeration.

So far on this juice fast my mind feels pretty muddled. Just kind of an overall lethargy and cloudy head feeling. That, plus the nearly constant hunger pangs and dreaming of solid food is making these first couple of days uncomfortable and annoying. I'm trying not to think of the 28 more days I have planned ahead of me buy rather focus my energy on getting through each day as I go. Based on my experience with water fasting I know the first couple days are the hardest as your body adjusts to going an almost constant empty stomach. Hopefully the same will be true of juice fasting. Course, the longest I ever went with a water only fast was 4 days, so we'll see how long I can keep this up. I don't want to set myself up for failure by predicting my success too far ahead. Just focusing on the here and now.

Friday, May 28, 2010

Juice Fast starting June 1st.

Okay, so my water only fast only lasted 4 days. But I'd really like to do a longer fast, so I'm going to do a Juice Fast starting June 1st. I have a Jack LaLaine juicer which I've only gotten to use once. My plan is to do fresh juices for the morning and evening and bring organic, no sugar added, bottled juices to work for my lunch and snacks. I also read that vegetable broths are good for this kind of fast so I may try and make up a big batch of broth on the weekend to take with me for a nice hot lunch. Anyways, June 1st is just a few days away so gotta start preparing. I'll update my blog with my progress...