Excerpts, Letters to The Man, Technical

Collocation vs Colocation

Link: https://dannyman.toldme.com/2012/12/03/collocation-vs-colocation/

This drives me insane. Part of the challenge is that most software dictionaries are unaware of the word “colocation” and are happy to offer “collocation” as an alternative, but that is wrong wrong wrong wrong and it makes me a little nuts every time.

So, here is some explanation I just sent to the NOC and copied to the Sales team of a “Colocation Provider” who keeps sending me messages from something called “Collocation Status Report”:

Dear NOC:

A collocation is a statistic used by linguists to determine the
frequency with which words and phrases are found together.

On your contact information page, there is an option to contact Sales
about “Colocation”

Assuming that you are indeed in the business of Colocation, and not
actually updating us on the status of word frequencies, please fix the
name in your outgoing envelope from “Collocation Status Reports” to
“Colocation Status Reports”


Yup. That’s all I have to say about that.

1 Comment

Presidential Decrees

Presidential Decree #2: Car Alarms

Link: https://dannyman.toldme.com/2012/12/03/presidential-decree-2-car-alarms/

Audible car alarms are a public nuisance. Their use is thus prohibited, with the following exception:

The owner or operator of an automobile may actively trigger an audible car alarm if it would serve the interests of public safety. Any activation of an audible car alarm must be accompanied by a request for emergency services. Any button which triggers an audible car alarm must also send an automated distress signal to public safety authorities. If authorities do not respond in a timely fashion, concerned citizens are empowered to act on the behalf of the authorities.

If an alarm is raised in error, the responding authority must respond in one of two ways, at their discretion:

1) Use “the jaws of life” or comparable apparatus to remove or destroy the audible portion of the car alarm. If this apparatus is not available, sledge hammers, firearms, explosives and other such tools may be used, if they can be safely deployed without jeopardizing public safety.

2) Impound the automobile for not more than 90 days. Upon confiscation, all audible alarm technologies will be removed or rendered permanently inoperable, and the automobile will be made available to members of the impounding organization for their use for either official business or employee leisure.

Feedback Welcome


JIRA Cascading Select in Jython

Link: https://dannyman.toldme.com/2012/12/06/jira-cascading-select-in-jython/

The Cascading Select Custom Field type in JIRA is a bear. The first trick is learning to set the “null” value and then the “1” child value. The next trick is building out a ModifiedValue object to hold your change. Then you get to jump down the rabbit hole of finding the correct Option values for the custom field, and setting them with the tricks just mentioned.

So, in the interests of saving me sanity next time I need to set a Cascading Select, here’s a Jython function that works in Jira 4.2:

import logging
from com.atlassian.jira import ComponentManager
from com.atlassian.jira.issue.customfields.manager import OptionsManager
from com.atlassian.jira.issue.customfields.view import CustomFieldParamsImpl
from com.atlassian.jira.issue import ModifiedValue
from com.atlassian.jira.issue.util import DefaultIssueChangeHolder
from java.util import HashSet
# cf = custom field
# issue = issue to modify
# parent = top value to set (string value)
# child = child value to set (string value)
def set_cascading_select(cf, issue, parent, child):
    # Get the managers
    cfm = ComponentManager.getInstance().getCustomFieldManager()
    om = ComponentManager.getComponentInstanceOfType(OptionsManager)
    fli = ComponentManager.getInstance().getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem(cf)
    parent_options = om.getOptions(cf.getRelevantConfig(issue))
    parent_option = None
    child_option = None
        parent_option = parent_options.getOptionForValue(parent, None)
        child_option = parent_options.getOptionForValue(child, parent_option.getOptionId())
    if parent_option and child_option:
        old_application = issue.getCustomFieldValue(cf)
        new_application = CustomFieldParamsImpl(cf)
        a_none = HashSet()
        a_1 = HashSet()
        new_application.put(None, a_none)
        new_application.put("1", a_1)
        mf = ModifiedValue(old_application, new_application)
        cf.updateValue(fli, issue, mf, DefaultIssueChangeHolder())
        logging.debug("set issue " + issue.getKey() + " cf " + cf.getName() + " setting " + parent + "/" + child)
        return True
        logging.error("invalid parent/child option: " + parent + "/" + child)
        return None

Example function calls from within a validation hook:

cfm = ComponentManager.getInstance().getCustomFieldManager()
application_cf = cfm.getCustomFieldObjectByName("Beverages")
# good
set_cascading_select(application_cf, issue, "Hard Drinks", "Whiskey")
# bad child
set_cascading_select(application_cf, issue, "Hard Drinks", "Coke")
# bad parent
set_cascading_select(application_cf, issue, "Soft Drinks", "Whiskey")
# total crap
set_cascading_select(application_cf, issue, "Illicit Drugs", "Bath Salts")

The logging stuff is useful for debugging, if you have that set up, else just remove those bits.

Feedback Welcome

Presidential Decrees

Presidential Decree #3: A Well-Regulated Militia

Link: https://dannyman.toldme.com/2012/12/17/presidential-decree-3-a-well-regulated-militia/

“A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.”

You can own any firearm you want. All firearms will be stored at armories. Armories will be regulated by the ATF. Safe transportation of armaments among munitions factories and armories will be entrusted to the National Guard. Owners of firearms may store their firearms at any armories of their choice. The operation of public armories shall be funded by subscriber fees.

Firearms owners will have access to their weapons for maintenance and skills training at their armory of choice. Different armories may have different facilities for maintenance and skills training.

Licensed hunters may “check out” not more than two firearms for the duration of the hunting season. Hunters may only check out firearms suitable for their type of hunting. Firearms intended for human combat are not to be checked out.

The Military, National Guard, and Law Enforcement Agencies shall have the ability to license their agents to bear firearms for human combat. These agents must have current training on the appropriate use of these firearms to ensure public safety. Agents should be provided with sufficient access to these firearms for the performance of their duty. When not on duty, firearms will be stored at either a public armory or a private armory maintained by their employer. Agents entrusted with combat firearms must have free and immediate access to mental health services during their employment, and submit to a basic psychiatric review every three months.

In the event of a collapse in public order, state of emergency, suspension of habeas corpus, revolution, coup d’etat, military invasion or occupation, or other circumstances in which government of the people, by the people, and for the people has been compromised or forfeited, armories may release firearms for public use at their discretion.

1 Comment


Happy Cat

Link: https://dannyman.toldme.com/2012/12/17/happy-cat/

Maxwell smiles during a belly rub.

Maxwell smiles during a belly rub.

Feedback Welcome

Arrr! . . . Avast!
Site Archive