Meet us every second Tuesday of the month!
Text Size

Building an API with Zinc-REST in Pharo Smalltalk

In this session we are going to build a simple RESTful API using the Zinc-REST package.

The base image is again Moose, now the latest build of Moose 5.1

You may watch part one, part two and part three of this series if you are interested to find out what lead to this point. They are however not needed to be able to follow this session.

A static webapplication hosted on Pharo Smalltalk

For part three of our workshop series we start from scratch, and build a small website that hosts nothing but static files from a memory FileSystem.

We are also going to explore the new development tools that are built in the Moose project

You may watch the first and second parts of this series, or you may jump right in here.

In the next session we are going to build the RESTful API to make this application functional

Building an API with Zinc REST in Pharo Smalltalk

In this session we are going to build a simple RESTful API using the Zinc-REST package.

The base image is again Moose, now the latest build of Moose 5.1

You may watch part one, part two and part three of this series if you are interested to find out what lead to this point. They are however not needed to be able to follow this session.

Osaka, Kyoto and Nara Travel Tips

After more than 10 years I traveled to Japan again. This time I went with my wife to Kyoto, Nara and Osaka. Here are some tips about travelling to these areas I want to share and also serve as notes to myself if I will ever go there again in future, which I will definitely do as Kansai is so beautiful and relaxing.

Keep connected

Getting mobile internet connection was not easy in the past since you need Japan residency to get a SIM from telco, but nowadays the market is more open and there are now many options. In this travel, I used a SIM card called Fuji card (富士卡), which I bought from Taobao at 76 CNY. This card has 1.8GB 3G data, valid for 7 days, but does not have any voice call and cannot be recharged after you have used it up. This card is backed by China Unicom and Softbank, in my experience the data connection and coverage is very good. If you live in Hong Kong, you can find this card in Sham Shui Po as well.

If this card does not suit your purpose, you can find other alternatives:

  1. Fuji card has a cheaper sibling which has 1GB data only, sold at 66 CNY, and a more expensive sibling which has double the data to 3.2GB, sold at 155 CNY.
  2. Before the existence of Fuji card, there was Sakura card (櫻花卡). Sakura card still exists and offers 3GB of data with 7-day validity. From what I read it is slower than Fuji card’s 7.2Mbps and lesser coverage.
  3. There is also a nameless SIM which offers unlimited data. The first 100MB data each day uses 3G speed but afterwards it falls back to 2G speed. It is cheaper but I bet no one want to suffer from slow speed especially during traveling.
  4. If your phone does not support WCDMA or you are not good at fiddling mobile phone settings, you can rent a WIFI router. More expensive, and you have to return it after the trip which I find inconvenient.
  5. So-net also sells pre-paid SIM cards at the airport, at a higher price than the Fuji card.

About Hotel

Valentine’s day is not a good day to travel to Japan not (just) because restaurants are fully booked but room rates could be more expensive than normal days 2 to 3 times, even for budget hotels like Toyoko Inn. I was very lucky that I found a really nice ryokan called Kitanoya (北野家) where the rates remained the same on the special day. Only available at Jalan, so knowing some basic Japanese is a pre-requisite. In general, check Jalan and Airbnb and you might find hidden gems.

Hotel near Kansai Airport

My flight landed almost at midnight so I chose to stay in a hotel close to the airport and began our journey the next day. There are not many options, the hotel at the airport is too expensive so I chose to stay at First Hotel. It is located in Izumisano (泉佐野) and very close to the Izumisano railway station, so you can take a train there, or if it is too late like my case, you can take the late night airport bus, the last stop is exactly the Izumisano railyway station.

The bus station is just outside the exit of the departure hall. After exiting the airport, turn right, look for the stand numbered ’12’. No need to buy ticket beforehand, pay when you take off, so better make sure you have 1000 yen notes or coins, which I did not have. Luckily the bus driver was able to find a lady who had ten 1000 yen notes to change for my 10000 yen note, otherwise I don’t know what would end up.

Travel to/from Kansai Airport/Kyoto

If your destination is either Osaka or Kyoto and your flight will land at the Kansai International airport, you will likely buy the “ICOCA and Haruka” ticket set to take advantage of the Haruka train (non-reserved seat) from airport to Osaka or Kyoto.

In my journey I made a mistake of buying the one-way instead of the round-trip, thinking that I would take the Nankai railway back as many people suggest. Later I found out my hotel actually is closer to Tennoji (天王寺) where there is JR station, so at the end I took the JR Hanwa line rapid train to the airport, that costs 1060 JPY, and in total it is more expensive than the round-trip “ICOCA and Haruka” ticket set.

The ticket set is sold on the 2nd floor of the JR office at Kansai airport, show them the passport when buying.

The railway system in Japan is complicated and could be astounding to new individual travelers, so
do your homework carefully in advance.

Travel in Kyoto

Kyoto is well connected with buses, they are very frequent and can reach all the popular attractions in the city. I took the bus almost exclusively in Kyoto, so I highly recommend buying the one-day bus pass. The pass costs 500 JPY and each bus ride costs 220 JPY, so the pass makes sense if you take more than 3 bus rides, not to mention you free your mind from worrying coins.

There are other passes that let you take subway as well, but since there are only two subway lines in Kyoto, I find bus to be more convenient and so subway passes may not be worth buying.

Travel in Nara

As Nara is not big and most attractions are close to each other, most people go to Nara as a day trip and stay in Osaka or Kyoto at night. For me, I stayed in Osaka and went to Nara in the morning by taking Kintetsu train to Nara Kintetsu station. Kintetsu has discount tickets called Nara-Ikaruga one-day pass (奈良・斑鳩1dayチケット) that offers unlimited bus rides in Nara and round-trip Kintetsu trains from/to Nara. Like Kyoto, you can go to many places just by bus so this ticket is highly recommended.

Depending on which city you buy the ticket, there are additional benefits. As I bought in Osaka, I could also enjoy unlimited rides on bus, subway and new tram in Osaka.

In Osaka, the ticket can be bought at the subway station supervisor office (駅長室), which is surprisingly located after passing the gate, which could be hard to find in maze-like Osaka subway stations.

Travel in Osaka

Osaka has a good subway system that covers most key destinations so getting a one-day pass is a smart choice.

The most basic form of the one-day pass is the Enjoy Eco card, which costs 800 JPY on week days and 600 JPY on weekends and national holidays. It can be bought directly from ticket machines. This card can be used on New Tram and bus as well, and offers discounts to some attractions like Osaka Castle and Floating Garden Observatory.

If you ever come across the Osaka Visitors’ Ticket and wonder what it is, forget it if you do not live in Hong Kong, Taiwan or Korea. It has the same benefits as the Enjoy Eco card, but with a lower price and is only sold in these 3 regions.

There are many other passes, such as Osaka Amazing Pass and Osaka Kaiyu Ticket, see which one suits you best here.

Money Matters

If you buy the “ICOCA and Haruka” ticket set, you will then have the ICOCA e-money card with 1500 JPY in it, which can be used to take trains and subways. But it is not too useful as a means in buying stuffs as many shops do not accept it, except convenient stores like 7-11. In Osaka, I found vending machines accepts PiTaPa rather than ICOCA as well.

Before leaving Japan, ICOCA can be returned at JR office and you can get 500 JPY deposit back. 220 JPY will be charged as handling fee from the remaining amount in your card, so if you have spent all the money in the card then it means no handling fee. If you think you will visit Kansai again in 10 years, you can keep the card and recharge it next time when you come back to Japan.

That’s it! Hope you enjoy Japan and find my tips useful.

neo-noir time!

In its overwhelming kindness and knowlegde, Wikipedia granted me this information: so i have been watching a few of them, starting with the asian media, and a real surprise was “Black Coal, Thin Ice” the acting is superb, the noir mood intense, and the whole setting just beautiful …

quite exited for a few more, but due to the heavyness only one film a week

Serving files through FileSystem in Pharo Smalltalk

In the second part of this series we transform our website to serve all content as files from a FileSystem object.

If you haven't yet, take a look at part 1

In the next session we will serve an actual web-application

Using the FileSystem class in Pharo Smalltalk

I am learning how to build a website with a RESTful API in Pharo Smalltalk. This project started during Google Code-In as a set of tasks for students to work on. A handful of students were interested and picked up tasks to learn Pharo.

Now that Google Code-In is over, the students are interested to continue learning and so i am running workshops with them, where we explore the tools needed to build this server.

The first workshop was held last week on sunday the 25th, and the next one will be on saturday the 31st of Jnauary. from 2pm to 6pm chinese time, that is 7am to 11am CET or 6am to 10am UTC. We will meet on freenode irc in the channels #fossasia and #pharo.

A part of website consists of static files. To simplify development and deployment, we want to serve those files from the smalltalk image. One way to hold several documents inside an image is using a memory FileSystem. The FileSystem class is described in the book "Deep into Pharo" in chapter 3.

In the first workshop we try to use the FileSystem class in a sample application. We use the tutorial "Building and deploying your first web app with Pharo" as a starting point, and adapt the code to store images in a FileSystem object.

If you want to follow along, please first complete the tutorial and then watch the screencast below to continue:

In the next session we will convert the rest of the website to using our FileSystem object.

the community calendar project at google code in

For the community-calendar project in total, 11 tasks were proposed, of which 7 got completed:

Not so much work got done on the code itself, but we now have some documentation of the API as well as the start of a testing framework to help keep the API stable.

As a sideproject, these tasks were designed to explore the ember.js framework. the calendar-widget, going to be embedded into different websites was a good target because we now can offer both versions for embedding.

For ember.js the student, samarjeet wrote about the work in his weblog. An initial comparison: Comparing the community-calendar
Creating Ember Components turned out to be more dificult, and we had to enlist outside help to solve it.
Finally, a deeper comparison of Angular.js vs. Ember.js

This leaves us with 4 tasks that were not worked on

csdn interview

I have been interviewed by CSDN. The interview has been published today in chinese.

The original english answers as i sent them are below:

1. Could you introduce yourself to us first?

I am using and developing Free Software and Open Source for more than 20 years. I am a contributor to the Pike programming language, the Foresight Linux distribution and several other Free Software Projects. I co-edited a book on Pike and organized developer conferences. I am also a mentor at FOSSASIA. Throughout my career I focused on developing and advocating Free Software. I have lived and worked in several countries around our planet Earth. I came to china in 2008. I am currently the CTO at eKita, a startup in Bangkok, and the General Manager at Realsoftservice, a Linux service firm in Beijing where i offer software development, training and internships. I live in Beijing with my family.

2. Compared with your own country, what attracts you most in China or Beijing?

China (and Asia in general) has a different culture from western countries. Learning chinese culture allows me to look at situations from a different perspective.

I believe that all the world should be united into one country. And in order to do that we need to understand the different parts of the world, what everyone can contribute to this world, and what unifies us.

China is a large part of this world, and also not much is known about china outside of it. The only way to learn about china is to be here.

China is also huge. I like to travel, and china allows me to travel long distances to places that are very different from each other without having to cross any borders.

3. What is your role in BLUG? Could you describe the important development milestones of BLUG?

I am acting as the secretary. That means i help to arrange meetings and events for the group.

I joined the BLUG in 2008 and i am not familiar with the history before. One important event before i joined was the 2007 Software Freedom Day which was chosen as the best SFD event for that year.

At the time, when i joined, the BLUG had monthly meetings, frequent quan'r dinners and BLUG Tuesday events. We also had a group aiming to build a quadcopter and a library. Active members were both foreigners and chinese.

In summer 2008 an intern at Exoweb where i worked at the time, together with me initiated a hackaton event called "Coding For Fun". I then continued hosting the event by myself as part of the BLUG. When i left Beijing other BLUG members continued hosting the event.

When I came back to Beijing some active members had left. I took over the management of the group in 2013, when most active members had left. At that time active participation was very low. I continued running the monthly meetings and Coding For Fun events. In Autumn we re-started BLUG Tuesday and used it to test new meeting locations. That way we found our current meeting place.

We slowly regained new active members, most of them chinese.

4. What kind of difficulties have BLUG encountered in the process of development, and how to solve them?

The main difficulty we have is finding good locations for the meeting and Coding For Fun events. It is still an unsolved problem. We don't have sponsors to pay for using locations, so we rely on offers for places we can use for free.

5. What are the daily activities in BLUG? Do you (or BLUG) have any interactions with other communities?

I am trying to visit and keep relations with every group that i can find in Beijing. I am regularly participating at events from the Beijing Open Party, Ruby, Python, Angular.js meetups. Barcamp and more.

Most of these groups have Linux users, but as i am a programmer, many groups are interesting to me personally too.

We also work with other groups to organize events, for example the Software Freedom Day. or we support conferences like and FUDcon or the OpenSUSE summit, all of which had volunteers who are BLUG members.

We also participated at Google Code-In with FOSSASIA.

6. Have you ever attended open source activities in other countries or regions?

What are the differences between other countries and China in Open-source activities?

Every place and every country i have lived in, i participate in the local activities. These vary in size and regularity. In some cases my visit was the motivation for a group to have more meetings. In most groups the meeting involved some form of topic presentation and discussion. But sometimes it was just going out for dinner. Really not much different from china.

7. From your personal point of view, could you share with us some tips on how to manage one open source community successfully?

Well, there are different kinds of communities, for example those that revolve around a particular software project where all members in some form contribute to that software project. The contributions to such projects are often motivated by the contributors own needs. The main goal for community managers is to get active contributors to the project.

Other communities are more loose where people just share a common ideal, but actually may contribute to different projects.

The BLUG is of the latter kind. People contribute to the BLUG more out of a desire to serve the community than out of a personal need. And many do not contribute to the BLUG directly.

The goal of the BLUG is to provide a venue for Free Software contributors and users to share and meet like-minded people. Most Free Software Communities are spread all over the world, whereas groups like the BLUG are very local.

To manage a local group, i believe persistence would be the most important aspect. If the group has meetings, they should be regular, so that new people can easily find out when and where the meetings happen. Then it takes a while for the word to spread, and attendance to grow. Keep holding the meetings, even if only two or three people join. Then keep advertising the group and invite new people. Eventually more will join and come back regularly.

8. Could you introduce us some active and outstanding members in BLUG?

It is difficult to praise the contributions of some people without unjustly leaving out others. Moreover i don't even know all the contributions of every member. Some members don't come to the meeting often but they are very active elsewhere in the Free Software and Open Source Community. This is one of the things that tends to be miss-understood about the Free Software community.

Some people worry if they release their work with a Free Software license, then others can take advantage of it without giving anything back. But we don't know if those users are not active somewhere else making contributions to our society in other ways.

This is after all what i believe is the purpose of our life. All Men have been created to carry forward an ever-advancing civilization. (人人生来是为了推动文明不断进步的)

9. GNU project founder Richard Stallman came to China in May, 2014, did you have a meet with him?

And what do you think about the Free Software campaign leaded by Richard Stallman since 1980th?

I have met richard stallman a few times before, but never had much direct interaction with him. This year he joined us for a BLUG Dinner. As for his campaign, i fully support the idea of Free Software. I believe that all knowledge should be shared, and everyone should have the opportunity to use all of the worlds knowledge in their work. To fulfill the purpose of life we should all use our work to contribute to society. And allowing others to use and modify our software is a great and very easy way of doing that.

10. The last one, could you reveal to us the BLUG's future development plan, and what kind of activity will be organized in the future days?

Future plans of the BLUG depend on its members. For now my goal is to get more active members, people who help to host events, give talks, or help contribute to our website. The BLUG website is very old and in dire need of an upgrade. but it is difficult to do if we want to keep all the data.

I am also trying to work on a community calendar where we can share all events

Education Freedom Day registration launched!


We have just opened Education Freedom Day registration, scheduled on March 21st, 2015. For its second edition EFD has been moved to March to facilitate its celebration in both the south of the planet and China (at least…) and we hope to cater to more events this year.

As usual for all our Freedom celebrations the process is similar, you get together and decide to organize an event, then create a page in our wiki and register your team. As the date approaches you get to put more information in your wiki page (or on your organization website which is linked from the wiki) such as the date and time, the location and what people can expect to see.

Education Freedom Day is really the opportunity to review all the available Free Educational Resources available, how they have improved since last year and what you should start planning to implement to deploy in the coming months. More importantly it is the celebration of what is available and letting people aware of it!

So prepare well and see you all in two months to celebrate Education Freedom Day!

Celebrate EFD with us on March 21, 2015!

30 years of FSF

After an exciting weekend celebrating Hardware Freedom Day what could possibly be better than going back to the very inspiring video made to celebrate the 30th anniversary of the Free Software Foundation? Indeed it’s been made using Free Software only and goes through the work of the foundation for the past thirty years. It’s actually nice to look at, positive and very well animated. We will definitely encourage all our software freedom day teams to use it during their events. But let us say no more and let you enjoy it if you’ve missed it so far:

And then, for the ones into this kind of work, and blender in particular, you can find a detailed explanation of the challenges that the makers of the work went through and how they fixed them right here. Definitely a great read into the whole process from design to finish. Great job guys! And of course a happy 30th anniversary to the FSF from the Digital Freedom Foundation and all its members!

Happy Hardware Freedom Day

hfd-banner2For its third edition Hardware Freedom Day got closer to the holiday season and we hope everyone who took a first step into the world of Open Hardware will use this opportunity to come and meet passionate people who spend their time (or most of it) in hackerspaces or toy with with concept of Free Software and Open Hardware. As usual we have the same strong sponsors as every year such as Google, Canonical, the Free Software Foundation, Linode, all our supporters and the additional support of Lulzbot since 2014 who makes fully Free 3D printers!
So wait no longer and join us to celebrate Hardware Freedom Day in your area!

Google Code In with FOSSASIA

Writable NTFS on Yosemite

Remove osxfuse if installed via homebrew:
brew uninstall osxfuse

Install osxfuse binary and choose to install the MacFUSE compatibility layer

Reboot (optional but recommended by osxfuse)

Install ntfs-3g via homebrew:
brew update && brew install ntfs-3g

Link mount_ntfs:
sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.original
sudo ln -s /usr/local/Cellar/ntfs-3g/2014.2.15/sbin/mount_ntfs /sbin/mount_ntfs


Launch your bootcamp partition under VirtualBox

First, we add your current user account to the operator group and we give the anyone in the operator group read-write access to the raw partition. In my case it's /dev/disk0s4, but it might be different for you; mount the partition with Disk Utility and check the device with the mount command. We use VBoxManage to create vmdk wrapper for just partition 4 and make sure our regular user has access to the generated vmdk files. Add the top-level vmdk to your VM as a AHCI SATA drive; check SSD if applicable.
sudo dseditgroup -o edit -a $(whoami) -t user operator
sudo chmod 660 /dev/disk0s4
sudo echo chmod 660 /dev/disk0s4 > /etc/rc.local
sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename Win8.1-bootcamp.vmdk -partitions 4
sudo chown $(whoami) Win8.1-bootcamp*.vmdk

