Email address validation rant

October 21st, 2015

This is my canned pre-written gripe to send to website’s who don’t allow all valid email addresses to be entered into their registration forms….

Dear web developer,

Your website does not accept all valid email addresses in one or more forms where you allow a user to enter their email address. Importantly it does not accept the plus sign “+” which *IS* valid and is widely used as a feature called sub-addressing, see below. Furthermore there are many more special characters which are being blocked but that are in fact valid email address characters allowed by the RFC specs, see below.

Sub-addressing: Also known as plus addressing or tagged addressing. Some mail services support a tag appended to the local part, such that the modified address is an alias to the unmodified address. For example, the address denotes the same delivery address as The text of the tag may be used to apply filtering, or to create single-use addresses.[9] Some IETF standards-track documents, such as RFC 5233, refer to this convention as sub-addressing.

Google’s Gmail takes advantage of sub-addressing:

Note that there are many special characters which are valid
RFC 822

Please bring your system up to spec and support all valid email addresses.

Thank you
Mike Makuch

Keyboard customization for Emacs

September 11th, 2015

In order to use Emacs effectively you have to customize your keyboard bindings. You really do have to do this one way or another. For a long time I tried to use the “standard” emacs bindings but eventually I realized you really can’t be productive that way.

I’ve been using Macbooks for several years now for my primary code editing device. Here’s how I have customized my keyboard.

First know that I use both emacs and vi. (I will always call it vi (pronounced “v” “i” two syllables). I used vi many years before vim came about and so even though I use vim I will always call it vi), so I need the Escape key for both. I use emacs as my primary code editor and dev IDE. But I’ll use vi when I just need to do quick edits, especially over ssh.

On a Macbook the escape key is kinda far away on the upper left corner. In fact on the new Macbooks they’ve removed it completely. Ridiculous.

Swap Control and Caps Lock keys. The built in Keyboard settings in the System Preferences, under Modifier Keys. Here I swap Control and Caps Lock. This puts the much needed Control Key within easy reach of left pinky. This is a must for emacs users and as you’ll see a life saver for vi users too.

Karabiner: I use for several keyboard customizations:

  • Caps Lock overloaded With Karabiner I use the Caps Lock key for a 2nd function: if pressed-and-released then ESCAPE. So when I press and release the Caps Lock key it issues an Escape char. So this replaces the need for the physical Escape key! Note that I use this both for vi and emacs. In vi Escape is used to exit insert mode. And in emacs Escape can be used as the Modifier key. Winning.
  • C-, and C-. for word left/right I find emacs’ out-of-box bindings for word left & right to be cumbersome so in Karabiner I bind C-, and C-. to C-B and C-F respectively. I find the , and . easier to use. The reason I do this in Karabiner instead of just mapping in Emacs is so that I have them available in the Terminal bash shell when editing commands, as well as in emacs.
  • Return+ to Option_L Also in Karabiner, when I hit Return and release, it’s just a Return. But if I hold Return down then it acts like the Option_Left key (Alt) which is the Meta key in Emacs. One disadvantage with this is that I lose the key repeat for Return key. But C-j suffices for that. I’ve found tho that I don’t use Return+ as Meta key. Rather I just use the CapsLock+release described above.

Karabiner has myriad ways to customize the keyboard. One thing for mac users, apparently Sierra totally changed the keyboard api, or something, so much that Karabiner won’t work at all. If you go read the info the guy has started working on the Sierra version of Karabiner but it may not be near as good. So, when I upgraded to Sierra last year and discovered this, I immediately went back to Capitan and will stay hear till I get Karabiner-like ability..

These days I’m a single computer person. I use nothing other than my laptop (** which happens to be a Macbook see below) so the above works for me. In the past it wouldn’t work cause I used to use multiple computers throughout a day. But for now this works.

(** which happens to be a Macbook, I’m not a fan boy or anything I just like unix and apple makes a decent laptop. But, since they’ve seen fit to produce this abomination of a laptop with no Escape key and the “touchbar” I may never get another macbook. May have to try a System76 or something made for Linux).

