Category: Computers

  • Postgres tip of the day – show size of all databases

    Here is a handy little query to show the size of all the databases on a particular postgres server: SELECT pg_database.datname, pg_size_pretty(pg_database_size(pg_database.datname)) AS size FROM pg_database; datname | size ————–+——— template1 | 6369 kB template0 | 6361 kB postgres | 6589 kB foo | 55 MB bar | 5129 MB foobar | 85 GB (6…


  • Unicode block names in regular expressions

    Frequently, I find myself wanting to do some simple language detection. For Chinese, Japanese, and Korean, this can easily be done by looking at the types of characters in some text. The simplest and most robust way to do this is to use Unicode block names. It is very simple to write a regular expression…


  • Monkey patching in python

    I was just reading an article about Martijn Pieters, who is a python expert, and he mentioned monkey patching I did not know what monkey patching is, so I googled it, and found a great answer on stack overflow Basically, it takes advantage of python’s class access philosophy. Unlike java, which has a strict access…


  • Java anchored regex

    I just discovered this today when doing some regex in Java. When I first started doing regex in Java, I was surprised to learn that Java seems to treat all regular expressions as anchored. That is, if you have a string foobar and search for “foo” it will not match. This is different than grep,…


  • Solr DataImportHandler preImportDeleteQuery gotcha

    One handy feature of the DataImportHandler in solr is that you can group documents by different entities. In the MKB we have a couple different kinds of entities we import – songs, albums, tvshows, etc. Sometimes we make a change or improvement to the underlying data of one type of entity, and want to test…


Join 165 other subscribers

archives

  • 2024 (10)
  • 2023 (8)
  • 2022 (15)
  • 2021 (19)
  • 2020 (1)
  • 2019 (1)
  • 2018 (2)
  • 2017 (1)
  • 2016 (2)
  • 2015 (5)
  • 2014 (5)
  • 2013 (2)
  • 2011 (7)
  • 2010 (10)
  • 2009 (50)
  • 2008 (28)
  • 2007 (31)
  • 2006 (8)

Category