Friday, February 8, 2013

My answer to "Does LAMPCMS support multiple subdomains like Stack Exchange?"

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


Yes, you can run multiple sites from single Lampcms library, it even comes with a lampcms.phar - php archive where entire library is packages in one file.

Every site will need own www directory with all the templates, css files, js files and own config file but the lampcms engine - can be shared between sites.

If you going to use sub-domains like you mentioned, then I'm pretty sure the you can also share database of users and user logged-in to any of your sub-domains will also be able to use any other sub-domain.

I have never done this, but in theory you can share user collection in MongoDB between multiple sub-domains in order to implement a single login.

If you run into any issues when setting this up, just ask for help here, I will help you.

Wednesday, February 6, 2013

My answer to "Integration Lampcms with postgesql"

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


MySQL is used only for the search feature, not as a main datastore. The site will work without MySQL just will not have the search and auto-suggest for when you ask new question.

If you know how to use Postgresql as a full-text search provider then yes, it can be used instead of MySQL. My goal was to eventually move to some type of real search engine like Lucene Solr.

I designed the search classes to be pluggable module using interfaces instead of hard-coded classes, so it should be possible to just write a Solr based search provider and use it instead of MySQL/PDO based provider.

Same can be do with Postgresql, but will not made as much sense as replacing MySQL with a real search engine.

Thursday, September 13, 2012

My answer to "Updating LampCMS"

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


It's not automatic. The easiest way is to start using the phar based installation.
With phar based installation you get one lampcms.phar file and also contents on the www directory which includes all templates and also a config directory with config files.

In 90% of updates changes are made only to the library classes and not to templates. Since all libraries are included in the lampcms.phar you will only need to replace the lampcms.phar with the new file. Also you will have to upload the new minified javascript file because every update to .phar file has slightly different version number and program will look for minified javascript that matches that version.

If you write custom plugins to Lampcms you don't have to worry about overriding them because plugins are stored in the config/plugins directory.

Tuesday, January 24, 2012

My answer to "Change Password Encryption"

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


OK, so you want to be able to use already encrypted passwords?
Then you can just use the same hashing as was used on SMF.

I mean, you can just use md5(username.password), it will work. It's usually a good idea to add salt to hashing but if you absolutely must be sure that existing users can login without any problems you may keep using the old hashing technique. It's still OK.

md5($string); is the same as hash('md5', $string);
the reason I use the second option is because in older version of php the hash('md5', $string) was faster than md5($string). I think there is no speed difference in the latest version of php, I just use it as a habit.

I am not sure what the data.username does? First of all what is data? This is php you know, it needs at least a dollar sign in front of variable. There is no dot notation in php also.

As for returning blank page, I am not sure why. If you enable debugging and have enabled logging, then you can look in the log file. You can quickly add anything to a log by just using the "d" function, like this:

d("log this line with this $variable");

It will automatically add a file name and line number where you added this line.

Saturday, May 7, 2011

My answer to "Added Sticky thread feature"

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


Just a
test answer

Tumblr support added

My Question on Support site for LampCMS project

This is a text post rrrr
f to test blogger API

Click here to post your reply


Tumblr support added

My question on Support site for LampCMS project

This is a text post
f to test blogger API

Click here to post your reply


Tuesday, December 7, 2010

Per user tags and recent tags display

TODO: need per-user tags table
that will have uid -> array tag => count
update on every question user posts

===============================

How to find all questions AND answers per user per tag?

If we have tags in answers then it's easy just search for tag $in + $uid
then the same in QUESTIONS

So we really must have tags in ANSWERS!

===================================

Every time a user posts an answer we must also update PER_USER_TAGS collection

=====================================

It would be cool to have PER_USER_VIEWS table

question_id, uid, hts (i_ts not necessary because we can just sort by _id)

Can also collect "interesting tags" based on user views, questions, answers!

======================

Handling "save draft": best is to save draft into USER object under 'q_draft' as array
of title, body, tags

And for answer is a_draft and alo draft_c for comment!

Then after submit answer/question/comment but delete the value from user object

====================================

TODO: when showing "recent tags" Stack does sneaky thing:
it ALWAYS show "YOUR INTERESTING" tags first, even if they are not most recent
and THEN append block with recent tags.

In order to do this we cannot cache recent tags, actually we can for guests
and those who does not yet have "interesting tags"

Then we do 2 selects from RECENT_TAGS: first one with $in => "Interesting tags"
and the second one we get the usual 'recent tags' but remove "my tags" from result
OR specifically in find() pass $not and specify array of "interesting" tags.

It's probably easier to do the usual select, then array_diff
and then append one array to another or merge then so that "MY TAGS" are
always on top!

It actually goes one step beyond this: it also uses per-user tags stats, looks like it
picks some tags from there as well.

