Installing Trac 0.12.x Python 2.6 on RHEL 5.8

March 13th, 2012

A quick note to install those stuff.

Install EPEL repo (http://fedoraproject.org/wiki/EPEL).
yum install python26 python-devel subversion subversion-devel
Install setuptools
easy_install trac
wget http://subversion.tigris.org/downloads/subversion-1.6.17.tar.bz2
tar xjvf subversion-1.6.17.tar.bz2
cd subversion-1.6.17
wget http://www.sqlite.org/sqlite-amalgamation-3.6.13.tar.gz
tar xzvf sqlite-amalgamation-3.6.13.tar.gz
mkdir sqlite-amalgamation
cp sqlite-3.6.13/sqlite3.c /home/sysadmin/subversion-1.6.17/sqlite-amalgamation/sqlite3.c
cd /usr/bin
rm python
ln -s python2.6 python
cd -
./configure
make
make swig-py
make install-swig-py
cp -R /usr/local/lib/svn-python/libsvn /usr/lib/python2.6/site-packages/
cp -R /usr/local/lib/svn-python/svn /usr/lib/python2.6/site-packages/

/sbin/service httpd restart


Actionscript/Flash mask experiences

January 14th, 2011

Some notes:

  1. both masker and maskee need to set cacheAsBitmap to true
  2. have to use transparent png or transparent swf file for masker, no jpg
  3. call setMask after loadMovie finished
  4. maskee can be multiple layers. Only need to setMask on top layer.

Sample code:

/*this.createEmptyMovieClip("mask_mc", 2);
mask_mc.createEmptyMovieClip("mask_submc", mask_mc.getNextHighestDepth());
mask_mc.cacheAsBitmap = true;

mask_mc.mask_submc.beginFill(0xfff000);
mask_mc.mask_submc.moveTo(0, 100);
mask_mc.mask_submc.lineTo(200, 100);
mask_mc.mask_submc.lineTo(200, 300);
mask_mc.mask_submc.lineTo(0, 300);
mask_mc.mask_submc.lineTo(0, 100);
mask_mc.mask_submc.endFill();*/

attachMovie("masker","mask_mc", 2);
mask_mc.cacheAsBitmap = true;

this.createEmptyMovieClip("mcCharMask", 1)
mcCharMask.loadMovie("a.png");

this.onEnterFrame = function(){
		if(mcCharMask.getBytesLoaded() >= mcCharMask.getBytesTotal() && mcCharMask.getBytesLoaded() > 0){
		delete this.onEnterFrame;
		// set cacheAsBitmap before setMask. Sometime cacheAsBitmap value changes after loadMovie
		mcCharMask.cacheAsBitmap = true;
		mask_mc.setMask(mcCharMask);

		/*mask_mc.createEmptyMovieClip("mask_submc1", mask_mc.getNextHighestDepth());

		mask_mc.mask_submc1.beginFill(0xff0000);
mask_mc.mask_submc1.moveTo(0, 200);
mask_mc.mask_submc1.lineTo(200, 200);
mask_mc.mask_submc1.lineTo(200, 300);
mask_mc.mask_submc1.lineTo(0, 300);
mask_mc.mask_submc1.lineTo(0, 200);
mask_mc.mask_submc1.endFill();*/

		}
}

Using saveAll to save model that has multiple levels of hasMany (hasAndBelongsToMany) relationship with CakePHP 1.3

November 26th, 2010

It turned out CakePHP failed to link GroupSet and Groups. No go…..

For example, GroupSet hasMany Groups and Group hasAndBelongsToMany users. They can be saved using one saveAll call. No need to deal with the IDs.

One level hasMany saveAll looks like:

Array
(
    [GroupSet] => Array
        (
            [name] => "Title"
        )
    [Group] => Array
        (
            [0] => Array
                (
                    [name] => On Gwoo the Kungwoo
                )
            [1] => Array
                (
                    [name] => More on Gwoo
                )
        )
)

The multiple levels hasMany (or HABTM) should looks like this:

Array
(
    [GroupSet] => Array
        (
            [name] => "Title"
        )
    [Group] => Array
        (
            [0] => Array
                (
                    [Group] => Array
                             (
                              [name] => Group1
                             )
                    [GroupMember] => Array
                       (
                          [0] => Array
                              (
                                [user_id] => 1
                              )
                          [1] => Array
                              (
                                [user_id] => 2
                              )
         )
         [1] => Array
                (
                    [Group] => Array
                             (
                              [name] => Group2
                             )
                    [GroupMember] => Array
                       (
                          [0] => Array
                              (
                                [user_id] => 3
                              )
                          [1] => Array
                              (
                                [user_id] => 4
                              )
                        )
                )
 )

How do I completely remove a file/folder from a Subversion repository?

July 14th, 2010

To remove a file or folder and all history from an SVN repository, create a dump of the existing repository and filter out the unwanted file or folder. Then create a new repository to replace the existing repository.

The process to completely remove a file or folder from a repository involves several steps. Use the following steps to completely remove an existing file or folder and all history from your current live repository:
Create a dump of the existing repository:

svnadmin dump [path_to_repo] > dumpfile1

Filter out the unwanted file/folder:

svndumpfilter exclude [path_to_file/folder] < dumpfile1 > filtered_dumpfile

Create a new repository, to swap for the live repository:

svnadmin create repo_temp

Load the filtered dumpfile to new repository:

svnadmin load repo_temp < filtered_dumpfile

Verify the new repository and replace the live repo with the new repository:

rm [path_to_live_repo] -rfmv repo_temp live_repo

From: http://help.collab.net/index.jsp?topic=/faq/removefile.html
Reference: http://svnbook.red-bean.com/en/1.0/ch05s03.html


CentOS 5.4 glibc causes crash of VMWare vmware-hostd process in VMWare 2.0.0 and 2.0.1

January 8th, 2010

http://bugs.centos.org/view.php?id=3884


Removing checkboxes from a given list for CoursEval

January 6th, 2010

Drag the button to the bookmark bar:
CE Student Remover

There is the source code:

String.prototype.trim = function() {
return this.replace(/^\s*|\s(?=\s)|\s*$/g, "");
};

Array.prototype.clean = function() {
for (var i = 0, loopCnt = this.length; i < loopCnt; i++) {
this[i] = this[i].trim();
}
};

Array.prototype.has = function(value) {
for (var i = 0, loopCnt = this.length; i < loopCnt; i++) {
if (this[i].trim() == value) {
return true;
}
}
return false;
};

var stu = prompt("List").split(";");
stu.clean();

var inputs=document.body.getElementsByTagName('input');
for(var i=0;i
if(inputs[i].getAttribute('type')!=null&&inputs[i].getAttribute('type').toLowerCase()=='checkbox'){
var j=0;
if(stu.has(inputs[i].parentNode.nextSibling.childNodes[0].textContent)){
//alert(inputs[i].parentNode.nextSibling.childNodes[0].textContent);
inputs[i].checked=0;
stu.splice(stu.indexOf(inputs[i].parentNode.nextSibling.childNodes[0].textContent),1);
}
}
};
var result="";
for(var i=0;i {
if(stu[i] == "") continue;
result+=stu[i]+"; ";
};
alert("The course name: "+document.getElementsByTagName('title')[0].textContent+"\n\nThe remaining students are: "+result);


Boxy Testing

November 16th, 2009

Boxy Me


Using Swift Mailer 4 in Symfony 1.3

November 11th, 2009


cd lib/vender
wget http://swiftmailer.org/downloads/get/Swift-4.0.5.tar.gz
tar xzvf Swift-4.0.5.tar.gz
mv Swift-4.0.5/lib swift

Add to “config/ProjectConfiguration.class.php”
require_once dirname(__FILE__).'/../lib/vendor/swift/swift_required.php';

Using Swift 4

$this->transport = Swift_SmtpTransport::newInstance($server);
//$this->transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($this->transport);
$message = Swift_Message::newInstance($subject)->setTo($to)->setFrom($from)->setBody($body,'text/html');
$mailer->send($message, $failures);


See what apache is doing

November 9th, 2009

http://httpd.apache.org/docs/2.2/mod/mod_status.html


Selecting/Unselecting all Checkboxes on a page

October 21st, 2009

Some webpages have a lot of checkboxes, but do not provide “Check All” button. Here comes a solution for this. You will use the following link to create a bookmark in your browser to help you check all of them at once.

To install, simply drag the following links into your Firefox toolbar:

Select All Checkbox

Unselect All Checkbox

To use it, just open up the page with checkboxes you want to check. Click on the bookmark on the toolbar you just added. Then you will see the magic ;)

Works in Firefox and Safari 4 on any web page.


Spam prevention powered by Akismet