Recently my parents had some friends visit. They had a laptop with them and asked to use the internet. We’ve not problem with that so let them connect…. except when they connected they were running a peer-to-peer file sharing program.
If you’re here, you probably know what that is. A way of sharing large files by turning it into lots of small pieces and allowing all the people who that file to share a little piece with you, until you have the whole file. Then you can share your little pieces with other users.
The advantage of peer-to-peer file sharing is the originators don’t need to have and pay for a server with lots of capacity. Used properly it’s a great idea. In the past I’ve downloaded and shared Ubuntu and OpenOffice files this way.
My parents house is connected to the internet via our office. I was trying to set up a server and getting very confused as to why my connection kept dropping. It was making a difficult task impossible. I noticed other things like web pages taking longer than usual, or being sometimes fast and sometimes slow. I check the router and realised what was happening, so I blocked my parents guest completely.
That wasn’t enough to solve my problems though. I eventually gave up setting up the server and did it from home in the evening. The problem with torrents is the computers looking to you for little pieces ask for them hours after you’ve stopped advertising they can have them. This screen shot showed my problem clearly – this was taken AFTER I’d blocked the computer at 10.18.6.56. Essentially they’d invited DoS attack. 11,000 incoming connections was more than enough to ruin our ADSL connection for everyone else on the network.
Sure, we could still email, see web pages slowly, but everything was so much harder than it needed to be.
Moral of the story: If you’re a guest with us, please turn off any torrent software before you connect.
Mac OS continues to keep me happy. Sure, it has it’s faults but I just needed to capture my screen to file a software bug report. I could have explained step by step by typing but sending a video file is so much simpler. Except, I hadn’t done it on my Mac before. A quick google lead to a page of results of screen capture applications. Most cost money, a couple of open source solutions… I was reluctantly expecting the need to invest in more software. Then I noticed another search result that basically said – ‘use Quicktime Player’… and I thought.. I have that – it’s comes built in to OS X!
I never realised, quicktime as supplied with the Mac (and maybe with windows, I never looked when I used it before) has an option to capture video of your screen. Giving the option of the whole screen, or just a section of the screen you select. Just what I was looking for to file the report with an example the developer could see happening.
Perfect. Simple. Life is good…. or it will be better once that bug gets fixed.
Returns the file name and the line with the matching string, like:
./app/controllers/spree/admin/satisfies_controller.rb: class Spree::Admin::SatisfiesController < Spree::Admin::ApplicationController
So, my constant that caused the error is located in app/controllers/spree/admin/satisfies_controller.rb
The command is made up like this:
grep = grep is a command-line utility for searching plain-text data sets for lines matching a regular expression
-r = recursively search all the sub directories
'Spree::Admin::Application' = The Needle = the string you want to search for, I enclose in apostrophes, I think you can use speech marks etc. You can also use a regular expression to match things
. = The Haystack = Where you want to search, using just a dot means search every every file.
grep can do much more, read the man file (grep man) or google for more ideas. The other cool thing I do all the time is use grep to extract data from a log file and output it to another file. For example;
grep '111.222.333.444' apache.log > analyse.txt
Here, any log line that has '111.222.333.444' will be copied into the file analyse.txt. This is an IP address, but it could just as easily match dates, pages, referrer strings and so on.