So 3 arrays: "My tags", "My stats tags" and "recent tags"
then filters out duplicates and uses them in order of "My tags", "Stat tags", "Recent tags"

Also, how are recent tags updated? Does the new answer trigger update or only new question?
In other words, recent activity for the tag, meaning answer/question/edit/comment (maybe?)
OR just new question?

==========================================

Monday, December 6, 2010

Processing of question

Handling Processing of QForm

Title, body, tags run through utf-8 string first

Run title, tags, body through htmlspecialchars or htmlentities()
or even through string_tags!

In the future if we allow tags then...we will run through safe_html instead!

Make intro
Parse markdown
store [html], [plain]
or just body?

We need something like messageAdapter that will accept
submittedQuestion object

SubmittedQuestion will have:
getBody (UTF8 object is fine, it's even better because we will be able to get num-lines, num-words)
getTitle Utf8String
getTags array
getUser <- UserObject
getIP string

////

tokenize title

record:
PER_USER_TAGS
TITLE_TAGS
QUESTION_TAGS
USER_STATS... not sure what it is but we need to update count_questions of user, right?
Ideally this will be in mongo USER collection
We can have separate collection USER_STATS, it's fine and it's small...


We can also keep reputation there? Maybe but it's really inconvenient because we
need reputation in clsUserObject of oViewer.


Also... we still want similar elist items!

We also want a way to get similar questions (later)
Also need a way to check for duplicate using q_hash uid + body

Need a way to test for floodcheck per uid, per ip

so we need a flood check class that would act as a filter via observer?

It's cool

The similar creation should be done as post-echo call.
also some emailing to subscribers will be done via post-echo thingy

///

Need a way to validate and set form errors.
validate title, validateBody, validateTags

If there are errors in validation we will return the same form.

Otherwise do redirect via meta tag with 2 seconds delay
How to do meta redirect? Basically we need to still show result page
with link to view new question and will say 'you will be redirected in 3 seconds"

Monday, November 15, 2010

Some notes about installing lighttpd and php

copy php-fpm.conf to /usr/local/cgiphp/etc
chmod src/php-5.3.3/sapi/fpm/init.d*

make /usr/local/cgiphp/var writable to user 'nobody' or just make it writable
both log and run dirs must be writable so that default log
and pid files can be created

//
lighttpd server
after ./configure
make
make install

// need to manually create
/etc/lighttpd
and copy from src/lighttpd-XXX/doc/config/lighttpd.conf
//
and also copy modules.conf there too

manually create dir /var/log/lighttpd/
and create files access.log and error.log in there
and make them writable
if files don't exist server will not be able to start

manually create /tmp/lighttpd/cache
for compression

change ipv6 to "disabled" otherwise the SERVER["REMOVE_HOST"]
shows weird looking ip stat starts with hex:$ip

Sunday, July 18, 2010

How to work around “sorry, you must have a tty to run sudo” without sacrificing security

Edit the /etc/sudoers file and comment out this line:

Defaults requiretty

Done!

Tuesday, July 13, 2010

Notes for Twitter image aggregator

Need per-twitter-user stats

in order to show other pics by the same user.
==================================================

Image rate up/down
favorites

comments

/reply

===========

most commented
most liked
most favorited

============

By tags....

How to best display other thumbs? In carousel or just on side block?


The idea is to auto retweet every new one

User may "Retweet", "Favorite", "Like", "Hate"

and "Comment" and "Reply"

Also may "Follow"

===================\\

Home page will have thumbs of new images + hash tag + tweet...
+ 'minutes' ago.... use JS for that?
+ javascript will auto-insert new images to top

==============

Nav column will have just recent tweets with auto-update

=============

Will also have tabs with most viewed, most commented, most liked, most favorited....


And will also have a per/tag pages...
=========

Settings to not include the user in 'viewed' image
Setting to not auto tweet the "Like" action

========

Keep tab on Next/Prev per image

========

store image paths like 23/54.jpg
then can easily create mini thumbs, thumbs, orig


===========

Sunday, May 30, 2010

Cannot start XAMPP on Windows 7?

If you having problem starting apache server on Windows 7 after installing the XAMPP, the problem is most likely that you already have a web server running.

Windows 7 comes with the IIS server and it's started up by default on many Windows 7 installations.

This is usually a very bad security risk, mainly because you should never have any server running that you don't need. Even more important, you should never have any server running that you are not aware of.

Anyway, on Windows 7 you should check if IIS is running and stop it if it is running.
Do this:
Start -> Control Panel -> System and security -> Internet Information service.

You then look in the right panel to see if Start button is grey and stop button is green. This would indicate that IIS service is running. Just click on Stop button to stop it.

Then you should be able to start the Apache server from the XAMPP control panel