<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Holly Becker's Blog</title><link href="https://hollybecker.net/blog/" rel="alternate"/><link href="https://hollybecker.net/feed.xml" rel="self"/><id>urn:uuid:0cfae1bd-06e5-3991-a3f5-777ea6af3c7e</id><updated>2024-05-16T00:00:00Z</updated><author><name/></author><entry><title>How to buy Japanese books (from Kobo)</title><link href="https://hollybecker.net/blog/2024-05-16-buy-japanese-books/" rel="alternate"/><updated>2024-05-16T00:00:00Z</updated><author><name/></author><id>urn:uuid:fb081678-21b6-3083-b5b7-3009858c081f</id><content type="html">&lt;p&gt;I managed to exchange money for books in Japanese!&lt;/p&gt;
&lt;p&gt;I've found it very hard to buy Japanese language media from outside Japan, and ebooks in particular are hard to find in other ways. I have an eReader I like reading on, which means I don't want to use the bookseller's mobile app to read a book, which cuts out most of the options.&lt;/p&gt;
&lt;p&gt;My eReader is made by Kobo, which is owned by Rakuten, which is a Japanese company. This should be easy! I tried using my existing Kobo account to buy from the Japanese Kobo store, but even with a VPN "Japan" didn't appear in the location dropdown. Some searches revealed that you can only say you're in Japan if you log in with a Rakuten ID. The Rakuten ID reportedly can't see Overdrive (which I use to check out library books in Canada), and switching accounts involves resetting the entire device, so that was a dealbreaker for me.&lt;/p&gt;
&lt;p&gt;Time passed.&lt;/p&gt;
&lt;p&gt;My Kobo became flakey (but not unusable) so I got a new one. Now I had a spare mostly-working eReader to mess around with, remembered the above problem, and tried it again.&lt;/p&gt;
&lt;p&gt;Creating a Rakuten ID was straightforward and free. Despite the link being in Japanese (楽天会員登録(無料)) the sign up form itself was in English, which I think was the only part of this process I did in English. I was able to skip entering an address initially, but when I actually bought a book it required one, so I used a hotel that I'd stayed at on the assumption that they won't check and it likely won't matter. I browsed &lt;a href="https://www.kobo.com/jp/ja"&gt;Kobo's Japanese site&lt;/a&gt;, found a book I wanted to purchase, and bought it with my Canadian credit card. I set up my new Rakuten ID account on the eReader, voila! my newly purchased book was there!&lt;/p&gt;
&lt;p&gt;After how much hassle it was the other times I tried and failed, it was almost a letdown that it was this easy, now that I had a dedicated Japanese reading device.&lt;/p&gt;
</content></entry><entry><title>The case of the missing 32-bit Ruby package</title><link href="https://hollybecker.net/blog/2023-08-03-missing-ruby-library/" rel="alternate"/><updated>2023-08-03T00:00:00Z</updated><author><name/></author><id>urn:uuid:ebafa876-3a25-36b9-86f8-abc799aeb79e</id><content type="html">&lt;p&gt;I have access to a 32-bit Arch server that hosts this website and I use Ruby on it to run &lt;code&gt;jekyll&lt;/code&gt; for static site generation. I don't touch it very often, but recently I started getting this exception:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ irb
irb(main):001:0&amp;gt; require "date_core"
&amp;lt;internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb&amp;gt;:85:in `require': cannot load such file -- date_core (LoadError)
        from &amp;lt;internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb&amp;gt;:85:in `require'
        from (irb):1:in `&amp;lt;main&amp;gt;'
        from /usr/lib/ruby/gems/3.0.0/gems/irb-1.4.2/exe/irb:11:in `&amp;lt;top (required)&amp;gt;'
        from /usr/bin/irb:25:in `load'
        from /usr/bin/irb:25:in `&amp;lt;main&amp;gt;'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I reproduced it with just the &lt;code&gt;require&lt;/code&gt;, but I first encountered it running &lt;code&gt;bundle exec jekyll build&lt;/code&gt;. The error is happening because Ruby is trying to load &lt;code&gt;date_core&lt;/code&gt; (which is a compiled-from-C &lt;code&gt;.so&lt;/code&gt; file) and can't find it on any of the load paths. It's the same error you get if you try to import nonsense like &lt;code&gt;require "aoeuaoeu"&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;tl;dr This can be worked around by setting Ruby's &lt;code&gt;$LOAD_PATH&lt;/code&gt; to explicitly include the directory&lt;/p&gt;
