ELouisYoung
Documenting my journey to being a successful web developer.
2011-11-20
Bye-bye Apple
I thought I'd post a brief email I sent to apple this morning, here it is:
I'm emailing to voice my disgust at Apple for not coming out against the stop online piracy act.
Apple, you make my favorite computers, and I use your computers primarily to interact with the world via a free and open internet. If you and other big players don't step up in a barking rage against such a horrible thing as SOPA then I'm afraid free speech online may soon come to an end; It feels like it's heading that way.
I've been dedicated to Apple computers for many years; I'm even a former employee, but it saddens me to say there is a very high chance that my next computer will not be a mac. As much as I like your hardware, I don't believe I can morally support you anymore.
2011-07-21
Unable to follow anyone on Twitter
When I follow any user on twitter, they will be removed from my following list automatically withing a few seconds to a few hours.
I can't figure this out. I can change my password and it still happens. I revoked all third party app access. I think it's their system
If anyone has any ideas please let me know. UPDATE: One of my emails to twitter finally got read and they fixed my account.
I can't figure this out. I can change my password and it still happens. I revoked all third party app access. I think it's their system
If anyone has any ideas please let me know. UPDATE: One of my emails to twitter finally got read and they fixed my account.
2011-01-29
No Ruby bindings for Xapian installed
I recently upgraded ruby 1.8.7 to patch 330 via rvm and I started getting the error "No Ruby bindings for Xapian installed".
So I'm guessing the ruby bindings are specific to the ruby version, down to patchlevel...?
Resolved by first uninstalling xapian
and then re-installing with the --ruby flag set again
So I'm guessing the ruby bindings are specific to the ruby version, down to patchlevel...?
Resolved by first uninstalling xapian
brew uninstall xapian
and then re-installing with the --ruby flag set again
brew install xapian --ruby
2010-12-15
Fresh mac rails development setup - quick and clean
just got a new macbook pro,
logging this here incase I have to do it again soon.
if you have a new mac and you happen to find this blog post soon after I'm posting it, this will save you some time! :)
the sites I used to get help listed here:
https://github.com/mxcl/homebrew/wiki/installation
http://everydayrails.com/2010/06/28/rvm-gemsets-rails3.html
http://blog.theablefew.com/very-simple-homebrew-mysql-and-rails
http://spyrestudios.com/setting-up-a-rails-development-system-on-mac-osx-snow-leopard
exactly what I did, in order, copy and paste these codeblocks:
1. first install xcode(downloaded from the mac dev site)
2. install homebrew:
3. modify /usr/local permissions:
4.a install RVM
4.b create .bash_profile
4.c add this to ~/.bash_profile
5. install ruby 1.8.7(via rvm)
6. install ruby 1.9.2(via rvm)
7. make rvm's 1.9.2 the system default(and switch to it)
8.a install mysql
8.b following instructions printed out after mysql installs: "If this is your first install, automatically load on login with:"
this is what I put there:
I made a default user for mysql client
pasted in this:
install rails gem and dependencies(remember this is for the 1.9.2 version of ruby, each version of ruby in rvm has it's own location for gems(and then there's gemsets, which I won't be setting up at the moment)
install mysql gem, and config for mac:
if this is what you do, you can probably pick it up from here
logging this here incase I have to do it again soon.
if you have a new mac and you happen to find this blog post soon after I'm posting it, this will save you some time! :)
the sites I used to get help listed here:
https://github.com/mxcl/homebrew/wiki/installation
http://everydayrails.com/2010/06/28/rvm-gemsets-rails3.html
http://blog.theablefew.com/very-simple-homebrew-mysql-and-rails
http://spyrestudios.com/setting-up-a-rails-development-system-on-mac-osx-snow-leopard
exactly what I did, in order, copy and paste these codeblocks:
1. first install xcode(downloaded from the mac dev site)
2. install homebrew:
ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"3. modify /usr/local permissions:
sudo chown -R $USER /usr/local curl -Lsf http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C/usr/local4.a install RVM
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )4.b create .bash_profile
touch ~/.bash_profile4.c add this to ~/.bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"5. install ruby 1.8.7(via rvm)
rvm install 1.8.76. install ruby 1.9.2(via rvm)
rvm install 1.9.27. make rvm's 1.9.2 the system default(and switch to it)
rvm 1.9.2 --default8.a install mysql
brew install mysql8.b following instructions printed out after mysql installs: "If this is your first install, automatically load on login with:"
cp /usr/local/Cellar/mysql/5.1.53/com.mysql.mysqld.plist ~/Library/LaunchAgentslaunchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plistmysql_install_db/usr/local/Cellar/mysql/5.1.53/bin/mysqladmin -u root password 'YOURPASSWORDHERE'sudo touch /etc/my.cnfsudo vim /etc/my.cnfthis is what I put there:
[mysqld]
max_allowed_packet=64M
character-set-server = utf8
default-character-set = utf8
[mysql]
default-character-set = utf8
[client]
default-character-set=utf8
I made a default user for mysql client
touch ~/.my.cnfvim ~/.my.cnfpasted in this:
[client]
user = root
password = YOURPASSWORDHEREinstall rails gem and dependencies(remember this is for the 1.9.2 version of ruby, each version of ruby in rvm has it's own location for gems(and then there's gemsets, which I won't be setting up at the moment)
gem install railsinstall mysql gem, and config for mac:
env ARCHFLAGS="-arch x86_64" gem install mysql --no-rdoc --no-ri -- --with-mysql-config=/usr/local/bin/mysql_configif this is what you do, you can probably pick it up from here
2010-09-15
UI for Editing serialized ruby Hash stored in database
For one part of a new project of mine I have decided to store lots of data in a hash stored in a database column. Of course I employed this in my model, I needed a way for a user to edit this hash and save it back out to the database. I drew this up on the board today, and so far, in a very short amount of time, I finished how to output the serialized nested Hash.
Here's my logic that implements nested looping partials, only escaping the loop when the item is a string and not another hash. This provided for output of an infinitely nested hash.
And here's the output with a single record I just threw in there:(ignore the style, it's some inline css that took me 5 seconds to write)
Now I will be making this editable, (new key/value pairs, new hashes...) at whatever depth I see necessary for this order data.
I will update this post tomorrow with how I accomplished this.
Here's my logic that implements nested looping partials, only escaping the loop when the item is a string and not another hash. This provided for output of an infinitely nested hash.
And here's the output with a single record I just threw in there:(ignore the style, it's some inline css that took me 5 seconds to write)
Now I will be making this editable, (new key/value pairs, new hashes...) at whatever depth I see necessary for this order data.
I will update this post tomorrow with how I accomplished this.
2010-09-14
Building a google news sitemap with Rails and XML Builder
I was recently tasked with creating a google news sitemap for our main websites
See google's formatting instructions here:
http://www.google.com/support/news_pub/bin/answer.py?hl=en&answer=74288
This was my first time creating an xml output with rails/builder from scratch, so I'm documenting my experience.
oh yeah, this is an older rails app, version 2.0.2
I found a lot of documentation online about builder and creating the tags, but there is NO documentation anywhere about how to create tags with namespaces. I even looked through my massive collection of ebooks. NOTHING!
So I banged my head on my desk for a few hours(metaphorically), and stumbled upon the syntax by chance.
I really hope this helps someone in the future, because I would have paid actual money to someone for this information.
here's my rails {template}.xml.builder syntax I'm using to generate the proper google news sitemap:(sorry about the indenting, bloggers system screws up this post if I try to use the PRE tag to retain whitespace)
See google's formatting instructions here:
http://www.google.com/support/news_pub/bin/answer.py?hl=en&answer=74288
This was my first time creating an xml output with rails/builder from scratch, so I'm documenting my experience.
oh yeah, this is an older rails app, version 2.0.2
I found a lot of documentation online about builder and creating the tags, but there is NO documentation anywhere about how to create tags with namespaces. I even looked through my massive collection of ebooks. NOTHING!
So I banged my head on my desk for a few hours(metaphorically), and stumbled upon the syntax by chance.
I really hope this helps someone in the future, because I would have paid actual money to someone for this information.
here's my rails {template}.xml.builder syntax I'm using to generate the proper google news sitemap:(sorry about the indenting, bloggers system screws up this post if I try to use the PRE tag to retain whitespace)
xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
xml.urlset "xmlns"=>"http://www.google.com/schemas/sitemap/0.9",
"xmlns:news"=>"http://www.google.com/schemas/sitemap-news/0.9" do
for a in @articles do
xml.url do
xml.loc(a.smart_permalink_url(true))
xml.news:news do
xml.news:publication do
xml.news(:name, $site[:name])
xml.news(:language, @lang)
end
xml.news(:genres, 'Blog')
xml.news(:publication_date, a.published_at.strftime("%Y-%m-%d"))
xml.news(:title, a.title)
xml.news(:keywords, a.keywords.gsub('_', ' '))
end
end
end
end
2010-09-03
RVM on Ubuntu 10.04
I'm beginning the coding phase on a new project. A few days ago rails 3.0.0 was released. I'm going to hop on that bandwagon. And I've decided i'm going to install ruby 1.9.2.
During the obligatory google'ing I discovered RVM: Ruby Version Manager, and I particularly liked this blog post in which contains the phrase "...let’s move the fuck on people, the first preview of 1.8 was released in 2002, and 1.9 has been here for three years!"
I couldn't agree more with his thoughts on 1.9, especially since it's supposed to be MUCH faster. I remember watching a video of Matz last year speaking in his horribly broken engrish about 1.9. I recall him saying how 1.9 fixed many/all of the fundamental logic flaws in 1.8x. Logic flaws? That sounds like something I want to get away from anyway.
So here I go, Documenting what I did to get RVM up and running on my main development box(Ubuntu 10.04).
you'll need some of this:
and this:
and:
NOTE: RVM is ruby code itself, so you'll need ruby and rubygems already installed(if you're reading this I'm sure this is already the case)
then i ran:
and this is what it spit out:
OK looks good so far, i ran
like it told me to and got this huge output:
Ok, so it's warning me about the return statement, I must admit I don't know exactly what this means, so I'll follow the instructions verbatim.
I actually added the:
to the bottom of my ~/.profile file (which is linked from ~/.bashrc)
then I refreshed my bash profile settings with this command:
And now when i run
I get what looks like the usage manual, ok, looking good so far(I think), Now I wanna get me some 1.9.2
spit out:
Awesome, I feel the end is near.
Woo, it's done and it worked:
RVM WINS THE DAY
an excerpt from http://marcgrabanski.com/articles/gem-management-with-rvm-and-bundler
___________________________
Dont forget about gems:
Gem Management with RVM
RVM has “gemsets” which allow you to organize different sets of gems. If you install gems into the global gemset, then it will be available to you no matter which gemset you are using.
Create the global gemset.
Install gems here that will be used in projects like bundler and passenger.
Notice that I never use sudo because rvm puts these gemsets in your user ~/.rvm directory.
Now create and use your project gemset.
Obviously YOUR_GEMSET can be anything you want. Then you are set to go!
During the obligatory google'ing I discovered RVM: Ruby Version Manager, and I particularly liked this blog post in which contains the phrase "...let’s move the fuck on people, the first preview of 1.8 was released in 2002, and 1.9 has been here for three years!"
I couldn't agree more with his thoughts on 1.9, especially since it's supposed to be MUCH faster. I remember watching a video of Matz last year speaking in his horribly broken engrish about 1.9. I recall him saying how 1.9 fixed many/all of the fundamental logic flaws in 1.8x. Logic flaws? That sounds like something I want to get away from anyway.
So here I go, Documenting what I did to get RVM up and running on my main development box(Ubuntu 10.04).
you'll need some of this:
sudo apt-get install build-essentialand this:
sudo apt-get install curland:
sudo apt-get install zlib1g-dev libreadline5-dev libssl-dev libxml2-devNOTE: RVM is ruby code itself, so you'll need ruby and rubygems already installed(if you're reading this I'm sure this is already the case)
then i ran:
sudo gem rvm installand this is what it spit out:
********************************************************************************
In order to setup rvm for your user's environment you must now run rvm-install.
rvm-install will be found in your current gems bin directory corresponding to where the gem was installed.
rvm-install will install the scripts to your user account and append itself to your profiles in order to
inject the proper rvm functions into your shell so that you can manage multiple rubies.
********************************************************************************
Successfully installed rvm-1.0.2
1 gem installed
Installing ri documentation for rvm-1.0.2...
Installing RDoc documentation for rvm-1.0.2...
OK looks good so far, i ran
rvm-installlike it told me to and got this huge output:
RVM: shell scripts which allow management of multiple ruby interpreters and environments.
RTFM: http://rvm.beginrescueend.com/
HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
* Installing rvm to /home/eric/.rvm/
Correct permissions for base binaries in /home/eric/.rvm/bin...
Copying manpages into place.ls: cannot access ./man: No such file or directory
Notes for Linux ( DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.1 LTS" )
* NOTE: MRI stands for Matz's Ruby Interpreter (1.8.X, 1.9.X), ree stands for Ruby Enterprise Edition and rbx stands for Rubinius.
* curl is required.
* patch is required (for ree, some ruby head's).
* If you wish to install rbx and/or any MRI head (eg. 1.9.2-head) then you must install and use rvm 1.8.7 first.
* For JRuby (if you wish to use it) you will need:
$ aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk
* For MRI & ree (if you wish to use it) you will need (depending on what you are installing):
$ aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf
* For IronRuby (if you wish to use it) you will need:
$ aptitude install curl mono-2.0-devel
Eric Young,
Thank you for using rvm. I hope that it makes your work easier and more enjoyable.
If you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know.
My irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST.
If I do not respond right away, please hang around after asking your question, I will respond as soon as I am back.
Be sure to get head often as rvm development happens fast, you can do this by running 'rvm update --head'.
w⦿‿⦿t!
~ Wayne
You must now finish the install manually:
1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
Please note that this must only occur once - so, you only need to add it the first time you install rvm.
2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly).
This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:
if [[ -n "$PS1" ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Be absolutely *sure* to REMOVE the '&& return'.
If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile.
placing all non-interactive items in the .bashrc, including the 'source' line above
3) Then CLOSE THIS SHELL and open a new one in order to use rvm.
WARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc.
This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:
if [[ -n "$PS1" ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Even if you use zsh you should still adjust the .bashrc as above.
If you have any questions about this please visit #rvm on irc.freenode.net.
Installation of RVM to /home/eric/.rvm/ is complete.
Ok, so it's warning me about the return statement, I must admit I don't know exactly what this means, so I'll follow the instructions verbatim.
I actually added the:
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvmto the bottom of my ~/.profile file (which is linked from ~/.bashrc)
then I refreshed my bash profile settings with this command:
source ~/.profileAnd now when i run
rvmI get what looks like the usage manual, ok, looking good so far(I think), Now I wanna get me some 1.9.2
rvm install 1.9.2spit out:
info: Installing Ruby from source to: /home/eric/.rvm/rubies/ruby-1.9.2-p0
info: Downloading ruby-1.9.2-p0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8296k 100 8296k 0 0 74580 0 0:01:53 0:01:53 --:--:-- 67103
info: Extracting ruby-1.9.2-p0 ...
info: Configuring ruby-1.9.2-p0, this may take a while depending on your cpu(s)...
info: Compiling ruby-1.9.2-p0, this may take a while depending on your cpu(s)...
info: Installing ruby-1.9.2-p0
info: Installation of ruby-1.9.2-p0 is complete.
info: Updating rubygems for /home/eric/.rvm/gems/ruby-1.9.2-p0@global
info: Updating rubygems for /home/eric/.rvm/gems/ruby-1.9.2-p0
info: adjusting shebangs for ruby-1.9.2-p0 (gem irb erb ri rdoc testrb rake).
info: Importing initial gems...Awesome, I feel the end is near.
Woo, it's done and it worked:
eric@elydevbox:~$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
eric@elydevbox:~$ rvm 1.9.2
eric@elydevbox:~$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
eric@elydevbox:~$ irb
ruby-1.9.2-p0 > puts "hi"
hi
=> nil
ruby-1.9.2-p0 >
RVM WINS THE DAY
an excerpt from http://marcgrabanski.com/articles/gem-management-with-rvm-and-bundler
___________________________
Dont forget about gems:
Gem Management with RVM
RVM has “gemsets” which allow you to organize different sets of gems. If you install gems into the global gemset, then it will be available to you no matter which gemset you are using.
Create the global gemset.
rvm gemset create global
rvm gemset use globalInstall gems here that will be used in projects like bundler and passenger.
gem install bundler
gem install passengerNotice that I never use sudo because rvm puts these gemsets in your user ~/.rvm directory.
Now create and use your project gemset.
rvm gemset create YOUR_GEMSET
rvm gemset use YOUR_GEMSETObviously YOUR_GEMSET can be anything you want. Then you are set to go!
Subscribe to:
Posts (Atom)

