Counts the number of bits in an array. Assumes array of 8 bit values
def count_bits a
a.inject(0) do |total, n|
(0...8).each do |j|
total = total + ( (n>>j) & 0x01 )
end
total
end
end
Counts the number of bits in an array. Assumes array of 8 bit values
def count_bits a
a.inject(0) do |total, n|
(0...8).each do |j|
total = total + ( (n>>j) & 0x01 )
end
total
end
end
RPM version info:
rpm -qi zlib
rpm -q zlib --queryformat %{version}-%{release}
To create fake RPM's, use fpm...
If the RPM's were created correctly in the firstplace, then the epock should be set to 0. In the scenario below, the epochs had been set to the current unin time. Strangely, you can not just set it to 9999999999? You may need to employ different strategies to get the fake package to 'win' the version battle over existing rpm's:
mkdir -p /tmp/fake_package
fpm -s dir -t rpm -n grpahite -v 999999999 --epoch `date +%s` -f -a noarch -C /tmp/fake_package ./
fpm -s dir -t rpm -n logstash -v 0.0.1 --epoch `date +%s` --iteration 999 -f -C /tmp/fake_package ./
fpm -s dir -t rpm -n sensu -v 0.0.1 --epoch `date +%s` --iteration 999 -f -C /tmp/fake_package ./
fpm -s dir -t rpm -n uchiwa -v 0.0.1 --epoch date +%s
--iteration 999 -f -C /tmp/fake_package ./
When using rvm to install jruby on Ubuntu Trusty, you will need:
object UsingDemo { | |
def main( args : Array[String] ) { | |
using( new A() ) { a => | |
a.print("Hello World " ) | |
} | |
} | |
Circa 2010, when I saw this scala code snippet for the first time, my mind was blown at the possibilities...
object WhileDemo {
def main( args: Array[String]): Unit = {
var i = 1
While( i < 10 ) {
println( i )
i+=1
}
}
"Hello world".bytes.map { |b| b.to_s(2).rjust(8, '0') }.join.to_i(2).to_s(2).scan(/.+?(?=.{8}*\z)/).map {|s| s.to_i(2).chr}.join |
Cobol resources:
http://www.csis.ul.ie/cobol/examples/
The IDE works really well. It has syntax checking, and a built in list of key words.
gem install capybara | |
gem install selenium-webkit | |
irb | |
Capybara.register_driver :selenium do |app| | |
Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
end |