Sunday, December 30, 2007

Release Early: Foorum 0.1.1 Release

please download from http://foorum.googlecode.com/files/Foorum-0.1.1.tar.gz

and have fun!

0.1.1 Sun Dec 30 16:19:11 2007
- use Perl::Critic to fix some errors, bin/misc/perlcritic.pl
- use JavaScript::Minifier to minify js files, bin/misc/js-min.pl
- bug fix for message permission check (r160)
- add requires 'Cache::FileCache'; in Makefile.PL (reported by hotsnow)
- use Config::YAML instead of ConfigLoader because Config::YAML is simpler and faster
- new table 'user_settings' & /settings for 'SendUpdateNotification for MyStarredItems' (r208)
- new settings 'show_email_public': can hide email from public (r215)
- Topic RSS && RSS title bug fix.
- What's New page
- Site Admin Settings: /admin/settings to change foorum_local.yml

Labels:

Tuesday, December 25, 2007

Perl::Critic support on Foorum

Perl::Critic is a great CPAN module for every Perl developers.

From Foorum v0.1.1 on, we will support Perl::Critic
the pl URL is http://foorum.googlecode.com/svn/trunk/bin/misc/perlcritic.pl
and the result is at http://foorum.googlecode.com/svn/trunk/bin/misc/critic.txt

and here is a tip from Jeffrey Thalhammer:
http://mail.pm.org/pipermail/pbp-pm/2007-December/000056.html

we can disable the eval "string" alerts by
my $has_proc_pid_file = eval "use Proc::PID::File"; ## no critic (ProhibitStringyEval)


have fun!

Labels:

Monday, December 24, 2007

Release Often - Foorum 0.1.0

I release Foorum 0.1.0 as a Christmas gift. :)

http://foorum.googlecode.com/files/Foorum-0.1.0.tar.gz

Live demo please see: http://www.foorumbbs.com/forum

Changes:

0.1.0 Fri Dec 24 20:56:00 2007
- move trunk to http://foorum.googlecode.com/svn/trunk/
- use jQuery to deal with browser time zone
- UBB js localize
- use Catalyst::Plugin::Cache instead of Catalyst::Plugin::Cache::Memcached
- use jQuery validate.js for register etc. (add validate/messages_cn.js)
- rewrite Model/Email.pm to send email after compose a message
- add Plain/Textile Formatter to post/reply/edit
- add Text::GooglewikiFormat
- new language: Chinese Traditional
- add =pod formatter supports
- My Shared Items

Labels: ,

Thursday, December 20, 2007

CPAM modules updates

Wednesday, December 19, 2007

new CPAN module released: Text::GooglewikiFormat

I spent couple of hours last night to write a new CPAN module: Text::GooglewikiFormat

I would use it in my Foorum.

And I would use it to build foorum documents from trunk http://foorum.googlecode.com/svn/wiki.

the syntax is here: http://code.google.com/p/support/wiki/WikiSyntax

have fun!

Labels:

Monday, December 17, 2007

Catalyst new feature: Catalyst::Stats

I guess I really need Catalyst::Stats.

I just move "Catalyst-Plugin-tv_interval" to DEPRECATED.

I think every Catalyst developer should use Catalyst::Stats.

:)

Labels:

Saturday, December 15, 2007

Foorum demo online!

finally I get the Foorum online. I buy a Dreamhost host plan then install it there.

http://www.foorumbbs.com

have fun!

Labels:

Friday, December 14, 2007

No Driver error in TheSchwartz

generally that's something in Data::ObjectDriver::Driver::DBI

u need configure your dsn as "dbi:mysql:database=theschwartz;host=mysql.foorumbbs.com;port=3306"
but not "DBI:mysql:database=theschwartz;host=mysql.foorumbbs.com;port=3306".

