DevHeads.net

Postings by Philip Rhoades

Upgraded from F28 x96_64 XFCE Spin to F29 => rough audio

People,

I haven't seen any posts about this but is anyone else having problem
with audio after an upgrade? - it happens with both PulseAudio and with
just basic ALSA.

Ruby CGI script <=> Java chatbot server - need to run some Javascript code for FaceBook Analytics

People,

I have this chatbot set up:

<a href="https://www.facebook.com/PhiRhoChat" title="https://www.facebook.com/PhiRhoChat">https://www.facebook.com/PhiRhoChat</a>

and it stopped working sometime recently for NEW chats - I can't work
out why Messenger continues to work for my test FB account but not for
new chatters - there are alerts to get the app reviewed again although
under "App Review" it says: "Your app is currently live and available to
the public."

Anyway, I want to add this Javascript stuff to the Ruby script somehow
so the FB analytics will work so I might have a better chance of finding
out why NEW chats are not making it to the Ruby script .

Anyone interested in building a Ruby alternative to RoundCubeMail ?

People,

I have been using RCM for many years and although it is the best current
option for my needs, there are still some changes / enhancements I would
make if I could - but it is written in PHP and there is no way I am
going to put any effort into learning that.

Debugging an email problem with Discourse

People,

I can't ask this question on the Discourse forum because I installed the
Bitnami stack into my Docker container and the Docker people won't
answer questions if you don't use their container - so I thought there
might be some Rubyists who have had some experience with Discourse or at
least might be interested enough to help me debug this problem (I am
assuming it is Ruby-related).

I have the container working fine here:

<a href="http://forum.philiprhoades.org" title="http://forum.philiprhoades.org">http://forum.philiprhoades.org</a>

BUT . . emails aren't working .

Bash script <=> Ruby sctipt

People,

I regularly grab information from the system using Ruby's backtick and
system call facilities for getting values into variables in the Ruby
script but sometimes it would be good to go the other way - if my shell
script is too big and painful to rewrite in Ruby it would be good to be
able to call a Ruby function to do something and then pass the results
back to the shell script. I have been messing around for a few hours
now and I can't see a nice way of doing it . .

Suggestions?

Thanks,

Phil.

Running docker images crashing F25?

People,

I couldn't find a specific docker Fedora list so I am posting here -
feel free to tell me a more appropriate list . .

I decided to live on the edge and did a bare-metal install of F25 x86_64
a little while ago - it has been going pretty smoothly but in the last
few days I have been playing around with docker again (specifically:
cprogrammer/indimail:fedora-23 ie a qmail server) and I have had a few
spontaneous reboots - one that locked up at a BIOS splash screen.

Is this something I should be helping to debug somehow?

Anyone interested incollaborating to build a Ruby / Web front end to EZMLM ?

People,

I have quite a few small mailing lists that use EZMLM:

<a href="http://untroubled.org/ezmlm" title="http://untroubled.org/ezmlm">http://untroubled.org/ezmlm</a>

and there are a couple of front-ends that are available to browse EZMLM
list archives but they are based on Perl or Python . . and I prefer Ruby
. . is anyone motivated to help me build a Ruby front-end? It would be
a great learning exercise for me but it would also be very useful
software once it is usable. I think a Rails app is probably overkill
but I am somewhat familiar with that route if it turns out that is the
best idea - maybe Jekyll?

Fedora_25_Alpha_1.1_Download

People,

I could only find this by Googling:

<a href="https://fedoraproject.org/wiki/Template:Fedora_25_Alpha_1.1_Download" title="https://fedoraproject.org/wiki/Template:Fedora_25_Alpha_1.1_Download">https://fedoraproject.org/wiki/Template:Fedora_25_Alpha_1.1_Download</a>

- it does not seem to be navigated to from the wiki itself? - at least I
couldn't find a link . .

Thanks,

Phil.

Simple SQLite app GTK importing from mmssms.db and using GContacts

People,

I periodically crash or otherwise do a factory reset on my Android phone
but rather than restoring all the SMS messages I would like to just
import from the backup mmssms.db into a Linux app and keep all the old
messages for historical posterity allowing me to search and look up
messages etc in a consolidated DB. I can't find anything in existence
that does this nicely so it seems like the easiest way to do this would
be build it myself using Ruby + GTK + SQLite? Has anyone done anything
like this?

ARGF almost doing what I want with MAIL

People,

I have this script (tmail.rb):

#!/usr/bin/ruby

require 'mail.rb'

mail = Mail.read( ARGF.filename )
p mail.attachments[0].filename

I have a text file that is an email with base64 encoded attachment and
if I do this:

tmail.rb email.txt

