Thursday, August 26, 2010

TIG - Head First C# - 1st Assignment




Our first reading assignment:

-Read the part under your commitment, and decide if you can do those things.
-Make and O’Reilly account.
-Forward that account logon name to me.
-Read Chapters 1 – 5 of our book.
-See you on September 22nd!
-Optionally, show me a mortgage calculator.

35 comments:

  1. From Randy Beach:

    To do highlighting and annotating that I wanted to do on PDF, I think I was going to need the $99 license of Foxit.

    I found this free software that I think is going to be GREAT. I checked out the basic functions I want and it does them all intuitively, plus a lot more that I haven’t tried. It is a Cnet 5 star, award winning tool.

    http://www.tracker-software.com/product/pdf-xchange-viewer/download

    We need a forum for the TIG to exchange this kind of info and be interactive during the month.

    Cheers
    Randy

    ReplyDelete
  2. From Stacy Park:

    Have you thought about recommending Safari Books Online to the group?

    http://www.safaribooksonline.com/Corporate/Products/individuals.php

    ReplyDelete
  3. Thanks so much for the link to the PDF reader, Randy! For any Mac folks out there, I am a huge fan of a free PDF reader (plus all kinds of annotations available) called "Skim": http://www.macupdate.com/info.php/id/24590/skim

    I would also second Stacy's recommendation for Safari books online. I've been a subscriber for years, and absolutely love it. It is an incredible resource, especially for the more junior level types (like myself) who still have tons to learn.

    ReplyDelete
  4. Ike,

    The link from the email to the PDF link is broken, Can you look into this?

    ReplyDelete
  5. Hi Aung,

    As of this morning, it is still working for me.

    Ike

    ReplyDelete
  6. I can't get the link to work either. It looks like it is opening the page for a second and then redirects to this message: The requested URL /fc13fec7e61778e433286f5df36fff3e was not found on this server.

    ReplyDelete
  7. I just tried it on three different computers, and they all worked. Do you have the PDF reader installed? Can you try from a different browser, like if you're using IE, try using FF. If you're using FF, try using IE.

    ReplyDelete
  8. PDF link worked for me, just tried it a few minutes ago. I tried both FF and IE, both worked.

    ReplyDelete
  9. The link to the PDF from the email didnt work for me, but I downloaded the free PDF reader that Randy suggested and I'm able to open the link from there.

    ReplyDelete
  10. clicking on the link wasnt working for me, so I tried the old copy-paste of the url and then used it on a new browser window and that worked.

    ReplyDelete
  11. Hi Gang. It may a bit late but I just learned of the ebook reader, NOOK by Barnes and Noble. The good thing about it is that it runs Android and is hackable with new apps. One link (that I havent checked) is nookdevs.com .
    I wonder if I could use it as an Android platform for learning a bit about that. Of course, I suppose you dont need hardware to do most of the Android development.

    Randy

    ReplyDelete
  12. If I’m missing a picture box (Chp 1 HeadFirst C#) in my toolbox, is there a way I can repair my instance of VS 2010 Express?
    v/r,
    Gay Farace-Mann
    SIG Immersion Class in C#

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. From Gay Farace-Mann:

    If I’m missing a picture box (Chp 1 HeadFirst C#) in my toolbox, is there a way I can repair my instance of VS 2010 Express?

    Thxs,
    Gay

    ReplyDelete
  15. You could try uninstall/reinstall of VS 2010. Are the rest of the controls ok - NumericUpDown, ProgressBar, RadioButton? There is some way to dd your own controls to the toolbaox, so there should be some way to get the PictureBox back

    ReplyDelete
  16. Except for the Radio Button, I'm missing all of the rest. I used the Repair Install feature yesterday, but am still missing the controls. So in a few minutes I will Unistall and try a fresh install.
    Thanks,
    Gay

    ReplyDelete
  17. I reinstalled VS 2010 Express and C# 2010.
    I still do not see the Picture box or the other controls mentioned in an earlier post. All feedback and help is welcome.
    Gay

    ReplyDelete
  18. In Chp 1 of HeadFirst C#, when I add the SQL Database, ContactDB.sdf in VS 2010 Express inside of the Solution Explorer, I get ContactDB.mdf.
    Is this just a difference between the Express and the Professional editions of VS?
    Thanks,
    Gay

    ReplyDelete
  19. Okay.
    So is the .sdf extension used in HeadFirst C# for SQL Server Express Edition 2008?
    I'm using a developer edition of SQL Server 2008 my own licensed copy I bought.
    Is that why the I see .mdf extension instead of .sdf?
    Thanks,
    Gay

    ReplyDelete
  20. When you’re on page Page 28 and 29 in the HeadFirst C# Book, When I click on the Data Menu and then Add New Data Source, I do not get the Database as a selection type.
    I get as choices: Diagram, table, Stored Procedure, Inline Function, Table-Value Function and Scalar-Value Function.

    In my humble opinion, my VS 2010 is acting more like Visual Studio 2008.
    I had at one time both VS 2008 and VS 2010 on my computer. I removed VS 2008, C# and VB.NET 2008 off my computer. Then I installed VS 2010 Express with C# Express. I turned off my computer and then turned it back on.
    Let me know if I'm on the right track.
    Thanks,
    Gay

    ReplyDelete
  21. Hi Gay,
    My experience is limited, so take everything I say with massive grains of salt.

    The essential difference between databases with the mdf vs. sdf extension appears to be that sdf databases are for SQL Server Compact Edition, which allows you to embed a database within your application. The mdf databases appear to be a more scalable and robust database for larger projects.

    It makes me curious, since the intro explains that we're making this app specifically to be a client-server type application with a central database, but perhaps the sdf file is essentially for caching data so that users do not have to actually be online with the database server to work with existing data... storing all changes one makes until the next time the app does get to connect to the main database server to up/down-load changes made.

    As for the options you're getting under 'Add Data Source', those all sound like very database-centric options. I wonder if you selected the wrong kind of project when you first got started creating the Contacts app? Sorry I can't provide a more definitive answer, but I hope this helps somewhat...

    Good Luck!
    Jon

    ReplyDelete
  22. Jon:
    Thank you. It makes sense.
    Started my project from scratch and again, I saw some differences between what the book show for starting a new project in the VS 2010 Express IDE and what I show for choices.

    For example,
    when I select a New Project, under Installed Templates, under Visual C#, it offers Windows, Web, Cloud, Silverlight and WCF. If I select Web, I get the following:
    ASP.NET Web Application, ASP.NET MVC2 WEb Application, ASP.NET Empty Web Application, and other choices.

    The closest to what I could find to match in HeadFirst was to select the ASP.NET Empty Web Application. When I select this choice, I get under the Contacts Project, Properties, References and Web.config.

    So I think I have something missing in my install.
    Gay

    ReplyDelete
  23. All:
    I do not get offered the Windows Form Application when I create a New Project.
    Gay

    ReplyDelete
  24. Hi Gay,

    I'm fairly certain you should pick "Windows", not web. We're building a standard windows forms desktop application, as opposed to an application designed to be deployed on the internet (which is what you would use ASP.NET for... And it's fairly awesome, but not part of this chapter).

    Hope this helps...
    Jon

    ReplyDelete
  25. Gay -

    When you start a new project, you want Windows project, not Web, maybe that will help.

    Also how about this - download all the source for the examples from here: http://headfirstlabs.com/books/hfcsharp/all/HeadFirstCSharp_All_Code.zip

    Then unzip one of them, and open the solution file from within the IDE, maybe all the settings will work out then.

    ReplyDelete
  26. Gay -

    One other idea about the controls not showing in the toolbox - I have found the site www.stackoverflow.com has lots of answers, and the user community there responds within minutes of question being posted. It is not Microsoft-centric, just programmer-centric, expert to beginner

    ReplyDelete
  27. Jon and Jeff:
    Thanks to both of you.

    Jon:
    When I pick Windows, I do not see Windows Form Application as you see on page 8 in the book.
    I see Class Library. And do not see any other choices.

    Jeff:
    Will do.

    Jon and Jeff:
    I'll keep you posted.
    Gay

    ReplyDelete
  28. Jeff and Jon:
    I opened up Chap 1 zipped files and NOW I can see the controls I was missing. I'm moving on. However, I want to know what's going on after I get further.
    Thanks for help.
    Gay

    ReplyDelete
  29. Jon and Jeff:
    My problem was I was in the Visual Studio IDE versus the C# IDE.
    Gay

    ReplyDelete
  30. Hi Everyone,
    I'm wondering if anyone else has run into questions on some of the casting info on the bottom (left column) of page 131. They list three lines of code:

    int myInt = 36;
    double myFloat = 16.4D;
    myFloat = myInt + myFloat;

    The handwriting-like font in the margin says "you need to add a D to the end of the number to tell the compiler that it’s a float, and not a double".

    This seems to contradict p.127, where I believe it is saying that the default type for a literal like '16.4' would be double, and by adding an "F" to it, we can force it to be a float. Also on p.127, I believe it says that adding a "D" should force it to be a double.

    I tried this out in Visual Studio, watching the value and type for myFloat (from the code snippet on p.131). With a D, as written, the type is listed as double with a value of 52.4.

    Leaving off the D, everything appears the same. Type is listed as double, and value is listed as 52.4. This is what the information on p.127 would lead me to believe, but seems contrary to what is written on p.131 in the margin.

    Finally, I tried it replacing the D with an F. While the type is still listed in the watch window as double, the value at the end of that code is now listed as 52.399999618530273 rather than the rounded off 52.4.

    This leaves me with three questions:

    1) Is the book wrong on p.131 where it says to add a "D" after 16.5 to tell the compiler that that number is a "float, not a double"?

    2) Based on p.126-127, I thought the difference between a float and double (other than min/max value, which we're nowhere near with a number like 16.4 or 52.4) was that a double could handle 16 significant digits, and a float could handle 7. Why is it that when I used a double, the value was rounded off (52.4), whereas when I put an F after that initial declaration of myFloat (always declared as "double" throughout all of these examples... all I've been varying is the letter, or lack thereof, following the initial value of 16.4) the final value wound up being 52.399999618530273?

    3) Am I completely insane, or doesn't 52.399999618530273 have *seventeen* significant digits?

    Thanks in advance for any help!


    Jon

    ReplyDelete
  31. Jon,

    Good catch. The book does appear to have a misprint. By default "a real numeric literal on the right-hand side of the assignment operator is treated as double" (see links below)

    You would use "d" if you were specifying an integer value and want it treated as a double. (i.e. 5d)


    the difference between double and float is not "significant digits" but digits of precision (those to the right of the decimal point)

    Float has 7 digits of precision whereas double has 15-16 digits of precision.

    Here are the relevant MSDN links

    Double
    http://msdn.microsoft.com/en-us/library/678hzkk9(VS.71).aspx

    Float
    http://msdn.microsoft.com/en-us/library/b1e65aza(VS.71).aspx


    Hope that helps

    ReplyDelete
  32. Thanks, Brad... That's perfect. Great links for clarification too!

    I feel famous... I've submitted the error on O'Reilly's errata page for this book.

    ReplyDelete
  33. Hi everyone, just a quick tip that might make consuming this comment feed easier.

    I forgot to follow this post and didn't realize there were so many comments coming in (sorry about that).

    So to keep up with things you can subscribe to just the comments in any RSS reader of your choice (I prefer google reader).

    Inside your reader just add a subscription to this link

    https://www.blogger.com/comment.g?blogID=5790493286190870944&postID=5886028341010330292


    That should be it. Now when there is a new comment it should appear in your reader and should allow you to track them more efficiently.

    Hope that helps. I have added this to my reader so I can respond quicker.

    Also as we do new posts (for each assignment) I will post the link to the comment feed as well.

    ReplyDelete
  34. One more quick update. Hopefully some of you see this before Tomorrow.

    If you have questions on any of the code you have written this past month (and I am sure you will)

    Please feel free to bring your code (on a usb stick or even better your laptop if you have one)

    I will bring my laptop with VS 2010 installed and we can load up your project, go over the questions and modify your code and save it back to your drive for future reference.


    Look forward to seeing you all tomorrow.

    ReplyDelete
  35. Resharper is a great tool. It is available for a free trial at this link:

    http://www.jetbrains.com/resharper/download/index.html

    It looks like there is a free version available for academics. I'm wondering if Ike might be able to get it for free for everyone? :)

    ReplyDelete