Search Results

Search found 2 results on 1 pages for 'ladookie'.

Page 1/1 | 1 

  • why does this knockout method receive a form element instead of the object its nested in?

    - by ladookie
    I have this HTML: <ul class="chat_list" data-bind="foreach: chats"> <li> <div class="chat_response" data-bind="visible: CommentList().length == 0"> <form data-bind="submit: $root.addComment"> <input class="comment_field" placeholder="Comment…" data-bind="value: NewCommentText" /> </form> </div> </li> </ul> and this JavaScript: function ChatListViewModel(chats) { // var self = this; self.chats = ko.observableArray(ko.utils.arrayMap(chats, function (chat) { return { CourseItemDescription: chat.CourseItemDescription, CommentList: ko.observableArray(chat.CommentList), CourseItemID: chat.CourseItemID, UserName: chat.UserName, ChatGroupNumber: chat.ChatGroupNumber, ChatCount: chat.ChatCount, NewCommentText: ko.observable("") }; })); self.newChatText = ko.observable(); self.addComment = function (chat) { var newComment = { CourseItemDescription: chat.NewCommentText(), ParentCourseItemID: chat.CourseItemID, CourseID: $.CourseLogic.dataitem.CourseID, AccountID: $.CourseLogic.dataitem.AccountID, SystemObjectID: $.CourseLogic.dataitem.CommentSystemObjectID, SystemObjectName: "Comments", UserName: chat.UserName }; chat.CommentList.push(newComment); chat.NewCommentText(""); }; } ko.applyBindings(new ChatListViewModel(initialData)); When I go into the debugger it shows that the chat parameter of the addComment() function is a form element instead of a chat object. Why is this happening?

    Read the article

  • CSV Parser works in windows, not linux.

    - by ladookie
    I'm parsing a CSV file that looks like this: E1,E2,E7,E8,,, E2,E1,E3,,,, E3,E2,E8,,, E4,E5,E8,E11,,, I store the first entry in each line in a string, and the rest go in a vector of strings: while (getline(file_input, line)) { stringstream tokenizer; tokenizer << line; getline(tokenizer, roomID, ','); vector<string> aVector; while (getline(tokenizer, adjRoomID, ',')) { if (!adjRoomID.empty()) { aVector.push_back(adjRoomID); } } Room aRoom(roomID, aVector); rooms.addToTail(aRoom); } In windows this works fine, however in Linux the first entry of each vector mysteriously loses the first character. For Example in the first iteration through the while loop: roomID would be E1 and aVector would be 2 E7 E8 then the second iteration: roomID would be E2 and aVector would be 1 E3 Notice the missing E's in the first entry of aVector. when I put in some debugging code it appears that it is initially being stored correctly in the vector, but then something overwrites it. Kudos to whoever figures this one out. Seems bizarre to me. rooms is declared as such: DLList<Room> rooms where DLList stands for Doubly-Linked list.

    Read the article

1