&lt;pre&gt;&lt;code class="lang-bash"&gt;export RUBYLIB=/usr/lib/ruby/3.0.0/x86-linux/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but it's weird that it's happening at all.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;I eventually tracked the problem down to &lt;code&gt;date_core.so&lt;/code&gt; being in &lt;code&gt;/usr/lib/ruby/3.0.0/x86-linux/&lt;/code&gt; which was not on Ruby's path so it couldn't find it to load it.&lt;/p&gt;
&lt;pre&gt;&lt;code class="lang-bash"&gt;$ ls /usr/lib/ruby/3.0.0/x86-linux/date_core.so
/usr/lib/ruby/3.0.0/x86-linux/date_core.so   # This is in the directory x86-linux
$ ruby -e &amp;#39;puts $LOAD_PATH&amp;#39;
/usr/lib/ruby/site_ruby/3.0.0
/usr/lib/ruby/site_ruby/3.0.0/i686-linux
/usr/lib/ruby/site_ruby
/usr/lib/ruby/vendor_ruby/3.0.0
/usr/lib/ruby/vendor_ruby/3.0.0/i686-linux
/usr/lib/ruby/vendor_ruby
/usr/lib/ruby/3.0.0
/usr/lib/ruby/3.0.0/i686-linux  # The directory it&amp;#39;s looking in is i686-linux
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The path that Ruby does look in also exists and has other installed Ruby packages in it. It's very strange that 32-bit &lt;code&gt;.so&lt;/code&gt; files for Ruby packages are in both &lt;code&gt;i686&lt;/code&gt; and &lt;code&gt;x86-linux&lt;/code&gt; and that Ruby only seems to know about one of them.&lt;/p&gt;
&lt;pre&gt;&lt;code class="lang-bash"&gt;$ ls /usr/lib/ruby/3.0.0/x86-linux/
bigdecimal.so  cgi  date_core.so
$ ls /usr/lib/ruby/3.0.0/i686-linux/
continuation.so  dbm.so  digest.so  etc.so    fiber.so   gdbm.so  json        nkf.so       openssl.so   psych.so  racc      rbconfig.rb  ripper.so  stringio.so  syslog.so
coverage.so      digest  enc        fcntl.so  fiddle.so  io       monitor.so  objspace.so  pathname.so  pty.so    rbconfig  readline.so  socket.so  strscan.so   zlib.so
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For each directory, I found a package that owned files there so I could look at their build scripts and compare them: ruby-date &amp;amp; ruby-digest.&lt;/p&gt;
&lt;pre&gt;&lt;code class="lang-bash"&gt;$ yay -Qo /usr/lib/ruby/3.0.0/x86-linux/date_core.so /usr/lib/ruby/3.0.0/i686-linux/digest.so
/usr/lib/ruby/3.0.0/x86-linux/date_core.so is owned by ruby-date 3.2.2-4.0
/usr/lib/ruby/3.0.0/i686-linux/digest.so is owned by ruby-digest 3.1.0-5.8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Arch Linux has officially deprecated 32-bit support, so this is where the research became harder. I think ArchLinux32 use the same packages as ArchLinux unless something needs to be different. I didn't find anything suspicious in the &lt;a href="https://git.archlinux32.org/packages/tree/extra/ruby-date/PKGBUILD"&gt;32-bit specific&lt;/a&gt; &lt;a href="https://git.archlinux32.org/packages/tree/extra/ruby-digest/PKGBUILD"&gt;packaging scripts&lt;/a&gt; so I looked at the upstream &lt;code&gt;PKGBUILD&lt;/code&gt;s.&lt;/p&gt;
&lt;p&gt;I think &lt;a href="https://gitlab.archlinux.org/archlinux/packaging/packages/ruby-date/-/blob/main/PKGBUILD#L29"&gt;both&lt;/a&gt; &lt;a href="https://gitlab.archlinux.org/archlinux/packaging/packages/ruby-digest/-/blob/main/PKGBUILD#L35"&gt;packages&lt;/a&gt; use &lt;code&gt;local _platform="$(gem env platform | cut -d':' -f2)"&lt;/code&gt; to generate the platform-specific version, but it's producing different results. Since previously I didn't get the exception, I looked in the pacman logs to find the version difference - &lt;code&gt;ruby-date (3.2.2-3.6 -&amp;gt; 3.2.2-4.0)&lt;/code&gt; which means it was only a change in how it was packaged - but both before and after use &lt;code&gt;gem env platform&lt;/code&gt; so it's probably not that.&lt;/p&gt;
&lt;p&gt;I couldn't find a definite answer, but my suspicion is that the different packages (and package versions) are built on different computers, and on some of them &lt;code&gt;gem env platform&lt;/code&gt; produces &lt;code&gt;i686&lt;/code&gt; and on others &lt;code&gt;x86-linux&lt;/code&gt;, but I'm not sure why.&lt;/p&gt;
&lt;p&gt;I didn't get any further than this - the server was reinstalled with a 64-bit Arch which didn't have the same problems. If you run into the same problem or figure out what was going on, please let me know!&lt;/p&gt;
</content></entry><entry><title>Photo rights &amp; Terms of Service</title><link href="https://hollybecker.net/blog/2020-06-20-photo-rights-tos/" rel="alternate"/><updated>2020-06-20T00:00:00Z</updated><author><name/></author><id>urn:uuid:9b982543-75cc-3abf-83d8-f93a35c1a675</id><content type="html">&lt;p&gt;I take a lot of bird photos, and while I enjoy uploading them to &lt;a href="https://ebird.org/media/catalog?searchField=user&amp;amp;userId=USER704980&amp;amp;q=Holly%20Becker"&gt;eBird&lt;/a&gt; for inclusion in their scientific collection, I also like showing them off to friends. I've been uploading them to &lt;a href="https://www.flickr.com/people/132539605@N07/"&gt;Flickr&lt;/a&gt; with a CC BY-SA-NC license, but since nobody browses Flickr anymore I was hoping to share them somewhere they'd get more attention. However, I also know social media sites are infamous for their aggressive rights grabs on user content, so I read several Terms of Service trying to figure out which was least-bad for uploading photos to, including Dreamwidth, Flickr, Twitter &amp;amp; Facebook.&lt;/p&gt;
&lt;p&gt;The relevant sections of the ToS were surprisingly short.&lt;/p&gt;
&lt;p&gt;Dreamwidth (&lt;a href="https://www.dreamwidth.org/legal/tos"&gt;https://www.dreamwidth.org/legal/tos&lt;/a&gt;)&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;By submitting Content to us for inclusion on the Website, you grant us a world-wide, royalty-free, and non-exclusive license to reproduce, modify, adapt and publish the Content, solely for the purpose of displaying, distributing and promoting the contents of your account, including through downloadable clients and external feeds.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Flickr, owned by SmugMug (&lt;a href="https://www.flickr.com/help/terms"&gt;https://www.flickr.com/help/terms&lt;/a&gt;)&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;You retain all intellectual property rights in and to any User Content you post .... [You] grant SmugMug a perpetual, nonexclusive and royalty-free right to use the User Content ... as is reasonably necessary in order to do the following: (1) provide the Services, including to display the User Content on the Services (2) ...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Twitter (&lt;a href="https://twitter.com/en/tos"&gt;https://twitter.com/en/tos&lt;/a&gt;)&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;You retain your rights to any Content you submit .... [Y]ou grant us a worldwide, non-exclusive, royalty-free license (with the right to sublicense) to use, copy, reproduce, process, adapt, modify, publish, transmit, display and distribute such Content in any and all media or distribution methods now known or later developed (for clarity, these rights include, for example, curating, transforming, and translating).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Facebook (&lt;a href="https://www.facebook.com/terms.php"&gt;https://www.facebook.com/terms.php&lt;/a&gt;)&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;You own the intellectual property rights ... in any such content that you create and share on Facebook and the other Facebook Company Products you use. .... [W]hen you share, post, or upload content that is covered by intellectual property rights on or in connection with our Products, you grant us a non-exclusive, transferable, sub-licensable, royalty-free, and worldwide license to host, use, distribute, modify, run, copy, publicly perform or display, translate, and create derivative works of your content&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Some of these are reasonable or expected:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;"worldwide" = the internet is everywhere&lt;/li&gt;
&lt;li&gt;"non-exclusive" = you can still grant licenses to other people or companies&lt;/li&gt;
&lt;li&gt;"royalty-free" = they're not paying you for the photos&lt;/li&gt;
&lt;li&gt;"to use, copy, host, distribute" etc = they need to store &amp;amp; display the photos to run the service&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Others are a lot worse:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;"transferable" = company can give the license that you gave to the company to someone else, and you have no say in it&lt;/li&gt;
&lt;li&gt;"sub-licensable" = company can license your content to another person or company, including charging money for it, and you have no say or right to the money&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Of these four, Flickr &amp;amp; Dreamwidth are the best, with the smallest rights and strong limitations on them. Twitter has the 'sublicense' clause, and Facebook has both 'transferable' and 'sub-licensable', both of which are pretty bad. This doesn't surprise me - Flickr is about photo sharing from people that might want to sell their photos and Facebook is rife with other problems - but still interesting to see that reflected in the ToS.&lt;/p&gt;
&lt;p&gt;I ended up continuing to upload my photos to Flickr under a Creative Commons licence, and linking them from Facebook, relying on the preview functionality.&lt;/p&gt;
</content></entry><entry><title>Can I Use That Code? Software licences as a user</title><link href="https://hollybecker.net/blog/2017-11-26-can-i-use-that-code/" rel="alternate"/><updated>2017-11-26T00:00:00Z</updated><author><name/></author><id>urn:uuid:b03e33fc-4dea-3db6-9ae1-169df78b9425</id><content type="html">&lt;p&gt;I did my first conference talk for PyCon Canada last weekend on software licences&lt;sup class="footnote-ref" id="fnref-1"&gt;&lt;a href="#fn-1"&gt;1&lt;/a&gt;&lt;/sup&gt; as a end user. I had given this &lt;a href="/talks"&gt;talk&lt;/a&gt; before to a few meetups and it had gone well, which encouraged me to submit it to &lt;a href="https://2017.pycon.ca/en/schedule/18/"&gt;PyCon Canada 2017&lt;/a&gt; and &lt;a href="https://2018.pycascades.com/talks/can-i-use-that-code-software-licences-as-a-user/"&gt;PyCascades 2018&lt;/a&gt;. To my delight (and nervousness!) both conferences accepted it!&lt;/p&gt;
&lt;p&gt;I really enjoyed the experience. While I was very nervous, and was finishing my slides and practicing fervently the night before I presented, the talk itself went fine. As a bonus, I've had several people tell me they enjoyed it, and I have an excuse to talk about software licences to everyone!&lt;/p&gt;
&lt;p&gt;While most of the content can be found elsewhere on the internet, I know many people (myself included) prefer reading over watching a video so I've provided a summary/transcript.  &lt;a href="https://docs.google.com/presentation/d/1NGAzLPPOPS6v_q8mLxjJpJphoEAfV9Cs4FEVzM9JWKs/edit?usp=sharing"&gt;Slides&lt;/a&gt; are also available.&lt;/p&gt;
&lt;p&gt;&lt;a href="#conclusion"&gt;tl;dr&lt;/a&gt;&lt;/p&gt;&lt;h3 id="introduction"&gt;Introduction&lt;/h3&gt;&lt;p&gt;&lt;img src="slide-0-sm.jpg" alt="Title slide: Can I ues that code? Software licences as a User and a CC-BY-SA logo" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;I'm going to try to answer the question "Can I use that code?".  I'll be talking about software licences as a user, focusing on looking at other people's code and checking if you can use it in your project&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-1-sm.jpg" alt="Slide: About Me: Holly Becker, Software Developer, Open source fan, Likes books, board games, birdwatching, hollybecker.net" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;I'm Holly Becker. I'm a software developer at Sauce Labs, which does automated mobile and web testing as a service.  I'm also a PyLadies Vancouver co-organizer and a fan of open source.  Aside from programming, I enjoy books, board games and birdwatching. You can find me online as Hwesta.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-2-sm.jpg" alt="Slide: IANAL" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;Another important thing about me is I Am Not A Lawyer.  I did some research for this presentation, and while it was fascinating and informative it is definitely not legal advice.  You should consult a lawyer if you have any actual legal concerns.  My research isn't enough because...&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-3-sm.jpg" alt="Slide: It's complicated!" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;...software licences are complicated.  There are lots of interactions and complexities; some requirements conflict; there's unclear definitions of terms, or terms from legal precedent from another country.  Much of this has not been tested in court, so the final decision may be different than we think it is (or should be).  This is just a summary to get you thinking about software licences.&lt;/p&gt;
&lt;h3 id="what-is-a-licence"&gt;What is a Licence?&lt;/h3&gt;&lt;p&gt;&lt;img src="slide-4-sm.jpg" alt="New section slide: What is a licence?" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;First of all, what is a licence?&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-5-sm.jpg" alt="Slide: What is a software licence? For software only! (For other creative works use Creative Commons) What the user can do with code. What obligations the user has" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;Specifically, what is a software licence? I'm only going to discuss software licences.  If you have other creative non-code work, I highly recommend the &lt;a href="https://creativecommons.org/licenses/"&gt;Creative Commons&lt;/a&gt; set of licences.  Licences discuss what you can do, and what you must do to be able to use the code.  It allows uses that default copyright does not, and addresses how you can run, modify and redistribute the code (for example, using it in your project).&lt;/p&gt;
&lt;h3 id="categories-of-licences"&gt;Categories of Licences&lt;/h3&gt;&lt;p&gt;&lt;img src="slide-6-sm.jpg" alt="New section slide: What is a licence?" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;There are lots of different software licences. Fortunately, they can be grouped into a few categories with similar rights and obligations, which I'll cover from most restrictive to least restrictive.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-7-sm.jpg" alt="Slide: Not Licensed. Default state of code. Author has copyright. Cannot use, But can ask author for permission. Examples: Blog posts, Websites" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;The first category is code that is not licensed. This is not actually a licence! By default everything is under copyright and not usable by anyone except the copyright holder, usually the author.  You can ask for permission to use it, but unless it has a licence you can't use it.  This includes the great looking code you found on someone's blog, or that useful website you found.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-8-sm.jpg" alt="Slide: Closed Source/Proprietary Licence. Generally can't use this code. Depends on the terms of the licence. Author retains copyright. Example: EULA, Unity game engine" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;The next category is closed source or propriety licences.  Generally, you can't use this code, or you can only use it in a restricted sense like running but not modifying, or you have the compiled binary but not the source code.  A common example of this is a EULA, where you agree to the terms and conditions in order to run the program. Another interesting example is the Unity game engine; you can use it for free to make video games until your revenue passes a certain amount, then you have to pay to use it.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-9-sm.jpg" alt="Slide: Copyleft Open Source Licence
. You can use this code! But you have to share derivatives (Modifications or used as dependency) Author retains copyright. Examples: GPL, AGPL, LGPL" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;The first open source category is copyleft licences.  You can use this code! However you have some significant obligations.  You have to keep a copy of the licence with the code, and derivatives have to be licensed under a copyleft licence.  A derivative can be modifications to the original code, or a new program built with the code, but both of them have to be released under a copyleft licence.  Copyleft is concerned not just with &lt;em&gt;making&lt;/em&gt; software free but with &lt;em&gt;keeping&lt;/em&gt; software free and the licences in this category enforce that. The best known example of a copyleft licence is the GPL, and the related AGPL and LGPL.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-10-sm.jpg" alt="Slide: Permissive Open Source Licence. You can use this code! Few restrictions, Author retains copyright. Examples: MIT, BSD, Apache" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;The second open source category is permissive open source licences.  You can use this code! There are very few restrictions and generally just require distributing the licence with the code so others know the terms the code is available under.  Most licences also disclaim liability and may have additional restrictions such as granting patent licences or say that using this code isn't an endorsement.  Unlike copyleft, permissive licences are not concerned with derivatives' freedom and can be used in closed source applications with few issues.  This is a very popular category of license - more than half the projects on PyPI are licensed under one of the permissive open source licences.  There are several well know licences in this category, including the MIT, BSD and Apache licences.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-11-sm.jpg" alt="Slide: Public Domain
. You can use this code! No restrictions, Author has given up copyright. Examples: Unlicense, CC0" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;Code can also be put in the public domain. You can use this code! There are no restrictions, no credit required, no licence to keep with the code.  Notably, there is no copyright. This is the biggest difference to the previous licences. In fact, it's not actually a licence, because no one has copyright.  Licences work by using copyright to control usage, even if the rights granted are broad and the conditions minimal.  If there's no copyright, then there's no one to set the terms, so no licence is possible.  There's also no disclaimer of liability, so you probably want a permissive open source licence instead of public domain for your code.  However it has been done: the &lt;a href="https://www.sqlite.org/copyright.html"&gt;SQLite&lt;/a&gt; database is public domain.  The "licences" in this category (CC0 and the Unlicense) offer public domain-like rights in jurisdictions with no concept of public domain.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-12-sm.jpg" alt="Slide: Joke Licences
. Intent: permissive with humor. Actually: legally problematic. Don't  use them! Examples: Beerware, WTFPL" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;The last category is joke licences.  This is not really a useful category. The intent is to be both permissive and funny, but it ends up being really legally problematic.  For example, "You can use my code if you buy me a beer!".  I buy you a beer? My company buys you a beer? Do all my coworkers have to buy you a beer? Do we buy you a beer before or after we start using your code? Do we have to hunt you down for the beer buying? This is problematic for lawyers and they have to buy themselves a beer to deal with it.  You should avoid libraries with these licences because it's a legal headache, and you should avoid licensing your code under a joke licence.&lt;/p&gt;
&lt;h3 id="common-licences"&gt;Common Licences&lt;/h3&gt;&lt;p&gt;&lt;img src="slide-13-sm.jpg" alt="New section slide: Common Licences
" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;Generally if you're using someone else's code it's available under one of the open source licences. We'll look at a couple permissive and copyleft licences to set the stage for discussing how they interact.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-14-sm.jpg" alt="Slide: MIT. Permissive licence. Must keep licence with code. Disclaims liability. Used by: SQLAlchemy, Twisted, six" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;Starting with the shortest, the MIT Licence is a simple permissive open source licence.  It only requires keeping a copy of the licence (which includes the copyright holder's information) with the code. Like basically every licence, it disclaims liability. It's actually quite short, only about 170 words, and there's an excellent breakdown by (/dev/lawyer)&lt;a href="https://writing.kemitchell.com/2016/09/21/MIT-License-Line-by-Line.html"&gt;devlaywerMIT&lt;/a&gt; explaining all the legalese.  Some Python packages licensed under MIT are SQLAlchemy, Twisted and six.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-15-sm.jpg" alt="Slide: BSD (2-clause &amp; 3-clause)
. Permissive licence. Must keep licence with source or binary. 3-clause: usage doesn't allow endorsement. Used by: numpy, scipy, pandas, Django, flask" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;The BSD licence is very similar to the MIT licence: a simple, permissive open source licence.  It disclaims liability and says you must keep a copy of the licence with the source or binary. There's two major versions of the BSD licence: the 2-clause and 3-clause.  The 3-clause adds another clause saying that copyright holders don't endorse any derivatives.  This makes more sense in the context that BSD is short for Berkeley Software Distribution, and the University of California in Berkeley probably didn't want people saying Berkeley endorsed them just because they were using software written at Berkeley.  This as a popular license: it's used by scipy, numpy and pandas from data science/scientific computing, and Django and flask from web programming.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-16-sm.jpg" alt="Slide: Apache 2.0. Permissive licence. Must keep licence with code. Grants patent rights. Used by: requests, selenium, Android OS" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;The Apache licence is the last of the permissive open source licences I'll discuss. It's longer and more explicit about things the previous licences are implicit about. Like the others, it includes a disclaimer of liability and you must keep a copy of the licence with the code.  It also explicitly addresses patents, and grants the patent rights necessary to run and distribute the code. Amusingly, these rights are revoked if there's a lawsuit over them.  Additionally, contributions to Apache licensed projects are by default licensed under Apache themselves, which is an interesting clause I didn't see elsewhere. The Python packages requests and selenium are licensed under Apache, as well as the Android operating system.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-17-sm.jpg" alt="Slide: GPL. Strong copyleft licence. Must keep licence with code. Must share changes if distributed. Affects whole codebase. Used by: Linux kernel (GPLv2), Ansible (GLPv3)" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;And last, but definitely not least, is the GPL or GNU Public License.  This is the best known of the copyleft licences. It includes the things you're probably coming to expect from a software licence: disclaimer of liability, keep a copy of the licence with the code. Like the Apache licence, version 3 includes a grant of patent licence.&lt;/p&gt;
&lt;p&gt;On top of that, the GPL has all the things that make it a copyleft licence.  If you distribute code (or modify and distribute code) licensed under the GPL, you must make the source code available. Note that if you only use it for personal use or internal to your company you don't have to do anything special. It's the act of distributing it (either giving away or selling) that requires you to make the source code available.&lt;/p&gt;
&lt;p&gt;Additionally, if you include GPL licensed code in your codebase and distribute it you must make the entire codebase available under the GPL.  Remember, copyleft licences are concerned with &lt;em&gt;keeping&lt;/em&gt; software free; they don't want you to make something with their code and not contribute it back to the community.  The GPL is sometimes called 'viral' because including GPL'd code affects the licensing of the entire program.&lt;/p&gt;
&lt;p&gt;However, the definition of 'one program' gets complicated. What's one program vs two programs that communicate?  Typically static and dynamic linking are considered one program, while HTTP calls and piping output are not. In between things get fuzzy. This is where the lawyers get involved if you want to use a GPL licensed dependency but don't want to release your codebase.&lt;/p&gt;
&lt;p&gt;The best known example of a GPL licensed project is the Linux kernel, and the Python project Ansible is also licensed GPL.&lt;/p&gt;
&lt;h3 id="can-i-use-that-code"&gt;Can I Use That Code?&lt;/h3&gt;&lt;p&gt;&lt;img src="slide-18-sm.jpg" alt="New section slide: Can I Use That Code?" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;This is the interesting part!  Now that we know a little about the licences, we can discuss if my code is licensed X can I include code licensed Y.  In the presentation, I asked people to guess the answer before I revealed it.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-19-sm.jpg" alt="Slide: Closed source + MIT
. Yes! MIT only requires preserving licence" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;Closed Source + MIT: Yes! MIT has few restrictions, only requiring a copy of the licence be kept with the code so others know how it's licensed, and can easily be used in closed source projects.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-20-sm.jpg" alt="Slide: Closed source + GPL
. Probably not. Can be done through careful separation. Probably talk to a lawyer" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;Closed source + GPL: Probably not.  There are workarounds to ensure your project and the GPl'd project are considered separate projects, but you're probably going to want to talk to a lawyer to make sure you get it right.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-21-sm.jpg" alt="Slide: GPL + MIT
. Yes! MIT is less restrictive than GPL" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;GPL + MIT: Yes! For the same reasons MIT licensed code can be used in a closed source project: the MIT license is permissive and has few restrictions. Note that while the dependency is licensed MIT, the combined work of your project and the dependency is distributed under the GPL, because that's what the GPL requires.  (I did say licences were complicated.)&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-22-sm.jpg" alt="Slide: GPL + GPL. Yes! Same licence, no problems" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;GPL + GPL: Yes! Two pieces of code with the same licence is rarely a problem because they have the same terms which are unlikely to conflict.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-23-sm.jpg" alt="Slide: MIT + MIT. Yes! Same licence, no problems. MIT is very permissive" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;MIT + MIT: Double yes! They're the same licence, and the MIT licence is very permissive.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-24-sm.jpg" alt="Slide: MIT + GPL. Probably not. GPL requires derivatives licensed GPL. Could license under GPL instead of MIT. Could be done through careful separation. Probably talk to a lawyer" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;MIT + GPL: Probably not, for the same reasons it's difficult to include a GPL'd dependency in a closed source project. The GPL requires that derivatives be licensed under the GPL as well.  You could license your project GPL, but if you want to retain the MIT license it requires the same sorts of careful separation from the less-restrictive MIT license to prevent the GPL's viral nature from overriding it.  You're probably going to want to consult a lawyer.&lt;/p&gt;
&lt;h3 id="common-questions"&gt;Common questions&lt;/h3&gt;&lt;p&gt;&lt;img src="slide-25-sm.jpg" alt="New section slide: Frequently Asked questions" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;There's a couple things that always come up when discussing licences.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-26-sm.jpg" alt="Slide: Can I use code on Github?
It depends! Not licensed by default. Check if the repository has a licence" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;Can you use code on Github?  By default, code on Github falls under unlicensed and you can't use it.  The copyright holder has given Github the rights to display the code and a few other things like forking, but that doesn't mean you can use it.  However, many repos have licences, and you can use that code under the terms of the licence.  In short: check!&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-27-sm.jpg" alt="Slide: What about Stack Overflow?
Complicated :( All user contributions are CC-BY-SA. But CC (probably) doesn't apply to code. Plans to move to MIT on hold. Uncertain if SO code is usable in projects. But good as inspiration" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;What about Stack Overflow?  Stack Overflow is complicated. User contributions are licensed &lt;a href="https://creativecommons.org/licenses/by-sa/3.0/"&gt;CC-BY-SA&lt;/a&gt;, which is a copyleft licence for non-code works.  However, it's not clear that Creative Commons licences can apply to code.  Usually the text is licensed under CC and the code is separately licensed under a software license.  Stack Overflow &lt;a href="https://meta.stackexchange.com/questions/271080/the-mit-license-clarity-on-using-code-on-stack-overflow-and-stack-exchange"&gt;discussed&lt;/a&gt; licensing code under the MIT license (or a modified MIT license), but it &lt;a href="https://meta.stackexchange.com/questions/272956/a-new-code-license-the-mit-this-time-with-attribution-required"&gt;failed to happen&lt;/a&gt; because of community push back over the suitability of the license for tiny snippets, whole programs and code in questions. This is also complicated by the fact that not all snippets of code are big enough to be covered by copyright. To be covered by copyright, and therefore be licensable, it has to be creative. Since many small snippets of code are common ways of doing things and not creative, copyright may not apply.  Overall, it's a very awkward situation. I won't make a recommendation, but I will admit I use SO for inspiration and reference.&lt;/p&gt;
&lt;h3 id="conclusion"&gt;Conclusion&lt;/h3&gt;&lt;p&gt;&lt;img src="slide-28-sm.jpg" alt="New section slide: Conclusion" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;There's a few things I hope you remember from this.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-29-sm.jpg" alt="Slide: Take aways. Software licences are good. Software licences are hard. Permissive open source is easy to work with. GPL enforces software freedoms." class="blog-image"&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Software licences are fantastic! They allow you to use other people's code and allow others to use your code, enabling the whole open source community.&lt;/li&gt;
&lt;li&gt;Software licences are also complicated&lt;/li&gt;
&lt;li&gt;Permissive open source licences are simple, straightforward and easy to use&lt;/li&gt;
&lt;li&gt;Copyleft open source licences take a strong ethical stance.  It doesn't want code being used without contributing back to the community.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="slide-30-sm.jpg" alt="Slide: Check the licence!
" class="blog-image"&gt;&lt;/p&gt;
&lt;p&gt;But most of all, &lt;strong&gt;remember to check the licence!&lt;/strong&gt; Just because code is on the internet doesn't mean you can use it.&lt;/p&gt;
&lt;p&gt;&lt;img src="slide-31-sm.jpg" alt="Slide: Thank you!" class="blog-image"&gt;&lt;/p&gt;
&lt;div class="footnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;&lt;li id="fn-1"&gt;&lt;p&gt;When making this talk I got to learn the difference between licence (with a c) and license (with an s).  In American English, they only use license.  In non-American English, licence is the noun (think advi&lt;strong&gt;c&lt;/strong&gt;e) and license is the verb (think advi&lt;strong&gt;s&lt;/strong&gt;e).  &lt;a href="http://grammarist.com/spelling/licence-license/"&gt;Grammarist&lt;/a&gt; has a good explanation.&lt;a href="#fnref-1" class="footnote"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content></entry><entry><title>&lt;ruby&gt;邪魔&lt;rp&gt; (&lt;/rp&gt;&lt;rt&gt;じゃま&lt;/rt&gt;&lt;rp&gt;)&lt;/rp&gt;&lt;/ruby&gt; and cats</title><link href="https://hollybecker.net/blog/2017-10-29-jyama-and-cats/" rel="alternate"/><updated>2017-10-29T00:00:00Z</updated><author><name/></author><id>urn:uuid:d142d270-76e1-3927-9b9e-203d70a9f7ce</id><content type="html">&lt;p&gt;When I encounter a word I don't know in Japanese, one of my techniques is to use google.jp to image search for it.  The goal is to keep from translating the word into English and to get a sense of what it means in Japanese instead.&lt;/p&gt;
&lt;p&gt;The other day I came across &lt;ruby&gt;邪魔&lt;rt&gt;jyama&lt;/rt&gt;&lt;/ruby&gt; and googled it.&lt;/p&gt;
&lt;p&gt;&lt;img src="/blog/2017-10-29-jyama-and-cats/post-2017-10-cats.jpg" alt="Screenshot of a google image search. Most results are cats sitting on keyboards or mice, one is of a board game named &amp;quot;Saboteur&amp;quot;"&gt;&lt;/p&gt;
&lt;p&gt;Thought process: Hmm, what does this mean? Something about cats sitting on keyboards? That doesn't seem right from the source context. What's that in the bottom right? I recognize that board game, it's Saboteur!&lt;/p&gt;
&lt;p&gt;So &lt;ruby&gt;邪魔&lt;rt&gt;じゃま&lt;/rt&gt;&lt;/ruby&gt; might mean sabotage or obstruct or hinder, but it's apparently quintessentially cat-on-keyboard!&lt;/p&gt;
</content></entry><entry><title>TIL: SASS &amp; locale-gen</title><link href="https://hollybecker.net/blog/2017-10-22-til-sass-and-locale-gen/" rel="alternate"/><updated>2017-10-22T00:00:00Z</updated><author><name/></author><id>urn:uuid:3de520a5-f81e-3c36-85d8-334be6563f4c</id><content type="html">&lt;p&gt;I decided to switch this site from a handful of HTML &amp;amp; CSS pages to a static site generator, Jekyll. When deploying it to my webserver, I ran into some locale problems with SASS generation and thought someone else can learn from my pain.&lt;/p&gt;
&lt;p&gt;&lt;a href="/blog/2017-10-22-til-sass-and-locale-gen/#summary"&gt;Just the solution please&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I've never used Jekyll before and I haven't really used Ruby so I had a few problems installing gems into the right places that I sorted out with &lt;a href="https://www.mistys-internet.website/"&gt;Misty&lt;/a&gt;'s help.  &lt;a href="https://jekyllrb.com/docs/installation/#install-with-rubygems"&gt;Jekyll&lt;/a&gt;, &lt;a href="http://bundler.io/"&gt;Bundler&lt;/a&gt; &amp;amp; &lt;a href="http://sass-lang.com/install"&gt;SASS&lt;/a&gt; all recommend &lt;code&gt;gem install&lt;/code&gt;. Jekyll uses Bundler for project dependencies.  However, I later ran into what I think were conflicts between the gems installed in my user directory and the gems installed by Bundler for my project. My solution was to install Bundler &amp;amp; SASS at the system level (&lt;code&gt;pacman -S ruby ruby-bundle ruby-sass&lt;/code&gt;), use Bundler for project dependencies, and use &lt;code&gt;bundle exec jekyll&lt;/code&gt; for any Jekyll commands I needed.  The &lt;code&gt;rm -rf ~/.gem&lt;/code&gt; to delete user directory gems was very cathartic.&lt;/p&gt;
&lt;p&gt;The conversion to Jekyll was pretty easy and I was ready to deploy it to my webserver.  When trying to generate the site on the webserver I ran into this problem:&lt;/p&gt;
&lt;pre&gt;&lt;code class="lang-bash"&gt;$ bundle exec jekyll build
Configuration file: /home/holly/hollybecker.net/_config.yml
            Source: /home/holly/hollybecker.net
       Destination: /home/holly/hollybecker.net/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
  Conversion error: Jekyll::Converters::Scss encountered an error while converting &amp;#39;css/main.scss&amp;#39;:
                    Invalid US-ASCII character &amp;quot;\xE2&amp;quot; on line 2
jekyll 3.6.0 | Error:  Invalid US-ASCII character &amp;quot;\xE2&amp;quot; on line 2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Huh?&lt;/p&gt;
&lt;p&gt;&lt;code&gt;\xE2&lt;/code&gt; is &lt;code&gt;â&lt;/code&gt; but I don't have any of those in my project.  It's definitely not on line 2 of &lt;code&gt;css/main.scss&lt;/code&gt; since that's the second line of the empty YAML frontmatter needed so Jekyll parses the file.  Also, this command works on my desktop and another Arch Linux server.  The versions of SASS, Jekyll and Bundler are the same.  The webserver is 32-bit, but a 32-bit VM Arch Linux VM didn't have this issue either.&lt;/p&gt;
&lt;p&gt;Google led me to a &lt;a href="https://github.com/jekyll/jekyll/issues/4268"&gt;Jekyll issue&lt;/a&gt; with the same problem I was having which was quite useful. It suggested specifying the encoding in several places, none of which worked.  It also helped track down that the problem wasn't in &lt;code&gt;css/main.scss&lt;/code&gt; but in the imports and provided a neat tip on how to &lt;a href="https://stackoverflow.com/a/13702856"&gt;grep for non-ASCII&lt;/a&gt; with &lt;code&gt;grep --color='auto' -P -n "[\x80-\xFF]" file.xml&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;A-ha! Grepping for non-ASCII on the webserver found a lot of comments with en-dashes instead of hyphens.  An en-dash is &lt;code&gt;\xe2\x80\x93&lt;/code&gt;, hence the misleading &lt;code&gt;\XE2&lt;/code&gt; in the error earlier. However, the same grep command on my desktop didn't find anything.&lt;/p&gt;
&lt;p&gt;Now I had a workaround - I could replace the en-dashes with hyphens - but I was curious what's going on.&lt;/p&gt;
&lt;p&gt;I narrowed it down to a more minimal test case using the pre-Jekyll master branch.  The problem was just with SASS, not Jekyll or Bundler. I hadn't run into it previously because I ran SASS on my desktop and committed the results, instead of generating the site on the webserver.&lt;/p&gt;
&lt;pre&gt;&lt;code class="lang-bash"&gt;$ sass sass/main.scss css/main.css 
Error: Invalid US-ASCII character &amp;quot;\xE2&amp;quot;
        on line 2 of sass/base/_variables.scss
        from line 14 of sass/main.scss
  Use --trace for backtrace.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is clearly an encoding problem, so I looked at the locale related environment variables. My desktop looks fine:&lt;/p&gt;
&lt;pre&gt;&lt;code class="lang-bash"&gt;holly@desktop$ env | grep LANG
LANG=en_CA.UTF-8
LANGUAGE=en_US:en_GB
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But the webserver is very suspicious:&lt;/p&gt;
&lt;pre&gt;&lt;code class="lang-bash"&gt;holly@webserver$ env | grep LANG
LANG=C
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;C&lt;/code&gt; locale is &lt;a href="https://unix.stackexchange.com/a/87763"&gt;aimed at computers over people&lt;/a&gt; and doesn't understand UTF-8.  However, setting the locale to something with UTF-8 support (&lt;code&gt;export LANG=en_CA.UTF-8&lt;/code&gt;) didn't fix the problem.&lt;/p&gt;
&lt;p&gt;I didn't realize this until the next morning, but I'd forgotten to check which locales were actually generated.  Neither &lt;code&gt;en_US.UTF-8&lt;/code&gt; nor &lt;code&gt;en_CA.UTF-8&lt;/code&gt; actually existed on the system and it was probably falling back to the only locale it knew about: &lt;code&gt;C&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To fix this I generated the &lt;code&gt;en_US.UTF-8&lt;/code&gt; locale (uncommented &lt;code&gt;en_US.UTF-8 UTF-8&lt;/code&gt; in &lt;code&gt;/etc/locale.gen&lt;/code&gt; and ran &lt;code&gt;locale-gen&lt;/code&gt;) and confirmed it worked by listing all generated locales (&lt;code&gt;locale -a&lt;/code&gt;).  I set the system locale in &lt;code&gt;/etc/locale.conf&lt;/code&gt; to &lt;code&gt;LANG=en_US.UTF-8&lt;/code&gt;, though once the locale was generated, I could have set the &lt;code&gt;LANG&lt;/code&gt; in the terminal I was using as well.&lt;/p&gt;
&lt;p&gt;After all this, it worked! Jekyll &amp;amp; SASS ran and correctly generated the CSS, even with unicode characters involved.&lt;/p&gt;
&lt;p&gt;As for why this happened, this webserver had been installed in 2009 before Arch changed the default locale to one with UTF-8 support.  All the other servers I checked on had been installed more recently or had been updated to a UTF-8 locale and didn't have this problem.&lt;/p&gt;
&lt;h3 id="summary"&gt;Summary&lt;/h3&gt;&lt;p&gt;When generating SASS, I had the error:&lt;/p&gt;
&lt;pre&gt;&lt;code class="lang-bash"&gt;$ sass sass/main.scss css/main.css
Error: Invalid US-ASCII character &amp;quot;\xE2&amp;quot;
        on line 2 of sass/base/_variables.scss
        from line 14 of sass/main.scss
  Use --trace for backtrace.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The fix was to generate UTF-8 system locale and set it.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check if locale exists: &lt;code&gt;locale -a&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;If not, generate locale: Uncomment locale name in &lt;code&gt;/etc/locale.gen&lt;/code&gt; and run &lt;code&gt;sudo locale-gen&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Set locale for the system: Edit &lt;code&gt;/etc/locale.conf&lt;/code&gt; and log in again for it to take effect&lt;/li&gt;
&lt;li&gt;Or set locale for the terminal&lt;ul&gt;
&lt;li&gt;bash: &lt;code&gt;export LANG=en_US.UTF-8&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;fish: &lt;code&gt;set -xg LANG en_US.UTF-8&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content></entry></feed>