Feb 032012
 

We have seen this error with Concrete 5.5.1

You try to setup Concrete 5, and get strange SQL errors during the installation:

If installing with an empty site, like this

c5-nosample-content-chosen

you get:

c5-mysql-error

mysql error: [1048: Column 'uID' cannot be null] in EXECUTE("INSERT INTO Config (cfKey,cfValue,uID) VALUES ('NEWSFLOW_LAST_VIEWED','FIRSTRUN',NULL)")

If installing with Sample content with Blog:

c5 with sample content

The error you get is:

Catchable fatal error: Argument 1 passed to ContentImporter::importPageAreas() must be an instance of Page, boolean given, called in /concrete/libraries/content/importer.php on line 75 and defined in /concrete/libraries/content/importer.php on line 197.

 

Solution:

You don't run Varnish by any chance, do you? We do, and we had it set up to … dispose of some cookies. The solution is, in Varnish' case, to enable pass-through for the host you are installing on.

You want to enable cookies.

 

Explanation:

The code which breaks is located in concrete5.5.1\concrete\models\package\starting_point.php

Config::save('SITE', SITE);
Config::save('SITE_APP_VERSION', APP_VERSION);
$u = new User();
$u->saveConfig('NEWSFLOW_LAST_VIEWED', 'FIRSTRUN');

As you see, this is the first time a User is created and used.

The User class is defined in concrete5.5.1\concrete\models\user.php

if (isset($_SESSION['uID'])) {
$this->uID = $_SESSION['uID'];
$this->uName = $_SESSION['uName'];
$this->uTimezone = $_SESSION['uTimezone'];
if (isset($_SESSION['uDefaultLanguage'])) {
$this->uDefaultLanguage = $_SESSION['uDefaultLanguage'];
}
$this->superUser = ($_SESSION['uID'] == USER_SUPER_ID) ? true : false;
} else {
$this->uID = null;
$this->uName = null;
$this->superUser = false;
$this->uDefaultLanguage = null;
$this->uTimezone = null;
}
$this->uGroups = $this->_getUserGroups();
if (!isset($args[2])) {
$_SESSION['uGroups'] = $this->uGroups;
}
}

The constructor checks in the Session for a valid user ID. If no user ID is found, it is set to zero. This happens if you throw away the cookies! Because the session is stored in them.

HTH. Feel free to comment on similar errors and solutions.

Aug 042011
 

For my worldwide Internet access project surfnext.com I developed an extension for MediaWiki to use amMap.

What is amMap?

amMap is a pretty cool Flash-based map which allows you to display geographical information. Check out the examples on amMap.com. It has been used on many pages world-wide, and now – thanks to SurfNext's needs – it is coming to MediaWiki!

What is MediaWiki?

It is the Wiki software which is behind Wikipedia and many other major wikis. SurfNext.com is also based on MediaWiki. Ah, the power of free software!

Why Flash, why amMap?

Because there is no free JavaScript-based map out there, which is not based on tiles. (Please post a link if you know any vector-based JavaScript map !!!)

Unfortunately iDevices (iPhone, etc) do not have Flash capabilities. Thus, you can't see the amMap on them.

Android has Flash support.

Download & Credits

Download version 0.5. (amMap v. 2.5.7 is included).

amMap requires you to leave the link to amMap (inside the map) intact, or to buy a commercial license.

I ask you to provide a back-link to my project SurfNext.com, if this extension is of value to you.

This extension is still in early beta, use at your own risk. Post comments about the extension on this blog page, thank you!

Installation

snAmmap requires MediaWiki 1.17 or higher, as it uses ResourceLoader. (Feel free to fork a version for earlier MediaWikis).

An alternative, of course, is to upgrade your Wiki. It is advisable, as the new release sports significant speed enhancements.

  • Put the snAmmap folder in your extensions folder.
  • Add require_once("$IP/extensions/snAmmap/snAmmap.php"); to your LocalSettings.php
  • If you want to, you can create custom data and settings files and put them somewhere in your Wiki installation path. (i.e. a folder custom)

Usage

Currently snAmmap only supports one map per page. After you have installed the extension, use the following tag in your Wiki where you want to include the map:

<ammap height="500px" width="500px" bgcolor="#FFFFFF" data_file="/custom/data.xml" settings_file="/custom/settings.xml">Placeholder text</ammap>

None of the tag's attributes are required, there are sensible defaults for them (falling back on the data_file and settings_file provided with amMap, for instance.)

  • height => sets the height of the map. Can be a percentage
  • width => sets the width. Can also be a percentage.
  • bgcolor => sets the initial background color, which can be modified in the settings file later.
  • data_file => sets the path (URL!) for the data_file. Can be a full URL with hostname, but you have to enable cross-site scripting, which is dangerous. Use a file from your server, preferably.
  • settings_file => sets the path for the settings_file

See the documentation of amMap for more details and information what you can modify.

Live Example

SurfNext.com uses the snAmmap extension on the main page in conjunction with custom data and settings files for a map which links to Wiki pages. It also has a dropdown menu from which you can select the individual countries by name, which also links to the Wiki pages.

SurfNext shows you how to obtain Internet access everywhere in the world. Feel free to join and participate!

Feel free to comment about SurfNext on this blog page.

Jan 272011
 

This is a release of all old code which I found on my harddrive, related to many different projects and of different age and quality. Feel free to browse, download and use all of the code on this site. I would appreciate a backlink, but this is no must.

The code has been compressed with 7zip.

License

Unless otherwise stated all code referenced in this post is released under the Apache 2.0 open source license.

Please double – check the code before using, I can give no warranty of any kind for its fitness for your purpose or good behaviour. Some code may be yet in unfinished and untested state.

Some tools and code included in my downloads originate from other authors. They have been included for your convenience, please read and respect their licences. If some license owner is unhappy with me putting their tools into my downloads, please contact me to resolve the matter.

Code

1. Google Analytics Batchpatcher

google analytics batch patcher screenshot

This is  an application written in Ruby, and designed with a GUI Builder (foxGUIb) based on FxRuby.  It has been processed with Erik Veenstras & Cowlibob's Rubyscript2exe to create an executable package ready to run on systems without Ruby (which should be the most).

It's purpose is to patch a lot of HTML files simultaneously, inserting code (it must not necessarily be Google Analytics code) just before the <\body> closing tag.

Usage

Select the work directory (preferably a copy of your live files!) using the directory browser on the right by double clicking. The folder selected will be shown on top. The Application will automatically recurse in subdirectories.

Set the file filters (the last one allows you to set an arbitrary extension). The default selected ones are .html and .htm

Enter the code you want to be patched in under "Google Analytics code". This can be any kind of code.

Hit "Patch!", and be patient – especially for large file sets. After the application has finished processing your request, you can see what has been processed in "Output".

The application will search for some "magic strings" to ensure that the file has not already been patched / incorporates Google Analytics code. This will only work for the old Google Analytics code, it will patch in copies of other code every time you run it. Unfortunately, this "magic strings" will not work for the newest version of Google Analytics code.

Known Bugs and Problems

  • Apparently it hits UAC when you start it in Windows 7 (perhaps because it has a directory listing component?)
  • The application will seem to hang on a very large fileset, it will update the progress output only after processing all files.
  • There is no "dry run" option – once you hit "Patch!" the application starts processing
  • "Umlauts (ä ö ü)" will display incorrectly in the log output, but they will be processed (this is probably a limitation in Ruby's handling or rather lack of handling of UTF-8)
  • With the newest version of Google Analytics code, this tool can't recognize if a file already includes the code – and would patch it twice. Use a tool like HD Search and Stats to find these files.

Download

2. Miscellaneous Ruby scripts

Somebody may find a useful approach to some problem here. Remove the .txt extension before using the file, it is just for download purposes.

  • removecuesheet.rb
    Interacts with Foobar to remove cuesheets from APE (Monkey audio) files
  • addcuesheet.rb
    Adds cuesheets to APE (Monkey audio) files using Foobar. You need to edit the script to provide the correct location of Foobar for instance.
  • htmlnuke.rb
    Deletes all html files in the folder it is run in
  • killindexhsub.rb
    Deletes all index*.html / index*.htm files in the folder it is run in and all subfolders of it recursively
  • timer.rb
    Plays a sound file every 30 seconds using the Windows32 API (that's the interesting part I got off some Ruby website!)
  • ruby.ebutcher
    This script reads a webpage (which you would need to set up and modify the script accordingly), and monitors the running processes in your (Windows) system. On start it kills all "offending" processes immediately, later it waits for a random time before killing or freezing the processes. The tool needed to do this is included (its the one by SysInternals, thanks!)
    It is intended to serve as a crude "babysitting" tool, which does not give itself away too easily.