OpenStack nova resize "ERROR: Resize requires a change in size"
If you get this error when you try to resize an OpenStack instance:
# nova resize example 23 --poll
ERROR: Resize requires a change in size. (HTTP 400)
You need to change your flavor to have a different memory size. It's a bug in an older OpenStack version:
# /nova/compute/api.py
if (current_memory_mb == new_memory_mb) and flavor_id:
raise exception.CannotResizeToSameSize()
which got fixed 2012-09-12 ([https://git.openstack.org/cgit/openstack/nova/commit/nova/compute/api.p...
Collection of Rails development boosting frameworks
Development environment setup
- Rails Composer
-
Basically a comprehensive Rails Template. Prepares your development environment and lets you select web server, template engine, unit and integration testing frameworks and more.
Generate an app in minutes using an application template. With all the options you want!
Code generators
- Rails Bricks
-
A command line wizard. Once you get it running, it creates sleek applications.
RailsBricks enables you to cre...
Git: Switching back to the previous branch
Using git checkout -
you can switch back to the branch you previously worked on.
(master) $ git checkout foobar
Switched to branch 'foobar'
(foobar) $ git checkout -
Switched to branch 'master'
(master) $
This also works with other commands like git merge
:
(master) $ git checkout foobar
Switched to branch 'foobar'
(foobar) $ git merge -
Merged branch 'master'
git: How to forget a recorded resolution
If you recorded a bad fix for a conflict, you can tell git to forget that bad resolution:
git rerere forget your_file.rb
Afterwards, the badly resolved file will still be in your working directory. To get it back with confict markers, say:
git checkout -m your_file.rb
Resolve the conflict again, properly now. ;)
Trailer, a faster and easier way to deal with pull requests
Introducing Trailer from HouseTrip, a simple menu bar app that helps you manage your GitHub pull requests. It’s one feature we felt was lacking from our workflow!
Installing therubyracer and libv8 with Ruby 1.8 on OSX Mavericks
There seems to be no way to use therubyracer -v '0.11.4'
and libv8 -v '3.11.8.17'
on OS X Mavericks.
However, running bundle update therubyracer
worked for me. It installed therubyracer -v '0.12.1'
and libv8 -v '3.16.14.3'
and I had not side effects.
Log of my attempts to get it working
Probably you got here when bundling failed building native extensions for therubyracer
.
The libv8
(3.3.10.4) should have been installed when bundling. Unfortunately it is not building correctly on Mavericks, so the libv8.a
f...
The new Modularity 2 syntax
We have released Modularity 2. It has many incompatible changes. See below for a script to migrate your applications automatically.
There is no does method anymore
We now use traits with the vanilla include
method:
class Article < ActiveRecord::Base
include DoesTrashable
end
When your trait has parameters, use square brackets:
class Article < ActiveRecord::Base
include DoesStripFields[:name, :brand]
end
Note how you ...
How to set git user and email per directory
I am using git at several places: at work, at university, and at home. I want an own git user/email for each of those places, but I don't want to care setting the values each time I create or clone a new repository.
Git allows for setting user/email per repository, globally and system-wide, but I need a fourth dimension: per directory. By setting git environment variables using ondir
, I managed to get exactly what I need.
- Install
ondir
(on a Mac:brew install ondir
, other OSs need to install it from the linked page). - Put these ...
HubSpot/mixen · GitHub
It's mixins (modules) for Coffeescript classes. Other than most homegrown approaches, this one allows you to keep using super
.
safe_cookies is now in public beta
We proudly release our safe_cookies middleware into public beta and just published it on Github.
Features are:
- make all application cookies
secure
andHttpOnly
(keeping them from being sent over HTTP and protecting them from Javascript) - rewrite all client cookies once, making them
secure
andHttpOnly
- notification if a request has unregistered cookies (no unsecure cookie will slip by)
- ability to ignore external cookies, like
__utma
and other tracking cookies - easy configurat...
Speeding up ssh session creation
Establishing a new SSH connection usually takes only a few seconds, but if you’re connecting to a server multiple times in succession the overhead starts to add up. If you do a lot of Git pushing and pulling or frequently need to SSH to a dev server, you’ve probably felt the pain of waiting for SSH to connect so you can get back to doing work.
redshift
For all late night coders:
The program "redshift" changes your monitors' white balance according to your position on the planet and your local time. This is supposed to put less strain on your eyeballs than staring at a "daylight white" screen all day and night.
The program is in the Ubuntu repositories, so a simple "sudo apt-get install gtk-redshift" transfers it onto your hard drive.
I find the effect rather pleasing and so I have set the following alias on my computer:
alias rdshft='gtk-redshift -l 48.3714407:10.8982552 -t 6500:4200 &'...
Git & Mac: Working with Unicode filenames
I had some problems with Git and the file spec/fixtures/ČeskýÁČĎÉĚÍŇÓŘŠŤÚŮÝŽáčďéěíňóřšťúůýž
. After pulling the latest commits, it would show that file as untracked, but adding and committing it would throw error: pathspec 'check in unicode fixture file once again' did not match any file(s) known to git
.
Solution
Install Git version > 1.8.2 using homebrew and set
git config --global core.precomposeunicode true
Done.
Reason
According to the linked Stackoverflow post ...
... the cause is the different im...
Git: How to remove ignored files from your repository's directory
When you have files in your .gitignore
they won't be considered for changes, but still you might want to get rid of them, e.g. because they clutter your file system.
While a regular git clean
will ignore them as well, passing the -x
switch changes that:
git clean -x
If you want to see what would happen first, make sure to pass the -n
switch for a dry run:
git clean -xn
Clean even harder by passing the -f
(force cleaning under certain circumstances; I think this is also required by default) or -d
(removes director...
Automated "git bisect" will make your day
So you're hunting down a regression (or just a bug) and want to use git bisect
to find out when it was introduced? Smart kid.
If you have a shell command ready to reveal if your current state is good or bad, you can have git do most of the work for you.
Using git bisect run <your command>
you can tell git that your command will reveal the issue; git on the other hand will use the return value of that call to decide if the state is good or bad.
...
Sprites with Compass
Using CSS sprites for background images is a technique for optimizing page load time by combining smaller images into a larger image sprite.
There are ongoing arguments on how useful this still is, as modern browsers become more comfortable to load images in parallel. However, many major websites still use them, for example amazon, [facebook](...
Upgrading Rails 2 from 2.3.8 through 2.3.18 to Rails LTS
This card shows how to upgrade a Rails 2 application from Rails 2.3.8 through every single patch level up to 2.3.18, and then, hopefully, Rails LTS.
2.3.8 to 2.3.9
This release has many minor changes and fixes to prepare your application for Rails 3.
Step-by-step upgrade instructions:
- Upgrade
rails
gem - Change your
environment.rb
so it saysRAILS_GEM_VERSION = '2.3.9'
- Change your ...
asciidisco/Backbone.Mutators · GitHub
Backbone plugin to override getters and setters with logic.
git: How to always pull with rebase
In order to have more human readable git branches, do
git pull --rebase
To always pull like this, write these lines to your ~/.gitconfig:
[pull]
rebase = true
..or use this oneliner
git config --global pull.rebase true
Note that this will break if you pull from other upstream branches like
git pull origin other-branch
If you keep rebasing by default, you can get "merge pulls" like this:
git pull --no-rebase origin other-branch
marcandre/backports · GitHub
Essential backports that enable many of the nice features of Ruby 1.8.7 up to 2.0.0 for earlier versions.
Duplicate a git repository with all branches and tags
In order to clone a git repository including all branches and tags you need to use two parameters when cloning the old and pushing to the new repository respectively:
git clone --bare http://example.com/old-repo.git
cd old-repo
git push --mirror http://example.com/new-repo.git
Of course, the URLs to your repository might look different depending on the protocol used, username required, etc.
For a user git
using the git protocol, it could be git@example.com:repository-namespace/repository.git
Use a global .gitignore file to ignore stuff from your machine
Sometimes you want git to ignore certain files that appear on your machine. You can do this in 3 ways:
- Per project, in the project's
.gitignore
file - Per project, in a local exclude file
- Globally on your machine
Downsides of per-project .gitignore
entries
While it might be tempting to set it per project (other devs might benefit from it), you
- need to do it each time for every project
- "pollute" a project's
.gitignore
file with stuff...