The email features of Juvely

Posted by Luca on July 31st

Well you have all had a chance to play around with Juvely and test most of its features, but we assume that most people don’t really want clients to access our not-really-yet-whitelabel client centre. The main way that people will want to allow clients to get support is via email. Well guess what - we can do that already!

All accounts already have an email address setup which can be used for this purposes. This is support@[your-account].juvely.com. If you send an email to this address a new ticket will be opened - go on, try it! If a member of staff replies to the ticket an email will be sent to the client. The client can then add a new message to the client by replying to this email!

Another thing we guessed people wouldn’t want is to tell people to email support@[your-account].juvely.com, something like support@[your-company].com would be better right? Well guess what - we can do that too!

To set this up first enter the address into the Account Settings page in the Manage section. Once this is done all emails send by the system will have this address as the from address. To get emails from support@[your-company].com into the system just setup your email server to redirect them to support@[your-account].juvely.com! Sorted! Forwarding will probably work as well as long as the original from address (of the client) is kept in place! You may also want to disable the client centre otherwise URLs to it will appear in the emails sent to users.

We have decided to do this for our support address, now when you email that all your messages will be handled via Juvely!

Howto: Lighttpd, PHP and MySQL on Windows

Posted by Luca on May 16th

What? No posts for two and a half weeks, what is going on? Well unfortunately James and I have both had quite a bit of uni work to do. James has got his exams in a couple of weeks and then finishes at the beginning of June. I have had a couple of group projects, but I haven’t got my exams for four weeks so I should be able to get a bit more work done over that time.

Unfortunately I am going to have to send my MacBook back as I am having a few problems with it, this means I am going to be stuck on Windows until the repair has finished so I was wondering what to do for development. On my Mac I have Apache, PHP and MySQL. There are plenty of tutorials, and even packages that do this for you for Windows but I wanted something a tad different so in this howto I am going to explain how to install Lighttpd, PHP and MySQL on Windows.

What you will need
Lighttpd Windows binaries (1.4.15)
PHP (5.2.2)
MySQL (4.1.22)

It is probably a good idea to use whatever version of PHP you are using on your production server, most hosting companies will be using 5.1 rather than 5.2 as linked to above.

Installation
This is nice and easy, just run the installers. The order shouldn’t make any difference but I did it this way: Lighttpd, PHP, MySQL. When installing Lighttpd your virus checker will probably say there is a virus in process.exe, if you have problems it is probably best to close your virus scanner while installing. Information on process.exe can be found here. When installing MySQL it will ask you to create an account, you shouldn’t need it so just click Skip Sign-Up. When configuring you will want to set the type as Multifunctional or Transactional. During the PHP configuration it will ask you for a server type, select Other CGI and from the list of extensions select MySQL.

Configuration
First you need to get lighttpd working, after the installation it wouldn’t work for me without a little change. Go to C:\lighttpd\etc\ and make a copy of the file lighttpd.conf.orig called lighttpd.conf. After this you should be able to run the start script, and if you navigate to http://127.0.0.1/ you should be greated with the startup page!

Next you need to configure PHP to work. This is again nice and easy. You need to edit C:\lighttpd\etc\lighttpd.conf. First find the line with “mod_cgi” on it and uncomment it by removing the #. The add the following to the bottom of the file:

cgi.assign = ("php" => "C:\\Program Files\\PHP\\php-cgi.exe" )

You may need to change it if you installed PHP to a different location, but make sure you point it to php-cgi.exe not php.exe!

Testing

We can kill two birds with one stone by getting a list of MySQL databases from a PHP script! To do so put the following in C:\lighttpd\htdocs\test.php:

< ?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$db_list = mysql_list_dbs($link);

while ($row = mysql_fetch_object($db_list))
{
     echo $row->Database . “\n”;
}
?>

(Argg WP sucks for code… “n” should have a backslash before it)

And then go to http://127.0.0.1/test.php, and if you have got it all working you should get a list of the databases!

Javascript buffering with CakePHP

Posted by Luca on April 10th

Over time as I have AJAXified more and more of Juvely we have unfortunately had more and more little Javascript code blocks spread around the page. On the dashboard I think it was 4 or 5 codeblocks each with only about 3 lines of Javascript within them. I thought this was rather inefficient, so I was going to write a helper to store each block, and then output it all at the end, fortunately CakePHP has something that does just this built in!

The Javascript helper allows to cache all the code put through the codeBlock() function and then either output it at the end of the view, or include it from a seperate file. I decided to output it at the end of the view as this seemed more suitable for our uses. To enable this you simply need to include the Javascript helper in your controller and then put this somewhere in your view:

$javascript->cacheEvents();

The problem with this is that you have to put it in every view you want the Javascript buffered, and you might forget, so instead open up the code for the Javascript helper (cake/libs/view/helpers/javascript.php) and set the following variables at the top of the class:

var $_cacheEvents = true;
var $_cacheToFile = false;
var $_cacheAll = true;

Right, so how do you use it? Well simple, you just need to pass your code through $javascript->codeBlock() and tada! If like me you don’t current do this, you might want to do what I did to avoid horrible multiline PHP strings argg! I used PHPs output buffering functions to grab the code and then send it to the $javascript->codeBlock() function, I even made a nice little helper for it:

< ?php
class MiscHelper extends Helper
{
	var $helpers = array('javascript');

	function jsBlockStart()
	{
		ob_start();
	}

	function jsBlockEnd()
	{
		$this->javascript->codeBlock(str_replace(”\t”, “”, ob_get_clean()));
	}
}
?>

Then I just need to enclose my Javascript in the tags from the helper like so:


< ?php $misc->jsBlockStart(); ?>
alert(’This code is buffered!;’);
< ?php $misc->jsBlockEnd(); ?>

Feel free to share this, and if anyone has an account for the CakePHP Bakery to post it there!

Some light entertainment

Here are a couple of links to distract you from your real work for a few minutes.

First, a little video from the game The Punisher which some Aussie I know made:
http://www.loreindustries.com/flash/PunisherHill.html

Second, a nice little addictive flash game. Please take note of the warnings that it is very addictive and you will waste many hours playing it:
http://www.handdrawngames.com/DesktopTD/

Anyway, back to work on Juvely now, we have set a deadline for when we are going to start the beta, and it isn’t very far away! Eeeeek!

Next Page »