Meet us every second Tuesday of the month!
Text Size
   

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

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:

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 GNOME.asia 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!

efd-banner

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


Reboot

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, "*.google.com") || host == "google.com") {
    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 192.168.1.1:8888:127.0.0.1:8888 -i /root/.ssh/id_rsa user@example.com'
    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 google.com


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 kernel.org at https://www.kernel.org/pub/linux/kernel/v3.x/
  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_TCP_CONG_ADVANCED=y
    CONFIG_TCP_CONG_BIC=m
    CONFIG_TCP_CONG_WESTWOOD=m
    CONFIG_TCP_CONG_HTCP=m
    CONFIG_TCP_CONG_HSTCP=m
    CONFIG_TCP_CONG_HYBLA=m
    CONFIG_TCP_CONG_VEGAS=m
    CONFIG_TCP_CONG_SCALABLE=m
    CONFIG_TCP_CONG_LP=m
    CONFIG_TCP_CONG_VENO=m
    CONFIG_TCP_CONG_YEAH=m
    CONFIG_TCP_CONG_ILLINOIS=m
    CONFIG_DEFAULT_CUBIC=y
    # 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 meetup.com 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)
  • meetup.com 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.

TIL tac

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'

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!

web-banner-chat-we-re-organizing-h

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
HOOKDIR="/var/cache/pbuilder/hook.d"
BINDMOUNTS="/home/ubuntu/pbuilder/sid_result"

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>

References

https://wiki.debian.org/PbuilderTricks
http://pbuilder-docs.readthedocs.org/en/latest/faq.html#using-special-apt-sources-lists-and-local-packages

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:
http://lunesu.com/ansible.yml

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

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 http://www.softwarefreedomday.org. 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!

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%';

Hack a fan – 自製空氣淨化器

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

說回這個 workshop,它是由一位在北京做研究的美國心理學博士生 Thomas Talhelm 舉辦的。話說他對北京的空氣污染很擔心,但又發現市面上的空氣淨化器貴的離譜,所以就開始着手研究自製淨化器,然後把結果發表到 http://particlecounting.tumblr.com/。目前他做了兩款,一款售價 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:

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:

6

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: http://creativecommons.org/weblog/entry/4101

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

http://projectnaptha.com/ – 是几个小时前发布的超酷项目,装一个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!

hfd-banner2

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

hfd-banner2

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
[Desktop]
Session=XBMC
(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

SFD2013@ Shantou University

Group photos with the STU Linux Association members.

Group photo with the STU Linux Association members.

After organizing the SFD event in Hong Kong in PolyU, Fred and I were invited to join another SFD event hosted by the Linux Association from Shantou University (STU). We had the pleasure to meet an associate professor of the Computer Science Department, Mr. Liao who is actually a Free Software user himself. The three of us gave presentations about different topics related to software freedom: Fred began with introducing what is Free Software and why it is important, he gave an overview on how the audience could benefit from using and contributing to any Free Software project, including GSoC for next summer. Then I talked about who and what makes Free Software, I started with a quick history review of Free Software and followed by how the audience could get involved and contribute to the community (I reused the slides created by Mathieu for SFD Hong Kong 2013). Mr. Liao presented his experience with Free Software and GNU/Linux as well as introduced a lot of great Free Software projects to the audience.

The event ended up with local desserts and lots of great discussions about how to strengthen the Shantou Linux Association. We also agreed to follow up with core members meetings and mailing list in the following weeks. From what we learnt, they are having a meeting today to kick-start the discussion! By having a professor involved in the process, I believe it can definitely help to build awareness of Free Software in STU. We are definitely looking forward to our next meeting together and committed to help them grow stronger and bigger.

SFD Hong Kong, we had so much fun!

I have been helping to organize a lot of SFD events in mainland China for almost a decade now. Being born and raised in Hong Kong, I was indeed very exited to organize my first SFD in my home town. It was a half day event starting at 13:15, we arrived at the venue at 11:00 to set it up and did some last minute promotion. As for myself I hosted a BoF about building communities in Hong Kong. Since I was told it lacks strong FLOSS communities locally we are considering to start one. Nick Jones from Network Box offered us a venue while Michael Iannini offered to run meetings in Wan-chai (different area so we still need to bridge the two proposals). There are still a few details to be ironed out but it’s a very positive start. Besides, from Naruhiko’s presentation, we learnt that the LibreOffice Japanese team is made of 50 people, so not so much in proportion to the project.

Below you can find snapshots of the great moments, please enjoy!

A huge thank you go to our sponsors, our speakers, our workshop hosts, our exhibitors and especially our volunteers, they are Graham, Michael, Mathieu, Jacqueline, Oi-to, Amity, Ray, See-ming, Messy, Cameron, Guo-feng, Hu-zhou, Xi-lin, etc. Right after the event, I received a lot of thank you notes from our speakers and volunteers for organizing the event and having them to participate. In fact without YOU it would have been impossible to have such a wonderful event! THANK YOU!

There were seven booths including LibreOffice, Stroke5, Blender, GNOME, Fedora, LinuxPilot and HKLUG.

Our exhibitions included LibreOffice, Stroke5, Blender, GNOME, Fedora, DFF, LinuxPilot and HKLUG.

Fedora 20 with GNOME 3.1 was demonstrated in our SFD HK 2013 event.

Fedora 20 with GNOME 3.10 was demonstrated in our SFD HK 2013 event.

An old friend from Beijing, Michael who is the BLUG founder. He was good in bringing the atmosphere up.

An old friend from Beijing and the BLUG founder, Michael was good in bringing up the atmosphere!

Graham from PolyU and DimSumlab, helped us in getting the venue for free and gave an introduction speech to kick start our event.

Graham from PolyU / DimSumLabs, helped us in getting the venue and gave an intro-speech to kick start the event.

Naruhiko Ogasawara, LibreOffice Japan team, came all the way to share with us their project and community in Japan.

Naruhiko from the LibreOffice Japan team, shared with us the project and community in Japan.

TK Kang talked about OLPC and announced his upcoming OLPC BaseCamp event in Malacca on 16-18 November 2013.

TK Kang talked about OLPC and announced the OLPC BaseCamp event in Malacca on 16-18 November 2013.

Nick Jones introduced us how NetworkBox Corporation is profiting from Free and OpenSource software.

Nick Jones explained how Network Box Corporation is profiting from FLOSS.

Fred introduced the Google Summer of Code program to some students during the event.

Fred introduced the Google Summer of Code program to students to join.

A BoF was hosted to discuss about building a stronger FLOSS community in Hong Kong

A BoF was hosted to discuss about building a stronger FLOSS community in HK.

sfdhk2013

At the end of the event we invited all the speakers to come to the stage to do a wrap up.

We finished the event with beer and local food in Tsim Tsha Tsui East and heading home at 2am with big smile on our face.

We finished the event with beer and local food in Tsim Sha Tsui East and left at 1am with big smiles on our faces.

 

"SECURITY_ATTRIBUTES for everyone!"

I keep having to Google this, so I thought it'd just put it up here. This piece of code creates a SECURITY_ATTRIBUTES (and SECURITY_DESCRIPTOR) for the Everyone group. Handy for some quick-n-dirty hacking, but probably A Bad Idea for anything else.

SECURITY_DESCRIPTOR SD;
InitializeSecurityDescriptor(&SD, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(&SD, TRUE,(PACL)NULL, FALSE);

SECURITY_ATTRIBUTES sa = {0};
sa.nLength = sizeof(sa);
sa.bInheritHandle = FALSE;
sa.lpSecurityDescriptor = &SD

watch for the fish shell

The following command is used to watch the progress of files being updated in a directory.

watch 'du -h *| tail -20 | cut -c -$(($COLUMNS-5))'

cut is used so we don't get linewraps in the output. And we need to subtract 5 from the width because there is a tabstop in there which cut counts as 1 instead of the width of the tabstop (which is 8 minus the width of the size column)

This command works fine as long as files are updated in alphabetical order, but when this is not the case we need to sort files by time.

We need to do something like this instead:

watch 'du -h $(ls -tr)| tail -20 | cut -c -$(($COLUMNS-5))'

Unfortunately this only works if the filenames don't contain spaces.

fish handles spaces in filenames just fine:

du -h (ls -tr)| tail -20 | cut -c -(math $COLUMNS - 5)

So instead of trying to find a solution for dealing with spaces in bash, lets just use a better shell, shall we?

However, watch insists on executing the command with sh -c, so we need to devise our own watch loop for fish instead. That's not really hard:

while true
  clear
  du -h (ls -tr) | tail -20 | cut -c -(math $COLUMNS - 5)
  sleep 2
end

Unfortunately using clear causes an annoying flicker, especially if the du command takes a bit longer.

ANSI escape-sequences help:


clear
while true
  echo \e\[H
  du -h (ls -tr) | tail -20 | cut -c -(math $COLUMNS - 5)
  sleep 2
end

This causes the cursor to be moved into the top-left corner without clearing the screen. Now we are almost there. Two problems still:
The tab character used to align the columns does not overwrite anything in its space. Likewise at the end of the line, if the newly written line is shorter then the remaining part of the old line is not cleared.

We can fix this with some sed trickery to clear the path:


clear
while true
    echo \e\[H
    du -h (ls -tr) | tail -20 | sed -e 's/^/\x1b\[K/' | cut -c -(math $COLUMNS - 2)
    sleep 2
end

The ANSI escape sequence ESC[K clears the line just before it is rewritten. This has almost the same effect as clearing the screen, but without the flicker because we only start clearing after du has done its work.
And because the escape sequence adds 3 characters to the output we need to adjust the width accordingly.

At the end we can also add a command to clear the rest of the screen.

Leaves one last issue: $COLUMNS doesn't get updated if the terminal is resized. Granted, it's a nit-pick really, because how often does one resize the terminal. But to make this command generally usable, let's fix this too:


clear
while true
    echo \e\[H
    du -h (ls -tr) | tail -20 | sed -e 's/^/\x1b\[K/' | cut -c -(math (tput cols) - 2)
    echo \e\[0J
    sleep 2
end

This is now pretty usable, so we'll leave it at that. There is still some room for improvement though. For example we could make the line-count flexible based on the terminal height. Also currently we are estimating that the size column is at least 2 characters wide so the tabstop adds at most 5 characters worth of space which cut does not count. Should it be less then we would get a linewrap again and if it is more then we get empty space at the end of the line. cut likely also has problems with multibyte unicode characters. This can probably be solved by switching the terminal in a no-wrap mode while the command is running, or finding a replacement for cut that handles these issues.

Update:

For those who prefer to stick with sh, i found a way how do deal with spaces:

watch 'ls -tr | while IFS= read -r i; do du -h "$i"; done | tail -20 | cut -c -$(($COLUMNS-5))'

OSS feature bounties

I did not like the idea of topic bound donations to OSS projects, but i came to realize that this is not to bad after all to support OSS a bit, but in the direction i like.

The last few days i placed 10 feature bounties each 50 Euro’s on features in various projects that i love to see, but probably never will be realized any time soon. They are just little mini features that i am missing badly in my daily life, but i thought i will try how fast or if at all some of them get implemented.

The nice side effect is that i actually start to work on a few of them myself to avoid a hard hit on my Bank account, a kind of interesting motivation ^_^

GNOME booth in SFD HK 2013

GNOME Booth, photo by http://blog.fedora-fr.org/public/bochecha/Nounours/IMG_0640.JPG

As a GNOME user and fan, knowing that the next major version GNOME 3.10 will be released two days after Software Freedom Day on 23rd September, we are happy to have a booth to showcase GNOME 3.10 on Fedora 20 at our Hong Kong SFD event which will be hosted at PolyU on 21st September, meanwhile I encourage every SFD team to celebrate the new release as well!

While I am still running Fedora 19 with GNOME 3.8.2 I can’t wait to check out the latest version myself with the new features such as maps and music applications, thanks for all the hard works by the GNOME developers, thanks Mathieu for running the booth and of course I will upgrade mine soon! How about you?

Neo4j Server启动失败

最近需要用到Neo4j做个小试验,看似顺利安装却在启动server的时候报错。最终发现问题是JDK1.7安装时,少修改了一个symlink。

我的安装步骤如下:

从Oracle下载了JDK1.7,在~/.bashrc里修改了JAVA_HOME变量。

export JAVA_HOME=/usr/libexec/java_home -v 1.7

检查了一下当前jdk版本。

> source ~/.bashrc
> java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

看起来没什么问题,但实际上并没有完成。在/System/Library/Frameworks/JavaVM.framework/Versions 下有一个 CurrentJDK 的symlink,仍然指向JDK 1.6的路径。

如果没有修改symlink,则neo4j启动时报错。

> neo4j start
Using additional JVM arguments:  -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties 
-Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties 
-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dneo4j.ext.udc.source=homebrew
Starting Neo4j Server...WARNING: not changing user
process [29976]... waiting for server to be ready.... Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.

需要执行一下命令:

> cd /System/Library/Frameworks/JavaVM.framework/Versions
> sudo rm CurrentJDK
> sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/ CurrentJDK
> ls -l CurrentJDK
lrwxr-xr-x  1 root  wheel  59 Aug 31 01:58 CurrentJDK -> /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/

这时

> neo4j start
Using additional JVM arguments:  -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties 
-Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties 
-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dneo4j.ext.udc.source=homebrew
Starting Neo4j Server...WARNING: not changing user
process [33636]... waiting for server to be ready....... OK.
Go to http://localhost:7474/webadmin/ for administration interface.

Neo4j Server顺利启动。网上看到有不少人报类似的错,但原因不全是JDK路径问题造成。

参考:

SFD Hong Kong getting in shape!

This photo is licensed under an open license - CC-by See-ming Lee

It is with great pleasure that we are opening an optional registration for our Software Freedom Day event in Hong Kong on September 21 at Hong Kong Polytechnic University. It means that first the schedule is positively progressing, while knowing how many of you will attend will allow us to plan accordingly. We are aiming 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. Fedora, LibreOffice, Blender, Stroke 5, Greenboard) to allow for more individuals discussions. All in all it’s been a joy working on this event, allowing us to talk and plan resources with people from the US, Netherlands, France and Japan, not to mention discovering a great bunch of passionate FOSS people like us in our backyard.

Still, almost 4 weeks to go and plenty of time to get great surprises! If you happen to be in Hong Kong on 21 September, please do register and drop by!

web-banner-chat-we-re-organizing-h

openSuSE Conference 2013 in Thessaloniki, Greece

osc-logo

In recent months, I worked on hard disk I/O latency measurement for our cloud service infrastructure. The initial motivation is to identify almost-broken-but-still-work hard disks, and isolate them from online services. In order to avoid modify core kernel data structure and execution paths, I hacked device mapper module to measure the I/O latency. The implementation is quite simple, just add timestamp “unsigned long start_time_usec” into struct dm_io, when all sub-io of dm_io completed, calculate latency and store it into corresponded data structure.

4 +++ linux-latency/drivers/md/dm.c

13 @@ -60,6 +61,7 @@ struct dm_io {
14 struct bio *bio;
15 unsigned long start_time;
16 spinlock_t endio_lock;
17 + unsigned long start_time_usec;
18 };

After running on around 10 servers from several different cloud services, there are some interesting data and situation observed, which may be helpful for us to identify the relationship between I/O latency and hard disk healthy condition.
It happens that openSuSE Conference 2013 is about to take place in Thessaloniki, Greece, a great opportunity for me to share the interesting data to friends and other developers from openSuSE community.

 

olympic_museum-1 olymplic_museum-2
Thessaloniki is a beautiful costal city, it is an enjoyed experience that openSuSE conference happens here. The venue is a sports museum (a.k.a Olympic Museum), very nice place for a community conference. When I entered the museum one day early, I saw many volunteers (someone I knew from SuSE and someone I didn’t know who were local community members), they were busy to prepare many stuffs from meeting rooms to booth. I joined to help a little for half day, then back to hotel to prepare my talk slide.

 

prepare-0prepare-3 prepare-2

prepare-5 prepare-4 prepare-1

 

This year, I did better, the slide was accomplished 8 hours before my talk, last time in Prague it was 4~5 hours before :-) Much more people showed up beyond my expectation, during and after the talk, a lot communication happened. Some people also suggested me to update the data in next year openSuSE conference. This project is still in quite early stage, I will continue to update information in next time.

coly-talk

This year, I didn’t meet many friends who live in German or Czech Republic, maybe it is because long distance travel and too hot weather. Fortunately one hacker I met this year helped me a lot, he is Olive Neukum. We talked a lot on seq_lock implementation in Linux kernel, he inspired me an idea on non-lock-confliction implementation for seq_lock when reading clock resource in ktime_get(). The idea is simple: if seq number changed after reading the data, just ignore the data and return, do not try again. Because in latency sampling, there is no need to measure I/O latency for every I/O request, if the sampling may be random (lock conflict could be treat as kind of random), the statistic result is still reliable.  Oliver also gave a talk on “speculative execution”, introduced basic idea of speculative execution and the support in glibc and kernel. This is one of the most interesting talks IMHO :-)

oliver
During the conference, there were many useful communication happened, e.g. I talked with Andrew Wafaa about possible ARM cooperation in China, with Max Huang about open source promotion, with Izabel Valverde for travel support program. This year, there was a session talked about openSuSE TSP (Travel Support Program) status update. IMHO, all updates about TSP makes this program to be more sustainable, e.g. more explicit travel policy, asking sponsored people to help as volunteer for organization. Indeed, before TSP mentioned this update, I did in this way for years :-) Thanks to openSuSE Travel Support Program, to help me to meet community friends every year, and have the opportunity to share ideas with other hackers and community members.

volunteer ralf
Like Ralf Flaxa said, openSuSE community has its own dependent power and grows healthily. openSuSE conference 2013 is the first time that it happens in a city where no SuSE office located.  I saw many people from local community helped on vane preparation, organization, management, only a few people are SuSE employees. This is impressive, I really feel the power of community, people just show up, take their own role and lead. Next year openSuSE conference 2014 will be in Dubrovnik of Croatia, I believe the community will continue to organize another great event, of cause I will join and help in my way.

 

[1] slide of my talk can be found here, http://blog.coly.li/docs/osc13-coly.pdf

[2] live video of my talk, http://bambuser.com/v/3754758 starts from 1:17:30

DFF going into Open Education

greenboard-bannerBeing part of the Digital Freedom Foundation, I would like to share with you some good news!

DFF is announcing its inclusion of the Greenboard project, an Open Education project started in China and focusing on adding FOSS equipped computers to primary schools as a tool to their current curriculum. With years of experience pushing Free Software and OER in poor schools the DFF board has acquired great knowledge of the challenges associated with OER in general and specific educational constraints in particular, assets it is taking to promote around the world.

The first phase will be to publicize all its content into English so it is easily transferable to other places in the world with minimum efforts. Once this is done we will then be able to improve and develop more content while eventually starting to localize our resources to specific regions where opportunities arise.

Our current three international days celebrating and promoting Free Software, Free Culture and Open Hardware will be completed by a fourth day to enhance our efforts as well as bring light to the already existing hundreds of similar projects that the world counts today. The first instance of Education Freedom Day will be on January 18th, 2014.

Even, a missing posix command line utility?

I was looking for a utility that would output every byte at an even offset from a file (e.g. skip bytes at odd offset). I couldn't figure out how to do it with dd (from the looks of it, it might not be possible) and ended up writing my own little utility. I was surprised that there wasn't already a utility called 'even', so here it is:
// even, by Lionello Lunesu, placed in the public domain
#include <stdio.h>

int even(FILE * f)
{
  char buf[4096];
  int r, read, wrote;
  while (1)
  {
    read = fread(buf, 1, sizeof(buf), f);
    for (r=1; r<read/2; ++r)
      buf[r] = buf[r*2];
    wrote = fwrite(buf, read/2, 1, stdout);
    if (wrote != 1)
      return 1;
    if (read != sizeof(buf))
      break;
  }
  return 0;
}

int main(int argc, char** argv)
{
  int i, r = 0;
  if (argc == 1 || (argc == 2 && argv[1][0] == '-' && !argv[1][1]))
    return even(stdin);
  for (i=1; i<argc; ++i)
  {
    FILE * f = fopen(argv[i], "r");
    if (f)
    {
      r = even(f);
      fclose(f);
      if (r)
        break;
    }
    else
    {
      r = 2;
    }
  }
  return r;
}

Interestingly, when compiling with GCC on my MBP, this performs better without any optimization flag, getting >440MB/s!

Oh, this is what I needed it for:
$ ./even * | grep -oai "[a-z0-9_]*\.dll"

Allow Google email forwarding through SPF

Use "include:aspmx.googlemail.com" in your SPF record:
yourdomain.com. 300 IN TXT "v=spf1 a mx include:aspmx.googlemail.com -all


Check your /var/log/mail.log to make sure it's working as expected:
Aug 10 08:30:05 pizzapazzi postfix/smtpd[23061]: connect from mail-ob0-f199.google.com[209.85.214.199]
Aug 10 08:30:12 pizzapazzi postfix/policy-spf[23074]: : SPF pass (Mechanism 'include:aspmx.googlemail.com' matched): Envelope-from: xxxxxxxxxx@yourdomain.com
Aug 10 08:30:12 pizzapazzi postfix/policy-spf[23074]: handler sender_policy_framework: is decisive.

basic http file server

I needed to quickly serve some files, and i didn't want to install a full webserver, knowing that this was only temporary. So instead here is a simple http file-server in Pike. I call it a file-server because it serves static files, and nothing else.

Based on this example for a simple web-server, it just takes a few additions to turn this into a file-server:

#!/usr/local/bin/pike

constant default_port = 8080;
constant my_version = "0.0";

Protocols.HTTP.Server.Port port;

string basedir = "/srv/www";

int main(int argc, array(string) argv)
{
  int my_port = default_port;
  if(argc>1) my_port=(int)argv[1];

  write("SocServe starting on port %d\n", my_port);

  port = Protocols.HTTP.Server.Port(handle_request, my_port);
  return -1;
}

void handle_request(Protocols.HTTP.Server.Request request)
{
  write(sprintf("got request: %O\n", request));

  mapping response = ([]);

  response->server="SocServe " + my_version;

  string target = Stdio.append_path(basedir, request->not_query);
  mixed tstat = file_stat(target);
  write("target: %O\n", tstat);

  if (tstat 
&
& tstat->isdir)
  {
    response->type = "text/html";
    response->error = 200;
    response->data = dirlist(target);
  } 
  else if (tstat 
&
& tstat->isreg)
  {
    response->type = MIME.ext_to_media_type((target/".")[-1]) || "octet/stream";
    response->error = 200;
    response->file = Stdio.File(target);
  }
  else
  {
    response->type = "text/html";
    response->error = 200;
    response->request = sprintf("%O", mkmapping(indices(request), values(request)));
    response->data = "<h1>SocServe " + my_version + "</h1>n<pre>"
    + response->request + "</pre>n";
  }

  request->response_and_finish(response);
}

string dirlist(string path)
{ 
  array dir = get_dir(path);
  return sprintf("%{<a href=\"%s\">%s</a><br>\n%}", ({ dir[*], dir[*] })); 
}

These are the changes: first combine the request path with our basedir which will reduce any embedded /../ to not go beyond that base. Then we check if it's a directory or a file. For a directory we make a simple listing, and for a file we find the mime-type and then just open the file and pass it to the request. This will cause the file to be served with non-blocking I/O, allowing you to handle multiple requests in parallel without blocking the server while a file is being downloaded.

That's all there is to it. Start it up, and it's ready to serve files.

Great to meet you in GNOME.Asia 2013 in Seoul

I might be the latest one to write report after attend the GNOME.Asia, but that does not mean I do not taken it sincerely. To attend GNOME.Asia always give me opportunity to meet many GNOMERS and participants and have a very wonderful experience. My buckets are full of spiritual rewards. Some by the generous spirite of sharing from others, some learned, some my humble creation.

I’d like especially to thank Eric Sun, Which I missed his topic “The soul’s code of Taiwan campus” in the conference, and he gladly showed his presentation with me alone after his speech:) I like Eric Sun’s creativity design for the Ezgo, and like his passion in Ezgo.

I also want to thank Max and Karen, Max always encouraging me on my speech. Karen, she actually came to listened my speech “Web design done in GNOME and how I did my last GOPW”, despite my poor delivery:) I also enjoyed the talk with her.

In my speech “Web design done in GNOME” I started with my own story to show how I getting in touched with Opensource, and introduced my paraphernalia of my web design work: GIMP, Inkscape, jEdit, fileZilla.

Also, I was glad to see my design elements in GOPW have been used in GNOME.Asia :)

BTW: I found, especially in Adacamp, women geeks tends dress alike. A typical ensemble include a T-shirt, jean, sports shoes, a pair of glasses. That is, they dress like male geeks. This time, I thought since my naive existence is an unavoidable reduction to the entropy of geeky heat, I might as well be hanged for a sheep as a lamb, so I dressed a red dress with flowery ribbon, my usual ensemble. It isn’t exaggerated dressing at all, nevertheless sparked curiosity. Some tried to verify that I am not a programmer, and succeeded;) perhaps before getting his wager. Should I bash the bias of perceiving women geeks, mostly also feminists, as unfeminine, or did it backfire, having myself tagged as a naive non-programmer? In other words, should I fight by dressing like not fighting at all? [Yes, my husband tightened this paragraph for me. It had been much longer.]

