0
I Use This!
Activity Not Available

Project Summary

Table of Contents

Table of ContentsIntroductionWelcome to the iCouchsurfing ProjectDevelopment ProgressFeaturesScreenshotsCoding NotesClassesCoding SchemaCode Check-in/CommitSubmitting Issues

IntroductionWelcome to the iCouchsurfing Project NOTE We have moved the project to a new repository. If you would like to participate in the code development, please send Danny an email.

Visit: www.icouchsurfing.com for more info!

Development ProgressFeaturesInitially, we are focusing in developing the following features:

User login (finished) (Needs debugging) Display message list (finished) Send/Receive/Read messages (finished) Display member profiles (working) (Needs debugging) Display list of friends Couch search Events Groups

ScreenshotsView images of the development progress here: http://fourtenmedia.com/icouchsurf/

Coding NotesClassesThere are several classes in this project which allows multiple users to work on small parts of the code without effecting the rest of the code. Here is a description of the most important classes:

ControllersCSLoginViewController - User login. Once authenticated, it will parse the messages page and the user's home profile CSProfileViewConroller - Display a user's profile. Gets passed a member name. Example (from CSLoginViewController): profileViewController.member.profileName = @"bluefloyd";
[profileViewController refresh];CSMessageViewController - Displays a table/list of user's messages

EntityCSMember - Object class which holds member information CSMessage - Object class which holds message information CSMemberPersonalInfo - Object class which holds member's profile information CSMemberCouchInfo - Object class which holds member's couch information Parsers (Methods group)CSParseMessagePage - Parses the message inbox of a pae CSParseProfile - Parses a specified user's profile Coding SchemaWe are using a few coding conventions to ensure that everything is done the same.

DebuggingNSLog() is a useful way to print/trace information to the debugger console during runtime. However, it gets very very confusing if there are NSLog statements being printed everywhere. Therefore, every page should have a constant define which can turn the NSLog() statements on or off (setting variable to "YES" or "NO")

#define SHOW_DEBUG NO // Define constant at top of file
...
if(SHOW_DEBUG) NSLog(@"Hello, World!"); // Conditional print statementParsingRight now, the only parser class being used is CSProfileParser but all new parser classes should be coded to be used in this way. NOTE: Danny needs to change the CSLoginViewController to use the CSParseMessagePage class instead of hard-coding it.

Couchsurfing does not let us have direct access to the database, so we have to parse HTML pages for the content that we need. This is difficult to do and requires some tricks to function correctly.

ExamplesIn this code, dataStr contains the entire HTML content of a page. We check the location of kCSMemberName (a string defined at the top) and then add an offset so that start points to the next character AFTER the location of this string. End does the same check and then we use substringWithRange() to "cut" the content between start and end. // CSProfileParser.m
// Member Name
start = [dataStr rangeOfString:kCSMemberName].location + [kCSMemberName length];
end = [dataStr rangeOfString:@""].location;
memberPtr.memberName = [dataStr substringWithRange:NSMakeRange(start, end - start)];
if(SHOW_DEBUG) NSLog(@"Member name = %@", memberPtr.memberName);In some cases, rangeOfString() cannot be used because the string that we are searching for occurs twice (such as in the message inbox parsing). rangeOfString() only returns the first instance of a string, but sometimes we want the second or third instance. For example, there is no good way to tell when the "max surfers per night" string should end. It ends with line break but that occuers everywhere. So, we find the start of the string and then cut a chunk of characters following it. Now, inside of that chunk we can look for the first occurrence of line break and use that as the end clipping point for our string // CSProfileParser.m
// Max Surfers
start = [dataStr rangeOfString:@"Max Surfers Per Night:"].location + [@"Max Surfers Per Night:" length];
if(start != NSNotFound){
end = start + 20;
temp = [dataStr substringWithRange:NSMakeRange(start, end - start)];
end = [temp rangeOfString:@" tab on the top of this page to submit a bug, crash, or other error that you find. If the bug only occurs on specific profile pages, please include the member name of the user whose profile caused the crash.

Tags

couchsurfing icouchsurfing

In a Nutshell, icouchsurfing...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

GNU General Public License v3.0 or later
Permitted

Place Warranty

Use Patent Claims

Commercial Use

Modify

Distribute

Forbidden

Sub-License

Hold Liable

Required

Distribute Original

Disclose Source

Include Copyright

State Changes

Include License

Include Install Instructions

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    learn about Open Hub updates and features on the Open Hub blog
  • ...
    in 2016, 47% of companies did not have formal process in place to track OS code
  • ...
    compare projects before you chose one to use

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!
Sample ohloh analysis