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 | 7 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

BurgerThought: Softshoring the new offshoring!

Offshoring is often overused nowadays by managers that tend to only understand that based on head count, it costs less, and that is of course true.ย The problem with simple offshoring is efficiency and failure to deliver, hopefully you can use the brand new Softshoring concept to replace most of your offshore work!!!

Training

To ensure your offshore team delivers at the required quality you spend time, effort and money training people that are not even directly part of your company. This is time you could have spent training some new cool kid next to you, that would buy you a drink, tell jokes and feel involved. Most of the time, you will have to invest in people that do not really care and that will move on at the next opportunity without looking back. It’s not a good investment of your company’s knowledge, it’s just dispersing knowledge and training people for free.

Delivery

In India and China, delivery at the expected target is a challenge that can only be achieved with close management of the teams to ensure progress. In a project environment, that can work with tight management, but for BAU tasks, you necessarily have a project manager to handle these people. This has a cost as someone on site will need to take on his time to follow progress of the offshore team, identify problems to the best of his ability and provide remote answers to, more often than not, simple but delivery blocking questions/issues. This will cost even more if your offshore team is not top notch, as you will need a very good project manager with international and remote project management experience, and that can’t be cheap when all you want are some chaps to produce damn reports and just follow very precise and detailed procedure.

Activity

Because it is supposed to be cheap, it is a good reason to throw any labour intensive, some would say “stupid”, work to offshore teams. This is actually quite interesting as it shows so much of a common trend in today’s managers. It’s cheap, and at laaast you get the much fought for increased head count! But the work sent offshore is often forgotten there, it is never optimized and offshore teams do not seem to be very interested in simplifying their own life. In their place… doing shitty work… would you do any better?

Most of your offshore team members just want you to be happy by doing EXACTLY the job you ask them to do, no more (and sometimes even a little less if they can go away with it, but hey we can’t blame them ^^). But that is not a good mindset for process optimization and continuous improvement, so there is a problem with efficiency as your remote teams will not have the nerve to tell you how to make the process better, often because that would involve somehow that they can do better than what you propose and in their eyes, that could have a negative impact on their relationship with you… Well, being located several thousand miles away does not help, but I have found that it’s also a cultural difference in the way they handle relationship. That is a very common asian view of relationships. At the end of the day, all of this does not help process self improvement, costs a lot of useless money on the long run and costs also turnover, as the staff gets bored from the uninteresting tasks proposed and the lack of flexibility to change anything (even if it is a barrier only in their head).

Economic

Offshoring is sending out knowledge and funds to another country, it is not good business for your local country’s economy, as it does crush local jobs, the funds sent away do not get back much either directly (buy your products) and indirectly (local taxes, VAT, consumption in the same country, etc). I may be wrong but offshoring is interesting only for the offshore economy, the added competitiveness of your local company may not stand strong in the long run as turnover, knowledge control and cultural gap raise new issues that cost money and pile up, in the end I am not quite sure the added competitiveness is that clear.

Solution? Softshoring!

My workmate and I have found that most of the work that people want to offshore can often be done more efficiently and with much less errors by a good script or software: that is the definition of Softshoring! ๐Ÿ™‚ Indeed most of the tasks offshored can be automated to such an extent that the actual people needed to do the work are 1 guy that knows its stuff, instead of a pile of AngryBirds applying a procedure they despise and have little interest in improving.

This strongly relates to automation in the workplace of course, but managers today only look at the cost and don’t know how to measure efficiency and have no interest in identifying improvements, so much that people are sometimes discouraged to propose improvement although they know what should be done.

Softshoring requires a good IT developer that understands the processes and has a brain for him.

With softshoring, rediscover what IT was originally made for: doing the crappy job itself and let human beings drink their beer and use their brains!

Posted in Burger Thoughts | Tagged , , , , , , , , , | Leave a comment

MPlayer 5.1 AC3 DTS in Ubuntu 10.04

I wanted to play some mkv/avi files containing 5.1 AC3/DTS sound with mplayer through an SPDIF optical out on my Ubuntu box.

With default settings, at first I was getting:

Selected audio codec: [hwac3] afm: hwac3 (AC3 through S/PDIF)
==========================================================================
[format] Sample format big-endian AC3 not yet supported
Error at audio filter chain pre-init!

I have the default configuration, so PulseAudio is running. I have just chosen “Alsa” as default audio device in smplayer (yes SMPlayer, a GREAT GUI for mplayer, Qt rocks get over it ๐Ÿ˜‰ ).

I have tried deactivating pulseaudio temporarily to call on the alsa device directly with:

pasuspender — smplayer test.avi

but it still did not work. This suspends PulseAudio, frees all audio hardware and launches the provided command…. could come in handy another day ๐Ÿ™‚

After some googling and testing, I finally figured out you need the following things for it to work:

  • Select the correct Hardware Alsa device ! (for me it was 0.1 for the SPDIF output). If you use mplayer CLI, that is: -ao alsa:device=hw=0.1
  • Disable “Enable the audio equalizer”. Activating this always gives the error.
  • Enable “AC3/DTS pass-through S/PDIF”. This one is obvious…
  • Disable “Use software volume control”. Activating this always gives the error.

You should get something like this:

 

Now you can play your favorite DVD/BR/files with full SPDIF AC3/DTS surround power, that will get decoded on your kick-ass Surround amplifier at the other end of your SPDIF cable ๐Ÿ™‚ All this on your favorite OS. Yeah!!!

Volume configuration

If you can’t hear anything, you need to mess with your PulseAudio settings first, and if not satisfactory then your Alsa settings.

For Pulse you need to select the “Digital Stereo Duplex (IEC958)” hardware profile.

For alsamixer, I have mostly:

  • “S/PDIF Default PCM” on Mute.
  • “Channel mode” at 6, although I am not sure it is needed.
  • “S/PDIF” on Unmute (lol)
  • Everything else on Mute, except for “PCM” and “Master” of course ๐Ÿ™‚
Posted in Linux | Tagged , , , , , , , , , , , , | 2 Comments

VirtualBox 3.2.8 EULA nuclear FAIL

VirtualBox is a good virtualization platform for both Windows and Linux environments.

It sometimes happens that I read the EULA (yes yes) of non-free softwares I install. To my surprise, in the VirtualBox 3.2.8 PUEL, it says:

ยง 3 Restrictions and Reservation of Rights.
[…]
(3) The Product is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility and Oracle and its licensors disclaim any express or implied warranty of fitness for such uses.
[…]

Cheers for the big O!! We knew you guys had nightmares on free software licenses (see the OpenSolaris murder) and dreams of fruitful lawsuits (Javaaa), but this one actually got me laughing for once ๐Ÿ™‚

For them to actually put such a statement before the “ยง 5 Disclaimer of Warranty”, probably means that this case probably REALLY happened. YES. Otherwise, why would they even bother?ย  The disclaimer of warranty being “AS-IS”, they should be already correctly covered from a legal perspective.

That’s a taste of what IT is like in the real world…

Hopefully, in “ยง 6 Limitation of Liability”, big O states that they will not be liable “FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES” for using VirtualBox in a nuclear facility. So don’t come after them if half of your country is gone.

Who is really responsible these days? Let met see the manager!

Posted in Burger Thoughts, Software | Tagged , , , , , , | Leave a comment