Thanks GNOME Foundation sponsored me to attend the GNOME.Asia in Seoul, thanks the Taiwan and local organizers who have held such a great event for us.


GPG key transition: 7BD22F74 → D28DA8DC

I should have transitioned my old GPG key to a stronger one for long time, it’s finally done today, with the help of here and here. You can find my signed letter at http://ubuntuone.com/6O2OCf1rg9ulw1eWi13zc2. I am also copying the letter below for your convenience.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256,SHA1

Due to rapid advancement of computing, my old 1024-bit DSA GPG key,
which was created 14 years ago in 1999, has long been deemed insecure.
Therefore, I am transitioning to a much stronger 8192-bit RSA key, by
using a slightly modified gnupg in [1], as the default gnupg does
not allow creation of keys greater than 4096-bit. Hopefully this new
key can survive much longer.

The old key will continue to be valid for some time, but I prefer all
future correspondence to come to the new one. I would also like this
new key to be re-integrated into the web of trust.  This message is
signed by both keys to certify the transition.

If you have signed my old key, I would appreciate signatures on my new
key as well, provided that your signing policy permits that without
reauthenticating me.

The old key, which I am transitioning away from, is:

pub   1024D/7BD22F74 1999-09-12
      Key fingerprint = CD09 4F7B BBEE 93CD 7966  6299 34B3 A9A0 7BD2 2F74
uid          Anthony Y. P. Wong (Personal) <ypwong@ypwong.org>

And the new key is:

pub   8192R/D28DA8DC 2013-06-01
      Key fingerprint = 8DF0 9030 F103 F760 C18C  BA06 605A A53D D28D A8DC
uid          Anthony Y. P. Wong (黃彥邦) <ypwong@ypwong.org>

To fetch the new key from a public key server using GnuPG, run:

  gpg --keyserver pgp.mit.edu --recv-key D28DA8DC

If you have already validated my old key, you can then validate that the
new key is signed by my old key:

  gpg --check-sigs D28DA8DC

If you are satisfied that you've got the right key, and the UIDs match
what you expect, I'd appreciate if you would sign my new key.

A simple and safe way to do that is by using caff (shipped in
Debian/Ubuntu as part of the "signing-party" package) as follows:

  caff D28DA8DC

Alternatively, you can sign the key by using gpg and send it to me (if
you have a functional MTA configured on your system) or upload the
signatures to a public keyserver directly:

  gpg --sign-key D28DA8DC
  gpg --armor --export D28DA8DC | mail -s 'OpenPGP Signatures' \
    ypwong@ypwong.org
  gpg --keyserver pgp.mit.edu --send-key D28DA8DC

Please let me know if there is any trouble, and sorry for the
inconvenience.

[1] https://launchpad.net/~anthonywong/+archive/ppa

Thanks,
Anthony Wong

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQQcBAEBCAAGBQJRqdnMAAoJEGBapT3SjajciuYf/isb8jX/+SXxnxr6veAS4VTL
rKG2Up6cGjAPsfNX4AmKUojiiGzWyqXOa3qTfRReXf2Xl+NroI6jMdN2zBEe4D7J
UZYDzvEVWDhhATbWIqL2mcxZYbInX4sd18UW5cw58Tx+uBATAIHSJdHiLMjLDbvc
uKpbIqwZDC1zgJIV1+vosgtR3KQFO0bJyeqEBMpjvzJ2Zy60ZFgBycNOZL2aIdav
HnbCBSttqdfUE+TuXMgHSSTgx0WUromRa9d4X/OaT+1veX2CRD/K9X+Qt4ac6dop
Tze43U4ns2Ijz8Mwb603rlkh5e+FFfI7VxehCpIPv2oYlpNHYt5BoJbNj5Hl8LYn
6DMmbJSugz5Ov94Q5/QLFPRprnwXRVmHuvm1sbxznQGrCDgJhxVLJuTTTSNjuUiL
5VVwqKJ8RrG8gFcqmcZhG1+U2tQvBfJU/NR7BF6LMqB9FrJNyBTvg0w460XnUiOc
2ZKubdDn7qj7iEhUru4Mmu1yz9tANjYP7ObCxsvWvMOt8basOn1EobgUywIVsQsz
QdCR5SYNvWT7fgKjbpMM6RwTOa7mqOvk+IF9SCgZcSy4KVkLr6PrB0VSNueMy7bz
iJqF+j06ur79/0IHK33iFj02OqXIXG99g6hGm86NgSIlBM0EZwX52O7XmfSfTcg0
DlKuAy/ZBZOltxujkTaUSECWmfRzT2FtGgDsNj9PGZ+RbSTIT0J3/P46Umg55IBq
ptNFg5e0VNSewVT5sQVGxZDesPmrcVH6KjmFI0HYihZp2SUjshoT9TmyeKIdZcGa
PtLKSlhuwVAgEEsMPKQb4x/8xwZa2D5ZuiSOWP0NWptzdE2g2qAMGVttgu19B1+X
Iv9FUts5BYI5xiocbBq0t/MSioEwQG4Q4fBjMltMKu062lXnHNj8bP2W0Z1lBOTy
/GxHRrRnvfdmsWjn5DTfY3Cg5LlOHWMxd0JnCYMrEMrdQb78+1sc/qpbhfW3cKeR
vL8nGw7GZthOLOTVHUMtMthVSvWcymWfuJ4pfwP+Im6PqHmV+aC8GfwsSBDoLjPn
6AkdoinofPTh7RziNK/bJ36qS5QVL4bITeIw5qBYG9cXGSyuX15clK8CiuMG6RqG
1ztp3rQbLp1a0/1fW4xuhZUfUo4kXPYwR5Tm8Emx9dnS1IDk6avbUYMw+30JUqPO
KLCSGQnsjXyBPD6Z+qxENUgk1046JNxUFZLoc9mbbU9CXWKlGDDAoF+moLcWmR4D
BX9JbQAkmTQkuvPuH9x7aYoFSJKcmJ7Zz6PTdD8PHAT0vm92Kg3viIu/2BhoyvyD
oKLf/yQ1d8y1/iZYuyOrnM7eT56BtcvSHlSXQSmyACiB4bR3YYz6SNS2KDjmWWCI
RgQBEQIABgUCUanZzAAKCRA0s6mge9IvdMFJAKDlnUHGERTnlUGTZTB5SH4IREKb
qwCeJy3k6qi6uxBlZqds/4AG6vDmtfE=
=UVhj
-----END PGP SIGNATURE-----

Running QQ on Ubuntu Phone

Courtesy to an open source project called uqq on Github, it is now possible to not only run QQ on Linux, but also on Ubuntu Phone! As Ubuntu phone is still under heavy development, and the current SDK is limited for QML-only apps, it is not an easy task to deploy uqq onto the phone, as it uses C++ for its backend. If you are adventurous, you can follow my steps below.

2013-05-19-03-02-38_photo 2013-05-19-03-31-17_photo 2013-05-19-03-32-01_photo 2013-05-19-03-32-35_photo

1. Get uqq

  1. git clone https://github.com/ginuerzh/uqq

2. Cross-compile uqq C++ plugin

  1. Create an armhf build environment: # pbuilder-dist raring armhf create
  2. Login to the armhf environment: # pbuilder-dist raring armhf login
  3. You are now in a chroot in /var/cache/pbuilder/build/<PID>, where <PID> is the process ID of the command in the last step.
  4. Copy uqq source code to /tmp in the chroot, something like “sudo cp -a uqq /var/cache/pbuilder/build/<PID>/tmp“.
  5. Add QT5 and Ubuntu SDK apt sources:

    # cat << EOF > /etc/apt/sources.list.d/qt5-and-ubuntu-sdk.list
    deb http://ppa.launchpad.net/canonical-qt5-edgers/qt5-proper/ubuntu precise main
    deb http://ppa.launchpad.net/ubuntu-sdk-team/ppa/ubuntu precise main
    EOF


    (apt-add-repository core dumped for me so I had to add the sources manually.)
  6. Install Ubuntu SDK: # apt-get update && apt-get install ubuntu-sdk
  7. Compile the uqq backend plugin: # cd /tmp/uqq/plugin && qmake && make
  8. libuqq.so will be compiled in /tmp/uqq/plugin/UQQ if everything works well.
  9. Copy libuqq.so back to your uqq directory, e.g. # cp /var/cache/pbuilder/build/<PID>/tmp/uqq/plugin/UQQ/libuqq.so uqq/plugin/UQQ/

