A successful marathon
In a successful marathon you start at the "Point of excitement" and go through "Point of exhaust", "Point of black circles", "Point of hallucinations" , "Point of philosophical hunger", "Point of no point", "Point of target in sight", "Point of accomplishment" and end up at "Point of wanna do it all over again".
As long as you don't give up at the "Point of no point" you are good to go.
@chandansharma #designer-ke-fundae
Conditional compiling in AS3
We come across situations where we don’t want part of our debug code/modules be part of the compiled SWF.
The following is how you can do conditional compiling in Actionscript 3.
function xxxxx
{
.....
.....
CONFIG::flag1
{
....
....
....
}
.....
.....
}
Everything enclosed by the CONFIG::flag1 statement is compiled only if the flag1 config constant is set to true.
In Flash CS4, This can be set from File -> Publish Settings. Select Settings next to Actionscript 3.
In the config constants menu, we can add over config constants.
Singleton in AS3
Singleton classes are one of the simple but very effective design patterns. Creating singleton classes in Java, C++ or even AS2 for that matter is very straightforward.
But in AS3, which is based on ECMAScript private constructors are not supported. The following is how you enforce a user of your library to have a singleton object in AS3.
Even the SingletonEnforcer class should go into the Example.as
package com.ciddu.sharath
{
public class Example
{
private static var _instance:Example;
public function Example(obj:Singleton)
{
if(obj == null)
{
throw Error(“This is a singleton class. Use getInstance instead”);
}
}
public function getInstance():Example
{
if(Example._instance == null)
{
var obj:SingletonEnforcer = new SingletonEnforcer();
Example._instance = new Example(obj);
}
return Example. _instance;
}
}
}
class SingletonEnforcer
{
}
Since the class SingletonEnforcer is present outside the package, it is not accessible outside Example.as
But at the same time if someone tries to create an object using new Example(), it will throw argument mismatch error during compilation.
If still someone tries to use new Example(null), a runtime exception is thrown.
GMail for Bugzilla notifications
Bugzilla supports both sendmail and SMTP as the mail delivery method. But with Gmail Apps starting to become the favored email provider for most of the companies, the need for making Bugzilla work with Gmail becomes important.
As of today, by default Bugzilla doesn’t support SMTP+TLS that is required for Bugzilla to work.
There has been one method suggested in the web that has worked fine for most of the users. But it hasn’t worked for me do to some authentication issues.
The following is how I was able to make Bugzilla work with my Gmail.
[root@sciddu~]# perl -MCPAN -e shell
This will launch the CPAN shell
cpan> install Email::Send::Gmail
It will ask to install additional modules. Install them.
Once the installation is done, in the Bugzilla mail_delivery_method admin page, choose Gmail as the option
Enter the from mailfrom address as <username>@gmail.com
Enter the smtp server as smtp.gmail.com
Enter the smtp_username as <username>@gmail.com
Enter the smtp_password
Click on “Save Changes”.
Now open the file Bugzilla/Mailer.pm
Look for the line if ($method eq "SMTP") { and replace it with if (($method eq "SMTP")||($method eq “Gmail”)) {
Save the file.
Now you are all set to use Gmail with Bugzilla.