October 2015

Weekly review: Week ending October 2, 2015

October 3, 2015 - Categories: review, weekly

My tiny corporation’s fiscal year ended this week. I did a dry run of corporate tax preparation so that there won’t be any surprises when I file. Reconciled bank statements, corrected transactions, compensated for the exchange rate, followed up on stuff… Looks like it’s all ready to go once the final statements come in.

In terms of sewing, this week I focused on learning more about patterns. I used tmtp to write Python scripts that drafted basic shirt patterns, but I still need to sew muslins to test whether the patterns make sense. (Some of the pieces look a little weird…) It’s been a slow week because things still feel pretty theoretical, but maybe I’ll spend next week knocking out a few small sewing projects so I have more of that feeling of accomplishment.

Also, I got to chat with cool people about Emacs and life. =) Thanks to Bill Z. for reaching out!

2015-10-03a Week ending 2015-10-02 -- index card #journal #weekly

output

Blog posts

Sketches

Focus areas and time review

  • Business (16.2h – 9%)
    • Earn (11.7h – 71% of Business)
      • File September invoice
      • Earn: E1: 1-2 days of consulting
      • Earn: E1: 1-2 days of consulting
    • Build (4.6h – 28% of Business)
      • Drawing (0.1h)
      • Paperwork (4.4h)
        • Enter transactions into Quickbooks
        • Doublecheck tax installments
        • Do Paypal USD conversion
        • Credit back personal amount for telephone expenses
        • Sort out GST/HST Payable account
        • Fix depreciation
    • Connect (0.0h – 0% of Business)
  • Relationships (5.7h – 3%)
    • Meet Bill Z
  • Discretionary – Productive (21.6h – 12%)
    • Emacs (0.0h – 0% of all)
    • Renew livinganawesomelife.com
    • Sewing (17.1h)
    • Writing (4.6h)
      • Try creating a Python pattern
      • Pattern-making: Generating SVGs for sewing with Python and tmtp
  • Discretionary – Play (15.3h – 9%)
  • Personal routines (30.5h – 18%)
  • Unpaid work (15.2h – 9%)
  • Sleep (63.4h – 37% – average of 9.1 per day)

Learned how to replace a zipper

October 6, 2015 - Categories: sewing

One of W-‘s winter jackets had a zipper that started to separate at the bottom. In retrospect, I should’ve tried squeezing the slider with pliers to see if that simple fix would take care of it. Then again, W- had probably already tried that before checking out zipper replacement tutorials on Youtube. Besides, replacing the zipper would also let us swap out the coil zipper for a plastic molded zipper (or what YKK calls Vislon zippers), which W- wanted.

There’s a tailor near us that charges $1/inch for replacing zippers, but I figured I’d give it a shot first. Free opportunity to learn a potentially useful skill, after all. I used a seam ripper to open the zipper-related seams. One of the sides came apart pretty quickly, but the other side required reaching through the lining of the jacket in order to loosen a few stitches before I could cut the rest of the threads.

Since I had the lining open anyway, I figured it was a good time to unpick the over-zipper flap’s hook-and-loop tape segments so that I could replace them with snaps. (Velcro is not a good idea when you have three cats.)

Yesterday I went on a long walk downtown to pick up supplies, since the fabric warehouse near us didn’t have the zippers or snaps I was looking for. I wasn’t sure what length to get and I forgot to bring the old zipper along, so I bought a 24″ zipper and a 26″ zipper from Fabricland – both one-way separating locking plastic moulded zippers. I bought rust-resistant snaps from a small store on Queen Street near Spadina.

I spent most of today learning how to replace the zipper. I took the time to baste both sides, which worked out well. I was a little concerned about the holes for the bottom snaps letting in wind and water, so I hand-sewed some polyurethane film behind the bottom snaps to catch some of that. My machine-stitching was a little wobbly because of the thickness, and there were parts I still needed to hand-stitch with the help of a thimble. Maybe next time I might hand-stitch the whole thing so that I can line things up better. The underside of my machine-stitched zipper wandered a bit. Still, I’m sure W- won’t mind!

Sewing the zipper and installing the snaps took me about five hours, but I’m sure that will get faster with practice. It was good to see things take shape, and the time passed quickly enough with Youtube videos in the background. I might take future zippers to the tailor if I’m pressed for time. Today, though, it was good to cross off another unexpected addition to my bucket list. =)

Monthly review: September 2015

October 7, 2015 - Categories: monthly, review

Following up on the research I did in August, I had a lot of fun sewing in September. I tried out many free printable patterns with inexpensive fabric, and I found quite a few I liked. I’ve also been learning about drafting basic blocks based on measurements, but I still have a long way to go before I’m comfortable with those. The more comfortable I get with making things for myself (and the more I enjoy the benefits of customized clothing), the more I’m motivated to put in the effort to learn even more.

It was an excellent month for consulting, too: built lots of little prototypes and reports. =) My fiscal year ended in September, so I’ve been getting a head start on tax-related paperwork. Even though I fell out of the habit of updating my books weekly, it was easy to catch up on transactions and crunch the numbers for last-minute decisions.

I made it out of hermit mode a couple of times, hanging out with friends and meeting interesting people. Aside from that, I’m back to long walks, hooray for feeling better!

Also, lots more cooking, tidying up, and going for errands. We’ve started keeping tapioca pearls in the pantry, and bubble tea is now well within the realm of a possibility for an indulgent afternoon snack. A few other firsts this month, too: making udon noodles, making tapioca pearls… Mmmm.

We’ve completed the story missions for Borderlands 2 on Ultimate Vault Hunter Mode, so I’ve been able to dial down the intensity of my video-game playing. W- bought the season pass, so we’ve been playing our way through the downloadable content. I usually join him for story missions, but I sometimes pass on optional missions and challenges. Instead, I’ve been spending a little more time drawing and thinking, taking advantage of the fact that my fuzzy brain has cleared up a little.

October: More sewing, more paperwork, more consulting, and more awesomeness (I hope)!

2015-10-06a September 2015 -- index card #monthly #review output

Blog posts

Sketches

Time

Category Last month % This month % Avg h per week Delta (h/wk)
Unpaid work 2.6 7.8 13 8.7
Personal 14.8 19.7 33 8.2
Discretionary – Productive 8.6 11.7 20 5.2
Business – Build 1.8 3.1 5 2.2
Business – Earn 5.2 5.9 10 1.2
Discretionary – Social 0.0 0.4 1 0.7
Sleep 40.1 40.5 68 0.7
Business – Connect 0.4 0.5 1 0.2
Discretionary – Family 8.7 2.1 4 -11.1
Discretionary – Play 17.8 8.3 14 -16.0

Weekly review: Week ending October 9, 2015

October 11, 2015 - Categories: review, weekly

Last week was an excellent week for sewing. Thanks to Youtube videos, I learned how to replace the zipper on one of W-‘s jackets. It was a good opportunity to swap out the Velcro for snaps, too. For good measure, I added snaps to a bunch of other things as well. Level up!

It was also a good week for long walks. I walked all the way downtown, picking up some fabric and food along the way.

I finally got around to digging into organizational chart visualizations with d3. Looking forward to making the visualizations more interactive and sharing them with my client.

Yay!

2015-10-16a Week ending 2015-10-09 -- index card #journal #weekly output

Blog posts

Sketches

Focus areas and time review

  • Business (14.4h – 8%)
    • Earn (11.7h – 80% of Business)
    • Build (2.8h – 19% of Business)
      • Drawing (2.2h)
      • Paperwork (0.6h)
    • Connect (0.0h – 0% of Business)
  • Relationships (0.0h – 0%)
  • Discretionary – Productive (21.7h – 12%)
    • Emacs (0.0h – 0% of all)
    • Sewing (16.6h)
    • Writing (3.8h)
  • Discretionary – Play (13.8h – 8%)
  • Personal routines (48.6h – 28%)
  • Unpaid work (10.1h – 5%)
  • Sleep (59.4h – 35% – average of 8.5 per day)

2015-10-14 Emacs Hangout

October 14, 2015 - Categories: emacs

Another Emacs Hangout, hooray! Thanks to everyone who participated. Enjoy watching, and I hope to see you at the next one!

Event pageMailing list for notifications

Partial list of fuzzy timestamps:

  • 0:04 using org babel for a git dashboard link
  • 0:14 org tables and timestamps – whoops, focused on the wrong video, but here’s the blog post: link
  • 0:22 projectile and tags
  • 0:32 jabber and org contacts
  • 0:37 org-download
  • 0:41 Kindle highlights
  • 0:42 archiving
  • 0:45 visible-mode
  • 0:48 company-mode
  • 0:50 elfeed, pinboard
  • 0:58 building from source

Text chat:

Eric Hanchrow 8:56 PM I’m so much more comfortable with text than video … if other people join, will I see their icons?
me 8:56 PM Yup. Text chat is totally cool, it gets saved and posted too. and I can read things into the audio for people just listening to the stream (Livestream viewers won’t see the text chat during the hangout – only people in the actual Hangout will see it, so that’s why I repeat cool stuff. )
Eric Hanchrow 8:57 PM uh … so “livestream” is something different from Hangout? :-\ livestream must be “read only”
me 8:58 PM Yup, livestream (Youtube, etc.) is read only
Eric Hanchrow 8:58 PM ah dinnertime already!
Puneeth Chaganti 9:09 PM Hi everyone.
me 9:10 PM Hi Puneeth!
Kiran Gangadharan 9:37 PM https://github.com/abo-abo/org-download
Puneeth Chaganti 9:41 PM https://github.com/punchagan/clip2org I have to head off folks! I’ll catch up with video later. Have a good day/night!
me 9:57 PM See you!
Dave Marquardt 10:13 PM Sacha, what was the name of that mode that scatters tasks? I think I saw something like that in orgbox…. Now I see it in the Org info. Thanks! Thanks for setting it up!

