Social Network in 30 days : Day 2


Warning: Undefined array key "layout" in /home/bateeqjg/public_html/news/wp-content/plugins/wp-about-author/wp-about-author.php on line 94

Friday just past, so here’s an report.

Day 2 Report:
Finished 3/4 tasked that were scheduled yesterday. I only had around 4-5 hours of programming time after work but I think I got a lot done.
The site is now hosted on heroku.com at http://linksteach.me.

Feature List:
The goal of the site is now to create a reddit-like site for school. This idea seems more like a social bookmarking website, rather than a social network.
A social bookmarking site values the content of the links more than the user.
A social network is values the user more than the content.
Here’s a brief and general overview of the features

Views (Non-registered user) can;
– View Posted content
– Search/Browse/Filter for posted content

Registered Users can;
– Has the same abilities as a viewer
– Post content relating to school material
– Vote on other’s posted content
– Leave comments on posted content
– Report content
– Request new features and material

Moderators;
– Ban users
– CRUD user’s content

Admin;
– Has all priveleges
– Ban Users, Moderators
– CRUD any posted content

Milestones (Dates):
– Oct 24, 2013 – Start of 30 day challenge
– Nov 5th – Alpha release
– Nov 7th – Collect feedback from at least 5 users and find out where to improve
– Nov 14 – Beta release
– Nov 15 – Collect feedback from at least 5 users and find out where to improve
– Nov 23 – Final Release, 30 day challenge complete.

HomePage:
Setting up Golang with Heroku was quick and simple after reading this guide. Getting Started with Go on Heroku by Mark McGranaghan. I decided on sticking with Heroku, instead of Google App Engine because using Google App Engine for hosting requires to many architectural changes.

Here’s the result.

On the homepage I hosted some of the content on Amazon S3 storage but converting all the URLs to point to it is a HUGE hassle. So I don’t think I’m going to be using them until the traffic demands for a CDN.
A major problem I had with Heroku was finding out how to point to the correct filepath for static content on the file system. The answer is simple. The base directory is where `.git` is hosted.

Login:
I got stuck on this part because I needed to figure out how to properly make a nonce (one time token).
https://github.com/LarryBattle/nonce-golang
More information here about nonce. Chapter 4.4 of “Building Web Applications with Golang”

Goals for tomorrow:
– Create mock up screen shots
– Create a login page
– Create a DB connection test page.
– Update https://github.com/LarryBattle/nonce-golang to include demo and documention
– Create a sample unit test
– Create a profile setup page.

Done with day 2

Larry Battle

Larry Battle

I love to program, and discover new tech. Check out my <a href="http://stackoverflow.com/users/527776/larry-battle">stackoverflow</a> and <a href="https://github.com/LarryBattle">github</a> accounts.

More Posts - Website

Follow Me:Add me on XAdd me on LinkedInAdd me on YouTube

Social Network in 30 days: Day 1


Warning: Undefined array key "layout" in /home/bateeqjg/public_html/news/wp-content/plugins/wp-about-author/wp-about-author.php on line 94

Hey guys and gals.
You know, I haven’t built anything in a while.
So today, I decided to challenge myself to build a social network within 30 days.
For the next 30 days, I’ll provide short blog post about my process and lessons learned.

Day 1:

Project Overview:
After some thought I decided to go with creating a site similar to Stackoverflow.com and chegg.com for online learning targeted for college students. Students post questions and peers help answer their questions about a course.

Tech:
Hosting: Heroku (Cloud Hosting)
Server Side: Google Go 1.x
Database: Redis 2.x(Caching), MySQL 5.x
Front-end: jQuery 2.x, Bootstrap.js 3.x and Angular.js 1.x

Budget:
cost < $1,000 Team Right now, just me. Might out-source a few parts. Here's my resume if you're curious about my background. http://www.indeed.com/me/larry_battle Also, I'm following this guide for learning Google Go, https://github.com/Unknwon/build-web-application-with-golang_EN Risks - Finding the time to work on this is going to hard. Time management is going to be crucial. - Learning curve. Expect for jQuery, I'm not an expert in any of the technologies I'm using. That's it for day 1. Plans for tomorrow: - Developer a feature list - Plan out milestones. - Create a homepage. - Create a login page.

Larry Battle

Larry Battle

I love to program, and discover new tech. Check out my <a href="http://stackoverflow.com/users/527776/larry-battle">stackoverflow</a> and <a href="https://github.com/LarryBattle">github</a> accounts.

More Posts - Website

Follow Me:Add me on XAdd me on LinkedInAdd me on YouTube

Code of the day: Javascript Flatten()


Warning: Undefined array key "layout" in /home/bateeqjg/public_html/news/wp-content/plugins/wp-about-author/wp-about-author.php on line 94
/**
* Returns an array that contains non-array elements.
* If an element is an array, then the element is replaced by the content of the array.
* @param{Array} 
* @return{Array} return null if no arguments are passed.
* @example 
    flatten([[1,2],3,[4]]); // returns [1,2,3,4];
*/
var flatten = function(arr){
	if(!Array.isArray(arr)){
		return (arr === null || arr === undefined) ? null : [arr];
	}
	var result = [], obj;
	for(var i = 0, len = arr.length; i < len; i++){
		obj = arr[i];
		if(Array.isArray(arr)){
			obj = flatten(obj);
		}
		result = result.concat( obj );
	}
    return result;
};

Larry Battle

Larry Battle

I love to program, and discover new tech. Check out my <a href="http://stackoverflow.com/users/527776/larry-battle">stackoverflow</a> and <a href="https://github.com/LarryBattle">github</a> accounts.

More Posts - Website

Follow Me:Add me on XAdd me on LinkedInAdd me on YouTube

Google Go: recover() example


Warning: Undefined array key "layout" in /home/bateeqjg/public_html/news/wp-content/plugins/wp-about-author/wp-about-author.php on line 94

Here’s an example of how to use recover() in Google Go.

package main

import "fmt"

func gandalf( doTalkTo bool ){
	defer catch()
	if(doTalkTo){
		// Panic stops execution of the current function and stops unwinding the stack, calling an deferred functions along the way.
		panic("You shall not pass!")	
	}
}
// catch() must be called as a deferred 
func catch(){
	// recover() regains control over the program execution when panic() is called.
	// recover() returns is the argument passed from panic()
	if r := recover(); r != nil {
		fmt.Println("Error:", r)
	} else {
		fmt.Println("No problems occurred")
	}
}
func main() {
	gandalf(true)
	gandalf(false)
	//unwinds to the top of the stack and ends the program
	panic("Where am I going?");
}


Output:
Error: You shall not pass!
No problems occurred
panic: Where am I going?

goroutine 1 [running]:
main.main()

Demo: http://play.golang.org/p/xu9Jd1YI0T

More information here:
Effective Go - The Program Language

Larry Battle

Larry Battle

I love to program, and discover new tech. Check out my <a href="http://stackoverflow.com/users/527776/larry-battle">stackoverflow</a> and <a href="https://github.com/LarryBattle">github</a> accounts.

More Posts - Website

Follow Me:Add me on XAdd me on LinkedInAdd me on YouTube