Archive for January, 2010

mod_rewrite and Concrete5

Sunday, January 24th, 2010

I was trying to additionally rewrite an URL before letting the classical Concrete5 mod_rewrite happen – everything matched to index.php, like so:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

Íf you try to paste any additional RewriteRule before this catch-all rule, your Apache will run into an endless loop, probably giving up with a 500 error. Your log will show something like:

access.log

(…) "GET" "114.ideaday.de" "/stellenmarkt/stellenangebote/" "redirect:/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/stellenmarkt/stellenangebote/"
error.log

[Sun Jan 24 16:57:52 2010] [error] [client 85.181.108.54] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

Apparently mod_rewrite fails to recognize index.php as already being rewritten and keeps looping through the rule over and over again. Recent versions of Apache will stop after 10 iterations and yield a 500 error.
After nearly giving up, I've figured out a solution how to do this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^stellenmarkt/stellengesuche/(.*)-([0-9]+)[/]*$ stellenmarkt/stellengesuche/gdemo/?id=$2 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

As you see, the additional rule is placed before the Rewrite Conditions! This works, no more endless loops :-)

Concrete5 Translation

Monday, January 18th, 2010

Official statement

http://www.concrete5.org/community/forums/internationalization/multi-lingual/

  • messages.po = template, edit it with poEdit
  • messages.mo = compiled file
  • create directory "xx_XX/LC_MESSAGES" (language_COUNTRY) in the languages/ directory
  • save messages.mo into that directory
  • add define('LOCALE', 'xx_XX'); to config/site.php

Converting TMX files to PO files

There is a tool to achieve the opposite: http://translate.sourceforge.net/wiki/toolkit/po2tmx

MakePOTty

Samuel Murray has an AutoIt Script to convert TMX files to PO (requires OmegaT and AutoIt)

http://www.leuce.com/tempfile/omtautoit/

Unfortunately MakePOTty did not work for me – special situation – but it might for you!

Translating by hand

Use poEdit, no really – use it. It's a fantastic tool for the job. I can give you the specifics if you're interested.

Merging

Use WinMerge to see what strings someone else has already translated in your targetted language – else poEdit will throw errors.

Fuzzy translations and other tidbits

Translations marked fuzzy will not be used by Concrete. So, if you're not getting the whole Monty of your translations, please defuzzy your .po file first :-)

Deutsche Übersetzung für Core Commerce:

Sie ist da, in einer Beta-Version. Bei Interesse daran sie von uns zu kaufen, bitte ich um Kontakt.

Durchlaufende Posten und 7 % Mehrwertsteuer

Wednesday, January 13th, 2010

Rufnummer Finanzamt München I

089/1252-1336

Durchlaufende Posten (Auskunft vom Finanzamt)

  • wenn ich Leistungen anderer unverändert durchreiche, dann kann ich sie original so wie sie waren auch mit dem entsprechenden Satz von 7 % weiterreichen
  • falls ich selber etwas daran mache, dann muss ich 19 % Mehrwertsteuer berechnen.
  • Deswegen bietet es sich bei zusätzlichen Leistungen an, diese in einer gesonderten Rechnung aufzuführen, und den durchlaufenden Betrag so weiterzureichen.
  • Die 7 % Mehrwertsteuer von mir werden in einer anderen Zeile erfasst (eine Zeile unter 19 %)
  • Die Vorsteuer wird komplett zusammenaddiert, egal ob 7 % oder 19 % und in der dafür vorgesehen Zeile erfasst.

Voranmeldung und Geld

  • Die Voranmeldung für die Mehrwertsteuer muss bis zum 10. des Folgemonats da sein
  • Das Geld muss auch bis zum 10. beim Finanzamt eingegangen sein
  • Bei Lastschriftverfahren wird das Geld einige Tage drauf abgebucht, d.h. es lohnt sich bei höherer Vorsteuer die Anmeldung möglichst früh zu machen, damit sie möglichst früh prozessiert wird und man das Geld zurück erhält
  • Januar ist keine Ausnahme, da sollte das Geld auch normal eintreffen

A promise given lightly …

Wednesday, January 13th, 2010

is worth nothing.

Yesterday my father confronted me with the promises to work on his site VitaNIT.

Today I've also made statements, promises, which I didn't intend to keep. I caught myself out on a few ones: my brother asked my opinion about a certain idea of his, usually I try not to break enthusiasm by coming down hard on his ideas. This time I did, I told him I saw no future in this idea at the moment, that I would rather pursue one of his other ideas.

Where does time come from?

From saying "no". From deciding "no".

I'm already evolved beyond saying yes to all projects. I've got a lot going on in my life, but still I'm not handling it in a perfect way. Actually the other day I had insomnia worrying about everything coming together, timewise.

Why? I didn't say "no" to a customer. To several customers. I did not communicate, and calculate that the requested changes in the requested timeframe with the requested additional budget (of 0) would not be feasible by a third party. I would have to work, and have worked, myself.

Kicking aside other promises, that is.

Thus, a promise given lightly to another party, which I feel bound to oblige (he is after all a customer!) breaks other promises given to people I know I can keep postponing executing the promises. At least until they themselves come down on me (at the cost of one evening of arguing and heated feelings).

I'm insecure in saying "no" to people. Part may come from my upbringing, and my father being very demanding without noticing it himself, part from my genetic and hormonal background. My brother is much tougher than me and he's had the same parents.

Disappointing people

For me, it's about holding promises. I really try to be an honest and reliable person. To everyone.

I've introduced systems of organisation which helped me speed up searching and storing of files, of bills and other things.

I've started working together with other freelancers, giving tasks to them. And catching them if they fall – work left unfinished would be done by me.

Many customers know no bounds and do not know about the time, knowledge and effort necessary to produce a certain result.

Often their budget is not sufficient to realise exactly what they have in mind. Often they try to reason, if I do this job for them on a budget, they'll recommend me, and I'll also get other jobs from them. On a budget. Again.

Disappointing other people is not easy, for me it's not. But it's better done upfront in a nice and friendly manner, than being in a temper about promises made to the customer, stealing family and own free time.

Do you know the guilt when you enjoy a movie instead of working? If it's a movie every other week?

Then, my friend, I think we have something in common. And the two of us need to adjust our work styles.

Broken pages in Lectora: JavaScript the culprit

Tuesday, January 12th, 2010

… can have multiple reasons. Here we're looking into one particular broken page, Codificando con la CIF (Coding with the ICF). All previous and all following pages seem to work OK.

The page displays as disarranged objects, apparently with broken JavaScript functionality.

Step 1: Disable all inherited objects.

Result: The page displays correctly.

Step 2: Reenable all inherited objects

Result: The page is broken again.

Step 3: Look at the error in Firefox' error console:

It is a JavaScript error:

Error: unterminated string literal
Source File: file:///I:/101-199/104.2-who-trainer/104.2-M01-D12/v8.17d-es/page19948.html
Line: 228, Column: 28
Source Code:
VarAktuellerSeitenname.set( 'Codificando

Step 4: Try to adjust the site's name

I also adjusted the site below it.

This did not help.

Step 5: Fix the problem in the HTML

Because this is easy to fix, and a single error, I decided to cater to Lectora's fancy and just fixed it in the HTML. Hey, we're working on a budget here :-)

VarAktuellerSeitenname.set( 'Codificando al CIF' )

The error consisted of a line break inserted by Lectora into JS code.

Remember, you can always hire us to fix your problems.

Lectora & strange span behaviour

Tuesday, January 12th, 2010

Lectora breaks some spans while exporting a translated version.

Example:

<div id="text41624"><a name="text41624anc"></a>
<p style="margin-left:15px;text-indent:-15px;line-height:1.127;margin-top:0px;margin-bottom:0px;text-align:left;" >
<span class="text41624Font8" style="position:relative;top:-0px">1.</span ><span style='font:1.0pt "Arial"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="text41624Font8" >El siguiente cap</span ><span class="text41624Font9" >í</span ><span class="text41624Font8" >tulo:
</span ></p >

