Monday, January 31, 2011

Challenge me in Mini Putt!

Hey guys I scored a 37 in Mini Putt. Go down on the bottom of my page to challenge me :)

Advanced Relational Database /* Inner Join between two tables */

The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables.Tables in a database are often related to each other with keys.A primary key is a column (or a combination of columns) with a unique value for each row. Each primary key value must be unique within the table. The purpose is to bind data together, across tables, without repeating all of the data in every table.
--McIntyre Inner Join Pop Tarts
use master;  
 create table #PopTartsStore  
      (  
      StoreId int primary key identity (1,1)  
      , Flavor varchar (20)  
      , Price dec(6,2)  
      )  
 insert into #PopTartsStore  
 values  
 ('Apple Cinnamon', 9999.99)  
 insert into #PopTartsStore  
 values  
 ('Brown Sugar', 9999.99)  
 insert into #PopTartsStore  
 values  
 ('Strawberry', 9999.99)  
 create table #PopTartsDistributor  
      (  
      DID int primary key identity (1,1)  
      , StoreId int  
      , Distributors varchar(50)  
      )  
 insert into #PopTartsDistributor  
 values  
 (1, 'Walgreens')  
 insert into #PopTartsDistributor  
 values  
 (2, 'Walmart')  
 insert into #PopTartsDistributor  
 values  
 (3, 'Wally''s')  
 --st = #PopTartsStore  
 --di = #PopTartsDistributor  
 SELECT st.StoreId, st.Flavor, st.Price, di.Distributors  
 From #PopTartsStore as st  
      Inner Join #PopTartsDistributor as di  
      on st.StoreId = di.StoreId  
select * from #PopTartsStore
select * from #PopTartsDistributor

Programming 2 /* Case Statements */

A select-case statement is a great way to perform a logical test that might have multiple directions if found true or false. You could write a bunch of if-then-else statements but that could be very cumbersome. Here is how you utilize the Select-Case statement.
'McIntyre Case Statements
Public Class Form1  
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load  
     Dim number As Integer = 8  
     Select Case number  
       Case 1 To 5  
         Debug.WriteLine("Between 1 and 5, inclusive")  
         ' The following is the only Case clause that evaluates to True.  
       Case 6, 7, 8  
         Debug.WriteLine("Between 6 and 8, inclusive")  
       Case 9 To 10  
         Debug.WriteLine("Equal to 9 or 10")  
       Case Else  
         Debug.WriteLine("Not between 1 and 10, inclusive")  
     End Select  
   End Sub  
 End Class  

Programming 2 /* If Statements */

An "If" statement in Visual Basic is a comparison statement that evaluates to true or false. If the statement evaluates to true, then the inner statements within the "If" block are executed. If the statement evaluates to false, then the compiler skips over the comparison statement and executes the following lines of code. "If" statements are common in all programming languages, and they are an essential part of creating web and desktop applications.
'McIntyre If Statements
Public Class Form1  
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load  
     Dim number, digits As Integer  
     Dim myString As String  
     number = 53  
     If number < 10 Then  
       digits = 1  
     End If  
     If digits = 1 Then  
       myString = "One"  
     Else : myString = "More than one"  
     End If  
     If number < 100 Then  
       digits = 2  
     ElseIf number > 100 Then  
       digits = 3  
     Else  
       MessageBox.Show("No")  
     End If  
   End Sub  
 End Class  

How to draw a Cartoon Banana.

Steps -
1. Draw a right-angled triangle, with a slightly slanted rectangle underneath, then draw another right-angled triangle but upside down.
2. Draw a border around the shapes, this will make the outline of the banana. Make sure the line does not touch the shapes. At each end, draw the edge dark for the ends of the banana.
3. Draw two large eyes, have them touching but not overlapping. Draw two pupils inside. For different looks, try making one eye a different size or shape to the other.
4. No draw the mouth as shown in the video, but be careful how far you curve the lip as this can dramatically change the characters mood.
5. Erase all underlines and make the outlines bold.

Now add whatever you like to the banana. Arms, Legs, Hands, Clothes, whatever you want.


You can find the YouTube video here.

Friday, January 28, 2011

Programming 2 /* Practice #1 - Acts and Facts */

