slideshow - return to 1st image
Return to 1st image on slideshow
How to remove duplicate values from an array in PHP How to run find -exec? I'd like to find the files in the current directory that contain the text "chrome".  $ find . -exec grep chrome find: missing argument to `-exec'   What am I doing wrong? JavaScript closure inside loops – simple practical example What's the best way to extend the User model (bundled with Django's authentication app) with custom fields? I would also possibly like to use the email as the username (for authentication purposes).  I've already seen a   to do it, but can't decide on which one is the best. In a perfect world, the so-important advice "do not reinvent the wheel" would be extensively followed. In practice, everyday millions of wheels are reinvented simply because someone didn't know an existing solution for a specific problem. The best way to find a library, today, is googling it, but it's not always obvious which keywords to use. The lack of a tool for finding solutions is very counterproductive for the dev world as a whole. Stack Overflow is not very receptive for recommendation threads. So what about a new SE for it? Does a photon exert a gravitational pull? I know a photon has zero rest mass, but it does have plenty of energy. Since energy and mass are equivalent does this mean that a photon (or more practically, a light beam) exerts a gravitational pull on other objects? If so, does it depend on the frequency of the photon? Macbook Pro hard drive failing? Any command that starts with $ returns  command not found   How can I fix this?  I am  using 16.10 Ubuntu. How do I bisect along an axis? Maybe I can't find the answer because I am not familiar yet with all the terminology. I know this is probably a simple answer but I cannot find it. How do I align the plane of a bisect along an axis?  I have an object that I want to bisect where 2 parts meet. The object is aligned to the platform and I want to make a cut through it the Z/Y axes.  Also... there is no tag for the bisect tool tar unpack : Unexpected EOF in archive I have downloaded eclipse-platform-3.7-linux-gtk-x86_64.tar.gz.  Using Ubuntu 10.10  64-bit on Intel 64-bit processor.  While trying to unpack the contents (either double-click or right-click &amp; open-with-archive-manager) I get this error:  gzip: stdin: unexpected end of file&lt;br/&gt; tar: Unexpected EOF in archive&lt;br/&gt;  tar: Error is not recoverable: exiting now   Is there any remedy to repair it? or is the downloaded file corrupt &amp; needs to be re-downloaded? Why girth of Petersen Graph is five? (Proof) I want to know, what is the mathematical proof that shows the shortest cycle in Petersen Graph has length five? It has come to the point in my computing program now where I have 5 swinging pendulums that are all modified at once by slider values. These values are drawn onto the from and passed through the class pendulum. To change the values the update button is run, and their is a default option to use a setup that works. The values are also shown on screen through some simple labels. The zero button sets all values (except length) to zero.  The values for each pendulum drawn is:   String length angle Acceleration (angular) Angluar velocity Damping or friction Gravity   My calcuations for these values: (Bob = the weight at the end of the string, and there are X and Y Co-ordiantes for it.  bobX = originX + (Math.Sin(angle) * length);         bobY = originY +(Math.Cos(angle) * length);   Caclulate Acceleration:  Angular Acceleration = (-1 * gravity / length) * Math.Sin(angle);    Increment Velocity:          Angular Velocity += Angluar Acceleration;   Increment Angle          angle += AngularVelocity;   Friction action, pendulum eventually 0's          AngularVelocity*= damping;   Now my next task is to make the pendulums collide "realistically" and recreate a newtons cradle type effect. I've looked into elastic collision solutions on particle e.g. here is an excellent example:    I've also looked at the raw physics behind it  but my brain couldn't get to grips with the raw physics side of things.  So I'm wondering if anybody could help me figuring out the theory for the collisions.  My current idea is when the co-ordinates meet the velocity will simply change polarity e.g. +10 to -10 in the opposing pendulum. Am I correct here?  If you are into code I've posted the code on stack overflow Why is the change in Hamiltonian for an active infinitesimal canonical transformation defined the way it is? I'm trying to understand infinitesimal canonical transformations and conservation theorems (section 9.6 Goldstein ed3). My specific problem is with understanding eq 9.104,         $\partial H = H(B) - K(A^{'}) $, where $\partial H$ represents the change in the hamiltonian under an infinitesimal canonical transformation (from the active view point ofc). The issue only arises for generating functions that explicitly depend on time.  Here's what I've thought of so far. I understand what $K$ is from the passive viewpoint (or so I think), its the hamiltonian that would furnish Hamilton's equations for the transformed variables $Q=q+ \delta q$ and $P = p + \delta p$. In the specific case of the generating function being a time dependent hamiltonian, $K = H + \delta t \frac{\partial H}{\partial t} = H + \delta t\dot H$, which makes sense because once you transform the variables to what they'll be in time $\delta t$, you'll also need to add on a term that comes from the Hamiltonian being at a later time $t+ \delta t$.   In the book, this is explained as a transformation depending on time changes the hamiltonian, so $H(A) \rightarrow K(A^{'}) $. Which I sorta get. But why not for $H(B)$? And what about the case when the Hamiltonian is time dependent and it is the generating function? Is $H(B)$ at a later time then?   Note: $A$ represents the original variables, $B$ is the transformed variables in the active sense, so in the same phase space as $A$, and $A^{'}$ is the same point as A but in the transformed phase space (passive). Deriving the inverse of a 2x2 matrix I am looking for a derivation for the inverse of a 2x2 matrix. I am also wondering why the determinant is involved in the expression. I am familiar with high school maths and linear algebra. If there is an intuitive reason for expression i would also be interested in that. Lost email settings and no icon for Mail I've lost my Settings → Mail, Contacts, and Calendars on my iPhone 5.  No icon for Mail and no Mail settings.  How do I get it back? I am a Physics undergrad, and just started studying Topology. How do you define neighborhood and open set in Topology.Wikipedia gives a circular definition.   An  is defined as follows.      In topology, a set  is called an open set if it is a neighborhood of every point    While a  is defined as follows:     If $X$ is a topological space and $p$ is a point in $X$, a neighbourhood of $p$ is a subset $V$ of $X$, which includes an open set $U$ containing $p$   which itself contains the term open set.  How do you define it exactly? Comparisons: "so [adjective/adverb] as" or "as [adjective/adverb] as" “have found” vs. “found” Buffering GeoJSON file using Python? I'm trying to perform a simple buffer on GeoJSON file using Python script. I am able to do it on a shapefile using Python script and on GeoJSON using QGIS fix distance buffer tool but I can't figure out how to do it on GeoJSON using Python script. I read many posts on it but none of them include working solely on GeoJSON. I also know that it is possible to convert GeoJSON to .shp but I need to work only with GeoJSON files.  My code that works for .shp file:  from osgeo import ogr  ds = ogr.Open(r'C:\vector files\tryyy.shp', 1) in_lyr = ds.GetLayer() out_lyr = ds.CreateLayer('new_buff44',in_lyr.GetSpatialRef(),ogr.wkbPolygon) out_lyr.CreateFields(in_lyr.schema) out_defn = out_lyr.GetLayerDefn() out_feat = ogr.Feature(out_defn) bufferDist = -0.00015075  for in_feat in in_lyr:      geom = in_feat.geometry()     out_feat.SetGeometry(geom)     for in_feat in in_lyr:          geom = in_feat.geometry().Buffer(bufferDist)         out_feat.SetGeometry(geom)         for i in range(in_feat.GetFieldCount()):             value = in_feat.GetField(i)             out_feat.SetField(i, value)         out_lyr.CreateFeature(out_feat)  del ds print "finish"   When I change the file from shp to geojson in the org.Open line I get:      NoneType' object has no attribute 'CreateFields'   I thought that if I read vector file as OGR datasource object then it doesn't matter which format is the original vector file.   Can someone help me understand what I should change so that the code will work on GeoJSON files? How to replace one char with another in all filenames of the current directories?