Follow Along as I Stumble on the Path to Learning RoR

Posts tagged “windows

Creating a CSR on Windows

In order to create a SSL Certificate, you need to generate a CSR, or Certificate Signing Request.  I ran into some issues when generating one from Windows, so I wanted to document the steps that I took.

  1. went to http://slproweb.com/products/Win32OpenSSL.html to download Win32 OpenSSL v1.0.0k
  2. installed OpenSSL
  3. I received an error regarding C++ during the install, so I installed Visual C++ 2008 Redistributables from the same page I downloaded OpenSSL
  4. Run a command prompt (cmd.exe from the search box in the Windows start menu)
  5. When I tried to run an OpenSSL command, I received an error that a file could not be found (WARNING: CAN’T OPEN CONFIG FILE: /USR/LOCAL/SSL/OPENSSL.CNF)
  6. As noted here, you have to set the environmental variable by typing this into the cmd: set OPENSSL_CONF=c:\[PATH TO YOUR OPENSSL DIRECTORY]\bin\openssl.cfg
  7. navigate to the bin directory
  8. enter your openssl command to generate your csr.  For me, it was:
    openssl req -nodes -newkey rsa:2048 -keyout myserver.key -out myserver.csr
  9. this created key and csr files I could use for creating my SSL certificate
Advertisements

Running Memcached on Windows

I needed to run memcached locally on my Windows PC.  These are the steps to making it work on Windows.

(1) Download the Memcached program (32 bit)

(2) Extract the exe to C:\memcached

(3) Open your start menu

(4) In the Search box at the bottom, enter “cmd” – don’t hit enter!

(5) Instead of enter, press Ctrl+Shift + Enter.  This should allow you to run the command prompt as the administrator, as long as your Windows user ID is set-up as an admin

(6) use the `cd` command to navigate to get to: C:\memcached

(7) once there, enter: memcached.exe -d install

(8) next enter: memcached.exe -d start

You should now be running a memcached server.  To check, open the Windows Task manager and on the Services tab, you should see “memcached”.


Editing Hosts File as Administrator on Windows

I was having an issue editing the hosts file on Windows.  I was receiving an error saying that only the Administrator could edit the file since the etc directory was protected.  My user has Administrator access so I couldn’t understand what was going on.  I tried to change the settings on the etc directory and could not do that either.

So I ended up opening Wordpad (which I use to edit the hosts file), by right-clicking and selecting Run as Administrator.  Once I did that and opened my hosts file in Wordpad, I was able to save the file.


Creating a Manifest.json file for the Google Chrome Store in Windows

I ran into an issue with my manifest.json file when trying to submit my app to the Google Chrome Store.  I followed the directions, but apparently there was a detail that was so simple, it wasn’t documented.  The documentation says to create a text file to put the manifest code, and then to save it as manifest.json.  However, when I loaded my zip file, I kept receiving error messages saying that the manifest.json was not at the root level and couldn’t be found.  The only thing was the file was of course there, and there were no subdirectories in my zip file.

It turned out to be a stupid, basic mistake.

When I looked at the properties of the file, the file was a .txt file, and the full name was actually manifest.json.text even though I couldn’t see the .txt part in Windows Explorer.  I found the solution was that when the file was created, I should have named it manifest.json, but also when I saved it in Notepad, I should have selected “Save as type” as “All Files”.  When you look at the properties, the file type will now be “json” instead of “txt”.


Error: C:/Dev/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: 193: %1 is not a valid Win32 application

I was receiving this error which was preventing me fom running my Rails server or any other commands locally:

C:/Dev/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: 193: %1 is not a valid Win32 application.   – C:/Dev/Ruby193/lib/ruby/1.9.1/i386-mingw32/digest/sha1.so (LoadError)

It started after I implemented a web hook, which conflicted with a local application.  I found out by after finding this post:

https://github.com/oneclick/rubyinstaller/issues/102

In the case of the poster, an app called FRAPS was causing the issue.  I don’t have that program, but after closing a bunch of apps from Windows’ Task Manager, it was working again.


Getting Thin Gem to Work on Heroku When you Develop in Windows

Upgrading to Heroku’s Cedar stack, I had to install the Thin gem to prevent my app from running on Web Brick.  On the Bamboo stack this is injected so I need not worry, but with Cedar you need to install all the gems you need.

The problem is that I work on Windows in development and that one of the dependencies for the Thin gem is the Eventmachine gem.  However, Eventmachine isn’t really geared towards Windows environments (except gem install eventmachine –pre), so everytime went to run bundle install the install would fail because the dependency, eventmachine 0.12.10 could not install.

However, Heroku helped me find a solution.

Add this to the gemfile

group :production do
gem ‘thin’
end

and instead of ‘bundle install’, run ‘bundle install –without production’


RSpecs

It has not been a picnic using RSpecs.  One of the steeper learning curves I’ve found in Rails.  Here are some random tidbits I’ve found:

(1)  the rspec command doesn’t get recognized in Windows for me.  So I have to do: rake spec:controllers (or whichever folder)

(2) to run a single test, from the root directory, do:

bundle exec rspec spec/(path to file).rb

ie

bundle exec rspec spec/controllers/user_controller_spec.rb