Tuesday, May 31, 2011

Beginning work on the Lampcms API

My Question on Support site for LampCMS project

Yes, the Lampcms will have an API. It will be one of the few Open Source Q&A programs that has own API.

Before I beging working on the API, here are some basic outlines of what it will do:

1) Output will be in JSON or XML, but first I'll work on JSON version since it's much simpler. But right from the start the output will be handled by the formatter class. That class will accept raw data (php array or object) and convert it into JSON or XML. So first I'll just write JSON formatter)

2) It will be read/write API. First I'll work on read functions, then on write.

3) Good news and bad news about write API. Good news - it will be OAuth2, which is harder to write for me but easier to use for clients. Bad news - this will be one module which that will not be free. Yes, it will be the first premium module. After all, if you need the write API you are probably building a very interesting project with the purpose of making a profit. So it will not be a big deal to pay for this module. It will not be expensive anyway.

So, here you have it - a free read API with support to get latest questions, unanswered, by tag(s), support for "startwith" and "limit" and "sort by" options

Support to get all answers for a question with "startwith", "limit" and "sort" options and support for include/exclude comments from data

Support for questions for specific user, answers by specific user.

Maybe other options like get following/followers per user, but that will come later.

Any suggestions? Post them here.

Click here to post your reply


Saturday, May 28, 2011

My answer to "Is there any way to include images in my post?"

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


There are some posts with images on this site. I am not sure how they did it. There is no support to actually save an image to the server but there is a way to just include an img tag that points to image hosted somewhere else. 

Friday, May 27, 2011

My answer to "Is there any way to include images in my post?"

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


There are some posts with images on this site. I am not sure how they did it. There is no support to actually save an image to the server but there is a way to just include an img tag that points to image hosted somewhere else. 

Thursday, May 26, 2011

My answer to "Working on "Add YouTube" video"

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


Start testing!
You can use this "Youtube" button now.
Just add some videos to your question or answer and see if it worked.
It still not the 100% polished, but it works with both inserting video and then playing in by replacing thumbnail with actual player.


Confused? More about NextUp: http://youtube-global.blogspot.com/2011/05/introducing-stars-of-future-on-youtube.html Keep up to date on Twitter: http://twitter.com/#!/search/%23YTnextup The YouTube NextUp winners arrive in New York City for Day 1 of the YouTube NextUp Creator Camp!Confused? More about NextUp: http://youtube-global.blogspot.com/2011/05/introducing-stars-of-future-on-youtube.html Keep up to date on Twitter: http://twitter.com/#!/search/%23YTnextup The YouTube NextUp winners arrive in New York City for Day 1 of the YouTube NextUp Creator Camp!

My answer to "A test of Adding YouTube video"

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



Part of the Google Apps for Education Professional Development Webinar Series. Learn about three LMSs available on the marketplace that integrate with Google Apps. Representatives from Haiku, Class.io, and CourseDirector will demo their products and answers your questions.Part of the Google Apps for Education Professional Development Webinar Series. Learn about three LMSs available on the marketplace that integrate with Google Apps. Representatives from Haiku, Class.io, and CourseDirector will demo their products and answers your questions.







This is a reply with YouTube video in it.

Sunday, May 15, 2011

My answer to "Some questions regarding lampcms"

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


Lampcms Can handle such load if you do few things right:
1) Do NOT run php as mod_php under apache. Instead run it as fastcgi, and not only that, but also run it under control of php-fpm. php-fpm comes with php 5.3.3 now, so you should just set it up. Make sure you have anough ram on the server and allocate about 250 php processors to run. This will be more than enough because 1000 requests are not really at the same time - php will not take more than 1/4 second per page on Lampcms, some pages are rendered in under 50 millisends here! This is true, even though my server is just plain dual core, 2 hard drives....

You can still use Apache but do not use mod_php, configure it to run php as fastcgi.
Ideally you should use NGINX or Lighttpd server for php - they are capable of handling much higher load.

2) Always use APC. This is one of the easiest thing is the world to do. APC is not even a server - you don't need to start it up, all you have to do is make sure apc extension is enabled in php.ini (and of cause you must have apc extension installed)

3) For best results run MongoDB on separate server, but make sure it's really close to the web server, I mean on the same subnet. This is not necessary, you can perfectly run the MongoDB and web server together on one box, just make sure you have enough RAM. I recommend minimum of 16Gig if you run Mongo and Web server together.