Wow, literate devops with Emacs and Org does actually work on Windows

October 16, 2015 - Categories: emacs, org

Since I persist in using Microsoft Windows as my base system, I’m used to not being able to do the kind of nifty tricks that other people do with Emacs and shell stuff.

So I was delighted to find that the literate devops that Howard Abrams described – running shell scripts embedded in an Org Mode file on a remote server – actually worked with Plink.

Here’s my context: The Toronto Public Library publishes a list of new books on the 15th of every month. I’ve written a small Perl script that parses the list for a specified category and displays the Dewey decimal code, title, and item ID. I also have another script (Ruby on Rails, part of quantifiedawesome.com) that lets me request multiple items by pasting in text containing the item IDs. Tying these two together, I can take the output of the library new releases script, delete the lines I’m not interested in, and feed those lines to my library request script.

Instead of starting Putty, sshing to my server, and typing in the command line myself, I can now use C-c C-c on an Org Mode block like this:

#+begin_src sh :dir /[email protected]:~
perl library-new.pl Business
#+end_src

That’s in a task that’s scheduled to repeat monthly, for even more convenience, and I also have a link there to my web-based interface for bulk-requesting files. But really, now that I’ve got it in Emacs, I should add a #+NAME: above the #+RESULTS: and have Org Mode take care of requesting those books itself.

On a related note, I’d given up on being able to easily use TRAMP from Emacs on Windows before, because Cygwin SSH was complaining about a non-interactive terminal.

ssh -l sacha  -o ControlPath=c:/Users/Sacha/AppData/Local/Temp/tramp.13728lpv.%[email protected]%h:%p -o ControlMaster=auto -o ControlPersist=no -e none direct.sachachua.com && exit || exit
Pseudo-terminal will not be allocated because stdin is not a terminal.
ssh_askpass: exec(/usr/sbin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/sbin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/sbin/ssh-askpass): No such file or directory
Permission denied (publickey,password).

As it turns out, setting the following made it work for me.

(setq tramp-default-method "plink")

Now I can do things like the following:

(find-file "/[email protected]:~/library-new.pl")

… which is, incidentally, this file (edited to remove my credentials):

#!/usr/bin/perl
# Displays new books from the Toronto Public Library
#
# Author: Sacha Chua ([email protected])
#
# Usage:
# perl library-new.pl <category> - print books
# perl library-new.pl <file> <username> <password> - request books
#
use Date::Parse;

#!/usr/bin/perl -w
use strict;
use URI::URL;
use WWW::Mechanize;
use WWW::Mechanize::FormFiller;
use WWW::Mechanize::TreeBuilder;
use HTML::TableExtract;
use Data::Dumper;
sub process_account($$$);
sub trim($);
sub to_renew($$);
sub clean_string($);

# Get the arguments
if ($#ARGV < 0) {
    print "Usage:\n";
    print "perl library-new.pl <category/filename> [username] [password]\n";
    exit;
}

my $agent = WWW::Mechanize->new( autocheck => 1 );
my $formfiller = WWW::Mechanize::FormFiller->new();
if ($#ARGV > 0) {
  my $filename = shift(@ARGV);
  my $username = "NOT ACTUALLY MY USERNAME";
  my $password = "NOT ACTUALLY MY PASSWORD";
  print "Requesting books\n";
  request_books($agent, $username, $password, $filename);
} else {
  my $category = shift(@ARGV);
  WWW::Mechanize::TreeBuilder->meta->apply($agent);
  print_new_books($agent, $category);
}


## FUNCTIONS ###############################################

# Perl trim function to remove whitespace from the start and end of the string
sub trim($)
{
  my $string = shift;
  $string =~ s/^\s+//;
  $string =~ s/\s+$//;
  return $string;
}

