Saturday, October 29, 2011

My answer to "German Umlaute transformed to chinese signs :-)"

This is my answer to a Question on Support site for LampCMS project


OK, since you mentioned the error from iconv, I suspected that you may not have mbstring extension on your php. The way it is setup now is that the program uses mbstring to handle utf-8 related functions but then if the server does not have mbstring, it uses iconv as a fallback option.

So basically on this server iconv is never used because we have mbstring, which usually handles multibyte string parsing better.

This is just one the the possible reasons for your errors. Just look in your phpinfo() output as see if you have mbstring enabled.

Wednesday, October 26, 2011

Latest updates to Lampcms now on Github

My Question on Support site for LampCMS project

I recently commited the recent changes to github.
The main changes are: IP to Location module has been completely rewritten to use MongoDB instead of compiled DB file to store IP to Location database.
This means that relying on shared memory extension is no longer required - one less thing to worry about. Since this project requires MongoDB that means that you will be able to use IP to Location lookup guaranteed.

All you have to do is download the GeoIP database from Mixmind.com and make sure it's a .csv version.
I wrote the importer script for it, it's in the root www directory, called geo_import.php

That file has instructions on how to import geo file into your MongoDB.

Once imported the program will use the new classes to lookup location info for your visitors. Lookups are very fast - about 3 milliseconds per lookup and they are done in the shutdown function, after the page has been served to the user, so even these extra 3ms are not added to end-user browsing experience.

Another change is the addition of the "Whos online" module. This module is activated by default. To turn it off comment out the online module in the [OBSERVERS] section of !config.ini

What this module does is stores the data about the visitors browsing your site - it records user info, the url on your website that they are on currently, the ip, the resolved Geo Location based on IP, which usually includes longitude and latitude, country name, and sometimes city (also states are for US and Canada only)

This module only records the data, it also deletes records older than 24 hours so that the ONLINE collection does not grow too big and lookups will always be very fast.

There are 2 separate collections actually - ONLINE keeps track of logged in users and GUESTS keeps track of non-logged in users just browsing your site. For non-logged in users ip address is used as unique id

This module only records the user data, there is currently no functionality to display the "who's online" details on the site.

I'm working on this next, there will be an option to add a block with stats on number of guests and users currently online, also whole page will be available to show details on who is doing what on the site currentlly and later I want to add option to put all visitors on google map.

Also it will be possible to add small blocks of info of who is currently reading "this" question or "this" tag.

And also it will be easy to add small icons next to user to indicate if they are currently online or not.

All these is coming next. I also want to add API calls to get the "Whos online" data.

Finally I added a debugging comments to templating engine, so when your site is in debug mode, the html comments are added to beginning and end of each template so you can view the html source code and see the name of each template used for generating a page. This is very useful for when you write your own templates.

These html comments are only added in debug mode, so there is no overhead in production environment at all.

That's all for now. Download the latest version, try it out, let me know if you have any questions.

Click here to post your reply


Thursday, October 20, 2011

My answer to "What's the best way to enhance LampCMS?"

This is my answer to a Question on Support site for LampCMS project


Yes, you can write plugins for pretty much any new feature.
I call them modules. Your custom module is a class that extends the \Lampcms\Observer object
As such it has access to the all important oRegistry object from which you can get your Mongo object, Ini object, and most other important object.

You write your own methods and write your own main() method. main() is called by the Dispatcher and notifies of important events. You can perform actions based on specific event.

Some of the core features of Lampcms are already written as modules, for example FloodCheck, IpFilter as well as Search indexer and EmailNotifier.

Take a look how there are written and you can then write your own plugin the same way. Then add your plugin to the !config.ini file either to [OBSERVERS] section - plugins in that section listen to all events or to [INPUT_FILTERS] section - plugins defined there listen to events like new questions, new answers, comments - all type of user input. If you write plugin like a spam filter then you would put it in the [INPUT_FILTERS] section. It's more efficient since input filters are not notified on all events like observers, only on input events.

I am now working on the new module "Who's online" and I'm writing it as a module.

Wednesday, October 19, 2011

My answer to "cc-wiki or LGPL license?"

This is my answer to a Question on Support site for LampCMS project


Content of this website is licenced under cc-wiki. You don't have to add this cc-wiki licence to your own site if you don't want to. This is just something I chose for this support forum, which basically allows the contents of posts on this forum to be re-published as long as they follow cc-wiki license.


The program itself is licensed under LGPL.

Saturday, October 8, 2011

Delays in new updates

My Question on Support site for LampCMS project

Just want to let you all know that I have several new features in the pipeline. The new MongoDB-only GeoIP class - no more use of shmop extension since it has been causing problems for some users. Also A lookup of a single IP address to map to a location takes about 3 milliseconds on my Windows PC running MongoDB. I think on a decent Linux server it will be even faster. All IP to Location lookups are done in post process mode. This means the lookup and storing the location data is done after the page has been served to the user and browser connection closed. I also wrote an import script to import the CSV file from MaxMind.com into MongoDB. Import takes 5-10 minutes to complete - there are over 4 million records inserted one by one and also 4 indexes are created.

Second feature - "who's online" module - it depends on GeoIP module because the GeoLocation of users online is extracted from IP and stored. That's why I could not release "Who's online" before the new Mongo based GeoIP module is done, and it is only 95% done - needs some finishing refactoring.

Also working on a nice debug toolbar - the Log data from the script will be viewable in the floating div in the debug mode. I've heard that this is how it's done in codeignitor.

Lastly, I am going to add several changes to templating engine making it also use namespaces and to also use directories for templates for better organization. For example, the templates that have to do with answers will be in template/answers, template to view users will be in template/users, etc...
I also added a nice feature to templating engine that in debug mode it adds the html comment section to indicate the start/end of each template and also start/end of each loop inside the template along with the full path to template file. So debugging templates and debugging in general will become alot easier.

Unfortunately I am not going to have any time for probably the next month. We are very busy at work with the launch of a new web portal for a major company and we are all asked to come to work 7 days a week now.

So realistically I will only have time to actually release all there new features in about 6 weeks.

But I'm still reading and replying to your questions every day.

Click here to post your reply