DevHeads.net

Postings by leam hall

"90 Day Wonder" Mentoring

Having a mentor helps you grow much faster than just consuming a book or
video. Insightful feedback pushes you to learn faster. Mentors have long
been a strength of the coding community.

Except for those of us who don't work in a coding shop, or we're doing a
language/skill no one at work knows or cares about. IRC is good for fast
answers but not as helpful for long term growth.

A few years ago I ran a "90 Day Wonder" mentoring program. We took a
book and worked through it together. Since I wasn't a subject matter
expert I enlisted smarter people to help.

"Well used built in classes and modules" for Ruby Certification Exams?

The Silver Certification exam references:

"Well-used built-in classes and modules (e.g., Object, Numerical
classes, String, Array, Hash, Kernel, Enumerable, Comparable)"

The Gold Certification exam references:

" Well-used built-in classes and modules
(e.g., Object, Module, Kernel, Enumerable, Comparable)
Numeric
Regular expression
Proc
Thread/Fiber"

Besides the ones specifically listed, which built in classes and modules
are considered "well used"?

Thanks!

Leam
-- Setting up for more Ruby in 2018!

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subje

Rakefile issue with Travis-CI

Probably Operator error.

Possible bug in updating glibc?

Hey all, not sure if this was operator error or what.

I'm running a KVM host on updated CentOS 6. The guest is built from the
CentOS 6.9 dvd1 with just @base and @core package groups.

When I went to install mysql it failed due to incompatibilities with the
libcc versions. Updated just glibc and glibc-common and then installed
mysql. Shortly there after it started to freeze and lost connection.

The KVM host is fairly beefy and mysql wasn't doing anything but running
with no queries or data.

Windows and Ruby?

Wuby?

It looks like the Installer issue has been taken up by some new folks,
cool. Still, it begs the question, is almost everyone doing Ruby doing so
on a non-Windows platform like Linux, Mac, or other *nix?

Leam

Confused on testing a Class as a Key in a Hash.

Actual code:
<a href="https://github.com/LeamHall/CT_Character_Generator/blob/master/test/tc_Citizen.rb" title="https://github.com/LeamHall/CT_Character_Generator/blob/master/test/tc_Citizen.rb">https://github.com/LeamHall/CT_Character_Generator/blob/master/test/tc_C...</a>

Trying to figure out why I can't compare a Hash key to it's value. The
key is a Class but if I use hash.each_key or each_pair it shows the key
and value. If I try to assert that hash[key] == value, it fails.

Besides a brain, a clue, and a life, what am I missing?

Thanks!

Leam

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Testing a written file?

This is the meat of a test I'm writing. The end state is that the test will
read a file another method has written. The goal is to test the writing
method. is there a better way? Should testing the nameserver IP addresses
go in a different test?

Yes, I'm probably doing a lot more testing than necessary.

to_i and to_s issue.

Trying to run a test to see if a to_i conversion in a method gives a
different string when converted back via to_s. The theory is that the
original_ip is the passed in a numeric only ip string. Unfortunately the
test fail thinking that "45" does not equal 45.to_s.

What am I missing, besides a brain, a clue, and a life? Is there a better
way to check?

How to share a ruby program without installed Ruby?

How do I take Ruby code and package it so I can give it to a Winderz or mac
user and they can run it without having to install Ruby? I would assume the
binaries would be different, but doable.

Thanks!

Leam

RubyTk and segfaults

Working with Ruby 2.4.0 and trying to see why it keeps seg faulting. I
saw an issue.

Ruby Jobs that are not Rails?

Not trying to cause an issue, but wondering what sorts of Ruby jobs there
are that are not Rails. Even Puppet seems to have moved away from using
Ruby directly.

SQLite update works in one file, fails in another.

In the second file, the save_characters() method fails to update the
database unless the upp string is manually set like:
upp = "777777"

If I edit the entry value it will print the new value, but not update.
If I use the same code in another program it works.

Generic class/design pattern question

I'm re-working old code from early efforts of learning Ruby. Now I'm trying
to get more OOP'ish and maybe figure out design patterns if they are
appropriate. I'm stuck on what do do with the "Career" concept.

Program design is pretty simple; there's a Class "Character" that stores
attributes of a Traveller RPG character.

Is $LOAD_PATH used for 'require "some_file"?'

Currently working on Winderz trying to figure out why

require "some_file"

Fails but

require "./some_file"

works. The $LOAD_PATH includes the directory the files being run and loaded
are in. Hit this issue on Linux as well, not sure if it's operator error or
what.

Why does require need the "./" to find a file in the $LOAD_PATH?

Thanks!

Leam

How do you references database dirs in a gem?

The code I have works by making DATA_DIR from a relative path. When I
put that in a gem it fails to find the database. This is my first gem,
anyone have a good tutorial on how to make portable code find the
database, when the code goes from ${HOME}/<project> to
/usr/lib/ruby/gems/etc/etc/etc...

Thanks!

Leam

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

First Gem fails to install

Ruby 1.8.7 on CentOS 6.

# As user
gem build ct_character_generator-0.0.1.gemspec
WARNING: no description specified
WARNING: no rubyforge_project specified
WARNING: deprecated autorequire specified
Successfully built RubyGem
Name: CT_Character_Generator
Version: 0.0.1
File: CT_Character_Generator-0.0.1-unknown.gem