I guess that’s it.

astro trivia

May 31st, 2014

I was curious about a couple things and did a little surfing…

Diameter of our solar system 90 AU or 8 billion miles or .001 light years.

Milky Way ~ 100,000 light years in diameter, 200 – 400 billion stars.

Nearest star: Alpha Centauri ~ 4 light years away.

1 light year is about 5.8 trillion miles.

Nearest galaxy: Cannis Major Dwarf – Actually it’s sort of part of the Milky Way only 25k-40k light years away from Sun – apparently it collided with Milky Way long ago. Only has a billion stars.

A few other galaxies are similarly close <~ 100k light years away. Andromeda Galaxy 2 million light years away nearest spiral galaxy, is bound to Milky Way, this plus Milky Way plus a few other galaxies make up the Local Group which are gravitationally bound together. The Large and Small Magellanic Clouds are two irregular dwarf galaxies about 180,000 and 210,000 light-years away, respectively. They were thought to be orbiting the Milky Way, but that may not be the case.. All of these galaxies make up part of what is called the Local Group, which is a group of more than 30 galaxies that lie within 4 million light years of the Milky Way. Here’s a great article from the Spitzer Space Telescope’s website on the Milky Way’s family of close galaxies and a video by the same author on the subject. Read more: All the stars we can see with the naked eye are within 1000 light years away, so they're all in our Milky Way. There are a few galaxies we can see with the naked eye; The Andromeda Galaxy is 2.5 million light years away, but is visible in the night sky in the Andromeda constellation as a hazy patch of light about the size of the full moon. The Large Magellanic Cloud and the Small Magellanic Cloud are 2 smaller satellite galaxies of our own Milky Way, and are visible in the southern hemisphere. Source: the net

C array subscript weirdness

September 20th, 2013

$ cat test.c
#include <stdio.h>

