Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

range

Russia's Designing a Deadlier AK-47 [Guns]
Tuesday, 28 February 2012 22:00
The AK-47 has been one of the most widely-used weapons in the world since its inception in the 1940's. However, as the battlefield of the 21st century demands ever-greater degrees of accuracy, the Kalashnikov's 350m range is no longer effective. That's why Russia is giving the "world's most dangerous weapon" a deadly new makeover. More »


Read more: http://feeds.gawker.com/~r/gizmodo/full/~3/YITtm-2937c/russias-designing-the-ak+47s-successor-right-now

 
Odometer-like Brute Force Counter in C
Wednesday, 04 May 2011 17:21
// Given a sorted set of digits, print all of them in counting order.
// digits[] - the set of digits allowed. They are assumed to be in the set {0-9}, but it will work with larger numbers as well.
// range - the length of the resulting number (i.e., how many digits to print)
// numDigits - the size of the set of digits represented by digits[]
//
// There are probably slicker ways to do this: see http://stackoverflow.com/questions/228796/algorithm-odometer-brute-force
// but this one is fast.


int odometer(int digits[], int range, int numDigits) {
int index[range];
memset(index, 0, sizeof (index));
int result[range];
memset(result, 0, sizeof (result));
int x; //, tempindex;

/* initialize result to the first digit */
for (x = 0; x < range; x++) {
result[x] = digits[index[x]];
}

/* go to the right-most digit in result */
int p = range - 1;

bool done = false;
while (!done) {
for (x = 0; x < range; x++) {
printf("%d ", result[x]);
}
printf("\n");

if (result[p] < digits[numDigits-1]) {
result[p] = digits[++index[p]];
} else {
/* move left until you find a number < greatest digit */
while (p >= 0 && result[p] == digits[numDigits-1]) {
--p;
}
if (p < 0) {
done = true;
} else {
result[p] = digits[++index[p]];
while (p < (range-1)) {
p++;
result[p] = digits[0];
index[p] = 0;
}
}
}
}

return EXIT_SUCCESS;
}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/ciKtdbaNV3U/13187

 
Generate test data in Rails where created_at falls along a Statistical Distribution
Friday, 31 December 2010 13:14

# http://stackoverflow.com/questions/3109670/generate-random-numbers-with-probabilistic-distribution
# http://rb-gsl.rubyforge.org/files/rdoc/randist_rdoc.html
# http://rb-gsl.rubyforge.org/files/rdoc/rng_rdoc.html
# http://www.gnu.org/software/gsl/manual/html_node/Random-number-generator-algorithms.html#Random-number-generator-algorithms
# http://rb-gsl.rubyforge.org/files/rdoc/randist_rdoc.html
# http://www.gnu.org/software/gsl/manual/html_node/Random-Number-Distributions.html
# http://rb-gsl.rubyforge.org/files/rdoc/hist2d_rdoc.html

# Install gsl scientific library
# brew install gsl
# gem install gsl



require 'rubygems'
require 'gsl'

# generate_time_plot :duration => 10.days, :interval => 6.hours, :count => 100, :range => [-2, 2]
def generate_time_plot(options = {})
distribution = options[:distribution] || :gaussian
count = options[:count]
duration = options[:duration]
interval = options[:interval]
bins = duration.to_i / interval.to_i
min_max = options[:range] || [-5, 5] # not sure how this works yet, or what good numbers are

range = GSL::Rng.alloc(GSL::Rng::TAUS, 1)
sigma = 1.0
histogram = GSL::Histogram.alloc(bins, min_max)

for i in 0...count do
histogram.increment range.send(distribution, sigma)
end

bins.times.map { |i| histogram.get(i) }
end

puts generate_time_plot(:duration => 10.days, :interval => 6.hours, :count => 100, :range => [-5, 5]).inspect
# => [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 6.0, 7.0, 9.0, 8.0, 12.0, 7.0, 15.0, 11.0, 4.0, 5.0, 3.0, 4.0, 1.0, 3.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]



def plot(options = {})
generate_time_plot(options).each_with_index do |data, index|
x = options[:start] + (options[:interval] * index)
y = data
yield options.merge(:x => x, :y => y, :index => index)
end
end

plot(:start => 1.month.ago.to_time, :duration => 10.days, :interval => 6.hours, :count => 100, :range => [-5, 5]) do |column|
next if column[:y].zero?

column[:y].to_i.times do
# https://github.com/harvesthq/time-warp, copied and modified below
Time.is_within(column[:x], column[:x] + column[:interval]) do
puts Time.now.to_s
# generate test data here... User.create!
end
end
end



if !Time.respond_to?(:real_now) # assures there is no infinite looping when aliasing #now
Time.class_eval do
class << self
attr_accessor :testing_offset

alias_method :real_now, :now
def now
real_now - testing_offset
end
alias_method :new, :now

def is(time, &block)
begin
Time.testing_offset = Time.real_now - time
yield
ensure
Time.testing_offset = 0
end
end

def is_within(start_time, end_time, &block)
is(start_time + rand(end_time.to_i - start_time.to_i), &block)
end
end
end
end

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/S9Dd4-pT-fU/12793

 
ExposeIP 3.7.5
Monday, 01 November 2010 04:00
About ExposeIP
Searches through a range or specified range of a given IP or IPs for specific active services, previously selected by the user. For example it searches the IP range for active Mail, FTP, Web, Gamers Servers or any other service that the user wants to expose, trace, or find.

- Specific IP ranges
- Local networking info
- Remote/local port scanning
- Statistical pinging
- TraceRoute
- Convenient Start/Stop Firewall actions
- Root DNS Statistics
- Prevent (invisible).DS_Store files over Networks

Read more: http://www.apple.com/downloads/macosx/networking_security/exposeip.html

 
Random Number Within a Range
Thursday, 14 October 2010 04:30
This function returns a random number within a range.

myRandomNumber = computeRandomNumber(rangeLow, rangeHigh);

int computeRandomNumber(int l, int h) {
int randNumber;
int range = h - l;
randNumber = rand() % range + l + 1;
return randNumber;
}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/yO_raE-U6Dc/12485

 


Taxonomy by Zaragoza Online