Friday, August 24, 2012

An addendum to UITextField delegate guides

Hi.

I'll be posting more programming notes in the future. So that I don't forget them.

Maybe you’re working on an iOS app. And maybe you’ve got a text field, and you want the keyboard to go away, because you’re finished with it.

Presentation styles?
But for some reason it won’t go away. So you double check guides and tutorials and documentation. You even find a few things that seem forehead-slappingly obvious.

“Oh. That’s it,” you exclaim, and make that fix.

Only it still doesn’t work.

You read the UITextField class reference, again, exhaustively, to no avail.

Is your view controller a modal view controller?

Is its presentation style UIModalPresentationFormSheet?

Welcome to a fun and exciting exception! What you’re looking for is:

UIViewController -(BOOL)disablesAutomaticKeyboardDismissal
Override it to return NO. And then have a nice day.

This tip brought to you by the letter D.



Thursday, June 21, 2012

Code, code on the range

I have achieved a major workflow milestone.

All of my web development can now be accomplished on the iPad, meaning that I may venture forth light of heart and burden, yet still program (in addition to writing, drawing, and hatching nefarious plots).

How? you cry plaintively. I too wish to walk the earth, free like the majestic Buffalo buffalo.

Not an actual Buffalo buffalo.
For me, the answer has been a triforce of apps, webhost, and extra hardware.

All of these puzzle pieces are replaceable. It’s just a matter of finding something that works for you.

But first, the webhosts.

It didn’t have to be Linode. Any server where I had actual control would do.

I was able to persuade my previous provider to give me remote access to my account so that I could install things. However, the operating system they used did not have a package manager.

For those unfamiliar with package managers, not having one meant that I had to install every single miserable dependency manually. To rephrase, programs need to run other programs, which need to run other programs. If you have to hunt down, build, and install every single one of these obscure bastards, that’s a lot of programs.

Energetic facial hair in the
background, masochism
in the foreground.
Though the general public may have the impression that anyone mad enough to stare down the barrel of a command line will have energetic facial hair and more than a tinge of masochism, the latter is patently untrue. That’s why there are package managers.

Package managers know program A needs program B needs program C. And they have a library of all of these programs. Handles it all for you.

Long story short: moving from little-known webhost to webhost used by people who know what they’re doing changed game from “cannot get shit done” to “can get shit done.”

Upon the necessity of keyboards

The software keyboard serves for train rides and fiddling around, or desperate times. If you propose to spend any time whatsoever at a table, a keyboard is necessary. That will be all.

New Cherry Diet Coda Zero: no calories, all flavor.

There’s two apps that I use for any programming work: Diet Coda and Textastic.

Diet Coda combines FTP access to the files on the webhost plus an editor for programming, with SSH access to the webhost itself for publishing and other server tasks.

Theoretically, it does everything.

Practically, it’s a new release and crashes quite a lot. Also, I’m not a huge fan of the software keyboard. We’ll see how it goes as I get more used to it. Since I have an external keyboard, it’s usually not a big concern.

Still, for emergency coding, or writing a draft on the train, Textastic works quite well. The software keyboard pretty much covers everything. It’s not ludicrous speed, but I can get things done without feeling an unquenchable desire to frisbee the iPad through a window every time I realize I must type an underscore.

Textastic is more general-purpose rather than specifically linked with my web server, so file sync is not quite as smooth. On the other hand, I can also use it to pull stuff from Dropbox and send it to my web server, which is useful.


But no workflow is so perfect it cannot be improved.

Photos and photo layout are not quite there yet. I think I vaguely promised a post on Photostream at some point. I’ve avoided it so far. I feel like I must have been doing something wrong, since it was so terrible, so I’ll have to try and bite the bullet again.

More experimentation

Last time I tried the iPad setup at a Ruby on Rails meetup, it failed due to lame webhost making it impossible to install anything. This time, I am reasonably confident that I can get it to work. And then it'll be just me and my two and a half pounds* against the world.



*iPad 2 + Smart cover + ZAGGKeys Flex + stylus

Saturday, June 2, 2012

The UG Personality Test

This revolutionary new psychological profiling method requires a specialized environment, and is only useful to determine male personalities. With those caveats out of the way, it's fantastically accurate.
In Japan, even the vending
machine drinks are pigeonholed.

More so than blood types, that's for damned sure.

These tests can be performed as formally or as informally as you like, though if the subjects become aware that they are unwittingly being observed, it may skew the results.

The specialized environment? Public restrooms with multiple urinals.

Welcome to the Urinal Gaze Personality test.

You may protest, but it's true: you can observe clear personality indicators by a subject's behavior at the urinal alone. Urinal selection when there is a choice of urinals available is also an expression of fundamental personality traits, but the additional complexity involved has made it thus far impossible to conduct a detailed study.

For what I think are fairly obvious reasons (lack of funding), I do not know if there are equivalent indicators for women.

So let's get to the meat and potatoes, so to speak.

The Narcissist:

Spends urinal time staring fixedly downwards.

Look, it's my penis! What a magnificent link of sausage it is. Pee comes forth, and it is like gold. I pee very well. I am a piss artist. Alas, the peeing is done, and I must now put my penis away. I am bereft. I must drink lots of fluids so that I may pee again soon and experience this joy once more.
Self-absorbed. Inconsiderate. Takes a bathroom break every hour. Wastes everybody's time.






The Ostrich:

Spends urinal time staring fixedly at the wall.

There is no peeing happening here. There is no peeing happening next to me, nor is there any peeing over there. We're all just hanging around in front of the urinals because that's what the cool kids do. There are no penises. No penises!

Lives in denial. Is uptight and inhibited. Prefers being alone. Also brazenly homophobic. Wastes everybody's time.

The Rubbernecker:

Spends urinal time scanning neighboring penises.

That guy has a big dick. Hell, it looks bigger than mine. But that's cool because I'm a grower, not a shower. My dick is totally bigger than his when I am hard. Or take Viagra. And even if it isn't, I am clinically proven to be 34% more skillful at pleasuring the ladies. Man, he's been peeing for two full minutes now. That's some impressive bladder capacity, but I peed for almost three minutes that one time. Ooh, new dick over there. Wow, it's kinda puny. How does he live with himself?

WE R WATCHING U XOXO.
- SKYNET
Judgmental. Tries to hide the fact that he's fundamentally insecure. Needs to be around others, else how will he know that his dick is big? The guy who always has to top others' stories. When he overhears you telling your friend about the Bahamas, he has to tell you about scuba diving with the dolphins in Bali. Wastes everybody's time.

The Gimp:

Also spends urinal time scanning neighboring penises.

That guy's dick isn't so big. Hey, I might even be bigger. But better not double check, I don't want to ruin the dream. And even if I am bigger, he probably gets laid way more often than I do. Man, I suck. Let's look somewhere else. My god, that dick is huge! I should just resign myself to a life of solitude and despair, but why bother when I could just kill myself already?
Low self-esteem. Masochist. Obviously insecure. Needs to be around others, else how will he savor his relative worthlessness? When he overhears you telling your friend about the Bahamas, he has to tell you about the time he got sunburnt and nearly drowned in the community pool. Wastes everybody's time.



That pretty much covers the gamut of masculinity, in all its magical diversity. No special snowflakes here, just urinal cake.



Happy peeing!




Wednesday, May 30, 2012

weissazool dot com

You probably didn’t notice, but I set up a website.



Yes, this, right here is a website. But it’s a template from Blogger. It would be more accurate to say that I built my own site. There’s a navigation bar on this page now, and all of the links (aside from ‘Blog’) will take you there.

What’s the difference? Why not set it up in Blogger?

All technical responsibility for my website devolves unto me.
  • Is it not showing because of some problem with the hosting? My problem.
  • Is it slow to load, or are there broken links? My problem.
  • Are the colors poorly chosen? My problem.
  • Is the design broken or buggy in another modern browser? My problem.
Well, except for…
Is there a monkey in your Gorditos?
Your problem.
  • Is the design broken or buggy in Internet Explorer 6? Your problem.

Yes, there’s lots of fine and wonderful services that do the technical work for you. But I wanted to learn a little bit more about this world wide web thing people are talking about. And learning about and making it was a lot of fun.

It was also probably a much better use of my week than playing Diablo 3. I don’t know that I would have made that same decision in the past. Perhaps this is a sign of encroaching maturity.

For those interested in the technical keywords, I use a blogging framework called Jekyll. I style it with CSS, lay it out in HTML and Liquid, and write content in Markdown. Jekyll then takes care of the rest.

My ideal workflow is to be able to write and lay out a post, from start to finish, and then publish it, from the iPad.

Being able to make changes to the website layout and push those changes out to the host from the iPad is another goal.

A road map:


Migrate this blog off of Blogger.

Blogger is nice, but I would prefer to have all of my stuff in one place and with one design.

There’ll be some consequences.

  • If I want comments (though so far they have been unnecessary) I will need to install something like Disqus as well.
  • Followers (all two of them) and analytics will be lost.
The toughest consequence: Handling fish.
Since readership is low, those are negligible.

The tougher consequences:

  • Handling images.

    Positioning and resizing and such are not part of Markdown’s spec. I wonder if there is a plugin or an extension for Markdown or Jekyll that handles it reasonably well. I can sacrifice a little precision if it means I don’t have to bang that out in HTML.

    (The answer: Yes. MultiMarkdown. Another thing to learn in the future.)

  • Handling pagination with multiple posts on a page.

    This is really a design question that I need to think through first. The economy of space of just having a list of post titles and dates (my current plan) is nice. On the other hand, if for some reason someone is in the mood for a longer reading session, it may be nice to have multiple posts on a page.

    At the very least, I need a prev post and next post link.

    Also, related posts, particularly for project pages, are important.

Picture galleries.

This one’s a long way down the road. But I’d like to move my photos off of picasaweb at some point. I haven’t really given this much thought at all, though.

So there it is. weissazool dot com. This blog is still my primary bit of the internet, but one day they will merge to form the terrifying DEVASTATOR!





Tuesday, May 22, 2012

Some notes from the app development scratchpad.


On the app itself:


Probably the single hardest component was in-app purchases. 


I might try to do a presentation about it in the future, if I am masochistic enough to do that dance again. I probably should, so that I learn how to do it properly this time.

I will say this for now: I sacrificed a chicken over a pile of broken iPhones and iPod Touches, doused everything with gasoline, and set it all on fire. While praying to the spirit of the Apple All-Father. Then it worked.

Usually this is indicative that the person performing the eldritch rituals has no clue what they're doing. That may well be the case. It felt, by far, like the thing I had the least control over. I'm deathly afraid that some horrible bug involving in-app purchases and extremely angry customers will pop up.


Data wrangling on the back end took a lot longer than it needed to. 


I had no idea where to start. In fact, in the initial agreement, I was not supposed to be responsible for getting the data into an acceptable format. It was supposed to be provided to me. But so much time would have been wasted with manually entering the data, and hunting down the inevitable typos, that it was necessary for me to automate it in order to move the project forward.

Valuable experience, but it did derail work on the app itself for a substantial amount of time.

Switching from trying to do things via Unix scripting with bash to doing it in a more full-featured language, like Ruby, made life so much easier.


There's a lot of room for improvement, both in the app itself and on the back end, and I hope I get the opportunity to work on a version 2. 


In particular, I think we can streamline the structure of the lessons. Right now they're very closely based on the podcast, and user control is very limited and linear. My goal would be to give the user control over where and when they want to put more effort and time into practicing.

I also think it's really important for people trying to learn a language to generate phrases and conversations rather than just listen and repeat. I have some interesting ideas on how that could be done.



I learned a few things about how I work best, too.


Getting paid by the milestone beats getting paid by the project. 


Having a series of discrete goals and rewards is good. However, it's inflexible.

New tasks and goals that were not accurately predicted at the beginning of the project inevitably appear, creating a distinction between work you actually get paid for and unremunerated tasks. Spending a lot of energy on time-consuming extra tasks that don't quite fit your milestones is demoralizing.

Next time I consider taking a contract based on milestones, I would need clauses in there that allowed for the re-evaluation of tasks and compensation.

Alternatively, getting paid hourly is probably better in terms of being motivated to work on the project right this moment. But hourly pay for a remote worker causes its own set of problems related to time tracking and trust.


On occasion I can be effective and productive at home. 


Those occasions are infrequent and unreliable.

Getting out of the house, to a café or co-working space or park or really pretty much anywhere (sitting on the train!), is much better. But saying I should go out and actually doing so are two different things.
 
The best solution so far has been to make sure to have something scheduled. Whether it be frisbee practice in the mornings, or lunch with someone, or an errand to run, I can pad that event before, after, or both, with working time.

Sunday, May 20, 2012

Eating the Sun (日食)



Love is a burning thing
And it makes a fiery ring
Bound by wild desire
I fell into a ring of fire

I fell into a burning ring of fire
I went down, down, down,
and the flames went higher
And it burns, burns, burns,
The ring of fire
The ring of fire


The taste of love is sweet
When hearts like ours meet
I fell for you like a child
Oh, but the fire went wild

I fell into a burning ring of fire
I went down, down, down and the flames went higher
And it burns, burns, burns, the ring of fire
The ring of fire

And it burns, burns, burns, the ring of fire
The ring of fire
The ring of fire
The ring of fire

Lyrics to "Ring of Fire" by Johnny Cash.
Photos by me.
Camera: Canon Powershot SD300, from circa 2004.


Update:
The last photo was published on the LA Times' home page for May 20th.

Monday, May 14, 2012

Sunburnt and Sleepdeprived

And a little depressed. More than anything else, I attribute it to sleep deprivation.

I was on the beach, playing in an Ultimate Frisbee* tournament this weekend. I played a lot on Saturday and we won all three of our games. (Please note that there is no actual correlation between these two facts.) Today I played only a couple of points per game, and we won one and lost two. The first game we lost, we were overwhelmingly outclassed. The second game, we definitely could have won for third place. Instead, we took fourth.

Fourth place of twenty-four teams is pretty darned respectable. In fact, I think it's the best placing I've ever reached that I substantially participated in. And the weather was great today, so great that I went for a dip in the ocean. Chilly at first, but totally swimmable. If I think about it objectively, it's fantastic, and I should be celebrating.

Beach pickup in FL in February. I'm in a long sleeved white top and shades.

Would I have been in a better mood if we had gotten third place? Maybe. It certainly feels better to end with a win than a loss, even if it's a win that puts you in 15th instead of 16th place. But I still probably wouldn't be in a celebratory mood.

The fundamental problem, I think, was this: I had to wake up at 5:30 for two days in a row. I go to sleep around midnight and usually wake up between 7 and 7:30.

Saturday was fine, but today I...
  • Played less but got tired more quickly. Less stamina.
  • Didn't have enough time to recover from the previous day, so muscles were tense and sore.
  • Made poor decisions on the field.
  • Was too lazy to properly apply suntan lotion to legs and re-apply it on face and arms. Thus, sunburn.
  • Also too lazy to take advantage of some of the fun side events. (At least I went swimming. There were fish! About three or four of them, a foot long, in water 3-4 feet deep.)
  • Was taciturn, felt irritable.
  • Too tired to actually do anything, but not sleepy.
  • Just generally felt like crap!

Actually, most of these things were true Saturday too, but they were even more pronounced today.

Next time, 

I need to think a bit more proactively about finding a place to stay near the tournament rather than taking the train two hours each way. I have a friend who lives nearby the beach who I probably could have crashed with. And I should keep couchsurfing in mind as well.

Otherwise I'm just wasting a good time.

The name of the team involves a pun
which I really don't feel like explaining here.

*Have I mentioned that "frisbee" being trademarked annoys the hell out of me? Other sports based on the names of their equipment (pretty much anything ending in 'ball') don't have this problem.