<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Caibin Chen on Medium]]></title>
        <description><![CDATA[Stories by Caibin Chen on Medium]]></description>
        <link>https://medium.com/@tigersoldier?source=rss-cd163c4197b3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3zlJDQiynyQ9utn0.jpg</url>
            <title>Stories by Caibin Chen on Medium</title>
            <link>https://medium.com/@tigersoldier?source=rss-cd163c4197b3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:32:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tigersoldier/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Announcing JavaComp]]></title>
            <link>https://medium.com/@tigersoldier/announcing-javacomp-8af971c70b77?source=rss-cd163c4197b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8af971c70b77</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[emacs]]></category>
            <dc:creator><![CDATA[Caibin Chen]]></dc:creator>
            <pubDate>Sat, 07 Oct 2017 14:19:13 GMT</pubDate>
            <atom:updated>2017-10-07T14:28:33.196Z</atom:updated>
            <content:encoded><![CDATA[<p>Today I announce the “release” of <a href="https://github.com/tigersoldier/JavaComp">JavaComp</a> 1.0.0. It provides Java IDE features such as code-completion to editors via a protocol called <a href="https://github.com/Microsoft/language-server-protocol">Language Server Protocol</a>.</p><h3>So what can it do?</h3><p>Version 1.0.0 implements only a small set of features: code-completion, go-to-definition, hover text and method signature. Let’s see how they work in Emacs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*BQ-RLS2f4h6iVhjRzgZUSQ.gif" /><figcaption>Code completion</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*admyIFVPTKIpZdv7kalsZw.gif" /><figcaption>Go to definition</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*5a1ud6FKXzTlguk4fFNkAw.gif" /><figcaption>Hover text</figcaption></figure><p>… and in Visual Studio Code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*K7qYdFf02sr0y5o5fp2NDw.gif" /><figcaption>Method signature</figcaption></figure><p>Those features are not as mature as Java IDEs such as IntelliJ or Eclipse, but way better than the text-based completion provided by Emacs. I use it in my everyday development and feel the productivity improvement.</p><p>My goal is to provide a great out-of-the-box experience. Ideally, you shouldn’t need to configure anything. You just open a file and it just works. Of course it’s not there yet. More specifically, it doesn’t support parsing any external jar files so you have to manually generate type index files form their source code if you want to see completions for the APIs provided by the external jars.</p><h3>What editors does it support?</h3><p>As of Oct 2017 I implemented an <a href="https://github.com/tigersoldier/lsp-javacomp">Emacs package</a> and a <a href="https://github.com/tigersoldier/javacomp-vscode">VS Code extension</a> for JavaComp. Supporting other editors shouldn’t be hard as long as the editor in question supports Language Server Protocol.</p><h3>Why do I make it?</h3><p>Because I love using Emacs but miss the awesome features provided by IntelliJ and Eclipse. Code completion saves me from remembering the APIs. Hover text allows me to have a glance of the type of a symbol or the signature of a method without finding where they are defined. Go-to-definition is very handy for reading code. Some of the features can be achieved by generating TAGS files, but they are not as good as what JavaComp provides, and requires additional configuration for each code repository.</p><p>I know there is <a href="http://eclim.org/">Eclim</a>, but I hate the idea that you need to create a project for each repository you work on. You either need to pollute your code base with project files generated by Eclipse, or add them to the .gitignore file and repeat the project creation process each time you clone it. Neither is configuration-free, let alone you have to configure Eclipse and Eclim to make it work for the first time. In addition to that, I really don’t like Eclipse running in the background for providing the code editing features.</p><p>So I decide to implement those features on my own. Microsoft did a great job documenting the protocol for IDE features they use in VS Code, which is Language Server Protocol. This means I don’t need to worry about defining the API for it. What’s better, it allows me to write it in Java, which means I can use the javac parser to parse the .java files.</p><h3>But aren’t there other options?</h3><p>I know, I know. There are <a href="https://github.com/mopemope/meghanada-server">Meghanada-Server</a>, <a href="https://github.com/georgewfraser/vscode-javac">vscode-javac</a>, and <a href="https://github.com/eclipse/eclipse.jdt.ls">Eclipse JDT Language Server</a>. All of them have more features than JavaComp. So why bother developing a new one?</p><p>Eclipse JDT Language Server have the same problems as Eclim, so it is not an option. I didn’t know vscode-javac existed the time I started to develop JavaComp.</p><p>But I did knew the existence of Meghanada-Server. The only excuse I can make is I was too lazy to configure it. Seriously? Too lazy to spend one day to configure but spent multiple months developing a half baked solution?</p><p>The real reason is I wanted to do it for a long time. I kept imaging Emacs being a great IDE for Java when I was using it. I wanted to implement the features I care. It’s a completely new area for me and I’m excited about it. Finally I decided to work on it. None of the existing solutions can stop me, not unless they meet all my requirements and I am too lazy to develop JavaComp.</p><h3>Will there be new features?</h3><p>Of course! I plan to implement features that can improve my productivity. The missing features I want to have are:</p><ul><li>Cross-reference.</li><li>Inserting import statements on completion.</li><li>Code-snippet for completing methods.</li><li>Support parsing .jar files and .class files.</li></ul><p>The existing features need lots of improvements as well. Just name a few:</p><ul><li>Completing for overriding methods.</li><li>Type inference for lambdas.</li><li>Better generics support.</li><li>Showing javadoc on hover.</li></ul><p>Because I work at Google and the Java development there is quite unique from open-source world, I may prioritize some less common features:</p><ul><li>Support the <a href="https://bazel.build/">Bazel build system</a>, because its internal version is used in everyday development at Google.</li><li>Lazy parsing. Only parse the java files opened by the editor and its dependencies, because the Google Java repository has more than millions of java files and only very few of them are actually needed.</li></ul><p>This is just a hobby project and I have a kid to take care of, so the amount of time I can spend on it is limited. Also, the world is full of distractions and fun stuff :). I don’t guarantee any of the features listed above will eventually be implemented. Let’s see when the next version will be released and what new features come with it.</p><p>Cheers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8af971c70b77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Macbook Pro 2015 with Arch Linux]]></title>
            <link>https://medium.com/@tigersoldier/macbook-pro-2015-with-arch-linux-4f8d3a2c0de5?source=rss-cd163c4197b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f8d3a2c0de5</guid>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[arch-linux]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Caibin Chen]]></dc:creator>
            <pubDate>Sun, 03 Jan 2016 08:01:45 GMT</pubDate>
            <atom:updated>2016-01-03T08:02:08.841Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been using the 2014 version for work for a while and I’m very satisfied with its screen, touchpad and battery life, so I bought a new one for my personal use on this Thanksgiving. Since it’s not issued by my company, I can do whatever I want to it, including installing my favorite linux distro — Arch Linux.</p><h3>Installation</h3><p>I plan to dual-boot both Arch and OS X. OS X is still the best OS for this awesome hardware.</p><p>The last time I installed Arch was on my 2009 Acer laptop, which was still using BIOS. Things has been changed a lot, everybody is using EFI now. Macbook is even more special — It’s using a special EFI implementation that’s not the same as PC laptops. My old experience of partitioning and GRUB installation doesn’t help at all.</p><p>Everything starts from creating a bootable USB with Arch’s ISO image. UNetbootin didn’t work for me. GNOME disk utility worked well. Or, you can simply use dd, as documented on <a href="https://wiki.archlinux.org/index.php/USB_flash_installation_media#Using_dd"><em>USB flash installation media</em> wiki page</a>.</p><p>Arch’s <a href="https://wiki.archlinux.org/index.php/Beginners%27_guide"><em>Beginners’ guide</em></a> and <a href="https://wiki.archlinux.org/index.php/Installation_guide"><em>Installation guide</em></a> still work for most of the cases. The exceptions are, as I mentioned above, partitioning and booting. I followed this article for partitioning and installing GRUB: <a href="http://zanshin.net/2015/02/05/arch-linux-on-a-macbook-pro-part-3-base-installation/"><em>Arch Linux on a MacBook Pro Part 3: Base Installation</em></a>. Keep the <a href="https://wiki.archlinux.org/index.php/MacBookPro11,x"><em>MacBookPro11,x</em> wiki</a> handy, I find it very useful. The generic Macbook wiki doesn’t help though. I still have problems booting into Arch, which I will explain later.</p><p>My choice of desktop environment is <a href="https://wiki.archlinux.org/index.php/GNOME">GNOME</a>. <a href="https://wiki.archlinux.org/index.php/NetworkManager">NetworkManager</a> is a must-have to me. Just simply follow the instructions on the wiki pages. xf86-input-synaptics is less annoying than libinput for touchpad support. I’ll explain it later.</p><h3>Fast to start up, with good battery life</h3><p>Thanks to SSD, starting up the system is pretty fast. It took less than 10 seconds to get to GDM login screen. Sometimes I think it’s faster than booting OS X.</p><p>Battery life is awesome. Gnome underestimates remaining battery time at startup, showing only 3 to 4 hours with full battery. After using it for a while, the estimated battery extends. At the time of writing this section, there is 60% battery with 4 hours 13 minutes estimated battery life.</p><h3>GNOME supports HiDPI out of box, some apps don’t</h3><p>One of the reasons I bought MBP is its retina display. Texts are sharp and UI elements are crisp. GNOME supports HiDPI since 3.10 and improves in 3.12, but I haven’t had chance to try it with my old laptop. It looks great. Both GDM and GNOME Shell render beautiful. With Source Han Sans font (thanks to Adobe and Google), Chinese characters never look so good on Linux. I’m still struggling to find good sans and serif fonts, though :(</p><p>GTK 3-based apps support HiDPI screens well. GTK 2-based apps look less good. Sublime Text and Chrome don’t have appearance issues unless you open and save files — GTK 2 file dialog is ugly.</p><p>WINE doesn’t support HiDPI well. You can change DPI using winecfg, but it only affects texts. I uses it to play Heroes of Might and Magic 3, and it just doesn’t scale up.</p><p>I haven’t tried QT-based apps yet.</p><h3>Touchpad support: this is not what I want</h3><p>Did I mention one of the reasons I bought MBP is its touchpad? I like its smooth, responsive experience, especially the mulitouch gestures that switch among workspaces and trigger Mission Control/Launchpad. There is also a great feature that allows you to use three fingers to drag.</p><p>Chrome also supports OS X touch gestures very well. You can pinch to zoom in/out, use two fingers swiping horizontally to go back/forward. Scrolling is as smooth as mobile devices.</p><p>Let’s see how the touchpad works on Arch.</p><p>If you use Xorg, the first problem is choosing touchpad drivers. There are 3 options: xf86-input-synaptics, <a href="http://www.freedesktop.org/wiki/Software/libinput/">xf86-input-libinput</a>, and <a href="https://github.com/BlueDragonX/xf86-input-mtrack">xf86-input-mtrack</a>. xf86-input-synaptics doesn’t support gestures with more than 2 fingers. xf86-input-mtrack can assign mouse buttons for swipe gestures. xf86-input-libinput supports swipe gestures with 3 or 4 fingers.</p><p>Sounds like synaptics is the worst. However, mtrack is not widely supported, which means you have to install it via AUR, and cannot change the settings in GNOME control center. The gestures supported by libinput are only available in Wayland, not Xorg. What’s worse, libinput <a href="https://bugs.freedesktop.org/show_bug.cgi?id=93367">doesn’t disable touchpad when typing on my MBP</a>. So synaptics is the best choice if you are using Xorg.</p><p>GNOME supports touchpad gestures <a href="https://help.gnome.org/misc/release-notes/3.18/more.html.en">since 3.18</a>. It only supports 4 fingers swiping up/down to swtich workspaces for now. The reason is that Wayland uses libinput as touchpad driver, which only supports 3 or 4 fingers swipe gestures for now. To fix the touch when typing bug in libinput, I forked the code and hacked it. See <a href="https://github.com/tigersoldier/libinput/tree/wip/fix-macbook-dwt">wip/fix-macbook-dwt branch</a>. I also have other branches that <a href="https://github.com/tigersoldier/libinput/tree/wip/disable-tap-to-drag">disable tap-and-drag</a> or <a href="https://github.com/tigersoldier/libinput/tree/wip/three-fingers-dragging">support three-fingers-to-drag</a>.</p><p>As of scrolling, GTK3-based apps seems pretty smooth. Chrome has experimental smooth scrolling support. However, the experience is worse than without smooth scrolling. Firefox has better smooth scrolling than Chrome. Scroll horizontally to go back/forward is not supported by either browser, neither is pinch to zoom in/out.</p><p>To recap, the best option is to use GNOME under Wayland, with my fixes of libinput, and Firefox. We can get three-fingers-to-drag, switch workspace gestures, and arguably smooth scrolling. The missing features are gestures to trigger Activity Overview, pinch to zoom in/out, and scroll horizontally to go back/forward.</p><h3>Suspending is broken due to wifi driver</h3><p>I cannot suspend the MBP because the Broadcom wireless driver, brcmfmac, cannot suspend the device. It can be confirmed by check the logs:</p><pre>$ dmesg | grep brcmfmac<br>……<br>[ 466.167212] brcmfmac: brcmf_pcie_suspend: Timeout on response for entering D3 substate<br>[ 466.167236] pci_legacy_suspend(): brcmf_pcie_suspend+0x0/0x1c0 [brcmfmac] returns -5<br>……</pre><p>The wireless device won’t be working after suspending.</p><p>To work around this problem, disable the driver before suspend:</p><pre>sudo rmmod brcmfmac</pre><p>On wake up, re-enable the driver:</p><pre>sudo modprobe brcmfmac</pre><p>So annoying. People who do this must be true Linux lover.</p><h3>Keyboard layout</h3><p>The “`” key that is left to “1” is mapped to wrong key. You can’t type “`” and “~” by default. The solution is on the <a href="https://wiki.archlinux.org/index.php/Apple_Keyboard#The_.60_and_.7E_keys_output_.3C_and_.3E"><em>Apple Keyboard</em> wiki</a>. Add the following line to /etc/modprobe.d/hid_apple.conf:</p><pre>options hid_apple iso_layout=0</pre><p>The default keyboard layout maps command to super, and option to alt. I swapped them so alt is next to space. A traditional way of doing that is to use xmodmap and write your own .xmodmaprc. However Gnome resets keyboard mapping after login. The alternative way is using gnome-tweak-tool. It’s under Typing section. Note that if you use Wayland, the settings only work with native Wayland apps, such as GTK3 apps (and maybe QT5 apps, haven’t tried yet).</p><h3>GRUB fails to load Linux kernel</h3><p>I use the MacBook’s native EFI bootloader approach for dual-booting described on <a href="https://wiki.archlinux.org/index.php/MacBookPro11,x#Using_the_MacBook.27s_native_EFI_bootloader_.28recommended.29">MacBookPro11,x wiki page</a>. By setting GRUB partition as the boot partition, GRUB shows up by default, but it gets stuck on “loading initial ramdisk”. If you hold option key at start up, it shows a menu to let to choose which disk to boot with. Choose the default one and GRUB works fine. Seems like GRUB sees different disk paths in these two modes.</p><h3>Conclusion</h3><p>The good: Gnome and apps I use support HiDPI screen very well. Battery life is still pretty good. Booting is fast.</p><p>The bad: Touchpad is usable, not awesome. Missing multitouch gestures with 3 or more fingers. Scrolling isn’t smooth.</p><p>The ugly: Problems with booting and suspending. There are workarounds, but pretty irritating.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f8d3a2c0de5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>