WPAD on OpenWRT with SSH tunnel

  1. Create your PAC file, for example
    function FindProxyForURL(url, host) {
    if (shExpMatch(host, "*") || host == "") {
    return "PROXY wpad:8888";
    else {
    return "DIRECT";

  2. SCP the PAC file to root@openwrt:/www/wpad.dat

  3. Go to Luci -> Network -> Hostnames and add wpad as an alias for your OpenWRT router's IP

  4. Install the autossh software package through opkg

  5. SSH to the router and edit /etc/config/autossh
    config autossh
    option ssh '-2 -N -o ServerAliveInterval=60 -L -i /root/.ssh/id_rsa'
    option gatetime '0'
    option monitorport '0'
    option poll '600'

  6. Use dropbearkey to create an SSH keypair, save the private key in /root/.ssh/id_rsa

  7. Append the newly created public key to your server's ~/.ssh/authorized_keys

  8. Enable and start the autossh service through Luci

You can test your setup with curl:
curl wpad/wpad.dat
curl --proxy wpad:8888

This will have created an SSH tunnel from your router to your remote server, reconnecting as soon as a disconnect happens. Clients on your network will route traffic through the proxy, as determined by your logic in the PAC file.
Windows clients use WPAD by default, but for OSX clients this has to be explicitly enabled in Network Settings.

Compile kernel module on Linode Debian VPS

Connection to linode hosts from within China can be poor from time to time. Choosing a suitable TCP congestion algorithm may alleviate that from insignificant to a great deal, your mileage may vary. Trying it out is always the best way to find out. Here I will show you how to do that step by step.

  1. Login to your VPS and find out the version of the running kernel

    # uname -a
    Linux jhelom 3.12.6-x86_64-linode36 #2 SMP Mon Jan 13 18:54:10 EST 2014 x86_64 GNU/Linux

    That is 3.12.6.

  2. Go get the 3.12.6 from at
  3. Extract it and copy the kernel config over from the current one.

    # tar xf linux-3.12.6.tar.xz
    # zcat /proc/config.gz > .config
    # make oldconfig
  4. Now, edit .config with an editor such as vi, look for the line CONFIG_TCP_CONG_ADVANCED, remove the line, and add the following lines there:

    # CONFIG_DEFAULT_RENO is not set
  5. Now compile the kernel and the modules.

    # make -j4
    # make modules SUBDIRS=net/ipv4
  6. If everything goes well, you will be able to load the module.

    # sudo insmod net/ipv4/tcp_hybla.ko

    Check with lsmod and make sure the kernel module is loaded successfully. If not, check dmesg for any errors.

That’s it!

learning smalltalk with Google Code In

For years i have been meaning to learn smalltalk. my first exploration started about 10 years ago while teaching two children to make a game with squeak. Then i worked through a tutorial about making a simple game. Unfortunately it didn't capture my interest. So the my attempts to learn smalltalk were stalled as i searched for a project that i could do with it.

Why do i want to learn smalltalk? Because it is the first object-oriented language. Many of the OO concepts were invented in smalltalk. There is also the concept of working in an image that not only contains my code but also a full IDE which is used to update my code at runtime. Updating code at runtime is a concept that has been with me for more than 20 years now, ever since i started programming MUDs in LPC and writing modules for the Spinner/Roxen webserver in Pike. Pike allows recompiling classes at runtime. Any new instances will be made from the new class, while old instances remain as is. If the compilation fails, the class is not replaced and the old class continues to work. This way it is possible to make changes on a live server without restarting and disrupting ongoing requests. A decade later i discovered sTeam, the platform that also drives this very website. It takes this process even further: sTeam persists code and objects in a database. While in Roxen objects live as long as it takes to process a request, in sTeam objects are permanent, much like in a smalltalk image. sTeam then adds the capability to update live objects with new class implementations. The image concept of smalltalk is therefore already very familiar, and the major difference is smalltalk's GUI.

Recently a friend asked me what it would take to build a text search application for the Baha'i writings in chinese. There is one for english and other western languages, but not for chinese, and it does not run on mobile devices. It is also not Free Software, so i can't use it as a base to improve. But i didn't really want to take on a new project either so i just filed the idea for the time being.

One of my customers is managing access to several internal resources through htaccess and htpasswd. Because they have many interns who need to have access to some of these, and because they are now spread over multiple servers, it is becoming more and more cumbersome to manage them manually via these files. It also does not help that a salt module which we could use to help depends on apache helpers, which we can not install because apache conflicts with nginx which we are using. So i started exploring alternatives. One such alternative is a different way for nginx to verify access. It can make a request to an external service which then grants or rejects access depending on the resource and credentials. This could be implemented as a webservice with a webinterface to manage the users. I looked for some existing applications that would get me part of the way but i found nothing suitable.

Enter Google Code-In: FOSSASIA invited the BLUG to join them as mentors.

At first i put up tasks for the community-calendar project, but then i realized that this was an opportunity to explore new ideas. Figuring that teaching is the best way to learn i put up those project ideas as tasks for the students. I could ask students to learn and explore, and finally work on those projects. I would pick the technology and guide the students through a sequence of tasks to acquire the skills needed to implement the actual applications. This was my chance to get back into smalltalk. Since code-In targets middle and highschool students, it is quite unlikely that any of them already know smalltalk, or have even heared about it. so in a way this will introduce a few students to smalltalk. I picked pharo because i feel it is going in the right direction trying to improve itself and also adding things like commandline support.

The desktop application was straight-forward: find out how to embed text-documents in the image and make them searchable.

The web application took more exploration. I wanted to do it with a RESTful api and a javascript frontend. Again, the frontend was easy to define: create a user management interface. For the backend, the question was which webframework to use? AIDA/web has builtin user management and REST style url support by default. Seaside includes a REST module, but both are strong on generating html which i am not interested in. Then there is iliad, which appears more lightweight. Eventually i figured i could just let the students explore each, and i created a task for each tutorial that i could find:

(some of these i repeated because the student who did the them first time didn't pick up the follow-up tasks.)

Finally i discovered that Zinc, the HTTP server used by most frameworks is powerful enough to build a RESTful API without all the templating extras that the above frameworks provide. I also discovered teapot, a microframework that might be useful.

Once the students are familiar with the smalltalk environment, they can move on to the next steps:

Of course there are also tasks for the front-end

Related is also this task about a file editor, which i believe should make it easier to edit static assets like html and css pages from within the image:

leaning smalltalk through Google Code In

For years i have been meaning to learn smalltalk. my first exploration started about 10 years ago while teaching two children to make a game with squeak. Then i worked through a tutorial about making a simple game. Unfortunately it didn't capture my interest. So the my attempts to learn smalltalk were stalled as i searched for a project that i could do with it.

Why do i want to learn smalltalk? Because it is the first object-oriented language. Many of the OO concepts were invented in smalltalk. There is also the concept of working in an image that not only contains my code but also a full IDE which is used to update my code at runtime. Updating code at runtime is a concept that has been with me for more than 20 years now, ever since i started programming MUDs in LPC and writing modules for the Spinner/Roxen webserver.

Recently a friend asked me what it would take to build a text search application for the Baha'i writings in chinese. There is one for english and other western languages, but not for chinese, and it does not run on mobile devices. It is also not Free Software, so i can't use it as a base to improve. But i didn't really want to take on a new project either so i just filed the idea for the time being.

One of my customers is managing access to several internal resources through htaccess and htpasswd. Because they have many interns who need to have access to some of these, and because they are now spread over multiple servers, it is becoming more and more cumbersome to manage them manually via these files. It also does not help that a salt module which we could use to help depends on apache helpers, which we can not install because apache conflicts with nginx which we are using. So i started exploring alternatives. One such alternative is a different way for nginx to verify access. It can make a request to an external service which then grants or rejects access depending on the resource and credentials. This could be implemented as a webservice with a webinterface to manage the users. I looked for some existing applications that would get me part of the way but i found nothing suitable.

Enter Google Code-In: FOSSASIA invited the BLUG to join them as mentors.

At first i put up tasks for the community-calendar project, but then i realized that this was an opportunity to explore new ideas. Figuring that teaching is the best way to learn i put up those project ideas as tasks for the students. I could ask students to learn and explore, and finally work on those projects. I would pick the technology and guide the students through a sequence of tasks to acquire the skills needed to implement the actual applications. This was my chance to get back into smalltalk. Since code-In targets middle and highschool students, it is quite unlikely that any of them already know smalltalk, or have even heared about it. so in a way this will introduce a few students to smalltalk. I picked pharo because i feel it is going in the right direction trying to improve itself and also adding things like commandline support.

The desktop application was straight-forward: find out how to embed text-documents in the image and make them searchable.

The web application took more exploration. I wanted to do it with a RESTful api and a javascript frontend. Again, the frontend was easy to define: create a user management interface. For the backend, the question was which webframework to use? AIDA/web has builtin user management and REST style url support by default. Seaside includes a REST module, but both are strong on generating html which i am not interested in. Then there is iliad, which appears more lightweight. Eventually i figured i could just let the students explore each, and i created a task for each tutorial that i could find:

(some of these i repeated because the student who did the them first time didn't pick up the follow-up tasks.)

Finally i discovered that Zinc, the HTTP server used by most frameworks is powerful enough to build a RESTful API without all the templating extras that the above frameworks provide. I also discovered teapot, a microframework that might be useful.

Once the students are familiar with the smalltalk environment, they can move on to the next steps:

Of course there are also tasks for the front-end

Related is also this task about a file editor, which i believe should make it easier to edit static assets like html and css pages from within the image:

Google Code In with FOSSASIA

FOSSASIA is a mentor organization at Google Code-In, and the Beijing GNU/Linux User Group has been invited to join them as mentors.

Two of us joined and created tasks for our projects.

At first i created tasks for our community-calendar project, but then i took the opportunity to get students to work on new projects that i had been hoping to do. For a long time i wanted to learn smalltalk, but i lacked good project ideas. This changed recently, as a friend asked me about a text search application, and one of my customers needed a better solution than htpasswd to manage users for nginx. I decided that both could be done in smalltalk.

So i created tasks for three new projects: A text search application to run on the desktop, and one on mobile, and a user-management web-application. For the desktop and the web-application i stipulated pharo smalltalk as the implementation platform. For good measure i also threw in my idealist for sup, a reimplementation of the frontend for this weblog in angular.js, a t-shirt design for the BLUG, packaging pike, and exploration of the api. I also proposed a new structure of the files for the fossasia api, and helped mentor a few tasks relating to getting chinese communities added to the api.

  • community-calendar (7 tasks)
  • desktop text search application (2 tasks)
  • mobile text search application (2 tasks)
  • user-management web-application (12 tasks)
  • sup ideas (more than 50 ideas, create tasks as needed)
  • fossasia (1 task)
  • sTeam weblog ui (1 task)
  • blug t-shirt (1 task)
  • amber (2 tasks)
  • file-editor (1 task)
  • packaging pike (1 task)
  • api (3 tasks)
new tasks will be added as needed, when i get another idea for improvements on one of the projects, or if i feel a task needs to be redone.


首先声明:文中观点只是我自己的想法,仅作参考。 经常听到一些商业宣传:“‘开源大潮’已经汹涌而来”,好像大姨妈来了,大家都没准备好卫生巾一样。那么抛开这些商业宣传,开源这个国外舶来品在中国是如何生根发芽的呢?我们不妨稍加整理,将所谓的“开源大潮”切段评判,将其在中国的推进历程,尝试以“断代”的方式分段讲述。这样做,除了可以理清开源引入中国的历程,更可以剖析开源背后的人的作用、利益诉求和其最终目标。 对开源这种“断代式”的分析起源于年初和一位前CSDN同事的头脑风暴,我们赫然发现,开源在中国呈现出高潮和低潮交替的有趣局面,与高潮期的轰轰烈烈相对的,则是低潮期的暗流涌动,可以说同样重要。遂决定尝试对这种历程做一些分析和解读。

中国开源的第一次浪潮 (1999年~2002年)

  • 标志性事件:红旗Linux、蓝点Linux等的发布
  • 高峰特征:筚路蓝缕,开路先锋
  • 低潮期:互联网泡沫,催生低成本和更广阔的互联网需求
1998年,自由软件基金会的Richard Stallman第一次来到中国,在清华大学做了一次演讲。之后,1999年美军空袭中国驻南联盟大使馆,给很多人以极大的刺激,因此催生出中国要有自己的,自主可控的CPU和操作系统的战略决策。随后在政府的“关怀”和指导下,中国自主操作系统开始研制。必然选用了开源的Linux系统,这其中的佼佼者无疑是红旗Linux。从1999年红旗Linux发布第一版到2014年红旗倒掉,长达15年的时间里,红旗Linux为中国开源铺垫了坚实的力量,从应用软件本地化、国产软件标准化、软件开发流程化和国产操作系统政府采购等多个方面作出了卓越的贡献。很多Linux的组件、桌面环境以及文档的早期翻译和中文文档编写大多是红旗员工的贡献,这也为后面中国推广开源积累了大量的技术基础和人才储备。一句话来说,这一时期开源主要发生在政府推动,高校和研究机构中,还属于高层需求,基于民族产业和信息产业的自主可控的诉求。 [caption id="attachment_1096" align="aligncenter" width="300"]孙玉芳,红旗Linux的发起人 孙玉芳,红旗Linux的发起人[/caption] 这一时期,除了红旗Linux还有蓝点Linux等一些公司开发的操作系统,以替代微软Windows为旗号宣传和推广,他们共同的努力给了中国人第一次接触Linux,接触世界开源潮流的机会。但因为当时家里有电脑的人不多,且微软在华的强势推广,因此桌面Linux的推广遇到很大困难。2000年互联网泡沫更加重了这一趋势,因为有政府背景红旗Linux挺住了,但蓝点Linux等民营公司开发的操作系统就慢慢夭折了。而在此漫长的低潮期,从国外IDG引入的LinuxWorld大会丰富了此时的中国开源世界,在暗流涌动中掀起了下一波浪潮……

中国开源的第二次浪潮 (2005年~2006年)

  • 标志性事件:LinuxWorld China的成功举办
  • 高峰特征:商业开源走向前台
  • 低潮期:技术人才储备和社区孕育
事实上,有据可查的LinuxWorld China可以追溯到2000年,到2008年最后一届,连续举办了8年!LinuxWorld China分别在北京、上海和广州发展了大量开源爱好者。这样一次商业展览和交流会为中国开源的商业化发展提供了推进剂,使得Linux的服务器应用、数据库和早期桌面Linux得到了交流和展示的机会,为推动互联网产业、信息科技发展贡献了卓越的力量。其中2006年~2007年的两届LinuxWorld China最为盛大,也最为引人注目。诸如红帽、Novell等国际知名开源企业均参展,并为中国的开源人打开了企业应用的成功案例。同时,国内的红旗Linux、联想等大企业也推出了自己的开源企业级应用。 [caption id="attachment_1097" align="aligncenter" width="300"]LinuxWorld China 2006(图转自ChinaUnix) LinuxWorld China 2006(图转自ChinaUnix)[/caption] 展览归展览,但却为开源的企业级应用打开窗口,刺激了更多企业投身其中,也促发了技术的储备和人才的培养。现在很多鼎鼎大名的行业“高端”人士(有些确实做出过卓越贡献),都是在这一时期吸纳进入开源浪潮的。同时也要看到,因为商业展会只是隔靴搔痒,并没有足够的大众参与,此时对开源的带动作用只能停留在企业层面,重视应用而轻视贡献。因此到2007年和2008年的两届LinuxWorld China呈现颓势,草草收场。

中国开源的第三次浪潮 (2007年~2010年)

  • 标志性事件:王开源在比尔盖茨演讲时举牌“Free Software,Open Source”
  • 高峰特征:桌面操作系统惠及大众,开源社区发展壮大,但质次量多,难以维系,同时具有反商业特性,多种诉求并存,多种理念共进。
  • 低潮期:大潮中社区洗刷,留下精品。少量的社区贡献者产生,优质成员流失严重。社会生活水平下降,关注短期效益。
2007年4月20日上午9点45分左右,比尔盖茨参加北京大学创新活动会议,一男子突然冲到台前高喊:“我们需要开源软件,需要自由!”,并举起手里的纸牌——“Free Software,Open Source”。这位冲上讲台的男子就是王开源,这一天也就成为开源在中国第三次浪潮的发端。是时,王开源正在CSDN筹划开发力求推广自由开源的网站OSDN,后来因此事而不了了之。我曾采访CSDN里仅存不多的几位熟悉他的老员工,大家评价他平日“夸夸其谈”,满嘴“自由”和“开源”,反对微软不知所已,却并无实质成果。这里不管王开源此人如何,他在盖茨北大演讲时的奋然一举,通过新闻媒体曝光和方兴未艾的互联网媒体大肆曝光和炒作,使得开源和自由软件第一次进入普通人的视野,也开启了开源浪潮在中国最宏大的篇章!   [caption id="attachment_1099" align="aligncenter" width="300"]2007年王开源在比尔盖茨北大演讲时举牌 2007年王开源在比尔盖茨北大演讲时举牌[/caption] 从全球范围来看,2008年前后也是开源涌现最为突出的一年,是新成员新社区雨后春笋般产生最多的一年。得益于桌面级Linux越来越成熟(比如Ubuntu、SUSE和红帽),覆盖更多的硬件和PC,再加上客观上计算机的普及度增加,都推进了开源更加深入的传到到普通人的视野中,拓宽了其应用范围。这一时期,随着微软Vista系统的失败,其垄断越来越重,以及病毒和流氓软件的盛行,使得人们更加关注个人隐私、信息安全和自由软件,这为自由开源的世界观和价值观输出创作了难得的机遇。但矫枉过正,此时出现了一些开源反商业的特征出现,过度理想主义和极端思想产生,这在中国也受到波及和影响。与此同时,中国因为举办奥运会而短暂的门户开放,使得大众可以更直接的与世界开源潮流对接,这一时期大量Linux社区(比如各地的Linux用户组)和其他开源技术社区兴起并走向繁盛,比如华蟒社区、Huihu灰狐、Mozest等等具有强大影响力的开源社区步入成熟。与此伴生的还有各种开源相关的会议和展览,此时自由软件日(SFD)的活动在全国各地遍地开花,比如2008年北京的SFD活动和第一届GNOME.Asia就给很多人留下了深刻的会议,这些会议和展览散发的巨大影响力也为开源的普及提供了极强的机会。 这一时期,加入开源社区的成员很多,来自各个阶层各种层面,水平各异价值观差异巨大,其中不乏混入了很多“伸手党”,很多打酱油的,很多期待不劳而获的人。很多这一时期加入的人带有极强的现实利益诉求,或有期待投资-回报的价值观和心态,比如为个人事业或单纯为其中的投机财富,而这批人在这次浪潮中并没有满足,他们还会再次出现,因此我给这批人起个名字叫“零八派”(因为是2008年这一时期加入的嘛)。 此时推广开源追求更多的是用户数量增加,很少提及贡献者,更鲜有核心贡献者出现,当然这也是开源推广的必经之路。因此虽然社区多,人数多,但有能力贡献的人却很难跟上。结果到后期,很多小社区开始瓦解,或者追随商业利益而去,成为商战中的炮灰。而很多社区活动从技术活动转为吃吃喝喝,没什么技术含量,凡此种种这些也就导致大量社区成员流失。从社会宏观角度来看,这一时期房价高企,物价飞涨,贫富差距加大,人民生活水平一年不如一年,人们开始更加关注现实利益和短期效益,对开源这种长线的贡献回报价值体系不再有兴趣。社会矛盾更加突出,社会阶层分化更加严重,人们的诉求从单纯的经济诉求变得多元和复杂,更强调个体自由。自由开源所倡导的自由民主的普世价值观,肯定会影响到参与其中的社区成员,而这也就为后面浪潮的发展埋下了伏笔。

中国开源的第四次浪潮 (2011年~2012年)

  • 标志性事件:(无)
  • 高峰特征:云计算、大数据和移动互联网成为推动开源行业主流,官府推动力减弱。
  • 低潮期:开源硬件大器晚成,开源创业方兴未艾,开源参与者重新洗牌
这第四次浪潮可谓是来得快,去得也快。随着国外云计算、大数据的大举发展,国内也不甘示弱,特别是大公司如阿里巴巴的大举投入,使得开源应用在企业级有了更广阔的天地。这就如同Eric S. Raymond在著名的《大教堂与集市》一文中所预言的那样,互联网的基础架构会首先应用开源软件,而应用级则会稍后引入开源。同时小米、华为、中兴等国产手机制造商的崛起,为移动互联网注入了新的活力,开源的应用软件发展则在此处迸发出来。与此同时,开源商业化应用被更多的人重视和领会,更多的厂商看中了开源开发的特点,并觊觎低成本社区开发所带来的成本降低和效益提升。 [caption id="attachment_1100" align="aligncenter" width="300"]2012年的云计算大会 2012年的云计算大会(图自网络)[/caption] 但因为不得法,这次浪潮退去的却很快,究其原因其实很简单,因为没有调动社区的力量。此时经过第三次浪潮的洗礼,很多大社区分化成一个个小社区,正在进入重新洗牌的时期,影响力和独立性都非常弱,再加上很多开源开发者并不在社区中,游离于社区之外,导致无法组织有效的社区开发。这样就导致像Android和iOS应用开发往往自成一体,无法融入到现成的开源社区中去(因为现实的开源社区太弱了),给人一种无法接续的感觉。企业当然也不傻,发现没有社区支撑开发之后,他们便筹划成立基于产品开发的开源社区,这样在后期,为了运营这样的开发者社区也就催生了一个新的岗位——“开源社区运营”或者叫“开发者关系”。 这一时期的另一个重要特征就是政府在开源领域的影响力,几乎消失殆尽。随着大量盗取开源代码宣称“自主创新”的产品曝光,人们开始反感政府将咸猪手伸向开源领域。而企业选择开源产品也是基于利益考量,政府的推动作用几乎无处可用,此时官方只能通过“核高基”勉强发挥一些影响力。 与高潮期的大企业参与相对的是低潮期的小公司崛起。2011年开始以Arduino为代表的开源硬件,在国内着实火了一把,“创客”一词也走入大众视野,走入CCAV的新闻联播中。北上广深各大城市各个高校纷纷成立创客空间,开源硬件创业似乎成了解决高校毕业生就业问题的一剂良药。事实上,在这次创业大潮中,除了开源硬件,更多的其实是基于开源软件的创业,这尤以前端开发、个人云业务以及平台服务等等为代表,这些创业公司成为了推动开源的中坚力量。

中国开源新浪潮 (2014年~?)

  • 标志性事件:尚未发生
  • 高峰特征:自由开源软件社区的成熟发展并强势回归,成为推动开源在中国发展的中坚力量。
现在,企业已经深刻意识到开源社区的重要性,大力筹建和拉拢亲自己的开源社区,与此同时经过第三次开源浪潮洗礼之后,开源社区经过大浪淘沙,淘汰了大量不合格的社区。其他社区通过自主发展,学会了自治管理,学会了社区的统筹规划,懂得了如何通过社区引导和推进以社区为中心的开源商业模式,在坚持中立性和独立性的同时与多家企业保持良性互动,吸纳多层次会员,成为了开源推动的核心和主力。 以上所说并不是预言,类似的例子其实就在我们周围发生,比如北京Linux用户组和北京Python用户组这样经历大风浪的老社区,还有像Docker.CN这样的新兴开源社区。这将会是一次巨大的潮流冲击,并且将会是不同以往的潮流变化强势来袭。 [caption id="attachment_1101" align="aligncenter" width="300"]北京Linux用户组的线下活动 北京Linux用户组的线下活动[/caption] 总结前面已经发生的四次开源浪潮,不难得出这样一个结论:中国的开源发展遵循从“政府——企业——草根社区”的一种自上而下的发展体系,即首先由政府主导和推动,由企业应用产生利益诉求,再由社区开发去迎合这些利益诉求。而这两年,我与美国、欧洲、韩国、日本、新加坡和台湾香港的一些社区交流后,发现国外往往是自下而上的,也就是由草根社区首先发起和主导,由企业通过利益引导社区开发,政府给与必要的协助。中国这种自上而下的体系有很大弊端,政府层面因为有不受控制的权力,因此可以对企业和社区任意干涉,任意处置;而企业层面,可以利用社区为其商业利益服务,成为企业廉价的研发部,同时企业的开源开发往往只给这个企业自身使用,并不会惠及到其他相关企业(出于竞争考虑),成为这个企业的专属利益输送工具,因此这种开发基本相当于闭源,对整个开源大环境的提升并无益处。这样,中国的开源变为了利益的封闭循环。 如上文所说,草根社区经过第三次浪潮时期的成熟和发展,开源社区成员接受了自由开源软件承载其中的自由民主的普世价值观,不可逆转的会追求独立自主的社区成长,特别是在第三次浪潮时期依然是学生的群体,也就是90后这一批。他们已经意识到民主的前提是自主,开源要想发展,靠“伸手党”是根本不行的,因此要引导社区成员通过公民自治管理开源社区,简单说就是“自己的开源社区自己搞”。再总结了第三次浪潮发生时的种种弊端以后,社区变得更加成熟并引导整个开源环境向着更加健康的良性发展,成为推动开源的一个平台。到此时,开源在中国的发展从自上而下的体系演变成了自下而上的草根突围。正是因为如此,所以我将这次浪潮命名为中国开源新浪潮! 这个过程一定不会顺利,但潮流就是潮流,谁也阻挡不住浩浩汤汤的潮水。同时也要看到,只有开源社区懂得如何利用公民自治管理社区,推动开源平台建设,才可以更好地为自己赢得生存空间。关于这个话题,我将会在下一篇文章中阐释。


  • 国产操作系统的“复辟”
最近两年随着微软XP停服,win8疲软,苹果强势回归,伟光正提出民族复兴的中国梦,这种国产自主操作系统的提法再次甚嚣尘上。而政府也希望通过业已存在的自上而下的体系,影响企业利用开源达成目的。很多带有投机想法的公司便投其所好,为官府鞍前马后的服务,甚至不惜牺牲开源社区的利益。那么现在效果如何呢?呵呵。 [caption id="attachment_1102" align="aligncenter" width="300"]极力推动国产自主操作系统的倪光南院士(图自网络) 极力推动国产自主操作系统的倪光南院士(图自网络)[/caption]
  • “零八派”的“复辟”
前文已述,在2008年左右的第三次浪潮时期,有一批抱有投资-回报思想的人,他们的某些利益诉求在当时没有满足(我命名为“零八派”),多年后看到开源大潮已如此席卷全国,便想利用机会再次试探并满足当时的利益诉求。但是他们的想法和观念还停留在第三次浪潮时期,某些人甚至从2010年到2014年都没有参加社区活动了,他们没有看到现在的浪潮已经是自下而上的不可逆转了。他们还认为社区还像2008年时那样一盘散沙,还认为社区里充斥着“伸手党”,还认为社区是低效和无能的,还认为只有依靠政府和大公司自上而下的引导,社区才有发展空间……云云。 他们基于这些想法,趁着现在新浪潮尚未成型,联合组织起来,希望通过一个强大的靠山,让别人来靠(“靠”字这里取“依靠”之意),可是不要忘了社区已经开始学会自主和自治了,这些人的这些行为只会让成熟的社区发出一声感慨——靠(这个“靠”字的意思请自行揣摩)。


通过这篇文章,我试图将十几年来开源在中国的发展做一个简单的梳理和断代,意图总结其中的规律和必然结果。我发现,开源在中国的发展亦如其他舶来品在朝内的发展一样都是畸形的,变态的。本该自下而上的开源发展历程,在中国就变成了由政府主导,企业操纵,社区没有自主精神的自上而下的模式发展。为何是这样的发展模式,其实原因都能明白,这里就不展开了。 而我想说的是,顺应潮流的发展,还是逆潮流而上,完全取决于每个人自己的选择,毕竟开源的核心是自由,每个人都有自由选择的权利。

[图文教程] 在openSUSE下玩转GPG

关于这个话题最早首先是玛格丽特·苏在微博上贴图求助,同时也让我有兴趣好好去了解了解,特别是当时我又感兴趣于GPG与智能卡的交互。后来我曾在2014年openSUSE.Asia Summit上做过一个workshop,但效果不是很好,很多朋友觉得讲的不够细致,确实,GPG的命令行操作对初学者比较难,上手困难。 后来我就花费了一些时间考察了常用的一些GPG图形前端,最终选定了本文我要介绍的这个软件——Kleopatra。没错,名字就是来源于“埃及艳后”克里奥佩特拉(Cleopatra)。我选定Kleopatra有几个原因,第一是因为它比较简洁明了,容易上手。第二是因为功能丰富,除了常用的GPG/OpenPGP密钥操作以外,还支持x509个人证书等。第三是通用性,Kleopatra可以在包括Linux/BSD/Windows等操作系统上使用,Windows可以通过安装gpg4win来安装Kleopatra,这一点就超过了同样非常强大也非常简洁的GNOME Seahorse和Kgpg。 本文力求简明扼要地讲述如何在openSUSE下玩转GPG(其他Linux发行版、BSD和Windows也可以应用本文所有例子),力求一句话讲明与GPG相关的一些概念和操作,比如常用的加密/解密以及文件和密钥的签名及其校验。关于与电子邮件的结合,我会推荐使用Thunderbird+Engimail的组合,但不会过多详述。


  • PGP (Pretty Good Privacy):可以简单理解为是一种数据加密解密和验证的应用程序。使用散列算法。此软件是闭源商业软件。
  • OpenPGP:这是一种数据加密算法的开放标准,也就是一种加密协议(RFC 4880)。而PGP也是这个标准的实现之一。
  • GnuPG(GPG):是OpenPGP标准的开源实现,使用GPL协议的自由软件。
  • 散列算法(Hashing,哈希算法):可以简单理解为是对一段数据(可能是文件、也可能是流)取其摘要的数学运算方法,这种运算有个特性,就是不可逆性,无法根据已经摘要的数据(即哈希值或散列值)恢复成原数据。常用的散列算法有MD5、SHA-1、SHA-256、SHA-512等等。可以用这种算法来验证数据的一致性,也可为数据生成数字指纹。
  • 非对称加密:先来说“对称加密”,就是在加密和解密过程中使用的是相同的密钥。而非对称加密,就是在加密和解密的过程中使用的是不同的密钥。一个公钥,一个私钥。使用公钥加密,使用私钥解密,因为公钥只是用来加密,甚至可以随处散播。而私钥就必须妥善且私密的保管好,否则就无法解密了。同时私钥还可以用来对文件进行数字签名,也就是对文件或信息生成一个散列值,若文件在传输过程中发生更改,再做散列操作以后,这个值就变了,这样就有了形似古时通信用“封印”的效果。我们常用的非对称加密算法有DSA和RSA等。

安装 Kleopatra

这个软件包一般在kdeim组件包内,有些发行版会单独打包,比如OpenMandriva/Debian/Ubuntu,可以单独安装Kleopatra包。若没有可以从源码编译。 Windows用户可以选择安装gpg4win这个软件,选择下载完整版包含Kleopatra的就行。Mac OS 用户可以安装gpgtool,但只有命令行版。


打开 Kleopatra 之后选择文件—>新建认证,打开新建认证对话框。可以看到有两个大按钮,因为Kleopatra除了支持常用的OpenPGP协议以外,还可以用来生成个人站点x509证书。这里我们选择“创建个人 OpenPGPG 密钥对” 然后填入个人信息。特别注意名字和邮件地址不要填错。注释建议留空。之后我们按“高级设置”按钮,配置更多选项。 在这个高级设置对话框中,我们可以选择生成的算法,保持默认的RSA即可。为了更高的安全性,我们选择4096比特,这是目前gpg支持的最大位数,也是最安全的。另外就是证书有效期(也就是密钥的有效期),这里注意,为了安全起见,也为了防止密钥丢失造成的损失,这里推荐还是为密钥增加有效期,一般三年左右就行。这并不是不可修改的,还可以修改,建议逐年增加。如图所示: 然后选“下一步”。之后会有个确认信息,确认生成的密钥对是否如你所愿,特别注意名称和电子邮件地址不要写错。然后点选“创建密钥”按钮。 在创建密钥的过程中,会要求你输入一个密码,这个密码是个密钥的本地密码,强烈建议设置一个密码,不要为空!假设你的私钥丢失,落入他人之手,因为他没有此密码,也无法使用你的私钥。 密钥被创建以后,可以看到一个密钥的指纹,此指纹是对密钥对进行散列算法得到一个为了便于记忆和识别的编码。这里可以点选生成密钥对的副本,也可以邮件发送证书,目前不建议把证书(这里其实是你的公钥)上传到服务器。 如图所示,绿色阴影所在的密钥就是刚刚生成的密钥对。 双击此密钥可以获得密钥相关的细节。我们可以对其进行修改,修改好之后可以选择上传到密钥服务器,这里只会上传公钥,这样可以有更多人知道你的GPG公钥。之后别人就可以根据你的GPG公钥,给你发送加密信息了。


导出公钥的操作非常简单,只要在主界面上选中预导出的密钥,然后再按上面的“导出证书”按钮,之后就可以把此公钥另存到另一个地方了。也可以把此公钥发送给别人,也可以放到自己的网站供人下载上等等。可以下载我的个人公钥,在我个人网站的右侧栏里可以找到下载我GPG公钥的地方(如下图)。 在预导出的密钥上点右键,还有一个操作是“导出到密钥服务器”,这会将公钥上传到公共的密钥服务器上,这样大家下载起来也就更方便了。特别提醒,导出到服务器的公钥不能修改和删除,请确定你检查没问题了再上传。 若想导出公钥和私钥,可以在预导出的密钥上选右键,选择“导出私密证书”(也就是私钥),之后选择要导出的位置,建议勾选“ASCII形式”可提高一些安全性。这个操作还会把子密钥也一起导出(如果有的话)。 导入操作也很简单,直接点选主界面上的“导入证书”,之后选择你要导入的密钥备份文件即可。 如何导入公共密钥服务器中别人的公钥呢?只需点选在"在服务器上查询证书",在弹出的对话框中搜索你要导入的公钥的名称、电子邮件、指纹、指纹标识(其实就是指纹的最后8位)等。如果是指纹或者指纹标号,需要有“0x”前缀。如下图所示:


加密和的操作大同小异,非常简单。从文件—>加密/签名打开加密对话框,选择要加密的文件。如图所示,我一般会勾选“文本输出(ASCII形式)”,稍微增加一些安全性,也方便后续文本操作(比如拷贝粘贴)。如果你需要加密之后再归档打包也可以勾选相关的归档选项。 然后选择加密用的公钥,选中谁然后点选“添加”按钮,就会加入到下面的列表中。注意,如果你使用收件人的公钥加密,一定要记得把自己的公钥也加进去,否则这个文件你自己无法解密。在这个列表里若只有公钥,则会以正常字体现实,若公钥和私钥都存在,则会显示为粗体。 之后按“下一步”就会提示你加密成功。 可以看到原文件和加密以后的差别。 为文件签名与上面加密操作几乎一样,这里不再重复,但在最会一步会让你输入私钥的密码,也就是刚才我们创建密钥对的时候设置的密码。 签名以后的签名文件test.asc是下图这样。毕竟只是原文的散列,也就是原文的摘要,所以会显得很少。 如果要解密文件,则从文件—>解密/验证打开解密和验证对话框,选择要解密的文件,并选择要把解密以后的文件存放在何处。 验证文件签名,需要原文件和该文件的签名文件,本例是test文件及test.asc文件。这样才能进行验证。从文件—>解密/验证打开解密和验证对话框,选择要验证的文件签名和文件。直接选下一步即可。结果会直接显现。


除了上述所有这些,还可以给别人的GPG公钥签名,这样的好处对别人进行认证,以帮助其增加信誉度。一个人被人签名越多,其自身的信誉也就水涨船高。 我们可以先导入某人的GPG公钥,用上面的方法。然后在他的公钥上点右键,选择“认证证书”。第一步要求你选择要认证的用户编号,如果某人有多个用户编号,根据情况勾选。然后别忘了勾选最下面的“我已验证此指纹”。这里要注意,为了防止某人骗取你的签名,需要做一些基本的验证:其一他的用户编号,也就是UID是不是他本人所掌握的邮件地址,只认证可信的用户编号。其二,让他提供给你一份全部长度的密钥指纹,至少16位,并仔细核对。其三,当面签署,最好能验证其身份证上的信息与用户标号(UID)一致。 之后第二步,选择你的私钥,如果你有两个或两个以上私钥时,注意不要看错。下面选择签名方式,一种是本地签名,一种是可导出的签名。这里选择第二种——认证所有可查看证书的人。可以勾选“稍候将认证的证书发送到服务器”,也可以不选,如果不选,就需要再为他做一步“导出到服务器”操作。 因为需要用你的私钥来签名,因此会要求你输入密码。之后认证成功会有一个提示,可以看到最终结果。 可以双击那个你签名的公钥,转到"用户编号和证书"选项卡,就可以看到我给此公钥新添加的签名了。


Kleopatra与电子邮件的结合不够好,若需要解密电子邮件,可能需要客户端先把邮件导出,然后再使用Kleopatra来处理。对于加密和签名,我们虽然可以把加密和签名的内容拷贝到正文里,不过毕竟这不太方便。所以各个邮件客户端都有与OpenPGP的结合,比如GNOME下的Evolution就可以很方便的直接与OpenPGP结合,相应的KDE下的Kmail搭配Kpgp也是同样的功能。 不过从跨平台通用性考虑可以使用 Thunderbird + Enigmail。网上这类文章很多了,这里不再赘述。特别要说明的是,Engimail可以完成上面所说的所有功能,但其生成密钥的方法略有点复杂,选项比较多,不利于初学者快速掌握。此文很不错,可以做参考 最后,Kleopatra的功能是非常强大的,除本文所介绍之外,还可以检查文件的校验和等等。可以说是一款不可多得的个人加密工具前端。我花了点之间,录制了一段操作视频,解释了一下以上各操作。 墙内镜像(非高清):

[传单中译] 免受电子邮件监控的自我防御之术

之前层翻译过 FSF 的有关GnuPG 的信息图。可以看这里。 最近又发现了 FSFE 也就是 FSF的欧洲分部又基于此做了一张传单,于是我也将其翻译了,我是基于其英文版改的。 下载中译:PDF(831KB)  源文件(2.4MB)

TIL tac


Concatenate and write files in reverse, copies each FILE ( - means standard input), or standard input if none are given, to standard output, reversing the records (lines by default) in each file separately.

OSX doesn't have tac out of the box, but add the following line to your .bash_profile and you're good to go:
alias tac='tail -r'


Q1. 开源的目的是什么?大家积极推广开源的目的是什么? 你个人的看法是什么,你认为在开源群体别人的看法又是什么。开源的目的是技术创新,还是追求自由民主?  先来说开源的目的。从最初GNU和自由软件开始,源码开放的目的就是一种保障自由的手段,保障软件的用户、开发者处在平等的地位上。而最近几年开源的目的依旧没变,技术创新和反对大公司垄断是随开源伴生的副作用,包括开源降低了开发成本等等,这些都是副作用,而这些副作用的产生的本源,是因为用户和开发者处于平等的地位,没有阶级差别而产生的。这是我的理解。而其他人的理解还是比较多元的,有的人认为开源可以学到东西,有人认为开源的目的是因为大势所趋,还有人认为开源的目的是为了引来更多的贡献,为自己服务。云云。 从我个人的理解来看,开源的直接目的既不是技术创新,也不是追求自由民主,而是平权和协作。具体到开源社区中,有一个大家都认同的运行规则就是“自由和贡献相对等原则”。什么意思呢?也就是你要想在开源社区中获得额外的权利和权力,也就是除去开源本身所赋予的源码权利之外的其他权利和权力,比如社区领导人的参与权和表决权,源代码的决策权,人员任免权、提交到主流代码仓库(比如Git)的权利,或者使用特定域名的邮件转发服务、Jabber服务等等。要想获得如上这些权力,就需要与之相对等的贡献,贡献越多获得的权力也就越大。比如GNOME基金会的董事,是由GNOME基金会成员匿名投票选出,而要想获得投票权必须是GNOME基金会成员,成为基金会成员则必须具有一定的贡献(代码贡献、宣传贡献、金钱贡献均可),并被至少两名其他基金会成员提名。这里就体现了贡献和自由(也就是权力)的对等原则。也就是所有人都有平等的地位,平等的机会,要想获得更大的权力,就必须要付出相应的贡献。开源社区保障了这种基本原则得以顺利实施,同时开源这件事又可以保障软件开发活动的协作更加稳健和顺畅。 而那些反对大公司垄断的成功案例,则成为宣扬开源万能论的“元叙述“(meta-narration),说到底,反垄断不就是将大家都放到同样平等的地位上吗,所有人对开源的贡献是唯一变量,而不是你有多少钱,有多少背景或资历。 也正是因为有了这样的特性,所以开源社区是去中心化的,是平面的一个团体。而去中心化的思想核心来自于美国TMRC早期黑客的黑客伦理。下面这段话摘自Steven Levy的《黑客:计算机革命的英雄》
伦理原则强调"共享、开放、分散、为操纵机器不惜任何代价",与PC文化与互联网文化的精神内核一脉相承 1. 对计算机的访问(以及任何可能帮助你认识我们这个世界的事物)应该是不受限制的 2. 完全的任何人都有动手尝试的权利! 3. 所有的信息都应该可以自由获取。 4. 不迷信权威——促进分权 5. 评判黑客的标准应该是他们的技术,而不是那些没有实际用途的指标,比如学位、年龄、种族或职位。 6.你可以在计算机上创造出艺术与美。 7. 计算机技术可以让你的生活更美好。
另外还推荐一本书《黑客伦理与信息时代精神》。 Q2. 大公司在开源生态中究竟处于一个什么样的角色?你对它们参与到开源当中是什么样一个态度?当开源参与人群当中,个人爱好者越来越少(不确定的判断哈)、公司的代言人越来越多的话,这意味着什么?会不会跟开源最初的诉求背道而驰? 大公司在开源生态中的角色有两类:一类是金钱提供者,也就是赞助商,带有一定的慈善行为,比如Google每年都会划拨专项资金投入给开源的会议、项目或者基金会,他们既是开源的用户和受益者,利用开源开展了自己的业务,同时将钱投入到开源项目或者基金会中,以更好地推进这项事业。另一类是参与者,比如红帽、Inter和IBM等,他们既参与到开源中,贡献代码,同时也受益于此。 我对大公司参与开源的态度是谨慎的欢迎。无论是那种方式加入到开源中,都不能影响开源社区的中立和平等原则,都不能影响开源产品的最终走向,否则公司将会把一个社区拖死,社区也将成为公司的廉价劳动力,成为公司的奴仆。 举个例子,还比如GNOME基金会的董事,总共是7个人。虽然红帽对GNOME项目的影响最大,但在董事选举时有个强制规定,最多只能有2名来自同一家公司的成员,这样就限制了如红帽这样的大公司对GNOME基金会项目的影响力。 还比如Oracle收购了SUN公司以后,因为认为OpenSolaris没有商业价值,决定将这个开源产品撤销,社区也被迫解散。虽然OpenSolaris里大多数都不是SUN的员工,但因为这个产品是Solaris的开源版,受SUN的影响和控制巨大,最后就成为了整件收购事件的炮灰。 Q3.从开源组织形态上来讲,一直大家喜欢说的是开源当中所倡导的是从下而上的组织形式。但由于一些参与者混杂着个人爱好和公司代言人的双重身份,所以在开源组织和开源社区活动的组织方面,其实还是可以看得到公司的潜在影响。若是公司的影响很大的话,是否与“从下而上”的这种开源组织文化是相悖的? 自下而上的组织形式,其实是对去中心化的一种形式上的说法。通过上面GNOME基金会选举的例子就可以很明确的讲明什么是自下而上的组织形式。对于普通人而言,自下而上意味着通过自己的贡献不断提升在社区中的地位,获得更大的权力和话语权,也就是影响力。这个过程无人可以替代,也无人可以例外。 大公司加进去的好处是加快了贡献的进度和获取地位的进度,说到底是因为其贡献的多自然地位上升的也就快。一个成熟的开源社区,应该理性的思辩并将大公司的影响降至与其贡献等同的地位,同时通过契约保持社区的中立性和独立性。 上面OpenSolaris的例子就可以很好的证明这一点,而为了避免这些问题,国外的开源项目社区往往通过成立基金会的方式来规避大公司的超强影响力,保持社区的独立性和中立性。由于在中国成立基金会等这些NGO组织非常非常麻烦以致几乎不可能,这也就为保持这种社区特性留下了一定困难,不过我相信通过明确的契约和规范,这也不是不可能达到的。 Q4. 想问问你对技术的看法、态度是怎样?或者说,技术观念是什么?技术是工具,还是技术本身就包含理想?技术若是工具,那么大家运用技术工具想要达到的是什么?(又回到了第一个问题。) 我认为技术就是工具,不包含理想。比如原始人用火,就是为了取暖和烹饪,而由烹饪而产生的厨艺和饮食文化则是伴生用火这项技术产生的。还比如核技术,既是毁灭一切,又可以造福人类,而为了规避核技术的毁灭特性,以及由此伴生的核讹诈和欺骗,因此制定了《核不扩散条约》。 任何技术应该能为人类整体带来福祉,如果它只能带来毁灭,我想人类社会是无法接受的。火既可以用来烹饪,也可以纵火烧毁房屋,斧头既可以用来砍伐和切割,也可以用来杀人,核技术也是如此。也就是对一项技术的限制和控制与使用它的人有很大关系,因此技术最终是与使用者自身素质有很大关系的。 计算机技术也是如此,黑客伦理的最后一条“计算机技术可以让你的生活更美好”说的就是这个道理,人们应该通过提高自身素质让计算机技术为整个人类社会谋福祉,服务于全体,而不是为某个小圈子,某个利益集团,甚至为某个人的私利。 Q5. 对开源中商业的进入,你秉持一个什么样的态度? 开源并不排斥商业,但是开源当中最让人赞叹的最早是业余爱好者的无偿付出,但现在开源界感觉还是很混杂的感觉,商业或公司力量的无孔不入会不会破坏原有的文化? 这就谈到什么是开源文化。我认为,开源文化是基于黑客伦理的一个延伸,可以说是黑客文化的现实载体,更融合了中立性和独立性的自身特性。 大公司的加入当然是好事,但我本人对其依旧秉持谨慎的欢迎态度。因为公司毕竟是逐利的,其对开源的投入具有选择性,比如微软2011年大量贡献Linux内核代码,几乎只贡献给了Hyper-V虚拟化相关,因为这是其云平台Azure的底层架构所必需的。而2012年和2013年在Linux内核代码的贡献列表里微软再也没有进入top10的行列。同样的道理,有些公司对某项技术很感兴趣,投入巨大,比如大数据相关的Hadoop最近两年飞速发展;与此同时,之前被Intel等大公司看中并发起的Meego项目却最终夭折,被Tizen替代。 所以公司投入开源的逐利特性决定了一个开源项目或者一个开源社区的走向,其话语权和决定权也对整体发展起决定作用。也正是因为如此,更应该通过手段、契约来限制公司的话语权,避免对开源社区产生不利的影响,总之开源社区要自觉、自决而不要自掘。 Q6. 你认为“社区精神”是什么?“社区精神”在开源文化中处于一个什么地位? 社区精神其实正是上面说的黑客伦理,换个提法而已。简单说就是自由、共享、开放、分权和协作共进。 社区精神在开源文化中处在非常重要的核心地位,可以说正是因为有了独立自主的社区精神,现在的开原世界才能如此丰富多彩,才能如此蓬勃向上。

Software Freedom Day 2014 Phnom Penh

The Digital Freedom Foundation is organizing our Software Freedom Day event in Phnom Penh together with the National Institute of Posts Telecommunications and ICT and the Ministry of Posts and Telecommunications on November 1st at the NIPTICT Building. There will be 14 talks (9 in Khmer and 5 in English) with topics covering free and open source software ranging from operating system, learning platforms, website development, resource map, servers, to security. Here is the detailed schedule and speakers profiles.

We expect to have more than a hundred people to attend and aim to target both the university audience and the young workforce, on top of presentations and workshops, we (assisted by various communities) will be holding booths (e.g. Moodle, Mozilla, RouterOS, Ubuntu and Blender) to allow for more individuals discussions. All in all it’s been a joy preparing for this event, allowing us to talk and plan resources with people from different local communities such as OpenSourceCambodia and Smallworld Cambodia.

The event will start at 1:30pm tomorrow, if you happen to be in Phnom Penh please do drop by!



今天是2014年10月31日,是西方的万圣节。1998年的10月,Eric Raymond披露了微软内部大量针对开源和Linux预备策略的备忘录,披露微软为了阻止消费者选择开源产品,市场人员可对消费者使用惧、惑、疑(即FUD)的手段。这份文件就是著名的万圣节文件。今年是微软“万圣节文件”曝光0x10周年。 开源社区中,有一个大家都认同的运行规则就是“自由和贡献相对等原则”。什么意思呢?也就是你要想在开源社区中获得额外的权利和权力,也就是除去开源本身所赋予的源码权利之外的其他权利和权力,比如社区领导人的参与权和表决权,源代码的决策权,人员任免权、提交到主流代码仓库(比如Git)的权利,或者使用特定域名的邮件转发服务、Jabber服务等等。要想获得如上这些权力,就需要与之相对等的贡献,贡献越多获得的权力也就越大。比如GNOME基金会的董事,是由GNOME基金会成员匿名投票选出,而要想获得投票权必须是GNOME基金会成员,成为基金会成员则必须具有一定的贡献(代码贡献、宣传贡献、金钱贡献均可),并被至少两名其他基金会成员提名。这里就体现了贡献和自由(也就是权力)的对等原则。也就是所有人都有平等的地位,平等的机会,要想获得更大的权力,就必须要付出相应的贡献。开源社区保障了这种基本原则得以顺利实施,同时开源这件事又可以保障软件开发活动的协作更加稳健和顺畅。 “开源社”最早的想法是成立中国开源基金会,通过资金运作鼓励和奖励一些优秀的国内开源项目。但因为中国成立基金会是需要民政部等多部门批准的,还有其他多种入门限制,因此这就导致无法创办这种NGO组织。最终退而求其次,微软OpenTech主导希望成立一个联盟组织,联合国内公司成立这样一个组织,先从翻译国外文章开始,进行开源教育,然后再在适合的时机推行基金会计划。 当然其初衷和设想是好的,几个初创成员却各怀鬼胎,将自己的商业利益绑架进来,他们一直在满口说希望大家贡献到开源中来,却不提自己的贡献,既不提曾经的贡献,也不提即将做的贡献,不提他们能为开源社的后进成员提供什么帮助和保障,更无法提出能为整个开源生态做出什么贡献。而且还会私下签订合同和密约,这种合约的内容为何不公开出来呢?因为商业合同才是需要保密的。 再来说,他们要做的事情,无论是所谓开源之星,还是开源大使等等,这都存在一个认证的问题,也就是如何认定某个项目是“开源之星”某人可以成为“开源大使”,这些认证是由他们认证的,某个隐藏在暗角里的“组委会”说了算,既不公开也不透明。这里还有个问题,他们有何德何能来认证一个人或者一个社区对开源的贡献?他们有过什么贡献来取得这个组委会资质的呢?也就是这个认证委员会的合法性问题,这就打破了上面所说的平等的地位和平衡的权力框架。也就是对于后加入的社区/个人/组织来说,完全没有了可能与初创成员有平等的地位。 那么问题来了,如果换成基金会呢,也是做同样的工作,是不是也是一样的?这就和基金会的定位有关了,如果是个中立的基金会,大公司是作为赞助商出现的,为了保证基金会的中立性会制定公开的契约,从契约上保证了公司对基金会的权力和义务。而认证的委员会也应该是由社区和公司共同推举产生,通过契约赋予其认证的权力,保障这个基金会是增加整个开源生态福祉。无论是Linux基金会,Apache基金会还是GNOME基金会,大公司在其中的作用、权力等都有明文限制,同时任何一种评选、认证和发布都有明确公开的方案、形式和规划以及流程,甚至连不是基金会的Google策划的Google Summer of Code都有非常明确而公开的流程方式等等。同时由于中立性和平等的地位,无论是先加入还是后加入,大家的权利地位是一致的,委员会是由基金会成员推举而出,并定期换届,他们要对其下所有成员负责,因此从客观上也保持了其中立性,而成员也看到通过贡献可以获得委员会的权力,因此会更大的积极性做出贡献,进而推动整个开源生态福祉的增加。 因此现在的“开源社”,既缺乏平权的公开契约,又没有平等的地位,更没有具有合法性的所谓认证委员会。现在他们做的所有这些都有一种高高在上的权威感和优越感,一种“嗟!来食!”的傲慢之气!所有这些显然是为其商业利益服务的,很多明眼人一看就明白是微软希望继续统领IT产业,争当盟主霸权的例证。微软,一个在从比尔盖茨开始就与开源为敌的公司,一个可以产出“万圣节文件”且至今没有解决这个问题的公司,怎么可能真的诚心发展开源?!虽然纳德拉当上新CEO,但显然其“爱Linux”也是出于赚钱和商业的需要,而说到底微软成立OpenTech就是想通过开源手段推广其Azure云平台而已,无论包裹了多么绚丽的外衣,其垄断嗜血本性依旧未改。 所以对微软来说,要想在开源界有个立足之地,请先多多做一些贡献吧,不要想着怎么空手套白狼。贡献和自由是对等的,与权力是也是对等的,想争取更多的权力就要做出更多的无私的贡献,而不是为自己服务(比如他们在2011年给Linux内核贡献代码,几乎全都是Hyper-V虚拟化的代码,因为这是Azure的底层架构所需)。总之一句话:但行好事,莫问前程! 目前加入的这些成员大多是与初创成员之间有裙带关系或个人关系,通过面子加入,我猜想很大一部分并不是真的看中其多么宏大的愿景,也不过是看中其可以带来的实际利益罢了,不是所谓的什么为中国开源贡献。其实,一个愿景越是宏大,其实现的可能就越低,而为了保证继续吹嘘这个愿景,继续维持这个虚幻的景象,就只能依靠——谎言。就如同纳粹德国和前苏联斯大林对其人民所做的那些一样。 简言之,开源社是以微软为首的几个初创成员借开源之名的市场行为,是一个商业利益联盟,是一个主要利益流向特定利益集团的逐利计划。并不是无差别的覆盖开源社区,也不能最终为整个开源生态带来福祉。也许这个过程中会有一些好的副作用产生,但远远无法掩盖其真实的目的。更不能真的推动开源在中国的发展。

11月4日 UPDATE:

关于此问题的其他回复,请见这个知乎问题: 有朋友看完文章已后,特别是对“开源社”的问题提出了两个见解:1. 现在的国情,需要有这么一个领导角色,统领中国的开源进程。2.这是微软为了进入政府采购而出的一步棋。 我先回答第二个问题:这是微软为了进入政府采购而出的一步棋。因为这个事情没有定论,看不出其明显动向,不能下这个结论,所以不能说微软被赶出政府采购而寄希望于用这么一个方法来重回。 关于第一个问题,现在的国情,需要有这么一个领导角色,统领中国的开源进程。其实有这样思维观念的人很多,甚至是社区里经验丰富的老人,也有这种思想!这就如同“需要一个领导,来带领中国革命”的红色恐怖表述一样,在我之前的几篇博文已经提出过,中国的开源社区发展之所以不行,很大程度是因为缺少公民自治能力。而公民自治能力需要两个前提,一是法治和契约精神,二是主人翁意识负责任态度。法治和契约精神这需要自上而下慢慢来,但个人主人翁负责任的态度和想法却需要每个人不断自我提高,这就如同台湾零时政府)里说的“不要问‘为什么没有人做这做那’,首先要承认你就是‘没有人’”,我狠欣赏这句话的说法。期待明君圣主是中国人的劣根性之一,是不愿意对公共事务承担义务,“事不关己高高挂起”的冷漠,最终拱手将自己应该承担的义务和权利让渡给了一个组织。自己负起责任,自己组织和领导自己的社区,这才是应该学着做起来的,不要将希望寄托在某个人或者某个组织身上,不要将自己应尽的义务和相应的权利让渡给这个人或组织。若每个人都这么做,那么这个人或组织将会变得超乎想象的集权,并最终成为一个垄断集团,独裁一切,而最终这个苦果也要大家起来吞! 所以,放弃明君圣主的寄望吧,该踏踏实实回到现实中了,应该让每个社区成员都需要负起自己的责任,参加到开源的活动中来,贡献到开源中来,并最终推举(或选举)出一个领导者或者组织机构,自己的开源社区自己领导,最终按照这种去中心化的开源模式,组建起来的一定会是一个真正的开源社区联盟!

11月11日 UPDATE:

前几天清华网管协会(TUNA)的bigeagle_xd披露“开源社”骚扰其社团邮件列表一事,并发表多篇微博斥责“开源社”的行为,以及他对此问题的见解。 据我了解,目前“开源社”通过其手中联系方式向很多国内开源社区发出了邀请。目前已知Fedora中文社区的负责人已经拒绝加入,openSUSE虽未表态,但SUSE官方基本确定不加入,openSUSE在华其实没有具体本地社区。还有北京Linux用户组(BLUG)的核心成员也决定不加入,并在官微上发布声明

How to include local packages for pbuilder

The ibus-cangjie suite consists of 3 source packages: libcangjie, pycangjie and ibus-cangjie, pycangjie depends on libcangjie and ibus-cangjie depends on the other two. When you use pbuilder or its wrappers (I mainly use pbuilder-dist) to build pycangjie or ibus-cangjie, you have to make sure the depended packages are in the pbuilder chroot somehow otherwise the build will fail.

I used to build the package in the lowest level first, in this case libcangjie, then login to the pbuilder chroot with the --save-after-login argument and manually copy the built packages to where the chroot is mounted, run dpkg to install the packages, then exit the chroot. Now libcangjie is installed the chroot and so the build dependencies of pycangjie can be satisfied. This is simple, but requires quite a lot of typing.

There is a simpler way. As pbuilder puts all its built packages in a single directory, we can make the chroot use it as an apt source.

Assume packages built by your pbuilder is located in /home/ubuntu/pbuilder/sid_result, and pbuilder hooks are stored in /var/cache/pbuilder/hook.d. Now, update your .pbuilderrc like this:

# cat ~/.pbuilderrc 

Then put a new hook script to generate a Packages file:

# cat /var/cache/pbuilder/hook.d/D70results 
cd /home/ubuntu/pbuilder/sid_result
/usr/bin/dpkg-scanpackages . /dev/null > /home/ubuntu/pbuilder/sid_result/Packages
/usr/bin/apt-get update

To verify it is set up correctly, login to the pbuilder chroot with the --override-config and --othermirror arguments and check if /etc/apt/sources.list is updated, OTHERMIRROR parameter in .pbuilderrc does not work for me so I can only use --othermirror, not nice as you need to supply it every time you run pbuilder:

# pbuilder-dist testing login --override-config --othermirror "deb [trusted=yes] file:///home/ubuntu/pbuilder/sid_result ./"

# grep -r home /etc/apt
/etc/apt/sources.list:deb [trusted=yes] file:///home/ubuntu/pbuilder/sid_result ./

If everything goes well, build your package with the --override-config and --othermirror arguments like what you just did for the login operation:

# pbuilder-dist testing build --override-config --othermirror "deb [trusted=yes] file:///home/ubuntu/pbuilder/sid_result ./" <.dsc-file>

Behold, the Sofa Car

Or click here if that doesn't work. The piece about the sofa car starts at 2:30 in.

Single-page ansible module documentation

A friend introduced me to Ansible recently and since then I've been spending a lot of time on writing playbooks. (Time which was perhaps better spent on Docker, but for now Ansible is my #shinynewthing.)

Unfortunately I find the Ansible online docs lacking, especially given the amount of info available in `ansible-doc` command line tool.

So, for all those Ansible lovers, here's a single page file with all of Ansible's modules and attributes:

This file was created as such (with a little post-processing*):
$ ansible-doc -l | cut -d ' ' -f 1 | xargs -n1 ansible-doc -s >>ansible.yml

* :%s/^\([^'#]\+\)'\([^#]*\)/\1`\2/g


早年做嵌入式培训的时候,就开始关注如何使用简单的轻文本标记语言编写教程和其他技术文档,最早使用的是Docbook和Latex,但还不够轻量级。虽然当时Markdown刚刚在github上大规模使用,但因为其不容易导出成易于出版pdf而没有选用。后来又接触了一些其他技术方案,最终选定了 MultiMarkdown + Latex 的方式。 从需求上看,我主要需要最终的PDF版本,如果能有 epub/mobi 更好。而且这些文档都是中文编写的,一个很重要的考察点就是中文支持。


Pandoc 和 MultiMarkdown 都非常有效的扩展了原生 Markdown 的一些语法特征,带来了诸如表格、代码段高亮、图表、尾注等等非常好的支持。特别是MultiMarkdown大大扩展了Markdown的语法,甚至可以排版非常专业的技术书籍,可以看这份语法说明。同时 Pandoc 和 MultiMarkdown 支持很多输出格式,除了 HTML 还支持 Docbook、pdf、epub、opml、segl等等,可以放到移动端和各种设备上,可谓一次编写,多平台共用。
  • pandoc + latex:这是目前比较常见的,优点是 Pandoc 支持的格式超多(htmldocbookpdfepubmobi...),而且也超级强大,能够解决的问题也比较完美,著名的《Pro Git》就是使用的这个方案。若想导出 pdf 需要 Latex 的支持。Pandoc因为使用的是 Haskell 其速度很快,不需要什么太多依赖,大多数Linux发行版都已经支持,搜索软件包pandaoc试试就行。
  • MultiMarkdown + latex:与上面的 Pandoc 一样,MultiMarkdown也是比较知名的一种,优点是用C语言编写,速度超快。缺点是支持的格式少,但命令行脚本比较简单,还是很方便的。同样的,导出 pdf 需要 Latex 的支持。
  • gitbook:很多崇尚 Mac 的人喜欢Gitbook,简单粗暴。优点是确实简单,而且支持的格式也多(pdfepubmobi)缺点是在 Linux 下保存中文 pdf 有些问题,修改格式和个性化不容易。另外依赖 Node.js。
  • HTML另存为pdf:这个做法挺有意思,利用 Chrome 浏览器的打印成 pdf 功能,直接将 HTML 网页转出 Pdf。优点是简单方便,缺点是只支持单页 HTML,方法有点太山寨。
项目 pandoc MultiMarkdown Gitbook HTML打印Pdf
中文支持 依赖 Latex 依赖 Latex 在Linux下不行 没问题
格式支持 pdfepubmobidocbookslider pdfopml,epub需要用其他脚本 pdfepubmobi 只有pdf
跨平台性 依赖 Haskell 全平台 依赖 Node.js 全平台
美观及定制化 完全自由定制 非常美观,某些Latex格式内置 定制不方便 依赖HTML源文件的CSS,效果难料
扩展Markdown 比较符合文档要求 更符合书籍要求 符合文档要求 依赖生成 HTML 的工具
多人协作 与 Git 结合 与 Git 结合 与 Github 结合 也可以与 Git 结合
技术难度 比较复杂 比较复杂 比较简单 非常简单


为了能导出成pdf,需要Latex的支持,而为了支持中文pdf,还需要CJK包和相关字体等。 我用的是 Debian Testing(Jessie),整个配置过程还是挺顺利的,可以直接执行如下命令: [code language="shell"]sudo apt-get install texlive-xetex sudo apt-get install texlive-xetex sudo apt-get install texlive-latex-recommended # main packages sudo apt-get install texlive-latex-extra # package titlesec sudo apt-get install ttf-arphic-gbsn00lp ttf-arphic-ukai # from arphic sudo apt-get install ttf-wqy-microhei ttf-wqy-zenhei # from WenQuanYi sudo apt-get install texlive-fonts-recommended sudo apt-get install latex-cjk-all [/code] 可以非常方便的把需要的包都安装好,整个安装过程比较长,费时也费空间,大概需要1.2GB左右才能把这些latex包全都装好。 之后就是获取MultiMarkdown,目前MultiMarkdown是4.0版本,完全用C重构,速度很快。但是在主流的Linux环境下都没有为其打包,而且这个项目比较复杂,还有一些不确定的依赖,对打包来说困难不小。 至于如何安装MultiMarkdown,就比较简单了,过程如下: [code language="shell"]git clone git:// cd multimarkdown-4 git submodule init git submodule update make sudo make install [/code] 剩下的问题就简单了,我修改了larrycaiyu的sdcamp项目之后稍微做一些微调,便有了gnome3-app-book项目,这将会是一次多人协作来完成的写作过程。我将原先的mmdbok脚本改成了 Makefile 这样只要直接在命令行下执行 make 就万事大吉了。


首先是这个方案毕竟严重依赖 Latex,而目前来看离开latex实现pdf的输出还没有太好的方案。这是一个大问题,因此本机需要大量资源消耗在Latex环境就是个较大的问题,而Latex超复杂的语法造成的高入门门槛也是个巨大的绕不开的问题。 除此之外,MultiMarkdown–4 项目本身尚不成熟,与 Pandoc 相比支持的格式偏少,再加之其很多 Latex 样式排版是内置的,导致有时候修改起来略有不便。 特别是若我想导出 epub 格式用来放在移动设备上阅读时,依然还要依赖 Pandoc 的工作。


这个问题在 Larrycaiyu 的博文PDF蛋疼的中文字体一文中已经有所表述,我在他的基础上再进行实验,增加了Google和Adobe最近新出的 思源黑体,总结如下:
字体英文名 字体中文名 测试结果
AR PL UMing 文鼎PL细上海宋 会出现标点符号在中间的错误
AR PL SungtiL GB 文鼎PL简报宋 英文字体不好看,item的"·"号不能显示
Adobe Song Std L Adobe宋体 item的"·"号无法显示
Hiragino Sans 字体很完美,但item的"·"不能显示
WenQuanYi Micro Hei 文泉驿微米黑 没有对应的粗体字体
Source Sans Han S(Noto Sans CJK) 思源黑体 不能用,出现 CMap 错误
FZSong FZheiti 方正宋体方正黑体 非开源字体,有潜在版权风险


可以配置 或者 Travis-CI 来引入在线持续集成环境,结合 Github 就可以直接在线生成 pdf 电子书,避免了安装Latex的一堆麻烦事,节省了本机资源。 这里以 为例,可以设置语言为 C/C++,这个不影响。然后在 Commands 处写上: [code language="shell"]./ ./ make [/code] 选择左侧的 Artifacts 然后填上 gnome3-app-book.pdf。这样生成的 pdf 文件 URL 就类似是 每次 push 到相应的 Github 仓库就会自动启动开始生成 pdf, 大概15~20分钟后就搞定了。


可能有人会说不是有Git吗,多人协作还是个事啊?事实上,从技术上说这真不是个事!但一旦落实到人本的问题,一旦放到具体社区环境中的时候,这个问题就略有点复杂了。 写书和写代码有相似又有不同,相同的是我们都可以把写作的过程量化和流程化,但写文章有较强的连续性和随意性,不像写代码那么模块化和逻辑性强。因此在多人协作的时候光靠技术来解决是不够的,还需要一些制度性的东西,比如协作要求等等。 另外就是要分章节负责,将具有一定连续性的章节分配给同一个作者,达到结果最优。


Celebrate Software Freedom Day on September 20

200teamsI am very glad to share with you that registration of the eleventh edition of Software Freedom Day has been opened since early August and you can see from our SFD event map, we already have 129 events from more than 50 countries shown in our map. As usual registration happens after you have created your event page on the wiki. We have a detail guide here for newcomers and for the others who need help, the SFD-Discuss mailing would be the best place to get prompt support.

Don’t forget to tell people about SFD! Simply use one of the banners we’ve made if you are organizing, participating, attending or speaking at a SFD event by placing it on your webpages and link it back to your SFD event page or You can also help us to promote SFD by placing our SFD counter with your own language as well!

So get ready to celebrate and happy preparations to all!
Celebrate SFD with us on September 20, 2014!

使用 Emacs + PO-mode 做本地化翻译

之前用过poedit和Gtranslator做过本地化翻译,对初学者来说是很好的工具,也是必须要掌握的工具。但在某些情况下就不是那么顺手,比如快速查找上下文翻译,Review既有的翻译等等。后来偶然一个机会发现了Emacs下的插件PO-mode,于是我现在已经全面转入po-mode的使用了。 作为Emacs的一个major mode,PO-mode目前是我使用中发现的最好的本地化工具了,它的优点是利用了Emacs非常方便的文本编辑框架,方便翻译者和Reviewer,又保留和提升了本地化翻译工具Gettext的优势,更难得的是降低了新手的入门门槛。




其实软件本地化的主要无非就是围绕文本翻译和Gettext的相关操作展开,因此所有图形化l10n工具的本质也都是将Gettext的各种操作简便图形化出来。 用Emacs打开一个po文件,如果是使用包管理器安装的话,此时会自动进入到PO-mode。若没自动打开,可以手动 M-x po-mode 打开,也可以自己写一个hook到.po文件上。 此时把光标移动到任意一个词条上,按Enter键即可打开翻译窗口。在翻译窗口翻译一段后,按 C-c C-c 即可保存,若想放弃此次翻译可以用 C-c C-k 。注意翻译时不要删掉末尾的"<"字符。 基本操作非常简单! 一些特别常用操作:
按键 操作
n 移动到下一词条
p 移动到上一个词条
u 移动到下一个未翻译的词条
U 移动到上一个未翻译的词条
t 移动到下一个已翻译的词条
T 移动到上一个已翻译的词条
f 移动到下一个模糊翻译(Fuzzy)的词条
F 移动到上一个模糊翻译(Fuzzy)的词条
k 清空当前词条的翻译
Backspace 标记当前词条为模糊翻译(Fuzzy)
TAB 移除当前词条的模糊标志(fuzzy)
# 修改当前词条的翻译者注释
? 显示帮助页面
q 退出PO-mode,退出时进行验证翻译


刚开始用PO-mode的时候感觉各种不爽,于是发现用命令E,可以进入传统文本编辑模式,我可以自由编辑。当然实际上,这未必是个好事,因为你会无意中破坏po文件的结构和一些很关键的内容,造成很多不便。 另外,既然是对Gettext进行封装,那么最基本的一些Gettext命令应该是支持的,比如 msgfmt 等等,PO-mode提供了一个简单的命令——V,代表Validate,会自动执行 msgfmt -c -v 命令,可以输出错误信息,如: [code language="shell"]msgfmt --statistics -c -v -o /dev/null gnome-boxes.master.zh_CN.po gnome-boxes.master.zh_CN.po:930: “msgid”和“msgstr”中的指定格式数量不匹配 msgfmt: 发现 1 处致命错误 gnome-boxes.master.zh_CN.po: 194 条已翻译消息.[/code] 此时在提示窗内按ENTER(RET)即可定位到出错的那一行,修改好即可。修改好之后再输入命令 V ,又会进行验证,直到输出如下的确认信息: [code]msgfmt --statistics -c -v -o /dev/null gnome-boxes.master.zh_CN.po gnome-boxes.master.zh_CN.po: 190 条已翻译消息,3 条模糊消息,1 条未翻译消息.[/code] 还有就是平时翻译的时候会碰上类似 “n”、“"”等等这种格式转义符,请看这个例子: [code language="shell"]msgid "'%s' could not be restored from diskn" "Try without saved state?" [/code] 而我在翻译窗口内只需要如下这样输入即可,也就是不需要输入“n”,只要在行尾回车换行即可。 [code]无法从磁盘恢复“%s” 忽略保存的状态来尝试吗?< [/code] 最终结果会自动转换是: [code language="shell"]msgid "'%s' could not be restored from diskn" "Try without saved state?" msgstr "无法从磁盘恢复“%s”n" "忽略保存的状态来尝试吗?"[/code] 类似的情况还可以用来处理英文双引号(" ")和斜线符()等转义字符上。


有些时候我们会碰上需要保持译文和原文一致的情况,比如时间啊日期啊,特意标注的英文等等,这时候可以在主编辑状态按 C-j 即可,就可以自己将原文复制到译文处。也就是保持 msgidmsgstr 的精准一致。 既然是在Emacs下操作,那么就可以结合其他插件和工具,比如拼写检查。详情参见EmacsWiki的PoMode一文。如果作为一个审核翻译的Reviewer来说,工作还是非常繁重的,因此结合Emacs的一些插件,就可以实现很多非常好用的功能,比如错别字检查,格式校对等等,这里推荐之前在CSDN的同事编写的Emacs中文校对插件,可以非常快速查找常用的错别字和符号问题,当然对于咱们来说还需要在此基础上稍微hack一些,增加更多符合中文本地化翻译的内容。


好的工具绝对可以使工作事半功倍,本文所介绍的Emacs+PO-mode就是这样一款不可多得的本地化翻译工具。本文只是非常浅显的介绍了po-mode最常用的一些日常操作,其他一些功能,比如结合C源文件等,请参考PO-mode的官方文档。 希望各位朋友多多参与到自由软件、开源软件的本地化工作中来吧!特别的,参与GNOME项目的本地化,可以进入这个地址:

龙芯2F逸珑安装Debian 8 Jessie记录(8101、8089适用)

最近闲来无事(忙里偷闲)想起我之前团购的龙芯小本了,这次买了一个8101,与著名的8089系列一样,只不过屏大了一些。之前折腾8089还是蛮顺利的,我想当然的认为折腾8101一样没啥难度,所以就挑战了一下Debian 8 Jessie,结果。。。


  1. Emacs在图形界面下运行会出错,emacs -nw是正常的
  2. 终端下的中文和输入法(如果X跑起来,这个可以忽略)
  3. PIXMAN的问题,可以加速视频显示
  4. 触摸板偶然出现问题,指针到处跑,怀疑和X的配置有关
  5. 启动时间超长,大概需要一次正常大便的时间(便秘和腹泻不算)。主要耗时在PMON载入initrd花费时间太多,至少10分钟!


首先是我看中它屏大!充分发挥了这玩意的优势,当然所谓屏大其实就是8089的像素拉伸罢了,形状和图标全都被拉伸了。。。 还一个我看重的地方是其配备160GB的硬盘,比较大的空间,这样可以用来做下载机和小型服务器。 同时也是比较大的游戏机,一般的framebuffer游戏和文本游戏都挺不错的,比如nethack。一些不需要openGL加速的SDL有些也可以跑起来。、 RMS大神用的也是这一款!




首先是要做U盘。具体步骤略,去官方源里找testing和loongson相关即可,把所有文件都弄到U盘上,U盘这个分区只要是ext2格式就行。然后按官方教程开始装。 我装的过程中无线网不能用,后改用有线最终完成安装。分区的时候我把/boot分区单分出来了。另外会碰上安装grub失败,忽略它,后面我会改。


装完后首先是不能引导进入系统,又用安装U盘进入安装界面,但我不安装,执行如下步骤: [code language="shell"] mount /dev/sda2 /mnt # 将根分区挂载 mount /dev/sda1 /mnt/boot #挂载/boot分区 cd /mnt/boot/ [/code] 之后的操作就比较简单了,创建一个boot.cfg文件,如下内容按情况适当修改。 [code language="text"] default 0 timeout 5 showmenu 1 title Boot with GRUB (grub.elf) kernel (wd0,0)/grub.elf args some-dummy-string title Debian 8 Jessie kernel (wd0,0)/vmlinux-xxxxxxxxxxxxx initrd (wd0,0)/initrd.img-xxxxxxxxx args root=/dev/sdaX rootdelay=8 [/code] 这时候再启动就OK了。启动之后进入系统。这种引导方式其实还是用PMON来引导的,速度极慢,开机大概需要10分钟左右,不知道为何?另一个办法是用PMON引导进入GRUB,然后由GRUB引导Linux系统,这样会速度比较快,但我并没有搞定这种启动方式,还在解决。


如果安装到tasksel的时候选择了“Desktop Environment” 则会默认安装XFCE桌面,如果不喜欢可以后面再改,我就没改,凑合这么用挺好。 默认装好以后X会启动失败,没事,只要删掉xserver-xorg-video-siliconmotion就好, [code language="shell"] sudo apt-get purge xserver-xorg-video-siliconmotion [/code] 这样重启就可以进X和图形界面了。现在相关驱动比尔盖子正在奋力编写,不用急。


这个解决略复杂,首先是其恶心的fn+F5这坑爹的设计,每次启动都要手动按一次。。。给出两种解决方案,一个是用图形界面,一个是命令行。 图形界面比较简单,用wicd即可,这也是Debian官方比较推荐的工具,平时我自己也这么用。 命令行也不复杂,这是WPA2的加密AP: [code language="shell"] ifconfig wlan0 up wpa_passphrase XXX > wpa.conf # 之后输入WIFI密码 wpa_supplicant -D wext -i wlan0 -c wpa.conf &; dhclient wlan0 [/code]




Bulk remove wordpress spam comments and Akismet metadata

Connect to your wordpress DB using MySql workbench and execute this query:
DELETE FROM wp_comments WHERE comment_approved = 0;
DELETE FROM wp_commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM wp_comments);
DELETE FROM wp_commentmeta WHERE meta_key LIKE '%akismet%';

两岸开源文化面面观(下) —— COSCUP 2014见闻



回顾与台湾开源人的接触,始于2010年,当时GNOME.Asia与台湾COSCUP合办,是时,我没有赶上那次盛会,不过后来加入到北京GNOME用户组之后,成为了台湾GNOME用户组和北京的联系人,认识了Sakana Chuang(Max)等人。之后2011年在北京Linux用户组的月度聚会上,Pingoo讲述了COSCUP的前世今生,不仅如此他还带了一瓶宝贵的台湾高山米酒,我第一次品尝如此甘醇的美味,也正因为此次讲解,让我对COSCUP有了非常深厚的情感,并一直关注,希望可以亲身参加一次。 而后借2012年香港GNOME.Asia大会的机遇,与更多台湾开源人有了接触,也熟识了Ezgo社区的Eric Sun和台湾真理大学的师生们。还邀请他们参加了2012年8月的北京GNOME用户组的月度分享会,特别安排了一次台湾真理大学和佛光大学与大陆开源社区的交流会。 在听说COSCUP四年后,我终于可以第一次踏上宝岛台湾,以演讲者的身份参加COSCUP,也深深领略了这里的开源文化。


其实COSCUP最吸引我的并不是两天的演讲题目。大多数演讲还都是比较传统的开源模式,虽然有亮点题目,也有很多在大陆比较难见到的演讲,比如讨论如何运营社区,如何办开源会等等非技术性话题或人文类话题。我将今年上半年我参与组织的两场大会与COSCUP对比罗列如下,各位看官其实可以很明显看出三者的不同: COSCUP一直秉持的一个原则是“40%听演讲,60%交朋友”,这也成了COSCUP多年来成功的关键。虽然看上去好像弱化了演讲的比重,但因此却强化了人本参与,让开源回归社区,更注重社区参与的味道。 [caption id="attachment_870" align="aligncenter" width="695"]60%交朋友 总召赵柏强讲述COSCUP的原则——40%听演讲,60%交朋友[/caption] 参加OSTC开源技术大会的时候,我就发现很多参会的人并不关心演讲,也不关心展台,却专注于招呼朋友,招呼好友占领一切可以占领的空间,在交流和闲聊,事实上到这一步的时候,会场已经基本“失控”,但却体现了开源社区的精神——去中心化和自由。 这种情况在GNOME.Asia的时候依旧发生了,原以为演讲开始以后展台周围会没有什么观众,但事实却再次与想象不同:演讲开始以后大量的观众依旧聚集在展台周围,即便是有鸣锣催场,很多人依旧更倾向于与人交流,而不听演讲。因此是否可以这样说,开源社区中的社交需求是个强需求。 [caption id="attachment_843" align="aligncenter" width="695"]主会场座无虚席 主会场座无虚席[/caption] [caption id="attachment_861" align="aligncenter" width="695"]Google 的演讲直到当天才最终确定话题——最新的Nato字体 Google 的演讲直到当天才最终确定话题——讲述最新的Noto CJK字体[/caption] [caption id="attachment_860" align="aligncenter" width="695"]即便是赞助商的演讲,也搭配了Workshop,不是那种完全的广告性质 即便是赞助商的演讲,也搭配了Workshop,不是商业宣传,有很多干货[/caption]


为了突出演讲与交友四六开的局面,COSCUP组委会设置了多项除演讲之外的活动。包括为各个社区和赞助商准备的多达20多个展位,而每个参展社区又有自己丰富的活动。比如有的社区举办了抽奖游戏环节,有的社区则举办了现场送书活动,还有社区会举办现场音乐制作和售卖会,更有某饮料赞助商将售卖冬瓜茶搬到了会场…… [caption id="attachment_869" align="aligncenter" width="695"]现场售卖开源硬件产品 现场售卖开源硬件产品[/caption] [caption id="attachment_868" align="aligncenter" width="695"]展台的3D现场打印 展台的3D现场打印[/caption] 其实这些都不是亮点,真正的亮点是会场上出现的“大地游戏”和简历投递,利用每个参会者的鉴别证(也就是胸牌)上的NFC近场通信功能。而贴有NFC贴纸的鉴别证最首要的功能是用在了进场签到上,因为减少了人员参与,大幅加快了签到的速度,1500名公众可在几分钟内全部顺利通过闸门入场。 [caption id="attachment_840" align="aligncenter" width="695"]我的参会识别证,含有NFC芯片,可以参加各种活动 我的参会识别证,含有NFC芯片,可以参加各种活动[/caption] 而“大地游戏”则是一种很简单的签到游戏,吸引参会者前往各个社区展台刷NFC鉴别证,增进交流机会,进一步增加社交的覆盖度,增加人员接触的可能。从我在展台的实际观察来看,这个游戏起到了非常好的效果,人员覆盖和流动都能在展台保持很长的时间,远比我想象中的带来更多的交流。而在其他展台也看到了类似的现象,单纯只是刷NFC鉴别证的比例并不大,反倒是由于这样的活动增加了人员密集家流。 [caption id="attachment_859" align="aligncenter" width="695"]玩大地游戏的终端设备,每个展台均有一台 玩大地游戏的终端设备,每个展台均有一台[/caption] 而此NFC鉴别证还有一个功能就是可以投递简历,NFC内部会存储个人简历相关的识别方式,可以利用NFC直接将简历投递到参展公司。另一方面,有的参展公司也自备了简历表格,可以直接当场填写。 [caption id="attachment_865" align="aligncenter" width="695"]使用开源工具制作的音乐,还可以现场制作 使用开源工具制作的音乐,还可以现场制作[/caption] [caption id="attachment_867" align="aligncenter" width="695"]研华科技是赞助商之一 研华科技是赞助商之一[/caption] [caption id="attachment_864" align="aligncenter" width="695"]我很喜欢的mobilgoblin ckan带来了我很喜欢的MediaGoblin展台[/caption] [caption id="attachment_866" align="aligncenter" width="695"]WoFOSS台湾女性开源社区 WoFOSS台湾女性开源社区[/caption] 最后就是每个开源大会都会有的BoF环节,COSCUP在这个环节上并没有太多创新,但这个环节的存在其实也是为了增加社交机会而设立。  


此次COSCUP大会最让我感觉惊诧的是志愿者组织工作,在北京举行的2014 GNOME.Asia我也参加了一部分志愿者组织工作,以及会前的志愿者组织会等等。 但相比于COSCUP的1500人规模,无论是GNOME.Asia的300人规模,或者OSTC的600人规模,志愿者(OSTC大会没有志愿者,都是CSDN工作人员)的组织工作绝对已经是小巫见大巫了。从最后一天上台拍照的志愿者来看,COSCUP这次大概有80~100名负责各种工作的志愿者,甚至很多志愿者我都叫不出他们的名字,也没有和他们一一合照。 [caption id="attachment_879" align="aligncenter" width="720"]与志愿者黃祿勳 与志愿者黃祿勳[/caption] [caption id="attachment_880" align="aligncenter" width="720"]与志愿者陳立函 与志愿者陳立函[/caption] [caption id="attachment_881" align="aligncenter" width="720"]与志愿者Yu-Chu Tu ,还有另一个志愿者和她很像,以为是双胞胎,一直差点认错人。我是靠她的发巾来识别的。 与志愿者Yu-Chu Tu ,还有另一个志愿者和她很像,以为是双胞胎,一直差点认错人。我是靠她的发巾来识别的。[/caption] [caption id="attachment_890" align="aligncenter" width="593"]与销售组大名鼎鼎的虾虾委员长 与销售组大名鼎鼎的虾虾委员长[/caption] 在我看来,志愿者组织在COSCUP是一大亮点,会前从Facebook一些小伙伴的po文上基本可以一瞥其志愿者组织情况,毕竟已经是第九届了,早就已经具备非常娴熟的志愿者招募机制。按照组长和分工协作的方式组织在一起,目前来看也已经是一种成功的模式了。小组长与总召(我猜应该就是总协调人的角色)之间是通过无线电沟通,毕竟这么大的会场,覆盖两栋大楼,也许只有无线电沟通最方便了。通过一级级分批协调的方式,将这么大规模的开源会可以稳妥组织进行下去,实在是难得。 从我的观察来看,看到的是平顺和紧张有序,能看到忙碌的身影,却看不到慌张神色和忙乱无措;能看到巡视会场的组长和总召,却看不到颐指气使和趾高气扬;能看到志愿者与参会者密切沟通打成一片,看不到工作人员无所事事哈欠连天。可以说这次COSCUP的成功完全得益于所有工作人员的辛勤付出和整个志愿者组织的合理调配,能感觉到工作压力被多个人分担,使得整个大会的人员组织显得更加游刃有余。  


最让我意外的是这次大会的讲者伴手礼,之前OSTC开源大会送给讲者的是廉价的青花瓷套装,毫无特色可言。而此次COSCUP赠送的讲者伴手礼真的高大上啊! [caption id="attachment_874" align="aligncenter" width="695"]讲者的伴手礼——活版印刷体验盒 讲者的伴手礼——活版印刷体验盒[/caption] 竟然是一个需要自己动手DIY的活版印刷体验盒,而体现组委会用心之处的是增加了“COSCUP”字样以及今年大会的主题“Make Things Happer”(软硬兼施的手创开源革命),最让人感动的则是加入了讲者的名字!再打开盖子的那一刹那,我真的是被感动到了,差点鼻子一酸当众泪奔啊! [caption id="attachment_876" align="aligncenter" width="695"]我的名字!组委会太用心了! 刻有我名字的铅字!组委会太用心了![/caption] 回家以后我花了一些时间(其实是很长时间)完成了这个DIY的活版体验盒,也“印”出了组委会的匠心独具。 [caption id="attachment_875" align="aligncenter" width="695"]终于大功告成了! 终于大功告成了![/caption]


在我理解中,其实开源大会和商业大会的区别主要体现在主办方和参会者。商业会的主办方是一个商业公司或组织机构,参会的人是有商业目的合作伙伴、上下游厂商或者相关产业的人士;而开源会的主办方是开源社区,参会的人也是开源社区里的人,可以说开源会更像是一次自High的大Party。商业会是有阶层差别的,能明显感受到对主办方有益或资源聚拢到主办方的特色,比如区别赞助商参会、购票参会、普通参会等等,还比如赞助商的安排和其与主办方关系为重。当然也不排除一些商业会带有一定公益色彩,或者成为某种产业的推广工具等。而开源会,特别是社区会,真正体现了“从社区中来,到社区中去”的精神,比如此次COSCUP的志愿者大多是本地开源社区的成员,比如MozTW、HITCON、SITCON等等。所以当我想明白这个道理,也就明白为什么COSCUP的原则是“40%听演讲,60%交朋友”,也就明白了为啥CSDN举办的所谓“开源会”让大家嗤之以鼻的原因了。 [caption id="attachment_871" align="aligncenter" width="695"]“创客”(Maker)在台湾的翻译是“自造”。Richard强哥与纪录片《Maker》的主创畅谈 “创客”(Maker)在台湾的翻译是“自造”。Richard强哥(右一)与纪录片《Maker》的主创畅谈[/caption] 前一篇文章《两岸开源文化面面观(上)》特别提到了台湾和大陆最大的差别就是基于其强大的公民社会基础,所以其开源发展也更加蓬勃和繁盛。而这种公民社会意识也体现在了COSCUP上。比如大会实时直播(大陆须翻墙),完全由不知名的非大会志愿者的“志愿者”来维护,可以看到有关大会超多资料!还有大会现场IRC频道,在freenode的#coscup 上,既是现场交流,同时也现场组织和通知的快速渠道,并由此形成了COSCUP梗全集等等,这些留下来的资源也成为了之后办会的参考。还有一位医生业余写代码,辅助更多的人可以更健康的生活。也有学校教师通过社区来让学生加入,进而引导学生学习等等。这些都启发了更多人,使得开源社区可以不断涌现。这也成就了今天台湾开源社区的繁华。 从COSCUP这个管中窥豹的渠道去了解台湾开源发展,实在是非常恰当的渠道,因为其不仅是台湾最大的开源社区聚会,更是最能集中体现台湾人公民意识和公民社会特征的地方。也许台湾人觉不出来,但作为从大陆过去的人,这种强烈的对比产生的感受就很强烈了。 [caption id="attachment_885" align="aligncenter" width="695"]COSCUP 2014的总召——赵柏强Bob COSCUP 2014的总召——赵柏强Bob Chao[/caption] 虽然今年COSCUP尚有一些可以做得更好的地方。比如没能请到国际大牌来演讲(需要请吗?台湾岛内那些大牌已经足够可以引起大家崇敬了);还如BoF可以好好创意一下,增加更多的趣味(Lightning Talk的趣味还不够吗?);又比如是否能增加一些i媒体宣传,玩好自媒体;还比如演讲时间安排比较紧凑,赶场很痛苦等等。。。最后我希望COSCUP不仅是台湾的,不仅是华人圈的,更应该是亚洲的,甚至是面向全世界的! 最后,感谢志愿者们的辛勤付出,没有你们是无法成就如此丰富多彩的开源大会的!期待2015 COSCUP十周年大会! 这里提个本人愚见,不妨请乐队给COSCUP十周年写一首歌吧,一首属于开源人自己的歌曲(自己的歌曲自己唱),且以开源协议公开,这可以说是整个华人开源圈,乃至全球开源社区首创。 [caption id="attachment_887" align="aligncenter" width="695"]感谢各位志愿者的付出!明年见! 感谢各位志愿者的付出!明年见![/caption]

Hack a fan – 自製空氣淨化器

上週日在北京 Bookworm 書店+咖啡廳參加了一個很有趣的 DIY 土炮空氣淨化器活動。北京經常被陰霾籠罩, AQI (空氣質素指數) 大部份時間處於不健康水平,在北京生活,口罩和空氣淨化器必不可少。其實空氣淨化器的構造不複雜,簡單說就是由風機抽取室內空氣,通過濾網把空氣中的顆粒隔除 。濾網包括 HEPA,活性炭等。很多市面上賣的淨化器都用 HEPA,HEPA 效能高,相對廉宜,技術成熟,能過濾 99.7% 以上 0.3 微米的粒子,所以對付 PM 2.5 很有效。當然,淨化器廠商不會只滿足於此,爲了提高利潤,都會加些有的沒的功能,譬如除甲醛、除臭、殺菌等。不過,這些 fancy 的功能往往只是錦上添花,至少在帝都這些功能遠遠比不上過濾 PM 2.5 來得重要 (沒聽說北京的細菌特別猖狂)。

說回這個 workshop,它是由一位在北京做研究的美國心理學博士生 Thomas Talhelm 舉辦的。話說他對北京的空氣污染很擔心,但又發現市面上的空氣淨化器貴的離譜,所以就開始着手研究自製淨化器,然後把結果發表到。目前他做了兩款,一款售價 200 RMB(我自己算了一下,成本大概 160 RMB),另一款過濾效能更高名叫「大炮」的賣 450 RMB。

在他的「發明」面世前,就已經有人嘗試過空氣淨化器,把過濾網放在風扇的前面(或後面),這件事誰都會幹,你想問這有什麼值得講的吧?答案就是 open data。Thomas 爲了證明他的淨化器有用,他做了非常多的實驗,在特定的環境下,採集了大量的數據,並進行對照實驗,跟量產的淨化器對比,證明他的 poor man’s air purifier 效果不比那些賣幾千塊錢的過濾器差。最重要是他把實驗方法和數據公佈在 smart air 網站particlecounting 博客,他對數據的嚴謹和認真態度都是長年在學術界鍛鍊出來的。他的朋友取笑他不願意付錢買淨化器,卻願意花 260 USD 買個粒子測量器,求真就是這個態度。



他還在不斷的進行各種實驗,目前正在測試 HEPA 在長期使用下效能的變化

剛才說到 AQI,要注意 AQI 在各國的計算方法都不同。雖然美國中國所用的算式一樣,但等級分類卻有點差別。分別在於 AQI 200 以下的時候,美國所用標準要求更高,AQI 200 以上則幾乎一樣,所以會出現下面的情況,左圖按照中國標準,右圖按照美國標準,以後 quote AQI 要小心囉:


最後順便推薦幾款監察中國 PM 2.5 的 Android app:


声明:此文只代表我个人浅浅的认知观点,有任何不妥之处请指正! 今年7月,我以演讲者的身份,参加了一年一度的COSCUP台湾开源人年会。从我第一次听说COSCUP,直到我真正参加进去,已经时隔四年之久。今年是我第一次去台湾,但在这四年时间里,我已经参加到台湾的一些开源社区中了,与很多人建立了关系,先后认识了GNOME社区的Max,以及Ezgo社区的Eric Sun老师和台湾真理大学的资管系的师生,近年来又结识了COSCUP的多位贡献者。 虽然大陆和台湾在文化上同源,但近代发展的道路不同,在开源文化上的影响也就出现了一些引人深思的对比。通过参加台湾的开源社区,特别是此次参加COSCUP,得以集中近距离观察台湾开源文化的现状,不妨将大陆和台湾开源文化的差异一一梳理。

民族主义 VS 公民社会

大陆的开源文化里充斥着很多“自主知识产权”的内容,我们更强调自主可控,往往是别人有的,我也要有,不懂得参与和贡献到别人的项目中去,于是就能看到大量自立山头的现象。而强调“中国人的操作系统、中国人的某某平台、中国人的开源软件……”等等论调也在最近两年甚嚣尘上,这种在开源圈大炒民族主义的言论,从始至终一直有,这与大陆开源发展的模式有关。从1999年第一次引入Linux开始,大陆的开源文化一直是从政府到民间的自顶向下模式发展,近几年终于在民间呈现遍地开花的局面。 而与此相对的则是台湾强大的公民社会文化,从各种开源社区,以及各种与之相伴而生的团体,还有g0v(零时政府)的出现,都带有强烈的公民意识。而了解到台湾开源文化的演进历史,就可以发现台湾的开源文化一直是民间自发推动的,也就是自底向上模式。近几年来,台湾当局也开始重视开源的发展,并给与一定的力量支持,这可以看作是这种公民运动的阶段性成功。 [caption id="attachment_837" align="aligncenter" width="500"]最体现公民社会和公民意识的一句话 最体现公民社会和公民意识的一句话[/caption] 我的观察,这两种发展模式的差异,是以下讨论所有差异的基础。大陆的开源社区往往带有一定的被动性,活动组织很难成规模,也很难聚集足够的志愿者和人气。而台湾因为从一开始便是民间自发而成,所以主动性强,自组织能力好,因此其开源发展更加迅猛且根深蒂固。

技术驱动 VS 社区带动

参加大陆的开源活动、讨论会,往往会发现大家都在讨论具体的技术细节,具体的实现方式,当然还有各种打嘴架各种嘴炮。而大陆的开源社区也大多是类似Python用户组啊,Docker中文社区啊,OpenStack中文用户组等等这种依托于具体技术的社区。而技术最终是为商业服务的,这导致的结果是大陆的开源发展本质其实商业驱动的。 而台湾的社区大量的是类似、Moztw、WoFOSS(女性开源社区)、HITCON(台湾黑客年会)、SITCON(台湾学生计算机技术协会)等等这种泛技术社区,当然也有关注具体技术的社区。总体上可以发现,台湾的开源文化是这种泛技术社区带动起来的,更注重志愿者的贡献和投入,更注重培育人本精神的社区文化,而不是仅仅学习某项技术,某种能力,获取某种知识。 [caption id="attachment_836" align="aligncenter" width="500"]COSCUP上台湾Ubuntu.tw的摊位 COSCUP上台湾Ubuntu.tw的摊位[/caption] 大陆开源社区过强的技术驱动性,导致的结果是目的性和指向性更强,人人都想着更多索取,而不是人人贡献社区,不利于开源文化的普及化发展。当然,台湾的这种社区带动模式也有一弊,即技术参与少,导致技术发展不够迅猛,容易与高速发展的技术前沿脱节。

小众玩物 VS 大众普及

在中国大陆,开源文化带有极强的精英意识和精英化思想,这样看上去好像大牛很多(包括自称“大牛”的人),这样产生的结果便是因为其技术精英化,无形的壁垒就会产生,因此就变成开源成为了小众的玩物,越来越难推广,也越来越难征到志愿者贡献到开源中来,由此产生的恶性循环导致大量开发者和贡献者流失,近年来中国开源社区的发展甚至有倒退的趋势。 与此正相反,台湾的开源文化强调人人参与,强调任何人都可以参与其中,降低难度系数,降低小白的学习门槛,吸引更多的人进来,也就有更多的贡献者愿意贡献自己的力量。与此同时,也很容易发现台湾开源社区的大牛都非常谦逊,为人低调而富有涵养,无论是早年的鸟哥(就是著名的写《鸟哥Linux私房菜》的那位)还是现在台湾大红大紫的黄敬群(Jserv),他们都在不遗余力的将自己所学布道给更多的人,举办培训班或者线下讨论会等类似的形式,抑或是线上解答大家的问题。仔细看COSCUP的议程也可以发现,都会安排一些Workshop环节,以动手实操的方式将一些技术环节教给大家。 [caption id="attachment_839" align="aligncenter" width="500"]COSCUP 2014参会人数创纪录。听闪电演讲的时候两层大厅完全坐满 COSCUP 2014参会人数创纪录。听闪电演讲的时候两层大厅完全坐满[/caption] 像台湾这种面向大众普及的思想,也催生了良性的氛围,导致台湾的开源文化普及越来越广。COSCUP这9年的变化恰恰是一个很好的例证,2012年20分钟即卖出700张票,而到2014年1100张票在10秒钟内被全部秒杀!正是因为有广泛的群众基础,COSCUP才能这么受人欢迎,这与台湾开源文化的大众普及程度密切相关。

Big Data  VS  Open Data

参加国内大型的开源大会,讨论话题往往集中在大数据、云计算和移动互联这三大块上,为什么会集中在这三大块呢?因为这是最热门的领域,最能产生经济效益的技术增长点。之前在CSDN的时候,某高管还曾信誓旦旦的对我说,离开了大数据、云计算和移动互联,开源大会就没什么可说的了,只要不是围绕这三块展开,开源就没什么意义了。现在回想,足可见其是多么的鼠目寸光和井底之蛙! 与之相对的,台湾在开源方面最近却一直强调Open Data,也就是数据的开放性,打破专有化壁垒,人人都可以对数据进行修改和添加。这体现在了很多公共事务方面,从各种社会运动到自然灾害,都可以第一时间看到网友们利用Open Data的优势,快速传递信息也同时成为了主人。以g0v.tw沃草为代表的公共平台,监督政府职能同时以主人翁意识主导社会事物,为大家谋福利。不仅如此,几乎所有台湾的开源社区都强调志愿者的贡献,鼓励人人都可以在社区中贡献并收获成就。由于志愿者贡献巨大,反倒形成了大数据,随着物联网、云计算和移动互联的引入,Open Data的理念更加深入人心,数据的获取、贡献和传播更加容易,反倒是更加培育了这个Open Data的生态系统。 [caption id="attachment_835" align="aligncenter" width="225"]COSCUP 2014赠送的手袋 COSCUP 2014赠送的手袋[/caption] 台湾人参与Open Data的一个例子,就是COSCUP当天,大量的无名志愿者义务线上文字直播,人们通过IRC来彼此联络,沟通文字直播的相关内容,有趣的槽点和精彩的演讲,更快速的将COSCUP盛况传播出去。还有COSCUP临时需要征召一些通风扇,第二天6台通风扇就运抵会场,全部由志愿者义务提供!


我曾在《中国不适合发展开源——对中国开源发展的思考》一文中说过:开源是国家的科技发展水平、公民意识、软件产业发展水平,三者共同发展到一定程度以后的必然产物。台湾的开源文化发展,可以说,恰好成为这句话的一个脚注和现实例证。 中国大陆和台湾,科技发展水平和软件产业发展水平,最近几年都已经不相上下,甚至中国大陆的软件产业水平还略高于台湾同等层次企业。但两岸最大的差别来自公民意识,这也造就了两岸开源发展巨大的差异。不用赘言,大陆和台湾在开源文化上的截然不同,与公民社会发展水平有极大关系,威权和极权式社会导致公民意识丧失,而开源恰恰是公民社会的产物,ESR在《大教堂与集市》一文里说的“集市模式”,其实就是强公民社会的表现形式。 因此结论简单来说,对中国大陆而言,现阶段不可能改变这种威权/极权社会形态,只能通过开源的生态模式倒逼民众的公民意识萌芽,利用这刚刚萌芽的公民意识再贡献到开源中。而就目前来说,不妨汲取台湾开源文化的一些优点,避讳两岸共有的缺点,降低技术门槛,培育大量的开源社区作为基础,特别是基于高校的开源社团,同时推进自由开放的文化建设,构筑人人贡献开源的良好氛围。只有这样,也许才能些许改变中国开源现状,进而推动公民社会的发展。  


Music to the ears – about GNOME Asia 2014 and an idea for the next one

Zoë, our new born. The inconspicuous man behind her is Zhang Weiwu

Zoë, our new born. The inconspicuous man behind her is ZHANG Weiwu

While I was busy nursing my one-month old daughter Zoë, my husband ZHANG Weiwu showed up in Gnome Asia 2014 and talked about usable design – he is perhaps happy to get noticed once or twice:)

The following is his guest writing, since he does not have a blog of his own:

Lenka Kripac for this Gnome Asia

GNOME Asia 2014 is again phenomenal: women leadership (was there, now better), a gender-balanced audience, warm local media coverage, diverse topics, and live golden fish under the smoking area’s floor – of which I should have taken an photo;)

If you didn’t present, you should watch this music-video mini-documentary and get thrilled – probably one of the best ever produced about opensource conferences:

You would certainly notice the great choice of music. The key frames are matched to the beats, a creative use of Mickey Mousing technique.

The music and lyrics stirs up passion about excitement to grow, about change, diversity and youth, which fits GNOME quite well. Unsurprisingly, this happen to be exactly the message Microsoft marketing guys prepared for public reception of Windows 8 too. It was chosen and licenced for the theme music of an official Windows 8 TV Ad. In fact, the music made a global name thanks to its wide used in Windows 8 Ads, and a rapt audience associates the two. You would hear people talking about this piece as “Windows 8 music”, forgoing its original title “Everything at Once”:

The music was written and produced by Australian singer Lenka, whose debute piece “The Show”, with a distinct personal touch, compares the world to a stage. My favourate.

Where the music fades, the debates go on. But not much about Windows 8, instead, it is about copyright. The use of this music is unlicenced.

In modern days China, copyright is so neglected, that if you try to licence that song for this conference, you walk into the copyright owner’s branch office and they would not believe what they heard. A dilemma between doing the stupid thing of actually go and licencing it, and, doing the wrong thing of going without licencing.

But I am not to join the debate. I am writing to offer a new idea.

Woody Guthrie for the next show

Since we will have to use a different piece of music for the next Gnome Asia. There is one that just fits.

It’s Woody Guthrie’s “Howdi Do”. I have not counted, but there should be at least twenty times “Howdi Do”, “How do you do”, “Howdy” in the song. The music is a warm picture of people shaking hands, greeting each other.

This is how we are going to do it:

GNOME had been presented by a robot before:


We arange someone to play the role of our cameo robot, and ask every guest to shake hands with it – and video it:

Robot shaking hands with people. We don’t have to use a real robot – you know, it’s cheaper to let human does the robot’s work.

Then we match the hand-shaking to the lyrics: “Howdi Do”, “How do you do”,”Howdi”. We could do the Mickey Mousing again.

Why Woody? Because his music is quite old, a lot of them produced as early as 1930, under which time copyright has to be declared to be valid.

But also, I chose Woody because he made a strong stance against copyright. On the typescript submitted for copyright of “This Land Is Your Land”, Guthrie wrote:

“This song is Copyrighted in U.S., under Seal of Copyright # 154085, for a period of 28 years, and anybody caught singin it without our permission, will be mighty good friends of ourn, cause we don’t give a dern. Publish it. Write it. Sing it. Swing to it. Yodel it. We wrote it, that’s all we wanted to do.”
– source:

I jumped out of my chair cheering him when I first learned this. An opensource pioneer in 1945? A free spirit he is.

I hope our next show attracts so much attention that someone coming to us claiming copyright, then we could make a good piece of news about it. EFF did act once to defend a Woody song against copyright claims.

思源/Noto pan-CJK 字體 & Ubuntu

以開源協議授權釋出的字體大多數以拉丁字母等歐洲語言爲主,但最近 Adobe 和 Google 共同推出的思源/Noto pan-CJK 開源字體不只涵蓋了大部份中日韓所需要的字型,而且繁中、簡中、日文和韓文都用了不同的 OTF 檔案,因此對同一個漢字在不同地區的不同寫法就能個別處理,算是解決了 Unicode 一直爲人詬病的 Han unification 問題。

香港人最關心的應該是該字體是否覆蓋 HKSCS,我檢查過部份 hkscs-2008-big5-iso.txt 的 unicode 碼,在 NotoSansHant 裏都能找到,而且目測在 CJK BCD 區裏都有覆蓋,所以應該夠用(在下面的圖找找吧)。

用 Fontforge 查看 NotoSansHant-Regular.otf用 Fontforge 查看 NotoSansHant-Regular.otf

從下面幾張 screenshot 可以看到香港字顯示效果理想:

想將 Ubuntu 的桌面 UI 和程式的預設字體改成思源/Noto,可以參考 Ingram Chen 的 blog。小弟改良了一下 Ingram 的 fontconfig 設定檔,使系統在不同 locale 下能優先選擇適當的字體,比如 zh_TW 下繁體的 Noto Sans T Chinese 是第一選擇,在 zh_CN 下則爲簡體的 Noto Sans S Chinese,之後其他的 CJK 字體作爲 fallback。

設定檔已放在 20-noto-cjk.conf,下載後執行:

mkdir ~/.config/fontconfig/conf.d
mv 20-noto-cjk.conf ~/.config/fontconfig/conf.d

另外如果要配置英文字體,可以下載 10-latin.conf,修改一下檔案中的字體部份,同樣放進 ~/.config/fontconfig/conf.d 即可。

Nexus One 手機螢幕自己換小筆記

好幾個月前在過馬路的時候不小心把 Nexus One 掉到地上,螢幕立即多了一道裂痕。雖然手機已處於半退役狀態,而且螢幕裂得不嚴重,但看着不爽,索性上淘寶買個螢幕把壞的換掉,也當是練練拆機,況且換不好也無所謂。

Nexus one broken screen

其實拆 Nexus One 不是第一次,由於 Nexus One 的開關鍵有質量問題,很多人用了一段時間後不能開關機,自己也遇到一樣情況,所以當時修過一次。不過換開關鍵比換螢幕要簡單得多。開關鍵在手機頂部,只要拆開頂部的背蓋就可以。但螢幕處於手機的最前方,必須從頭到尾把所有部件拆走。



  • 第一當然是螢幕,在這家淘寶店買,只需 38 RMB,運費 10 RMB 到北京,送貨速度挺快
  • 小十字螺絲批
  • 星型 T4 螺絲批: 之前買的 T4 螺絲批鋼水太差,用了幾次已經滑牙,但發現一字螺絲批也能擰開 T4 螺絲,所以這次先用一字螺絲批代勞。
  • 風筒/熱風槍: 螢幕是被黏着的,要靠熱風才能分解,不一定需要熱風槍,普通的風筒應該足以應付。
  • 萬能膠: 用來把新的螢幕黏回去。




Shared GIT repo over SSH

GIT over SSH will create files with user:group from the user that's doing the push. This will prevent other users from changing files, in particular updating refs/heads/.

To share a GIT repo over SSH among several users, create the repo with --shared=group and put all users in the same primary group:
sudo addgroup git
sudo adduser user1 git
sudo adduser user2 git
git init --bare --shared=group

To fix sharing for an already existent setup, fixup the primary groups and file ownership:
sudo cat /etc/group
sudo usermod -g 1006 -G 1007 user1
sudo usermod -g 1006 -G 1008 user2
sudo chown -R root:git /var/repo.git
sudo git config core.sharedRepository group

where 1006 is the ID of the 'git' group and 1007 and 1008 refer to the user's respective groups.

Specifying the private key for GIT on Windows

If GIT keeps asking for your password, even though you have private key auth set up, then its SSH probably doesn't know which key to use. Fix this by making a "config" file in your user's .ssh folder:
echo IdentityFile ~/.ssh/github_rsa > %USERPROFILE%\.ssh\config

Swap Command and Ctrl for Windows on Mac

Quick registry hack that turns the Mac Command keys into Ctrl keys and turns the left most Ctrl key into the Windows key:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,04,00,00,00,1D,00,5B,E0,1D,E0,5C,E0,5B,E0,1D,00,00,00,00,00

The format of the Scancode Map is as follows: 8 bytes header (all 0x00), 4 byte integer "count", followed by "count" times scancode pairs, with each pair consisting of 2 16-bit scancodes with "to" followed by the "from" scancode.

0x0000 will disable the key. The last pair is always 0x0000 0x0000.

You'll need to restart Windows in order for the map to apply.

Project Naptha – 浏览器里的OCR – 是几个小时前发布的超酷项目,装一个Chrome插件即可在浏览器里支持对图片任意文字的OCR,而且还能翻译。

Project Naptha automatically applies state-of-the-art computer vision algorithms on every image you see while browsing the web. The result is a seamless and intuitive experience, where you can highlight as well as copy and paste and even edit and translate the text formerly trapped within an image.










Upcoming Greenboard deployment

fossasia-group-sOver the past few months we have been busy introducing the Greenboard project in a few places, namely at Teach for China in Shantou and at FOSSASIA in Phnom Penh to name just two places. Both have been very interested in the concept, its flexibility, past deployments and more importantly using it within their environment.

greenboard-teamWe are now working on refurbishing a classroom of sixty computers in a school not too far from Shantou, classroom which was installed ten years ago and has never ever been used. Of course not all the machines start (in fact only 15 out of 60) but the room is properly set up and looks like a very nice place to start in the region. The people we are working with from Teach for China are very motivated as well which brings a lot to the equation.

usaidOn the Cambodian side, the discussions we had with USAID and the representative from the Ministry of Education were very positive too. We will have further discussions during April and need to start checking the translation status of all the components we use. Luckily the person in charge of packaging Greenboard happens to be Cambodian too!

All in all we are pretty excited about what’s coming ahead of us and will work hard to make it happen. Stay connected to learn more as the projects move forward!

Promote OpenClipart on Culture Freedom Day!

As Culture Freedom Day preparation is ongoing I got the chance to meet up with Jon Philips from the Open Clipart Library during FOSSASIA.I actually got to know Jon since about 2007 from the Beijing LUG and we have been doing quite a few things together. CFD events is of course something he definitely cares about. While at the Digital Freedom Foundation we make extensive use of all the great graphics from OpenClipart for our design needs, it is important to help others discover such a useful resource. So Jon kindly authored a video to support us and encourage participants to take a closer look at the Open Clipart Library new website design and functionalities. So without further ado I will let Jon do the presentation and thank him and the Open Clipart Library team for their support! And of course don’t forget to use and showcase the Open Clipart Library at your CFD event!

Celebrate Free Culture with us on May 17!

Culture Freedom Day Registration is on!

Register your CFD event now!

We have just announced that for its third edition Culture Freedom Day‘s registration is ready and awaiting all the passionate organizers to come and be known! As usual the event is planned for the third Saturday of May (the 17th) and appearing on the events map only requires to create an event page under the CFD wiki and fill up the registration form. Then of course you’ll be challenged between finding Free Culture artists in your area and presenting their work, or selecting one of the many projects published under a Free License and showing it to your audience. We are sure a lot of passionate discussions will follow and you’ll be delighted to explain the ins and outs of Free Culture! As Free Culture is indeed one of the most accessible form of art and development issued from the Free Software philosophy, one also used by million if you think of WikiPedia or indirectly Creative Commons, and those are just a few obvious examples!

So all the best for CFD 2014 and see you in two months to party!

Today is Hardware Freedom Day!


For its second edition Hardware Freedom Day is happening with over 40 registered teams and one more sponsor in the name of LulzBot offering 8x3D printers for the event, product which has been RYF-certified by our partner the FSF. Canonical, Google and Linode are of course still part of our long term sponsors and we are trying to reward all our supporters as well. You can find more details on that by looking at the HFD website. So what could you do today? Quite simple, you’re either organizing an event and then you probably hardly have the time to read this message, or you are interested by the concept of Libre/Open hardware and should direct yourself towards our global map to see if there is anything happening in your area. If all the events are too far, then you can check the hackerspaces website and locate a Libre/open hardware hacking place near you. Hopefully you will be able to find something to satisfy your thrust and we wish you the best possible Hardware Freedom Day!

A six classes OS kernel development course

Since year 2010 after I joined Taobao (a subsidiary of Alibaba Group), I help my employer to build a Linux kernel team, to maintain in-house Linux kernel and optimize system performance continuously. The team grew from 1 person to 10 persons in the next 2 years, we made some successful stories by internal projects, while having 200+ patches merged into upstream Linux kernel.

In these 2 years, I found most of programmers had just a little concept on how to write code to cooperate with Linux kernel perfectly. And I found I was not the only person had similar conclusion. A colleague of mine, Zhitong Wang, a system software engineer from Ali Cloud (another subsidiary company of Alibaba Group), asked me whether I had interest to design and promote a course on OS kernel development, to help other junior developers to write better code on Linux servers. We had more then 100K real hardware servers online, if we could help other developers to improve 1% performance in their code, no doubt it would be extremely cool.

Very soon, we agreed on the outline of this course. This was a six classes course, each class taking 120 ~ 150 minutes,


  • First class: Loading Kernel

This class introduced how a runnable OS kernel was loaded by boot loader and how the first instruction of the kernel was executed.

  • Second class: Protected Mode Programming

This class introduced very basic concept on x86 protect mode programming, which was fundamental to rested four classes.

  • Third class: System Call

This class explained how to design and implement system call interface, how priority transfer was happened.

  • Forth class: Process scheduling

We expected people was able to understand how a simplest scheduler was working and how context switch was made.

  • Fifth class: Physical Memory Management

In this class people could have a basic idea that how memory size was detected, how memory was managed before buddy system initialized, how buddy and slab system working.

  • Sixth class: Virtual Memory Management

Finally there were enough back ground knowledge to introduce how memory map, virtual memory area, page fault was designed and implemented, there was also a few slide pages introduces TLB and huge pages.


In next 6 months, Zhitong and I finished first version of  all slides. When Alibaba training department knew we were preparing an OS kernel development training, they helped us to arrange time slots both in Beijing and Hangzhou (Alibaba Group office location). We did the first wave training in 4 months, around 30 persons attended each class. We received a lot of positive feed back beyond our expectation. Many colleagues told me they were too busy to attend all these six classes, and required us to arrange this course again.

This was great encouragement to us. We knew the training material could be better, we yet had better method to make audience understand kernel development more. By this motivation, with many helpful suggestions from Zhitong, I spent half year to re-write all slide pages for all six classes, to make the materials to be more logical, consistent and scrutable.

Thanks to my employer, I may prepare course material in working hours, and accomplish the second wave training earlier. In last two classes, the teaching room was full, even some people had to stand for hours. Again, many colleagues complained they were too busy to miss some of the classes, and asked me to arrange another wave sometime in future.

This is not an easy task, I gave 6 classes both in Beijing and Hangzhou, including Q&A it was more than 30 hours. But I decide to arrange another wave of the course again, maybe start in Oct 2014, to show my honor to all people who helped and encouraged me :-)

Here you may find all slide files for these six classes, they are written in simplified Chinese.
[There are more than enough document in English, but in Chinese the more the better ]

* Class 1: osdev1-loading_kernel
* Class 2: osdev2-protected_mode_programming
* Class 3: osdev3-system_call
* Class 4: osdev4-process_scheduling
* Class 5: osdev5-physical_memory_management
* Class 6: osdev6-virtual_memory_management

Speaking at FOSSASIA 2014 tomorrow!

fossasiaI will be giving a talk tomorrow at FOSSASIA 2014 in Phnom Penh, Cambodia about my work in Open Education. The talk (entitled “Let’s Raise Kids Up”) will be part of the opening keynotes. It will give a quick introduction of the Greenboard project and all the works done around Beijing since 2007. I will also be joining the panel discussion about Women in IT together with Hong Phuc Dang (FOSSASIA), Cat Allman (Google), Sindhu Sundar (GNOME), Sneha Priscilla Makini (GNU Mailman) and Richa Jain (Mediawiki).

If anybody is interested in deploying free and open source projects in schools, I am running a workshop on 1st March (10am) too. I will present all the tips we discovered the hard way from running our own open education project ranging from hardware donation, curriculum design to using Free Software and customizing or translating the possible solution. It will of course talk about GNU/Linux, some of the GNOME and KDE educational applications we are using as well as putting it all together and allowing teachers to control the classroom.
Thanks for Mario Behling and Hong Phuc for hosting such a great event! And of course thanks for FOSSASIA sponsoring my trip to participate!

Introducing Greenboard to Teach For China

greenboard-bannerThanks to Education Freedom Day, we started a conversation with a local NGO here in Shantou, Teach For China which is non-profit working on Chinese education inequity and founded in 2008. They are currently looking at developing some e-learning solutions with the schools they are involved with this year and we have been invited to present Greenboard during their mid-year professional development conference. The conference is happening this weekend (22/33 February) in Shantou, China and we will most likely spend the whole Sunday discussing with their fellows. As we already had a pre-meeting last weekend we feel there are a lot of things which could be used from the work we did in the Beijing area and we are looking forward to share our experience on the matter. Hopefully, we’ll have more to tell soon!

Hardware Freedom Day celebrations 15 March 2014


For its second edition Hardware Freedom Day will be celebrated on March 15th (Saturday) this year. The HFD 2014 registration has been launched about a month ago and the map of currently registered event is available here! This day’s purpose is to get your area familiar with your work and get them interested to join and participate. Should you be a hackerspace or simply a FLOSS user group without a space but with motivation and projects it’s a great opportunity to make the extra effort and get more people to know about what you’re doing.

For registration, simply create a wiki page and fill up this form. Please also make the event shine by using our HFD countdown and banners.

If you want to get some insights for your HFD events, we have had a few ideas submitted to the mailing list to enhance the celebration and we definitely need to see how those can be implemented. In the meantime, get your team ready, your hackerspace (or not) in order and celebrate HFD with us!

Celebrate Hardware Freedom Day with us on March 15, 2014!

InterlockedCompareExchange128 on linux

The GCC that comes with my Fedora installation doesn't appear to have a __sync_val_compare_and_swap that works with __uint128_t, so here it is:
#undef NDEBUG
#include <assert.h>

inline __uint128_t InterlockedCompareExchange128( volatile __uint128_t * src, __uint128_t cmp, __uint128_t with )
  __asm__ __volatile__
      "lock cmpxchg16b %1"
      : "+A" ( cmp )
      , "+m" ( *src )
      : "b" ( (long long)with )
      , "c" ( (long long)(with>>64) )
      : "cc"
  return cmp;

int main(int argc, char* argv[])
  __uint128_t a=0, b=0, c=0x0123456789ABCDEFULL;
  c <<= 64;
  c |= 0xFEDCBA9876543210ULL;
  assert(b == InterlockedCompareExchange128(&a, b, c));
  assert(a == c);
  assert(c == InterlockedCompareExchange128(&a, b, b));
  assert(a == c);
  assert(c == InterlockedCompareExchange128(&a, c, b));
  assert(a == b);
  assert(b == InterlockedCompareExchange128(&a, c, c));
  assert(a == b);
  return 0;

Booting to XBMC under LXDE

I recently reinstalled my HTPC using Fedora 19 and, of course, installed XBMC on it.

Here's how to get Fedora to boot to XBMC without login.

First, configure your desktop manager to auto-login. In my case that is LXDM and it's configured by editing /etc/lxdm/lxdm.conf and adding/changing the line containing autologin=USER with USER being the username of the local user you want to run XBMC as.

Next, change the desktop manager for your user to XBMC. If you install XBMC using the Yum package you should have gotten /usr/share/xsessions/XBMC.desktop so it's enough to create a file called .dmrc in the user's home folder.
cat >~/.dmrc
(End by pressing CTRL-D)

Finally, to prevent XBMC from using CPU when on the home screen, disable the RSS feed by editing the settings for the default skin. Edit ~/.xbmc/userdata/guisettings.xml and change enablerssfeeds to false.

Reboot to confirm XBMC does indeed start automatically after boot and run top remotely to check the CPU usage.

One week to Education Freedom Day

OBPlogoAs Education Freedom Day is just around the corner I would like to highlight a few of the possibilities of participations during that day. I am indeed very happy to see projects contributors getting involved and I would like to highlight the Open Book Project lead by Jeffrey Elkner, Kevin Cole and a few others running their own event in Washington, DC. The Open Book Project has for us some special significance as I am also involved in Free Software advocacy and running educational groups which cover how to program at a young age. Definitely learning to code early enough is a good thing for every one as it teaches you the fundamentals of problem solving and logic. I have been using software such as RUR-PLE myself (part of the GNOME Education Suite) but the Open Book Project goes further and provides all kinds of books, tutorials and courses around the Information & Communication Technology with quite an extensive part on Python itself, split well enough not to bore the kids (or at least that is how I feel). Jeffrey Elkner is also involved in the Guido van Robot programming language which is very similar to the RUR-PLE I love. So why do I care about Python in education would you ask? Well that is probably because the language is simple and close enough to the English language and allows you to do wonders at the same time. So rather than learning something that is only useful within its educational context, why not make the slight extra effort to learn something that is also used by real developers? And it is all Free Software!

Of course those materials are usable by either teachers, students or self-learners and EFD will be a day where you can either join the team in Washington DC or get in touch with them and see how you could contribute without being on site.

openhandbookYet another day and another project needing some love on Education Freedom Day: the Open Education Handbook! Started in September 2013 and initiated by the Open Education Working Group from the Open Knowledge Foundation, the Open Education Handbook initially intended to cover Open Data use in education but has quickly evolved into a document extending to the different aspects of open education, such as resources, data and culture and how those fit together. While it is currently the second version, the targeted final release is for October 2014.

So on Education Freedom Day, the people from Campinas in Brazil, together with interested participants either locally or remotely, will work on a Portuguese translation of the Open Education Handbook. Note that the event is actually happening on Monday 20 January and should you not live in the area feel free to contact them through our Portuguese mailing list. Of course if you are more generally interested in contributing to the Open Education Handbook then looking at the Open Education Working Group mailing list is probably a good way to start.

Celebrate EFD with us on January 18, 2014!Education Freedom Day is happening in many other places and can be a very good way to get involved in Free Educational Resources building or advocacy. In the coming days I will highlight other projects as well. Stay tuned!

Education Freedom Day celebrations 18 January 2014

EFDDigital Freedom Foundation is at it again as we announced last August and we are finally launching our new celebration around Free Educational Resources called Education Freedom Day. The day selected is January 18th 2014 (Saturday) which we believe to be mid school year and a good time to evaluate what has been done and to look at what else could be added. We really hope this can provide a great introduction to educators, professors, teachers and anybody else involved in the education industry about what Free Educational Resources (FER) is, its benefits and how vibrant your local community is.

In the meantime, we are getting more involved with Polytechnic University in Hong Kong thanks to Graham and started to work on our EFD event in Hong Kong. We plan to cover Free and Open Source Software, Hardware and Content for educational purposes by introducing Arduino, Raspberry PiGNOME educational software (e.g. Rur-ple & GCompris) and of course some great international and local Free Educational projects.

Please help us to promote EFD by using our EFD countdown and bannersIf you have contacts with either your local schools, colleges, universities or some open education projects please visit the EFD wiki, create your event page and register your event! If you have any question, please join and ask our EFD mailing list or IRC channel #efday @ Freenode.

Happy Education Freedom Day!
Celebrate EFD with us on January 18, 2014!

Google Code-in 2013 is launched!

GCI-2013-bI would like to share with you that Google (long term sponsor and supporter of the Digital Freedom Foundation) has launched its Code-in 2013 program, an online contest to introduce 13-17 year old pre-university students to free and open source software development. The contest is similar to the Google Summer of Code program for older students in that it gives participants the opportunity to work with mentors from carefully chosen free and source software projects on real-world coding and related tasks like QA, documentation and more. Over the last 3 years over 1200 students from 71 countries have participated. Google hope to expand the program this year and would appreciate your help and that of the members of your community to spread the word to girls and boys around the world.

The contest begins on Monday, November 18th 2013 and runs through January 5th, 2014. Prizes for participating – online only! – in the contest include certificates, tee-shirts, and an all-expenses paid trip to Google headquarters in California, USA for 20 Grand Prize winners with a parent or legal guardian.

You can learn more by watching a screencast and/or a short video describing the contest here and by visiting the program site for complete details here. You can also download a flyer about the program here. Please help to spread the word and get more students involved in FOSS by joining the Google Code-in program!

Meet the Guangzhou LUG

guangzhoulugWe happened to be in Guangzhou earlier this week and spent a wonderful evening with the core members of the local GNU/Linux user group in Guangzhou. They gave us an overview of their group history and progress: basically it is a two years old group with over 700 people subscribed to their mailing list and around 5 core members to manage the group activities. They host regular meetings on a monthly basis in different locations such as restaurants or classrooms. They also organized Software Freedom Day events the past two years and recorded over 100 participants in 2012. While we shared our experiences of how we ran and grew the Beijing GNU/Linux User group with them.

They also mentioned that half of their members are interested in “free” hardware highlighting the growing connection between two movements that we feel very linked. In fact we cannot ignore the fact that hardware needs software to operate and a bit of free culture to make those logos, the documentation and the potential courses that go together to bring it to more people. Each of the movements (software, hardware, culture, OER) should care equally about each others in order to exist as they need one another to thrive. I truly believe that bringing those concepts as one within our communities and to the world will create a bigger impact for everyone.

To conclude, Guangzhou LUG wants to grow in terms of attending members and meeting frequency so we offered to put them in touch with the Shantou Linux Association as they are planning for their upcoming activities right now, and sharing ideas can’t hurt. Besides, there are five universities in Guangzhou with computer science classes which are located in the same area and could become a very prosperous ground for cooperation and activities. That’s another lead right there!

In light of all those discussions and plans we will be hosting a round table discussion mid December on our next visit to Guangzhou. We hope that getting members from each university and setting up a plan together will create a more diverse group in the area with a more balanced workload for everyone.

I am always very happy to meet passionate people from different communities and can’t wait to meet them again soon!

Digital21 Consultation Hong Kong

digital21-2013NovEnd of October saw us visiting Hong Kong another time. While we will not attend the OpenStack Summit the main purpose of our visit was to attend a round table discussion on the government’s digital 21 consultation organized by Charles Mok office and Hong Kong in-Media. We were actually introduced to in-Media by our nice friends from Google and asked to give an overview on Open Data and Open Source, while other participants covered the other fields mentioned in the document.

OpenData has already started in Hong Kong and the government seems to be interested to push the adoption further. While this is a rather positive move, the government probably needs to put some efforts on standardization and improving both the quality and the feedback loop on the available data. On our side we were lucky enough to be assisted by Pia Waugh, former president of Software Freedom Internation and now working for the Australian government implementing Open Data.

(Free and) Open Source unfortunately is not mentioned at all in the document and we covered how important it is for governments to support the effort and what others have been doing for the past ten years. Hong Kong is probably a place where software is mainly imported and the only way to get tailor-made applications which Hong Kong companies can expect specific functionalities to cover their needs is by using Free Software. Not to mention that the government is also planning to bring programming to primary and secondary schools as well as boost start-ups and the SME business in general.
Overall we had a thorough and lengthy debate on those matters and I felt our points were well perceived. We have been recommended to push the discussion directly with the department who wrote the proposal and are now preparing for our next meeting.

In the meantime you can take a look at the slides I wrote to guide the debate here: digital21hk-comments-on-opendata-opensource

Planet BLUG

Planet BLUG is a window into the world, work and lives of Beijing LUG members and contributors.

Updated on February 28, 2015 - 08:20 UTC.
Entries are normalised to UTC time.


Atom 0.3
RSS 1.0
RSS 2.0


Brought to you by the Planet aggregator, cron, Python, CANDIS Group (who kindly host the BLUG server). Beautiful template adapted from an early design by Steven Garrity, concept by Seth Nickell and Diana Fong.

Planet BLUG is edited by Fred. Please contact him if you have a question or would like your blog added to the feed.