sub request_books($$$$)
{
  my $agent = shift;
  my $username = shift;
  my $password = shift;
  my $filename = shift;

  # Read titles and IDs
  open(DATA, $filename) or die("Couldn't open file.");
  my @lines = <DATA>;
  close(DATA);

  my %requests = ();

  my $line;
  my $title;
  my $id;
  foreach $line (@lines) {
    ($title, $id) = split /\t/, $line;
    chomp $id;
    $requests{$id} = $title;
  }

  # Log in
  log_in_to_library($agent, $username, $password);
  print "Retrieving checked-out and requested books...";
  # Retrieve my list of checked-out and requested books
  my $current_ids = get_current_ids($agent);

  # Retrieve a stem URL that I can use for requests
  my $base_url = 'https://www.torontopubliclibrary.ca/placehold?itemId=';
  my @already_out;
  my @success;
  my @failure;
  # For each line in the file
  while (($id, $title) = each(%requests)) {
    # Do I already have it checked out or on hold? Skip.
    if ($current_ids->{$id}) {
      push @already_out, $title . " (" . $current_ids->{$id} . ")";
    } else {
      # Request the hold
      my $url = $base_url . $id;
      $agent->get($url);
      $agent->form_name('form_place-hold');
      $agent->submit();
      if ($agent->content =~ /The hold was successfully placed/) {
        # print "Borrowed ", $title, "\n";
        ## Did it successfully get checked out? Save title in success list
        push @success, $title;
      } else {
        # Else, save title and ID in fail list
        push @failure, $title . "\t" . $id;
      }
    }
  }
  # Print out success list
  if ($#success > 0) {
    print "BOOKS REQUESTED:\n";
    foreach my $title (@success) {
      print $title, "\n";
    }
    print "\n";
  }
  # Print out already-out list
  if ($#already_out > 0) {
    print "ALREADY REQUESTED/CHECKED OUT:\n";
    foreach my $s (@already_out) {
      print $s, "\n";
    }
    print "\n";
  }
  # Print out fail list
  if ($#failure > 0) {
    print "COULD NOT REQUEST:\n";
    foreach my $s (@failure) {
      print $s, "\n";
    }
    print "\n";
  }
}

sub get_current_ids($)
{
  my $agent = shift;
  my %current_ids = ();
  my $string = $agent->content;
  while ($string =~ m/TITLE\^([0-9]+)\^/g) {
    $current_ids{$1} = 'requested';
  }
  while ($string =~ m/RENEW\^([0-9]+)\^/g) {
    $current_ids{$1} = 'checked out';
  }
  return \%current_ids;
}

sub print_new_books($$)
{
  my $agent = shift;
  my $category = shift;
  $agent->env_proxy();
  $agent->get('http://oldcatalogue.torontopubliclibrary.ca');
  $agent->follow_link(text_regex => qr/Our Newest Titles/);
  $agent->follow_link(text_regex => qr/$category/i);

  my $continue = 1;
  while ($continue) {
    print_titles_on_page($agent);
    if ($agent->form_with_fields('SCROLL^F')) {
      $agent->click('SCROLL^F');
    } else {
      $continue = 0;
    }
  }
}

# Print out all the entries on this page
sub print_titles_on_page($)
{
  my $agent = shift;
  my @titles = $agent->look_down(sub {
                                $_[0]->tag() eq 'strong' and
                                $_[0]->parent->attr('class') and
                                $_[0]->parent->attr('class') eq 'itemlisting'; });
  foreach my $title (@titles) {
    my $hold = $title->parent->parent->parent->parent->look_down(sub {
                                                          $_[0]->attr('alt') and
                                                          $_[0]->attr('alt') eq 'Place Hold'; });
    my $id = "";
    my $call_no = "";
    if ($hold && $hold->parent && $hold->parent->attr('href') =~ /item_id=([^&]+)&.*?callnum=([^ "&]+)/) {
      $id = $1;
      $call_no = $2;
    }
    print $call_no . "\t" . $title->as_text . "\t" . $id . "\n";
  }
}

sub clean_string($)
{
    my $string = shift;
    $string =~ s#^.*?(<form id="renewitems" [^>]+>)#<html><body>\1#s;
    $string =~ s#</form>.*#</form></html>#s;
    $string =~ s#<table border="0" bordercolor="red".*(<table border="0" bordercolor="blue" cellspacing="0" cellpadding="0">)#\1#s;
    $string =~ s#</table>.*</form>#</table></form>#s;
# Clean up for parsing
    $string =~ s#<!-- Print the date due -->##g;
    $string =~ s#<br> <!-- Displays Date -->##g;
    return $string;
}

sub log_in_to_library($$$) {
    my $agent = shift;
    my $username = shift;
    my $password = shift;
    $agent->get('http://beta.torontopubliclibrary.ca/youraccount');
    $agent->form_name('form_signin');
    $agent->current_form->value('userId', $username);
    $agent->current_form->value('password', $password);
    $agent->submit();
}

Ah, Emacs!

Weekly review: Week ending October 16, 2015

October 17, 2015 - Categories: review, weekly

Way more consulting than normal this week, helping the clients with reports and prototypes. Good stuff! I think I’m starting to get the hang of Q.defer() and promises in asynchronous Javascript. I also got around to getting Selenium working with both Chrome and Internet Explorer, so that should open up even more doors for automation. Yay!

The Emacs Hangout was lots of fun too. =) It’s great to have a place where people can chat about cool stuff they’re learning or working on.

This week was a good one for cooking: cheesecake and egg tarts for the Thanksgiving get-together, Japanese curry and pesto for dinners at home, and other little things here and there. Nice to get back into the swing of things.

2015-10-17b Week ending 2015-10-16 -- index card #journal #weekly output

Blog posts

Sketches

Focus areas and time review

  • Business (37.3h – 22%)
    • Earn (31.9h – 85% of Business)
      • Earn: E1: 1-2 days of consulting
      • Earn: E1: 1-2 days of consulting
    • Build (5.4h – 14% of Business)
      • Drawing (5.3h)
      • Paperwork (0.0h)
    • Connect (0.0h – 0% of Business)
  • Relationships (5.7h – 3%)
  • Discretionary – Productive (13.7h – 8%)
    • Emacs (2.3h – 1% of all)
      • Re-cut wasamasa’s lightning talk on Emacs graphics
    • Sewing (5.8h)
    • Writing (0.9h)
      • Decision review: Mid-range phone (Motorola G)
    • Gather requirements for Philippine paperwork
  • Discretionary – Play (5.8h – 3%)
  • Personal routines (28.9h – 17%)
  • Unpaid work (11.1h – 6%)
  • Sleep (65.5h – 38% – average of 9.4 per day)

2015-10-18 Emacs link round-up

October 18, 2015 - Categories: emacs, emacs-news

How do you find out about cool new packages? Reddit suggests /r/emacs, emacs.zeef.com, Paradox or package-list-packages, @melpa_emacs, Emacs-related blogs, gnu.emacs.sources, rubikitch’s feed, the MELPA repository (also available as a feed), Emacsist, Awesome Emacs, and other sources. ericjmritz has also been posting overviews of recently released/updated Emacs packages together with suggested config and other resources. September features: eno or avy for navigation, modalka for modal editing, nameless for namespaces, and highlight-thing for seeing other instances of a keyword under point.)

Quite a few people posted navigation tweaks. Check out these Hydra-related blog posts about Paradox, navigation, and other packages. If you use isearch a lot, swiper might be a faster way to search (it now supports visual-line-mode too), and you might like this multiple-cursors extension for it too. Multiple-cursors is neat.

There were a couple of writing-related resources, too. Emacs for Writers was a talk by Jay Dixit at the New York Emacs Meetup. Also, /u/yamadpc asked about a focused mode for writing. Suggestions included focus, darkroom-mode, writeroom-mode, and olivetti. In terms of building your own from the ground up, Emacs, naked describes variables you can set and functions you can call in order to make your Emacs screen cleaner.

Coding:

Videos:

Also, just for fun: Pacman.

Links from planet.emacsen.org, reddit.com/r/emacs, Youtube.

Decision review: Mid-range phone (Moto G), and thinking about how to get even more out of it

October 19, 2015 - Categories: decision, geek, review

My Samsung Galaxy S3 started uncontrollably turning off in February. Even after I cleaned the switches and contacts, it wouldn’t reliably stay on.

On W-‘s recommendation, I switched to a Moto G (2nd gen) a few days after my old phone died. I bought the mid-range Android phone from Staples instead of getting it through a phone contract.

I was a little nervous about my Moto G’s storage limits (16GB, no external storage), but surprisingly enough, it’s been fine. I subscribe to a handful of podcasts, and I’ve given up on the desire to keep an offline copy of my sketches for easy flipping. I’ve picked a few Evernote notebooks and Dropbox folders to synchronize offline, and I leave the rest for online or desktop use.

W- recommended the Otter Commuter case, so I got that too. His is black and mine is purple. Since the phones and cases are identical, sometimes I accidentally pick up his instead of mine if I’m not looking. The case has been working out nicely as well. It’s nice not having to worry so much about dropping my phone (which I’ve done more than a few times) or cracking the screen (which I haven’t).

It’s been almost eight months with the phone. I’m happy with the decision to go with the Moto G instead of splurging on a higher-end phone or choosing something more basic. I mostly use it for alarms, activity tracking, reading, mail, calls, weather forecasts, timers, tethering, remote cheque deposits, and the occasional app or game.

I still haven’t gotten around to Android development, even though that was one of the things I was curious about. Web development is easier for me and more generally useful. I did get around to learning more about Tasker and Javascript, and the quick activity tracker I put together for my most frequently-used categories has been handy. I haven’t played around much with NFC either, since that activity tracker’s been convenient enough for quick interactions and it’s always available.

The recent Android OS update improved the power use. I’ve been okay in terms of battery life – enough to feel comfortable listening to podcasts or leave the pedometer app running in the background.

I’ll probably use my phone even more over the next year, so it might be good to think about how I can get even more value out of it.

  • I haven’t quite gotten into the habit of reading e-books on my phone, even though I have the Kindle and Overdrive apps installed. I think it’s a combination of being impatient with the low information-density-per-page-turn of non-fiction books and not building up a fiction backlog instead. I read a bit of fanfiction from time to time. Hmm, maybe I can slowly work my way through classic literature.
  • In terms of podcasts, I like listening to CBC’s Ideas program, and W- and I sometimes chat about the episodes. I also listen to podcasts about philosophy, and Stoicism in particular. I can look around for tech shows, like the one that Daniel Gopar is starting up around Emacs.
  • It would probably be good to take more pictures, too. Sewing, maybe?
  • If I trim my Feedly blog subscriptions a bit more and then add feeds in line with my current interests, that would help me get more out of blog reading.
  • Jotting quick ideas in Evernote worked well before, but I haven’t been doing it lately because I’ve been casually browsing the web instead. Since browsing has diminishing returns, perhaps I’ll shift more attention towards writing.
  • I wonder if the performance and accuracy of speech recognition has improved enough for it to be mostly usable. Hmm…
  • Time to get back to doing flashcards, too!

I’ve settled into comfortable routines, but there’s so much I haven’t explored yet. Looking forward to taking advantage of the phone’s capabilities!

Fabric from the thrift store

October 20, 2015 - Categories: sewing

I’ve been raiding the thrift store for 100% cotton sheets with patterns or textures that appeal to me. After a trip through the washing machine and dryer, they’re ready to be turned into other things. It’s easier to imagine what they’ll wear like with the softness of well-washed cotton instead of the stiffness of fabric on the bolt. There’s so much fabric that it’s easy to take risks on sewing experiments without feeling like I need to worry too much about maximizing yardage or avoiding mistakes. At the moment, I’d rather buy fabric than finished clothes, if I think I can sew what I want. Every piece is an opportunity to learn something.

Value Village is a bit higher-priced than the other thrift stores, but it has the advantage of being the largest one within walking distance. The price differences aren’t large enough to justify going on the subway. My limiting factor for sewing certainly isn’t a lack of fabric in my stash!

It took me a while to realize that I could get lots of material from the thrift store instead of from the fabric store. When I started getting back into sewing last year, I sewed the same pattern in different solid-coloured fabrics, and then moved on to some of the patterns that I liked: gingham, floral, and even a Marvel Comics print. (Mwahaha!) The more I browsed through the selection at fabric stores, though, the more I felt that I didn’t need to find a specific print or colour in order to make something I would like. If I happened across something I liked at the thrift store, I could add it to my stash. If not, it was a good walk anyway, and there’s still more to sew beyond that.

I suppose it’s a little like how we plan our groceries around the weekly flyers. If diced tomatoes are on sale, then it’s a good time to stock up. If not, we can cook from storage. If we’re out, there are plenty of other things we can cook.

I’m now reasonably confident that I can turn fabric into something simple that I can comfortably wear, and that I might prefer wearing more that something I could buy either used or new. I’m also happy with the kind of fabric that I can easily get, with the occasional splurge or special order here and there. I could spend more – there’s room in my budget, considering it’s part utility, part entertainment, and part education – but I don’t need to, and I like not needing more.

Weekly review: Week ending October 23, 2015

October 25, 2015 - Categories: review, weekly

This was an excellent week for learning. W- bought a small riveter in order to fix the rake, and he showed me how to use it. Whee!

In terms of sewing, I learned a different way of attaching collar stands and stitching hems. I experimented with making a long-sleeved peasant blouse, too. I like short sleeves more (long sleeves get in the way of washing dishes and things like that) but it was a good thing to try.

I’ve been going through the Latin 101 course by Prof. Hans-Friedrich Mueller. The first three noun conjugations are starting to make sense to me now, hooray! Unfortunately, the guidebook turns out to have quite a few errors. I ran into a couple of mislabeled exercises in Chapter 12, and there doesn’t seem to be an errata page. I was thinking of flagging the ones listed in this Amazon.com review with sticky notes so that I don’t get confused by them when I come across them in the book, but maybe it’s better for me to just switch to Wheelock’s Latin.

I had fun getting together with former coworkers, chatting about business and social trends over breakfast at Sunset Grill.

There was hail last Saturday, and the weather’s been cooling down. Fall colours everywhere, too. I bought a new pair of winter boots, since my old ones were leaking. The online reviews are mixed, but we’ll see what my experience with them is.

Next week, I’m looking forward to more Emacs, more sewing, more code, and more learning. Yay!

2015-10-25a Week ending 2015-10-23 -- index card #journal #weekly

output

Blog posts

Sketches

Focus areas and time review

  • Business (25.3h – 15%)
    • Earn (20.7h – 82% of Business)
      • Continue scraper work
    • Build (2.7h – 10% of Business)
      • Drawing (2.7h)
      • Paperwork (0.0h)
        • Finalize return
    • Connect (1.9h – 7% of Business)
  • Relationships (5.5h – 3%)
  • Discretionary – Productive (24.7h – 14%)
    • Emacs (1.3h – 0% of all)
      • 2015-10-18 Emacs link round-up
      • Fix How to Read Emacs Lisp
      • Do another Emacs review
    • Sewing (11.0h)
    • Writing (2.7h)
  • Discretionary – Play (3.1h – 1%)
  • Personal routines (31.8h – 18%)
  • Unpaid work (13.9h – 8%)
  • Sleep (63.7h – 37% – average of 9.1 per day)

2015-10-26 Emacs News

October 26, 2015 - Categories: emacs, emacs-news, review

Links were from reddit.com/r/emacs, planet.emacsen.org, and Youtube. Here’s last week’s round-up, too. Enjoy!

Programmatically rescaling and manipulating the darts in sewing patterns

October 27, 2015 - Categories: geek, sewing

I’ve been playing with the tmtp project for programmatically generating SVGs based on body measurements in order to create basic blocks and sewing patterns (see my previous blog post). I’m not yet at the point of being able to look at an image and see if it will sew correctly. However, printing and taping up large patterns is frustrating and a waste of paper. Scaling the patterns down so that they fit on a single page of paper makes perfect sense. With the measurements I’m working with, a scale of 0.2 (1″ : 5″) makes things fit neatly on 8.5″x11″ paper. It’s easy enough to cut them out and tape them up into something that resembles the form.

Here’s the commit that adds the scaling factor, and the commit that adds a very useful --scale command-line option. This lets me do something like this:

python mkpattern --verbose \
  --client=customer/Sacha/sacha-cm.json \
  --pattern=patterns/dart_manipulation_example.py \
  --styles=tests/test_styles.json --scale=0.2 output.svg

I generated a bunch of SVGs using my measurements, printed and cut them, and taped them up. Tada! They look like they make sense. The easy-fitting bodice block from Metric Pattern Cutting is, as expected, looser than the close-fitting bodice block, and both are a little bit bigger than the basic bodice block from BurdaStyle.

2015-10-26 16.17.312015-10-26 16.20.17

The basic shirt pattern from Cal Patch’s Design-it-Yourself Clothes fits over the basic blocks, as expected. It looks a little boxy compared to the blocks, but it will probably be fine in cotton, since cotton won’t be as stiff as paper.

2015-10-26 16.18.49

If I end up doing this a lot, I’ll probably look into modifying the patterns to draw an outline on a separate layer. Then I can convert the SVG for use with Hacklab’s laser cutter (see my previous experiments and fun results), so I can easily test with paper or fabric.

I was thinking about the viability of printing a small, to-scale 3D model based on measurements. Doesn’t have to be a photorealistic 3D scan of me – apparently you can get photorealistic 3D prints for about ~$120 these days, but that’s still a bit much. If it’s not from a scan, though, there’s the challenge of generating a good model based on entered measurements, or creating/adjusting an existing model of a dress maker’s mannequin. Anyway, papercraft with basic blocks seems to be a decent starting point. =)

With the scaling factor in place, I did the math for dart manipulation. Darts help add shape to fabric, turning flat pieces into slightly conical structures. If you wanted to move a dart on paper, you could tape the dart closed, then cut a new line to the apex of the dart and spread the pattern until it’s flat again. (Wikipedia describes this as slash-and-spread.)

There’s an SVG rotate transformation that would probably make it easier to handle the rotation of complex shapes. I haven’t figured out how to add an SVG group in tmtp yet, though. Instead, I:

  1. Added a pair of points where my “cut” was going to be
  2. Calculated the existing dart angle
  3. Rotated one of the dart points, one of the new cut points, and the points in between – to make things easier, I specified which points to rotate
  4. Redrew the front bodice

I added a few library functions, so now the code to rotate a dart is pretty short. It takes an array defining the dart points (start, apex, end), and another array of the points to rotate around the apex by the calculated angle.

def rotateDart(self, dart_points, points_to_rotate):
    # Determine the angle of rotation
    angle = angleOfVectorP(dart_points[0], dart_points[1], dart_points[2])
    # Rotate the dart closed
    (dart_points[0].x, dart_points[0].y) = rotateP(dart_points[0], dart_points[1], angle)
    # Rotate the rest of the points
    for i in range(len(points_to_rotate)):
        (points_to_rotate[i].x, points_to_rotate[i].y) = rotateP(points_to_rotate[i], dart_points[1], angle)
    return

When I printed out my test pattern and cut it, the new pattern matched the result of slashing and spreading the dart on the previous bodice. Hooray for paper testing!

2015-10-26 18.27.54

The next step would probably be to make an SVG slicer that converts large patterns into segments that can be printed on a home printer. It would probably move/clip the image, add cutting lines and labels for convenience, and export a series of SVGs. If I’m lucky, I might be able to find a Python library that will let me easily create a multi-page PDF.