'McIntyre Practice #1 - Acts and Facts 
Public Class ActsAndFacts   
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click   
    '1. Morgan loves collecting small stuffed animals. She has 6 cows and 7 sheep. How many   
        animals does she have in her collection?     
    'Variables declared   
    Dim Cows, Sheep, Animals As Integer   
    'Variables set   
    Cows = 6   
    Sheep = 7   
    'Calculation of total animals   
    Animals = Cows + Sheep   
    'Output in a message box   
    MessageBox.Show("There are " & Animals & " Animals.")   
   End Sub   
   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click   
    '2. Diane bought 7 mega burgers. Each mega burger cost $4. How many dollars did she spend on the Mega Burgers?   
    'Variables declared   
    Dim MegaBurgers As Integer   
    Dim MBCost, TotalCost As Decimal   
    'Variables set   
    MegaBurgers = 7   
    MBCost = 4   
    'Calculation of Total Cost of the Mega Burgers   
    TotalCost = MegaBurgers * MBCost   
    'Output in a message box   
    MessageBox.Show("The Total Cost of the Megaburgers is " & FormatCurrency(TotalCost, 2) & ".")   
   End Sub   
   Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click   
    '3. Ole has 15 apples and 12 oranges. How many pieces of fruit does he have?   
    'Variables declared   
    Dim Apples, Oranges, TotalFruit As Integer   
    'Variables set   
    Apples = 15   
    Oranges = 12   
    'Calculation of Total Fruit   
    TotalFruit = Apples + Oranges   
    'Output in a message box   
    MessageBox.Show("There are a total of " & TotalFruit & " fruit.")   
   End Sub   
   Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click   
    '4. There are 33 horses in a field. 15 horses go into the barn. Then 7 of them come back out. How many horses are standing in the field?   
    'Variables declared   
    Dim FieldHorses, BarnHorses, HorsesThatCameOut, HorsesStanding As Integer   
    'Variables set   
    FieldHorses = 33   
    BarnHorses = 15   
    HorsesThatCameOut = 7   
    'Calculation of Horses left in the field   
    HorsesStanding = (FieldHorses - BarnHorses) + HorsesThatCameOut   
    'Output in a message box   
    MessageBox.Show("There are " & HorsesStanding & " standing in the field.")   
   End Sub   
   Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click   
    '5. Inglebert has 15 apples and 3 times as many oranges. How many pieces of fruit does she have?   
    'Variables declared   
    Dim Apples, Oranges, TotalFruit As Integer   
    'Variables set   
    Apples = 15   
    Oranges = Apples * 3   
    'Calculation of Total Fruit   
    TotalFruit = Apples + Oranges   
    'Output in a message box   
    MessageBox.Show("There are a total of " & TotalFruit & " fruit.")   
   End Sub   
   Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click   
    '6.  English Geography Mathematics Science    
    'Andrew 12  19   18   7    
    'Brian  22  15   7   22    
    'The table shows quiz marks out of 25 in each subject.    
    '•How many marks did Brian totally obtain in Mathematics and Science?   
    '•How many more marks does Andrew need for a perfect score in Mathematics?   
    '•What is Andrew's percentage for all of the quizzes together?   
    'Variables declared   
    Dim AEng, BEng, AGeo, BGeo, AMath, BMath, ASci, BSci, PerfectScore, BTPoints, NeededForPerfectScore, APerc As Integer   
    'Variables set   
    AEng = 12   
    BEng = 22   
    AGeo = 19   
    BGeo = 15   
    AMath = 18   
    BMath = 7   
    ASci = 7   
    BSci = 22   
    PerfectScore = 25   
    'Calculation of Brian's total points in Math and Science   
    BTPoints = BMath + BSci   
    'Needed marks for a perfect score for Andrew in Math   
    NeededForPerfectScore = PerfectScore - AMath   
    'Andrew's percentage for all quizzes   
    APerc = (AEng + AGeo + AMath + ASci) / 4   
    'Outputting the answers in a message box   
    MessageBox.Show("Total marks for Brian in Math and Science is " & BTPoints & ".")   
    MessageBox.Show("Andrew needs " & NeededForPerfectScore & " points for a perfect score in Math.")   
    MessageBox.Show("Andrew's percentage for all of the quizzes together is " & APerc & ".")   
   End Sub   
  End Class   

Wednesday, January 26, 2011

Programming 2 /* how to join a string to another string */

String Concatenation
Two strings can be combined to form a new string consisting of the strings joined together. It is represented by an ampersand (&).
Dim Google, BackInTime, HotTubTimeMachine as String
Google = "Lougle"  
BackInTime = " is a better name."  
HotTubTimeMachine = Google & BackInTime  

Programming 2 /* how to convert an integer into a decimal and a decimal into an integer */

