Archive for February, 2011

More than 3 conditional formatting options in OpenOffice Calc

Wednesday, February 23rd, 2011

It had to happen 🙂

Long story short, I just made a spreadsheet with a list of products in different states and I color coded them. I got 5 states. Conditional formatting only has 3 conditions. If I’d had 4 states, it would have been solved easy, by setting the default formatting for the cells to something and let that be the 4th status.

Now, I did some searches and first thing I found was some macro. Uhm… I don’t quite like to go into macros. Gets your document dependent on stuff. Nasty.

Some more searches showed the STYLE function. It returns 0 (zero). It’s only useful in formula cells. So what do you do if your cell contains some text that is not a formula? Or even if it IS a formula, but you don’t want to change it for whatever reason.

Well, Just move that column to somewhere else, and in place use a formula like:

=IF(STYLE(“Status-” &ROUND(F1))=0;G1; “error”)

BUT FIRST … you need to:

– create 5 styles names “Status-x”, where x ranges from 0 to 4. (Obviously you’ll adapt to your number of colors and naming preferences)

– create the $F column (well, you’ll just use this as helper) in which you will set your status, like 0, 1, 2, 3, 4

– have your $G column be the one with your needed values (the one you moved to, previously)

– and you’ll get “error” (put whatever you like here) in the column if something goes wrong. But the STYLE function will always return 0, even if no style defined, so that won’t help much. But you gotta put something there that will make sense, just in case STYLE will not return 0 (zero) 🙂

So I said I’ll be short, so .. till next time.

Related posts

Concrete5 MU (MultiSite)

Sunday, February 6th, 2011

As some of you might have read, I am looking for a MU CMS generic solution for my server because I just hate administering tons of software.

