Skip to content

Repairing a Tascam M-2524 or M-2516 – Part 4

Potentiometers

Potentiometers are tricky, because there exists many different kinds. They have a resistance value, which is the maximum resistance, and when you turn them they go down to zero. For audio applications you’ll have single pole and dual pole potentiometers, where dual pole are for stereo applications, and you can have linear, logarithmic, audio and panning taper, and they can be with or without a center detent, ie that little middle “click” so you can feel that you have put it in the center position.

In addition to that you can have different types of shafts and different lengths of shafts, and different sizes and wattages and pinouts and… yeah. It gets complicated.

For that reason, buying your potentiometer replacements from an official channel is almost always required. You have to be lucky to find the right potentiometer online, and if you need to replace several, it quickly becomes impossible.

Other circuits like resistors, transistors and electrolytes generally have less variants and it will be easier to find replacements, except for transistor types that aren’t manufactured any more.

The markings on the potentiometer is also not very helpful, but they are enough to distinguish them once you have bought the correct ones. This one says 104B, which means a 100k logarithmic. The 202H seems to be a manufacturing code. It probably tells the manufacturer where and when it was manufactured, but you would need to know how this specific manufacturer marks it’s potentiometers.

20170201_154743

Old

This is the new potentiometer I replaced it with. Notice that this one has the manufacturer code on top and the 104B below.

20170201_154732

New

As mentioned in the first blog post I won’t discuss how to solder or replace parts, there’s plenty of blogs and YouTube videos on how to do that. But use a soldering pen that has a thermostat so it doesn’t get too hot, and use tools to get the old solder away and it’s not very hard. Take it easy and be careful and you’ll be fine.

I also replaced one if the channel faders. That was very easy, because the faders are connected to the channel slider bu this blue-white-red triple connector.

20170201_213610

Old

So all I needed to do was to desolder it and put it on the new fader.

20170201_214501

New

These mixer uses ALPS faders, a very popular and famous brand, although these ones are not the professional faders they are famous for. But it still means that you can find these faders quite easily online. The service center has them as well, of course.

Assembling the mixer

Repair done, it’s now time to put the mixer back together. In general that’s just a question of putting things in the opposite order of how you took it out. Here the photos you took when disassembling comes in handy.

20170119_094816

How to know which screws goes in which hole.

A few steps can use some extra hints, though:

The potentiometer shafts will hit whatever your mixer is resting on (in my case a blanket, to protect the mixer from the table and the table from the mixer). So when assembling it, you will have to prop the mixer up, so that you can position the circuit boards properly.

Also, the little “lock tab” in the XLR input is a pain in the ass. I’ve ended up making a small “tool” that I can use to hook behind the lock tab, and press it back and up until it fits through the hole. There should be better ways of doing this, but I haven’t found one yet.

Special tool

This is 7-8 cm long, hook the top part under the tab, press the tab towards the back of the mixer, and slightly up until it passes through the hole.

Although the easiest way to get the channel strips in is to just put them all in, and then mount the transverse connector boards, this is not true for the output/effect/return section shown below. I tried several times, and in the end resorted to putting the whole section together as one, and then carefully putting it in place and wiggling everything to get it into the right place.

20170202_194215

The trickiest part

Here a phone/camera came in handy,  so I could verify that all the buttons were positioned properly.

20170202_212342

All in!

You also might want to put a few cables into the connectors in the output section before you flip the mixer over, as those circuit boards will fall down and land on the power supply transformer otherwise.

Once all the circuit boards are in place, it’s time to again put in the metal bar that holds everything in place, and the back plate and flip it all over. This is a good point to check that everything still works, before you put back everything on the front.

Putting back the nuts is pretty annoying, I found that the quickest way was to use a socket wrench socket (but not the wrench) of the right size, and twist it a few turns counter-clockwise to get things into the right position, and then clockwise to fasten it. Using just my fingers was uncomfortable, and using an adjustable wrench means you will scratch the front.

That’s all! Here is a closeup to see how nice and clean it looks now.

20170204_081211

Compare with the first picture in part 1. Quite a difference.

20180120_115221

I even made a dust cover.

I hope this information will help someone!

Repairing a Tascam M-2524 or M-2516 – Part 3

Cleaning the mixer

Since I needed to almost completely disassemble the mixer to repair it, I decided to also clean it properly, while I was at it. This is the steps needed.

First I took all the knobs and buttons I had and soaked them in warm water with dishwasher liquid.

20170112_110133.jpg

After they had soaked for an hour or so, I took each button and brushed it with an old toothbrush. This is without a doubt the most time consuming and boring part of the whole process. The outside of the buttons will have gone darker thanks to sunlight exposure, there are ways to fix that as well, but I didn’t bother, and doing so risks bleaching the colors on the knobs, so you would have to pry away all the little tops first. A lot of work, and in my opinion not worth it.

After the brushing, more rinsing in hot water and then I just spread them out on a towel to air dry.

20170112_115241.jpg

You’ll notice that I’m only cleaning the potentiometer knobs and sliders here. This is because I cleaned them before I took out all the channel strips. However, I noticed that the push buttons had gotten dirty as well, so I pulled them off and cleaned them as well.

20170121_150434

Tascam’s minimalist push buttons.

They are quite hard to pull off, so be careful. The cleaning procedure was the same, but instead of a toothbrush I wiped them clean with a cloth. A toothbrush is needed with the knobs to get into the uneven bits, but these push buttons are perfectly flat.

One push button broke during cleaning.

20170121_163956

I glued it together with superglue, and then carefully sandpapered off the excess glue with very fine sandpaper, and in the end with polishing sandpaper.

20170201_201959

Once in place it’s impossible to tell which of the buttons this is.

Cleaning the front panel was done with the type of mild alcohol wiped that you used for computers and telephones, they are good at getting rid of dirt from fingers. Soapy water would probably work as well, but since I hadn’t removed the sliders and all of the electronics I didn’t want to, although I wiped off dust with a mildly moist rag first.

Pictures of this is unexciting, but here’s a before and after picture of various pen marks.

20170121_092700

Ugh.

20170121_114900

Cleaner

That was it for cleaning, next part we’ll discuss the repairs I did and reassembly.

Repairing a Tascam M-2524 or M-2516 – Part 2

Opening the mixer

OK, now when we have taken away all screws and nuts that keep the circuit boards in place in the front, it’s time to flip the mixer over. Careful, it’s heavy! 

20170115_121932

Making flippy floppy.

The big silver metal sheet is what we need to remove. Which screws to unscrew is fairly obvious, but note that some of them are on the backside. However, part of the power supply is also screwed onto the bottom, and you need to remove those screws as well. The power supply is also held in place with two screws on the back of the mixer so it will not drop down, so no need to worry.

20170115_122226

The screws for the power supply

After you remove the bottom plate, you’ll notice that there is a U-bar across the mixer. This both provides some extra stability, but more importantly keeps the channel strips in place. You’ll have to remove it was well, with the remaining two screws holding it in place.

20170115_122743

Part of the U-bar

Taking things out

That’s it, the mixer is now open, and you can access the circuit boards. At this point a camera becomes really handy to document which cables go where and how you disassembled everything. That can help clear up any questions you have when you assemble the mixer again.

20170123_110136-e1516524876526.jpg

All non-unique cables are marked with tape.

20170121_150930-e1516525693748.jpg

Circuit boards are marked and stored in boxes.

What you do now depends on what you need to repair. I needed to repair three of the channel strips, and one of those is channel 18, which is blocked by the power supply. So the first thing I removed was the power supply! As previously mentioned, it’s held in place by two screws on the backside, and the transformer is also held in place by two other screws.

20170115_122900

Holy circuits, Batman! (click for larger version)

However, those screws are not the only thing preventing you from putting the power supply to the side. No, everything inside the M-2524 is connected by soldered grounding cables. Those are the black ones you see above, and they are soldered in, and connect the three boards that form a wide band across the channel strips, and the three boards that form a thin band near the top, and the board that goes across the return and monitor section, and also the power supply. So if you want to put them aside, in a box or something, while you work on the mixer, you either have to treat them like one giant unwieldy unit or desolder some of the grounding wires. I opted for a middle ground, where I kept most circuit boards together but desoldered the grounding for the power supply. I also obviously needed to remove the cables on connector A on the power supply.

Remember to mark all cables and connectors you disconnect so you know where to connect them back. I did that by wrapping a piece of tape around the cable, and writing something on it, and putting a piece of tape by the connector on the circuit board and writing the same thing. Make up your own system that makes sense to you.

The three connecting “strips” then need to be carefully and gently removed from the channel strips. Don’t disconnect one channel strip at a time, rather gently get them off from all strips at once, bit by bit, so you don’t bend things for no reason.

20170115_142647

One part of one “connector strip” disconnected

The cables between the “strips” and the rest of the mixer are neatly held in place by zip ties in several places. You will have to carefully cut them off with a wire cutter.

20170115_123426

One of several zip ties that must go

The connecting strips are connected to each other, and with the other circuit boards with ribbon cables. You disconnect these by carefully (but rather forcefully) lifting the top part of the connector and the ribbon cable will pop out. However, try to avoid this, as you are certain to bend the wires, which makes it very fiddly to put them back correctly.

20170115_142752

A disconnected ribbon cable

With the connecting strips and the power supply gone, the channel strips are now almost free to be removed. But just almost. The little tongue on the microphone input will get stuck in the hole. To remove the channel strip you need to reach under the mixer and press the tongue upwards while carefully maneuvering the channel strip free.

20170115_143519

Reach under with your hairiest arm to push on the mic connector tongue

I started with channel strip 5 as this is the one with the bent potentiometer, one of those I needed to replace. I later removed all strips to better clean the front, but I had not made my mind up about that at this point, but I later decided to remove all the channels to clean the mixer front properly.

20170115_143548

Channel 5 liberated

Afterwards I removed the board that covers the return and monitor boards. It’s the same here, removed it gently bit by bit from all boards at the same time.

20170129_230244

The board in question

Once that board is gone you can remove the underlying boards. However, some of them are attached to the front with little plastic “rivets” that needs removing. That is also fiddly.

To start with you need a small screwdriver to push the plastic “pin” down and reach under the mixer to pull the pin all out. It may fall out completely, so be careful that it doesn’t disappear. Then you press firmly but gently inwards and downwards on the remaining “neck” that sticks up, while you pull on the circuit board.

riveting

I call them “plastic rivets”, but they probably have a real name

The transformer is easily removed by removing the two screws on the mixer backside that holds it there, and two screw that holds it into the metal “box” that surrounds the digital circuitry and the meters. One of those screws also holds a piece of wire that holds a few cables in place. It’s probably not important, but try not to lose it.

The power cable is also “hooked” into the chassis, but you can just unhook it easily.

20170119_093411

Little piece of wire covered in plastic.

Underneath the transformer, you find a piece of shielding attached with a screw. Underneath that is the input/output boards, which if you unscrewed them now can be just lifted out. There’s also a piece of shielding between two of the boards. If you don’t have the service manual you need to keep track of where it should go, by taking a photo or something.

20170121_091508

Shielding

I let the volume meters and the digital circuit board stay in the chassis because they are flat enough to easily clean the front anyway, so I didn’t need to. I also didn’t disconnect the input/output boards above, I instead lifted them a bit and then taped them in place so I could flip the mixer over without them falling out.

I also unscrewed one of the faders, as the knob was loose. They are simply attached with two screws from the front, nothing strange.

I left the little “computer” bit in place, it looked like it was fiddly to remove, and easy to clean around. And the output circuit boards I simply taped in place. That and most the faders is all the circuitry that remains, the fades are also easy to clean around.

20170121_091858

(Almost) all disassembled!

Next part I’ll discuss the cleaning a bit.

Repairing a Tascam M-2524 or M-2516 – Part 1

I have a home studio, and the center of that is a Tascam M-2524. I bought that cheaply many years ago, just when everyone was getting rid of old bulky analog mixers. You can  find them on eBay for as little as $200-$400, and considering you get 24 very nice microphone preamps for that price it’s absolutely ridiculously cheap. It has a smaller brother, the M-2516 that has 16 channels and I suspect everything I say here goes for both mixers.

