Movies.mdf not in App_data Folder – MVC4 Tutorial

Hey everyone,

I’ve decided to take a look MVC4 (C#) and have just started the Movies tutorial. Unfortunately I ran into a bit of trouble with the database setup, for some reason mine wasn’t appearing in the app_data folder.

Apparently there are a few things you can try here:

Click Show All Files
This one is pretty simple, just click Show All Files
– Project > Show All Files

Refresh
Hit the refresh button
– Project > Refresh

Ensure that you’ve created a movie
You’ll need to make sure you’ve created a movie first. Apparently the database is not created until after a new row is inserted.

Final Solution, also the one that worked for me
The database wasn’t actually created under app_data, instead it was placed under: C:Program FilesMicrosoft SQL ServerMSSQL10_50.SQLEXPRESSMSSQLDATA

This StackOverflow post explains why: asp-net-retrieving-data-from-nowhere

Cannot set property ‘show’ of undefined at new DeathrayMenuController – AngularJS

Hey everyone,

I’ve just started working my way through AngularJS by Brad Green & Shyam Seshadri. Unfortunately I ran into a bit of an issue on page 23 (line 19):

TypeError: Cannot set property 'show' of undefined
    at new DeathrayMenuController (http://127.0.0.1/:18:27)
    at d (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:28:174)
    at Object.instantiate (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:28:304)
    at $get (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:52:239)
    at $get.g (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:43:348)
    at m (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:6:494)
    at i (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:43:213)
    at e (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:39:307)
    at e (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:39:324)
    at e (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:39:324) 

The solution to this problem turned out to be pretty straight forward, just set the menu state in a similar fashion to that used in the previous exercises:


	
		Your Shopping Cart
	
	
		
		
Toggle Menu
  • Stun
  • Disintergrate
  • Erase
//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js function DeathrayMenuController($scope){ /*$scope.menuState.show = false; //Switch this line with the one below $scope.menuState = {show: false}; $scope.toggleMenu = function(){ $scope.menuState.show = !$scope.menuState.show; } $scope.erase = function(){ window.alert('erased'); } $scope.disintergrate = function(){ window.alert('Disintergrated'); } $scope.stun = function(){ window.alert('Stunned'); } } <!--http://controllers.js-->

Missing Partial (JSON Response) – Ruby on Rails

Hey everyone,

I’ve just added pagination (Kaminari) to make an infinite scroll list a little easier to use. Unfortunately, I ran into the following error – had me stumped for a while:

Missing partial /contents/content_list_item with {:locale=>[:en], :formats=>[:json], :handlers=>[:erb, :builder, :coffee]}. Searched in:  * "/home/chris/funny/app/views"  * "/home/chris/.rvm/gems/ruby-1.9.3-p327/gems/kaminari-0.14.1/app/views"

The solution was fairly simple, but adding a few things at once had me looking at it the wrong way. Because I was using the same nested partials for an HTML response as my JSON one, the file extensions weren’t what rails was expecting. To get around this, all I needed to do was fully qualify the partial filenames. For instance:

#The original
 '/contents/content_list_item', :locals => { :@content_item =>  content} %>

#Became this
 '/contents/content_list_item.html.erb', :locals => { :@content_item => content} %>

ORA-28000: the account is locked – PeopleSoft

Hey everyone,

Just a small PeopleSoft issue I ran into while running an SQR:

(SQR 5528) ORACLE OCISessionBegin(RDBMS) error 28000 in cursor 0:
   ORA-28000: the account is locked
(SQR 4701) Cannot logon to the database.

SQR for PeopleSoft: Program Aborting.

For some reason the sysadm account had been locked, thankfully there’s a fairly easy fix:

ALTER USER sysadm ACCOUNT UNLOCK;

If you don’t have access you may need to get a DBA to run it.

Amazon S3 Images Expiring – CarrierWave (Ruby on Rails)

Hey everyone,

After working with CarrierWave for a couple of days a few of my images started disappearing. It took a while to work out what was causing it, but thankfully the fix is pretty easy:


#Set fog_public in your initialiser to true
config.fog_public = false

#Should be
config.fog_public = true

Alternatively, if you’d like them to keep expiring but want to adjust their availability you can use the following config option:

#Number of seconds
config.fog_authenticated_url_expiration = 60000 

There’s a bit of info in the following StackOverflow post: http://stackoverflow.com/a/13757841/522859

Excon::Errors::SocketError Broken pipe (Errno::EPIPE) – Ruby on Rails

Hey everyone,

I was having a bit of trouble with CarrierWave on Amazon S3 today. When attempting to upload files that were larger than ~150kb I received one of the following errors (depending on config):

getaddrinfo: Name or service not known carrierwave
Excon::Errors::SocketError in PhotosController#create
Broken pipe (Errno::EPIPE)

 

Despite the vague error, the solution was fairly simple. The region configured in my initialiser was different to the one my bucket was created in.

In order to find out which region you need, logon to your AWS console and browse to an uploaded image. Check the endpoint URL (properties > static website hosting) and simply copy the region. For examples:

Endpoint: testbucket123321.s3-website-us-west-2.amazonaws.com
Region: us-west-2

A couple of final tips if this doesn’t work for you:

  • You need the region codes, not the name. For instance, “Oregon” won’t work
  • Don’t forget to restart your app after making changes to the initialiser
  •  

    Assets:Precompile (Rake Aborted) – Heroku

    Hey everyone,

    I ran into the following error over the weekend while trying to push to heroku:

    Running: rake assets:precompile
    rake aborted!
    could not connect to server: Connection refused
    Is the server running on host “127.0.0.1” and accepting
    TCP/IP connections on port 5432?

    This stackoverflow post helped to solve the issue. All you need to do is add the following line to your application.rb file:

    #Applicication.rb
    config.assets.initialize_on_precompile = false
    

    Let me know if you have any problems.

    Installing SQL Developer on Ubuntu – make-sqldeveloper-package chmod: missing operand after `755′

    Hey everyone,

    I was following a guide while trying to install SQL Developer on Ubuntu, however I ran into the following error:

    make-sqldeveloper-package chmod: missing operand after `755′

     

    To fix it, simply change line number #381 in ‘/usr/bin /make-sqldeveloper-package’ as follows:

    Original

    ${FIND} "${OPTDIR}" ! ( -type d -o -name "*.jar" ) |${XARGS} ${XARGS_OPTS} ${FILE} ${FILE_OPTS} |${GREP} ${GREP_OPTS} "shell script text executable" |${CUT} ${CUT_OPTS_FUNC_CLEAN} |${XARGS} ${XARGS_OPTS} ${CHMOD} ${CHMOD_OPTS}
    

    Modified

    ${FIND} "${OPTDIR}" ! ( -type d -o -name "*.jar" ) |${XARGS} ${XARGS_OPTS} ${FILE} ${FILE_OPTS} |${GREP} ${GREP_OPTS} "shell script" | ${GREP} ${GREP_OPTS} "text executable" |${CUT} ${CUT_OPTS_FUNC_CLEAN} |${XARGS} ${XARGS_OPTS} ${CHMOD} ${CHMOD_OPTS}
    

    Thanks to this blog post for the solution, just note that it is Polish.

    Let me know if you have any issues!

    WARN Could not determine content-length of response body – Ruby on Rails

    Hey everyone

    I was going through my development logs today and noticed that the following line was appearing everywhere:

    WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
    

    While nothing appeared to be wrong, it made the logs a lot harder to read. A stackoverflow post indicates that this is a webrick issue that can be avoided by switching to thin. This is also the recommended option for heroku. In order to use thin, you simply need to add it to your Gemfile:

    #Gemfile
    
    #Added gems
    gem 'therubyracer' #JavaScript
    gem 'thin' #Instead of webrick
    

    Run bundle install

    chris@chris-VirtualBox:~/calendar$ bundle install
    Fetching gem metadata from https://rubygems.org/...........
    Fetching gem metadata from https://rubygems.org/..
    Using rake (10.0.2) 
    Using i18n (0.6.1) 
    Using multi_json (1.4.0) 
    Using activesupport (3.2.9) 
    Using builder (3.0.4) 
    Using activemodel (3.2.9) 
    Using erubis (2.7.0) 
    Using journey (1.0.4) 
    Using rack (1.4.1) 
    Using rack-cache (1.2) 
    Using rack-test (0.6.2) 
    Using hike (1.2.1) 
    Using tilt (1.3.3) 
    Using sprockets (2.2.2) 
    Using actionpack (3.2.9) 
    Using mime-types (1.19) 
    Using polyglot (0.3.3) 
    Using treetop (1.4.12) 
    Using mail (2.4.4) 
    Using actionmailer (3.2.9) 
    Using arel (3.0.2) 
    Using tzinfo (0.3.35) 
    Using activerecord (3.2.9) 
    Using activeresource (3.2.9) 
    Using bcrypt-ruby (3.0.1) 
    Using bundler (1.2.3) 
    Using coffee-script-source (1.4.0) 
    Using execjs (1.4.0) 
    Using coffee-script (2.2.0) 
    Using rack-ssl (1.3.2) 
    Using json (1.7.5) 
    Using rdoc (3.12) 
    Using thor (0.16.0) 
    Using railties (3.2.9) 
    Using coffee-rails (3.2.2) 
    Installing daemons (1.1.9) 
    Installing eventmachine (1.0.0) with native extensions 
    Using jquery-rails (2.1.4) 
    Using libv8 (3.3.10.4) 
    Using pg (0.14.1) 
    Using rails (3.2.9) 
    Using sass (3.2.3) 
    Using sass-rails (3.2.5) 
    Using therubyracer (0.10.2) 
    Installing thin (1.5.0) with native extensions 
    Using uglifier (1.3.0) 
    Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
    

    And finally start thin:

    chris@chris-VirtualBox:~/calendar$ rails s thin
    => Booting Thin
    => Rails 3.2.9 application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    >> Thin web server (v1.5.0 codename Knife)
    >> Maximum connections set to 1024
    >> Listening on 0.0.0.0:3000, CTRL+C to stop
    

    If you’d prefer to keep using Webrick, the following patch is said to resolve the issue:
    https://bugs.ruby-lang.org/attachments/2300/204_304_keep_alive.patch

    Events Only Showing in Month View – FullCalendar

    Hey everyone,

    Ran into a bit of a problem with FullCalendar today after setting up a JSON feed. My events were only appearing in the month view. This StackOverflow post explains that this is due to the fact that the allDay property wasn’t set.

    Original JSON

    [
        "0",
        {
            "title": "Test event",
            "id": "821",
            "start": "2012-11-23 14:00:00",
            "end": "2012-11-23 15:00:00"        
        },
        "1",
        {
            "title": "Test event 2",
            "id": "822",        
            "start": "2012-11-23 9:00:00",
            "end": "2012-11-23 10:00:00"
        },
        "2",
        {
            "title": "Test event 3",
            "id": "823",        
            "start": "2012-11-24 8:00:00",
            "end": "2012-11-24 6:00:00"
        },
        "3",
        {
            "title": "Test event 4",
            "id": "824",        
            "start": "2012-11-27 6:00:00",
            "end": "2012-11-27 7:00:00"
        }
    ]
    

    Working JSON

    [
        "0",
        {
            "allDay": "",
            "title": "Test event",
            "id": "821",
            "start": "2012-11-23 14:00:00",
            "end": "2012-11-23 15:00:00"        
        },
        "1",
        {
            "allDay": "",
            "title": "Test event 2",
            "id": "822",        
            "start": "2012-11-23 9:00:00",
            "end": "2012-11-23 10:00:00"
        },
        "2",
        {
            "allDay": "",
            "title": "Test event 3",
            "id": "823",        
            "start": "2012-11-24 8:00:00",
            "end": "2012-11-24 6:00:00"
        },
        "3",
        {
            "allDay": "",
            "title": "Test event 4",
            "id": "824",        
            "start": "2012-11-27 6:00:00",
            "end": "2012-11-27 7:00:00"
        }
    ]