Converting an integer into a decimal.
Dim intYahoo as Integer
intYahoo = CDec(1)
Converting a decimal into an integer is done the same way.
Dim decYahoo as Decimal
decYahoo = CInt(1)

Monday, January 24, 2011

Advanced Relational Database /* Assignment 1 Frog Database */ 1/24/11

use master;  
 Go  
 Create database Frogs  
 use Frogs  
 create table NDFrogs  
      (  
      ID Int Primary Key identity (1,1)  
      , Scientific_Name varchar(50)  
      , IUCN_Red_List_Status varchar(30)  
      , Vernacular_Name varchar (30)  
      , Family varchar (30)  
      )  
 insert into NDFrogs  
 (Scientific_Name, IUCN_Red_List_Status, Vernacular_Name, Family)  
 values  
 ('Bufo americanus', 'Least Concern (LC)', 'American Toad', 'Bufonidae')  
 insert into NDFrogs  
 (Scientific_Name, IUCN_Red_List_Status, Vernacular_Name, Family)  
 values  
 ('Bufo cognatus', 'Least Concern (LC)', 'Great Plains Toad', 'Bufonidae')  
 insert into NDFrogs  
 (Scientific_Name, IUCN_Red_List_Status, Vernacular_Name, Family)  
 values  
 ('Bufo hemiophrys', 'Least Concern (LC)', 'Canadian Toad', 'Bufonidae')  
 insert into NDFrogs  
 (Scientific_Name, IUCN_Red_List_Status, Vernacular_Name, Family)  
 values  
 ('Bufo woodhousii', 'Least Concern (LC)', 'Woodhouse''s Toad', 'Bufonidae')  
 insert into NDFrogs  
 (Scientific_Name, IUCN_Red_List_Status, Vernacular_Name, Family)  
 values  
 ('Hyla versicolor', 'Least Concern (LC)', 'Eastern Gray Treefrom', 'Hylidae')  
 insert into NDFrogs  
 (Scientific_Name, IUCN_Red_List_Status, Vernacular_Name, Family)  
 values  
 ('Pseudacris maculata', 'Least Concern (LC)', 'Boreal Chorus Frog', 'Hylidae')  
 select * from NDFrogs  

Creating A Database in Microsoft SQL Server 1/24/11

This will create a blank database named Blogging.
Use Master;  
 Go
 Create Database Blogging;  
After creating the database we can use it by using the 'use' command.
use Blogging;  

Converting a number variable into a string 1/24/11

When converting a number variable such as an integer we use the 'ToString' command. You can do it this way and also a different way by using the 'CStr' command. Here I show both ways.

This is the 'ToString' command.

Dim intYahoo As Integer = 8
Dim strYahoo As String = intYahoo.ToString

This is the 'CStr' command.

Dim intYahoo As Integer = 8
Dim strYahoo As String = CStr(intYahoo)

Both of these do the same thing when converting.

Variables in Visual Basic 1/24/11

Visual Basic, just like most programming languages, uses variables for storing values. A variable has a name (the word that you use to refer to the value that the variable contains). A variable also has a data type (which determines the kind of data that the variable can store). A variable can represent an array if it has to store an indexed set of closely related data items.


'Declaring a String  
Dim strGoogle As String  
'Declaring a Boolean  
Dim blnBing As Boolean  
'Declaring an Integer  
Dim intYahoo As Integer  
'Declaring a Decimal  
Dim decAsk As Decimal  
'Assigning a value to a variable  
strGoogle = "Googling"  
blnBing = False  
intYahoo = 1  
decAsk = 0.25  
'Outputting all of the values to the variables in a message box  
MessageBox.Show(strGoogle & " " & blnBing & " " & intYahoo + decAsk)  

Friday, January 21, 2011

Advanced Relational Database /* Testing the creation of a table variable, inserting 3 records into it and changing one of the values of a column in only 1 row, and selecting all records */ 1/21/11

use AntiGoogle

declare @ProblemsWithPalmersQuestions table
(
    ID int primary key identity(1,1),
    Problems varchar(50) null,
    Googling varchar(20) null
)

insert into @ProblemsWithPalmersQuestions
(Problems, Googling)
values
('Too Hard', 'Not Good')

insert into @ProblemsWithPalmersQuestions
(Problems, Googling)
values
('He doesn''t have his own problems figured out', 'False Information')

insert into @ProblemsWithPalmersQuestions
(Problems, Googling)
values
('Algebra problems are no fun', 'Too Much Information')