since
        if (my $dsn = $driver->dsn) {
($type) = $dsn =~ /^dbi:(\w*)/;
in Data::ObjectDriver::Driver::DBI

JFYI.

Dreamhost Catalyst

It's a best Catalyst Calendar ever for Dreamhost:

local::lib and Catalyst

Labels: ,

Monday, December 10, 2007

jQuery and browser time zone

generally everyone has a browser time zone.
var timezoneOffset = -(new Date().getTimezoneOffset());
like mime is 480.

I want add a simple class="date" to time span, then it will add time zone automatically. (MySQL DateTime format for now. I'll use it in my Foorum)

it's a sample html: http://www.fayland.org/jQuery/dateTimeZone.html

it will convert <span class='date'>2007-11-05 12:20:30</span> to 2007-11-05 20:20:30 in my browser.
$(function() {
// follows are copied from datePicker/date.js
// utility method
var _zeroPad = function(num) {
var s = '0'+num;
return s.substring(s.length-2)
//return ('0'+num).substring(-2); // doesn't work on IE :(
};

$(".date").each(function (i) {
var s = $(this).text();
var f = this.id; //format
if (! f) {
f = 'yyyy-mm-dd hh:ii:ss';
}

var d = new Date(1997, 1, 1, 1, 1, 1);
var iY = f.indexOf('yyyy');
if (iY > -1) {
d.setFullYear(Number(s.substr(iY, 4)));
}
var iM = f.indexOf('mm');
if (iM > -1) {
d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1);
}
d.setDate(Number(s.substr(f.indexOf('dd'), 2)));
d.setHours(Number(s.substr(f.indexOf('hh'), 2)));
d.setMinutes(Number(s.substr(f.indexOf('ii'), 2)));
d.setSeconds(Number(s.substr(f.indexOf('ss'), 2)));

var timezoneOffset = -(new Date().getTimezoneOffset());
d.setMinutes(d.getMinutes() + timezoneOffset);

var t = f
.split('yyyy').join(d.getFullYear())
.split('mm').join(_zeroPad(d.getMonth()+1))
.split('dd').join(_zeroPad(d.getDate()))
.split('hh').join(_zeroPad(d.getHours()))
.split('ii').join(_zeroPad(d.getMinutes()))
.split('ss').join(_zeroPad(d.getSeconds()))
;

$(this).text(t);
} );
});


Enjoy!

Labels:

Foorum trunk changed

Sunday, December 09, 2007

Foorum 0.08

The last version of this year. I'll push out a 0.1.0 on next month next year.

http://foorum.googlecode.com/files/Foorum-0.08.tar.gz

Changes:
0.08 Sun Dec 9 16:30:30 2007
- I18N encoding fix
- use the lastest Catalyst::Plugin::Authentication (Store::FromSub::Hash)
- use jQuery flot to do daily chart
- bin/setup.pl
- RSS text fix
- lots of changes are missed.

check out your code from
svn checkout http://foorum.googlecode.com/svn/trunk/ Foorum


have fun! welcome to join us to make a new Catalyst based forum app - Foorum.

Labels:

Saturday, December 08, 2007

jQuery Flot For Daily Chart in Foorum

I know Google just release his Chart days ago. it's powerful, more than jQuery flot.

but I still want to use flot because it's simpler. yet badly it's not supporting day as its X. like 20071131 is next to 20071201, not far away as treated in flot.

Foorum has a feature that it will record the count of some tables every day. we have a table named 'stat', and columns are "stat_id", "stat_key", "stat_value", "date". so somehow we would have something like
20071201 user_counts 510
20071202 user_counts 640
then go on.
we use a cron script to collect those data.

data is not so straight for human being. we need CHART.
so I just make vars from stat table like:
stats => {
user_counts => {
20071201 => 510,
20071202 => 640,
20071203 => ...

then we use a TT file to create a HTML file.
$(function () {

[% i = 0 %]
[% FOREACH ctype IN stats.keys %]

$('body').append("<h2>[% ctype %]</h2><div class='placeholder' id='placeholder[% i %]' style='height:300px;'></div>");

var d[% i %] = [];

[% FOREACH key IN stats.${ctype}.keys.sort %]

d[% i %].push([[% key %], [% stats.${ctype}.$key %]]);

[% END %]

$.plot($("#placeholder[% i %]"), [
{
data: d[% i %],
lines: { show: true },
points: { show: true }
}
]);
[% i = i + 1 %]
[% END %]
});


more details @
http://fayland.googlecode.com/svn/trunk/Foorum/lib/Foorum/TheSchwartz/Worker/DailyChart.pm
http://fayland.googlecode.com/svn/trunk/Foorum/templates/stats/chart.html

@Enjoy;

Labels: ,

Friday, December 07, 2007

C::A::S::FromSub::Hash

I just release a new CPAN module for Catalyst - Catalyst::Authentication::Store::FromSub::Hash.

Generally I always hate one situation that http://search.cpan.org/perldoc?Catalyst::Authentication::Store::DBIx::Class hits database every request. to ease database, I create one cache layout between Authentication and database.

In my Foorum,
Foorum.pm
use Catalyst qw/Authentication ../;

foorum.yml
authentication:
default_realm: 'members'
realms:
members:
credential:
class: 'Password'
password_field: 'password'
password_type: "hashed"
password_hash_type: "SHA-1"
store:
class: 'FromSub::Hash'
model_class: "UserAuth"

In this config, we use store "FromSub::Hash" and model_class "UserAuth". so we need create a Foorum::Model::UserAuth:
package Foorum::Model::UserAuth;
use base 'Catalyst::Model';

sub auth {
my ($self, $c, $userinfo) = @_;

my $where;
if (exists $userinfo->{user_id}) {
$where = { user_id => $userinfo->{user_id} };
} elsif (exists $userinfo->{username}) {
$where = { username => $userinfo->{username} };
} else { return; }

my $user = $c->model('User')->get( $c, $where );
return $user;
}

$c->model('User')->get($c, $where); has built-in cache layout. and it return hash from/to cache.

I guess I would create another module - Catalyst::Authentication::Store::FromSub::Object later.
but since I don't use it, I'm not sure when will it kick out.

@Enjoy!

Labels:

Thursday, December 06, 2007

add Baidu to google toolbar

Wednesday, December 05, 2007

top softwares

I just reinstalled my laptop yesterday.
here is the list of the softwares/tools/services.

softwares:
* MSN
* Firefox
* ThunberBird
* UltraEdit
* FoxitReader
* WinSCP
* Skype, Google Talk, Yahoo! Messenger

tools:
* ActivePerl
* Subversion
* Apache
* MinGW + MSYS
* MySQL
* Memcached Win32
* OpenSSL Win32

services:
* Google Code
* CPAN search engine for Firefox
Monday, December 03, 2007

Catalyst Advent Calendar 2007

Saturday, December 01, 2007

a book - Programmer Web 2.0

FYI, I just brought a http://subject.csdn.net/web20programmer/ book in 5 minutes ago.

Labels: