Page not rendering with IIS Express in Firefox or Chrome, waiting for localhost

There’s a lot of posts on this issue, and none of the suggested solutions worked.  In my particular case, the ASP.NET application’s page rendered fine on IE and Opera, but in Firefox and Chrome I was constantly getting “waiting for localhost”

My solution was to change the project’s web properties to use Visual Studio Development Server (screenshot below).  Right-click on the project, click “Properties”, select “Web”, and select the aforementioned radio button.  Now all the browsers can find the page.

iis1

 

 

 

 

 

 

 

Oddly, I have no problems with IIS Express on my laptop, so there’s still some investigation to do as to why it requires a different web server.

 

Ruby on Rails Portfolio After One Year

I realized today that it’s been about a year since I started working with Ruby on Rails.  I ended up putting together a portfolio of the work I’ve done with Ruby / Ruby on Rails in the last year.  Here it is!

GitHub Projects

Database Spider UI:
github: https://github.com/cliftonm/spiderui
Article: Day 1: Spider Database Navigator Website

Dynamic Server-Side Property Grid
github: https://github.com/cliftonm/property_grid_demo
Article: A PropertyGrid Implemented in Ruby on Rails

Where are my Facebook Friends:
github: https://github.com/cliftonm/WhereAreMyFriends
Article: Where In The World Are My Facebook Friends?

Basic Authentication (not using Devise):
github: https://github.com/cliftonm/basic-auth
Article: User Authentication in Ruby on Rails

Other articles on Ruby / Ruby on Rails:

Comparing Ruby and C# Performance

Function Composition, Function Chaining, Currying, and Partial Functions / Application in F# and Ruby

C# and Ruby Classes

Ruby on Rails Websites

personal projects implemented in Ruby on Rails

http://app.intertexti.com/
http://needsandgifts.herokuapp.com/
http://wherearemyfriends.herokuapp.com/

websites developed for my clients:

(these websites use significant pre-existing work from the open source community as well as other team members, so I certainly cannot take full credit for them, but I have made significant contributions to them):

http://www.neighborhoodcatalyst.org/
https://www.breastfeedingdatasystem.org
http://www.douladata.org/

Why you should never use MongoDB

An excellent real-life story of actual experience with MongoDB: http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/

I recommend that anyone considering a “document-based” database read this and thoroughly understand what Sarah is talking about…

…because the world IS relational.

This rebuttal was brought to my attention:  http://ayende.com/blog/164483/re-why-you-should-never-use-mongodb

Personally, I find this statement: “And yes, this is a somewhat relational model.” amusing.  Well, since it’s relational, doesn’t a relational database seem like the right tool?  And what does “somewhat relational” mean?  It either is or it isn’t, in my opinion.  There’s no “somewhat” here.

A PropertyGrid in Ruby on Rails

Using JQuery UI and minimal Javascript to create a dynamic server-side property grid editor control that can be initialized in a fluid programming style or with a minimal DSL.

Get the code: git clone https://github.com/cliftonm/property_grid_demo

Features:

  • Collapsable groups
  • Support fo jQuery UI controls
  • Easily extensible to support new control types
  • “Fluid” programming of grid groups and properties
  • Don’t like a “fluid” approach?  A minimal DSL is provided
  • Minimal javascript, most of which is auto-generated
  • Control is generated on the server-side

screenshotI needed a general purpose property grid editor that supported some fancy things like date/time pickers, color pickers, etc., based on record fields known only at runtime (this is ultimately a part of my next installment of the “Spider UI” article series.)  There’s a snazzy Javascript-based property grid here, but I wanted something that was minimally Javascript and more Ruby-on-Rails’ish.  I also wanted a server-side control that could interface well with record field types and that would dynamically generate the grid based on schema information like table fields.

I have put together is a set of classes to facilitate building the content of a property grid control on the server-side.  You will note that I opted for actual classes and a “fluid” programming style, but if you don’t like the way the actual implementation looks using a “fluid” technique, I have also put together a very minimal internal Domain Specific Language (DSL) that you can use instead — basically just method calls that hide (using static data) the internal management of building the property grid instance.

As in my previous articles, I will be using Sass and Slim scripting for the CSS and HTML markup.

…  The rest of this article is forthcoming!

Ruby on Rails, SQL Server, and dynamic “spider” Database Navigation

I’ve posted an article on The Code Project, which is the start of a web-based “database spider UI” — written in Ruby on Rails!  The implementation of this first cut accomplishes:

For the website:

  • Connect to SQL Server (yes, Ruby on Rails can connect to SQL Server.)
  • Use a separate database for session and other metadata store, leaving the database we’re connecting to for navigation untouched.
  • Rather than physical Models for each table, implement a dynamic Model.
  • Dynamic discovery of user tables and foreign key relationships by inspecting the database schema rather than relying on the Rails application schema (which would be otherwise generated from concrete Models backed by physical tables.)

For the user interface:

  • Selecting a table from a list
  • Viewing the data for that table
  • Selecting parent and child tables to navigate to
  • Selecting records to qualify navigation and display of parent/child records
  • Pagination
  • Breadcrumb trail of parent/child navigation

A tiny screenshot (see the article for a larger screenshot):

screenshot-small

Connecting to SQL Server Express from Ruby

Something I’ve been interested in is creating a dynamic data viewer for SQL Server in Ruby on Rails.  Here’s the steps I had to take to establishing a connection with SQL Server.  I’m using the AdventureWorks2008 database as the test database, and I should also point out that I’m running Ruby in Windows 7.

SQL Server Configuration

Some initial configuration of SQL Server Express is necessary, depending on how you configured SQL Server Express in your initial installation options.

Enable Mixed Mode Authentication

From SQL Server Management Studio, sign in with Windows Authentication and then right-click on the SQLEXPRESS top-level node, then select properties.  Click on Security    and Enable Mixed Mode Authentication:

MixedModeAuthentication

Enable Remote Connections

Click on the “Connections” page and check “Allow remote connections to this server”:

AllowRemoteConnection

Create a User Account

Create a user account under Security -> Logins.  I named my account “ruby” with the password “rubyist”.  On connecting the first with SQL Server Authentication, you will be prompted to change your password, so I changed mine to “rubyist1”.

Set the Server Roles

On the same dialog box, click on the Server Roles page and enable the desired roles.

Associate the User with the Desired Databases

On the same page, click on the Server Roles page and map the user to the desired databases.  For example:

UserMap

Enable Named Pipes and TCP/IP Protocols

Then, in the Sql Server Configuration Manager, enable the Named Pipes and TCP/IP protocols:

Protocols

Reboot or Restart the Services

After making all these changes, I found it simpler to just reboot my machine.

Test Your Connection in SQL Server Management Studio

After rebooting / restarting the services, open SQL Server Management Studio and try logging in with Sql Server Authentication:

ConnectIf all the configuration changes went well, you should see the object explorer.  If you continue to have problems, check out this excellent article on dealing with connection issues, which includes steps that I have omitted, such as configuring the firewall, as I’m testing everything locally.

Configure Ruby

Install the tiny_tds gem by opening a command line and typing in:

install gem tiny_tds

Test It!

I use RubyMine for Ruby / Rails development, so we’ll run a few things from the Interactive Ruby Console directly in the RubyMine IDE:

RubyPay particular attention to the client connection and the dataserver value.

For more information on how tiny_tds works and the options that it supports, refer to the tiny_tds GitHub page.

Obtaining Foreign Key Table-Column References in SQL Server

Borrowing from what others have put together, this query give you the details of foreign keys:

  • The referencing schema, table, and column names
  • The referenced schema, table, and column names
SELECT 
        f.parent_object_id, 
        SCHEMA_NAME(f.schema_id) SchemaName,
        OBJECT_NAME(f.parent_object_id) TableName,
        COL_NAME(fc.parent_object_id,fc.parent_column_id) ColName,
        SCHEMA_NAME(ref.schema_id) ReferencedSchemaName,
        OBJECT_NAME(f.referenced_object_id) ReferencedTableName,
        COL_NAME(fc.referenced_object_id, fc.referenced_column_id) ReferencedColumnName
        FROM sys.foreign_keys AS f
        INNER JOIN sys.foreign_key_columns AS fc ON f.OBJECT_ID = fc.constraint_object_id
        INNER JOIN sys.tables t ON t.OBJECT_ID = fc.referenced_object_id
        INNER JOIN sys.tables ref ON ref.object_id = f.referenced_object_id
        WHERE OBJECT_NAME (f.referenced_object_id) = 'Employee'

This example queries the foreign key relationships of the table “Employee” in the AdventureWorks sample database that Microsoft provides.  Here’s the results of the query:

awfk_exampleThis is an important part of the dynamic data explorer that I’m writing as an application example in my upcoming book Imperative to Function Programming for SyncFusion‘s “Succinctly” e-book series.

Microsoft, SQL Server 2012 Express, and Failure

I’m doing a bit of multitasking today, mainly fixing a bunch of Ruby on Rails features for my client while doing some setup stuff on my workstation, like installing the latest version of SQL Server Express.

So I go this download page:

http://www.microsoft.com/en-us/download/details.aspx?id=29062

First thing I notice is how poorly this page correlates the download options with the filenames.   Here’s a screenshot of the download page:

fail1And here’s the descriptions (which of course requires that you click on “Details” to even see.)

fail2Notice that there is nothing that says “this installer is this file”.  You have to figure out that “With Tools” is the “WT” version, etc.

Finally, after 40 minutes of waiting for a 600 MB download (why are things so slow on your systems, Microsoft?) I get this message:

fail3And yet:

fail4It says right there that Windows 7 is supported!!!

So Microsoft, four failures for what should be one simple task.  Nice batting average.

Path to devkit\bin got removed somehow

I went to install the latest json gem this morning and got “make is not recognized as an internal or external command, operable program or batch file.”

Poking around my path, I discovered that c:\railsinstaller\devkit\bin was no longer there!  I have no idea what removed it — the last thing I did on this machine was install the latest version of SmartGit/Hg (which is another story.)

Anyways, adding the path back in fixed the gem install issue.