update @ProblemsWithPalmersQuestions
set Problems = 'Too Easy'
where Problems = 'Too Hard'

select * from @ProblemsWithPalmersQuestions

Advanced Relational Database /* Testing the creation of a table variable, inserting 3 records into it and deleting one record, and selecting all records */ 1/21/11

use AntiGoogle

declare @ProblemsWithPalmersQuestions table
(
    ID int primary key identity(1,1),
    Problems varchar(50) null,
    Googling varchar(20) null
)

insert into @ProblemsWithPalmersQuestions
(Problems, Googling)
values
('Too Hard', 'Not Good')

insert into @ProblemsWithPalmersQuestions
(Problems, Googling)
values
('He doesn''t have his own problems figured out', 'False Information')

insert into @ProblemsWithPalmersQuestions
(Problems, Googling)
values
('Algebra problems are no fun', 'Too Much Information')

delete from @ProblemsWithPalmersQuestions
where Problems = 'Too Hard'

select * from @ProblemsWithPalmersQuestions

Advanced Relational Database /* Testing the creation of a table variable, inserting 3 records into it, and selecting all records */ 1/21/11

use AntiGoogle declare @ProblemsWithPalmersQuestions table (     ID int primary key identity(1,1),     Problems varchar(50) null,     Googling varchar(20) null ) insert into @ProblemsWithPalmersQuestions (Problems, Googling) values ('Too Hard', 'Not Good') insert into @ProblemsWithPalmersQuestions (Problems, Googling) values ('He doesn''t have his own problems figured out', 'False Information') insert into @ProblemsWithPalmersQuestions (Problems, Googling) values ('Algebra problems are no fun', 'Too Much Information') select * from @ProblemsWithPalmersQuestions

Wednesday, January 19, 2011

Advanced Relational Database /* Temp Tables and Table Variables */ 1/19/11

use DB
Create Table Frogs (
  ID int primary key identity(1,1)
 ,Legs int not null
 ,Color varchar(8982)
  )

* look up temp tables and table variable
--syntax
--when to use

 4 ways to store data: local temporary tables (#table_name), global temporary tables (##table_name), permanent tables (table_name), and table variables (@table_name). 

Local Temporary Tables

Create Table #pimp
(
  id int
  ,daddy varchar(50)
)

A temporary table is created and populated on disk, in the system database tempdb — with a session-specific identifier packed onto the name, to differentiate between similarly-named #temp tables created from other sessions. The data in this #temp table (in fact, the table itself) is visible only to the current scope (usually a stored procedure, or a set of nested stored procedures). The table gets cleared up automatically when the current procedure goes out of scope, but you should manually clean up the data when you're done with it.

Table Variables
Declare @people table
(
  id int
  ,name varchar(32)
)

A table variable is created in memory, and so performs slightly better than #temp tables (also because there is even less locking and logging in a table variable). A table variable might still perform I/O to tempdb (which is where the performance issues of #temp tables make themselves apparent), though the documentation is not very explicit about this.


I found all of my information here.

Programming 2 /* Repeatable Processing */ 1/19/11

--Calculating a tip.
$23.12 @ 10%
T = 23.12
Tip = .1
TotalTip = T * Tip

--Calculating Final Grade.
30% Blog, 40% Assignments, 10% Peer Evals, 20% Final
86/100 blog, 345/450 assignments, 43/50 peers, 55/80 final
BlogTP = 100
BlogS = 86
BlogP = BlogS/BlogTP
BlogW = .3
AssignTP = 450
AssignS = 345
AssignP = AssignS/AssignTP
AssignW = .4
PeerTP = 50
PeerS = 43
PeerP = PeerS/PeerTP
PeerW = .1
FinalTP = 80
FinalS = 55
FinalP = FinalS/FinalTP
FinalW = .2
Grade = (BlogP * BlogW) + (AssignP * AssignW) +...

--It's time to send out all the Christmas cards again, but you don't feel like writing all the envelopes by hand.
--How could you use a formula to create the addresses for you?
FL = First & " " & Last
SL = Address
TL = City & " " & State & " " Zip

Saturday, January 15, 2011

M&M

Keep bloggin while I mind boggle in my zone like i’m in the twilight, dog.
Get off my bone, this is my mic doggonit, and I like hoggin’ it...

Friday, January 14, 2011

Code

Dim strNotGooglingAnything as String
txtNo.text = strNotGooglingAnything
strNotGooglingAnything = "Book Power :)"

Classes

Programming II

Advanced Relational Database

Followers