I was doing some research on caching reverse proxies - related to some REST stuff. I figured I’d end up at Squid - since it seems like the standard for this sort of thing. Then I hit an article that got me to
Varnish was written from the ground up to be a high performance caching reverse proxy. Squid is a forward proxy that can be configured as a reverse proxy. Besides - Squid is rather old and designed like computer programs where supposed to be designed in 1980. Please see ArchitectNotes for details.
I have no idea how well it works but two things: The first was funny - the second interesting
From the FAQ:
Does Varnish require the system to have a C compiler? ¶
Yes. The VCL compiler generates C source as output, and uses the systems C-compiler to compile that into a shared library. If there is no C compiler, Varnish will not work.
.. Isn’t that security problem? ¶
The days when you could prevent people from running non-approved programs by removing the C compiler from your system ended roughly with the VAX 11/780 computer.
The second was a discussion about how Squid’s basic architecture is simply wrong for the problem it is trying to solve.
Take Squid for instance, a 1975 program if I ever saw one: You tell it how much RAM it can use and how much disk it can use. It will then spend inordinate amounts of time keeping track of what HTTP objects are in RAM and which are on disk and it will move them forth and back depending on traffic patterns.
Well, today computers really only have one kind of storage, and it is usually some sort of disk, the operating system and the virtual memory management hardware has converted the RAM to a cache for the disk storage.
So what happens with squids elaborate memory management is that it gets into fights with the kernels elaborate memory management, and like any civil war, that never gets anything done.
When I have more time looks like something i’m going to have to try out…
Testing flash.now with RSpec - Xavier Shay’s Blog
This turned out to be the simplest way I could find to easily test flash.now - my only addition was a simple helper method
def keep_flash_now
@controller.instance_eval { flash.extend(DisableFlashSweeping) }
end
It makes it easier to understand what is going on in thest.
Ok so I’ve been dealing with an old app for the last two weeks. It is woefully out of date (several libraries are behind - not the least of which being rails). And it looks like at some point I threw discipline out the window and added some stuff without writing tests (before or after adding in the code).
On top of all of that, I’m back in the guts of it because I need to add a pretty major new feature - and the state of the code has me running for the hills.
I got all the tests to pass last week - but doing some coverage analysis I found that there are big sections of the code that are not tested at all. (Yes I know 100% coverage doesn’t mean 100% bug free - but it will generally alert you to the obvious bugs).
In the process, I was trying to get Rcov to sort some of the results for me so I can focus on the worst offenders. In the process of figuring out how to do that I stumbled on Metric Fu.
Metric_fu is a set of rake tasks that make it easy to generate metrics reports. It uses Saikuro, Flog, Rcov, and Rails built-in stats task to create a series of reports. It’s designed to integrate easily with CruiseControl.rb by placing files in the Custom Build Artifacts folder.
It’s really cool - basically it not only made it seriously easy to sort out the coverage stuff and works well with Rspec. It also showed me some new tools for finding other code smells. It alerted me to a particularly nasty controller method that is apparently doing a hell of a lot more than a controller method should do.
The coolest part of this is that not only is it a neat tool - but I actually know this guy. We worked together on a project a year and a half a ago. Small world I guess.
Thanks to Cory’s tip about looking for Iframes and changing my passwords - it looks like google no longer considers me a threat to the universe….
Currently I’m grinding through the process of translating my old unit tests on a project into much nicer Rspec tests. Over all it has been a good experience. Especially since I caught some things in the process that the old tests didn’t cover.
So I started on new controller and I wrote something like this:
describe "My Cool Test" do
before(:each) do
@obj = String.new
puts "Hello"
@obj.should_receive(:stupid_method).once
end
it "should do something"
it "should do something else"
it "should not do this"
end
The object never calls stupid_method so it should fail the expectation right?
Well it turns out that although the begin is executed - because all of the examples are pending! If you run the above code you’ll see “Hello” several times - but no error.
Now add in the following example:
it "should be empty" do
@obj.should == ""
end
You’ll get:
Spec::Mocks::MockExpectationError in ' My Cool Test should be empty'
Mock 'String' expected :stupid_method with (any args) once, but received it 0 times
So there you go - (And don’t worry I submitted a bug)
You may be wondering why I said triggers a lot of work - well I’m currently using the Rspec mock library. I was very close to switching to mocha - which would have meant modifying a heck of a lot of tests.
From the search in the google…..
Economy Size Geek
This site may harm your computer.
www.economysizegeek.com/ - Similar pages - Note this
Bummer… I’ve scheduled a review - but still waiting them to clear me.
Ok I’ve been busy lately (by lately I mean since 2.2 came out). I got a note a while ago from a friend about a problem with my RSS feed - didn’t think much about it. Then today I got an email from another friend who is trying our firefox 3 - it has a plugin that warns you when you visit a site that has malware. Apparently, my site is listed as a malware site…..
It turns out there was a hole in WordPress at some point that let them inject javascript and whatnot into the posts. They were hiding a bunch of it - but it showed up in the RSS.
I think I’ve cleaned out the bad posts (If you see one let me know), I’ve cleared out the back log of comments (all 25K of them), and updated to 2.5.1 - which is the latest and greatest - oh and it has security fixes for 2.5 (just released recently).
The only annoying thing is that every time I do this I have to deal with putting back in my patches to WordPress. I’m going to to give git a whril on this problem to see if it helps.
Also I noticed that some people are having problems with Postie on 2.5.x - I didn’t notice because I wasn’t running 2.5 - but since I am now - I’ll be fixing whatever the main problem is since I still need Postie to work.
Michael Ivey / Contributing to Merb (Part 1) (git, merb)
This is an intro to submitting code to the Merb project. That isn’t what caught my eye. What is really nice about this short write up is it shows you how you can branch off to do your own thing, and still keep up with the main trunk you branched off of. For those times when it takes you a little bit longer than you thought to get your feature wrapped up so it can be merged back onto the head.
Ok so I’m a little annoyed - more so because I figure my complaint is unlikely to be fixed. You see I own a kindle. So far I haven’t met any others - not entirely surprising - I was the only person I knew with a PSP for a while too.
I had both a Kindle and a Sony Reader. I read a lot and wanted to figure out which was the best one. I sold off the reader - the kindle is awesome. So far I’ve finished 6 novels, a mix of short stories, and a couple of reads through some serious tech pdfs I had laying around.
Enough with the gushing - the complaint - the whispernet doesn’t work outside of the US! I haven’t tested Canada, but I didn’t have connectivity in London or Mexico. I wasn’t entirely surprised about London. I thought it would be unlikely to work. Mexico, on the other hand, was a bit of a surprise. I was even more annoyed because I was actually on vacation and reading like a fiend and I finished book 2 of a 4 book series and really needed book 3 - which I couldn’t have. I hadn’t bought it was because I wasn’t sure a) book 2 would be as good as book 1 and b) I didn’t think I’d finish book 2 on the trip. (Which is another cool thing about the kindle my reading speed on it is seriously faster than my normal paper speed.)
Of the X number of Kindle owners (Amazon has not mentioned sales numbers as far as I’m aware - just shortages) - I wonder what percentage travel outside the US? Even if it is a big number I’m willing to bet they aren’t going to fix it - guess I’m just stuck stocking up before I hop on my next international flight.