i've noticed..

2011, Apr 01

What is Self Compete?

On the road here, to search for the new headquarters of Self Compete in beautiful Raleigh-Durham. Well, not exactly… I am on the road, headed toward Raleigh-Durham (which is beautiful), and Self Compete is a thing but it’s not a thing that’s ready for a headquarters. So… what exactly is Self Compete? Self Compete is my entry into the wonderful world of web applications. The idea started as a personal motif - a mission for each day, to improve upon the day before. It felt good. It felt like personal growth. It improved self confidence because I was growing and able (and willing) to take on new things.

This way of living wasn’t without its drawbacks. There was the risk of overdoing it and causing myself to degrade rather than improve. Also, it was difficult keeping track of where I had already been. I want to run further than the last time… but how far did I run last time? Around the time of realizing these issues, I was also a big fan of playing games on my iPhone. I would get 2 stars on Angry Birds and think to myself, “well I will definitely get 3 stars if I break 100,000.” That was the moment of realization - these high scores were what I needed for every day life.

Self Compete is my solution to these problems. It is an application that creates a way to measure any goal, break new personal bests and even do a little bragging. Through measuring where I had been, I was able to set realistic goals that were both attainable and still an improvement. Through incremental and controlled improvement, I could get better without over doing it and risking degrading myself. Along with the ability to set goals, I gained an emotionally valuable understanding of myself.

My newest goal is to bring those things to you and to make them fun. I’ve already begun to develop and hope to have something out very soon. In the meantime sign up for early access at www.selfcompete.com and I’ll post regular updates on this site. I’ll be listening for your feedback!

2010, Nov 20

SQLite3::SQLException: table already exists

Another installation of “Things that you can’t really find on Google!”

When using rake db:migrate you may run into a problem if you have previously created a table in a migration and have not done a proper down migration. In my case, I completely forgot to do a migration between doing a `rails destroy scaffold` and recreating the scaffold with new properties.

Doing so, caused the following error when I did `rake db:migrate` :

==  CreateTable_Names: migrating ================

— create_table(:table_name)

rake aborted!

An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table “table_name” already exists: CREATE TABLE “table_name” 

Luckily, this is very easy to fix. There may, however, be an exclusion made by most of the problem solvers on the internet that won’t be assumed by the beginning Rails programmer. The solution is easy: drop the table. How to do the solution, especially for those with a MySQL background, can be tricky.

From the command line, your first instinct will be to start sqlite and look for the table to drop. However, the proper way to do it is to go to your Rails application directory and run the following command to open the development database for your application:

sqlite3 db/development.sqlite3 

Once you’ve started sqlite3 with the proper database, you probably know what to do:

sqlite> drop table table_name;

sqlite> .quit

This is pretty simple, but old habits die hard and coming from MySQL leads you to follow the wrong steps so its worth sharing for the stranded Googler. Maybe just learning SQLite properly is the trick here.

2010, Nov 20

Rails Attribute Types

When you generate a model or scaffold in Rails, you can specify attributes along with their type. Using typed attributes is an incredibly useful tool in rails generator because it will generate the appropriate field types in your database and html in your views.

Example:

$ rails generate scaffold Post name:string title:string content:text

More accurately, these are the types supported by ActiveRecord. The problem is, not a single rails tutorial will tell you the full list of types. I suppose you’re supposed to just guess and hope everything works.

It is incredibly annoying to find these on Google, so I’m hoping to contribute to a few keyword searches by putting these here. (And this will serve as a personal reminder of sorts)

Supported ActiveRecord Types:

:string, :text, :integer, :float, :decimal, :datetime, 

:timestamp, :time, :date, :binary, :boolean