Disclaimer

The content of this blog is my personal opinion only. Although I am an employee - currently of Imagination Technologies's MIPS group, in the past of other companies such as Intellectual Ventures, Intel, AMD, Motorola, and Gould - I reveal this only so that the reader may account for any possible bias I may have towards my employer's products. The statements I make here in no way represent my employer's position, nor am I authorized to speak on behalf of my employer. In fact, this posting may not even represent my personal opinion, since occasionally I play devil's advocate.

See http://docs.google.com/View?id=dcxddbtr_23cg5thdfj for photo credits.

Thursday, May 26, 2016

#114 (IMAP server password stored in plain text on disk) - POPFile - Automatic Email Classification - Trac

Trying POPfile - yay!



Saw this developer response, dated 1909. Scary!


#114 (IMAP server password stored in plain text on disk) - POPFile - Automatic Email Classification - Trac: "I just don't see how any kind of encryption of the password would be more than just cosmetic."
Checking:



It is still world readable by default (on my Mac).


Well, it is no longer plaintext, but I am not sure how good the crypto is.



(It's Open Source, so I will put this on my list of things to do.)






Email Classification Automation with Exchange - Microsoft Exchange - Spiceworks

Soam advocate?

Email Classification Automation with Exchange - Microsoft Exchange - Spiceworks: "Email classification is usually in the providence of the sender not the receiver, as its the sender's data thats being transferred."
'via Blog this'

Automatic Email Sorting/Classification in Outlook? - Ars Technica OpenForum

I wish:

Automatic Email Sorting/Classification in Outlook? - Ars Technica OpenForum: "automatic sorting in Outlook"
'via Blog this'


Tuesday, May 24, 2016

Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?

Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?: "For some operations, prefix notation just reads better than postfix — prefix (and infix!) operations have a long tradition in mathematics which likes notations where the visuals help the mathematician thinking about a problem. "
Semi-agreement.



I like readable and familiar notations.  I like notations familiar from math.



But I note that math also has postfix notations, such as factorial n!. Double factorial or involutions n!!. n# - commonly product of primes up to n. I argue that % is a postfix operator (that divides by 100).



And how about situations where the operator symbols surround their arguments: absolute value and cardinality |a|.  Also the open/closed interval notations (lo,hi) [lo,hi] [lo,hi).  Let alone ]a,b(, etc.



Arguably the complement of a set A^C is a postfix operator - but really is is a superscript operator.) Math also makes great use of two dimensions, subscripts and subscripts, both to left and right.  (









Myself, I prefer the approach - I think it was Algol-68 - where an operator could be applied both prefix or postfix (and occasionally infix, and other fixes).



To apply a function f to an argument value x, write



    prefix

f :- x
    postfix

x -: f
Above I have used :- and -: as my function apply operators, deliberately using unfamiliar notation. Familiar notation might be

f . x
or simply putting things next to each other

f x
in published math, usually in different fonts (which are essentially a type system).





To apply a function f to an argument list (x,y), write



   prefix

f :- (x,y)
   postfix

(x,y) -: f
    infix

x --: f :-- y
To apply a function f to an argument list (x,y,z,...), write



   prefix

f :- (x,y,z,...)
I myself don't like SmallTalk or AppleTalk like polyfix
f: x: xval y: yval z: zval
at least not beyond keyword parameters
f :- (x=xval, y=yval, z=zval, ...)


 With the usual elision and shortenings



   prefix

f :- x  
==> f. x 
==> f of x 
==> f(x) 


    postfix

x -: f 
==> x's f
===> x | f    (stretching to use a UNIX-like pipe notation) 
    infix

x --: f :-- y 
==> x .f. y
===> x .+. y 
==> x + y     (if the operator f or + is syntactically defined to be infix) 




I suppose that allowing different *fixes for the same function goes against Python's "there should be only one way to do it" philosophy.


Friday, May 20, 2016

I like Python's brevity

I like Python's brevity.



?



Actually, I like Python's use of indentation.  It makes the code more readable.  It closely corresponds to how many people write pseudocode on paper.  (Now, if the code could only contain vertical bars down the left, the number of which indicate the nesting level.  Hmm, I wonder



In most respects, Python is NOT a language of brevity.   Python code is often verbose.



But the use of indentation is elegant and reduces clutter.



(Perl's sigils? clutter!)









I am amused that Python3 is increasing the amount of syntactic clutter, by requiring parentheses around the arguments to print - print("a") versus pythin2 print "a".



It's a pity that Python3 could not figure out a way to allow function calls without ()s.

less than function Block scope in Python

:-(
Block scope in Python - Stack Overflow: "No, there is no [python] language support for creating block scope. The only means to create scope is functions, classes or modules."
Someone else goes on to say: "The idiomatic way in Python is to keep your functions short. If you think you need this, refactor your code! :) "
I could very much like Python - but whenever I try to use it, I run into things like this very quickly.

I like Python's use of indentation.

But I imagine that the reasoning runs like this:
  • Python uses indentation and hence doesn't need {...} to provide blocks for constructs like IF, functions, etc.
  • But since Python doesn't have {...} blocks, we have no way to provide lexial scope except for def: and class: and modules.
  • "Who needs it anyway?" says the chorus of unimaginative twerps. "Just refactor".
So think about refactoring: you could introduce a function with def, and then call it immediately.  Must make sure tat the function cannot be called from elsewhere, but Python allowing local definitions (not-quite-closures) is sufficient for that. But that requires typing the name in twice.  

I have been doing the following in some python code:
statement1
statement2
if 1:
     statement3.1
     statement3.2
statement4
when I want to emphasize the relatedness of statements3.1 and 3.2.

The equivalent of 
statement1
statement2
{
     statement3.1
     statement3.2
}
statement4
in Perl or C.

(Amusingly, emacs often requires me if add an if(1) to the blocks {}.  It doesn't like indented "blocks in space".  After all, what crazy person would want to create lots of local blocks?)

I like indicating the relatedness.

Plus, if I need a temporary variable or to import a function, I like to be able to do so in the smallest scope possible.

Yes, it can be refactored to be a function that is immediately invoked.  But that is repetitive.


This explores aspects of one of my rules "The most important thing in programming is the ability to give something a name.  The second most important thing is to not be required to give something a name."

Python requires scopes to have names.   It fails the second most important test.



---


The obvious way to support scopes in an indentation oriented language like Python would be:

statement1
statement2
scope:
     statement3.1
     statement3.2
statement4
i.e. introduce a keyword "scope" or the like.

Wanted: portable labelmaker, USB charge, upload label and location to database

I just spent ... more time than I want to admit ... searching for the lost AC adapter for my label printer.
DYMO LabelManager 280D Label Maker:
Rechargeable Battery Pack
USB Cable
D1
Charging Adapter
Damn! You would think that if it has a USB port, it could be charged via USB!!!!

I can understand that it might not be possible to operate via USB, if the labelmaker thermal printer takes too much power during operation.  But at least it could charge the battery!



Here's a Product I Want:
  • LabelMaker
  • Battery powered
  • USB
    • to charge battery
    • for data communication with a controlling device
      • PREFERRED: to mobile device (cell phone, tablet)
      • LESS PREFERRED: to PC (Windows/Mac/*x/..., desktop/laptop/...)
OPTIONAL: freestanding, with the sort of lousy membrane keyboard that most label makers have.

ALTERNATE: use controlling device (cell phone, tablet, or PC) to write the label, etc.
  • PREFERRED: cell phone and/or tablet
    • Form factor of labelmaker such that it can easily be attached to mobile device.  
      • E.g. clip over the edge of a cellphone, although that makes product specific to particular phones
      • Myself, I would probably velcro it or otherwise attach it to my cellphone. 
  • MUCH LESS PREFERRED: PC or laptop as controlling device for labelmaker
    • Kills the usage model of composing and printing labels at storage shelves
Frankly, being able to write the label on a phone/tablet/laptop/PC is NOT a big selling point for me.  (Unless there is no keyboard on the labelmaker.)

Much more important to me would be having the ability to upload the text labels written and printed while walking around to a database.

I.e. PC--->LabelMaker or phone--->LabelMaker not important

LabelMaker ---> phone/PC/... is more important

USAGE MODEL: putting stuff away in storage. Print and label storage box or file, upload text of label (along with date and location) to a database.   So that you almost automatically get a database telling you WHERE you have stored a physical box or file.

Bonus points for allowing a photograph of what is being put away to be taken and recorded to the database.

The need to have location (GPS/other) and photo motivates having a labelmaker that is controlled by a mobile phone via USB or similar.  Plus, it gives you a much better input device than the lousy membrane keyboard typical of labelmakers.  Cost reduction for the labelmaker.

PlusPlus, if you have a need to download long lists of labels to print, phone/PC--->LabelMaker gives you that ability.

Location: GPS or wifi or or other usual wireless a start.   But if you want to record which room of a house or which shelf in a storage closet of an apartment you have put the box or file in, GPS not fine grain enough.   This partly motivates photographs - e.g. photograph a shelf, possibly with an ID number.  But it might also motivate something more convenient for user, such as RFID on shelves. Slightly more advanced tech, but more convenient. If you have home automation, e.g. for light switches, those IDs may be sufficient.

---

Further: standalone portable LabelMaker with wifi or other wireless - to update database immediately.  (Of course, it would need the usual lousy labelmaker keyboard, if not attached to a mobile phone.)