Cannot find module XXXX

Today, I was working on a small node project. I did an npm init . followed by adding a few dependencies to my package.json

I then proceeded to run npm install and edited a simple coffee script file.

When I went to run it, I was confronted with a “Error: Cannot find module ‘merge-descriptors’” error. Quite a stubborn error at that since no matter what I did at first to my tiny script seem to change the output.

A simple npm update forced a re-check of all deps on it and solved it. I suppose went wrong with my first npm install which I didn’t see since re-doing the exact same thing with the same package.json in a different directory worked perfectly.

Oh well…๐Ÿ™‚

Posted in Development, Node, Software | Tagged , , | Leave a comment

Fiddler and failure to intercept HTTPS traffic

If for some reason (for us, it was an easy transfer between domains) you get a message from makecert that it failed to acquire a security provider form the issuer’s certificate, do the following:

  1. Open mmc
  2. Add a Certificates snap-in for the local user
  3. Drill into Personal >> Certificates
  4. Remove all certificates with the DO_NOT_TRUST_FiddlerRoot ‘Issued By’
  5. Restart fiddler
Posted in Security, Web | Tagged , , | Leave a comment

How to lock your Mac and not lose WiFi connectivity

Lock your Mac, seriously

When you leave your Mac alone, you need to lock it!!! The basics of security right? Apparently not…

How to lock your Mac using only your keyboard? It is really simple! This is all over the Internet but nobody using a Mac seems to know this, I have seen lots of fugly posts like “install that shareware app”, “oh use this script that needs root, I use it and it does the job, so simple!”, or “ask your sexy neighbor to come and guard your computer for you”, etc… crazy right? So here goes:

To lock the session of your Mac, it is simple, press:

CONTROL + SHIFT + POWER

or on some Macs where the Power button is replaced with the Eject button, I will give it to you in clear:

CONTROL + SHIFT + EJECT

Easy enough right? Yes Win+L is faster but this is MacOSX… everything is supposed to be so much more user friendly… so you’re just wrong ^^

Stop losing WiFi when locking your Mac

If you now complain that the Wifi is disconnected when you do lock your Mac:

  1. If you want, complain to Apple, not to me, for doing something securely for once (people are good at that aren’t they? ^^)
  2. Do something about it!!! Like below:
    1. Find your Wifi network card name, it should be en0 or en1 ( try in Terminal: ifconfig|grep ^en )
    2. In a Terminal: sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en0 prefs DisconnectOnLogout=NO
    3. Type your password when requested Et Voila!

This change is one shot and persistent! You only need to run it once and you’re done!

Now, go and enjoy a great locked Mac experience…๐Ÿ™‚

Posted in Burger Thoughts, Mac, Security | 3 Comments

Find out GCC optimizations of -march -mtune etc

If you want to check what optimizations your current gcc settings give you, you need to use:

echo | gcc -dM -E - -march=native

You can then grep the output to check stuff like MMX, SSE or 3dNOW.

To test a specific setting, like “-march=x86-64 -msse3” :

echo | gcc -dM -E - -march=x86-64 -msse3

To see what gcc recommends for your platform:

echo | gcc -dM -E - -march=native
Posted in Burger Thoughts, C, Cpp, Software | Tagged , , , , , , | Leave a comment

Rails 3.0.9 and Mongo_Mapper error when using a generator

I was trying out the mongo_mapper gem with a small app that I had. I didn’t want to re-create a new app with the option to skip active-record (too easy apparently….) so instead, I converted the app to use mongo from sqlite.

After changing the application.rb to not include the whole rails/all and added the mongo_mapper gem to my Gemfile, I tried generating a new controller with the generator:

locksfree@vm0001:~/dev/rails/testapp$ rails generate controller Users new
/var/lib/gems/1.8/gems/activemodel-3.0.9/lib/active_model/translation.rb:24: uninitialized constant ActiveModel::Naming (NameError)
	from /var/lib/gems/1.8/gems/mongo_mapper-0.9.1/lib/mongo_mapper/translation.rb:4
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:70:in `const_get'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:70:in `local_constants'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:70:in `each'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:70:in `local_constants'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:68:in `each'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:68:in `local_constants'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:86:in `local_constant_names'
	from /var/lib/gems/1.8/gems/activemodel-3.0.9/lib/active_model/naming.rb:1
	from /var/lib/gems/1.8/gems/mongo_mapper-0.9.1/lib/mongo_mapper/plugins/active_model.rb:7
	from /var/lib/gems/1.8/gems/mongo_mapper-0.9.1/lib/mongo_mapper/embedded_document.rb:8
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:70:in `const_get'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:70:in `local_constants'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:70:in `each'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:70:in `local_constants'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:68:in `each'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:68:in `local_constants'
	from /var/lib/gems/1.8/gems/activesupport-3.0.9/lib/active_support/core_ext/module/introspection.rb:86:in `local_constant_names'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/engine.rb:201
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/engine.rb:200:in `each'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/engine.rb:200
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `instance_exec'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `run'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:50:in `run_initializers'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `each'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `run_initializers'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:134:in `initialize!'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:77:in `send'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
	from /home/administrator/dev/rails/tforce/config/environment.rb:5
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:103:in `require_environment!'
	from /var/lib/gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:16
	from script/rails:6:in `require'
	from script/rails:6

Obviously, something didn’t go as planned. I checked and could not see anything directly wrong. The translation.rbย file just used ActiveModel which should have been redefined by mongo mapper…. unless something else was redefining it before hand…

I checked the gem dependencies and only rails-3.0.9 seemed to pull in active-record, but that should not have been a problem. So, I went other the application.rb and Gemfile once more and I noticed that I hadn’t commented out the sqlite3 gem. It turned out that was just that, a nice little waste of time just there๐Ÿ™‚

locksfree@vm0001:~/dev/rails/testapp$ rails generate controller Users new
      create  app/controllers/users_controller.rb
       route  get "users/new"
      invoke  erb
      create    app/views/users
      create    app/views/users/new.html.erb
      invoke  rspec
      create    spec/controllers/users_controller_spec.rb
      create    spec/views/users
      create    spec/views/users/new.html.erb_spec.rb
      invoke  helper
      create    app/helpers/users_helper.rb
      invoke    rspec
      create      spec/helpers/users_helper_spec.rb

Now, to some mongo fun!

Posted in Ruby on Rails, Web | Tagged , , , , , , , , , , , | Leave a comment

Error whith rspec on Ubuntu 11.04

This is mostly a personal note to remember next time I run into this.

After setting up my rails environment on Ubuntu 11.04 last night, I had the bad surprise of having an error every time I tried to run rspec tests. It was failing within a ruby gem with a const missing error on the ActionController.

To sort this out, I had to make sure I was referencing the latest rspec and webrat in my Gemfile and also upgrade to ruby 1.9.1 (1.8 is the default version on Ubuntu 11.04) with the following commands:

sudo apt-get install ruby1.9.1 libruby1.9.1
sudo apt-get autoremove

Finally, I just had to run a bundle install in the rails app directory to get things sorted. Next time I ran

bundle exec rspec spec/

it gave me no error and I could nicely restart my autotest๐Ÿ™‚

Posted in Development, Linux, Ruby on Rails, Software, Uncategorized | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Fix Plymouth configuration on Ubuntu 11.04, after upgrade from 10.10

If you don’t get the splash screen you usually have on Ubuntu after an upgrade to 11.04 Natty, then you need to follow the steps below, that should work for most cases and should not harm:

  1. Launch your Terminal: sudo apt-get install watershed startupmanager
  2. Launch the Startup Manager from your favorite Menu (System/Administration/Startup-Manager)
  3. Configure the resolution wanted and other parameters, it is very straightforward. I would tick the “Show startup splash” and “Show text” if I were you๐Ÿ™‚
  4. Click on Close, this will apply the changes.
  5. Just in case, run: sudo update-initramfs -u
    This will update (put new drivers, configuration files, etc) your InitRamFS image, used on boot. This is where all the magic happens on boot, for everything that happens before your system is fully booted.

That should do it!

If not, then try your luck again on Google/Bing๐Ÿ˜‰

Posted in bugs, Linux, Software | Tagged , , , , , , , , , , , | 3 Comments