Pages
Greetings :)
Hi, I'm Louis!
I like to code, but I don't do enough of it.
This blog is about trying my best to keep up with the ever evolving stream of technology.
This blog is about trying my best to keep up with the ever evolving stream of technology.
Saturday, November 19, 2011
Helpful sinatra info
https://github.com/toolmantim/sinatra-content-for -- allow you to pass in say the title from a page to the layout.
Sunday, October 16, 2011
Helpful ruby commands
Remove all gems
* gem list | cut -d" " -f1 | xargs gem uninstall -aIx
* (From RVM) rvm do gem list | cut -d" " -f1 | xargs rvm do gem uninstall -aIx
Remove RVM
1.rvm implode
2.gem uninstall rvm
* gem list | cut -d" " -f1 | xargs gem uninstall -aIx
* (From RVM) rvm do gem list | cut -d" " -f1 | xargs rvm do gem uninstall -aIx
Remove RVM
1.rvm implode
2.gem uninstall rvm
Saturday, September 24, 2011
Adding local 'DNS' entries to your mac
I'm currently working on adding subdomains to my sinatra app - following the instructions at:
http://tannerburson.com/2009/01/extracting-subdomains-in-sinatra.html
First we need to add a local domain name to our hosts file:
http://decoding.wordpress.com/2009/04/06/how-to-edit-the-hosts-file-in-mac-os-x-leopard/
sudo vi /private/etc/hosts
Run dscacheutil flushcache
Once this is done, wildcard subdomains will need to be supported. I'm using Heroku, and thus I'll follow the instructions at http://devcenter.heroku.com/articles/custom-domains
Heroku notes
Create a new heroku instance
gem install heroku heroku create git push heroku master >> 'successfully deployed' then you go to the site and ... error... heroku logs >> figure out the error (e.g. missing gem.. update Gemfile) then try again...
now that we've got something running, can add a domain...
(taken from http://devcenter.heroku.com/articles/custom-domains)heroku addons:add custom_domains heroku domains:add www.example.com heroku domains:add example.com
And now setup domains on your domain provider (I'm using godaddy)
75.101.163.44 75.101.145.87 174.129.212.2In GoDaddy find your domain name, click on it, and then click the 'DNS Manager' on the page that shows all the information about your domain. Click on the 'Quick Add' on the Hosts(A) section, and just add the @ ip address - have to do three entries. The www will reference to @, so don't need to worry about that one :)
Getting the mongo connection string:
heroku config --long
You'll get some output that includes a line where your mongo connection is:
MONGOHQ_URL => mongodb://heroku:myPassword@myHost:10013/appname545
You can then take this string, and use it to connect to mongo:
mongo -u heroku -p myPassword --host myHost -port 10013 appname545
heroku config --long
You'll get some output that includes a line where your mongo connection is:
MONGOHQ_URL => mongodb://heroku:myPassword@myHost:10013/appname545
You can then take this string, and use it to connect to mongo:
mongo -u heroku -p myPassword --host myHost -port 10013 appname545
We may already have an app and we're on a different machine than the original
- Install toolbelt - https://toolbelt.herokuapp.com/linux
- heroku login
- heroku keys:add [path to keyfile]
- git remote add heroku git@heroku.com:myAppOnHeroku.git
Friday, August 5, 2011
Deleting objects with ruby on Amazon S3
Problem:
I ended up with loads of objects in my bucket after configuring some logging in Amazon S3. Deleting these manually is not the best use of time (click click click... one has been deleted) * 1 million (slightly over-exaggerated)
Solution:
Use Ruby to do it!
Solution Problem:
I was trying to use the 'aws/s3' gem, and apparently there's some problems with european regions or something... anyway, I tried some sample code found in http://stackoverflow.com/questions/27267/delete-amazon-s3-buckets, and then I found - http://thewebfellas.com/blog/2009/8/29/protecting-your-paperclip-downloads which led me to my eventual solution...
Solution Problem Solution:
Use a different gem - the 's3' gem.
Here's what I ended up with:
Pretty simple in the end huh :)
Check that it worked by doing my_bucket.objects.size before and after you delete the objects.
I ended up with loads of objects in my bucket after configuring some logging in Amazon S3. Deleting these manually is not the best use of time (click click click... one has been deleted) * 1 million (slightly over-exaggerated)
Solution:
Use Ruby to do it!
Solution Problem:
I was trying to use the 'aws/s3' gem, and apparently there's some problems with european regions or something... anyway, I tried some sample code found in http://stackoverflow.com/questions/27267/delete-amazon-s3-buckets, and then I found - http://thewebfellas.com/blog/2009/8/29/protecting-your-paperclip-downloads which led me to my eventual solution...
Solution Problem Solution:
Use a different gem - the 's3' gem.
Here's what I ended up with:
require 's3' service = S3::service.new(:access_key_id => your key from amazon account page, :secret_access_key => your secret key from amazon account page) my_bucket = service.buckets.find("my-unique-bucket-name") my_bucket.objects.each {|object| object.destroy}
Pretty simple in the end huh :)
Check that it worked by doing my_bucket.objects.size before and after you delete the objects.
Friday, January 7, 2011
What is hypermedia or hypertext????
Taken from Roy Fielding (the father of REST)
Hypertext means text with links in it (which give you further options or actions)
and
Hypermedia means media with links in it (i.e. video, text, pictures) - which give you further options or actions.
Hmmmm..... Maybe radio advertisements that direct you to their website for more information could even be considered as "hypermedia"? I don't think that a strict definition is really needed though. As long as the general idea comes across.
So...When I say hypertext, I mean the simultaneous presentation of information and controls such that the information becomes the affordance through which the user (or automaton) obtains choices and selects actions. Hypermedia is just an expansion on what text means to include temporal anchors within a media stream; most researchers have dropped the distinction.Hypertext does not need to be HTML on a browser. Machines can follow links when they understand the data format and relationship types.
Hypertext means text with links in it (which give you further options or actions)
and
Hypermedia means media with links in it (i.e. video, text, pictures) - which give you further options or actions.
Hmmmm..... Maybe radio advertisements that direct you to their website for more information could even be considered as "hypermedia"? I don't think that a strict definition is really needed though. As long as the general idea comes across.
Tuesday, January 4, 2011
Installing Git on windows
The following will guide you roughly through getting git setup on windows and getting a github account setup, so that you can start using git right away ;)
Install MSysGit
http://code.google.com/p/msysgit/downloads/list
Generate a private/public key pair
http://help.github.com/msysgit-key-setup/
Then create your online repository:
Go to https://github.com, sign up for an account
Add your public key to your github account:
Click "account settings" => "SSH public keys" => "Add another public key", and copy and paste the public key you generated (the whole thing) - from the "id_rsa.pub" file.
Create your repository
Click on "dashboard" => "Create a repository" => name your repository, and continue => follow the instructions shown :)
Install MSysGit
http://code.google.com/p/msysgit/downloads/list
Generate a private/public key pair
http://help.github.com/msysgit-key-setup/
Then create your online repository:
Go to https://github.com, sign up for an account
Add your public key to your github account:
Click "account settings" => "SSH public keys" => "Add another public key", and copy and paste the public key you generated (the whole thing) - from the "id_rsa.pub" file.
Create your repository
Click on "dashboard" => "Create a repository" => name your repository, and continue => follow the instructions shown :)
Subscribe to:
Posts (Atom)