from turtle import *
# Takes a polygon p and returns its perimeter
perim = 0 # perimeter
numPoints = len(p)
for i in range(numPoints): # for the P above, i will count 0, 1, 2, 3
perim = perim + EKdistance(p[i], p[(i+1)%numPoints])
# finds the distance between points p and q
# p and q are both tuples p=(0,3) q=(1,5)
def EKdistance(p, q):
sumDet = 0
numPoints = len(P)
for i in range (numPoints):
sumDet = sumDet + EKdet(P[i], P[(i+1)%numPoints])
if sumDet < 0:
I couldn’t help myself.
In case you haven’t seen it, the xkcd comic for today plays on the weird configurations we programmers apply to our personal computers. The mouseover text reads: “If used with software that could keep up, a scroll wheel mapped to send a stream of ‘undo’ and ‘redo’ events could be kind of cool.” Well, as it turns out, Vim can “keep up.” All it takes is these two commands:
map <ScrollWheelDown> :undo<CR>
map <ScrollWheelUp> :redo<CR>
Put those in your
.vimrc or run them as commands and watch as using the scroll wheel or two-finger trackpad scroll cycles through your history. Enjoy!
Fun fact: the comic alludes to mapping caps lock to control, which is something that Emacs users actually do. Vim users are more partial to mapping caps lock to escape.
Last week, I gave a presentation on learning LaTeX to interested UD students as an activity of our ACM Student Chapter. The presentation aimed to cover everything necessary to write a paper or lab report in LaTeX, while also touching on aspects useful for math homework. Fittingly, I created a slideshow using LaTeX (specifically, the Beamer package) to streamline my presentation. Here is that slideshow, in PDF form. For best results, view it in full-screen single-page mode, or “presentation mode,” if your PDF viewer supports it.
Introduction to LaTeX
We won! The ACM Student Chapter just got the first place prize in Trunk or Treat. I’d like to thank everyone who volunteered to help out, especially Jack, who let us use his car even though he couldn’t be there himself, John Peter, who programmed the robot and dressed up like Darth Vader, and Ted Morin, who helped weaponize the robot and got costumes for the rest of us. Now we have $75 more for public events, so let’s start thinking about how we can use it!
A few months ago, I made a blog post called ‘How to be the guy in “git.txt,”’ referencing the mouseover text of a certain xkcd comic. Here I’d like to expand on that and provide more useful resources.
- First, read this tutorial. It discusses different workflows you might use with Git, building up from simpler to more complex workflows. It helps you to understand the idea behind what you’re learning before you really plunge into it.
- Next, I again recommend Pro Git, a free online book on how to use Git. You don’t have to commit to reading the whole thing, but just skimming the first 3 chapters can make you much more knowledgeable about Git.
- Search the web. Seriously. If you have a question about Git, chances are that someone has already asked it (on StackOverflow, probably). You can learn a lot just by wondering, “How do I do this in Git?” then looking it up. (This really goes for any programming tool.)
man git. I wouldn’t recommend using man pages to learn Git, but they are very useful as a reference. To view the manual page for a specific git command, for example,
git merge, use
git help merge.
- Lastly, I’ll leave you with a cheat sheet I found.