The first span: <span class="text41624Font8" style="position:relative;top:-0px">1.</span > should not be there.

After deleting several chapters and the complete navigation from the Lectora title, the SPANs and DIVs are rendered correctly.

Experiment 2: Removing inherited items from the broken pages.

Result: after removing all inherited items, except for the forwards button, the broken DIVs and SPANs work correctly!

Interesting side note: in the chapters afterwards, in which I did NOT disable inheritance, all DIVs and SPANs also continue to work, no strange numbers or other erratic behaviour. There is something wrong in the first chapter!

Experiment 3: Locating the problematic inherited item

By turning on arrays of inherited items I'll try to locate the problematic one.

  • enabling all navigation: no problems
  • nearly all items, except of the comment script: ok
  • enabling all items: now everything works again!

If you're ever stuck in a situation like this, don't give up just yet. Try things and see if you can fix it by actually returning to the normal state.

Here's an example how the error looks like:

Unfortunately I was not able to fix the problem by randomly deleting items this time … it persists.

101121 Update:

Exporting the title with Lectora X does not solve the problem.

101219 Update:

We have analysed the problem. It seems to happen when importing RTF translation files into Lectora. If you copy strings from Lectora and put them into Open Office writer, they sometimes show up with 1) . These are the strings which will be exported as 1. to HTML, creating an additional SPAN.

As a quick solution, I have written this Ruby script (you probably have to modify .php to .html or .htm for your project in this script). Please note that this tool may remove spans which should not be removed, as there is no way to decide on the HTML level.

icf-tool-fix-es-spans

Another quick Lectora tip:

When rendering HTML, it offers the option to you to print. If you have a virtual PDF printer installed, you can save some time by "printing" the errors on it, instead of searching through the wad of output in the HTML render dialog.

Tags: Lectora, broken spans, Lectora inserts strange characters, rendering HTML, virtual PDF printer.

If you're running into problems with Lectora and have a deadline to meet consider using our services.


Concrete and Section

Monday, January 11th, 2010

If you want to query whether a given page is in a specific section, you should go:

$this->section('about/something');

This returns true or empty. Useful for, i.e. adding classes to images to hilite them.

Attention: do NOT add a leading slash, as stated incorrectly in the Concrete documentation (as of 11.01.2010).

Indiana Jones 4

Sunday, January 10th, 2010

Yesterday I saw Indiana Jones and the kingdom of the crystal skull.

Die Leute die mir gesagt hatten, dass der Film weniger gut wäre, hatten Recht. Es ist ein guter Actionfilm, aber kein Indiana Jones.

Ensuite, nous avons vu le vieux film.

array() and new array()

Saturday, January 9th, 2010

In PHP, when creating a new array, do not add "new" in front of array.

$ary = array();

NEVER $ary = new array();

Else you'll be wondering why the whole damned thing doesn't work, although everything seems to be setup "just like in the other code". One word makes a huge difference. To PHP, that is.

Zeit sparen

Saturday, January 9th, 2010

1224529 hourglass

… warum hasten? Wohin sich beeilen?

Um noch mehr Zeit zu haben für die unangenehmen Dinge? Die Dinge, die einem keinen Spaß machen, für die man aber in der Pflicht steht?

Mag sein, dass es für einen früher reizvoll war, genauso wie das Tanzen am Anfang seinen besonderen Reiz hat – man lernt ständig neue Figuren, hat Spaß an der Herausforderung …

Lieber im Bett bleiben und richtig genießerisch ausschlafen, die Welt um sich vergessen – das ist manchmal das beste Glück, wenn man vor Verpflichtungen nicht mehr weiß wo einem der Kopf steht.

Noch besser: die uninteressanten, unangenehmen Pflichten, bei denen man eine Wahl hat, nach und nach abbauen / auslagern.

Bild: O_m // sxc.hu