My mixer got a knock in transportation, so one filter doesn’t work, and one knob is bent. In addition, one knob that should have a center detent doesn’t, and recently one of the group fader knobs fell off. I also got some more equipment, so I decided to tear the whole studio down, repair the mixer and then reorganize it. But even opening the mixer seemed complicated, and I bought a copy of the service manual, but it tells me everything about the innards of this mixer, but nothing about how to access them. So I’m documenting it on this blog, because it’s far from obvious.

You can buy somewhat shitty copies of the Tascam M-2516/2524 Service Manual online. Perhaps you can buy less shitty copies from Tascam, I forgot to ask. But the online ones are generally good enough.

Prerequisites

  • Small and medium Phillips screwdrivers
  • Small hex drivers (optional)
  • Several boxes and jars to organize things in
  • A wire cutter (for cutting zip ties)
  • A multimeter (optional, but good to have)
  • A Tascam M-2516/2524 Service Manual (optional, but good to have)
  • A good working table where you can turn the mixer upside down and have it lying there for days, possibly weeks; Ie, not the kitchen table
  • Good places to store the circuit boards while repairing, for example, cardboard boxes
  • A camera where you document how everything looks before you remove or unscrew anything
  • Tape and a pen that can write on that tape, or another way of marking circuit boards and cables

You need to know how to solder and desolder electronics, and you need the equipment to do so, including a temperature controlled soldering iron. I won’t cover how to solder electronics. You should also be reasonably handy, and very patient.

If you want to clean the mixer, doing so while it’s disassembled is not a bad idea. Then you also need mild cleaning fluid or wipes, for example, the type you use to clean computer keyboards.

Small hint: If you need to turn it on while open, because you need to find what the problem is, make sure the power supply is screwed into the backplate properly. The chassis is grounded through that contact. If it’s not grounded, you have no chassis ground. Not only is that unsafe, on my mixer the headphones stopped working! That’s how I realized it.

Step 1: Test everything

The first step is to test every single function of the mixer, to make sure that you know what works and what doesn’t. Opening this mixer up is a big process, you don’t want to discover another error just after you repaired it.

20170111_204149

The bent knob. Also notice all the dirt.

Step 2: Order replacement parts

Look up the order numbers of the things that need replacing in the service manual. If you don’t have one, the Tascam service center can probably help you identify the bits.

I tried to contact the distributor in Poland to see if they had parts but got no answer. I also contacted the main international service online but got no answer. However, the German service center, Triplex Service, did answer very promptly! They also ship to many countries in Europe, so that’s a good place to use if you are in Europe, maybe even elsewhere. While waiting for an answer from the first places I opened up the mixer to see if I could figure out more about what exact parts the broken ones were, but I could not find exact replacements anywhere, so official service companies are still your best bet.

Rumour has it that they no longer have replacement knobs at Tascam, and a few of my knobs was missing the colored cap, so I already before contacting Tascam support bought a bunch of replacement knobs on eBay, but you can check with Triplex Service first. The knobs on the M-2500 series are the same as on the M-3500 and M-1500 series so you can look for that as well.

When you open the mixer up you may find a classic problem with old electronics: Broken, bulging or leaking electrolytes. However, I went through my whole mixer and inspected every circuit board and didn’t find one, so you probably don’t need to disassemble the mixer before ordering replacements for that reason.

Step 3: Remove the front fixings

You open up these mixers from the bottom, but before you flip it over, there are things you need to do.

First take off all the knobs on any channel strip that needs repair. If any of the potentiometers in the output section needs repair I would recommend that you remove all knobs from that section. I decided to give my mixer a good cleaning while I was at it, so I took off all the knobs.

20170111_231208.jpg

One knobless mixer

Remove any of the nuts on the mixer channels that need repair. There are five nuts per channel, on the TRIM, EQ MID (the lower one), AUX 1, AUX 4 and PAN knobs. As with the knobs, if you need to repair the output section, it’s easier to remove all the nuts there. It’s easy to remember which ones have the nuts because you just start from the top and put a nut on every third potentiometer.

channel-strip

