Upgrade to ownCloud 7

I’ve made a terrible mistake.

I’ve heard myself say that many times this year, and I said it again today.

I use ownCloud, and I use it heavily. I use the News feature the most. It’s an amazing News RSS reader. I use it daily, many many times. I use the file transfer, contacts, calendar, bookmarks, tags. I use almost all of ownCloud to help me have a happy and productive life.

Last week, a little yellow notice started appearing at the top of the page, telling me that ownCloud 7 had been released and I could upgrade.

[owncloud upgrade]

Last time I did an ownCloud upgrade, I ran into some minor issues. Nothing much, but I struggled a little to get News working again. This time I was going to be more cautious. I waited. After a week I checked to see if there were issues, and there did not appear to be. So I attempted the automatic upgrade. It went smoothly. At the point where it suggested I backup the directory, I considered it but did not do it. I made a terrible mistake. The upgrade proceeded, and it upgraded the database tables and structures.

After the upgrade, things looked good at first. Nearly everything was there and it worked. And then I started noticing the two big problems.

Tasks did not work. Tasks would attempt to load, but never finish loading the tasks in the database. News was not to be seen, but that was the same as last time. Last time, I fixed it by going into apps and enabling News. Uh-oh, News is not in the app store and I can’t just enable it. I spent a few hours reading and fumbling and trying to make News work. I could not. The News section is so important to me, that I decided to downgrade back to ownCloud 6.0.4, the last version I had running.

Then I wished I had made a backup of the directory. And a backup of the database.

But wait, at 3:30 each morning, I do backup the MariaDB database. So I have a backup from this morning. I copied the ownCloud 7 directory in case I needed anything. Then I installed the code for ownCloud 6.0.4. Then I extracted the SQL for just ownCloud from my backup, and I loaded that in. Then I aimed at my ownCloud URL. It wanted to do the installation. I entered an admin account, and gave it the MariaDB parameters, and wow, I was back in business. The passwords were all wrong, different seeds, so I had to re-enter them. I enabled Tasks and there they were. I enabled News, and bless it, all my feeds were there and I had 70 to read again. But oops, all my files were gone. No matter, I retrieved them from the saved ownCLoud7 directory and copied them into place. And all is well.

I am back to where I was this morning with all services enabled and caught up.

Lessons learned – backup before attempting an automatic upgrade; wait longer before thinking about doing an upgrade; do more reading for the optional modules like News.

I should report these things to ownCloud. I will keep reading their notes and report the Tasks problem. I don’t think the News developer has it ready for ownCloud 7 yet. I think I was premature in upgrading. I’ll keep reading his notes and not upgrade till he says it’s ready for ownCloud 7. I may be on ownCloud 6 for a while.

Marvin for epubs

I already had Marvin installed, and I reinstalled BlueFire, and I went through the appstore and looked at other epub readers.

BlueFire was still twitchy, and didn’t have a way to categorise books. iBooks had a way of categorising and separating books that I liked. I read a book in BlueFire and it’s nice, it’s got a good display of fonts and yes, it looks really good. But no way to categorise that I could see.

None of the other readers looked interesting. I read a book with Marvin. Not as clean a display as iBooks or BlueFire, but it had a cheerful feel to it. I know that’s not scientific, but the display was good enough, the options are terrific, the more I used it the more options I found. Even Dropbox. And a Calibre plugin. And it has a way of categorising books and doing bulk operations on books. I loaded up some of my library and it took it all. I flicked between BlueFire and Marvin, and finally the convenience of Marvin won me. I deleted BlueFire and I deleted iBooks. Marvin is the way forward for me, for the time being.

I just hope they don’t do what most apps do – improve them to the point of unusability.

I would have been happy with iBooks. If I had managed my library in the One True Sanctioned Way through iTunes, I would not have had the problem. But I manage my library without iTunes. I hate iTunes. It’s a spreadsheet abomination that I use as infrequently as possible. So if a full encrypted backup of my iPad means that iBooks will shed all unsanctioned books, I either have to not back up (not an option), or use another ereader. I choose the other ereader. Marvin.