- the script runs correctly with no errors but if I do this:

cat email.txt | temail.rb

I get:

/usr/share/gems/gems/mail-2.6.3/lib/mail/mail.rb:176:in `initialize': No
such file or directory @ rb_sysopen - - (Errno::ENOENT)
from /usr/share/gems/gems/mail-2.6.3/lib/mail/mail.rb:176:in `open'
from /usr/share/gems/gems/mail-2.6.3/lib/mail

Advice about using a little Ruby script with / without Rails

People,

I just read some more of the comments on the "Are we dying?" thread and
I realised I, too, am happy with a ML environment and low volume means
it is easier to make sure I don't miss interesting stuff when I am
scanning Subjects!

Self Numbering Debug Lines - a little script

People,

There are probably already things around that do what this little
program does and do it more efficiently and elegantly but it was an
interesting little exercise for me and some others might find it useful.
This effort was not precipitated by a "Doh!" forehead slapping bug but
more of a "WTF! I have no idea what is going on here . ." bug. In the
end the bug was an odd thing to do with the "dialog" utility and I have
worked out how to get around it but it started me on this exercise .

Anyone got Mailcatcher working?

People,

I cloned this:

<a href="https://github.com/sj26/mailcatcher" title="https://github.com/sj26/mailcatcher">https://github.com/sj26/mailcatcher</a>

Installed with:

bundle install --path vendor/bundle

Started the daemon with:

bundle exec ./bin/mailcatcher

Sent test mails with:

swaks -p 1025

- which deliver OK

I can browse to the interface at:

localhost:1080

- but no mails are displayed . .

Also, it is a plain HTML interface ie not as pretty as the picture on
GitHub . . which is a bit suspicious . .

Anyone got any ideas (I have sent a note to the author but no response
yet . .).

Thanks,

Phil.

dnf woes

People,

I have been watching the dnf arguments over the last year or so with a
little interest but now I am exposed to an actual problem - I have been
making VMs from the last few beta versions of Fedora-Live-Xfce-x86_64-22
and find that Beta-3 still does not let me update packages after
installation - I still get the following error:

"Error: Failed to synchronize cache for repo 'fedora' from
'https://mirrors.fedoraproject.org/metalink?repo=fedora-22&arch=x86_64':
Cannot download repomd.xml: Cannot download repodata/repomd.xml: All
mirrors were tried"

whenever I do anything with dnf

Is it possible rewrite like this?

People,

I've had a look at the rewrite stuff but I can't see that it is possible
to do what I want:

For outgoing mail for users with names like:

info_dom1@*
info_dom2@*
info_dom3@*

I want their from/reply-to addresses to be rewritten as:

<a href="mailto: ... at dom1 dot com"> ... at dom1 dot com</a>
<a href="mailto: ... at dom2 dot com"> ... at dom2 dot com</a>
<a href="mailto: ... at dom3 dot com"> ... at dom3 dot com</a>

- is this possible?

Thanks,

Phil.

Real world method examples for public, protected and private

People,

I have been following the "Stoooopid OOP question" stuff and I went
looking for some real-world examples of when to use the different sorts
of methods but all I can find are silly "foo / bar" type examples - can
someone point me to some simple examples that show me why there are
cases when methods should not be public?

Thanks,

Phil.

yum groupinstall development-tools FAILS

People,

This command:

yum groupinstall development-tools

fails with these errors:

Transaction Check Error:
file /usr/share/locale/en/LC_MESSAGES/systemtap.mo from install of
systemtap-devel-2.2.1-1.fc18.x86_64 conflicts with file from package
systemtap-sdt-devel-2.1-2.fc18.x86_64
file /usr/share/locale/fr/LC_MESSAGES/systemtap.mo from install of
systemtap-devel-2.2.1-1.fc18.x86_64 conflicts with file from package
systemtap-sdt-devel-2.1-2.fc18.x86_64
file /usr/share/locale/pl/LC_MESSAGES/systemtap.mo from install of
systemtap-devel-2.2.1-1.fc18.x86_64 conflicts with file f

"gets" overwrites string - why does this happen?

People,

If I run this script with a text filename parameter:

#!/usr/bin/ruby

puts $*
filename = $*
puts filename
gets
puts $_
puts filename

- the last puts is empty! Why does this happen?

Thanks,

Phil.

Re: Alternatives to methods for large number of nested "ifs"

People,

Thanks to the people who responded - I looked at everything but nothing
really suited what I was trying to do but see below for some progress
that I made and another question:

On 2012-11-17 01:35, Philip Rhoades wrote:

Alternatives to methods for large number of nested "ifs"

People,

I have an existing script that looks like:

lots of code
.
.
.
if ..
some lines of code
if ..
some lines of code
if ..
some lines of code
if ..
some lines of code
if ..
some lines of code
etc

This makes it difficult to see the overall logic so I want to change it
to something like:

lots of code
.
.
.
if ..
call something
if ..
call something
if ..
call something
if ..
call something
if ..
call something
etc

but if I use methods I will have to pass lots of variables

Ruby, AI, Chatbots, Semantic Avatars and memory (persistence?)

People,

I have a need for a "Semantic Avatar" for a (non-profit) web site
(using a typed interface to begin with). There are many chatbots around
but I was interested in what might be possible with Ruby. Most of the
Ruby AI stuff is from some years ago and it doesn't look like there has
been much progress recently. Do people here know of, or are involved in
developing something that might be of interest or useful for what I
want? The main need is for the entity to have a good memory and to be
able to build on previous discussions it has had with the same user.

Thanks,

Phil.

Ruby AI and Natural Language suggestions

People,

I have found a number of links for this topic but do people here have
any experiences, suggestions, etc that they would like to pass on? I am
familiar with Ruby and familiar with some of the concepts but otherwise
starting from scratch.

Regards,

Phil.

Elegant selection of closest number?

People,

Say I have numbers: 0.1 0.2 0.3 0.4 0.5

then I want to process thousands of numbers, choosing which of the
above numbers the processed number is closest to. I can see ways of
doing this eg I could calculate mid-points of the above numbers and then
iterate through that list checking the value of |x - mid-point| to find
the minimum value but I think there should be a more elegant, direct
method but I can't think of it. Suggestions?

Thanks,

Phil.

Inserting hash value slows down as table gets larger

People,

In response to people's suggestions about speeding up my script by
replacing output to many small files with output to one large file I
have implemented a hash table I can write out with YAML. However, I
find as the hash table gets larger, the script slows down . . but when I
try and work out what is happening by producing a small test script that
does more or less the same thing, I can't reproduce the problem .

Fast alternatives to "File" and "IO" for large numbers of files ?

People,

I have script that does:

- statistical processing from data in 50x32x20 (32,000) large input files

- writes a small text file (22 lines with one or more columns of numbers)
for each input file

- read all small files back in again for final processing.

Profiling shows that IO is taking up more than 60% of the time - short of
making fewer, larger files for the data (which is inconvenient for random
viewing/ processing of individual results) are there other alternatives to
using the "File" and "IO" classes that would be faster?

Thanks,

Phil.

A Real World example for Ruby to "compiled" version discussion

People,

The "how can we make a ruby compiler" thread has been very interesting -
I really like hearing from serious and competent programmers about the
theoretical problems involved with this issue.

William Rutiser asked for an expansion on the details of my C/C++
population genetics simulation program as a specific example of how one
might proceed depending on a particular situation.

Stopping Audio CD automatically playing on F12

People,

I am using:

kernel-2.6.32.10-90.fc12.x86_64

with PulseAudio uninstalled (ie using ALSA) and I want to prevent Audio
CDs from automatically playing when I put them into the drive. I have
turned off ALL automatic options for ALL media using:

thunar - Edit - Preferences - Volume Management - Configure

and restarted Gnome but the behaviour persists - what am I missing?

Thanks,

Phil.

Audio with CRON works - not AT?

People,

When I put:

40 21 * * * root /usr/bin/mplayer -ao alsa
/home/phil/audio/vincent_van_gogh.mp3

in /etc/crontab - it works but if use "at" for any time and enter:

/usr/bin/mplayer -ao alsa /home/phil/audio/vincent_van_gogh.mp3

- at the designated time I hear a click as though something happens but
no audio clip.

Anyone know why "at" doesn't behave?

Thanks,

Phil.

Squirrelmail and https, ssl logs

People,

I have put:

# Rewrite Engine
RewriteEngine On

# Rewrite HTTP requests to HTTPS for secured areas
RewriteCond %{HTTPS} !=on
RewriteRule ^/webmail/(.*)$ https://yourserver.com/webmail/$1 [R=301,L]

in etc/httpd/conf/httpd.conf and:

Alias /webmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

in /etc/httpd/conf.d/ssl.conf and restarted httpd, but the squirrelmail
login is still the normal http login. Do I need to setup certificates
or something to get the ssl working?

Logrotate not starting a new log file at cron.daily time?

People,

Every day I want to run a script on the current, complete maillog file
so I set it up in crontab for 04:01 - one minute before the cron.daily
logrotate happens but all the maillog log files start with lines in the
file that vary between 03:00 and 04:02 - how is this possible? -
shouldn't they all be after 04:02?

Thanks,

Phil.