After you migrate your files to a new mac all the postgres data will be present but the postgres user won't exist. The postgres server won't start in this case. To create the user you need to figure out the postgres userid. You can run ls -l /usr/local/psql (substitute your postgres installation directory). The data subfolder needs to belong to the postgres user and you will see just a numeric userid. You will also see the postgres groupid. The example below assumes that both IDs are 103, make sure to substitute the IDs for your setup.
To create the user and group do the following as root:
dscl . -create /Users/postgres UserID 103
dscl . -create /Groups/postgres PrimaryGroupID 103
dscl / -append /Groups/postgres GroupMembership postgres
Wednesday, July 1, 2009
Postgres after mac migration
Posted by
decodeideas
at
8:39 PM
0
comments
Friday, June 12, 2009
The packet8 scam
I was seldom using my packet8 account and I had a low usage account paying $14/month. They sent an email that they will automatically upgrade my account to double that price since they do not offer low usage anymore. This doesn't make sense for me since I really never use my account. I started canceling my account which you cannot do over their automated system. You have to call them and they transfer you to a voicemail. They call you back after 1 day and if you are unlucky to miss the call you have to call back, identify yourself, get transferred, identify yourself again and then listen to somebody doing their best effort to keep your account.
This is all pretty standard albeit a bit shadu. What is not standard is that in the time it took to do all this the new month started. My account got canceled on the 2nd of the month but I was charged $30 on the 3rd of the month. I called somebody there and I was informed that I am liable for that month even though it is not my fault their lengthy process let me to this situation.
Are you a happy packet8 customer or an unhappy former packet 8 customer? Leave a comment.
Marius
Posted by
decodeideas
at
3:38 PM
1 comments
Tuesday, June 2, 2009
Ruby on Rails.tmbundle for ruby1.9
I forked Dr. Nic's TextMate bundle for Ruby On Rails and I started fixing issues related to ruby1.9
http://github.com/decodeideas/ruby-on-rails-tmbundle/tree/master
Let me know of any issue.
Monday, June 1, 2009
Benefits of local .gitignore
When you avoid tracking files in a git repository you can out the file names (or a regex matching them) in .gitignore files. Some weeks ago I realized you can sprinkle .gitignore file through out your directory structure. Generally it makes sense to keep information modularized so I started using .gitignore files in my subfolders.
Today I found out the benefits of local .gitignore files. I started a new project with a git repository encompassing multiple modules: rails app, backend processing, deployment scripts. Later on I could not figure out how to use Capistrano to deploy a rails out from a folder and I split the big repository in smaller repositories, one per project.
Since the subfolders have their own .gitignore files they were automatically picked up by each git subproject. Nice :)
Posted by
decodeideas
at
7:50 AM
0
comments
Sunday, May 31, 2009
Upgrading libxml on OS X from sources: DON'T!
I upgraded the libxml/libxslt libraries on my MBP. After ./configure && make && sudo make install the new libraries ended up in /usr/local which is fine. I renamed the existing libraries from /usr/lib and that was the end of it. I had to reboot from an external firewire backup to restore the files and get my system back.
The series of unfortunate events that leads to a broken OS are:
- the libxml build process generates only i386 files
- it is not obvious how to generate universal binary, or at least x86_64 with the libtool used in the libxml source
- the sudo exe depends on a library that in turn depends on the x86_64 libxml
- without libxml from the distribution there is no more sudo so you cannot rename the shared libraries back
Posted by
decodeideas
at
3:06 PM
0
comments
Saturday, May 30, 2009
Rake1.9 gotcha
Note that if you installed ruby 1.9 in parallel with ruby 1.8 then you got a rake1.9 that you should use with the upgraded projects. Unfortunately rake1.9 does not call gem1.9, it falls back to gem when you run commands like rake1.9 gems:install RAILS_ENV=test. If you want to install gems for the 1.9 environment you need to use gem1.9 explicitly, for example
sudo gem1.9 install thoughtbot-factory_girl
Posted by
decodeideas
at
9:29 PM
0
comments
Labels: ruby
Mysql ruby1.9 extensions on OS X / Ubuntu 9.0.4
If you get the errors below when installing the mysql gem for ruby 1.9 then just go to the link below and follow the instructions to compile the ruby extension manually. Remember to use ruby1.9 if you installed it in parallel with 1.8.6
http://www.tmtm.org/en/mysql/ruby/
The instructions worked for me both on OS X 10.5.6 and Ubuntu 9.0.4. Here are the errors I was getting with gem install mysql.
mysql.c:6:21: error: version.h: No such file or directory
mysql.c: In function ‘make_field_obj’:
mysql.c:185: warning: unused variable ‘hash’
mysql.c: In function ‘escape_string’:
Git on ubuntu 9.04 server
If you try to install git on ubuntu 9.04 server, without Tcl/TK, you will get an error similar to the following:
GITGUI_VERSION = 0.12.0.23.ga91be
* new locations or Tcl/Tk interpreter
GEN git-gui
INDEX lib/
* tclsh failed; using unoptimized loading
MSGFMT po/de.msg make[1]: *** [po/de.msg] Error 127
One fix is to not build the GITGUI extensions. A complete list of commands follows, replace 1.6.3.1 with the current stable version of git.
http://kernel.org/pub/software/scm/git/git-1.6.3.1.tar.bz2
tar xjf git-1.6.3.1.tar.bz2
cd git-1.6.3.1
./configure --without-tcltk
make
sudo make install
Posted by
decodeideas
at
8:27 AM
0
comments
Wednesday, May 20, 2009
Python __new__ not called
I was trying to build a quick and dirty singleton in python 2.5. I defined a __new__ method for my class and returned the one and only instance in there of the desired subject. To my surprise __new__ was not called, at all. After some more digging it turns out that your class needs to inherit from object. See the example below.
class NoNew:
def __new__(cls):
print "New Called for NoNew"
class YesNew(object):
def __new__(cls):
print "New Called for YesNew"
NoNew()
YesNew()Executing the above generates
$ python test.py
New Called for YesNew
As you can see there is no line with NoNew and you need to inherit from object to be able to override __new__.
Another interesting fact is that printing an object will output something that looks like a physical address and that can be used to ensure that your objects are a singleton. Writing unit test cases for this is harder and I decide it is not worth the time.
Posted by
decodeideas
at
10:10 AM
0
comments
Labels: python
Monday, May 11, 2009
CocoaHeads Sacramento/Roseville/Davis
I am trying to start a CocoaHeads group in the CA Central Valley around Sacramento. Inaugural meeting this Thursday May 14th at 6:30pm. We are meeting at Common Grounds in Davis, CA. See you there if interested :)
Posted by
decodeideas
at
6:43 AM
0
comments