4) Scaling will be done mostly by MongoDB - it supports "horizontal scaling", which basically means "Just add another server" and with minimal or even no downtime. MongoDB will take care of it, you need to know how to do this of cause. You can learn more on MongoDB site and on their discussion list.

You can also scale by adding extra web server. One of the easiest things to do is to have dedicated server for images, JavaScript and css files. LampCMS supports this and even has config options in !config.ini to define urls of Image and CSS servers.

For serving static files Apache is preferred choice is it has excellent in-memory cache module, which you should always use for static files.

If you need to add more web servers then there are ways to do that too. There are some common time-tested ways to do this like round robin DNS. Just install copies on Lampcms scripts on several servers, point them to the same MongoDB database or cluster of databases and you should be able to handle millions of visitors a day.


I recommend you start with just 2 servers: one web server and one database server. Put as much ram on your DB server and more importantly make sure you can add more RAM later. Start with 16Gigs of ram and have room to expand it like 4 times just in case you will even need it. 16Gigs should be enough for start.

Make sure hard disks are fast. RAID 10 is the best choice.

Web server does not need to be super fast, 2 hard drives - one for system files, one where the program is. If you like logging then it's best to log to dedicated disk, so 3rd disk for that.

If you sending out lots of emails then you may need another server as email server. You may also use some type of messaging system like ActiveMQ to send mail jobs to mail server. LampCMS has EventDispatcher, so you can just write simple php class that listens to events that need to send out mass emails then use messaging like ActiveMQ (php has libraries for it) and then just post messages to ActiveMQ server. All these will be done after the page renders, so these things do not add to page load at all. You need to use fastcgi under control on php-fpm for that. I already said this like 100 times on this forum - use php-fpm and you'll have Java-like performance on php.





My answer to "Thanks and some feature requests"

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


Thanks.
This site already has the "Reputation" system just like on StackOverflow. You do earn points for votes and for w hen someone selects your answer.

You also earn points for posting your Q and A to Twitter, Facebook. Tubmlr, Blogger.

You also gain certain extra permissions for reaching certain score. This is all configurable. So the Points system is already fully implemeted.

As for badges - no. I am not sure I want this. I mean, what are we a boyscout club? I mean badges are great for when you in boyscout, but seriusly, I have never, ever paid any attention to anyone's badges (including my own) on StackOverflow. What this means to me is that there is a considerable work required to add a feature that I personally totally ignore on other sites.

Badges is just one of those features that I will do if someone sponsors it. I mean, I am open for coding sponsored features - you pay, I code. New code becomes available as feature - for everyone, not just you. Your name and link goes into "sponsors" category. A Win-Win.

As Far as "not as feature rich" as So and So... Take a look at what we already have. I think it has more features than "so and so". Does "so and so" have "Dot folders"? Does "so and so" have indicators of "Questions you follow"?

Does "so and so" have ability to follow tags, follow users and follow questions?

Does "so and so" have feature when words that match your tags are wrapped in <em> tag which can boost SEO for these words?

Does "so and so" have "Sticky thread" feature to keep certain posts on top of list all the time, like an announcement?

Does "so and so" have ability to post question or answer to Twitter, Facebook wall, Tumbl blog and Blogger blog - all at the same time?


Does "so and so" have excellent programming code editor/highter which is much better than one used on StackOverflow?


I am not sure about all other sites but at least one of the sites you mentioned does not have support for UTF-8 Tags - they only allow tags to be in English. On this site tags can be any word in any language - arabic, chinese, even html tags or percent sign can be in tag.

Does "so and so" have ajax based sort in tags and users pages?

Not as feature rich as StackOverflow? Think about it - SO does not even have their own user signup system - you MUST use open ID, there is no way to just create own account on SO. How lame is that?


Yes, this site does not have all the features that all other sites have. We don't have "Favorite" feature where you mark question as favorite - and it's saved to your favorites. But this is going to be added because I like it and I use it on stackoverflow, so it's going to be here too.

Yes, we don't have badges but I explained my position.

We don't have Internationalization yet but it's on a todo list and when I write it it's going to be better than "so and so" sites because I'm am planning to write complete locatization library not just translation. What I mean is not just language selection but locale like en_US, en_UK, etc... The locale also results in formatting date/time differently, formatting decimal points. currency etc.