A channel strip with three of its five nuts. The TRIM and MID EQ nuts are removed here

Lastly, you need to remove a few screws on the input section for each channel strip you want to remove. That’s two small screws that hold the mic input in place, and one larger screw that holds the TAPE IN and D. OUT connectors in place.

20180119_091320

These things are all that holds the channel strip onto the front of the mixer but don’t worry, they won’t just fall down, there’s a metal bar holding them in place as well.

If you want to repair or remove the input/output connector section there’s a lot of screws there as well that needs removing. This section consists of three circuit boards, going from top to bottom, one with the row of dual RCA connectors, one with the row of 1/4 jacks and one with rows of various bottom connectors. These circuit boards are not held in place by anything else than the screws and will drop a small bit to land on the internal power supply. You can prevent that from happening by sticking a few contacts in them before removing the screws, and the contacts will hold them in place, if you want.

outs.jpg

The output connectors (and OK, a few inputs)

That’s it for this installment. Next up: Opening the mixer up and taking out the innards.

PyCharm (vs WingIDE, kinda)

I’ve been thinking of checking out PyCharm for a while, and the fact that the amazing Paul Everitt works for them now finally triggered me into doing it. This is some random notes.

  • PyCharm by default adds all files in the directory to the project, forcing you to exclude everything you don’t want. That makes a bit more work upfront when starting to use it for an existing project, which is fine, but when you work with very large projects it’s sometimes less than ideal. It would be really nice if it by default excluded directories that aren’t under version control.
  • “Search Everywhere”, the search box you get up by pressing <Shift> twice most definitely does not search everywhere. In fact, it seems to always find everything except the piece of code I want to find.
  • PyCharm claims to have zc.buildout support and you can choose a file to pick paths from, but it doesn’t work, and PyCharm continues to incorrectly claim that your dependencies aren’t installed.
  • I miss the class and method dropdown boxes in WingIDE.
  • Ctrl-Y maps to yank line, not redo. Annoying (but fixable)
  • Where is revert to disk?
  • Why is there no way to see if a file is modified compared to the disk?
  • What? It doesn’t ask if I want to save when I close the file!? ARGH! It saves to disk directly! TURN IT OFF!
  • Can’t I assign live templates to keys? I have to use a macro? Weird.
  • I have to name the new files I create before I edit them? Weird. And they’ll end up where they end up, which seems to be in the same directory as the file you just opened. You can create files from the file browser as well, but you can’t make a new file and then save it outside the project directory… That’s just too weird.

After a month I’ve decided to go back to WingIDE, despite that it still randomly crashes when you change projects, an annoying bug that has been a constant for ten years now.

New releases of Hovercraft!, svg.path, pyroma, tzlocal, spiny and skynet.

  • Hovercraft! is a tool to make Prezi-style presentations from human-readable text files. Version 2.1 fixes a bunch of bugs, drops Python 3.2 support and adds support for having multiple css-files.
  • svg.path is a collection of objects that implement the different path commands in SVG, and a parser for SVG path definitions. 2.1.1 adds an error-parameter to many functions so you can specify the amount of error you need in calculations, where a higher error means faster calculations.
  • Pyroma tests your Python-project’s packaging friendliness. 2.0.0 changes how data is extracted from setup.py, and now works with pbr and other tools that extends distutils to store the metadata outside setup.py.
  • tzlocal returns a tzonfo oject with the local timezone information. 1.2.1 is a bugfix release.
  • Spiny tests your package under multiple Python versions, like tox, but I like it better. If you can run your tests with “setup.py test” and you have specified supported versions as package classifiers, you don’t need any project configuration. Version 0.5 is the first release that is usable, really.
  • Skynet is a module that doesn’t want to die. It’s purpose is to demonstrate Python’s exit hooks and signal handling.

Red Hat Enterprise Linux 7 experiences

Here are some random notes on RHEL 7.1. Mostly complaints. I think also all complaints from my Fedora 20 post remains. As usual this is posted after I actually stopped using the distro I’m talking about.

Installation

In the “Installation summary” page you must first go to the lower right to turn on the network and then go to upper left for setting date and time, or “network time” (ie sync to a time server) will not be on. I don’t know if that settings is preserved after the installation too, but I don’t want to find out.

