Drupal Camp Taipei 2013

It is an honour to be invited to Taipei Drupal Camp this year
I submitted a migrate content case study
and got in successfully http://2013.drupalcamp.tw/session/83
So booking air tickets, sleeping bed, prepare slideshow
join the second day's hackathon etc
Thanks TKY had been helping and inviting me
And this is the exact right time to "exchange" outside HK when I started my own business
Get some fame, seeking co-working opportunities with Taiwan

I got the impression that the developers in Taiwan is more eager to participate after working hours
I had think of numerous reasons, like population is 3 time more than HK
Tech sector in Taiwan is much larger, and Tech industry is a "higher graded" job in Taiwan
And HK only being seen as "poor geeks and nerds"
and many others factors
But there isnt still a single reason why tech communities in HK is so much smaller
Just in July, there are Drupal Camp Taipei, HITCON, COSCUP happening in Taiwan, hosted by comminuties themselves
And there are WIDS in HK, hosted by gov backgoruned isoc.hk
But HK are famous for holding exhibitions, world-wide scale...
(ok, there is barcamp(s) in HK)

Let's come back to the camp
Enthusiastic pretty much sum that up, every where during the camp
I was a volunteer during collage
and know a bit about the effort behind the scene
《Thousand meeting,spend in two days》is a very good summary
The Enthusiasm from the participant, from volunteers
even without any linkage with their own job
(HK's WIDS was held on Thur, Fri, during office hours XD)
「using Drupal two year ago, but not now again」
heard these conversation I am not sure I am happy becasue they still help Drupal community
or being sad because there is not enough Drupal jobs in Taiwan?

The second day's hackathon was a new experience for me
I havent tried coding on rounded tables like camp fire
and helping ubuntu TW, a NGO
There are a little pressure
For a casual programmer like me, limited time coding is not really my style
Lucky I started the development the night before
so I finished the job within time limit
But as my time is fully occupied in the development, there was not much chance to work and communicate with others
It will be nice if I can steal others secret tips XD

Last but not least, I guess the business part of the camp can be improved
There are sponsors only session in Drupalcon
May be the situation is not the same
but as a Drupal community, bridge developers and business is very important to the growth of community
Developers need to paid their bills, business need workforce to develop
that is the basic thing for an eternal health community

That is it. Thanks TKY at last
and those audience listening to my bad putonghua,
the photographer that take a very good pic of me,
volunteers,
enthusiastic Taiwan friends,
girls around 師大
and banana flavored beer

Last, see Taiwan again next month in COSCUP!!

Drupal Camp Taipei 2013 MISC

Back from Drupal Camp Taipei 2013 safely
Blog a MISC first, before writing a review blog

In past 5 year, I visited Taiwan at least once a year, even more
Taipei had lots of coffee shops, slightly less heat than HK
But the high sun afternoon still burns and need to move in-door

This time I stayed near 師大夜巿 1983 hostal
aiming for the girls near the area
But the night market around really smaller than before
and less girls too
but there are still some styling pub (insomnia cafe),coffee cafe(中西美食)
I tried both, nice environment
When you are relaxed, those feelings just flow into your body easily

Way before I off load my luggage to hostal after get off the metro,
The first thing is pick up a book "字型之不思議" inside 7-11
I saw the description on a blog and want to buy the book immediately
But that is a publisher in Taiwan, and cannot be found in HK
So I booked the book online, delivered to 7-11 near my hostel
That is so convenient! But Taiwan locals do not think so
Later on I discovered that the book is best seller in book store...
and put that on featured best reseller shelf..

Lurking around 敦化站 on Friday afternoon
So hot and moved to LAVAZZA老咖啡
A cafe recommended by twitter
There are also cakes and pies
But there is no flat white in the coffee shop!
Every single cafe I visited do not have flat white
NO flat white!
So disappointed
cappuccino, you are the substitute in Taiwan then

There is no planning on the last day,
So I go to 誠品信義店 again
There are guitar shops, CD shops with shelf especially for Taiwan indie
And a "Revolution" focus featured topic
I thought I would see Marx there
But there is Banksy offical book
I spend an hour there standing and finished that
Turned over the book and see this 240 page full colored offical bookonly cost Taiwan dollar 395
Taiwan dollar 395 !!!!!
f words inside myself and then think of,
the author actually promote "free art"
and my luggage had been so full
So I put that "commercial product" down and just leave

After MISC, review blog also coming in, stay tuned!

Custom feeds tamper plugin

feeds tamper module can map multiple columns inside a CSV to the same field as multiple value
But there is a constraint, each field can only "rewrite" once
For example, convert
abc.jpg
to
sites/default/files/abc.jpg
and then multiple them into
sites/default/files/abc.jpg,sites/default/files/def.jpg
Two rewrite is needed in this case
There is no solution from feeds tamper module, you can only use a full path inside the CSV to skip the first rewrtie

But actually write your own custom plugin for feeds tamper is not that difficult
convert
abc.jpg,def.jpg
to
sites/default/files/abc.jpg,sites/default/files/def.jpg
just need a prefix-er

As feeds tamper use the plugin system from ctools
it is easy to extend, and add custom plugin:

<?php
// prefix_feeds_tamper_plugin.module
function prefix_feeds_tamper_plugin_ctools_plugin_directory($owner, $plugin_type) {
  if (
$owner == 'feeds_tamper' && $plugin_type == 'plugins') {
    return
'plugins/';
  }
}
?>

to notice feeds tamper there is a custom plugin here

implementation:

<?php
// plugins/list_prefix.inc

// plugin info, you can copy from feeds tamper module's plugins
$plugin = array(
 
'form' => 'prefix_feeds_tamper_plugin_list_prefix_form',
 
'callback' => 'prefix_feeds_tamper_plugin_list_prefix_callback',
 
'name' => 'prefix',
 
'multi' => 'direct',
 
'single' => 'skip',
 
'category' => 'List',
);

// form API being used, also copying from feeds tamper
function prefix_feeds_tamper_plugin_list_prefix_form($importer, $element_key, $settings) {
 
$form = array();
 
$form['prefix'] = array(
   
'#type' => 'textfield',
   
'#title' => t('Prefix'),
   
'#default_value' => isset($settings['prefix']) ? $settings['prefix'] : '',
   
'#description' => t('The string to use for prefix.'),
  );
  return
$form;
}

// this is the real logic, notice that $fields can be String or an Array, depends on the definition of this plugin
function prefix_feeds_tamper_plugin_list_prefix_callback($result, $item_key, $element_key, &$field, $settings) {
 
$out = array();
  foreach (
$field as $f) {
   
$out[] = $settings['prefix'].$f;
  }
 
$field = $out;
}
?>

p.s. feeds_tamper-7.x-1.0-beta4

Hong Kong Economic Journal Forum revamp

It has been a while since my last post on this blog
Since we just have this project finished, and slowing moving to maintenance mode
This will be a great time to write something about the porject, before I forget everything

This project's design starting since March 2013, and of course use Drupal7
Content structure is not very complex, frontpage, article detail page, user page and "featured users" page
But as this site accept user generated content, the node edit form also need to be customized and use custom theme
And that form had been simplified for a non-trained user to use

Responsive web design is used on this site
So mobile users will serve a simpler version of the page
But we implemented by a js based responsive, which performance is not very good
There are loading time and executing time lag problems
May be we can share more on this topic later

There is something special about the frontpage, it is categorized by date
The editors and "featured bloggers" will appear on top of the page
and other general users will appear on the bottom part
Unless special circumes, frontpage only shows today's posts
and yesterday's post will be moved to dated page, navigate using the dropdown
And we have created a few views arguments to process this special, "time dependent" page setup
date based frontpage

There are 3 main difficult area on this site: article editorial, data migration and user single sign on

Article editorial
As a normal user can also create article like editors did,
editors need much more authority over the control of the article, and orderings
Everyday there are upper and lower part ordering, and will act accordingly upon special time sensitive events
Second is "admin delete", "author delete" functions
When editor found a off topic, personal attack of a potential danger article, they will hide them
but the creator need to see them marked as deleted, and keep the evidence
The article's original author can do the same to the comments under his article
So the result is we cannot use the "unpublished" state to control these
And we used bunch of flags and draggable views to implement those functions
Flag module provide a reliable API to customize the actions after content flagged
The "report" function is also an extension of flag module
By combining with rules, emails alert can be send to editors

Data migration
As this is a revamp project, the articles can be traced to since 2008
In this five years, the users, articles, comments combined have over 1.2M records
And during the migration process, the forum must be put offline until the process had completed perfectly.
Exporting from old system, import to the new system had spend 9 hours in total
Starting from 6pm in the evening until next day 3am
To ensure the process will not fail in the last minute, we have spend much time developed a module base on the migrate module
Through a maintainable, continuous, reproduciable method, migrate the old content to Drupal
And mapped to the main entity, users, node, comments and files.
I will talk about the details of the module in Drupal camp Taipei 2013 http://2013.drupalcamp.tw/session/83

user single sign on
Last is single sign on
as the old system is based on the same server, user do not have to login separately.
But if we want the same smooth login flow on different sub-domain, the difficulty and complexity is much much higher.
For this purpose we also developed a custom module to handle user integration, so user will not notify the forum and news sites are completely different machine
We will also talk about the coding behind on Drupal camp taipei 2013
and release the ppt here after I come back

Last, let me show you some screencaps
And if you still havent sign up Drupal Camp Taipei 2013, sign up at http://2013.drupalcamp.tw/ immediately!

Snapshot: 

Pages

Google