int main() {
int a[2];

1[a] = 1; // weirdness

printf("%d %d\n",a[0], a[1]);

$ gcc -o test test.c

$ ./test
0 1

The subscript operator is commutative for what ever reason.

*(a + 1) < => a[1] < => 1[a]

Generic makefile for easily building 1 file programs

September 18th, 2013

I’ve always found myself writing short little programs to test out an idea or learn how a language feature/bug works. Often they’re throw away programs, once finished they’re no longer needed. So often it ends up being test.c/test.cpp/ etc. But sometimes I like to keep it around so they’ll end up with a meaningful name i.e. I now have a lambda.cpp I used for trying out the new C++11 lambdas. So rather than always have to whip out a new makefile or copy/edit an old one I have this makefile which makes things a little easier. You just drop the makefile in place where you have file.cpp’s laying around and you can compile that single file.cpp with ‘make file’. As you can see I have it working on linux, osx, and windows.

$ cat - > hw.cpp
#include < iostream >
int main() {
std::cout < < "Hello, world!\n";

$ make hw
g++ -std=c++11 -Wall  hw.cpp -o hw

$ ./hw
Hello, world!

Here's the makefile

# generic 1 file makefile
# 2013/09/18 Mike Makuch
# This makefile will compile any single file.cpp file without modification
# by simply typing 'make file' without the .cpp eg;
#	file name	myprog.cpp
#	type:		make myprog
# Initially works for linux, osx, win7/vs2012,
# Written assuming gnu make

UNAME := $(shell uname -s)

	MAKEFLAGS += --no-builtin-rules

ifeq ($(UNAME), Linux)
CFLAGS = -std=c++11 -Wall 
CC = g++
COMPILE = $(CC) $(CFLAGS) $< -o $@
BINS = $(subst .cpp,,$(SRCS))

ifeq ($(UNAME), Darwin)
CC = /opt/local/bin/g++-mp-4.7
CFLAGS = -std=c++11  -L/opt/local/lib -I/opt/local/include
COMPILE = $(CC) $(CFLAGS) $< -o $@
BINS = $(subst .cpp,,$(SRCS))

ifneq (,$(findstring CYGWIN_NT,$(UNAME)))
CFLAGS=/O2 /nologo 
#LIBS=gdi32.lib user32.lib kernel32.lib shell32.lib winmm.lib opengl32.lib glu32.lib
LIBS=user32.lib kernel32.lib shell32.lib
COMPILE = cl /EHsc $?  /Fe$(subst .cpp,.exe,$?)  ;  rm $(OBJ)
OBJ = $(addsuffix .obj,$@)
BINS = $(subst .cpp,.exe,$(SRCS))

SRCS = $(shell ls *.cpp)

% :	%.cpp

	rm -rf $(BINS) *.dSYM *.obj *.exe

author unkown

June 28th, 2013

Great minds discuss ideas, average minds discuss events, and little minds discuss people. Widely credited to Eleanor Roosevelt but if you keep digging that’s not clear.

Advanced Certification

March 18th, 2012

Advanced Scuba Certification

Got it done this weekend. Also took the Nitrox test this week.

4 dives in Travis, 2 Sat 2 Sun. 3/17 & 3/18, 2012

Water temp about 57. Outside low 70s. Had complete thick (6 mil?) suit on actually it was a wader type bottom which covered ankles to chest then a top half that covered head to knees so it was doubled up. Then had booties/fins and a hoodie. Only thing not covered was hands and they were fine. I was almost toasty warm the whole time.

Visibility: almost nothing at times, almost total brown out at other times. Great experience.

Made it to about 60′ or just below that each days 1st dive. Was trying to get down to 80 or 90 or what ever, but silt avalanche followed us down (rookies) and instructor aborted descent.

Dove Shaker Plant site both days. Old construction area when damn was built. Just a bunch of old pillars, concrete blocks, timbers, big crap laying around you have to watch out for. They’ve got a bunch of lines tied to follow around.

My first dive was a helluv an experience. Definitely pushed out of my “Cozymel” comfort zone ha ha :-)

Because of numerous rookies they/we quickly stirred up tons of silt on the bottom and what would have been maybe 10 feet of vis quickly degrades to almost nothing at times. Most of the time it was several feet and you could definitely see the other flash lights for the most part as long as we were together. Or I’d be able to see the fins kicking in front of me but couldn’t see the upper body connected to them. Several times one of the group would get “lost” not really lost but gone out of site and the instructor would go chase ’em and get ’em going back in right direction. One time I pointed out to him that we’d lost one of the group and he went and got her.

It’s very interesting how being nearly blind so dramatically changes the experience. I visualize the dive site of the areas we were diving and imagine it was only an area of say 100 feet square, or maybe 200 feet, I’m not sure but not that big an area. This would be nothing in blue water as you’d be able to see the whole area from one spot and thing nothing of it. But remove vision and it’s an amazing experience. Like being in a maze of twisty little passages. You don’t know what you’re swimming up to until you’re right there. Kinda spooky at first but 2nd day I was all over it.

I dove in groups of 3. Instructor and 2 advanced students each dive. We dove off of Giant Stride pontoon dive boat.

We’d drop down, follow lines around down to around 50 or 60 feet to see if we could attempt a deep dive to 90 or so. Plan was if viz was ok we’d descend down but each time we tried the rookies kicked up too much silt and viz got poor so we couldn’t go down further. So, we’d just swim around practicing staying together, following the lines and staying close and practicing communicating – which were all a real challenge given the very short visibility.

It was a real challenge is several ways. You really can’t see where you are, the bottom or anything much of the time. So, you have to rely on your gauges for your depth and controlling your buoyancy. This was very new to me. I did much better 2nd say than 1st. It was good to have a day between – I thought about it a lot and figured out what I needed to do.

Also did a navigation exercise where I was to swim a square by following compass N-E-S-W 3 mins each leg. 1st day tried it and it was quite difficult as I hadn’t ever tried anything like this before. You have to constantly watch your gauges, clock, compass, depth and adjust and control all 3 concurrently – all without being able to see any bottom or features for reference – imagine being in a white out blizzard except this was more like a mud out.

First attempt I didn’t do well. I was having trouble controlling my neutral buoyancy, then I’d get neutral and find I was 90 or 120 degrees in wrong direction, etc. 2nd day (today) I nailed it. Had total control of my buoyancy and direction. I felt like I really swam in correct direction and depth each of the 4 legs and I believe that’s the case. What I didn’t factor though was my timing was off on 1 or 2 of the legs and so I didn’t end up exactly right back at the boat. Idea was to pop up when done with the square and I’d be right behind the boat where I started. Great drill. Would love to do it again.

I believe we had to perform 3 out of a number of different tasks in order to get the advanced cert, though that wasn’t made clear to me. So I got deep water (anything beyond 60 is deep), low visibility, and the navigation component.

I totally appreciate lake diving now. It’s not about scenery. It’s about mastering your diving skills, at least this was. I loved it. I’d like to do more of this kind of stuff. I’ll have to look into the Master Diver program.

The Nitrox certifcation is just basically all about Nitrox, which is pretty straightforward with a few details. It’s getting more popular and available, extends your dive time and so need to be able to use it.

CS371P #14

December 2nd, 2011

Oops, one more blog. *this is the last one.

Today was the last day of the semester. Took the final test today. I found it to be shorter than exam 2, which helped. I was able to finish the test and go back over and check for mistakes. I’m sure I did well enough. I’ve always found written programming tests to be a pain, unrealistic and not something I am particularly great at. My strengths have always been in design and development. I scored well on the projects. As I should. I should do well on tests too. But that is my weakness. All of the extra credit raises the grade by 9% – almost a full letter grade. So for that reason I’ll get my grade.

I’m sure that having written test skills works in advantageous ways for those who have them. But it’s not the only way to succeed as a developer. I’m proof of that. It appears that our instructor is somewhat in tune with that as evidenced by the weighting of the projects and the ample extra credit. I don’t think all instructors are tuned in that way. I got lucky choosing this class.

Still I want to believe that test taking is a skill set that can be improved upon and I am challenged by it. I consider myself good at what I’m doing and so I ought to be able to do well on tests. So, I intend to look for information in this area, improving test taking skills that sort of thing. Especially as I’m considering grad school.

I enjoyed this course. Our instructor has obviously refined his teaching techniques over many years. He really maximizes the classroom experience by causing everyone to be 100% engaged every day in class. The short quiz every day. And the system he has of calling on people to answer questions really keeps everyone on their toes – lest they be humiliated in front of their peers. It works well sort of like a C++ boot camp. I didn’t like it at first but I came around.

I am pleased with my new C++, java & OOP knowledge. Most of the OOP was review for me and the programs were mostly trivial. But all the C++ ins and outs, corners and nuances I enjoyed learning. I will be putting it to practice soon.

Enjoyed meeting a few of you guys. See you around.

Calvin Coolidge

November 28th, 2011

Nothing in this world can take the place of persistence. Talent will not; nothing is more common than unsuccessful people with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. The slogan “press on” has solved and always will solve the problems of the human race” – Calvin Coolidge

CS371P #13

November 28th, 2011

Last week of the semester and this is the last blog. I did manage to get quite a bit of studying done over the break though not as much as I had hoped.

This my first semester back to school has been an interesting and fun experience. I’ve learned quite a bit of C++ that I never knew. Which was a surprise, I thought this class was going to be mostly java. I plan to do more studying of C++ in the near future. And I hope to use java at some point for an extended period of time so I can become fluent with it.

I enjoyed this class and I’m glad this is the one I chose to take as my last CS course. I enjoyed working with the partners that I had. Chances are some of us will run into each other in the future. I look forward to that. Look me up on LinkedIn, Facebook or Google+.