Good F# Example

After a decade of Linux database work, a lot more of my time is being spent on the Microsoft platform, using Visual Studio. Because our enterprise is on Windows 7, Visual Studio 2012 is as high as I can use.

Over the past six years, I’ve learned enough Clojure to write small applets; added to my Perl knowledge; and ported a VB application to C#.

So, I am learning F# now, and was looking for a good example. I was lucky to find one that includes posting a dialog box. I had to tweak a couple of things, because this example was written for Visual Studio 2010, but it is the first good example I have found for F#.


Temporary Workaround When Multiple Python Versions Cause Problems

I wrote and maintain an AMR (automated meter reading) store/transfer system. The system is implemented in Python, and has both command line and Django components, which share Python modules. Django is using Python 2.6.6, and the command line version is using 2.7.3.

Last Spring, I had to use pysftp and wound up breaking the web application. There is no pysftp installed for Python 2.6.6.

Eventually, this server is going to be rebuilt, but, until it is, I restored the web site using a bit of a kludge, by performing this workaround. The web site (Django) component does not use pysftp.

It’s funny that until you try something, you don’t know if it will work. Here is the workaround:


import sys
import os

if our_python_version >= (2,7,3):
   import pysftp

Since Django was built using Python 2.6.6 and no Django modules use sftp this is a good workaround, until I can rebuild this server.

This is what I like about these more modern languages, like PythonClojure, and even languages like Perl. You can interdict during a module load.


Greater Boston Bone Marrow Drive

https://octopusgrabbus.wordpress.com/2015/03/14/bone-marrow-drive/


Replacing CVS (Source Code Revision Control)

Well, it has finally come down to finding an open source source code revision control. But, what do I choose, git or something else? This will be interesting.

I have been using cvs for over a decade, because I know it, and I’m the only user. Then, cvs began expanding keywords in javascript code  on me.

Nothing lasts forever, so a new task for 2015. Replace our source code control.


A Simple Question Without An Answer [so far]

Aside from having enough disk space to defragment a disk, choosing a slower time of the day to defragment a disk, and perhaps running the disk check utility before you defragment, I want to know if it is okay to defragment a Windows server or workstation using Microsoft’s disk defragmenter.

A consultant we use happened to see the Microsoft disk defragmenter running on several of our servers, and said running the defragmenter could cause problems. However, the consultant offered no reasons why or any corroborating evidence. I’ve been defragmenting disks for over a decade with no apparent negative results. More or less the Microsoft Devnet community said it’s OK, but I am still looking for the definitive answer to this question.


Taming sendmail [ I hope ]

With the exception of one Linux server, which performs URL routing, all our Linux servers have jobs to do, and send email out when their jobs have completed. All our Linux servers run sendmail, but sendmail is being used in its crudest form. It’s not serving in its full capacity, but its only job is to move email off each Linux server to our email server, and does so with a Perl shim that logs into our email server using a valid user name.

Over the past few years, our email server has needed replacing. Its disks get full, and it cannot accept more incoming mail. I’ve never bothered to tune sendmail, but have now resorted to something crude that I hope will prevent our Linux servers from many, many retries, and hanging due to one of many conditions, including running out of memory.


# A $? -eq 1 means the mail server is running. That is ?Invalid command was not found.
(echo open mailserver.arlington1.local 25; sleep 1; echo EHLO; echo quit) | telnet | grep "?Invalid command"

if [ $? -eq 1 ]; then
   if [ -r /tmp/sendmail_stopped ]; then
      rm /tmp/sendmail_stopped
      /etc/init.d/sendmail start
      mail -s "sendmail has started back up." dbadmin@town.arlington.ma.us << /dev/null
   else
      echo "sendmail OK"
   fi
else
   if [ ! -r /tmp/sendmail_stopped ]; then
      touch /tmp/sendmail_stopped
      /etc/init.d/sendmail stop
   else
      echo "sendmail still not OK"
   fi
fi

So far, so good. I’m hoping to shutoff sendmail and hence shutoff retries, so I don’t have to force reboot our Linux servers.


Why Am I Reluctant To Write Web Applications?

I was first introduced to a production web environment fourteen years ago in Fidelity Investment’s Catalina development group. Although there was some Unix web programming on Sun systems, most of the development was on IIS using ASP pages. I even wrote my first application that created a configuration document for testing new financial applications in first level “smoke” test. I learned some Perl as well. I was on a good development learning track.

I do not know what happened after that, but my career and interests seemed to veer further away from web development, and I actually developed some avoidance behavior. To me web development is development, and is neither harder or easier than other development. It is different and has its own set of challenges.

I have been struggling to come back for years. Four years ago, I implemented a rudimentary Django application. It’s crude, but it does what it is supposed to and rarely breaks. It is primarily used for snapping water meter reads for billing. And now, I really need to get away from headless server applications, bite the bullet, design, and write something.

So, here goes.

 

 


Follow

Get every new post delivered to your Inbox.