Wednesday, December 16, 2009

Testing your code.

Be sure that all Guids are being inserted properly. Null's or Empty Guids will throw off everyone's code.

Good Luck!

Tuesday, December 15, 2009

SQL Script

For creating the DotNetTwitter Database on your local SQL Server.

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Following]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Following]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Keywords]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Keywords]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Link]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Link]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Tweets]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Tweets]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Users]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Users]
GO

CREATE TABLE [dbo].[Following] (
[FollowingID] [uniqueidentifier] NOT NULL ,
[UserID] [uniqueidentifier] NULL ,
[FollowingUserID] [uniqueidentifier] NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Keywords] (
[KeywordID] [uniqueidentifier] NOT NULL ,
[Keyword] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Link] (
[LinkID] [uniqueidentifier] NOT NULL ,
[KeywordID] [uniqueidentifier] NULL ,
[TweetID] [uniqueidentifier] NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Tweets] (
[TweetID] [uniqueidentifier] NOT NULL ,
[Tweet] [char] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DateStamp] [datetime] NULL ,
[UserID] [uniqueidentifier] NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Users] (
[UserID] [uniqueidentifier] NOT NULL ,
[UserName] [char] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[UserImage] [char] (110) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

Monday, December 14, 2009

About the Final: Oops.

Alright, I set the time wrong, the Final goes live at Noon today(12/14/2009)
You are more than welcome to use your notes or any other resource, but you only have 45 minutes to take the final, so use your time wisely.

The Final is available under "Lessons"
You have until 12/19/2009, 11:59pm to take the final.

Twitter Application.

Deadline: 12/19/2009, 11:59pm
Points: 100

Minimum Requirements:
Users need to be able to login or register if their login account/username does not exist.
Users will be able to post tweets and mark keywords
Users will be able to view all Tweets from all Users
Users will be able to edit their Tweets
Display a list(checkbox list, listbox, datalist, or repeater) of all keywords
Selecting keywords will display related Tweets

Extra Credit:
Display top 10 keywords (+10pts)
Ability to select multiple keywords to narrow your search (+10pts)
Implement ability to Follow Users:
Display a list of users you are following, selecting the user will display their Tweets (+10pts)
When displaying all users' tweets, display an icon or label showing that you are following them(+10pts)
When displaying all users' tweets, have a button allowing the user to follow that user, if you are already following that user, display the "following" icon from above(+10pts)

Sunday, December 13, 2009

Standard SQL Statements

"SELECT * FROM users"

"SELECT * FROM users WHERE userid ='" + _userid.ToString() + "'";

"INSERT INTO User " +
"([UserID], [UserName], [UserImage]) " +
"VALUES ('"
+ _UserID.ToString() + "','"
+ _UserName + "','"
+ _userImage + "')";

"UPDATE User" +
"SET " +
" [UserName] = '" + _UserName.Trim() + "'," +
" [UserImage] = '" + _UserImage.Trim() + "'," +
+ " WHERE UserID = '" + _UserID.ToString() + "'";

"SELECT * FROM Tweets"

"SELECT * FROM Tweets WHERE tweetid ='" + _tweetid.ToString() + "'";

"INSERT INTO Tweets " +
"([TweetID], [Tweet], [DateStamp], [UserID]) " +
"VALUES ('"
+ _TweetID.ToString() + "','"
+ _Tweet + "','"
+ _DateStamp
+ _UserID.ToString() + "')";

"UPDATE Tweets" +
"SET " +
" [Tweet] = '" + _Tweet.Trim() + "'," +
" [DateStamp] = '" + _DateStamp.ToString() + "'," +
" [UserID] = '" + _UserID.ToString() + "'," +
+ " WHERE TweetID = '" + _TweetID.ToString() + "'";

"SELECT * FROM KeyWords"

"SELECT * FROM KeyWords WHERE KeyWordid ='" + _userid.ToString() + "'";

"INSERT INTO KeyWords" +
" ([KeyWordID], [KeyWord]) " +
"VALUES ('"
+ _KeyWordID.ToString() + "','"
+ _KeyWord + "')";

"UPDATE KeyWords" +
"SET " +
" [KeyWord] = '" + _KeyWord.Trim() + "'," +
+ " WHERE KeyWordID = '" + _KeyWordID.ToString() + "'";

"INSERT INTO Link" +
" ([LinkID], [KeyWordID], [TweetID]) " +
" VALUES ('"
+ _LinkID.ToString() + "','"
+ _KeyWordID.ToString() + "','"
+ _UserID.ToString() + "')";

The Final.

Here's a preview of the final. The final exam will be opened tonight at midnight.


1. What is a DataTable a collection of?

2. How do I check to see if a user is viewing a page for the first time?

3. Which control is similar in funcationality and behavior to a ListBox?

4. Name the main parts of an Object Class.

5. I have a session variable called "MyData". How would I cast "MyData" as a DataTable?

6. What is the primary event for a Button object?

7. I am getting the following error:
System.NullReferenceException: Object reference not set to an instance of an object.
Most likely, this is caused by:

8. Imagine a student database table. I need to add a method to my object class which would select all graduating seniors. What type of method would I make this?

9. I have a DataTable called 'dtClassSchedule' with three columns: "DepartmentCode", "ClassCode", "Section".

I need to add a new row where:
"DepartmentCode" = "CSC"
"ClassCode" = "177"
"Section" = "290"

How would I hard code this?

10. With our class projects in mind, what is the first event fired from a .aspx web page?

11. Which control is similar in functionality and behavior to a DropDownList?

12. What is a GUID used for?

13. Which control(s) are a collection of ListItems?

14. Suppose I have an Object Class called MyClass, and an Accessor called Value1.

Would I be using a 'get' or 'set':
this.TextBox1.Text = MyClass.Value1;

15. Suppose I have an Object Class called MyClass, and an Accessor called Value1.

Would I be using a 'get' or 'set':
MyClass.Value1 = this.TextBox1.Text;

16. Explain the post-back process.

17. What command do we use to bind a column from a DataTable to a control embedded in a template column of a GridView?

18. I am need of two constructors for my Object Class called MyClass. One constructor takes an ID of type Guid and a FilePath of type string, the other takes only the ID. What would my constructors be?

19. Suppose we have a TextBox called 'MyTextBox'.
It's text property is set to 'Hello World'.
How would I parse the text into a string array?
How would I loop through the array?

20. Imagine a student database table. I need a method in my object class which updates a student record with new information. This method is an example of:

21. What steps would I take to connect a .aspx page to a SQL Database.

22. I have a music database table with the following columns:

TrackID
TrackName
TrackLength
ArtistID

For the Object Class: list the Accessors, Public Methods, and Static Methods.

Tuesday, December 8, 2009

Publishing site/connection string

site:
http://hydra.csit.parkland.edu/(application-YourInitials)/

i.e.

http://hydra.csit.parkland.edu/DataTableSQL-Cdey/


connection string: (inside web.config)

(appSettings)
(add key="ConnectionString"
value="packet size=4096;user id=student; password=fall2009;data source=hydra; integrated security=SSPI; persist security info=false; initial catalog=DotNetTwitter"/)
(/appSettings)

also make these changes to your web.config, if these lines already exist, change their values, else add them:
(customErrors mode="Off"/)

(compilation debug="true")

NOTE: REPLACE Parenthesis w/ Greater Than/Less Than signs