DevHeads.net

Postings by Ken D'Ambrosio

HDMI: video, yes; audio, not so much.

Hey, all. New install of 18.04. I have an older 18.04 that works great
from an Intel NUC on the same system. But I've plugged in the new
system (a Dell E7250), and while the video is terrific -- 4K and
everything -- not so much the audio. This is a Sharp 43" 4K set, if
that matters. Any suggestions on where to look/what to poke?

Thanks!

-Ken

Disable sound?

Hey, all. Is there a good way to entirely disable sound? I'm running
Ubuntu in a VM, and, for reasons I haven't entirely discerned (and don't
have time to troubleshoot) Chrome + sound + HDMI-at-home = bad news.
V-e-r-y slow response, etc., etc. (Firefox works fine, but I'm already
settled into Chrome.) As it's running in a VM, I'm more than happy to
use the host OS to do audio (a Mac).

So, anyway: maybe blacklist the audio kernel modules? Or...?

Thanks!

-Ken

Read individual characters off socket?

Hi! I'm trying to read a character-at-a-time off a network socket;
while (say) getch kinda-sorta does that, it only does it once the remote
end has submitted the entire line via <CR>.

EventMachine, single-character input, and start_server?

Hi! EventMachine is really nifty. It even supports single-character
input, which is something I've realized I need... but I'm not sure it
supports it over a network connection. Or, rather, I'm thinking maybe
it doesn't.

So:
1) Can I get character-at-a-time input via EventMachine for a
network-based connection?
2) Failing that, what other recommendations might be out there?

Open port, then lower privs.

Hi, all. "For reasons," I need to set up a telnet-like service -- and,
yeah, it needs to be on port 23. In the Unix world, ports < 1024
require root privs to open, but I don't want my server running with root
privs for reasons that should be obvious. Using the base Eventmachine
example, I'm wondering if someone could show me how to do this? I see
that there's a "set_effective_user(username)" method on the object, but
I don't see how to use that on the object since instantiating it seems
to execute it, and it's too late to do it afterward...

Dealing with invalid encoding...

Hi, all. I've got a file with some things like this:

radio frames^M<83>?<9B>v64
(The "?" is a \x3f)

Needless to say, Ruby barfs all over that. There are also *other*
invalid strings in the file. (Thanks, Framemaker.)

Now, I know I can use #scrub to make the file palatable, but what I
*really* want to do is to take the "<83>?<9B>", and swap it with a
\u2022 (unicode bullet), and then use #scrub on the rest of the invalid
stuff. But I can't figure out how to do that; I admit I get out of my
depth when dealing with encodings.

Gwrite/Wordpad equivalent?

Of course, Ubuntu comes with text editors and word processors -- the
former can be extremely lightweight (or not), and the latter is
generally extremely heavyweight. There used to be an app in the middle,
though -- the Wordpad equivalent, for Linux. Pretty sure it was Gwrite,
which seems to have ceased development in '11 or so.

Nutshell: looking for a stupid lightweight word processor. Don't care
if it opens .DOC files. Don't care if it publishes to .HTML.

Keybinding FUBARness.

Hi! I run MATE with Compiz, and love-love-love it... except for
something that's happened very recently. I use the
<alt><left-mouse-button> keybinding for window movement; it's now second
nature, and is on all my systems. Greatest thing since sliced bread;
don't have to even think about finding the dragbar, just drag the whole
darn window. Yay.

But, suddenly, it just stopped working on my primary work system.

L-o-n-g delay for rc.local in systemd on Ubuntu.

Hey, all. I've got some stuff in my rc.local, and it takes *forever* to
execute -- three+ minutes. (Note that the machine -- a virtual one --
is up in something like 20 seconds.) I *need* this stuff, which is
lightweight in the extreme, to execute much earlier in the boot process
than that.

Anyone have any ideas on how to make that happen?

Thanks,

-Ken

USB-VGA suggestions?

Hey, all. I've got the weirdest server I've seen in some time: it's got
four (independent) blades, but no video. You can pop the slot off, buy a
VGA connector with a cable running to the VGA header, and plug that
in... but it's a PITA. What it *does* have for every blade, though, is
USB -- two of 'em. So if I had a VGA-to-USB adapter, and a keyboard,
I'd be golden. But last time I looked, Linux support for those adapters
was kinda questionable. Has anyone had any good experiences?

Thanks!

-Ken

Upstart on 14.04.