The box where you type in your desired hostname is really in a discreet location, it’s easy to miss, and then your system is called “locahost.localdomain”. Annoying.

The partitioning screen is highly confusing. Make sure you have backups, because you are likely to not know what you are actually doing, and even if you aren’t likely to erase a hard disk by mistake, you’ll be scared to death to press the install button.

You have to set a root password, as most GUI tools does not sudo, but runs as root. And if you set it to something different that your own password you will get confused and type the wrong one.

After install make sure you don’t have beta or htb the repos selected. It was selected by default for me, possibly because I use employee subscriptions. If you have that selected and run yum update it will upgrade you to 7.1 Beta.

Shell tests

I ran Fedora 20 on my laptop for over 6 months, and was not happy with Gnome Shell. As a result, I installed several shells on RHEL7, to try them out. I had many recommendations for Cinnamon, so even though it is was to archaic and windows-like for me, I figured maybe I could tweak it or install extras that would give me a more modern behavior with a dash/dock/launcher. Essentially I like Unity, but the effort to run Unity on Red Hat Linuxes seems to have died.

However, Cinnamon was consistently unstable. Often the screen would not turn on when I lifted the lid to unsuspend the computer. If it had turned off the screen to save power, sometimes the screen was just garbled pixels when it came back. The login screen started behaving weirdly. I don’t know why these things happened, the login screen is shown before Cinnamon is even started, but it only happened when I uses Cinnamon as the shell session.

I also tried Xfce, but it didn’t seem to do anything I wanted at all, and I couldn’t find any information on how to make it more modern.

I the decided to make another try with configuring Gnome Shell more to my liking, and after discussions with very helpful people at the #gnome-shell IRC channel, I got to know that a complete reworking of the notifications in Gnome Shell is underway. They are getting rid of the idiotic Message Area (or whatever it’s called) and moving notifications back to where they should be: Visible. Some of the other annoyances I had was also recognized as being so, and in at least one case actually a regression bug.

Between the time of writing and the time of publishing this, the new designs are done, and available in Fedora 22. It will take a long time to get into future RHELs, but perhaps some kind soul can backport future Gnome releases. Red Hat Enterprise Linux is primarily a server OS, so that it’s desktop lags behind Fedora is not surprising. I just hope that Red Hat can incorporate a newer version of Gnome Shell quickly, so that RHEL can compete as a desktop as well.

Still, while waiting for that day to come, there are things you can do to lower the pain of Gnome Shell on RHEL as well. This is much thanks to the one area where Gnome Shell wins over Unity: It’s highly configurable, and there are many extensions.

Gnome Shell tweaks

For Gnome Shell extensions to work you must have rhel-7-workstation-optional-rpms repo enabled, and install gnome-shell-browser-plugin. I have quite a lot of extensions, but here I’ll only mention the absolutely necessary ones.

There are two System monitors, System Monitor, which works but is useless since it shows up in the message tray, so you can’t see it without opening the message tray, and system-monitor, which I used on Fedora 20 and is fantastic. But doesn’t work on RHEL7! Hey ho.

Dash to Dock is an extension that is a must-have. It’s listed as outdated on https://extensions.gnome.org/ but works fine. This may be since RHEL is running a rather old version of Gnome. There is also Simple Dock, but it silently fails with no errors, probably for the same reason.

TopIcons is another must-have. It moves status icons from the Message Tray, where you can’t see them, to the top-bar, where you can. Unfortunately it won’t move the System Monitor widget so it stays useless.

Dual screen pains

The laptop I’m using still has the same resolution as my external screen, despite being much smaller. There is no solution for this that I can find in RHEL either. Switching between a high DPI and a low DPI is very annoying as you will constantly find yourself having too large or too small texts. Using both screens in dual-screen mode is not an option.

I solved this by having both a stationary computer as my main work-machine in my office, and using the laptop at home and for traveling. That way I never switch screens and never switch screen resolution. This is a problem that needs fixing for all Linux variations, and it’s probably going to take a very long time to fix, as it means software needs to stop thinking in pixels.