3. Copy the app to the phone

  1. Connect your phone to the computer via USB.
  2. # adb root
  3. Copy the uqq source code and our compiled plugin to the phone: # adb push uqq /data/ubuntu/home/phablet/uqq
  4. Login to the phone: # adb shell
  5. Type "ubuntu_chroot".
  6. Type "su - phablet" to change to the phablet user.
  7. Now we are ready to run QQ, type "/usr/bin/qmlscene -I plugin /home/phablet/uqq/uqq.qml --desktop_file_hint=/home/phablet/uqq/uqq.desktop".
  8. uqq window should now appear on your phone!
  9. Since ubuntu phone does not ship with any Chinese font, all Chinese characters will be shown as squares. It can be easily fixed by copying /usr/share/fonts/truetype/droid/DroidSansFallback.ttf from any Ubuntu system to the phone's /usr/share/fonts/truetype.

    I still haven't figured out how to add an icon to the launcher for the app, I tried modifying /usr/share/qml-phone-shell/Applications/applications.js, but no luck.

    Hope you find this useful!

Planet BLUG

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

Updated on February 01, 2015 - 02:14 UTC.
Entries are normalised to UTC time.

Subscribe

Atom 0.3
RSS 1.0
RSS 2.0
OPML
FOAF

Credits

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.