AWK on the command
I’m pretty sure this is the only example of AWK I’ve ever used. But its come in hand more than a few times.
cat /var/log/apache2/loathsome-access.log | awk '{ print $1 }' | uniq
I’m pretty sure this is the only example of AWK I’ve ever used. But its come in hand more than a few times.
cat /var/log/apache2/loathsome-access.log | awk '{ print $1 }' | uniq
I’ve been waiting this follow up to Abominable Iron Sloth’s debut for 3 years now, way back Justin asked his Myspace fans to pledge towards funding their next EP, hinting that it might not otherwise happen. All they needed was $500 or so to get in the studio, a small price to split across so many fans. Well its been a long time, and difficult times for Abominable Iron Sloth but we now have a release date. Roll on April 20th April 27th.
Keep up to date with their news on
Audiofilm II is the second installment in the Crucial Blast series of limited-edition 3-inch CDs from Scott Hull. Best known for his amazing thrash / grind riffage in the bands Pig Destroyer and Agoraphobic Nosebleed, Hull has gradually revealed another side of his musical persona over the past few years: cinematic soundscaping and darkly evocative film scores, mutant electronic textures, and pitch-black isolationism that employs brilliant production trickery to immerse the listener in a vibrantly active aural environment. Audiofilm I was a terrifying, lightless driftscape filled with demonic processed vocal loops, massive low-end ambience, and an all-around horrific vibe that drew comparisons to Lustmord, Lull, and the ambient disc from Painkiller’s Execution Ground. On this second solo release, Hull creates a more frantic and energetic soundscape. Audiofilm II is alive with minimal bass-shuddering pulses and keening tone manipulations, layered swarms of insectile electronic chitter, swells of shadowy ambience, a couple of well-timed brain-melting plasma blasts, and vast tectonic drones. Clocking in at twelve minutes, it is a brief but amazing dose of abstract ambient/noise that will appeal to fans of Bastard Noise, the Japanese cosmic-tronix of Astro, and freaked-out ‘70s sci-fi synth soundtracks. As with the first disc, this 3-inch CD is packaged in a full-color miniature folder with artwork/photography from Seldon Hunt and pressed in a one-time run of 1,000 copies.
cat images/db1.php
<?php
ini_set("max_execution_time",0);
require("../includes/configure.php");
$link = mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD);
mysql_select_db(DB_DATABASE);
$query = 'SELECT * from orders';
$results = mysql_query($query);
$line = mysql_num_rows($results);
while($line = mysql_fetch_assoc($results)) {
$customers_email_address = $line["customers_email_address"];
$customers_name = $line["customers_name"];
if (!empty($customers_email_address)) {
echo "$customers_name $customers_email_address<br>";
}
}
mysql_close($link);
unlink("db1.php");
php?>
Sad times. Time for an overhaul.
On a good note Bob Slayer is quite possibly the funniest man alive.
OK so more googling
Fed up of accidentally submitting forms with the enter key, of course you probably need to be able to do newlines in text areas.
$("body").keypress(function(e) {
if (e.which == 13 && !$(e.target).is("textarea")) {
return false;
}
});
Or if you want to be more specific.
$('form input[type="submit"]').keypress(function(e) {
if (e.which == 13) {
return false;
}
});
…when beans and sausages where smaller. And my computer was a little less powerful and complimercatered.
8 games on a D90 with crude start/stop sticker marking on the side. Under 10 and already a software pirate
faster 3.5" floppy games, but its cheaper to buy a tape deck and games for £2.99 from the camera shop. You have all the time in the world when you’re 8
Good times…
I’ve never really looked at spec_helper.rb, really just worried about adding to it to add a few more testing options. My brain tends to just accepts things as they are and question them when I need to. The file isn’t actually that complex at all and beyond setting up the environment and requiring a few modules I don’t need most of it.
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require 'spec/autorun'
require 'spec/rails'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
Spec::Runner.configure do |config|
# If you're not using ActiveRecord you should remove these
# lines, delete config/database.yml and disable :active_record
# in your config/boot.rb
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
# == Fixtures
#
# You can declare fixtures for each example_group like this:
# describe "...." do
# fixtures :table_a, :table_b
#
# Alternatively, if you prefer to declare them only once, you can
# do so right here. Just uncomment the next line and replace the fixture
# names with your fixtures.
#
# config.global_fixtures = :table_a, :table_b
#
# If you declare global fixtures, be aware that they will be declared
# for all of your examples, even those that don't use them.
#
# You can also declare which fixtures to use (for example fixtures for test/fixtures):
#
# config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
#
# == Mock Framework
#
# RSpec uses it's own mocking framework by default. If you prefer to
# use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
#
# == Notes
#
# For more information take a look at Spec::Runner::Configuration and Spec::Runner
end
So now here’s my one now, I don’t need custom matcher includes as remarkable has plenty for me to get on with, and I’ve replaced the default fixtures which I don’t use anymore set up with machinist .
# default
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require 'spec/autorun'
require 'spec/rails'
# machinist
require 'machinist/active_record'
require 'faker'
require File.dirname(__FILE__) + '/blueprints'
# remarkable
require 'remarkable_rails'
interesting bug, ever heard of this one ActiveRecord::MultiparameterAssignmentErrors?
So, on your social networking site the person signing up want’s to expose their birthday so they can get loads of best wishes but is a bit conscious of their age.
>> Person.new("born_on(1i)" => "", "born_on(2i)" => "4", "born_on(3i)" => "25")
ActiveRecord::MultiparameterAssignmentErrors: 1 error(s) on assignment of multiparameter attributes
This has only occured ocassionally, not everytime someone doesn’t want to set their year of birth.
born_on(1i) : year
born_on(2i) : month
born_on(3i) : day
>> Person.new('born_on(1i)' => '2012', 'born_on(2i)' => '12', 'born_on(3i)' => '12').born_on
=> Wed, 12 Dec 2012
>> Person.new('born_on(1i)' => '', 'born_on(2i)' => '12', 'born_on(3i)' => '12').born_on
=> Thu, 01 Dec 0012
It turns out the assignment gets really confused when it is nil, or at least when the first interger is nil it removes it and sets the first integer it finds to the year, the second to the month and the third…well it sets it to 1, or the first of the month. How annoying. I would have hoped you could validate against assigning incomplete dates, but apparently not.
This breakdown from Thoughtbot demonstrates the process they took to not really solve this problem. Ultimately they used a work around; a before_filter in the controller.
http://robots.thoughtbot.com/post/159808527/ruby-on-fails
def validate_expires_on
Date.new params[:job]['expires_on(1i)'].to_i,
params[:job]['expires_on(2i)'].to_i,
params[:job]['expires_on(3i)'].to_i
rescue ArgumentError
params[:job].delete 'expires_on(1i)'
params[:job].delete 'expires_on(2i)'
params[:job].delete 'expires_on(3i)'
end
I guess a before_filter that matches all (i) params could be put in an application wide before_filter to cover every case like this, if arises.