Search Results

Search found 15 results on 1 pages for 'anapprentice'.

Page 1/1 | 1 

  • Proxy cache zone static is unknown

    - by AnApprentice
    I'm working to setup a reverse proxy cache. In nginx.conf I added the following: location /blog { # Reverse Proxy # Cache the Blog Pages from Heroku proxy_cache STATIC; proxy_cache_valid 200 10m; proxy_cache_valid 404 1m; proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; rewrite ^/blog$ /; rewrite ^/blog/(.*)$ /$1; proxy_pass http://whispering-retreat-1.herokuapp.com; break; } However when trying to restart nginx I received the following error: $ /opt/nginx/sbin/nginx -s stop nginx: [emerg] "proxy_cache" zone "STATIC" is unknown in /opt/nginx/conf/nginx.conf:182 Any ideas what's the problem is with using STATIC? I just want to cache the blog pages so it doesn't hit heroku every time which is horribly slow. Thanks

    Read the article

  • Ruby / Rails - How to aggregate a Query Results in an Array?

    - by AnApprentice
    Hello, I have a large data set that I want to clean up for the user. The data set from the DB looks something like this: ID | project_id | thread_id | action_type |description 1 | 10 | 30 | comment | yada yada yada yada yada 1 | 10 | 30 | comment | xxx 1 | 10 | 30 | comment | yada 313133 1 | 10 | 33 | comment | fdsdfsdfsdfsdfs 1 | 10 | 33 | comment | yada yada yada yada yada 1 | 10 | | attachment | fddgaasddsadasdsadsa 1 | 10 | | attachment | xcvcvxcvxcvxxcvcvxxcv Right now, when I output the above in my view its in the very same order as above, problem is it is very repetitive. For example, for project_id 10 & thread_id 30 you see: 10 - 30 - yada yada yada yada yada 10 - 30 - xxxxx 10 - 30 - yada yada yada yada yada What I would like to learn how to do in ruby, is some how create an array and aggreate descriptions under a project_id and thread_id, so instead the output is: 10 - 30 - yada yada yada yada yada - xxxxx - yada yada yada yada yada Any advice on where to get started? This requirement is new for me so I would appreciate your thoughts on what you're thinking the best way to solve this is.Hopefully this can be done in ruby and not sql, as the activity feed is likely going to grow in event types and complexity. Thanks

    Read the article

  • JQUERY animate Delay?

    - by AnApprentice
    I'm using JQUERY animate to show a banner at the top of the page, which is a DIV that is set to top -60 to hide it. I'm using the following JS call to show the div: // Animation $('#message-dock').animate({ top: 0 }, 500, function() { // Animation complete. }); What I can't figure out is for some reason there is an unwanted delay before I start seeing the div and I can't figure out why? Any Ideas?

    Read the article

  • Rails - Vestal Versions - Access previous version data w/o restoring?

    - by AnApprentice
    Hello, I'd like to use vestal versions to do the following: Determine the Content of the current record being saved Determine the Content of the last record saved In my model I have: class Note < ActiveRecord::Base versioned :if => :really_create_a_version? def really_create_a_version? XXXXXXXXXXXXXX XXXXXXXXXXXXXX end end Where the XXXX are, how can I get the note.content of the item about to be saved (i'm assuming it hasn't been saved yet to the DB? Is that correct? Also, how can I get the note.content of the save before the current save in progress? Thanks

    Read the article

  • rails - when using Group_by - How to get an Index?

    - by AnApprentice
    I have the following: sets = DataSet.all.group_by{ |data| [data.project_id, "-", data.thread_id].join(" ") } <% sets.each do |range, datas| %> <p><%= range %>:</p> <% datas.each do |data| %> <%=data%> <p>Last Post<%= data.last.created_at %></p> <% end %> <% end %> Problem is that I need an index. So i updated the above with: <% sets.each_with_index do |range, datas, i| %> <p><%= range %>:</p> <% datas.each do |data| %> <%= i %> <%=data%> <p>Last Post<%= data.last.created_at %></p> <% end %> <% end %> That then breaks, with the error: undefined method `last' for 0:Fixnum Ideas? thank you

    Read the article

  • Uncaught TypeError: Cannot read property 'length' of undefined

    - by AnApprentice
    I'm working to built a contact list that is grouped by the first letter of the contact's last name. After a succesfull ajax request, the contact is pushed to addContact: Ajax success: ko.utils.arrayForEach(dataJS.contactList, function(c) { contactsModel.addContact(c); }); contactsModel.addContact: //add a contact in the right spot under the right letter contactsModel.addContact = function(newContact) { //grab first character var firstLetter = (newContact.lname || "").charAt(0).toUpperCase(); //if it is a number use # if (!isNaN(firstLetter)) { firstLetter = "#"; } //do we already have entries for this letter if (!this.letterIndex[firstLetter]) { //new object to track this letter's contacts var letterContacts = { letter: firstLetter, contacts: ko.observableArray([]) }; this.letterIndex[firstLetter] = letterContacts; //easy access to it //put the numbers at the end if (firstLetter === "#") { this.contactsByLetter.push(letterContacts); } else { //add the letter in the right spot for (var i = 0, lettersLength = this.contactsByLetter().length; i < lettersLength; i++) { var letter = this.contactsByLetter()[i].letter; if (letter === "#" || firstLetter < letter) { break; } } this.contactsByLetter.splice(i, 0, letterContacts); } } var contacts = this.letterIndex[firstLetter].contacts; //now we have a letter to add our contact to, but need to add it in the right spot var newContactName = newContact.lname + " " + newContact.fname; for (var j = 0, contactsLength = contacts().length; j < contactsLength; j++) { var contactName = contacts()[j].lName + " " + contacts()[j].fName; if (newContactName < contactName) { break; } } //add the contact at the right index contacts.splice(j, 0, newContact); }.bind(contactsModel); The contacts json object from the server looks like this: { "total_pages": 10, "page": page, "contactList": [{ "photo": "http://homepage.mac.com/millhouse/Family%20Tree/images/PersonListIcon.png", "lname": "Bond", "id": 241, "fname": "James", "email": "[email protected]"}, While this works in jsfiddle, when I try it locally, I get the following error during the first push to addContact: Uncaught TypeError: Cannot read property 'length' of undefined jQuery.jQuery.extend._Deferred.deferred.resolveWithjquery-1.5.1.js:869 donejquery-1.5.1.js:6591 jQuery.ajaxTransport.send.callbackjquery-1.5.1.js:7382 Ideas? Thanks

    Read the article

  • jQuery, my function is return a FUNCTION and not an integer?

    - by AnApprentice
    Hello, i have the following func: viewModel.unreadCount = ko.dependentObservable(function() { var unreadCount = 0; for (var i = 0; i x< xxxxxxxxxxxx.length; i++) { if (xxxxxx == false) { unreadCount++; } } return unreadCount; }, viewModel); When I use this in knockout JS, I can't do a simple if (viewModel.unreadCount()==0), like this: <div data-bind="visible: viewModel.unreadCount()==0"> It turns out because when I run: <p>${ (typeof viewModel.unreadCount) }</p> I get "function" Any ideas why that is and how I can get it to return an INT so I can do an if statement? Thanks

    Read the article

  • Rails - Ability to Enable/Disable Links on a View?

    - by AnApprentice
    Hello, I have a UserMailer View that has several link_to's like so: <%= link_to('XXXXXXXX Link Title', item_url(@item, :only_path => false), :style => 'color:#5196E3;text-decoration:underline;') %> The page has several different links. I'd like to know if there is a way to globally set in the view to enable or disable the links. If enabled, the above would run like normal, if not the block above would just show the text (XXXXXXXX Link Title) and not be linked? Any ideas other than wrapping every link_to inside a IF statement? Thanks

    Read the article

  • Rails - JSON object with an array?

    - by AnApprentice
    Hello, I'm able to create and send a JSON object like so: @mylist << { :id => item.id, :name => name.id } render :json => { :result => 'success', :mylist => @mylist } That works great. Problem I'm having now is that I need to include users with are 1 or more per item. @mylist << { :id => item.id, :name => name.id, :users => item.users } Where item.users contains a list of (user.id, user.name, user.desc). how do I include an array like users inside a json object? How to build in Rails and then how to parse it with jQuery? Thanks

    Read the article

  • CSS - How to Style a Selected Radio Buttons Label?

    - by AnApprentice
    Hello, I want to add a style to a radio button's selected label: HTML: <div class="radio-toolbar"> <label><input type="radio" value="all" checked>All</label> <label><input type="radio" value="false">Open</label> <label><input type="radio" value="true">Archived</label> </div> CSS .radio-toolbar input[type="radio"] {display:none;} .radio-toolbar label { background:Red; border:1px solid green; padding:2px 10px; } .radio-toolbar label + input[type="radio"]:checked { background:pink !important; } Any ideas what I'm doing wrong?

    Read the article

  • jQuery - UI Dialog - looking for a smart solution for a timed close

    - by AnApprentice
    Hello, I wrote the following: // Called with setTimeout(magicDialogDelayedClose, 2500); function magicDialogDelayedClose() { $(".ui-dialog").fadeOut(function() { dialog_general.dialog('close'); }); } The above is called with setTimeout when I show a notice dialog that I want to auto close in 2.5 secs. The problem I'm noticing with this is that if the use Manually closes a dialog this timer still is running. If the user then opens a new dialog (which is very possible) the timer can then close that NEW dialog. What's a smart way to handle this?j

    Read the article

  • jQuery DataLink - Does DataLink solve my use case?

    - by AnApprentice
    Hello, I recently heard of the jQuery datalink plugin and wondered if I should be using if for the following: I have a an inbox in my app that consists of the following: Inbox (index) - List of Items (list of mails) Inbox (show) Item Viewer (1 mail) Inbox Unread Counter The challenge I'm having now is a user can mark a mail as read/unread in either view which makes keeping the counter accurate challenging. Can datalink help with this? If so how? Also, I read that datalink requires forms is that true? Or can I bind the links to anything like 0 and anytime a mailitem changes from read to unread it would automatically update? Thanks

    Read the article

  • Rails - Posting a Boolean (true or False) and updating the DB in the controller

    - by AnApprentice
    Hello, in my Rails 3 App, I'm posting with jQuery the following: http://0.0.0.0:3000/topics/read_updater?&topic_id=101&read=true In my controller: def read_updater current_user.topics.where(:topic_id => params[:topic_id]).update_all(:read => params[:read]) render :json => {:status => 'success' } end params[:conversation_id] works great, but params[:read] is inserting empty values in the DB, even though jQuery is posting either a true or false. Ideas? I want rails to update the DB with either true or false. Thanks

    Read the article

  • jQuery using .html & then window.scrollTo

    - by AnApprentice
    Hello, I'm doing the following: First, inject HTML into the page (a lot) which then increases the window scrollbar: $("#XXXX").html("LOTS OF HTML").show(); Then i want to scroll down to the end of the page: window.scrollTo(0,$(document).height()); Problem is the page never scrolls down. I did some console.logging and the scrollTo is running before the HTML from the inject html() is run. I tried this in the JS which injects the HTML, I then tried doing the scroll inside the HTML inject but that made no difference. Any ideas?

    Read the article

  • HTML, jQuery Suggestion for a List

    - by AnApprentice
    Hello, I'm creating an app that will have a list of messages, each message can be either read or unread. Think GMAIL (though I'm not trying to rebuild that)... My question is when I output all these messages, I need to list if the message is read or unread, I also need to provide the ability to change the message status, from read to unread. That being said, how do you suggest I stored this? A checkbox, a hidden input value? Any thoughts? Thanks

    Read the article

1