Monthly Archives: June 2015

AHK: Hint current layout with custom cursor

This post is for those using more than one language in their Windows environment.
Each Windows application stores it’s own layout (language) state. It introduces a mode in Jef Raskin’s terms. When you switch to a particular application it’s completely invisible for you what layout it’s set to. Consider the situation. Say you were previously typing in Russian in one app, then you switch to another app and type in English for some time, then you switch back to the first app and start to type in English thinking it has an English layout set. But you current layout for this app is set to Russian, so oops, you put some gibberish. Now you have to delete it, switch to English and start over again. And that happens over and over again.
The modes are evil. Invisible modes are absolute evil.
Here’s how we can fight this evil mode. Let’s make it visible again! To become aware of what layout the app is set to let’s show a little red dot near the cursor just for a second if it’s set to non default layout.
This can be easily done with AutoHotkey. To actually have a red dot near the cursor, alter any cursor you use with some soft. I used a shareware Aha Soft Art Cursors. Here’s the resulting cursor.
cur
So now when you have a cursor for non default language, just use the following code to change all system cursors for just a second if an app layout is not the default one (in my case it’s English).

As any .ahk script it seats in a tray.

ora_te: v1.0.3 is here

A simple template engine for Oracle ora_te has a new release v1.0.3.
IF and FOR constructs are implemented (the Twig way), while old syntax for loops is moved behind syntax proxy.
Road map for further development:

  • Filters for uppercase, lowercase and capital case (like in Twig).
  • Partial substitution

ora_te: On further development

Hi, we are talking about ora_te again.
I’ve finally decided to implement IF construct, but I want to do it in a slightly different way I wanted earlier. Next release of ora_te will feature new syntax for LOOP construct and a an implementation of IF construct in a form very similar to twig template engine.
It will greatly improve readability of templates.
Plus such things as concatenation by new line and carriage return could be directly archived by writing actual new line in the template.
Compare

{% for cur:1 |  , %}t1.{{column_name}} = t2.{{column_name}}
{% endfor %}

to

{% for cur:1 |, %}t1.{{column_name}} = t2.{{column_name}}{% endfor %}

First of given templates will naturally insert new line after each loop substitution, while second one will produce one line.
If construct will also be implemented the twig way.

{% if ('{{column_name}}' = 'dummy' ) %}
  gotcha
{% else %}
  nope
{% endif %}

Sure old syntax will not be deprecated.
Rewriting a merge example with a new syntax will result in something like

'merge into {{dest_table}} t1
using {{tmp_table}} t2
on (t1.{{join_by}} = t2.{{join_by}} ) 
when matched then 
  update set {% for cur:1 |  , |n|?|%}t1.?1 = t2.?1 
{% endfor %}
delete where t2.status_code = ''D''
when not matched then insert( 
  {{dwh_pk}}
  , {% for cur:2 |,%} t1.{{column_name}} = t2.{{column_name}} 
{% endfor %} 
) values ( 
  {{sequence_name}}.nextval 
  , {% for cur:2 |,%}t2.{{column_name}}
{% endfor %} 
) 
where t2.status_code <> ''D''';