Monday, 28 July 2014

Set Timezone

This will set the timezone for all the php functions in a page. Put this at the top of a page:

date_default_timezone_set('Asia/Calcutta');

Solve 5 annoying moodle problems

http://www.iteachwithmoodle.com/2012/11/16/solve-5-annoying-moodle-problems-quickly/

XMPP chat

Prosody is a good XMPP chat server. It can be installed from the distro repository.

A guide: http://www.techytalk.info/install-configure-prosody-xmpp-jabber-server-on-debian-ubuntu-linux/

There are many desktop clients for XMPP. There are a few web clients too: https://conversejs.org/ and http://candy-chat.github.io/candy/

https://conversejs.org/docs/html/

However, for these web clients to connect to the XMPP server, they need to use HTTP, so the XMPP server needs a plugin to communicate using xmpp over http, called BOSH: http://xmpp.org/extensions/xep-0124.html

The BOSH plugin for Prosody is: http://prosody.im/doc/modules/mod_bosh

Once the bosh-bind plugin is installed, a redirect should be setup in the web server (Apache or Nginx). This is because, converse.js must connect to the XMPP server (through bosh) at port 5280. However, browsers prevent authentication to this port because of same-origin policies (to prevent XSS). Therefore, the javascript can be made to authenticate to a particular directory which redirects the request to the correct url and port.

http://prosody.im/doc/setting_up_bosh

For integrating prosody with Wordpress, there is a plugin:
https://github.com/llun/wordpress-authenticator

However, this plugin requires wordpress to store passwords as md5 hashes (using a plugin) instead of phpass. Md5 hashes are very insecure so wordpress-authenticator cannot be used.

There is another prosody plugin for wordpress authentication: https://code.google.com/p/prosody-modules/wiki/mod_auth_wordpress
However, the code is alpha and development seems to have halted.

To integrate converse.js with a site that already uses authentication, one needs to use PHP prebinding: http://www.techytalk.info/other-projects/xmpp-bosh-toolkit/
http://stackoverflow.com/questions/3696165/get-xmpp-sid-and-rid-from-bosh-in-php
http://stackoverflow.com/questions/23264662/java-trying-to-prebind-converse-js-using-bosh-but-not-able-to-get-the-sid-and

https://github.com/candy-chat/xmpp-prebind-php/

Prosody: creating accounts:  http://prosody.im/doc/creating_accounts





Wednesday, 23 July 2014

Enable error display in PHP

error_reporting(E_ALL);
ini_set('display_errors','1');

Wednesday, 9 July 2014

Improving email delivery (preventing spam flagging)

http://www.emailvendorselection.com/email-deliverability-checklist-improve-email-deliverability-now/

Friday, 27 June 2014

Windows 7 Panning Desktop Applications

http://superuser.com/questions/85362/looking-for-an-application-that-scrolls-or-pans-netbook-screens-running-windows

http://ynea.futureware.at/cgi-bin/infinite_screen.pl


http://kjh.ca/contour_mods/doku.php?id=solution_for_storyteller_on_1024x600%3asolution_for_storyteller_on_1024x600


http://www.addictivetips.com/windows-tips/get-infinite-scroll-on-windows-desktop-with-windowslider/

http://ficusdev.com/WindowSlider/Description

Friday, 20 June 2014

Page caching for Buddypress? Transients, memcached, vs others

Since Buddypress works on having users login, page caches software such W3 Total Cache, BP Super Cache, Nginx microcache, APC, Memcached, etc. won't work.

What would work is a partial page caching software. But there doesn't seem to be any such software now.

http://chrislema.com/high-performance-wordpress-membership-site/

However, by using the wordpress transients API, one can manually code fragment or partial page caching.

http://premium.wpmudev.org/blog/wordpress-transients/

Problems with transients:

http://wpengine.com/2013/02/21/wordpress-transient-api/

Starting with Wordpress 3.7, transients are garbage collected, so the issues mentioned above may be fixed.