Put git into Verbose Mode

Using git as a versioning system is great, but sometimes you might get some cryptic error messages.
To help you on debugging put git into verbose mode directly in your command line, and only for each command you need. Here's how:


$ GIT_CURL_VERBOSE=1 git push

Cheers

HOW-TO fix Git repository corruption: Cannot obtain needed commit

When trying to clone a remote repository and you receive an error message that it cannot obtain need commit from server, it is very easy to fix this problem:

error: Unable to find ef999dd8a64814fb66f09e7020a6613b6de835f5 under http://example.dyndns.org/repo/example.git
Cannot obtain needed commit ef999dd8a64814fb66f09e7020a6613b6de835f5
while processing commit 23e99471bb05a6807e4d4fc3744ce864e7effeaa.
error: Fetch failed.

HOW-TO find out the remote GIT repository

It might happen that you have so may repositories on your local machine at once that it could get hard to remember which is the original remote repository or branch. The command in git to find this out would be:

git remote show origin

Cheers!

Loading Seed Data in Rails 3

Most applications need some startup data in the database to be able to run (e.g. an administrator account or some configuration items). Before Rails 3 there were some alternative ways to do this, either using 3rd party code or adding data into your migrations (check this article to learn why having seed data in migrations is not a good idea).
In Rails 3 there is a much wiser way to do it. In your db folder you will find a file called seeds.rb. This is now the place to add seed data, as in this example:

Creating nested resources in ruby on rails 3 with scaffold

This very helpful article on Creating Nested Resources with scaffold in Rails 3 shows what you have to change after scaffolding 2 models and deciding that you want them to be nested.

Dictionary of Algorithms and Data Structures

"This web site is hosted in part by the Software and Systems Division, Information Technology Laboratory.

This is a dictionary of algorithms, algorithmic techniques, data structures, archetypal problems, and related definitions. Algorithms include common functions, such as Ackermann's function. Problems include traveling salesman and Byzantine generals. Some entries have links to implementations and more information. Index pages list entries by area and by type. The two-level index has a total download 1/20 as big as this page.

Don't use this site to cheat.

HOW-TO install MySQL on an Amazon AWS Server using EBS

I am using an Amazon Linux AIM so the steps below assume this is the kind of image you have. Most of the steps below actually should work on any Linux server.
It is interesting to use an EBS filesystem so your data is persisted even after termination of your server instance. Using the instance filesystem to store data from MySQL should not be interesting for a database server, as all your data would be lost in case of termination of your instance.

Using new EBS volume with your Amazon AWS instance server

So you just decided to create a new EBS volume to be used with one of your Amazon AWS Instances. Why would you do this? I could think of many reasons, but the one for me is using it as a repository for my git files, so they are preserved in case my instance is shut down or corrupt.
To do this, follow the steps below:

  1. Create the EBS Volume:
  2. Go to your AWS Management Console, choose your region and find the "Elastic Block Stores"(EBS) / Volumes option.

Install MySQL Gem in Mac OS - using MacPorts

While trying to install the MySQL gem in a Mac OS Lion, you might get an error message:

$ sudo gem install mysql -v '2.8.1'
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
....
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

How-to install Ruby and Rails on a Amazon EC2 Server

To install Ruby and Rails on your Amazon EC2 server there are a few steps you need to follow, but none of them quite hard. By default ruby is already installed on your server by Amazon - check it by running $ ruby -v.

$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-linux]

Pages

Subscribe to www.definenull.com RSS