iBooks on iPad lost all my books

I would have to say it threw them away, rather than lost them. It seemed a deliberate act.

I settled down this afternoon to continue reading on my iPad, opened iBooks, selected the book I was reading. The book opened up, displayed my page, and then iBooks dropped out. When I restarted it, all my loaded books were gone. The books from the iTunes store were there, but everything I had loaded from my own sources was gone.

Earlier this afternoon, I backed up my iPad to iTunes. I don’t sync books. I didn’t change any sync settings. I’m not sure if this is related, but from my reading, it appears it might be.

I used to use BlueFire reader, but with the iOS7 update, it got twitchy. If I tapped a book the wrong way, it saw it as a swipe and wanted to delete the book. I moved to iBooks after that. But now iBooks is displaying irritating tendencies, it’s all open again. I’m not going to use an app that will throw away books from my sources and keep the “official” sources. So iBooks is now out. I’ll go back and look at BlueFire, but I’ll also look at Marvyn. I started looking at that earlier, but now I think it deserves a better look.

I don’t require much in an epub reader. Folders, non-twitchy UI, and not throwing away my books when it feels like it. That shouldn’t be hard.

Mac Mini Server

I acquired a mid-2011 Mac Mini Server. It’s got two 500 gig hard drives in it, and 8 gig RAM. Running OS X Lion Server. The guy who sold it had started using it as a server, but never really got into web development. So he was using it for his photos and music. Then he needed money, so he sold it.

He had deleted most of his files, and he had erased most things, but left his Apple ID and other things behind. I didn’t care, I wanted a clean start and wanted to erase everything. First I tried to install Mavericks, thinking that would erase Lion Server. Twice, it got about 4 gig into the 5.32 gig download and then stopped and told me it couldn’t do it. I wasn’t sure if this was because of download problems, or if it was a permissions problem with conflicts over Apple IDs.

Next, I hooked up an external DVD drive, and tried to install a non-server version of Lion. It told me it wasn’t allowed to do that on this machine.

Then I did some research. Turns out there is a hidden partition on the hard disk. Reboot with holding down Command-R gave me a special menu. First up, I used the Disk Utility to erase the two hard disks. Then I asked it to reinstall Lion. Turns out it reinstalled Lion Server. But it downloaded more stuff for six hours, and finally it finished and it reinstalled Lion. This time, I got my Apple ID in, and it was the only Apple ID it knew about. Then into the App Store and start the free upgrade to Mavericks. This was the 5.32 gig download again. It got all the way to 5.20 gig downloaded, and then it froze. Ten minutes went by, then fifteen, then it rushed ahead and downloaded the last little bit.

I then got told that the Server components had been disabled. If I wanted them, I could go into the App Store and buy the latest version. I was happy with that. I don’t want the server component. The Dock icon for Server now had a large X through it. I put it in Trash. Then I used Finder and put the whole Server app into Trash.

This is great. I just wanted another newish Mac Mini that will take Mavericks, and hence XCode, so I can do some development, and that’s what I ended up with. I’ll get XCode on it next week, and the 8 gig RAM will be a big help there. I’ll take the other one home and use it for the same thing. So now, Anne has a newish Mac Mini with Mavericks, and I now have two of them. We can probably stay up-to-date with new versions of the OS for another five or six years.

ownCloud problem

After praising ownCloud so highly recently, I now have to report a problem with the ownCloud Linux client. Everything else works just fine – the webserver, the Mac clients, the iPad and iPhone software – the only thing having a problem is the Linux desktop client.