# As root
gem install CT_Character_Generator-0.0.1-unknown.gem
ERROR: While executing gem ...

Nokogiri on Windows 7?

Anyone installed Nokogiri on Windows 7? I have fresh vanilla installs of
Ruby 2.2.6, nokogitri 1.7.0.1, mini_portile2-2.1.0, and RubyInstaller, When
I try to gem install nokogiri it bombs, mkmk.log below.

Thanks!

Leam

####

"gcc -o conftest.exe -IC:/Ruby22/include/ruby-2.2.0/i386-mingw32
-IC:/Ruby22/include/ruby-2.2.0/ruby/backward -IC:/Ruby22/include/ruby-2.2.0
-I.

Right classes and modules for use cases?

My character generator does the basic task and I want to expand it.
Since my experience has been with very small projects I'd like your
advice on scaling up well; the project is my path for learning more Ruby
and OOP.

Excellent Ruby code to read?

I keep seeing suggestions to read excellent Ruby code. Best suggestions
where to look? I'm interested in Ruby itself.

Thanks!

Leam

ipv6 validator

Any good ways of improving this as an ipv6 validator? Calling scripts
assume it's valid unless nil.

Leam

####

def self.ipv6(ip)
return nil if ip.match(/:::/)
ip_array = ip.split(":")
return nil if ip_array.count > 8 or ip_array.count < 1
ip_array.each do |octet|
return nil if octet.length > 4
return nil if octet.match(/[^[:xdigit:]]/)
end
return ip
end

####

What to do when object has lots of attributes?

N00bie question. I'm working on a Class that has lots of attributes that
can be set or get. I've been using attr_accessor but am wondering if
there's a better way to store data. At this point I'm looking at two or
three dozen attributes and being extended as needed.

Thoughts?

Leam

Is there a Ruby mentorship program anywhere?

I am learning by readying the Pickaxe book and "The Ruby Way". My code
seems to be mostly working but it still looks a lot like my BASH code.
I'm trying to find some guidance on how to better use Ruby as Ruby.

Would prefer an "every week or so" e-mail conversation so we can avoid
global scheduling issues.

Any good Google search terms? Using "ruby" and "mentor" quickly dives
into Rails and Ruby Tuesdays. :)

Leam

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Using object's class in case statement?

I'm trying to use an object's class in a case statement.

How to Test::Unit a module that prints?

Some of the things I am writing print to STDOUT. How do you put that into a
test case for Test::Unit?

Thanks!

Leam

SQLite error just now showing up?

I'm getting the following error:

/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/sqlite3_api.so: warning: global
variable `$swig_runtime_data_type_pointer2' not initialized

What is more odd is that the Ruby and SQLite versions haven't changed and I
don't mess around with the Gem configurations. This error is new but the
database code calling sqlite3 hasn't changed for several months.

Any ideas on where to look?

Thanks!

Leam

Design review for classes and mixins

I've been refactoring a class as I re-read "Practical Object Oriented
Design in Ruby". Moving from "one class to rule them all" to as much
decoupling as possible. Looking for some critique of my new design.

<a href="https://github.com/LeamHall/CT_Character_Generator/tree/refactor_character" title="https://github.com/LeamHall/CT_Character_Generator/tree/refactor_character">https://github.com/LeamHall/CT_Character_Generator/tree/refactor_character</a>

The base class, Character, stores various attributes about a Traveller(tm)
character. Stats, age, skills, etc. Right now the plan is to store that in
JSON.

There are a couple of Modules I'm working on. One (Traveller.rb), sort of a
Factory, that can set or change attributes.

Statement vs expression

In "The Ruby Way" (2nd) Hal Fulton states "Ruby is an
expression-oriented language. Why use a statement when an expression
will do?"

I though statements and expressions were the same, that is "a = b + c".
Pointer to an explanation?

Thanks!

Leam

Mentoring?

Hey all,

The PHP community has a mentoring website, <a href="https://phpmentoring.org" title="https://phpmentoring.org">https://phpmentoring.org</a>. Does
the Ruby community have something similar?

I'm trying to move from "just the basics" to better pure Ruby. No Rails,
not a lot of gems, just the core OS. I can get almost everything I want to
get done with that and some JSON and a little Nokogiri.

One of the real challenges for me is learning to go from the very small
stuff to the decently sized stuff and not get too lost along the way. Of
course, I'm also the guy stuck on Ruby 1.8. :)

Leam

Need help designing a cladd

Hey all,

Again, I'm an OOP newbie. For the gaming stuff I'm working on I'd like to
push my class skills a little further. In this case I'm trying to create a
class that will let me work with weapons in the game. I have done a short
set of notes on what factors I'm looking at. What I do not know is how to
build the class itself.

Suggestions?

<a href="https://github.com/LeamHall/CT_Character_Generator/blob/master/docs/equipment.txt" title="https://github.com/LeamHall/CT_Character_Generator/blob/master/docs/equipment.txt">https://github.com/LeamHall/CT_Character_Generator/blob/master/docs/equi...</a>

Thanks!

Leam

Old issue with Minimal ISO

Sorry if I'm on the wrong list. I got bit by Bug 5589 (
<a href="https://bugs.centos.org/view.php?id=5589" title="https://bugs.centos.org/view.php?id=5589">https://bugs.centos.org/view.php?id=5589</a>). It's a couple years old and
looks to be a simple fix. Anything I can do to help?

Leam