More thoughts on sewing and programming: it would be nifty to be able to easily program variable seam allowances, so that I could say that one seam has a 1/2″ allowance and the other has a 2″ hem allowance. Lines should be pretty straightforward – just offset a parallel line by the specified distance. Bezier curves might be a challenge. In “An offset algorithm for polyline curves” (Liu, Yong, Zheng, and Sun, 2006), the authors describe a algorithm involving trimming the offset curves of a polyline curve. I should check out the approximation algorithms mentioned in their literature review – might be an easier thing to start with, especially if I can wrap my head around the way the existing code’s curveLength function interpolates curves. Or I can leave the addition of variable allowances as a human step. It’s not that hard with a seam allowance ruler. Still, it would be neat to have laser-ready SVGs… =)

Anyway, now that I’ve got a simple way to test things on a small scale and a bit more of a handle on the math, I’m looking forward to playing around with generating actual patterns instead of just basic blocks. Whee!

Python + sewing: Making basic shapes and splitting up larger patterns

October 28, 2015 - Categories: geek, sewing

More Python and sewing. =) The first step was to make parameterization even easier by allowing command-line specification of measurements. I refactored some code from client.py and modified mkpattern to accept the new arguments, splitting up the name and value based on regular expressions (commit). That way, I could quickly generate patterns based on different dimensions, like so:

python ../mkpattern --client=../customer/Sacha/sacha-cm.json \
   --pattern=../patterns/box_tote.py \
   --styles=../tests/test_styles.json \
   -m height=4in -m width=7.5in -m seam_allowance=0.5in \
   -m depth=7.5in -m strap_width=1in -m strap_length=10in -m hem_allowance=1in \
   ../foo.svg

I sketched basic patterns for cylindrical and box-type containers the other day, so I wanted to try them out. It turned out that the Python framework I used for sewing patterns didn’t yet support arcs. Adding the arc element to the SVG was straightforward. I initially faked the bounding box for the arc, but since that made the code misbehave a little, I looked around for a better implementation. I translated the code from this post from 2011 to Python and added it to the code (git commit). That allowed me to make a simple cylinder pattern generator. I haven’t tested it yet, but it looks reasonable.

2015-10-27 20_30_11-foo.svgThe box tote was interesting to work on. When I did the math, I couldn’t believe that the calculations were that simple. I was waiting for a sqrt or a cos to show up, I think. Still, the small-scale paper version I taped up looks like it makes sense, and I’ll sew a full-size version soon. J- asked for a light blue lunch bag that would fit our standard containers, and I’ve been meaning to make a casserole carrier for a while now. It would be handy to be able to make bags that are the right size. Too small and things don’t lie flat, too big and they move around too much.

2015-10-27 20_31_54-foo.svg - Inkscape

I spent most of my time making a flexible circle skirt pattern, pretzeling my brain around circumferences, angles, multiple pieces, and fullness multipliers. I’m happy with the way it turned out. It can generate patterns for quarter-circle skirts, half-circle skirts, full-circle skirts – even an arbitrary fraction of skirt fullness split into an arbitrary number of pieces, with optional seam allowance, waist seam allowance, and hem allowance. If you give it the fabric width, it will split the pattern into however many pieces are needed. If you specify a seam allowance and you want a full-circle skirt in a single piece (maybe for dolls), it’ll leave room for the seam allowances by adjusting the inner radius. We’re heading into snow pants season, so I probably won’t get around to testing it in fabric for a while. Caveat netrix, I guess.

I also got around to writing a tool for splitting up large patterns so that I could print them on a regular printer. I had tried Posterazor and a few other tools for splitting up large images into smaller pages, but I wanted something that would add cutting lines and page numbers. It turns out that all you need to do is change the SVG’s height, width, and viewPort. I added a rectangle for the cutting line and some text for the page numbers. I haven’t figured out how to use pysvg to replace the contents of an existing text element, but since the tool prints out non-overlapping regions, I just keep adding more text elements. My script creates a numbered sequence of SVGs. I haven’t found a convenient way to print multiple SVGs in one go, but I can select multiple PNGs and print those, and I can use Inkscape’s command line to convert SVGs to PNGs like so:

inkscape -z -e output-01.png -d 300 output-01.svg

There’s supposed to be a -p command to output Postscript ready for printing, but command-line printing on Windows doesn’t seem to be as much of a thing as it is on Linux. Something to figure out another time, maybe. Anyway, now that I have a conversion pipeline, I can write a Bash script or Emacs Lisp to process things automatically.

I’ll probably move from all this theoretical script-writing to more hands-on sewing during the rest of the week. My fabric order has arrived, so I’ve got a bit of cutting and sewing ahead of me.

Hmm. With the command-line measurement and scaling overrides, it might be interesting to use this framework for papercraft and laser-cutting too. Someday!