Posts

ruby - Rails Date.today is reflecting Date of Deployment of Server -

i have rails application displays active events (events on or after today). scope :active, where("event_date >= ?", date.today).order("event_date asc") it coming fine on local. on production server , query taking date of deployment comparison. this log select "events".* "events" "events"."school_id" = 32 , (roster_id in (45) or roster_id null) , (event_date >= '2014-09-18') order event_date asc but if check console on production, showing correctly 1.9.3-p448 :001 > date.today => fri, 19 sep 2014 server on aws ec2 any appreciated. try putting in lambda: scope :active, -> { where("event_date >= ?", date.today).order("event_date asc") } probably date.today being evaluated @ time when code loaded(i.e. deployed).

javascript - Default input number value -

i'm new angularjs , i've created simple input box want default value. here's input: <input id="fieldwidth" min="10" type="number" value="10" ng-model="set.width"> however, value doesn't show default. when try set though scope in controller $scope.set.width = "10"; it says "cannot set property 'width' of undefined" what missing? if haven't already... should set $scope.set before trying set it's child: $scope.set = {width:10}; or $scope.set = {}; $scope.set.width = 10; or can without set object if don't have other values associating it. $scope.width = 10; <input id="fieldwidth" min="10" type="number" ng-model="width">

jquery - NuGet Limit max major version of a package -

Image
is possible tell nuget want use latest version of package with particular major version , never above major version? for instance, let's take example jquery: can't use 2.x version if need support of old browsers. we're limited use latest 1.x version. we know available (and offered default in manage nuget packages dialog) version of jquery 2.1.1. rather using version, need use latest major version of jquery 1.x branch, currently, 1.11.1. i know how install 1.11.1 version. 1 simple solution manually edit packages.config file replace value of version attribute 1.11.1 : <packages> <package id="jquery" version="1.11.1" targetframework="net451" /> </packages> and build project. what don't know how tell nuget keep track of releasing new versions of 1.x branch offer me updating them same way when new 2.x version released: by default, nuget try update latest 2.x version, not latest 1.x. in other words, wh...

c - Calculating facing arc between two 3d rotational matrixes -

i working on space-ship simulator, , having trouble facing arcs between 2 space objects. each object has rotation matrix defined follows: //top row rotation[0][0] = cos(pitch)*cos(yaw); rotation[0][1] = -sin(yaw)*cos(pitch); rotation[0][2] = sin(pitch); //middle row rotation[1][0] = cos(yaw)*sin(pitch)*sin(roll) + sin(yaw)*cos(roll); rotation[1][1] = -sin(yaw)*sin(pitch)*sin(roll) + cos(yaw)*cos(roll); rotation[1][2] = -cos(pitch)*sin(roll); //bottom row rotation[2][0] = -cos(yaw)*sin(pitch)*cos(roll) + sin(yaw)*sin(roll); rotation[2][1] = sin(yaw)*sin(pitch)*cos(roll) + cos(yaw)*sin(roll); rotation[2][2] = cos(pitch)*cos(roll); as having xyz coordinates. using information, need able decide 90 degree arc facing between object1 , object1: forward, starboard, port, aft, dorsal (upper) , ventral (lower) trying use following formula: arc = acos( sum(a*b) / ( sqrt(sum(a * a)) * sqrt(sum(b * b)) ) ) where |a| vector direction of |object2| - |object1| , |b| row1 (forward arc), r...

asp.net - Performance degrades as multiple tabs are opened SignalR -

i creating chat application. due browser limitation open 5-6 concurrent tabs 1 connection, used sub domian concept open multiple tabs. but facing problem that, when multiple tabs opened, chat process slows down. it works fine when 4-5 tabs opened if more 5 tabs opened, overall process slows down , messages received receiver in different order send. when start closing tabs, signalr issue starts behaving earlier. one more issues faced related performance when open tabs 1 after other performance degrades. sends messages after minute or takes long time send message. can suggest me solution performance issue of signalr? thanks in advance

sql server - SQL Query to Select by String ID -

i have below line of code in asp.net page var strselect = string.format("select emailaddress dbo.master stringid='", values["stringid"], "'"); this results in error unclosed quotation mark after character string ''. incorrect syntax near ''. what's wrong syntax? source error: line 65: cmd.connection.close(); line 66: if (!mvcfunctions.handleerror()) line 67: throw e; line 68: return null; line 69: } you're not using string.format correctly: var strselect = string.format("select emailaddress dbo.master stringid='", values["stringid"], "'"); should be var strselect = string.format("select emailaddress dbo.master stringid='{0}'", values["stringid"]); additional information: http://msdn.microsoft....

jquery appending directly after each closing tag before any unwrapped text -

i having trouble getting image link appear directly after closing tag each players names here snippet of script if (shouldaddpopupicon()) { var bodyid = $('body').attr('id'); if (bodyid === 'body_options_02') { $.each($('a[class^="position_"], td.cbsplayername ,td.playertd a'), function (index, value) { var id = getplayeridfromhref($(this).attr('href')); _playerpopupids.push(id); }); _playerpopupids = getuniquearray(_playerpopupids); $.ajax({ type: 'get', url: getplayerprofileapiurl() }).done(function (data) { $.each($('a[class^="position_"], td.cbsplayername a, td.playertd a'), function (index, value) { try { if(!$(this).nextall('a').hasclass('playerpopupnewsicon')) { ...