DevHeads.net

Postings by Larry Martell

R: dplyr, doBy, and ggplot2 in CentOS7

I have a R script that I am running from python with rpy2. On a debian
system I run this:

apt-get install R-cran-ggplot2 R-cran-caret

And the script works. I want to move this to CentOS 7 system. There it
cannot find R-cran-ggplot2 or R-cran-caret. Does anyone know what
packages in CentOS 7 I need for dplyr, doBy, and ggplot2?

libGLU.so.1

I have a C++ program that I have been running on RedHat 6 and I want
to move to CentOS 7. When I run it on the CentOS 7 system it fails
with:

error while loading shared libraries: libGLU.so.1: cannot open shared
object file: No such file or directory

I did this, but still have no libGLU.

sendmail

I an running CentOS7 in a docker container. I need to send email from
that container so I installed sendmail and then I run:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf` and when I try and
send mail it fails with:

<a href="mailto:larry. ... at gmail dot com">larry. ... at gmail dot com</a>... Connecting to [127.0.0.1] via relay...
<a href="mailto:larry. ... at gmail dot com">larry. ... at gmail dot com</a>... Deferred: Connection refused by [127.0.0.1]

Anyone know how I can configure sendmail so that I can send mail?

Connecting to internet with USB tethered iphone

I am trying to get a centos 6 system on the internet with a tethered
iPhone. I can see the phone with lsusb as bus 001 device 011. A post on
stackoverflow said I would need to run "# ip link set usb0 up && dhcpcd
usb0"

But how do I reference my phone in that command?

JRE 8.1 for CentOS6

I have some software that says it requires JRE 8.1 or higher. If I go
to <a href="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html" title="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html">http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2...</a>
and install jre-8u144-linux-x64.rpm I get jrel.8.0_144. Anyone know
where I can get 8.1?

system slowdown

I have a CentOS 6 system that has suddenly starting significantly
slowing down. It runs a django app with an Apache server and MySQL
server. There is plenty of disk space and no process seems to be
hogging the memory or CPU. But operations that used to take 5 minutes
are now taking hours and hours.

Coinciding with this slow down I see these messages in
/var/log/messages (this is hand typed, as I can't copy/paste or send
email from this system, although for a change I do have remote access
via 2 VPN hops):

kernel: BUG: soft lockup - CPU#5 stuck for 67s!

strange system outage

I have a CentOS 7 system that I run a home grown python daemon on. I
run this same daemon on many other systems without any incident. On
this one system the daemon seems to die or be killed every day around
3:30am. There is nothing it its log or any system logs that tell me
why it dies.

CentOS 7 selinux

If I make a change to /etc/sysconfig/selinux do I have to restart anything
for the change to take effect?

CentOS version

I am trying to find out what version of CentOS is running at a
customer site, but I do not have remote access and there is no one
there to run anything for me. But I do have a dmesg output and I see
this:

Linux version 3.10.0-327.22.2.el7.x86_64
(<a href="mailto: ... at kbuilder dot dev.centos.org"> ... at kbuilder dot dev.centos.org</a>) (gcc version 4.8.3 20140911 (Red Hat
4.8.3-9) (GCC) ) #1 SMP Thu Jun 23 17:05:11 UTC 2016

From that can someone tell me what the CentOS version is?

long delay when logging in

I have a CentOS 7 system and when I login with putty or ssh there is a
long delay before I get the password prompt.

NFS help

We have 1 system ruining Centos7 that is the NFS server. There are 50
external machines that FTP files to this server fairly continuously.

We have another system running Centos6 that mounts the partition the files
are FTP-ed to using NFS.

There is a python script running on the NFS client machine that is reading
these files and moving them to a new dir on the same file system (a mv not
a cp).

Almost daily this script hangs while reading a file - sometimes it never
comes back and cannot be killed, even with -9.

Mysql devel

I am trying to install the mysql devel libs (so I can build MySQLdb).
This is on RHEL 6. It's failing as shown below.

using alias in where clause

I know I cannot use an alias in a where clause, but I am trying to
figure out how to achieve what I need.

If I could have an alias in a where clause my sql would look like this:

SELECT IFNULL(f_tag_bottom,
IFNULL(f_tag_bottom_major_axis,
IFNULL(f_tag_bottom_minor_axis,
IFNULL(f_tag_ch_x_bottom,
IFNULL(f_tag_ch_y_bottom, NULL))))) as ftag,
STDDEV(ch_x_top)
FROM data_cst
WHERE ftag = 'E-CD7'
GROUP BY wafer_id, lot_id

But I can't use ftag in the where clause.

help with query to count rows while excluding certain rows

I need to count the number of rows in a table that are grouped by a
list of columns, but I also need to exclude rows that have more then
some count when grouped by a different set of columns.

OPTIMIZE TABLE vs. myisamchk

I have a very large table (~50GB) and periodically rows are purged
from it and I want to run OPTIMIZE TABLE to recover the space. But I
do not have enough space to run it. If I do run it the server hangs
and must be killed and restarted and the table is damaged and must be
repaired.

Upgrade from 5.5 to 5.6

I am upgrading my server from 5.5 to 5.6. This is on CentOS 6.5.

'Lock wait timeout exceeded' with MyISAM tables

I just upgraded a server from 5.1 to 5.5. Our tables are all MyISAM. I
have a python script that inserts rows to a table, in 5.1 it worked
fine. In 5.5 it's failing with 'Lock wait timeout exceeded'. I google
this, and it seems that all the cases of people getting that were with
InnoDB tables, and all the solutions only apply to InnoDB tables. How
can I fix this with MyISAM tables?

questions about timestamps and DST

I have a column that was a timestamp type. I was inserting rows using
NOW(). When we switched to DST and the hour from 2am to 3am was
non-existent I of course had no data for that hour.

Help improving query performance

I have 2 queries. One takes 4 hours to run and returns 21 rows, and
the other, which has 1 additional where clause, takes 3 minutes and
returns 20 rows. The main table being selected from is largish
(37,247,884 rows with 282 columns). Caching is off for my testing, so
it's not related to that. To short circuit anyone asking, these
queries are generated by python code, which is why there's an IN
clause with 1 value, as oppose to an =.

Here are the queries and their explains.

Installing old version of firefox

I need to install firefox version 24.3.0 on centos version 6.5. Anyone
know how I can do that? I tried downloading that version directly and
it fails with:

XPCOMGlueLoad error for file /usr/local/lib64/firefox/libxul.so:
libXrender.so.1: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

Stored procedure debuggers

Does anyone know of any debuggers for stored procs that run on Mac and/or Linux?

Case sensitivity

I have 2 servers, one is running 5.5.25a and the other 5.0.77.

They both have the same collation and character set:

mysql> SELECT COLLATION(VERSION());
+----------------------+
| COLLATION(VERSION()) |
+----------------------+
| utf8_general_ci |
+----------------------+
1 row in set (0.00 sec)

mysql> show variables like '%_server';
+----------------------+----------+
| Variable_name | Value |
+----------------------+----------+
| character_set_server | utf8 |
| collation_server | utf8_bin |
+----------------------+----------+
2 rows in set (0.00 sec)

Yet the 5.5.25a

Performance boost by splitting up large table?

We have a table with 254 columns in it. 80% of the time, a very small
subset of these columns are queried. The other columns are rarely, if
ever, queried. (But they could be at any time, so we do need to
maintain them.). Would I expect to get a marked performance boost if I
split my table up into 2 tables, one with the few frequently queried
columns and another with less frequently queried ones? Doing this will
require a lot of code changes, so I don't want to go down this path if
it won't be beneficial. Can folks here offer their experiences and
learned opinions about this?

Thanks!

Getting yum to install to python 2.7 dir

I am running CentOS 6.5, which has python 2.6. I need python 2.7 so I
installed that and it works and is my default python. But yum does not
work with that, so I changed the shebang line for yum to
/usr/bin/python2.6 and then yum works again. But when I install a
python package with yum it get installed to
/usr/lib64/python2.6/site-packages/. How can I get yum to install to
/usr/lib64/python2.7/site-packages?

Thanks!

Conditional in update

Is there some way I can have a conditional in an update?

I have this update sql (paraphrased):

update LMPROC_LIMITS
set LIMIT = sign(LIMIT) * 100 * floor(0.000001 + (sign(LIMIT) * LIMIT
* ratio/100)
where SYMBOL_ID = symbolId
and CLASSTYPE = LimitType
and TYPE_ in ('minClusterPosition', 'maxClusterPosition',
'minProductPosition', 'maxProductPosition', 'minBookPosition',
'maxBookPosition', 'maxShortShares')

(ratio, symbolId, and LimitType all are filled in at run time)

What i want to do is limit (no pun intended) the value LIMIT is set to
to +/-2,147,483,647 - i.e.

grouping by the difference between values in rows

I've been asked to do something that I do not think is possible in SQL.

I have a query that has this basic form:

SELECT a, b, c, d, AVG(e), STD(e), CONCAT(x, ',', y) as f
FROM t
GROUP BY a, b, c, d, f

x and y are numbers (378.18, 2213.797 or 378.218, 2213.949 or
10053.490, 2542.094).

The business issue is that if either x or y in 2 rows that are in the
same a, b, c, d group are within 1 of each other then they should be
grouped together. And to make it more complicated, the tolerance is
applied as a rolling continuum.

regexp in conditional

Can I use an regexp in a conditional? I need to do something like this:

SELECT (IF r REGEXP '^ED[HMUZ][0-9]$', 'yes', 'no') FROM s;

I'm getting an error from that. Is there some way to do this?

Log rolling with a daemon

I'm looking for advice or suggestions for rolling log files with a
daemon. I have a python script that I daemonized with
<a href="http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/" title="http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/">http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/</a>.
Before I daemonized it it was run from a bash script that invoked the
underlying python script. It ran the python script, waited for it to
complete and then it slept for 5 seconds and ran it again. This was in
a infinite loop. In between each invocation it checked the log file
and if it was over 10MB it renamed it and then the next invocation
started with a new empty log.

chkconfig question

In the docs for chkconfig it says:

<startlevellist> is a list of the runlevels for which the service
should be started by default. Only services which are really required
for a vital system should define runlevels here. If no runlevels are
defined, a - should be used in place of the runlevels list.

and then:

More commonly, the service is off by default on all runlevels, which
looks like this:

# chkconfig: - 20 80

But services with a chkconfig entry like that are started at boot time
(e.g. mysql, httpd).

making a script into a service

We have a python script that is currently run from cron. We want to
make it into a service so it can be controlled with service
start/stop/restart. Can anyone point me at site that has instructions
on how to do this? I've googled but haven't found anything.