In Python 2, what is the difference between '/' and '//' when used for division?

In Python 2, what is the difference between '/' and '//' when used for division?

Is there a benefit to using one over the other? In Python 2, they both seem to return the same results:>>> 6/32>>> 6//32 1:In Python 3.0, 5 / 2 will return 2.5 and 5 // 2 will return 2. The former is floating point division, and the lat

Relative imports in Python 3

Relative imports in Python 3

I want to import a function from another file in the same directory.Sometimes it works for me with from .mymodule import myfunction but sometimes I get a:SystemError: Parent module '' not loaded, cannot perform relative importSometimes it w

Controller not a function, got undefined, while defining controllers globally

Controller not a function, got undefined, while defining controllers globally

I am writing a sample application using angularjs. i got an error mentioned below on chrome browser. Error is Error: [ng:areq] http://errors.angularjs.org/1.3.0-beta.17/ng/areq?p0=ContactController&p1=not%20a%20function%2C%20got%20undefine

Relative imports for the billionth time

Relative imports for the billionth time

I've been herehttp://www.python.org/dev/peps/pep-0328/http://docs.python.org/2/tutorial/modules.html#packagesPython packages: relative importspython relative import example code does not workUltimate answer to relative python importsRelativ

window.close and self.close do not close the window in Chrome

window.close and self.close do not close the window in Chrome

The issue is that when I invoke window.close() or self.close() it doesn't close the window. Now there seems to be a belief that in Chrome you can't close by script any window that is not script created. That is patently false but regardless

Using i and j as variables in Matlab

Using i and j as variables in Matlab

i and j are very popular variable names (see e.g., this question and this one). For example, in loops:for i=1:10, % do something...endAs indices into matrix:mat( i, j ) = 4;Why shouldn't they be used as variable names in Matlab? 1:Be

event.preventDefault() vs. return false

event.preventDefault() vs. return false

When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I'll use jQuery in the examples, but this applies to plain-JS as well:1. event.preventDefault()$('a').click(function

Problems filtering django datetime field by month and day

Problems filtering django datetime field by month and day

Can someone explain to me why the following filters are not working at the month and day level? Filtering by year seems to work, but not the other two.>>> clicks.count()36>>> date = clicks[0].created>>> date.month2>>> date.year2014>>> date

Add another button next to the “back” button on the left of a UINavigationBar

Add another button next to the “back” button on the left of a UINavigationBar

I've tried this for hours but I still cannot solve it.When using UINavigationController and push a new view controller on top, I got a free "back" button on the left of the navigation bar. I want another button just next to it (to show a po

How can I find a devise user by it's session id?

How can I find a devise user by it's session id?

Given session["session_id"] is it possible to find the logged in User to which that session belongs to? 1:At least on my system (rails 3.2, devise 2.0.4), you can do it like this:session is:{"session_id"=>"be02f27d504672bab3408a0ccf5c1db

Switching from Eclipse to IntelliJ: Is there a way to split tool windows?

Switching from Eclipse to IntelliJ: Is there a way to split tool windows?

Having used Eclipse for more years than I care to admit, I'm currently trying to get adjusted to IntelliJ 12 but I'm having a hard time with the totally different UI metaphors/concepts. I'd like to be able to have a window layout like this:

what is the difference between view and activity in android development?

what is the difference between view and activity in android development?

When do I need to create a new activity and when do I need to change the view?My app needs to do:screen #1two big buttons(sort of menu)screen #2list of items - depend on the selection on prev screenscreen #3another list - depend on the sele

highcharts: dynamically define colors in pie chart

highcharts: dynamically define colors in pie chart

I'm trying to dynamically define color for each seria depending of their type.Below is my code which doesn't work but showing what I'm trying to do. I would like to define colour for certain type eg: if type = 'IS' then color = '#FFCACA'I

Run a script in the same directory as the current script

Run a script in the same directory as the current script

I have two Bash scripts in the same folder (saved somewhere by the user who downloads the entire repository):script.sh is run by the userhelper.sh is required and run by script.shThe two scripts should be in the same directory. I need the f

What is the status of ranges in C++?

What is the status of ranges in C++?

Sometimes I get tired of all this my_vector.begin(), my_vector.end() noise. Last year at boostcon, Andrei Alexandrescu's keynote speech was titled Iterators Must Go (video)Is there any progress on introducing ranges into C++, so I can final

Java -classpath option

Java -classpath option

Will the use of -classpath option with java, add to or replace the contents of the CLASSPATH env variable? 1:Using the classpath variable it overrides the CLASSPATH of Environment variable but only for that session. If you restart the ap

Exposing `defaultdict` as a regular `dict`

Exposing `defaultdict` as a regular `dict`

I am using defaultdict(set) to populate an internal mapping in a very large data structure. After it's populated, the whole structure (including the mapping) is exposed to the client code. At that point, I don't want anyone modifying the ma

Best way to find SQL Locks in SQL Server 2008

Best way to find SQL Locks in SQL Server 2008

What is the best way to find the SQL locks along wih the user associated with that lock in SQL Server 2008? 1:select * from sys.dm_tran_locks will list all current locks, granted or pending, along with the requesting session id. select *

integrating a discourse message board with an existing rails site

integrating a discourse message board with an existing rails site

I'm looking at integrating a message board for a site I'm developing in rails. The new discourse board looks interesting http://www.discourse.org/ but there isn't much information about integrating into another site either via oauth2 or sso

Python: finding lowest integer

Python: finding lowest integer

I have the following code:l = ['-1.2', '0.0', '1']x = 100.0for i in l: if i The code should find the lowest value in my list (-1.2) but instead when i print 'x' it finds the value is still 100.0Where is my code going wrong? 1:To find

Table layout panel scroll bar

Table layout panel scroll bar

given a table layout panel with 2 columns and many rows, how can i attatch a scroll bar to it as sometimes it grows much greater than the size of the form .Thank you 1:The TableLayoutPanel is an example of a ScrollableControl. You can th

Access parent window from User Control

Access parent window from User Control

I am trying to access parent window from user control. userControl1 uc1 = new userControl1();mainGrid.Children.Add(uc1);through this code I load userControl1 to main grid.But when I click on a button inside userControl1 then I want to load

No plugin found for prefix 'jetty' in the current project

No plugin found for prefix 'jetty' in the current project

I have added jetty mvn plugin code in my project pom.xml. org.mortbay.jetty maven-jetty-plugin 6.1.26 /redkites start-jetty deploy run 10 true When I use commands s

Jquery to get the name of the current html file

Jquery to get the name of the current html file

If you are on http://www.cnn.com/2012/11/09/opinion/brown-pakistan-malala/index.html can you get Jquery to grab the index.html?or if you are on http://www.washingtonpost.com/politics/decision2012/supreme-court-to-review-key-section-of-votin

how to change jQuery autocomplete plugin default querystring key? (term to that i want)

how to change jQuery autocomplete plugin default querystring key? (term to that i want)

jQuery autocomplete plugin sent request like thismysite.com/suggestion?term=Sadeghis there any way to change term querystring key to another? i can't find option that provide this for me ;) 1:I assume you're using jQuery UI AutoCompleteY