I have the client installed on my Slackware desktops, installed using sbopkg. The client depends on libocsync.so, and that depends on libiniparser. Both of these are add-ons from sbopkg. libocsync is a version of csync (a file synchroniser) that has been modified to work with ownCloud. It looks for the flag SAMBA_4.1.6 in libiniparser. I don’t know why it does this as I do not use samba at all. Libiniparser got upgraded in April, and the flag changed to SAMBA_4.1.9. But libosync still wants SAMBA_4.1.6 so when I start owncloud now, I get this error message “owncloud: /usr/lib/libiniparser.so: version `SAMBA_4.1.6′ not found (required by /usr/lib/libocsync.so.0)” and it will no longer start.

The ownCloud client has been running on my work and home desktops for a long time, but I rebooted my work desktop and now the ownCloud client won’t run. It’s still running on the home desktop, but the next time I shut it down and attempt to restart it, it’s not going to run either.

I think I had this problem happen once before, but I can’t remember how it started working again. That’s why I started writing here again, it’s my way of making system notes for the future.

I think I waited a little bit and libocsync.so got upgraded to come back into sync with libiniparser. I have a number of options to try and make it work.

Forcing Midnight Commander

I have a theory that most really useful utilities get improved to the point where they are awful.

I’ve been using Midnight Commander (mc) at the command line, in xterms, since 1994. 20 glorious years of useful use. But lately I’ve been struggling with it. The defaults keep getting changed, or else the distribution defaults get changed, and I have to keep making over-riding corrections so I can keep doing what I want to do.

First of all, I don’t want to exit from Midnight Commander and be in the last directory I accessed. Given that this is default Slackware behaviour, I would guess that many people want this. I do not. So every time I do a new installation, or upgrade Midnight Commander, I make the shell scripts in /etc/profile.d.mc* not executable.

Then I want to be in the left pane when it starts. I want Midnight Commander to start with my focus in the left pane, and if I told it to start in a directory, I want that directory to be in the left pane. I have it doing this now, but I can’t work out how I did it.

But the thing that has started driving me to a rage is what directories it displays. I don’t know what other people want, but I want the absolute simplest approach.

If I type mc with no parameters, I want left and right panels to be the current directory. If I type mc with one directory after it, I want left and right panels to both be set to that panel. If I type mc with two directories after it, I want the first one to be in the left panel, and the second one to be in the right panel. That makes sense to me, but I can’t configure mc to give me that. Maybe I am just not reading the right parts of man or the documentation. Anyway, I have conquered this with brute force.

First, I have an alias so if I type mc, it runs my mc script in $HOME/bin.

Second, that script does exactly what I described up above.

#!/usr/bin/bash

DIR1=$1
DIR2=$2

if [ "$DIR1" == "" ]; then
  DIR1="."
fi
if [ "$DIR2" == "" ]; then
  DIR2=$DIR1
fi

/usr/bin/mc $DIR1 $DIR2

And with that in place, my blood pressure and my rage have subsided. Now it doesn’t matter what the defaults get turned to, my use of mc will be the way I want it, how it makes sense to me. I am grateful that I can control this, to allow me to do things my own odd way.

New Mac Mini

I generally buy used Apple equipment, being reluctant to pay the premium for brand new gear. This means I spend less, but tend to be a bit behind. Right now, I have a Mac Mini stuck at Snow Leopard (10.6), a MacBook and a MacBook Pro, both from 2006, stuck at Lion (10.7). They work well, they do all that I need, but they cannot progress to the latest levels of Mac OS X. Normally, I wouldn’t mind. But at work, we have a need for an iPhone app, and I wanted to explore iOS development. For that you need XCode, and XCode needs Mountain Lion (10.8) or Mavericks (10.9) to run. I cannot put XCode on any of my devices. So staying at the blunt edge of technology does not work if you want to do iOS development.

I needed a machine that could run Mavericks. I investigated Craigslist and found once again that most people selling equipment on Craigslists are complete arseholes who take hours to answer texts, won’t give out phone numbers, give addresses that don’t exist, and sometimes don’t even have the equipment for sale. I kept looking at MacBook Pros that were from around 2009 and 2010, that are running Mavericks, and cost about $600. Generally they only have about 2 gig RAM, so I would have to upgrade the memory before doing anything serious with XCode. But the problem with these is that they probably would not be able to run the latest Mac OS X in a year or two. What I really wanted was a development machine that would be up-to-date right now, and continue to be up-to-date for the next six years. I needed to buy a brand new Mac.

Have you looked at the prices for brand new Mac Books and iMacs? Insane. I’m not spending that much money. I ended up getting a Mac Mini with 4 gig. Normally I would get it at Apple, but Best Buy had $10 off, and I had a coupon for $15 off anything, so I got it at Best Buy. Only 4 gig, but I can upgrade to 16 gig for about $150 from Crucial.

I got it to work, upgraded all pieces of software, discovered that I get iWork for free, so got that downloaded, and got XCode downloaded and installed. I am set and ready for iOS development. I have the Big Nerd Ranch book for tutorials on old-school iOS development, and some newer works on Swift development, and I am ready to learn.

Off-by-one bug

Astute readers will have noticed that the code I put here recently for switching themes by time of day had an off-by-one bug. I was attempting to turn the day theme on at 7am and the night theme on at 7pm. The code was

$hour = (int) date ("G");
if ($hour < 7 || $hour > 19)
  $theme = "summer_night";
else
  $theme = "summer_pool";
print "<link rel=\"StyleSheet\" href=\"/css/$theme.css\" type=\"text/css\" media=\"screen\">\n";

This worked well, except that the night theme was switching on at 8pm, not 7pm. However, as it is still light at 9pm in summer, I thought it appropriate to leave the code running as is, and change my notes on the league website to say that it changes at 8pm. Much easier.

If I really wanted to switch at 7am and 7pm, the if statement should be this:

if ($hour < 7 || $hour >= 19)

Modernizing Legacy Applications In PHP

I write a number of websites in PHP. It’s old school PHP, functional. No OOP. It works for the most part, but I want to modernise it.

I follow Paul M. Jones’s blog. I read segments of chapters as he wrote this book Modernizing Legacy Applications in PHP. When the book was ready for purchase, I bought it.

I have started working with it to modernise my websites. It’s a long hard road to follow, but I am working at it. So much new stuff to learn – PSR-0, OOP. So much to do, so little time, but it’s keeping me very active.

Timezone changes on the league website

On the league website, we added two CSS themes for summer – a turquoise swimming pool one for daytime, and a darker night-time one. They switch at 7am and 7pm, my time. But as the players are spread all round the world, it didn’t seem appropriate to change the day/night themes only at US/Eastern time. I wanted to give users the option to set their personal timezone, and have this used when displaying the theme and later on, for other things.

This is all done in PHP, and it’s legacy style code.

So first of all, the code to set the theme based on the time is done like this:

$hour = (int) date ("G");
if ($hour < 7 || $hour > 19)
  $theme = "summer_night";
else
  $theme = "summer_pool";
print "<link rel=\"StyleSheet\" href=\"/css/$theme.css\" type=\"text/css\" media=\"screen\">\n";

Then I allowed users to change their profile and set their timezone. I got some code from Stackoverflow to populate a select with all valid timezones.

Users get to set their timezones with values like “America/New_York” and “Asia/Singapore” and “Australia/Perth”. Once users could set their timezones, when they login or change their timezones, I store their timezone value in their session data. I do not want to be looking this up in the database every page access they make. So once that was done, the original function to set the theme became this:

if (isset ($_SESSION['tz']))
{
  date_default_timezone_set ($_SESSION['tz']); # Set to their timezone
  $hour = (int) date ("G");
  date_default_timezone_set ("America/New_York"); # Set back to me
}
else
{
  $hour = (int) date ("G");
}

if ($hour < 7 || $hour > 19)
  $theme = "summer_night";
else
  $theme = "summer_pool";
print "<link rel=\"StyleSheet\" href=\"/css/$theme.css\" type=\"text/css\" media=\"screen\">\n";

If the user has not set his timezone, then I continue to assume that it’s done in MY timezone. But if the user has set his timezone, it will be in the session data, and I can use it. My webserver has the time set to UTC. I think this is why it was so easy to do. I’ve been setting system time on all my Linux systems to UTC for 20 years, and finally I get the benefit of it. So all I have to do is get the current time but filtered through the user’s timezone, and extract the hour. It works. I set the timezone back to mine afterwards, as I need it in my timezone for other things. Eventually, those other things will be translated to to the user’s own timezone too. This is a start.

←Older