So, after WP MU failed miserably from support point of view ( I decided to take a better look at C5 (which I already had installed). And luckily, while browsing the how-tos, I bumped into this nice howto:

I think I can live with 2 systems: WP MU for the blogs and C5 MU for the rest. Now it’s only a matter of getting “the rest” converted to C5…

First step: the photo gallery (it has some needs that none of the major dedicated photo galleries out there had about 1-2 years ago when I tested them and got stuck with gallery2, which lost some other needed features with their version 3).

Considering how “fast” I move when it comes to such things, I think it is safe to say that you should expect “news” on the subject in say … 6 months 😀

Related posts

Please use mysql_upgrade to fix this error. (1558)

Sunday, February 6th, 2011

that just doesn’t sound right, does it. I just now noticed it when I ran my cron backup manually. Complete error is:

mysqldump: Couldn’t execute ‘SHOW FUNCTION STATUS WHERE Db = ‘your-db-here”: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077, now running 50152. Please use mysql_upgrade to fix this error. (1558)

so I ran mysql_upgrade , errored about password, then I ran mysql_upgrade -p and all was ok. Well, at least from the script point of view.

Running the backup again revealed another error:

Cannot proceed because system tables used by Event Scheduler were found damaged at server start (1577)

Reading about it on the net, somebody suggested a mysql restart after running the mysql_upgrade script adn what do you know, it did it.

Do note that you need to be logged as root for that command line to work. Otherwise, make sure to specify root user in the command line.

One thing that I did notice a while ago was that the “all” backup (which dumps all tables) was failing, but I didn’t give it too much attention since the per-table backups were ok. Seems this upgrade thing solved that issue as well.

This one was simple 🙂

Related posts

CVS out of the house

Sunday, February 6th, 2011

As expected, after I finally migrated all my cvs projects to my svn repository it was high time to remove this … relic 🙂

Related posts

Migrate CVS to SVN with cvs2svn

Sunday, February 6th, 2011

Well, as it usually happens with stuff I do, it gets out of the “ordinary”. It almost never gets easy enough.

So, this time, cvs2svn. Great litle tool. Only problem is that in my centos 5.5, the subversion I installed for some reason I don’t remember and didn’t bother spending time figuring out, it created a repository based on sqlite or something. In any case, the repository and the projects are not directories, as happens in most or all examples on cvs2svn out there.

So, since you can’t use svn2cvs on local repository as in the tutorials, I searched for a way to use it to migrate to a … “remote” repository 🙂

And I eventually found this:

Looked promising. I made the dump and then figured I have to install the svn-pusher. Obviously, I got

[root@Impuls ~]# apt-get install libsvn-core-perl
Reading Package Lists… Done
Building Dependency Tree… Done
E: Couldn’t find package libsvn-core-perl

So, I did a yum search push and found

perl-SVN-Push.noarch : Push Repository to Remote Subversion Repository

trying to install that, failed with dependency check on subversion perl:

subversion-perl-1.4.6-jason.1.i386 from utterramblings has depsolving problems
–> Missing Dependency: subversion = 1.4.6-jason.1 is needed by package subversion-perl-1.4.6-jason.1.i386 (utterramblings)
Error: Missing Dependency: subversion = 1.4.6-jason.1 is needed by package subversion-perl-1.4.6-jason.1.i386 (utterramblings)
You could try using –skip-broken to work around the problem
You could try running: package-cleanup –problems
package-cleanup –dupes
rpm -Va –nofiles –nodigest


[root@Impuls ~]# yum erase subversion-perl
Setting up Remove Process
No Match for argument: subversion-perl
Package(s) subversion-perl available, but not installed.
No Packages marked for removal

after some hours of digging around I learned that this is because I already had installed the subversion.1.6.13-0.1.el5.rf so removing that and the svn_web_dav with yum and then installing subversion and svn_web_dav and perl-SVN-Push solved everything. Then I tried cpan with svn-pusher and that finally worked.

then came the migration:

[root@Impuls db]# svnadmin load –parent-dir delphi /svn/ < /launcher.dump
svnadmin: Expected FS format ‘2’; found format ‘4’

a little digging around showed the cause: I previously had installed a newer version of subversion and created the repository with it. now, since I downgraded, it was no longer supported. Crap.

So, uninstall the jason version subversion and reinstall the previous one. But … there is no sense in doing that from the cd/dvd as I’d end up in the same situation. So I searched the net a bit for the rpm version I had looking for a source that had all my needed dependencies and finally found :

installed everything and voila:

svnadmin load –parent-dir delphi /svn/ < /launcher.dump

worked without errors.

But, as I already told y’all, in my case nothing is *that* simple. And here’s again why: I don’t use trunk/branches/tags or any other such structure for my projects. And that’s because I wrote them all, they are pretty small and until now I never needed this structure. And of course, I hate having 2 empty dirs in all my projects (branches and tags) plus an unneeded nesting level (tags).

So, what to do. I first wanted to cancel the import but when I saw that you need to “hack” things in order to remove the stuff without anybody ever knowing about it (given that I am the only person using my repository it’s a bit too paranoid even for me) I decided to just make 3 new revisions by deleting the “offending” directories and re-create the dump properly.

I then tried

cvs2svn –trunk-only –username=ciuly –trunk=Launcher –branches=Launcher/branches –tags=Launcher/tags –dumpfile=/launcher.dump /cvs/delphi/Launcher/

obviously, errored.

A bit of thinking and looking in the dump file got me an idea: modify the cvs2svn to NOT create the branches and tags directories when dumping 😀 And this time it was damn easy too. I only searched for a few things and in less than 5 minutes I got to modify the on line 467 and removed branches_path and tags_path from the initial_directories array. Ta-Da.

now running

cvs2svn –trunk-only –username=ciuly –trunk=Launcher –dumpfile=/launcher.dump /cvs/delphi/Launcher/

properly produced the desired dump file for importing into my svn repo suitable for my structure with

svnadmin load –parent-dir delphi /svn/ < /launcher.dump

complete with history. Only “issue” was that in cvs I used the user “impuls” where as in svn I changed it to “ciuly”. And the history kept it as impuls. Not a big deal after all. That can be changed too 😀 But I don’t have time right now for such minor issues. I have to finish moving my cvs to svn properly.

And I didn’t even need that svn pusher thing. damn 🙂

PS: now, when I’m finished, I realized that the reason why I thought I have to do a remote svn import was because I had an error in my svnadmin load command line. oups 😀

Related posts

How to write an infinite recursion … elegantly

Wednesday, February 2nd, 2011

I’m working on a DB Lookup Combo with filter, sorting and most important: instance search (like winamp).

So, I figured I’d use a TClientDataSet as a proxy dataset for my combo and just descend from TDBLookupComboBox

All nice and dandy until the part where I have to respond to changes in the original dataset and update my proxy one. As always I did it like




while not dataset.eof do blabla




The component was integrated into a financial application and for some reason I got the freeze, but only for a few seconds. For the life of me I couldn’t figure out what it was wrong, especially because from about 10 similar adotables and about the same number of forms, similar in construction and components, it only happened with one and only one. MadExcept by itself was not useful as setting the freeze timeout to 2 second it didn’t fire. Then I remembered madTraceProcess.exe and that did it: it showed the issue being in my component. A few breakpoints in the right spot (trial and error) got me seeing the recursion happening on the dataset.enableControls line. A few more minutes of debugging proved that the issue was caused by that usage as I was doing it in the DataLink.DataSetChanged method which is called when the dataset “changes”. But if you look through the code in DB.pas you’ll notice that the datasetChanged is called in a lot more other situations, but most notably in EnableControls.

Long story short, this is probably the “best” infinite recursion I’ve ever seen till now. and it was caused because my assumption that datasetChanged is called when the dataset changes. Wrong, it is called in EnableControls as well.

Related posts