Monday, October 11, 2021

"Add support for Logitech Zone 750"

I bought this headset*, a Logitech Zone 750, and I wanted to turn down the "sidetone", i.e. the always-on foldback. After some searching I found HeadsetControl, which can do it, but didn't support this particular model. It did support the Logitech Zone Wired, which is almost, if not exactly, the same device.

So I figured maybe I could do something about it and solve loud sidetone problem for myself and anyone else using this headset.

Running `lsusb` (in Fedora) showed me the device number, from there it was pretty straight forward.
Ps, the headset seems alright, but I don't know if it's four times better than the H540* it was replacing - unfortunately because the padding cover fabric was peeling and disintegrating on the top part where you can't easily replace it. Hopefully the fabric on the new one will last longer.


* Amazon link with affiliate referral info included.

Wednesday, March 31, 2021

Thursday, August 11, 2016

Tau in Python

Python Issue 12345 "Add math.tau" had its 5th birthday in June.

Yesterday, this:
I'm just going to do this.

- Guido van Rossum
It's happening!

(See also my Ruby MR 644 being considered and politely rejected a year ago.)

Friday, March 13, 2015

Rails test helper for stubbing a constant

When Googling for how to mock or stub a constant in your Rails test suite, I found out about RSpec's stub_const method. I don't use RSpec though, so I wrote this.

The way I use it is to include it in ActiveSupport::TestCase somewhere in test/test_helper.rb.

class ActiveSupport::TestCase
  include WithStubbedConst
  ...
end

Monday, January 21, 2013

Fixing the caps lock key in Gnome in Fedora 18

I like to set my caps lock key to left control. Previously you could do this via the Gnome System Settings control panel. In Fedora 18 it's not possible as far as I can tell.

The gsettings command to make caps lock act as a control key in Gnome is this:

If you are worried about losing any other settings you might have in xkb-options, then do this:
This is an explanation I got just now (from someone who should know about this stuff):
"GNOME 3.0 shipped with input methods separately from xkb, now the two have been brought together to have one dialog. I suspect xkb options will come back, but that'll take another iteration"

Ps, for more info on gnome input sources, see these blog posts by mclasen.

Pps, I've been an anti-caps lock campaigner for a while now :)

Wednesday, October 31, 2012

Nice brief git log format

I'm really happy with this. There's two new features compared to what I've been using up until recently.

Firstly, I just learned about the core.pager option which solves the problems I was solving previously with this ugliness:
ll = "!git --no-pager log --pretty=nice -n30; echo"

Secondly, the %+d. I generally don't use the --graph log formats, (such as these), that show you the branch paths, but seeing where the refs are is super useful. The + makes it appear on the next line without adding a line break when there are no refs.

Here's a screenshot of how it looks (with details obscured to protect the innocent).

Update: I dropped the line break before the refs list, which is fine if you have a nice wide terminal, and tweaked some colours. Now it's:

  nice = format:%Cblue%h %C(cyan)%cr %Cgreen%an%Creset %s%C(yellow)%d %Creset

Tuesday, October 2, 2012

Some "progress" on my Tau in Ruby patch

Its category was changed from "core" to "joke" :(... How does the quote go? "First they ignore your patch, then they classify it as a joke, then... " I forget the rest ;)

"Once Ï„ is widely accepted in these communities, we might add it..."

But also:

"...if it were just up to me, I'd add it just to show support. It's a rather tiny and harmless addition."

See the ticket here.

Tuesday, August 14, 2012

Wednesday, August 8, 2012

Make it easier to use partials with blocks in rails

The shorter version of render :partial is widely known and used. These are equivalent, but the second version is so much more succinct and readable. To use a partial with a yield in it, (what I call a "block partial"), you can use render :layout which a. doesn't read very well, (it's a partial, not a layout clearly), and b. can't be shortened nicely the way that render :partial can. So here is block_render: It lets you have nice neat render calls like this: This is a real-life example of a block partial I like to use. Those classes are bootstrap classes for making a nice drop down menu.

How to make pinned tabs in Firefox a bit wider

I'm using Stylish to apply this, but I guess you could do it with a userChrome.css. The main reason I want this is so the hit target is larger. I want to be able to click my pinned app tabs (currently a TiddlyWiki and my Zimbra corporate calendar) without aiming too hard.

Wednesday, February 8, 2012

Make ActiveRecord::Base#create respect the :type attribute

I think I've needed and implemented this twice now, so let's make a post about it.

The problem occurs when you are using f.fields_for and nested forms, as per these railscasts, and the nested objects are using STI.

(Will leave a more detailed explanation for future posts).

Update 1: Even though this works as described, I don't think it solves my problem. Will post again if I figure it out...

Update 2: Found this which is I think what I was using last time I had this problem... :S


Tuesday, September 20, 2011

A Rails 3 gotcha with html_safe

This was causing me to scratch my head a bit today. I'm glad I know what's going on now and why you need to use safe_concat. It still seems a little unintuitive though. For more into see the explanation here (under the "the tricky part") and the api docs on ActiveSupport::SafeBuffer

My (first) contribution to Rails

I fixed a little mysql configuration bug in Rails. It counted as three commits (even though they are the same thing, just in different branches), which puts me unfairly into the top 500 all time committers. ;) See here.

You'd think DHH would be number one, but actually he's not. Take a look at the list.

Here is my original pull request if you'd like to read more about it.

Ps, I also reported a capybara bug (along with a failing test) that got fixed pretty quickly. But my fork didn't get merged so none of my commits are recorded. :P

Friday, June 17, 2011

Tau in Ruby

Inspired by http://bugs.python.org/issue12345 and of course The Tau Manifesto, here is a patch for ruby to define tau, the true circle constant. Of course we don't need to really need to patch ruby to get this functionality (but I had fun doing it anyway).

Here is tau.rb so you can just require 'tau'. (Maybe this should be a gem...) Ps, I just learned about module_function.

Update 1: I made this ticket which has been mostly ignored.


Update 2: Ticket has been noticed and discussed! :) Ticket has been categorised as joke! :(


Update 3: Some active debate is going on now and the ticket is now 'assigned'! :) See the details.


Update 4: (28-Jun-2014) Made a pull request in Github.


Update 5: See https://github.com/jneen/math-tau/