Software

You have to install the EPEL repos, of course, and the Nux! Desktop repo is absolutely essential. http://li.nux.ro/repos.html

With these two I could install xchat, KeePassX, Quod Libet, skype, and more. And of course things necessary for work, such as git, git-review, subversion, etc.

To get multimedia working (and install Quod Libet, the best music library/player I’ve found so far):

sudo yum install gstreamer gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-bad-free gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg quodlibet

Conclusions

RHEL was definitely tricky and quirky to use as a personal desktop for “power users” like me. But it’s main target is of course as a standardized enterprise install, where users can’t really install software at all, but everything including software selection is managed by the IT department. And in those cases even the problems of Gnome 3 isn’t a drawback, because these departments will typically install the more Windows 95-like Gnome Classic mode.

But for personal use Fedora is better, especially Fedora 22, which I’ve renecently switched to. More on that later.

 

Python date/time libraries

This is an overview of the various date/time implementations in Python (that I know of) and why they aren’t good enough. I’m not mentioning why they are good, they may or may not be. The standard library’s datetime module has a lot going for it. This only explains why it’s not good enough. If I’ve missed a library, tell me and I’ll take a look.

The standard library modules

  • Too many separate modules, datetime, time, calendaring, etc, with some overlap (and omissions).

  • Naive and intentionally crippled timezone implementation.

  • Stores datetimes internally as the local time, which makes time zones overly complicated.

  • timedelta has a days attribute which is actually not 1 day, but 24 hours.

  • Except that the intentionally crippled datetime implementation makes it 23 or 25 hours on DST changes.

Arrow

  • Arrows main criticism towards the standard library is that there is too many classes, like date, time and datetime. However, Arrow does not implement a date() replacement or a time() replacement, an Arrow() object only replaces datetime(). You can’t represent a date or a time with it, Arrow(2014, 5, 6) will return midnight that day. It also will return a timedelta if you subtract two Arrow objects. So it does not improve the situation. Even if you replace all your datetime objects with Arrows, just still need to deal with the exact same number of classes.

    And how should time arithmetic work on a date? What is “The 1st of February plus three minutes”? That’s not obvious. A date is the whole day so it actually should be three minutes after midnight on February 2nd”, but if you implement that I think most people would be very surprised. They would get even more surprised that datetime(2014, 11, 2, 5) – datetime(2014, 11, 2) doesn’t return a 5 hour timedelta. (Actual elapsed time between midnight and 5 am that day is six hours). And even if you implement one object that can behave both as a date and a datetime. How can you tell the difference between a date and a datetime without asking the object if they are the same type?

    I therefore think there should be separate date and datetime objects.

  • In addition I’m not happy about how Arrow.replace() works, with Arrow.replace(month=3) sets the month to March, but Arrow.replace(months=3) increases it with three months. The difference is to subtle, and the replace() method should replace, not add. A shift() method would have been better.

  • All Arrow objects are time zone aware, and default to UTC. But separating time zone aware objects and time zone naive classes are essential, as again, they can’t reliably be compared or subtracted. Just assuming that not specifying a time zone means UTC is not good enough for all cases.

Times

  • Uses Arrow as it’s implementation, so only included here for completeness.
  • Deprecated.

Moment

  • Datetimes are mutable, and they shouldn’t be, because then you can’t use them as keys etc. Possibly there could be mutable datetimes as well, but that should not be the default.

  • Merges dates and datetimes into one class.

DateTime

  • Old, inconsistent and confusing due to being written/extended piecemeal.
  • A lot of old cruft like supporting timezones named “EST”.
  • Unmaintained.

mxDateTime

  • No real time zone support.

dateutil

  • Implements a relativedelta class, but uses the stdlib for everything else, so only included for completness.

Delorean

  • A wrapper around datetime and pytz, chiefly for a more convenient API (I think).

Ubuntu 14.04 experiences

Installing

I’m used to the Ubuntu installer, so I obviously think it’s SUPER EASY! I do wish it was smarter about the locales, I select a Swedish keyboard but an English language for the OS, it should install both the Swedish and English language packs. The Swedish is needed because I want to have international standard date times.

The overlay scrollbars

I wish I could get IBM SAA CUA Scrollbars. They were the shit. You can page up and down with them for example. Ubuntu however has invented some sort of “overlay scrollbars”. I do not like them at all. You can disable the overlay scrollbars, but the “normal” mode isn’t great either. It for example can’t page up and down.

System monitor

System Load Indicator is in the standard Ubuntu repositories. The Fedora version allows having separate indicators per processor. Yes, that’s 8, but that’s much more usable than having only 1. Running one process at 100% is barely visible as it’s only 1/8th of the indicator graph.

Python

Compiling Python on Ubuntu is a bit of a pain, generally, as you need to patch older Pythons to compile, because library files are not where they expect. However, pyenv contains “python-build” a tool to make it easy to build any Python on pretty much any Linux. As a result, this is no longer a big issue.

Issues with Unity

I like the ideas behind Unity and Gnome Shell. I like them a lot. But the move there is not always smooth. In mouse-driven UI design, corners are important. This is because you can “throw” the mouse into a corner without aiming. Move the mouse fast and vaguely in the right direction, and it ends up in the corner. Unlike Gnome shell, Unity has all the window buttons that should be there: Minimize, Maximize and Close. They are on the left, so that Unity can move them into the top bar, hence taking less space. This is one of the things I like with Unity, it leaves the screen space to the applications. This also means that throwing the mouse into the top left corner and clicking closes the window. This is a good behavior, it makes it easy and fast to close windows. But it means that to open the main Unity menu with a mouse, you have to actually aim at the menu button, as it’s up there in the top left, but not actually in the corner. The top right corner is for system settings, logging out and rebooting. The bottom corners are not used for anything, and that kinda seems like a shame. Did they choose the top left corner just to not have people call it “The Start Menu”? I don”t know, but it seems to me that bottom left was not such a bad place after all. The decision to move the window buttons into the top bar also sees the application menus moved there. This causes problems with some applications, for example in some applications the text will continue to be black, and hence invisible on the black menu background.

How it compares with Gnome Shell/Fedora 20

I stayed on Ubuntu 12.04 for a long time because I wanted to use Unity 2D, as Unity 3D was buggy. This was mostly because of driver issues. I’ve now used Unity 3D on 14.04 without a single problem for more than half a year. While Gnome Shell is an exercise in being bombarded by annoyances, Unity is smooth and friendly. The notifications work well, they show for a long time and they go semi-transparent if you hover the mouse over them, so you can still click on whatever is below the notification. Status icons show up in the icon bar, where you expect them. You can choose to auto-hide the launcher or not. With today’s modern wide screens there is plenty of space on the side, so hiding it is really not necessary. Almost any open source Unix software you can think of has repos with distributions you can install. The update manager actually works. It will show updates once a day, and ask to reboot when needed after an update. You can scale the menus and title bars separately for separate screens, that’s a real nice feature. Unfortunately of course this is not a setting of DPI, and applications themselves will ignore it. It wold be really nice if you could use both the laptop screen and an external screen without getting a headache. I have no problems with my processors running on 100% for no apparent reason. OK, fair enough, right now while typing this one core is on 100% doing “nothing”, but the process running that is qemu running some sort of virtual machine. I don’t know what THAT machine is doing that is taking 100%, but the main OS isn’t doing anything anyway.

Conclusion

Ubuntu 14.04 is so nice. It and OS X are the only real contenders for “Top Desktop OS” in my opinion. Much of that is thanks to Unity. Fedora, and especially Gnome 3, has a lot of catching up to do.

Related: Fedora 20

Third goal reached, last hours!

Unexpectedly and amazingly even the third €1200 goal was reached in my funding campaign! The Python community is fantastic! Thanks to everyone!

This is the last day of funding (it says 0 days left), so there is just hours to go (I’m not sure at exactly what time it closes). It’s unlikely that the last goal of €2500 will be reached, but I can find ways to put any money over €1200 to good use. For example, I could print copies to give away at PyCon in Montreal. But what to do with that money depends a lot on how much it is.

https://www.fundedbyme.com/en/campaign/5065/supporting-python-3/