Hey, all. Newbie to the list, but long-time Linux/Ubuntu user... and
I'm confused. We've got an Openstack install on 14.04 host systems, and
after a hurricane-induced power outage over the weekend, one of our
hosts won't boot -- it fails (seemingly) at loading an Openstack Neutron
service. So, I figure I'll go into /etc/init.d/ and just chmod -x all
the suspect services, see if it boots, and then manually load services.

(W)rest STDIO when I don't want it.

First off, please excuse the crudity -- this is a proof-of-concept as I
figure out how stuff works, not something "real." With my wussy caveats
out of the way, does anyone know why this outputs the transactions
themselves?

#!/usr/bin/ruby

# v.

Long time for client to connect; not for script.

Can someone help explain something to me? When I use "mysql" to connect
to my server, it can take upwards of 15 seconds. When I use any of the
Ruby scripts I've written, it's so fast it's not even obvious it's
querying a remote host. Any idea what might cause this disparity? (My
initial suspicion would be a reverse DNS resolution issue -- which I
can't easily check from the DB host -- but wouldn't that affect both
script and client the same?)

Thanks!

-Ken

Stoooopid OOP question. (Really. You've been warned.)

Hey, all. I've never taken a for-real OOP-related course, and I'm 99%
sure I'm completely misunderstanding what is probably a very fundamental
OOP concept, and was wondering if someone would be kind enough to
enlighten me.

Say I'm parsing a file of pets/widgets/whatever. For simplicity's sake,
let's assume they have unique names. Everything I see about
instantiating an object says to do something like this:

foo = Pet.new

"foo", though, doesn't smell very unique to me.

POST with Net::HTTP

Hi! I'm trying to authenticate to an internal application, and I'm
trying to do it using POST.

Daily Reminder: TCL > Ruby 17749

shoutz to irc.gangnet.ru #tclmafia 6734

Daily Reminder: TCL > Ruby 12524

shoutz to irc.gangnet.ru #tclmafia 2683

DB transaction setup, and feeling stupid.

Hi, all. I'm a relative Ruby newb, and I'm trying to set up
paramaterized MySQL queries. And am getting completely stumped. I do a
similar query slightly before this one, and it works great. This one?
Not so much.

XML on the server?

I'm trying to dip my toes into Ajax, and am attempting to give an XML
reply to the query. And I am *completely* failing -- either it gets
passed, but with an HTML MIME header (which is why I'm guessing it's not
recognized by the client as XML), OR it barfs and gives a 500-series
server-side error.

Getting a single hash from a row in a MySQL query.

Hi, all. Right now, when I want to pull a hash out of a database, I
find myself first pulling all matching rows from my select, then
iterating through all the hashes in a given row. Surely, when I've got
a row, I should be able to say something akin to
puts row["foo"]
and have it spit out its value, "bar", instead of doing what I am right
now, which is

row.each_pair do |key, value|
stuff happens here
end

Pointers? (And apologies if this is a totally newb kind of
question...)

Thanks!

-Ken

Escaping SQL queries.

Hi, all. As someone whose last name has one of those dreaded
apostrophes, I'm acutely aware of how poorly things can go when SQL
queries don't handle apostrophes correctly. Googling this seems to give
me some indeterminate methods on handling it, and I was wondering if
there's One True Way to escape strings correctly in Ruby.

Any pointers?

Thanks!

-Ken

Newbie question: (free) on-line courses?

Hello, all. There's a bunch of free on-line training for Javascript,
CSS, etc., etc., but I haven't found anything of the sort for Ruby. I
*assume* I'm just looking in the wrong places. But I've really enjoyed
the little exposure I've already had -- Ruby seems to take the best of
Perl and Python, blend them together, and add some magic fairy dust to
boot. I've got a project coming up, and I'd love to do it in Ruby, but
I definitely need a bit more of an intro, and a training course (or good
documentation suggestions?) would be ideal.

Thanks kindly!

-Ken

How to reject mail on secondary MX?

Hey, all. I've got a primary -- my actual destination/IMAP server -- and, for
various reasons, a secondary SMTP server. My primary only rejects mail to
invalid recipients (spam is dealt with internally). I'd like my secondary to
reject invalid recipients, also. I can bring over /etc/aliases and /etc/passwd
-- we're talking perhaps 15 addresses, tops -- but how do I get the secondary
to check against them before relaying to the primary?

Thanks,

-Ken

"Forging" headers?

Hi, all. My company has a web server hosted by an external provider. It
sends out e-mail (e.g., in response to web forms), and, occasionally, it
gets bounced and/or eaten up by spam filters. What I'd like to do is
relay mail from the web server through our corporate server, but make it
look as if mail had originated from the corporate server. Any way to do
that?

Thanks!

-Ken