Archive

Posts Tagged ‘tip’

nginx + Rails (through Passenger) on different Rubies + PHP, all this on Amazon AWS

Hi everybody!

It’s been quite a long time since my last post… I have lots to do, I’m working on a startup project and I’ve now another blog on which I have to write. I do not spend so much time developing, and almost not any more for Cocoa…

Due to my project I’ve been switching to web application technologies, and since I’m looking in the startup ecosystem, I’ve been looking at Ruby On Rails. After having played a little with Heroku, I wanted to start with a more customized hosting experience, so I’m now testing Amazon AWS service, through their free 1-year tier (allowing a sufficient cloud hosting for my purpose).

However, since I found the road quite long to reach a working config (I’m really newbie as sysadmin), I put all the things I went through on an Evernote page, and now I’m sharing them with you. It’s raw, I’ll try to refine all this with the time, but it may help nonetheless. And feel free to ask for help, I’ll do what I can 😉

Read more…

Advertisements

Snow Leopard, 64bits, Ruby and MySQL

I recently started again wanting to play a little bit with the so acclaimed Ruby on Rails framework. Being on a Mac, I had not much to do to start working, with Ruby & RoR already installed with my Snow Leopard default OS X install (maybe because I’ve already installed the XCode Developer package, as well as the iPhone’s one… maybe you should check). So I was playing with my Ruby on Rails’ guide and I had already started building a project, having it displayed in my browser, so I knew the core of the install was up and ready.

Next step was to connect with MySQL. It proved not to be so simple as expected… Running rake db:migrate to check Ruby was well connected with MySQL lead to the following errors (both errors came repeatedly during my way to the solution, given below…):

  • uninitialized constant MysqlCompat::MysqlRes
  • dyld: lazy symbol binding failed: Symbol not found: _mysql_init
    Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/
    mysql.bundle

After some research and tests following different articles on the net, I finally got with a working solution (however please notice that it applies to an Intel Mac with 64bits processor under Snow Leopard):

  • Install the latest x86_64 MySQL release (currently the mysql-5.1.53-osx10.6-x86_64). Several articles on the net will tell you the problems are due to the 64 bits version, you should install the 32 bits one, and so on. In my case, I tried both and it worked with the 64 bits one.
  • Make it work! Check the install documentation, connect with mysql, start the server… to be sure everything is working. A good thing would be to be able to connect to it with phpMyAdmin for example (which I did).
  • If you had already install the mysql gem (which you should have to need this page because you must have faced the previously mentioned issues…), uninstall it with sudo gem uninstall mysql.
  • The trick is then to reinstall it with the following command line: sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config which ensures the gem is installed for the 64bits architecture, matching the MySQL one.

Then, you should not face the previous problem any more, maybe some access denials due to misconfiguration in your RoR’s project “database.yml” file or your MySQL configuration. But the Ruby/MySQL connection should be OK!

Categories: Mac OS X Tips Tags: , , , , ,

Fix Apple aluminium ultraflat keyboard

I have had a little issue with my Apple aluminium ultraflat keyboard: I used some cleaning foam to make it shine, and there must have been more liquid than foam on my tissue… and some must have gone to the ‘L’ key…

I faced the following issue after plugging my keyboard back: the ‘L’ key was acting like it was pushed, so as soon as the keyboard was plugged it started typing llllllllllllllllllllllllllllllll… and so on. Typing another key stopped it, but then no way to make the ‘L’ key work anymore.

After having tried to blow on the unmounted key, unmount the mechanism, have some water on it, nothing made it, it was still not working. Finally, I ended up sinking the whole keyboard in water, leaving it there for approx. 2 hours, hoping the product would be gone. After 1 week drying quietly not far from the heater, it was working again as before!

Since during my first repairing trial I kind of broke some part of the mechanism, I had to exchange two keys (my broken ‘L’ with the never-used-number-pad-lock-key). To prevent this, please find a video (sorry voice and subtitles are in French) explaining how to unmount the key and the mechanism without broking it.

From Twitter to all your social web places, but filtered

Slide from Twitter to social web places.001
Uploaded with Skitch!

This shows how to update major social networking websites with your tweets, using #hashtags to prevent feeding your friends with boring work updates!

The icons can be found on the following authors’ sites:

Thanks to them!

Categories: Networking Tags: , , , , ,

Make Wireshark work on OS X

You just have to make the BPF file of libcap readable with the following command (in your terminal):
sudo chown {your account name} /dev/bpf*

Original tip source

Categories: Mac OS X Tips Tags: , , ,

Your CoreData app is crashing you don’t know why? Check your properties’ names!

In my case, I was using a property named “description”. Causes the apps to crash without displaying anything to help, so beware of your properties’ names!

AFP (Apple File sharing Protocol) issues when sharing between same user

Here was my problem: I have 2 Macs, with one user account on each of them. Both user accounts share the same username (quite easier, isn’t it?). I use Mac B to connect to Mac A with my user’s login/password, I go through my files on Mac A, which I can read, but impossible to edit or create anything! Seems I’ve no write rights! Same problem in the other way! But no problem when connecting with Mac B to another user account on Mac A!

NB: the considered user accounts have administrator rights on both Mac, and all files have read/write permissions for this user.While I don’t think it is of any importance, I performed a migration of the user account from Mac A to Mac B with the “Migration Assistant” tool provided in MacOS X. My both Macs are under Snow Leopard 10.6.3, but this seems to be a common issues between numerous versions of OS X.

Googling a little a good hour, I found the explanation, and a solution. The reason is that, while the user accounts on Mac A and Mac B share the same username, they do not share the same UID (Unique ID, a number used by the system to identify a user account – it is generally hidden to the user, replaced by the username). This is due to the fact on Mac A, I created another user account before this one, so it took the 502 UID. On Mac B however, it was the first one so it took the 501…

Don’t ask me why, but this is the reason of all these write permissions problem, so now, how shall we address this issue? The solution is quite technical, and may be risky if you do not master what you’re doing, so please be prudent, and remember I shall not be taken responsible of any consequence of your acts! If advise you to do this only if you already know what the Terminal is, and how to use it. If not, ask a friend!

To fix this issue, you will indeed need to change your user’s UID manually. This requires terminal manipulation…

  1. First, you should check you really have the described problem (UID inconsistency). For this, you can execute the following command on both Macs: dscl . -read /Users/replace-with-your-username UniqueID. It should give you an answer of this form: UniqueID: 502. If answers are not the same for both Macs, you have this problem, and this is probably the cause of your file sharing issues.
  2. You now have to change your UID on one of the Macs to match with the one on the other. Be sure not to change to a UID already used by another user account in case you have multiple users on the Mac you wish to make the change on. For this, use the following command: sudo dscl . -change /Users/replace-with-your-username UniqueID replace-with-originalUID replace-with-targetUID. This will change from originalUID to targetUID.
  3. Finally, you need to update your whole user’s folder permissions to match your new UID. Since the terminal you’re logged in do not know you anymore (you changed your UID, remember?), you should open a new one (asked a password in my case), and use the following command to update your UID for all your files: sudo chown -R replace-with-targetUID /Users/romain/.
  4. Finally give your Mac a restart, it will help him not loosing track of you!

If you did this, I hope it worked for you as it did for me! You can give a eye to the following pages which I used to identify the issue and solution, if you want to be sure before doing it:

http://discussions.apple.com/thread.jspa?messageID=7176565

http://osxdaily.com/2009/02/19/mac-os-x-change-your-user-id/

%d bloggers like this: