Envelopes in algorithms

In mathematics / computer science algorithms, it is sometimes useful to solve a problem in terms of an "envelope" over source data such as a time series or other data sets.

You could look at a time series as an array of values, and the position in the array is the time (array[0] is the value for time=0) and the contents in that position is the value at that time.

Another way to look at a time series is a function, func(time)=value.

Given a time series function, the upper-left envelope takes a value at time=t that is the maximum of all points of the original function between 0 and t inclusive. If you take the minimum, that's the lower-left envelope. If you start from the right instead of the left (max/min of all points from t onward), it's an upper-right or lower-right envelope. You can draw the envelope on top of the graphed original data to visualize it.

Upper-left envelope (red) over original data / time series (blue)


dvorak international on windows 8 / 8.1 and custom windows 8.1 keyboard layouts

just so y'all know, international dvorak keyboard layouts can still be installed on windows 8.1.

the famous international dvorak page has the setup files:

however, after the installation, it appeared nothing had changed, and i couldn't select the new keyboard layout in control panel.

after trying to install the keyboard layout dll file manually myself, and after realizing the Microsoft Keyboard Layout Creator was never going to work on windows 8, i finally realized the solution:

simply log off and back on for installation of layouts generated from Microsoft Keyboard Layout Creator to take effect.

since arjen's downloads seem to have been generated using Microsoft Keyboard Layout Creator, it follows that to create a custom layout for windows 8, you can use the Microsoft Keyboard Layout Creator on a windows vista computer to create the setup files, and then do the installation on windows 8.


"Please wait (for the Local Session Manager)" Windows 8.1 remote desktop

After installing several virus scanning applications (including Sophos, which seems to be known to cause this) on a recently infected computer, remote desktop connections took forever and sometimes never connected at all.   Uninstalling the virus scanners didn't help, nor did disabling all services with msconfig.  The system restore point I needed was already deleted.

The symptom was simply "Please Wait" showing for several seconds when starting the computer, switching users, or connecting via Remote Desktop.  Restarting would make it work temporarily.  Apparently if you disconnect while this message is shown, remote desktop will stop working until restart if you are affeted by a particular bug.

After going to Group Policy (start, run, gpedit.msc) and enabling Computer Configuration -> Administrative Templates -> System -> "Display highly detailed status messages", the error read "Please Wait for the Local Session Manager" instead of just "Please wait".

The solution for me was to disable Remote Assistance in Advanced System Properties / Settings -> Remote tab.  No restart required.

After this, Remote Desktop worked normally.

Would be a shame if I ever wanted to enable remote assistance I guess.  I guess that's what TeamViewer is for.

Kudos to this post for helping me fix this:

Hope this helps!


how to change alarm ringtone without playing it on android nexus 5

it makes me sad when people who design alarm clocks don't ever think you'll want to set an alarm without waking up your wife/husband/baby/roommates.  setting an alarm should be a silent process unless the user wants it not to be.

on nexus 5, setting alarm volume makes a noise when set from the Settings app, but you can also change alarm volume using the buttons on the side of the phone when on the screen to change the alarm ringtone.

so you can set the alarm ringtone to max volume without making a noise, but as soon as you choose a ringtone, it plays it at that volume.

one workaround is to set the volume to 0, then choose a ringtone, and then put the volume back up.  just dont forget.

however, if you had the volume at just the right setting and you don't want to forget what it was, or if you are woeries that, being sleepy, you will forget to put the volume back up after scrolling through and thinking of an alarm to choose, you can try this:

tap down on the alarm and the ok button at the same time, but dont let go.  neither the alarm plays and gets selected nor does the ok button exit out until you lift up your fingers.  so, lift up both fingers at the same time, and hope that the alarm gets selected first and then the ok button gets pressed.  if your  change wasn't saved, simply try again.  the ok button cuts off the alarm, so technically the alarm will still play, but for 0.01 seconds, and you won't hear a thing.

and for some reason, blogger decided to make this paragraph really big when i started typing it.
[edit:  just a bug in the editor.  font not big when published.  thought i'd let y'all know.]


how to convert state to timezone using excel formula

Here is an Excel function to get a timezone based on the state.  Some states have multiple timezones, so I just chose the timezone that looked like it took up most of the state on the timezone map.

This takes a two-letter state and converts it to "Pacific", "Mountain", "Central", "Alaska" or "Hawaii".


This takes a two-letter state and converts it to "PDT", "MDT", "CDT", "AKDT" or "HST".


Copy and paste the formula into a text editor such as Microsoft Word, and then do find-replace to change A1 to whichever cell has the state you want to replace, such as D2.  Then plop the formula into excel.

Currently, the formula gives a blank value if the state isn't the 2-letter abbreviation of any of the 50 states in the U.S.  To make it say something, like "ERROR", add some text in between the last set of quotes in the formula, after "Hawaii".  E.g.  ... "HI")),"Hawaii","ERROR!")))))...

If those formulas don't work, you can try something like this thanks to the person in the comments who suggested it. This seems to work on Google Sheets and Excel Online.
=if(OR(A1="CT", A1="DC", A1="DE", A1="FL", A1="GA", A1="IN", A1="KY", A1="MA", A1="MD", A1="ME", A1="MI", A1="NC", A1="NH", A1="NJ", A1="NY", A1="OH", A1="PA", A1="RI", A1="SC", A1="VA", A1="VT", A1="WV"),"Eastern",
if(OR(A1="AL", A1="AR", A1="IA", A1="IL", A1="KS", A1="LA", A1="MN", A1="MO", A1="MS", A1="ND", A1="NE", A1="OK", A1="SD", A1="TN", A1="TX", A1="WI"),"Central",
if(OR(A1="AZ", A1="CO", A1="ID", A1="MT", A1="NM", A1="UT", A1="WY"),"Mountain",
if(OR(A1="CA", A1="NV", A1="OR", A1="WA"),"Pacific",


usona dvorak international keyboard in ubuntu / linux: esperanto "u" with breve/hoketo/luneto

se vi uzas linukson / ubuntu, kaj vi tajpas uzante internacian dvorak-an klavaron, vi eble ekkonsciis ke por fari ĝ, oni premas ^ kaj g, ktp por tajpi aliajn cxapelitajn literojn (kun la cirkumflekso).  sed por tajpi ŭ, ne tiom simplas.  ^ kaj u faras û, sed kiel tajpi ŭ?

RESPONDO:  unue premu dekstra-alt (AltGr) + shift + 9, kaj malpremu, kaj premu 'u'.

laŭ la dosiero "/usr/share/X11/xkb/symbols/us"
sub "dvorak-intl"
la "dead_breve" klavo estas tajpita per alt+shift+9.  "dead" signifas ke la hoketo/"breve" aperos sur la sekve tajpita litero.   la tria kaj kvara kolumnoj estas atingebla per la dekstra "alt" klavo--la tria sen "shift" kaj la kvara kun "shift".

uzu "sudo vim ./us" por redakti la klavaron.  trovu "u, U, uacute, Uacute" sub "dvorak-intl", kaj anstataŭ "uacute" tajpu "ubreve", kaj anstataŭ "Uacute" tajpu "Ubreve":

 key <AC04> { [         u,          U,        ubreve,           Ubreve ] };

tiel, oni povas premu dekstra 'alt' + 'u' por tajpi 'ŭ' pli facile.


if you use linux / ubuntu, and type using the interational dvorak keyboard layout, you might've noticed that to make a ĝ, one presses ^ and g etc in order to type hatted letters (with the circumflex).  but to type û, it's not that simple.  ^ and u make û, but how to type ŭ?

ANSWER: first press right-alt (AltGr) + shift +9 and let go, and then press 'u'.

according to the file "/usr/share/X11/xkb/symbols/us"
under "dvorak-intl"
the "dead_breve"key is typed by pressing alt+shift+9.  "dead" means that the breve will appear on the next letter typed.  the third and fourth columns art attainable by the right "alt" key--the third without shift and the fourth with shift.

use "sudo vim ./us" to edit the keyboard. find "u, U, uacute, Uacute" under "dvorak-intl", and instead of "uacute" type "ubreve", and instead of "Uacute" type "Ubreve":

 key <AC04> { [         u,          U,        ubreve,           Ubreve ] };

this way, one can press right 'alt' + 'u' to type 'ŭ' more easily.


Sonos controller prevents standby / sleep / screensaver

Just wanted to let y'all know that Sonos Controller 4.2 on Windows XP prevents the computer from putting on the screensaver / locking your computer / going into standby/hibernate, or turning off your monitor.

This is only so when music is actually playing.  If you hit "pause" on the controller, the computer can do its power-saving tricks.

Workaround: pause the music or set the sleep timer in Sonos Controller.

I don't see a way to change this behavior, let me know if you find one.