Saturday, December 8, 2012

How to install MongoDB on CentOS Linux

My Question on Support site for LampCMS project

I just made a short video tutorial on how to install a MongoDB easily from 10gen yum repository

You can watch it here.

YouTube videoPlay

Click here to post your reply


Monday, November 5, 2012

I'm back online. Power and Internet have been restored

My Question on Support site for LampCMS project


Hi everybody! Just want to let you know that I'm back after being offline for about a week. We had power outage for 5 days, then it was restored on Saturday evening and shortly after that cable Internet was restored at my house.

I am still busy with a few other things right now but I will be back working on this project very soon. The "moderation" feature is still in progress and I plan to finish it this month.

I have been playing around with idea of building high performance API for this project in C++, so far no progress. It proved to be a pain to use Mongo Client C++ library on Windows because they only officially supportdevelopment on Visual Studio 2010, and the framework that I want to use cppcms does not support Visual Studio.

The next thing is to try to compile the test program on Linux only I don't have Linux box at my house and writing program at home and uploading it to Linux server every time just to build it is such a pain. Maybe I'll buy a Linux Box later this year or next year and will try this again.

Anyway, I'll resume answering you questions and taking care of fixing bugs if any are found very soon.

Now I'm heading back to work. If anyone is wondering, I have a full time job as a php developer at ADP

Click here to post your reply


Saturday, September 22, 2012

My answer to "Installation error on VPS"

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


A little strange.
Basically this error means that your bootstrap.php was found and loaded, the require.php was found and loaded
and the !inc.php was found and loaded.

Unfortunately the way php outputs the trace from exception is pretty crappy.

This is what you should do:

Open !inc.php in lib directory.
Around line 96 find this line:
echo('Got exit signal in error_handler from ' . $e->getTraceAsString());

replace it with this:
echo('Got exit signal in error_handler. Exception: '.get_class($e).' Error ' . $e->getMessage().' in: '.$e->getFile().' line: '.$e->getLine()."\n<br>Trace: ".$e->getTraceAsString());

This will at least give a much clearer error and will point us to the root of the problem. (hopefully)

Wednesday, September 19, 2012

My answer to "Reputation and ability to post comments"

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


First of all this is a configurable option. It's set in the [POINTS] of !config.ini
The reason to require some reputation points for comments is to prevent new, less experienced members from potentially taking conversation off-topic with comments. It's also serves as an incentive to earn reputation points with good questions and answers.

These minimal reputation is only required to comment on other people's questions and answers. You can still add comment to your own question without the reputation requirement.



Saturday, September 15, 2012

Image Upload feature added to Lampcms

My Question on Support site for LampCMS project




As you can see, this image has been added using the new uploadfeature.
Now you can upload an image instead of just providing a path to image on the Internet

Image is automatically resized if uploaded image is larger than maximum dimensions defined in config.
If image is resized then resized image will also link to original image which will open in a new window.
Later we can add option to .js file to open original in some type of lightbox.

Default max dimensions are 400 width by 300 height, but you can change these on your site.

This new feature is available on github in the YUIUploader branch and is also included in the official .zip file which can be downloaded from the http://www.lampcms.com/download/ page

There are several configuration options added to !config.ini.dist and also a new permission is added to acl.ini.dist

What you need to do is add this permission to [registered] group in your acl.ini file
upload_image = A

Some new config settings added to [EDITOR] section of !config.ini:

;
; Maximum file size allowed for imageupload
; in megabytes default is 2 meaning 2 Megabytes
;
; To disable imageupload functionality
; set this to 0 or leave empty
;
IMAGE_UPLOAD_FILE_SIZE = 2
;
; Define maximum width,height (comma separated)
; If uploaded image is larger than these limits,
; it will be resized
;
IMAGE_UPLOAD_W_X = "300,200"

;
; Uploads are allowed by logged in users
; Set the min reputation score required to be
; able to upload images
IMAGE_UPLOAD_MIN_REPUTATION = 1
;
; Number of seconds user has to wait between uploads
; Resizing image is CPU and memory intensive.
; This setting helps prevent upload flood
;
MIN_UPLOAD_INTERVAL = 30

This is an initial release of imageuploadfeature. What currently does not work is imageupload in the "Edit" Question or Answer action, it only works during Ask/Answer action

I will add it to Edit soon, it's a bit tricky because what I want to do is when image is removed from the post when post is edited I want to also delete image from the server.

Anyway, it took alot of work to add this seemingly small feature.

Enjoy.

Click here to post your reply


Thursday, September 13, 2012

My answer to "Can this be easily integrated into an existing site?"

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


Yes, the latest releases of Lampcms make it easy to install in sub-folder of existing website. There are configuration options to define the sub-folder path.

It's also easy to install lampcms libraries in any directory on your server, then just define path to libraries in bootstrap.php

This makes it very easy to host multiple Q&A websites all powered by a single Lampcms distribution. Each site will have own copies of templates and css so you can make them all look unique while still using a single copy of lampcms core library classes.

All you have to do is hook up your existing site's registration/login to the Lampcms. This is a bit of a custom work you have to do but it's not all that difficult if you know how to program in php or know someone who does.

Saturday, September 8, 2012

Image upload for Questions and Answers

My Question on Support site for LampCMS project

Just want to post a little update on the imageupload functionality

I am currently working on adding imageupload functionality to the text editor.
I am using this plugin to YUI RTE as a starting point:
http://allmybrain.com/2010/06/16/yui-image-uploader-works-with-yui-2-8-1/

It's a good start, I have already made changes to JavaScript to make it work with YUI3 based functions.
Now I'm working on the server-side functionality.

It's not a difficult task but there are just a lot of little things I have to implement on the server.
Here is the list:

Only logged-in users will be able to upload images
Uploading of image will be a separate Access permission, configurable in the acl.ini, by default will be enabled for registered users
A configuration option will be used to require minimum reputation in order to allow imageupload
Configuration options for imageupload: max file size, max width and max height.
Image will be resized to fix max width and height. If image had to be resized then the original is also saved separately so that later we can have option to view the original
If user does not have permission or enough reputation to uploadimage then the imageupload button will not even be added to the text editor. Additionally the same permissions/reputation will be checked on the server after image is uploaded just to be sure...
Extra check will be in place to prevent more than "N' uploads per minute. This is to prevent attempts to overload the server by uploading hundreds of images rapidly.

As you can see there are quite a few functions I have to implement and test. It's not very difficult but it will take time, so please be patient - the imageupload functionality is coming... I would estimate to take about 4 more days. I mean working days, and since I work on Lampcms only on weekends it may take up to 4 more weeks.


Click here to post your reply


Friday, September 7, 2012

My answer to "captcha issue - stub.php"

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


This has been fixed, but it's only available on github. The distribution zip file still has not been updated with all the latest fixes. I'll try to update/upload the new zip file this weekend.

I'm pretty sure that what you have done was actually the fix. The file name was incorrect.

Tuesday, September 4, 2012

My answer to "Search doesn't work for non-english characters"

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


It seem to not have any problem here. There are no search results but the search for: does show the correct text.

http://support.lampcms.com/search?q=%D0%BD%D0%BE%D0%B2%D0%B0%D1%8F+%D0%B1%D0%BE%D1%80%D1%89

My answer to "Lower case Slug change"

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


You can do that. Generally I would recommend to always use mb_strtolower instead of strtolower. In this particular case it ok to use strtolower simply because url slugs are converted to ASCII chars. This whole deal with converting slug to ASCII is probably a bad idea, and I will change it in the future.

Anyways, it's just better to use mb_strtolower when developing Lampcms sine all data is stored in utf-8

Problems with this server

My Question on Support site for LampCMS project

I apologize for the downtime today.
I've been having some issues with the server on which this support site and lampcms is hosted.
It may be at the end of it's life, I suspect some problems with the hard drives.

I may have to move to a different host shortly, hopefully will get a brand new dedicated server on the cheap.

Click here to post your reply


Monday, September 3, 2012

My answer to "gibrish when asking questions in non-engilsh characters"

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


What I mean is that this support site runs on a newer version of Lampcms. If you downloaded the zip file from lampcms.com your version probably does not have the fixes I made for utf8 string handling.

Try to post a new question in your language right here, we'll see how it looks. I just want to know if there is still a problem. I'll delete your question once I see it.

My answer to "rel nofollow to user links"

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


I see what you mean, the link TO a profile page. No, I never thought of adding nofollow since they link to a page on your own site. Why whould you want to prevent indexing of user profiles?

I was talking about a link that user added in their profile to their own website. That link will have a nofollow

Since I never thought of adding nofollow to internal links I have not even made this an option that you can change in template. It's hard coded and added as html fragment to the actual question.

You can submit feature request to github to make link to user profile not hard-coded.

My answer to "Upload images"

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


This has been asked before. It's a feature request on github, I am working on it, still not finished. I actually started working on this yesterday, made some progress with adding this to YUI editor.
Once I finish with Javascript side of editor I will have to do a server-side file parsing work.
Currently I plan to allow only image uploads, no regular "attachments" files.

My answer to "Remove the viewquestion"

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


Yes, it's quite simple. It required to define an alias for the controller name.
Look in [ROUTES] section of !config.ini
Basically there are already some aliases being used in default installation. The /tags/ url is actually an alias for the /viewtags/ controller.
You can define your own alias for viewquestions in the same way, for example
add:
topic = viewquestion

Then the url will be /topic/12/SomeQuestion

The nice thing about it is that you modify alias for routes even after you already have lots of questions on your site.
So if someone bookmarked your link to /viewquestion/quest123/How_are_you
Then you add alias
topic = viewquestion

and then when someone follows the old link the system will use 304 redirect to point to the new url:
/topic/quest123/How_are_you


My answer to "How can I add a logo"

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


It's all in the templates.
You should get familiar with the templating system used in Lampcms, which is actually very simple.
A template is a class that extends either Lampcms\Template\Fast or Lampcms\Template\Simple
The Lampcms\Template\Fast templates have numbered placeholders. It's not very user-friendly but php parses them much faster by simple using php's vsprintf() function.

The Lampcms\Template\Simple template uses user-friendly named placeholders like {somevar}
The Simple template users php's strtr() function which is slower than vsprintf()


The logo is in the header, the header is in the main template, so open the file
/www/style/1/www/tplMail.php and you can experiment with it.
I suggest you save a copy of the working template first before you start modifying it.

My answer to "get an error when asking question"

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


Actually this error probably means cannot connect to MySQL database, not Mongo. LampCMS uses MySQL in addition to Mongo to implement "Similar questions" feature and to implement the "Search" feature.
I chose to use MySQL for search because MySQL has full text search capability which makes it very easy to index questions.

All you need to do is to create an empty MySQL database and supply the connection details in the [DB] Section of !config.ini

You don't have to create any tables in MySQL, the program will create table automatically when it's first needed.

My answer to "Where are the administration options"

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


Admin can see extra icons under each post, for example "delete", "stick", "lock"
Admin can also retag questions and edit questions submitted by other people.

Also when viewing profile of another user admin can delete that user as well as all user's posts with just one click. This is useful for dealing with spammers.

Admin can also "accept" the best answer for any question, not just for their own question.

Also when you on the "settings" page you will also see extra links - "edit categories" and "Clear cache"
You should clear cache after you edit the translation .xlf file, like when you add or modify translation strings for a language. This is because translations are cached, they are not served directly from the .xlf file, that would be pretty slow.

So in short, there is no special admin section, you simple have lots of extra options when logged in as admin.

Sunday, September 2, 2012

My answer to "Signup doesn't work"

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


You need to have writable permission on directory where captcha images are generated.
directory is /www/w/img/tmp
Basically all directories under the /www/w supposed to have write permissions

My answer to "Default admin username and password"

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


You have to create admin account yourself
You have to add admin email address to !config.ini as EMAIL_ADMIN
Then register a new account using the normal registration process. When you register with email address that matches the EMAIL_ADMIN your account is automatically an admin account.

Enjoy.

Thursday, August 23, 2012

My answer to "Incorrect email content"

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


Have you added support for new languages to your site? Have those users selected the different languages in their profile than other users?

Basically this type of error points to translation problem - like when you have a new language but don't have translation for these strings.

Also have you changed DEFAULT_LOCALE and/or DEFAULT_LANG in !config.ini file?

My answer to "is mongodb better than mysql?"

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


For this type of site (Q&A or forum) MongoDB is perfect. Especially if the site will grow to very large site. Also performance (speed) is better with Mongo because there are never table joins.

Lastly it's fairly easy to add extra servers when your think your site is outgrowing one-server installation.
Also from deveoper's point of view it's alot faster to develop programs with Mongo than with MySQL because you don't need to change table schema when you want to add new fields.

Wednesday, August 15, 2012

My answer to "charset problem"

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


There could be a problem with charset. I have seem some strange charset issues occasionally. It has nothing to do with Mongo. Most likely it has to do with the script attempting to sanitize all input and not being able to detect the utf8 charset in some cases.

I will add an experimental option to skip charset detection and we'll see if that will fix the problem.

I'll release this new option soon.

Monday, August 13, 2012

Video questions and video answers

My Question on Support site for LampCMS project

Youbube is planning to release the new project for developers to allow discussion communities use
embedded youtube widget to solicit Answers/Answers by using webcam.

Take a look. I am interested in integrating this into Lampcms when it is released.

YouTube videoPlay

Click here to post your reply


Saturday, August 11, 2012

Phar based LampCMS package is ready

My Question on Support site for LampCMS project

I am happy to announce that phar based package of Lampcms library is now included in the distribution zip file.
Also this support forum runs from the phar archive now.

The lampcms.phar is included in the distribution zip file, it's not available on github because phar is created during the build process. Basically lampcms.phar included every file that resides under the /lib/ folder in the source tree. The comments and new lines are removed from all php files before they included in the phar archive, resulting in over 50% reduction in file sizes.

The bootstrap.dist.php in www folder included option to define LAMPCMS_PHAR - a full path to lampcms.phar file. If defined, the phar archive is used.

Basically if you using lampcms.phar you don't have to upload the contents of the /lib/ folder to your server, just upload lampcms.phar anywhere on your server then define a path to it in bootstrap.php and you good to go.

Upgrading to a new release of phar is easy - just upload a new version of phar. The only little extra step you need to take when upgrading a phar file is you also need to upload a newest version of the minified qa.js file.

This is because release version of the library is different in every phar archive and when page is rendered the script looks for a version of minified .js file that matches the release version.

For example, the current release is 0.1.77 so a path to js file is /js/min/qa_0.1.77.js

So when upgrading phar-based installation you need to: download a zip file, extract it locally on your PC. From the extracted archive upload lampcms.phar to your server and also from www/js/min/ upload the latest version of qa.js file to your www/js/min directory.

Who should use phar based installation?

Anyone who just wants to get the site up and running fast. If you plan making any changes to any of the php files then of cause phar based installation is not for you.

One last thing: with phar based installation it is not possible to add your own custom modules to lampcms. This is because the Modules directory is now packed inside the phar archive.
I have to make a change to include the 'Plugins' directory under the 'config' directly. Then you would could add your own plugins to that directory.

Anyway, give it a try. Download the latest zip from http://www.lampcms.com/download/

Click here to post your reply


Sunday, August 5, 2012

Updated to PR2 and PR3 branches. Working of phar based distribution.

My Question on Support site for LampCMS project

Just want to give you an update of what I'm working on now.
I am currently working on 2 branches: PR2 and PR3

The work in PR2 includes support for INTL library. Mainly the formatting of date/time based on user's selected locale. Also using the intl library it will be possible to show timezone's selection menu translated into user's language. The translated names of all timezones are available in the php's intl library which is great, so we don't have to add these translations manually to our xliff files.

That's the current work on the PR2 branch.

At the same time I am also working of the support for phar based distribution of Lampcms library.

The idea is to have just one lampcms.phar file that will replace all the files in the lib directory, including the PEAR and SWIFT mailer folders. I have just started working on it, I am not 100% sure if I will succeed in this but I'm optimistic.

I know that having an option to download a new version of a .phar file and upload to your server will be a much easier way to upgrade to the latest release.

Since I'm working on these 2 branches at the same time I'm not sure which one will be done first, but of cause I'm trying to complete PR2 tasks first.

Click here to post your reply


LampCMS Official distribution zip archive

My Question on Support site for LampCMS project

The Official distribution of Lampcms is finally available in the zip archive.
It can always be downloaded from the www.lampcms.com website from the "Download" link.

It's recommended to use this zip file for production installation.
The main difference between the zip based release and downloading a zip from gitbub is that
the source code on github does not include the minified versions of javascript and css files.

The minified version of qa.js is created during the build process. I use phing as a build tool.
The way minified version of qa.js is created is this:
First a release version number is incremented for each release.
For example if latest version of previous build was 0.1.60, then the build tool automatically increments the minor version to 0.1.61
This number '0.1.61' then replaces the placeholder @package_version@ in all source files.
The most important place where this placeholder is used is in Object.php
there is a line:
const VERSION_ID = '@package_version@';

The minified version of javascript is then created and save as qa_0.1.61.js (uses the build version as part of the file name)
By the way, I use YUI compressor java tool to minify javascript and css file.

So after the build is complete the program will have a constant VERSION_ID that holds the value of actual build version.

This VERSION_ID is then used when including a minified javascript file.
So now the value of javascript src in the generated html will look something like this:
<script type="text/javascript" src="http://support.lampcms.com/js/min/qa_0.1.65.js"></script>

You should configure your web server to send long-lived expiration header for all files served from the js/min directory so browser will cache the minified javascripts. This will significantly improve the load time of all you pages.

Click here to post your reply


Saturday, August 4, 2012

My answer to "How do i increase the auto log out time of user or turnoff altogether"

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


The problem is that when you download from github you only have a development version and it runs in debug mode by default.

In debug mode the session is set for 5 or 10 minutes, I'm not sure.

To turn off the debug mode you must set DEBUG=false in !config.ini
The problem that in non-debug mode the program supposed to load a minified version of javascript and css files and currently they are not included on github.

The minified js and css files are generated during the 'build' process

I still have not resolved this issue but I will soon.

What will happend is that there will be an official distrubution zip file available for download from lampcms.com website. That zip will always include the minified css and js files.

It will be ready in a few days, maybe by tomorrow evening.

Tuesday, July 31, 2012

My answer to "Feature request for google +1 button."

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


I am pretty sure you can add extra buttons to a template yourself. It's in the tplQuestion.php template file

Monday, July 30, 2012

My answer to "How to integrate post to feature?"

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


Please tell me more about your server setup. What type of server, how do you run php - as php-fpm or as mod_php? 

Wednesday, July 18, 2012

Working on Login with Google feature

My Question on Support site for LampCMS project

Just want to let you know I'm currently working on Login with Google feature.
As many of you already know, Lampcms used to have a Login with Google via Google' FriendConnect service.
Through FriendConnect we also have a Login with Yahoo, AOL and OpenID

Earlier this year Google shut down the FriendConnect project and we lost all these Login options.

Then I got busy with rewriting Lampcms for the PR1 release and now finally have time to work on Google login integration. It's about 80% done.

Also in the process of researching the Google Login integration I stumbled across the newest Google+ API. It looks really cool - they now have a support for write methods - you can post links and actions to Google+ history API. As of now this is still in beta, I had to signup for beta testing to get access to it and I don't think it's available to end users yet.

The only problem with Google+ API is that it does not provide user's email address - there is no way to ask for user's permission to get their email address. This makes Google+ not suitable for the Login with Google+ feature because without email address there is no way to find if this is a new user or existing user signing up with Google+.

Of cause we can ask for email address as a second step in registration just like we do for Twitter and that's exactly how we used to it with FriendConnect, but that's kind of unattractive and I don't like it.

So I decided I will still add the support for Google+ but only as an option to add Google+ to existing account from the profile page. This will be done the same way you can add your Blogger and Tumblr account.

Once user authorizes/adds Google+ to their account, they can start sharing the questions, answers and comments on Google+ network.

Well, that what's I'm working on now. It will be in PR2 release.

Also I want to add support for translation of all strings that are used in Javascripts into the user's selected languages. This is very important step for making Lampcms fully internationalized.

Then as a last step I plan to start using the php's intl extension for support different locales. What this will do is it will allow us to translate time zone names into other languages using php's extension, also to format date/time into locale of user and also format numbers (number of questions, answers, the reputation score) according to locale.

This is a longer-term goal and intl extension in php is being actively developed and is getting better and better. We actually started using the intl extension at my current job's project and I really like it.

Ok, one more item on the longer-term goals is to make a .phar release of the Lampcms. The idea is to have entire /lib/ folder with all sub-folders as a single lampcms.phar file
This will make installation alot easier for less experienced users, also upgrading will be must simpler - just download one new .phar file and upload it to your server and you're done.

Click here to post your reply


Server was down

My Question on Support site for LampCMS project

This site as well as www.lampcms.com was down today. There was some problem with the hard disk, I had to run fsck to fix the file system. Not exactly sure what the problem was. What happend was - Linux switched the file system to read-only mode. This caused all kinds of problems.

Anyway, I ran the fsck and restarted the server early in the morning but did not have time to do anything else - had to leave to go to work.

Now I came back from work, ssh to server, noticed that php-fpm was not running. Started it up and we are back.

I think I'll be moving to different host - found a better deal for a dedicated server - a little bit cheaper and will have more RAM.

I also decided to move the static pages of www.lampcms.com to the github - they host project pages for free, so I figured why not? github seems to be pretty reliable.

Click here to post your reply


Friday, July 13, 2012

My answer to "Fresh Install: renderTimeString error"

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


You found a bug. Thank you for that.

That variable has to do with a setting SHOW_TIMER in !config.ini
It allows to show render time at the bottom of the pages, just like on this support forum.

I have fixed this issue and pushed a new update to github. You can download a new zip file from github OR just copy the contents of the new index.php in the www directory.

Monday, July 9, 2012

My answer to "How can I contribute with a translation?"

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


Download Lampcms zip file from github or clone Lampcms master branch from github.
Look in the config/translations/ directory

There are 2 files there - one for Russian and one for English.
English has only few required translation strings since most strings don't have to have English translations.

Russian translations file "messages.ru.xlf" is a good example of how to create own language files. You should translate values of all "target" tags while not changing the values of <source> tags.

Thank you.

My answer to "CSS forbidden -> installation"

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


Sorry, but installation process has changed slightly in this new release.

Also why is the screenshot point to dev.lampcms.com? Have you added this domain to your hosts file?

Here are some basic installation instructions now:

1) inside the config folder rename !config.ini.dist to !config.ini
rename acl.ini.dist to acl.ini

2) in the www folder (which will be your root folder of the installation) rename
bootstrap.dist.php to bootstrap.php

In the newly renamed bootstrap.php you may edit a couple of lines if you going to be using a multi-site setup where you need to define a path to the lib directory. You don't have to edit anything at all for default installation.

3) You need to create 'logs' folder, by default it should be next to the lib directory, but you can have logs directory anywhere on your system and then define a full path to logs directory in !config.ini
Make sure logs directory is writable

4) Edit !config.ini to setup your mail server in the [EMAIL_SERVER] section. Read the comments in the !config.ini they are pretty informative.

5) In !config.ini make sure to enter values for
EMAIL_DEVELOPER
EMAIL_ADMIN
EMAIL_DOMAIN

EMAIL_DEVELOPER and EMAIL_ADMIN can be the same address. Should be your address since that's where you will be receiving errors in case there are any. Receiving errors is very helpful in debugging process. Also
the value of EMAIL_ADMIN you set in !config.ini is used when creating your first account. When you register a user with the email that matches EMAIL_ADMIN value in !config.ini that user becomes admin of the site and have rights to moderate, delete posts, edit posts and delete users. Also has other super-rights.

Do not edit
IMAGE_SITE = ""
CSS_SITE = ""
JS_SITE = ""
AVATAR_IMG_SITE = ""

unless you really going to host these on a dedicated server(s) with own domain name

You MUST also set a value of
SITE_URL

to point to domain name where you going to host your Lampcms project.
If you going to setup Lampcms in non-root web directory do NOT point
SITE_URL to that directory - it must still point to root of the site.

6) If you setting up Lampcms in NON-Root web directory then also edit
value of DIR in the [URI_PARTS] section of !config.ini

Again, instructions in !config.ini are pretty informative

Let me know if these steps work for you.


PR1 merged into master branch

My Question on Support site for LampCMS project

I merged the PR1 branch into the master branch on github. Basically this means that the pr1 release is now the default branch.

This support site runs on pr1 and works well.

PR2 will be some bug fixes and hopefully couple of new features like upload of images.

The pr1 branch will be deleted from github and the pr2 will be created soon.

The installation instructions have changes but unfortunately I have not updated the installation instructions yet, will do it soon.

Click here to post your reply


Wednesday, June 27, 2012

My answer to "[bug][seo] Duplicate content"

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


This issue has been fixed and is now in the PR1 branch.

Monday, June 25, 2012

My answer to "Admin Control Panel"

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


There is no admin control panel.
When you logged in to site with admin account you have ability to delete and edit questions, answers, retag them, close questions, etc.

You also have access to couple of extra links in "Settings" page like to edit categories and flush cache.

And you also have ability to ban user. There is even a "Shred user" button when viewing a profile of any users. Pushing that button will delete every post made by that user and ban their account. That's cool way to deal with spammers.

The rest of administration is done by editing !config.ini file. Very simple.

No need to admin panel.
If you need to change the look of the site then you need to one or more of the templates.

My answer to "Arabic Support"

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


Lampcms supports the translation to any language. You will have to create translation file for your own language and translation strings must be in utf-8 charset.

Look at example translation file in translations directory. Currently there is a Russian translation file there, you can use it as a template to translate to other languages.

Also at this time not 100% of strings can be translated - some are hardcoded inside the code and also Javascript file has some hardcoded strings.

This has already been improved alot in the PR1 branch, but Javascript still has several hardcoded strings.

The PR2 release will have no hardcoded strings, even in Javascript.

My answer to "About lampcms"

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


Not right now. I plan to add support for image uploads but no plans to add video upload support. That would require some type of streaming server to be installed.

My answer to "Issues with Installation"

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


This error means that php cannot understand the "\" character. This is a namespace separator.
One possible reason for this error is that your php does not support namespaces.
But since you said you have php 5.3 then it must understand namespaces.
The only other possibility is that maybe you uploaded php file using binary transfer mode in ftp server and some extra characters got added to a file during the upload.

Also right now I'm almost done with coding the PR1 branch. You may want to try that branch instead, it's somewhat easier to install - the rewrite rules are optional and much simpler.

On github you will find https://github.com/snytkine/LampCMS/tree/pr1

Sunday, June 10, 2012

My answer to "can lampCMS be installed inside a subfolder"

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


Right now no, but this is one of the important change I'm working on right now.
It will definitely be available in the PR1 release which is due in 3 weeks.

You can take a peek at the PR1 progress if you want. It's a pr1 branch on github

Saturday, June 9, 2012

My answer to "[bug][seo] Duplicate content"

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


Confirmed. I will include the in the PR1 release.
I'm working on PR1 right now. The rewrite is really massive.
I hope to have it done in 2 more weeks.

Monday, June 4, 2012

My answer to "Error: Unable to connect to Mongo: Unknown error"

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


This means your mongo server is not running. Just make sure Mongo server is running and that the address and port number of your mongo server is set correctly in !config.ini in the [MONGO] section

Sunday, May 27, 2012

Started a new PR1 branch

My Question on Support site for LampCMS project

I started working on a new PR1 version.
I created a new branch on github for this.
All new development is done in PR1 branch for now.

New features I am working on:

Support for multi-site. Running more than on site from single Lampcms library. This is already done.
A simple 'define' of the path to Lampcms/lib directory is all that is needed in the new bootstrap.php file

Moved all configuration files to config folder. Got rid of Points.php and Mycollections.php. All these are now in the !config.ini file. Yes !config.ini got bigger in size but I think its better than having too many configuration files.

Also the config directory can be moved to custom location to prevent it from being overridden during the upgrade (this is already pretty well protected because the !config.ini is not even included in distribution and must be created by renaming or copying !config.ini.dist file, same for acl.ini file)
The language translations directory is now a subfolder in the config directory, so moving config directory to a custom location will protect the translations directory from being overridden.

What I'm really working on now, and this may take decent amount of time is to use url routes concept so that rewrite rules will not be necessary. This will be somewhat similar to CodeIgneter's way, but not the same. It will also be a 2-way mapping - if you rename the route the urls will all be updated dynamically in the site. For example, if you want to access your unanswered questions using /noanswer/ then just changing the route name from 'unanswered' to 'noanswer' will do the trick - the links everywhere in the site will be pointing to '/noanswer/'
while the route will point to the same controller.

Also it will be possible and quite easy to install Lampcms in a subfolder of an existing website. For example, maybe in the '/forum/' directory of your site.

So this new url routing feature will take some time to complete and test. Many templates will have to be updated to use placeholders instead of hard-coding the links.

I'm working on it now.

You can still use the master branch for the previous more stable version or wait for the PR1 with all the good features.

I also changed the coding style a bit in a new version, it's more in line with Symfony2 coding style. Not a big change at all, but class and function opening brackets are in the new line now.

I also got this new IDE - PHPStorm. I like it a lot. Thanks to the good people of JetBrains I got a free license for this open source project. It's the best IDE I worked with so far, and I tried many: Eclipse (still using it for some Java coding and for Android code. What I really hate about Eclipse is that so many times I would install some new plugin and suddenly some old feature stops working and I really need that old feature more than the new plugin but uninstalling plugin does not fix the problem), Aptana (crap), NetBeans (not bad), PHPEd (crap)

Debugging with XDebug works right out of the box with PHPStorm, good support for PHPUnit, and for viewing cachegrind files right in the IDE. Also a nice support for Phing - it recognises the Phing's xml file and you can right-click right in the xml to build a target. And lastly nice support for php codesniffer. This is a less important but still a nice feature. Or, and it has a really good support for all the Git features like creating, switching branches, merging, comparing branches and very good tool to resolve occasional merge conflicts.


Earlier this week I attended the MongoDB NYC conference. It was great - their busiest even even - over 900 attendees. It was really crowded but it was worth it, especially since the company paid for the ticket. I lleared a new new tricks, got some new ideas on using Mongo. Also we starting to use MongoDB at work, got a pretty serious multi-server install with sharding and replica sets.

By the way I work for the ADP now. It's a pretty big company, you probably heard of it.

Anyway, I have alot for work to do.


Click here to post your reply


Saturday, May 19, 2012

Updates and new features

My Question on Support site for LampCMS project

I just pushed the latest updates to github

First of all, the category feature is here, as you may have already noticed you now can select a category when posting a question.

Categories can have sub-categories, and the level of nesting is unlimited.

You can already try the admin page for category editing here:

http://support.lampcms.com/editcategory/

Since you are not admin you can only play with the editor but the changes will not be saved.

The rendering of categories page is not very good yet, I have to work on a template and css for displaying categories better.

2 - I added support for multi-site setup. You can have multiple sites using lampcms on the same server and they all can use a single copy of the lampcms library.

For this to work you just have to uncomment the line in !inc.php
//define('LAMPCMS_LIB_DIR', '/var/lampcms/lib');

and put a full path to location of Lampcms/lib directory
That's all you have to do.

You can even move the Lampcms/lib directory (the directory that contains 3 folders: Lampcms, Pear and fonts folder as well as autoload.php file (which I moved there from the root directory so that autoload can also be reused between sites)

3 - Added Time Zone selection to Edit Profile page so user can select own timezone now. This is just a first step, I still have to go over the rest of the program and update all the places where timezone can be used in order to display correct times in user's timezone.

So download and test these new features.

Next I am starting to work on some refactoring of how site settings are stored. I want to create a single 'settings' directory where we will keep all editable files like !config.ini, !acl.ini, Points.php, Mycollections.php and also soon another editable file to make urls flexible by using 'routes' - something similar to Codeigneter's routes.
The idea is that you will be able to define your own url structure and will no longer need rewrite rules on the web server.

Also there will be the option to define the root web folder so you can add lampcms to existing website and just access in like yoursite.com/commutity/ or yousite.com/community/forum
Basically you will just define a root folder and links will be created dynamically. You can even update this web folder setting any time and all links will be updated since they will be created dynamically now.

Not sure when I will be done with all this, I'm thinking about 8 weeks (I work only couple evenings a week on this site plus 2 days on weekend)

The good news is that I recently started a new job which is 5 days a week, unlike my last job which was 6 day/week. So now I have more time to work on Lampcms.




Click here to post your reply


My answer to "Is there a way to do multiple choice questions in lampcms?"

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


That would be a totally different type of website. Some type of opinion poll site or even a quiz website.

I like the idea but I don't have any plans on adding this feature any time soon.

Wednesday, May 16, 2012

My answer to "Multisite functionality - when?"

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


I have a pretty good idea how to do this multi-site setup. I'm going to try it this weekend.

If it works then I'll release the update next Monday, May 21

Monday, May 14, 2012

My answer to "Post times are incorrect"

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


Thank you for this bug report. It definetely has to be fixed. You are correct that time zone is set to user's time zone. I don't remember if user was able to set own time zone in "settings", but I'm sure that was the idea - to let user set own time zone.

I will investigate all these issues soon.

Friday, May 4, 2012

My answer to "Can we use lampcms in production ?"

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


About AOL, Google, Yahoo and OpenID login - these no longer work. They used to be a part of a Google Friend Connect service. Unfortunately Google discontinued this service recently.
I have just removed these buttons from this site, I will also remove all the Friend Connect related code from the program soon.

So now we are left with Facebook, Twitter and LinkedIn login.

I will have to add Login with Google using Google's API. I have not decided on Yahoo login support. I don't think I will be adding OpenID support.

The categories links do not work because I have not added rewrite rules for category urls. Category support is very new, just added recently. Originally Lampcms had support only for tags and I was not even planning on categories but because many people requested it, I have added categories which also support unlimited sub-categories.

You can use the program in production if you want, but at least wait for me to add rewrite rules and update css files to better support categories. I plan on doing it in the next 3 days.

Also this is still a beta version. For a pre-release I plan on changing the url model and it will not use rewrite rules, will instead use url routing model similar to how it's done in CodeIgniter or Symfony frameworks

The Pre-release will also fully support multi-site installation and also support for installation in non-root web directory, so people will be able to just add Lampcms to existing site in own sub-directory

Saturday, April 28, 2012

My answer to "Subdirectory installation problems"

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


Actually I looked into this little further and realized that this is not an easy thing to do right now.
The rewrite rules have to be changed as well as a new functionality have to be added to site to automatically
prefix all generated urls with some type of constant like WWW_BASE_DIR

I will treat this as a feature request and will work on it.

Wednesday, April 18, 2012

My answer to "Math symbols support"

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


This has been asked before.

http://support.lampcms.com/q1120/Math-symbols-supported

If you can post a UTF-8 char of math symbol it will be rendered in Lampcms without any problem

I will have to research this further in case it cannot be solved just by using UTF-8

My answer to "Error in Exception handler: : file_put_contents(php.log): failed to open stream: Permission denied"

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


This means that program cannot write to php debug log.
What this also means is that there was some kind of exception thrown, then exception handler tried to write the error message to php debug log and was unable to do it.

The default debug log is located in www dir, which is a bad place to have your log file.
You should set a path to your own writable directory where you want to keep debug log.
Look in your !config.ini file - search for LOG_FILE_PATH setting and edit it.
Set it to full path to your own writable directory anywhere on your server.
For example something like /var/logs/lampcms.log

Sunday, April 8, 2012

My answer to "Right to Left Laguages"

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


Tought question. I have not tried it. You can try creating a translation .xlf file based on the russian translation file and see it it will make any sense.

In translations folder copy messages.ru.xlf to your own language, for example messages.ir.xlf then translate all strings to your language.

You will also have to add your language to the [LOCALES] section of !config.ini
for example, add ir = "Iran"

This will add a language to the drop down language selections. (you may need to also go to settings link and click on clear cache and also may need to logout and log back in to see the changes since translation object is cached and may be stored in session)

Wednesday, March 21, 2012

My answer to "LampCMS vs OSQA.net"

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


Yes, but it's Python and also uses Django framework and MySQL or some other type of Relational database. This program uses php and MongoDB. It's also light, no unnecessary frameworks, I wrote 90% of classes myself, the 10% is paginator from PEAR, EventDispatcher which I rewtore for php 5.3 and ACL from Zend which I also modified to be fully serializable to the ACL object can be stored in cache.

Another class from PEAR is HTML Sanitizer which is pretty good if used together with optional php tidy extension.

This program also has read/write REST API, not documented yet but you can search this forum for API. Basically you can already create some type of APP with it, be it for Android, HTML5 based app or just integrate with another program.

API even has feature to allow developers to register their own app, just you would do on Twitter developer site, can even upload your apps image.

There is still alot of work to be done, I plan to continue working on it every time I have some extra time.

My answer to "What was the motivation behind creating LampCMS?"

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


OSQA is written in Python and uses MySQL. I am not all that good at Python.
But I am pretty good at php, have been using it for almost 14 years now.

I also wanted to go with NoSQL database so that a Q&A site can grow to almost unlimited size without slowing down much. I have been using MySQL for many years, in fact using it daily at my current job and I know that at certain point when database grows in size the performance take a hit. This usually happens very suddenly, not gradually and then it's a never-ending battle to optimize your database, constant tweaking configuration, etc.

I think MongoDB is pretty good for the Q&A site. Q&A sites don't have an overly complicated business logic, no need to complex relational joins in queries.

At the time I started this project there were no other php/mongodb based Q&A sites.



Sunday, March 11, 2012

My answer to "How can i use the api??"

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


More about the API
There is a page that allows a developer to register their app and to get an API key.
Some api methods require an api key and you as admin can also set a daily limit of api requests, this limit is per app. Also admin may be able to disable an access to the api based on the api key.

You can provide a link to register the APP at the /viewapps/ url
If user does not have any apps registered, they are redirected to a page to create their first app.

You can try it here:
http://support.lampcms.com/viewapps/

Once a client has a unique API key, they should add it to api call, like this:
&apikey=theirkey

For POST methods a client must pass apikey as a post parameter

API also supports basic authentication where username and password of actual site user maybe passed in headers - this is based on the HTTP basic authentication RFC.

You are strongly advised to use https ONLY for such requests as username and password will be send over the network in clear text.

Saturday, March 10, 2012

My answer to "I can translate string in file stored on style?"

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


You cannot use $this inside any templates. Templates are static classes.
You need to pass already translated strings to template as variables.

My answer to "How can i use the api??"

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


For example, for this question:
support.lampcms.com/api/api.php?a=question&qid=1540

For all questions:
support.lampcms.com/api/api.php?a=questions

All questions but also include comments
support.lampcms.com/api/api.php?a=questions&comments=true

All questions that contain tags "feature" and "request"
support.lampcms.com/api/api.php?a=questions&comments=true&tags=feature%20request

This is just a simple example. There are other features in api, I'll post more about them soon.

Wednesday, February 29, 2012

My answer to "Admin options"

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


When you logged in as admin you can just do the sticky posts, edit other people posts, delete posts, lock post, retag post etc right from the normal pages. So basically there is no admin section for most of the normal site keeping.

Also when logged in as admin and clicking on the "Settings" link you will see extra link "Clear cache"
The category editor is not ready yet, but it will be added to the "Settings" block also and will be visible only to people with permission to edit categories.

As admin of site you also can edit settings in !config.ini file to activate/deactivate some features of site like enable Facebook or Twitter, other social sites intergation and acl.ini to edit permissions for various user groups.

Sunday, February 19, 2012

My answer to "Registration failed. Argument 2 passed to MongoCollection::insert() must be an array, boolean given..."

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


Thank you. This is interesting, looks like the API for this mongoCollection may have changed since I wrote the class. I mean, there has been several updates to php's Mongo library since then.

Originally it was possible to pass 'true' to MongoCollection insert method as second parameter, meaning a 'safe' mode, meaning to write data to disk immediately.

Indeed, looking a the latest documentation on php.net site it does say that second param cannot be boolean anymore.

http://us2.php.net/manual/en/mongocollection.insert.php

I will make update now and will commit the update to github ASAP.

Thank you.

My answer to "Why do not my upvotes result in the user gaining reputation points?"

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


This is possibly a bug. Unfortunately this site does not run on the very latest version that I still have in development, and there was a bug with reputation that I fixed awhile ago but did not have time to upload everything yet.

My answer to "Is the aim of LampCMS to implement all the features of Stackoverflow?"

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


No, that would be the aim of Stackoveflow I suppose.
Lampcms aim is to implement the best features for a Q&A site. It already has features not available on Stackoverflow and I'm definetely not going to implement all features of Stackoverflow.

Also if there are some good features worthy of implementing you want to suggest, I will consider them too.

Thursday, February 9, 2012

My answer to "Integration with Drupal 7"

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


I don't know... Can you?

Seriously, I don't like Drupal at all, I downloaded it and look at the code and all, and I really don't like the way it's made.

I am definitively not going to attempt to integrate Lampcms with Drupal, unless it's a for-hire project.

Friday, January 27, 2012

My answer to "Search Engine Optimization"

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


Are you talking about the main page only?
What do you mean by 'description', do you mean the description meta tag?

I just modified it so that a description that you set in !config.ini as SITE_NAME will be set as default value for 'description' meta tag.

In any controller you can override this at any time by adding this anywhere inside your main() function in any controller:

$this->aPageVars['description'] = $this->_('My cool site');

In this example 'My cool site' will be a translation string, so you can even translate it in your xlif translation files.

If you don't want it to be translatable string then you can just hard code it
$this->aPageVars['description'] = 'My cool site';

As for "All questions" title, you can also modify it.
The best way to do this is to create a xliff file, even for the English strings, which I don't currently have.
This way you can "Translate" strings that are used on the site to your own values.

Look in /translations/messages.ru.xlf file
You can copy that file to your own language and even to messages.en.xlf
Then just write your own translated strings for any string that is used in this site. Anywhere in the code you see something like $this->_('some string') means it's going through translation object, trying to find value in the loaded translation array.

So if you add your own messages.en.xlf and define you own version of 'All questions' then your version will be used on the site.

I will soon make new commit to github, so the default value for 'description' will be there too.
The next changes I am working on is support for categories. Alot has been done already but I still have to write a controller and templates to render a view of all categories.

Thursday, January 12, 2012

My answer to "I really like this script and looks like everything i need But is there a mobile version?"

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


It has a very capable RESTful API, with read/write methods.
You can build a mobile app for Iphone, Android, HTML5 with this API.

I will one day start working on mobile app, my plan is to work on Android app since I have some previous experience with Android development.

If anyone else is interested in this, please post here, we can work together on this, I will answer all your questions about the API we have, since it's not documented yet.

Sunday, January 8, 2012

My answer to "Password clear text in change password"

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


You know this can be fixed by setting the 'type' of inputs to 'password' in the template.
I'll do it in the next release but you can already do this yourself, just track down the template that generates the password change form and change the input type="password"

that's all there is to it.

Tracking down to template is super easy because when site is run in debug mode the template names are added to the html source code.

My answer to "zendframework"

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


I would not recommend it. This project, I mean the structure, the organization of classes, the autoloader, all work very well, acting as a full featured framework already.

Zend, is good framework but it's not going to be easier, it would be more difficult and less efficient if you were to use Zend. The reason I wrote everything from scratch is because I wanted to have a very efficient, very fast program.

I have given it alot of thought as far as rewriting it as a module for Symphone2 framework, since the whole approach to loading classes using dependency injection (out Registry class) is very similar to Symphony approach.

So if would be easier to port this to Symphony2 than to Zend, but then the question is why?
If you want to make it slower and more difficult to use then go ahead, port it to Zend, just include my copyright on modueles you going to reuse and rewrite.

As for me, I thought of rewriting it in Java just because in would be even faster in Java, but the speed gain would only mean anything if this project was used in a super highg traffic site where you get thousands of requests per second - not per minute but per second. And again, I had (still have) an idea to write it in Java but only to write the RESTful api service, no UI at all, then wrote UI completely in JavaScript for the web, mobile etc. Also can write Android and Iphone native apps using the API. Only for this type of service it's going to be worth it to rewrite it in java and then it can probably compete in scalability with big social network type of sites.
I recently took time to learn about Java Spring framework, Jersey framework and Guise frameworks, but this was just a research type of thing, have not decided on either one. Spring is something that worked for me, but I think Jersey is better for just RESTful service with no frontend, but I could not make Jersey to work in my environment, I saw many people are having the same difficulties getting Jersey based API to even work.

By the way, if anyone has experience with Java Jersey framework or with Spring, especially with Spring MVC, I am very interested in collaboration and starting a super-high efficiency API.

So in conclusion, I does not make sense to port this project to something slower, only to something that would be faster (Java or C++, but C++ is way to unfriendly as a language, so I have to pass)

The way it's written now, this program can handle couple of million page requests per day on a single server easily, then can add more servers and scale.