Blog
053527th since April 04, 2007
R
1 - 4 of totally 6 entries in Dec, 2007 found Next »
Dec 29, 2007 ( Saturday )
( 461 )
Recent improvement
1) Added a graphic web monitor(at the right-bottom corner) to roughly display the traffic of my website. The records are from the Apache2 access.log, and filtered out all (png|gif|js|css|txt|ico|jpg)s and 302 redirections.

I used a stand-alone Perl script this time to generate the plot by using GD::Graph and a crontab job is setup to update the plot per-hour. All are done from outside of the httpd so that it can save some bandwidth and relieve the workload of my server process.

2) Added some visual effects by using jQuery. Now I have one more option when dealing with JavaScript, either parse the DOM manually, or using jQuery's features which make things much easier. Besides that I can use a lots of CSS3 specifications and don't have to worry about the cross-browser traps which saves me lots of time to google solutions, jQuery also provides with many easy-to-implement visual effects that makes the use of it lots of fun..

3) Improved the "My links" box which is now using AJAX features(this time using jQuery) to "Add" or "Remove" your favorite links, so no need to refresh the whole webpage to update your input.

4) Fixed some CSS problems with IE-7 after I installed IE7 in my laptop last week. Also I modified HTTP::BrowserDetect to make it work with IE7. Since the backend of this module is just using some regexes to parse HTTP_UserAgent, so this work is trivial but quite helpful to make my CSS work better.:)

5) some adjustment on Perl modules, i.e. switching from JSON to JSON::Syck, and from YAML to YAML::Syck. , saved about 4-10MB memory usage of the process.

6) Improved the line_count script (based on David Wheeler's SLOCCount) which counts lines on both Perl, bash, Javascript, CSS and filters out HERE documents, empty lines, comment (line|block)s like '#...', '%#...', '<%doc>...</%doc>', '/*...*/', '//...' et. al. and an overall report can be outputted in just several key stokes.
...More
Add tags: cross-browser GD::Graph jQuery JSON line YAML

by xicheng
21:07:57 | Add a comment | Read article
Dec 21, 2007 ( Friday )
( 152 )
Perl Timeline
Add tags: 5.10 CPAN Perl

by xicheng
23:09:31 | Add a comment | Modify entry | Ask xicheng
Dec 17, 2007 ( Monday )
( 230 )
Yet another info deliver: $m->notes
$m->notes is a very handy tool to deliver state information in Mason-based websites. It lives per-request and can be used to share data across multiple Mason components. i.e. you can parse the session-id in the top-most autohandler and then assign it a $m->notes entry to share among other Mason components later on.

You can surely get(set) more complex Perl data structures from(into) $m->notes, all depend on your needs : - )
Add tags: Mason notes state

by xicheng
19:08:25 | Add a comment | Modify entry | Ask xicheng
Dec 17, 2007 ( Monday )
( 307 )
Passing shell variables into Perl
To pass shell(bash) variables into the Perl command lines, one can:

1) use Perl's -s switch:
var="Some value"
perl -se 'print $v1, $k1' -- -v1="$var" -k1="..."


2) use shell (the - metacharacter):

var="Some value"
echo "print qq[$var]" | perl -


3) use double quotes (not recommended)

var="Some value"
perl -e "print qq[$var]"
...More
Add tags: bash Perl

by xicheng
18:46:07 | Add a comment | Read article and comment(1)
More entries: 1 2 Next » End