Part of the EllisLab Network
   
1 of 4
1
A full real CI example website (see story inside)
Posted: 13 September 2009 05:35 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  85
Joined  07-02-2008

My brother and I spent many months designing and coding our website Unravel The Music.  We decided that it is now effectively worthless because the API we used for gathering lyrics was recently sued and shutdown for copyright infringement.  We weren’t really aware that this was a major risk for us and one that we were really willing to take on. 

We therefore decided that since this is a hobby site and we are unable to afford licensing for lyrics the site is essentially valueless and we are looking for something else to put our time into (if you have any ideas or support we’d love to hear it).
Since we no longer really plan on pursuing this website any longer I wanted to offer up to the community many examples of codeigniter code.  While some of them may not be “best practice” I feel they still get the job done well.

So, if you want to see examples of the following things plus much much more check out the source, let us know how we did, what you think and anything else on your mind.

User activity feed
Journals
Blog
Most disccused lists
User Karma system
Multiple APIs
Memcached integration
Searching
Cataloging
User profiles
AJAX and jQuery examples
File uploading (thumbing and resizing)
Comment voting
Threaded comments
Artist/Album/Song Tagging
Amazon integration
Issue Reporting
Power User management console
Admin console

We could try to set it up as a music blog and spotlight interview site but there are just so many of them already we don’t see how we can be competitive as we can’t be dedicated writers and we are both in school and working.  Therefore I hope you learn something from our work.

So please any comments, tips, concerns or whatever, just leave them below.

Please note if you are looking at songs/view the lyrics section has been intentionally crippled to not work.

http://www.unravelthemusic.com/unravelthemusic.com.zip
www.unravelthemusic.com

Edit:
I’ve actually decided to start a simple wordpress blog to share and explain some of the code in a much more structured format rather than a source code dump.  Hope you all enjoy it.

http://unravelthecode.wordpress.com/

Edit2:
Thanks Snaver for putting the code up on BitBucket.
BitBucket

Profile
 
 
Posted: 13 September 2009 05:44 PM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2126
Joined  06-04-2008

Hey .. sad story, but I really applaud your decision to give this to the world.  Thank you so very much (even if you share the same concern as the rest of us with regards ‘not quite best practice’ ;)

Couple of hints.

application/config/database.php - might want to change your password at your end now. ;)

Consider publishing this to something like git hub so it gets a bit more exposure / people can contribute code / make it more easily explored.  I see that there’s no .svn or .git sub-directory, so I’m guessing you weren’t developing this with a cvs?

Finally, there’s no licence (or even license) file in sight - you should probably specify one somewhere.  I’d go for GPLv2 (or later) but I’m a GPL fanboy - you should, in any case, consider your position on the licensing front.

Profile
 
 
Posted: 13 September 2009 05:48 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  315
Joined  08-29-2008

Wow! browsing thru the code right now.  I certainly appreciate this wink  grin

 Signature 

CodeIgniter From Scratch: Day 1 | Day 2 | Day 3 | Day 4 | Day 5 | Day 6 | Day 7

Profile
 
 
Posted: 13 September 2009 05:53 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Rank
Total Posts:  85
Joined  07-02-2008

Yowza forgot about the database password…
Thanks for pointing it out.  and for the curious I did change it if you got it.

Profile
 
 
Posted: 13 September 2009 05:55 PM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2126
Joined  06-04-2008

That kind of thing has bitten me in the past when wrapping up things for public consumption.

I don’t imagine anyone around here would try to do anything unpleasant with it, so don’t panic on that front.

But I have to ask .. what’s with the hatred of whitespace (empty lines between blocks of code, say) and comments?  (Hey, if I didn’t, someone else would ;)

Profile
 
 
Posted: 13 September 2009 05:59 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  85
Joined  07-02-2008

You have to understand, this was just me working on anything in controllers, models or view files.  I never intended on anyone else seeing the code so I just tried to write code that made sense without needing comments. 

If you have questions on what something does I’d be happy to explain it.

Profile
 
 
Posted: 13 September 2009 06:11 PM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2126
Joined  06-04-2008

It’s just that this is a truly mammoth library of work - I’m sure it was a very painful decision to ‘let it go’ - and I’m both amazed and impressed that you could track everything in a project of this size in your head without using tools like phpdoc, or a software version tracker, etc.  (It’s one of those regrettable insights that makes me feel old and dumb.)

I, too, am digging through the contents at the moment .. and (to use the young person’s vernacular) it’s, like, wow, like, this is just massive.

There’s the thick end of 10,000 lines of code in here - and for a ‘conventional’ PHP suite that figure would be broken down into about 6k lines of code, and 4k lines of comments.  With this code, it feels closer to 9:1.

Profile
 
 
Posted: 13 September 2009 06:16 PM   [ Ignore ]   [ # 7 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2674
Joined  05-18-2008

Wow! It’s great of you to share this after the sad story. Gives people another big scale application to look through

I just ran CLOC on it (Count Llines Of Code) and it said (just for the PHP as it seems to be ignoring HTML, CSS and JS today :S)
Code: 17814
Comments: 2467
Blank lines: 3014

I’ve not started looking through the code yet, and based on the size, it may take me a while lol
But yeah, I’m too impressed you managed to keep track of whats what without using PHPDoc, Version control etc

 Signature 

I’m building a Project Management System for my 3rd year Uni project, Sign up to the beta
Track my progress | Post of the day: UI Designs
Get full auto complete support for CodeIgniter in Eclipse

Profile
 
 
Posted: 13 September 2009 06:21 PM   [ Ignore ]   [ # 8 ]  
Research Assistant
RankRankRank
Total Posts:  390
Joined  04-21-2009

Tough luck… I hope you learned your lesson though. Be very cautious whenever your about to use any information that any one in the record industry could see as their own. Any even more, that you cherish learning how to make such a nice site…

 Signature 

I love the smell of code in the morning.

Profile
 
 
Posted: 13 September 2009 07:01 PM   [ Ignore ]   [ # 9 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2126
Joined  06-04-2008
Dam1an - 13 September 2009 10:16 PM

Code: 17814
Comments: 2467
Blank lines: 3014

I think your cloc is running slow. ;)

Not sure what scope you were limiting yourself to there, but just looking at the controller (less the admin sub-dir) collection:

cd controllers

wc -* | tail -1
  5501 

grep  "\/\*" * | wc -l
 5 

grep  "\/\/" *  | wc -l
 248

grep ^^M$ *  | wc -l
 239

grep "function" * | wc -l
 154 

So .. 154 functions spread over 5,500 lines, with 248 lines of comments, 5 blocks of comments,  and 239 blank lines (dos format, so I had to mung that a bit)

Seriously, that’s making my nose bleed just thinking about trying to track all that in my head, over a period of several months!, and while I was doing something else (school) that required non-trivial amounts of my time and concentration.

Profile
 
 
Posted: 13 September 2009 07:02 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  455
Joined  03-28-2008

Wow!
I really admire your work and the fact that you share this with us!
That actually inspires me to share my own work (when I’m happy enough with it!) smile

You did a GREAT job and I will browse your code in more depth asap!

Regards!
Johan

 Signature 

———————————————————————————————————————————-
Imac 27” Core i7 / 12GB RAM
Macbook Pro 15” C2D 2.53Ghz / 4GB RAM / NVIDIA GeForce 9400M + 9600M GT 512MB
iPhone 4 16Gb Black

http://www.rockkarusellen.se

Profile
 
 
Posted: 13 September 2009 08:21 PM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  281
Joined  02-12-2009

Dood, that so totally sucks… as the owner/admin/programmer/etc of a website that bends/pushes the rules of copyright I fear getting any C&D letter in the mail.  Thanks for the contribution, please consider like others have said and put this in a public repository (github, sourceforge, etc) and then add it to the CI Wiki—applications section (if you haven’t done so already)

Nice!  You extended the Form_validation class, haven’t seen a lot of discussion on that.

Just taking a quick look through the code—do you have any base sql information (tables, sample data, that you can release? (public domain songs could be used - nearly any of the Christmas songs should be ok, National Anthems are typically public domain also.)

Again, thanks for the contribution of code.

 Signature 

.htaccess mod_rewrite no longer working when moving from the development server to production server?

Check that you have AllowOverride All in your host config file for the public web directory of your website.

AND USE THE FRACKING SEARCH!!!  it works, it really does!

Profile
 
 
Posted: 13 September 2009 08:39 PM   [ Ignore ]   [ # 12 ]  
Grad Student
Rank
Total Posts:  85
Joined  07-02-2008
brianw1975 - 14 September 2009 12:21 AM

Just taking a quick look through the code—do you have any base sql information (tables, sample data, that you can release? (public domain songs could be used - nearly any of the Christmas songs should be ok, National Anthems are typically public domain also.)

Again, thanks for the contribution of code.

http://www.unravelthemusic.com/schema.txt

That is the schema.  You can input some basic information if you want it’s pretty easy.

Profile
 
 
Posted: 13 September 2009 09:36 PM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  281
Joined  02-12-2009

Thanks!

 Signature 

.htaccess mod_rewrite no longer working when moving from the development server to production server?

Check that you have AllowOverride All in your host config file for the public web directory of your website.

AND USE THE FRACKING SEARCH!!!  it works, it really does!

Profile
 
 
Posted: 13 September 2009 10:29 PM   [ Ignore ]   [ # 14 ]  
Summer Student
Avatar
Total Posts:  23
Joined  07-18-2008

Thanks a lot for the sharing

 Signature 

Ervin Ter Blog Twitter

Profile
 
 
Posted: 14 September 2009 12:06 AM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  141
Joined  05-23-2009

Did you consider spidering lyrics from other websites? Its not that hard really!

 Signature 

Renowned Media: Website | Blog | Twitter | CodeVault

Our Products: RenownedStats | Royalty Free Music

Profile
 
 
   
1 of 4
1