Technitribe

interesting problems (and a few solutions, too)

Technitribe
  • About the Authors
  • Log In
  • Log Out
  • Lost Password
  • Register
  • Reset Password
    • 12 Aug 2015

      Eclipse Graphene

      Written by Alex Wood

      Dear Internet,

      As I noted in an earlier post, Eclipse on Fedora 22 has some usability problems with the colors it uses. Eclipse uses GTK 3 for a lot of the theming of the interface. With the Gnome Adwaita theme, several of the drop-down dialogs (like Content Assist) have very little contrast between the background and foreground of a selected item. The result is the highlighted text is extremely difficult to read. Your only recourse is to mess with GTK settings.

      I had managed to address an issue with the Content Assist drop-down only to run into another issue with the Quick Outline drop-down. Finally I gave up and said, “to heck with it, I’m going to redo the whole thing.” To check out the result I came up with, head over to the Eclipse Graphene repo.

      Here’s an example:

      eclipse-dark

      0 Comments
    • 9 Jul 2015

      Eclipse Content Assist Colors

      Written by Alex Wood

      When I write Java, I use Eclipse.  It does what I need it to do, but there are a few things about it that bother me.  One of them is that Eclipse allows very limited control over the color scheme.  Most of the color settings are inherited from the desktop theme that you’re using.  I recently upgraded to Fedora 22 and with the Adwaita theme under XFCE, this is what the Eclipse content assist dropdown looks like:

      Can you read the top selection?

      Can you read the top selection?

      Notice how close the foreground and background colors are for the selected item.  I find that intolerable.  I’m not sure exactly why Eclipse is picking that color combination, because the content assist object is a GtkTreeView which has the selected item background color set to cerulean blue in Adwaita.  In any case, to fix it create ~/.config/gtk-3.0/gtk.css with the following contents:

      
      GtkTreeView:selected {
          background-color: @theme_selected_bg_color;
      }
      

      That snippet will override whatever weirdness is going on with the content assist dropdown and set the background color back to the theme’s default background color for selected items. You can also just set it to a hex value. Note that this setting will apply to any GTK3 application, but that should be all right since you’re just asking the theme to do what it is already doing.

      4 Comments
    • 28 Sep 2014

      New update for python-bitmath released

      Written by Tim Bielawa

      bitmath-1.0.8-1 was published on 2014-08-14.

      Major Updates

      • bitmath has a proper documentation website up now on Read the Docs, check it out:
        • bitmath.readthedocs.org
      • bitmath is now Python 3.x compatible
      • bitmath is now included in the Extra Packages for Enterprise Linux EPEL6 and EPEL7repositories
      • merged 6 pull requests from 3 contributors

      Bug Fixes

      • fixed some math implementation bugs
        • commutative multiplication
        • true division

      Changes

      Added Functionality

      • best-prefix guessing: automatic best human-readable unit selection
      • support for bitwise operations
      • formatting customization methods (including plural/singular selection)
      • exposed many more instance attributes (all instance attributes are usable in custom formatting)
      • a context manager for applying formatting to an entire block of code
      • utility functions for sizing files and directories
      • add instance properties equivalent to instance.to_THING() methods

      Project

      Tests

      • Test suite is now implemented using Python virtualenv’s for consistency across across platforms
      • Test suite now contains 150 unit tests. This is 110 more tests than the previous major release (1.0.4-1)
      • Test suite now runs on EPEL6 and EPEL7
      • Code coverage is stable around 95-100%

      Examples Below the Fold

      (more…)

      1 Comment
    • 27 Mar 2014

      python-bitmath – Now available in Fedora!

      Written by Tim Bielawa

      Last week I wrote about bitmath, a Python module I made for working with (prefix) units commonly used to represent file sizes, e.g., kB, GiB, Byte, TB.  I can now happily say that python-bitmath has passed the review process and has been officially accepted into Fedora!

      Need more proof?

      References:

      • bitmath on the Python Package Index
      • bitmath on GitHub (with examples!)
      • original blog post about bitmath
      2 Comments
    • 16 Mar 2014

      New side-project: bitmath – A Python module for representing file sizes with different prefix notations

      Written by Tim Bielawa

      Update: 2014-03-27 – python-bitmath is now in Fedora!

      Background

      I’ve written a new Python module which I’m calling bitmath.

      Given my day job as a System Administrator, and the content of my upcoming book on Linux virtual disks, I frequently find myself in situations requiring me to convert file sizes into various other formats. I recall far too many instances of having to do unit conversions mid-code in projects (does this look familiar to anyone else?):

      Thus, out of necessity, bitmath was born.

      bitmath

      I’m going to plagiarize myself here and rip the long description right from the project:

      bitmath simplifies many facets of interacting with file sizes in various units. Examples include: converting between SI and NIST prefix units (GiB to kB), converting between units of the same type (SI to SI, or NIST to NIST), basic arithmetic operations (subtracting 42KiB from 50GiB), and rich comparison operations (1024 Bytes == 1KiB).

      In addition to the conversion and math operations, bitmath provides human readable representations of values which are suitable for use in interactive shells as well as larger scripts and applications.

      Anyone not deeply invested in the heartache that comes with converting base-2 and base-10 prefix units can stop reading now.

      Why Should You Care?

      bitmath is Pythonic

      bitmath finally provides a uniform way to manipulate these units in a way which is natural to Python programmers. There’s nothing special or unusual required to work with bitmath objects. You can add them, subtract them, multiply and divide them — just like you’re already used to with the int and float objects. bitmath objects support all of the standard Rich Comparison Operators as well!

      bitmath converts anything

      Converting bitmath objects is a first-class supported operation. Even more complex conversions, like converting from Mibibits to Kilobytes, is trivial. This functionality is supported in both directions: from the lowliest Bit() object through the grand EiB() object. That is to say, any bitmath object, whether it be base-2 (NIST ‘kibi’ and ‘gibi’ style) or base-10 (SI ‘kilo’ and ‘giga’ style), supports conversion (without loss of accuracy) to any other valid prefix unit.

      bitmath objects print out nicely

      As the previous two examples demonstrated, bitmath objects have useful console representations, as well as string representations. In a future release the format string for this may be configurable.

      Getting bitmath

      Fedora/RHEL6 users will need to wait a bit longer for a proper yum install command to be available, as the package is currently sitting in the package-review queue awaiting judgement. Update: 2014-03-27: python-bitmath is now in Fedora!

      However, there are several other methods available for installation: installing from PyPi, building your own RPM, and from setup/distutils.

       

      1 Comment
    • ←
    • →
    Page 2 of 4
    • The Authors
    • Virtual Disk Guide

      Interested in virtualization? Do QCOWs rule your filesystem? Are you a libvirt or KVM+QEMU wizard? I wrote a book about virtual disk management. Check out the The Linux Sysadmin's Guide to Virtual Disks online for free at ScribesGuides.com.


      Consider supporting the author by purchasing a hard copy of the first edition for just $10.00 on Lulu.com.

    • bitmath

      bitmath is a Python library for dealing with file size units (GiB's, kB's, etc) in a sane way. bitmath supports arithmetic, rich comparison, conversion, automatic best human-readable representation, and many other utility functions. Read some examples on the docs site or check out the source on GitHub.

    • latest posts

      • Using jq to filter an array of objects from JSON September 9, 2019
      • Two Year Break — And we’re back! November 16, 2018
      • [Updated] GitHub + Gmail — Filtering for Review Requests and Mentions January 20, 2017
    • tags

      bitmath blog conference css dblatex DNS DocBook eclipse Emacs Erlang Fedora fedora 22 filter GNU Screen Haiku Introduction java jboss LCSEE Linux locale locales fix slicehost ubuntu Macports module nist nXML-Mode opengl open source OS X package packaging pki prefix units presentation project pypi Python scholarship si summit Tutorial ubuntu xcode XML XMPP
    • h4ck teh world

      tbielawatbielawa

    Creative Commons License
    Technitribe by Tim Bielawa is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.