{"QuestionId": 13157315, "AnswerCount": 1, "Tags": "", "CreationDate": "2012-10-31T11:53:19.723", "AcceptedAnswerId": "13157540", "Title": "homebrew uninstall/move macports UNDO", "Body": "

brew doctor told me to move macports: sudo mv /opt/local ~/macports

\n\n

So I did that and now nothing works properly. What would be the command to move macports back to where it was?

\n", "Lable": "No"} {"QuestionId": 13429218, "AnswerCount": 2, "Tags": "", "CreationDate": "2012-11-17T09:11:59.167", "AcceptedAnswerId": "13429402", "Title": "Modifying a dictionary with datetime as keys", "Body": "

For example:

\n\n
{datetime.date(2000, 1, 15): [1],\n datetime.date(2000, 1, 14): [5],\n datetime.date(2000, 1, 3): [4],\n datetime.date(2005, 1, 10): [2],\n datetime.date(2005, 1, 16): [4],\n datetime.date(2005, 1, 5): [2]}\n
\n\n

to just:

\n\n
{(2000, 1): [10], (2005,1): [8]}\n
\n\n

basically omitting the day, and adding the values. I can't seem to figure out how to remove datetime.date.

\n", "Lable": "No"} {"QuestionId": 13436206, "AnswerCount": 1, "Tags": "", "CreationDate": "2012-11-18T00:19:31.917", "AcceptedAnswerId": null, "Title": "Creating a Book Inventory System in Ruby on Rails", "Body": "

I'm currently in the process of creating a inventory system designed for books and other paper goods. I want to create the website in Ruby on Rails. What I'm looking for is any examples or ideas that can make that happen.

\n\n

What I need to happen is when this is set up it'll have the books added, with a current count and a few other details(name, date published, etc.). Now when a delivery comes in they can add to the current count. When books are removed they can of course subtract that from the total. Love all this to be seemless if possible. The more its user friendly the better.

\n\n

Also when books are reaching a low stock a warning will be shown. Also a list of books alphabetically with all the details and so forth.

\n\n

I'm at a loss on how exactly to do this efficiently, I'm fairly new to Ruby on Rails but very familiar with HTML, PHP, CSS and so those cause no problems.

\n", "Lable": "No"} {"QuestionId": 13565177, "AnswerCount": 2, "Tags": "", "CreationDate": "2012-11-26T12:48:09.050", "AcceptedAnswerId": "13565228", "Title": "How to apply diff between commits to current head in git?", "Body": "

I was working on some topic branch on project I participate in. I normally rebase my branches before making a pull request. This time however, due to changes in master, rebasing is a big pain. Lot of conflicts and, what's worse, after manual merging commits look just ugly and loose their point. I would definitely prefer to obtain diff between my branch's head and latest commit present on both branches, then apply this diff to master's head and finally create brand new shiny commits with git add -p. So my question is: how to achieve it? One possibility would be to simply merge master into my topic branch, but is there a more elegant solution? I believe yes.

\n\n

Thanks for your help.

\n\n

EDIT:

\n\n

One file has been moved on master branch and my commits are altering this file (using it's old name).

\n", "Lable": "No"} {"QuestionId": 13585178, "AnswerCount": 1, "Tags": "", "CreationDate": "2012-11-27T13:22:04.560", "AcceptedAnswerId": null, "Title": "TinyMCE with div tag?", "Body": "

Below is my JSP code:

\n\n
<tr>\n      <td colspan=\"2\">custEmail</td>\n      <td colspan=\"5\"><div id= \"custEmail\"><p><strong>Test</strong></p></div></td>\n</tr>\n
\n\n

Below is the code attaching the div with TinyMCE Editor

\n\n
<script type=\"text/javascript\" src=\"tinymce/tinymce.min.js\"></script>\n<script type=\"text/javascript\">\ntinyMCE.init({\n        width : \"640\",\n        mode : \"exact\",\n        elements : \"custEmail\",\n        theme : \"advanced\",\n        plugins : \"preview\",\n        readonly : true,\n        theme_advanced_buttons1 : \"forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,formatselect,fontselect,fontsizeselect,sub,sup,|,bold,italic,underline,strikethrough\",\n        theme_advanced_buttons2 : \"\",\n        theme_advanced_buttons3 : \"\",\n        theme_advanced_toolbar_location : \"top\",\n        theme_advanced_toolbar_align : \"left\",\n        theme_advanced_statusbar_location : \"bottom\",\n        theme_advanced_resizing : true\n    });\n</script>\n
\n\n

But on my HTML page, I see the content as:

\n\n
<p><strong>Test</strong></p>\n
\n\n

Instead of Bold Test. As soon as I change the following:

\n\n
div id=\"custEmail\" tag to textarea id=\"custEmail\"\n
\n\n

It works fine. Not sure if I need to have some setting for div tag?

\n", "Lable": "No"} {"QuestionId": 13665763, "AnswerCount": 1, "Tags": "", "CreationDate": "2012-12-02T02:07:36.040", "AcceptedAnswerId": "13667544", "Title": "shared partials error undefined method `empty?' for nil:NilClass", "Body": "

I've create a partial (views/cart/_cart.html.erb) for my applications shopping cart. I'm rendering it in only in my views/layouts/application.html.erb file. But when I run it I'm getting a NoMethodError on every page other than the views/cart/_cart.index.erb, which I suspect is because it shares the same controller as the partial being rendered.

\n\n

I've been looking everywhere for an answer & believe it has something to do with how I'm passing variables when rendering the partial, I'll really appreciate it if someone can have a look?

\n\n

All code can be found here: https://github.com/rossmc/topsnowboards

\n\n

My code for my partial (views/cart/_cart.html.erb) begins:

\n\n
<% @cart = cart%>\n\n<h1>Your Cart</h1>\n\n<% if @cart.empty? %>\n    <p>There is nothing in your shopping Cart</p>\n<% end %>\n\n<% total = 0 %>\n\n<!-- More code displaying the rest of the cart omitted for brevity \n
\n\n

The partial is rendered in views/layouts/application.html.erb with:

\n\n
<%= render :partial => \"/cart/cart\", :locals => { :cart => @cart } \n
\n\n

The error message Rails is throwing back at me when I run it is:

\n\n
NoMethodError in Site#home\n\nShowing Server Side/PROJ-Server Side/app/views/cart/_cart.html.erb where line #5 raised:\n\nundefined method `empty?' for nil:NilClass\n\nExtracted source (around line #5):\n\n2: \n3: <h1>Your Cart</h1>\n4: \n5: <% if @cart.empty? %>\n6:  <p>There is nothing in your shopping Cart</p>\n7: <% end %>\n8: \n
\n", "Lable": "No"} {"QuestionId": 13698969, "AnswerCount": 3, "Tags": "", "CreationDate": "2012-12-04T08:44:59.977", "AcceptedAnswerId": "13702056", "Title": "What is the difference between mocks, stubs and fake objects", "Body": "

Although there are plenty of resources, even here on SO, only two of the terms are compared to each other in these Q/A.

\n\n

So, in short, what is each one of them? And how they all relate to each other? Or don't they at all?

\n", "Lable": "No"}