Search Results

Search found 477 results on 20 pages for 'bryan cook'.

Page 12/20 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Rails: unable to set any attribute of child model

    - by Bryan Roth
    I'm having a problem instantiating a ListItem object with specified attributes. For some reason all attributes are set to nil even if I specify values. However, if I specify attributes for a List, they retain their values. Attributes for a List retain their values: >> list = List.new(:id => 20, :name => "Test List") => #<List id: 20, name: "Test List"> Attributes for a ListItem don't retain their values: >> list_item = ListItem.new(:id => 17, :list_id => 20, :name => "Test Item") => #<ListItem id: nil, list_id: nil, name: nil> UPDATE #1: I thought the id was the only attribute not retaining its value but realized that setting any attribute for a ListItem gets set to nil. list.rb: class List < ActiveRecord::Base has_many :list_items, :dependent => :destroy accepts_nested_attributes_for :list_items, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => true end list_item.rb: class ListItem < ActiveRecord::Base belongs_to :list validates_presence_of :name end schema.rb ActiveRecord::Schema.define(:version => 20100506144717) do create_table "list_items", :force => true do |t| t.integer "list_id" t.string "name" t.datetime "created_at" t.datetime "updated_at" end create_table "lists", :force => true do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" end end

    Read the article

  • Select distinct from multiple fields using sql

    - by Bryan
    I have 5 columns corresponding to answers in a trivia game database - right, wrong1, wrong2, wrong3, wrong4 I want to return all possible answers without duplicates. I was hoping to accomplish this without using a temp table. Is it possible to use something similar to this?: select c1, c2, count(*) from t group by c1, c2 But this returns 3 columns. I would like one column of distinct answers. Thanks for your time

    Read the article

  • ASP.NET MVC - PartialView html not changing via jQuery html() call

    - by Bryan Roth
    When I change the selection in a DropDownList, a PartialView gets updated via a GET request. When updating the PartialView via the jQuery html() function, the html returned is correct but when it displayed in the browser it is not correct. For example, certain checkboxes within the PartialView should become enabled but they remain disabled even though the html returned says they should be. When I do a view source in the browser the html never gets updated. I'm a little perplexed. Thoughts? Search.aspx <%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Search </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <script type="text/javascript"> $(document).ready(function () { $("#Sections").change(function () { var section = $("#Sections").val(); var township = $("#Townships").val(); var range = $("#Ranges").val(); $.get("Search/Search?section=" + section + "&township=" + township + "&range=" + range, function (response) { $("#cornerDiv").html(response) }); }); }); </script> <h2>Search</h2> <%--The line below is a workaround for a VB / ASPX designer bug--%> <%=""%> <% Using Ajax.BeginForm("Search", New AjaxOptions With {.UpdateTargetId = "searchResults", .LoadingElementId = "loader"})%> Township <%= Html.DropDownList("Townships")%> Range <%= Html.DropDownList("Ranges")%> Section <%= Html.DropDownList("Sections")%> <div id="cornerDiv"> <% Html.RenderPartial("Corners")%> </div> <input type="submit" value="Search" /> <span id="loader">Searching...</span> <% End Using%> <div id="searchResults"></div> </asp:Content>

    Read the article

  • Bibtex with no references title

    - by Bryan Ward
    I am working on writing a scientific poster in LaTeX, and I want to include a few references for my work. Because this is a poster, I have my own customized headers for different sections, and don't want my related works to have a separate title. Essentially I have something like this: \begin{textblock}{5.5}(19.5,11) \CHead{Related Work} %a newcommand header I wrote \bibliographystyle{acm} \bibliography{mybib} \end{textblock} And it comes out with a header called "Related Work" like I want, but it also under that says "References", which I don't want. I found a few websites that said that I could override this with something like \renewcommand\refname{} But all this does is take the word "References" out, but the space allotted for the title is still there. Is there a way to completely eliminate the title and any space it may take up?

    Read the article

  • XPath and special characters

    - by Bryan
    I am having an issue with an XPath query I'm performing for a Sitecore CMS system. This query works fine: /root/content/Meta-Data/Tips/* But when I try this: /root/content/Meta-Data/Tips/*[@SomeAttribute='somekey'] I get an error which says "End of string expected at position 22" which is where the dash character is found. I was under the impression that the dash was not a special character in XML... am I doing something wrong here? Do I need to encode this in some way? Or is this a bug in the XPath parser? Any suggested workarounds?

    Read the article

  • AutoMapper and flattening nested arrays

    - by Bryan Slatner
    I'm trying to use AutoMapper to flatten multiple levels of arrays. Consider the following source classes: class X { public string A { get; set; } public Y[] B { get; set; } } class Y { public string C { get; set; } public Z[] D { get; set; } } class Z { public string E { get; set; } public string F { get; set; } } And the following destination: class Destination { public string A { get; set; } public string C { get; set; } public string E { get; set; } public string F { get; set; } } What I'd like to be able to do is get a List from one or more X, e.g.: Mapper.Map<IEnumerable<X>, IEnumerable<Destination>>(arrayOfX); I'm unable to figure out what sort of mapping configuration to use to achieve this. MapFrom seems like the way to go for 1:1 compositions, but doesn't seem to be able to handle the array (or other enumerable) unless I use AutoMapper's destination naming convention. Any insights on how to achieve this?

    Read the article

  • ASP.NET MVC 2 RC 2 returns Area-specific controller when no area specified

    - by Bryan
    I have a basic MVC 2 (RC2) site with one base-level controller ("Home"), and one area ("Admin") with one controller ("Abstract"). When i call http://website/Abstract - the Abstract controller in the Admin area gets called even though i haven't specified the Area in the URL. To make matters worse - it doesn't seem to know it's under Admin because it can't find the associated view and just returns: The view 'Index' or its master was not found. The following locations were searched: ~/Views/Abstract/Index.aspx ~/Views/Abstract/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx Am i doing something wrong? Is this a bug? A feature?

    Read the article

  • Maintain List of Active Users for Web

    - by Bryan Marble
    Problem Statement - Would like to know if particular web app user is active (i.e. logged in and using site) and be able to query for list of active users or determine a user's activity status. Constraints - Doesn't need to be exact (i.e. if a user was active within a certain timeframe, that's ok to say that they're active even if they've closed their browser). I feel like there should be a design pattern for this type of problem but haven't been able to find anything here or elsewhere on the web. Approaches I'm considering: Maintain a table that is updated any time a user performs an action (or some subset of actions). Would then query for users that have performed an action within some threshold of time. Try to monitor session information and maintain a table that lists logged in users and times out after a certain period of time. Some other more standard way of doing this? How would you approach this problem (again, from a design pattern perspective)? Thanks!

    Read the article

  • jQuery + Jeditable - detect when select is changed

    - by Bryan Roth
    I'm using Jeditable for in-place editing. One the controls I am working with has the select type. When a user clicks on the field, the following select control is generated: <div id="status" class="editable_select"> <form> <select name="value"> <option value="Active">Active</option> <option value="Inactive">Inactive</option> </select> <button type="submit">Save</button> <button type="cancel">Cancel</button> </form> </div> What I am trying to figure out is how to use jQuery to detect when that select control is changed, especially since it doesn't have an ID attribute. This is what I have so far, but the event is not getting triggered: $(document).ready(function () { $('#status select').change(function () { alert("Change Event Triggered On:" + $(this).attr("value")); }); });

    Read the article

  • Should entry level programmers be able to answer FizzBuzz?

    - by Bryan Rowe
    When interviewing entry level developers, I have used the FizzBuzz question as a type of acid test. Generally, I ask for a solution in pseudo-code or any language of their choice. If someone can't answer this question -- or get reasonably close, the interview generally ends shortly thereafter and we don't progress to more interesting code questions. In your opinion, is it fair/appropriate/accurate to filter entry-level staff in this manner? Should the average four year college graduate have a reasonable enough foundation to be able to throw up a pseudo-code solution of FizzBuzz?

    Read the article

  • ASP.NET MVC: How to validate an Ajax form with a specified UpdateTargetID?

    - by Bryan Roth
    I'm trying to figure out how to show validation errors after a user submits an Ajax form that has its UpdateTargetID property set. I'm stumped on how to update the Ajax form with the validation errors without returning the Create PartialView into the results div. If the form is valid, then it should return the Records PartialView. Create.ascx <% Using Ajax.BeginForm("Create", "Record", New Record With {.UserID = Model.UserID}, New AjaxOptions With { .UpdateTargetId = "results", .LoadingElementId = "loader" })%> Date Located <%= Html.TextBoxFor(Function(model) model.DateLocated)%> <%= Html.ValidationMessageFor(Function(model) model.DateLocated) %> Description <%= Html.TextBoxFor(Function(model) model.Description)%> <%= Html.ValidationMessageFor(Function(model) model.Description) %> <input id="btnSave" type="submit" value="Create" /> <span id="loader" class="loader">Saving...</span> <%End Using%> Records.ascx <div id="results"> ... </div> RecordController.vb Function Create(ByVal newRecord As Record) As ActionResult ValidateRecord(newRecord) If Not ModelState.IsValid Then Return PartialView("Create", newRecord) End If _repository.Add(newRecord) _repository.Save() Dim user = _repository.GetUser(newRecord.UserID) Return PartialView("Records", user) End Function

    Read the article

  • A* (A-star) implementation in AS3

    - by Bryan Hare
    Hey, I am putting together a project for a class that requires me to put AI in a top down Tactical Strategy game in Flash AS3. I decided that I would use a node based path finding approach because the game is based on a circular movement scheme. When a player moves a unit he essentially draws a series of line segments that connect that a player unit will follow along. I am trying to put together a similar operation for the AI units in our game by creating a list of nodes to traverse to a target node. Hence my use of Astar (the resulting path can be used to create this line). Here is my Algorithm function findShortestPath (startN:node, goalN:node) { var openSet:Array = new Array(); var closedSet:Array = new Array(); var pathFound:Boolean = false; startN.g_score = 0; startN.h_score = distFunction(startN,goalN); startN.f_score = startN.h_score; startN.fromNode = null; openSet.push (startN); var i:int = 0 for(i= 0; i< nodeArray.length; i++) { for(var j:int =0; j<nodeArray[0].length; j++) { if(!nodeArray[i][j].isPathable) { closedSet.push(nodeArray[i][j]); } } } while (openSet.length != 0) { var cNode:node = openSet.shift(); if (cNode == goalN) { resolvePath (cNode); return true; } closedSet.push (cNode); for (i= 0; i < cNode.dirArray.length; i++) { var neighborNode:node = cNode.nodeArray[cNode.dirArray[i]]; if (!(closedSet.indexOf(neighborNode) == -1)) { continue; } neighborNode.fromNode = cNode; var tenativeg_score:Number = cNode.gscore + distFunction(neighborNode.fromNode,neighborNode); if (openSet.indexOf(neighborNode) == -1) { neighborNode.g_score = neighborNode.fromNode.g_score + distFunction(neighborNode,cNode); if (cNode.dirArray[i] >= 4) { neighborNode.g_score -= 4; } neighborNode.h_score=distFunction(neighborNode,goalN); neighborNode.f_score=neighborNode.g_score+neighborNode.h_score; insertIntoPQ (neighborNode, openSet); //trace(" F Score of neighbor: " + neighborNode.f_score + " H score of Neighbor: " + neighborNode.h_score + " G_score or neighbor: " +neighborNode.g_score); } else if (tenativeg_score <= neighborNode.g_score) { neighborNode.fromNode=cNode; neighborNode.g_score=cNode.g_score+distFunction(neighborNode,cNode); if (cNode.dirArray[i]>=4) { neighborNode.g_score-=4; } neighborNode.f_score=neighborNode.g_score+neighborNode.h_score; openSet.splice (openSet.indexOf(neighborNode),1); //trace(" F Score of neighbor: " + neighborNode.f_score + " H score of Neighbor: " + neighborNode.h_score + " G_score or neighbor: " +neighborNode.g_score); insertIntoPQ (neighborNode, openSet); } } } trace ("fail"); return false; } Right now this function creates paths that are often not optimal or wholly inaccurate given the target and this generally happens when I have nodes that are not path able, and I am not quite sure what I am doing wrong right now. If someone could help me correct this I would appreciate it greatly. Some Notes My OpenSet is essentially a Priority Queue, so thats how I sort my nodes by cost. Here is that function function insertIntoPQ (iNode:node, pq:Array) { var inserted:Boolean=true; var iterater:int=0; while (inserted) { if (iterater==pq.length) { pq.push (iNode); inserted=false; } else if (pq[iterater].f_score >= iNode.f_score) { pq.splice (iterater,0,iNode); inserted=false; } ++iterater; } } Thanks!

    Read the article

  • Is there a way to declare a variable that implements multiple interfaces in .Net?

    - by Bryan Anderson
    Similar to this Java question. I would like to specify that a variable implements multiple interfaces. For instance private {IFirstInterface, ISecondInterface} _foo; public void SetFoo({IFirstInterface, ISecondInterface} value) { _foo = value; } Requirements: I don't have the ability to add an interface to most type that would be passed in to Foo. So I can't create a third interface that inherits from IFirstInterface and ISecondInterface. I would like to avoid making the containing class generic if possible because the type of Foo doesn't have much to do with the class and the user isn't likely to know it at compile time. I need to use foo to access methods in both interfaces at a later time. I would like to do this in a compiler safe way, i.e. no trying to cast to the interface just before trying to use it. If foo does not implement both interfaces quite a bit of functionality won't work properly. Is this possible?

    Read the article

  • JSON to Persistent Data Store (CoreData, etc.)

    - by Bryan Veloso
    All of the data on my application is pulled through an API via JSON. The nature of a good percentage of this data is that it doesn't change very often. So to go and make JSON requests to get a list of data that doesn't change much didn't seem all that appealing. I'm looking for the most sensible option to have this JSON saved onto the iPhone in some sort of persistent data store. Obviously one plus of persisting the data would be to provide it when the phone can't access the API. I've looked at a few examples of having JSON and CoreData interact, for example, but it seems that they only describe transforming NSManagedObjects into JSON. If I can transform JSON into CoreData, my only problem would be being able to change that data when the data from the API does change. (Or, maybe this is all just silly.)

    Read the article

  • Rails 3 equivalent of complex SQL query

    - by Bryan
    Given the following models: class Recipe < ActiveRecord::Base has_many :recipe_ingredients has_many :ingredients, :through => :recipe_ingredients end class RecipeIngredient < ActiveRecord::Base belongs_to :recipe belongs_to :ingredient end class Ingredient < ActiveRecord::Base end How can I perform the following SQL query using Arel in Rails 3? SELECT * FROM recipes WHERE NOT EXISTS ( SELECT * FROM ingredients WHERE name IN ('chocolate', 'cream') AND NOT EXISTS ( SELECT * FROM recipe_ingredients WHERE recipe_ingredients.recipe_id = recipes.id AND recipe_ingredients.ingredient_id = ingredients.id))

    Read the article

  • Windows Screensaver Multi Monitor Problem

    - by Bryan
    I have a simple screensaver that I've written, which has been deployed to all of our company's client PCs. As most of our PCs have dual monitors, I took care to ensure that the screensaver ran on both displays. This works fine, however on some systems, where the primary screen has been swapped (to the left monitor), the screensaver only works on the left (primary) screen. The offending code is below. Can anyone see anything I've done wrong, or a better way of handling this? For info, the context of "this", is the screensaver form itself. // Make form full screen and on top of all other forms int minY = 0; int maxY = 0; int maxX = 0; int minX = 0; foreach (Screen screen in Screen.AllScreens) { // Find the bounds of all screens attached to the system if (screen.Bounds.Left < minX) minX = screen.Bounds.Left; if (screen.Bounds.Width > maxX) maxX = screen.Bounds.Width; if (screen.Bounds.Bottom < minY) minY = screen.Bounds.Bottom; if (screen.Bounds.Height > maxY) maxY = screen.Bounds.Height; } // Set the location and size of the form, so that it // fills the bounds of all screens attached to the system Location = new Point(minX, minY); Height = maxY - minY; Width = maxX - minX; Cursor.Hide(); TopMost = true;

    Read the article

  • C program that prints out another C program in Japanese

    - by Bryan Bueter
    There was a C program written for a contest that was formatted in ASCII art as a Japanese character. When compiled and ran it printed out another program formatted in a different Japanese character, then another, then finally it printed out the first again. I was looking for the code to that and could not find it on the internet. I dont remember what contest nor what the name of the program was. Thanks.

    Read the article

  • XSLT Sort Alphabetically & Numerically Problem

    - by Bryan
    I have a group of strings ie g:lines = '9,1,306,LUCY,G,89' I need the output to be: 1,9,89,306,G,LUCY This is my current code: <xsl:for-each select="$all_alerts[g:problem!='normal_service'][g:service='bus']"> <xsl:sort select="g:line"/> <xsl:sort select="number(g:line)" data-type="number"/> <xsl:value-of select="normalize-space(g:line)" /><xsl:text/> <xsl:if test="position()!=last()"><xsl:text>,&#160;</xsl:text></xsl:if> </xsl:for-each> I can get it to only display '1, 12, 306, 38, 9, G, LUCY' because the 2nd sort isn't being picked up. Anyone able help me out?

    Read the article

  • How do I create drop lines while dragging a menu item on a WinForm?

    - by Bryan
    I want to mimic the functionality of Google Chrome/FireFox for example, when rearranging your bookmarks, when you are dragging the menu item, it creates a black line at the proposed drop point, like this: I've already implemented the Drag/Drop functionality to rearrange the menu, but I would like to add these separator lines as an additional feature. Is there a way to do this within the .NET Framework (3.5) or shall I have to resort to Win32 api calls? Just wanted to ask before I went down that path.

    Read the article

  • Visual Studio 2008 adding incorrect working folders to TFS Workspace

    - by Bryan Rowe
    I am using Visual Studio 2008 with TFS. I have one workspace set up with one working folder. I map the root source control folder $/ to C:\TFS and get all code. When working on any project under the root, Visual Studio will randomly add incorrectly mapped working folders to my workspace. For example, it might map $/WebProject/ to C:\TFS\WebProject\DataAccess -- where the real files exist at C:\TFS\WebProject. Once it incorrectly adds these working folders, I can no longer open the solution. I am forced to remove the working folders that Visual Studio added and get latest from TFS. Has anyone experienced this? Is there something I can do to avoid running into this?

    Read the article

  • Storing high precision latitude/longitude numbers in iOS Core Data

    - by Bryan
    I'm trying to store Latitude/Longitudes in core data. These end up being anywhere from 6-20 digit precision. And for whatever reason, i had them as floats in Core Data, its rounding them and not giving me the exact values back. I tried "decimal" type, with no luck either. Are NSStrings my only other option? EDIT NSManagedObject: @interface Event : NSManagedObject { } @property (nonatomic, retain) NSDecimalNumber * dec; @property (nonatomic, retain) NSDate * timeStamp; @property (nonatomic, retain) NSNumber * flo; @property (nonatomic, retain) NSNumber * doub; Here's the code for a sample number that I store into core data: NSNumber *n = [NSDecimalNumber decimalNumberWithString:@"-97.12345678901234567890123456789"]; Code to access it again: NSNumber *n = [managedObject valueForKey:@"dec"]; NSNumber *f = [managedObject valueForKey:@"flo"]; NSNumber *d = [managedObject valueForKey:@"doub"]; Printed values: Printing description of n: -97.1234567890124 Printing description of f: <CFNumber 0x603f250 [0xfef3e0]>{value = -97.12345678901235146441, type = kCFNumberFloat64Type} Printing description of d: <CFNumber 0x6040310 [0xfef3e0]>{value = -97.12345678901235146441, type = kCFNumberFloat64Type}

    Read the article

  • Add dynamic URL (or button) to each node in Drupal

    - by Bryan Folds
    I've used CCK to create a 'Travel Offer' content-type which basically just lists the details for a travel package. My question is how to have a button or link on each node (when the user views it) that will link to a url that includes the title of the current node (eg: example.com/requestQuote/Title_Of_This_Node). I haven't implemented my system yet so I am free to change the content-type to include a button field or something like that...

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >