Tie-Dye Soda Ash Experiment

One of the steps in tie-dying is to soak the shirt in a “fixer” solution of sodium carbonate, also known as soda ash. I think of soda ash as a dye-cotton binding agent.

My informal experiment is to see the effects of applying the soda ash before or after folding or not at all. Here are the results of four spirals:

Soda Ash – Tie – Dye
The first brown-red spiral is my usual technique of soaking in soda ash solution before folding. It gets good dye coverage, but looks a little blocky in places. On reason I like this order is that soaking after tying sometimes loosens the folds/knots.

Dampen – Tie – Soda Ash – Dye
This is the Paula Burch technique, since it is safer not to handle the treated fabric. The effect is more pronounced since both the soda ash and the dye are constrained by the tying; however, there is less dye coverage.

Dampen – Tie – Dye
Skipping the soda ash produced a nice pattern, but the colors (brown and periwinkle) already look faded and I suspect they will fade quickly over time. On the other hand, you can view the colors as nicely mellowed.

Tie – Dye
Dry cloth produced bulky folds and really soaked up the dye. The green did not “mellow” well for whatever reason, possibly unrelated to the technique.

Posted in Art | Leave a comment

18 Days of Tie-Dye

I finished my summer run of consecutive tie-dye day earlier this month with a final count of 18 different shirts in 18 consecutive days, beating last year’s record of 16. I could have done a few more, but I imagine my colleagues at work were tiring of the fashion.

This photo is a my recollection of the shirts I wore, in the approximate order. I’m sure, at least, of the three red, white, and blue shirts worn before, on, and after Independence Day. Next year I’ll try to get a photo of myself each day for a definitive record.

18 Tie-Dye Shirts

Posted in Art | 3 Comments

Google Code Jam 2011 Round 2

My luck ran out in Round 2 of the Google Code Jam 2011. I placed 626th but needed to be in the top 500 to advance. At least I qualified for a T-shirt for being in the top 1000.

There were four problems this time, with less variation in difficulty than usual. I solved the first problem, Airport Walkways, completely and got partial credit for my correct-but-inefficient solutions to two other problems. Of course, I figured out how to make my solutions efficient shortly after the contest ended. I didn’t get to the fourth problem, A. I. War, but it looks more straightforward than I expected from a title alluding to artificial intelligence. Maybe I could have solved that one completely instead of one of the partial solutions.

The third problem, Expensive Dinner, involved finding the difference between the best and worst case for a particular problem involving least common multiples. I set about computing both cases separately and taking the difference. I thought I was doing well to reduce the naive O(n2) solution to O(n), but when n is 1012, that’s not good enough (for full credit). I reduced the best case to be the number of primes less than or equal to n, aka π(n), and the worst case to be the number of primes powers less than n. That seemed like a dead-end, though, since it’s not so easy to calculate π(1012). What I didn’t see in time is that since I was going to be taking the difference of the two and they both included π(n), I didn’t have to compute that part at all. And counting the higher prime powers is much easier, and that’s all I really needed to do. Oh well.

The second problem, Spinning Blade, didn’t involve any fancy math, but required a clever data structure to reduce it from O(n4) to O(n2) or so. (n was limited to 500, so O(n2) is fine.) I didn’t find it in time, though, and went with my brute force solution for the partial credit.

Posted in Code, Java | 1 Comment

Chapel Hill Flooding Video

I was eating lunch downtown at Mint with Joe and Anli when the heavy rains rolled in last Friday. We tried to wait it out, but it didn’t follow the usual pattern of a brief summer storm. After about an hour, it was still a decent shower, but Anli and I decided walk the six blocks or so to where we needed to be. Not sure what happened to Joe.

We were pretty soaked from the rain when we encountered a section of Franklin Street that was completely under a foot or so of water. After wading halfway, a whirlpool developed over the partially blocked drain.

I shot this video and later uploaded it to WRAL, where it was featured several times on the evening news.

Posted in Local | 2 Comments

Google Code Jam 2011 Round 1

Round 1 of the Google Code Jam 2011 contest was last week-end. I stayed up Friday night for the first of three sessions for round 1 qualification. The top 1000 in each two-and-a-half-hour session advance to round 2. I was fortunate to end up around 200th, so I didn’t have to try the other sessions after all. I don’t know how many competitors there were, but there were 3100 who solved at least one problem correctly.

There were three problems, each with a small and large challenge test cases. The first problem was relatively easy, and basically boiled down to computing greatest common denominators to reduce fractions. I used a fraction class I had from Project Euler work, which made things even simpler. That got me 20 points in under 20 minutes, which turns out was already good enough to place around #640 in the final scores. Time is used for tie-breaking, and there were about 1500 partipants with 20 points.

The second problem was worth 30 points but had a very long description, so I skipped it. It looked interesting reading it later, but I wasn’t confident about boiling down all that prose correctly under time pressure. The problem was basically to find the hardest word(s) for someone to guess in hangman, given the guesser’s letter-picking order.

The third problem was the hardest and worth 50 points. You had to basically find the maximum score for a solitaire card game, given the order of cards in the deck. I thought it would be a simple dynamic programming solution, but the parameterization I chose was obviously not optimal. I included the current cards in the hand as part of the state, but with up to 80 cards in play, there could be a disastrous 280 possible states. After several tries, I was able to add enough tree-pruning to my code to solve the small test cases and get 15 points, but I never solved the large test case which included more pathological card sequences, defeating my pruning logic.

As a consolation prize, my code did trigger an internal JVM error at one point:

*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message can't create name string at ../../../src/share/instrument/JPLISAgent.c line: 769

Update: Turns out my parameterization was OK, but I had bugs in the pruning logic.

Posted in Code | Leave a comment

Google Code Jam 2011 Qualification

I advanced through the qualification round for the Google Code Jam 2011 over the week-end. It was a relatively low stress format allowing 24 hours to solve 8 problems, with only about 3 successful answers needed to move to the next round. There were really 4 problems, but each one had two input sets to solve, one small and one large.

The first two problems were easy — basically just seeing if you could carefully convert the prose instructions into code. The third problem required a little bit of math insight to reduce the simplistic O(2n) solution to O(n). I got those three done, but it still took a few hours, which would not be good enough for future rounds where time is more constrained.

The fourth problem, GoroSort, was pretty fun but required a little more thinking than I could put together. Basically, the problem is to sort a list of the first n integers by randomly permuting a subset of your choice. Because of the randomness, the answer is the expected number of permute operations to six decimal places. Fortunately, the problem statement included an example that suggested cycles should be sorted separately. I worked on a recursive solution to iterate through the possible cycle combinations (equivalent to integer partitions) resulting from a random permutation while weighting each one by its probability, but I didn’t get a successful submission.

Turns out my logic was good, but my probability formula was bad (which I should have realized since the total for all partitions was greater than 1). The next day I posed the question to the Mathematics StackExchange site and got a quick answer, which at least let me verify my logic (and learn more about combinatorial counting).

Posted in Code | Leave a comment

Tom Peters Apple Prediction

I used to follow Guy Kawasaki in the early Mac days, and I recently noticed he has a new book out. I haven’t seen it, but the announcement prompted me to check out some of his older books from my local library. One was called Hindsights: The Wisdom and Breakthroughs of Remarkable People and contains interviews with successful people. Only a few of the interviews are very insightful; Mary Kay Ash was probably the best.

In spite of the book’s theme, Tom Peters decided to show off his foresight:

I can’t imagine a scenario where Apple is a leader twenty years from now. Maybe it will be ten times bigger … but setting the agenda? That’s an insane thought.

The book has a copyright date of 1993, so the interview must be from about twenty years ago.

Posted in Art, Uncategorized | Leave a comment