Be inspired and inspiring.

Source: Gizmodo

Helveticards (via it’s designed)
Ordered. They’re taking preorders until April 14th so get in there and get some.

Helveticards (via it’s designed)

Ordered. They’re taking preorders until April 14th so get in there and get some.

Text

If, like me, you hastily installed iPhone OS 4.0 before adding your iPhone to the Registered Devices list in the Provisioning Portal and now you can’t get your UDID from iTunes, you can find it in System Profiler > USB > iPhone > Serial Number (oddly enough).

Hey Apple Developer Registration Form, those are some terrible options except for me where they fit perfectly.

Hey Apple Developer Registration Form, those are some terrible options except for me where they fit perfectly.

iPhone OS 4.0: All the New Features
Hello 4.0! This is going to be a great release. I’m very excited about the Mail improvements. A unified inbox is going to save me so much button pushing, and multiple Exchange accounts will get Google Sync back in action. We’re even going to have multitasking! Everything is wonderful right? Right??
Well, almost. I think that the glaring omission from today’s event was an update to how notifications are displayed. It looks like the ridiculous modal alert boxes are here to stay for now at least. This is incredibly disappointing. After my wonderful experience with WebOS notifications, I was really, really hoping that Apple would do something similar. My hopes have been dashed. I guess there’s always next year.

iPhone OS 4.0: All the New Features

Hello 4.0! This is going to be a great release. I’m very excited about the Mail improvements. A unified inbox is going to save me so much button pushing, and multiple Exchange accounts will get Google Sync back in action. We’re even going to have multitasking! Everything is wonderful right? Right??

Well, almost. I think that the glaring omission from today’s event was an update to how notifications are displayed. It looks like the ridiculous modal alert boxes are here to stay for now at least. This is incredibly disappointing. After my wonderful experience with WebOS notifications, I was really, really hoping that Apple would do something similar. My hopes have been dashed. I guess there’s always next year.

The Man From Hollywood
Kinetic typography using CSS selectors and Webkit CSS properties.

The Man From Hollywood

Kinetic typography using CSS selectors and Webkit CSS properties.

jb.tumblr
My mind was just blown. Go see Jarred Bishop’s Tumblelog and checkout how the background seems fixed but is related to the post in view. It’s awesome.

jb.tumblr

My mind was just blown. Go see Jarred Bishop’s Tumblelog and checkout how the background seems fixed but is related to the post in view. It’s awesome.

"What makes me optimistic about iPad sales is just how delightful it is to use one. That’s a factor that makes sales truly viral: people who didn’t plan to buy it tend to change their minds as soon as they try one. No feature checklist will ever convey user delight."

Source: marco

"The iPad has the proportions of a paper page. It’s a familiar format, which feels natural to humans, especially in portrait mode. A widescreen display in portrait mode feels wrong. We just played with a JooJoo-which is 16:9-and that’s exactly how it feels: Stupid."

Source: Gizmodo

petervidani:

In case you were wondering, this is the button that Ivy Leaguers running A/B tests will produce.

petervidani:

In case you were wondering, this is the button that Ivy Leaguers running A/B tests will produce.

Source: petervidani

Text

I spend a lot of time parsing and cleaning up text files with regular expressions, and there’s a problem that comes up fairly often that used to really puzzle me. How do you replace something that requires complicated, multi-step logic?

Everyone who has used regular expressions is pretty familiar with doing something like this:

>> "5553331234".gsub(/(\d{3})(\d{3})(\d{4})/, '(\1) \2-\3')
=> "(555) 333-1234"

And truth be told, you can do a lot of good stuff with that simple concept. The problem is that it isn’t always so easy as replace “this” with “that”. Many times you want to inject some logic into the replacement process. Thankfully we can can pass blocks to the regular expression methods in Ruby (.NET offers something similar by passing a delegate to Regex.Replace).

This allows us to do some really complicated matching pretty easily. Last week I needed to reformat hundreds of SQL statements that NHibernate was generating. Here’s what some of them looked like:

exec sp_executesql N'INSERT INTO Actions (CreatedAt, Description,
IsReversible, Name, ObjectClass, UserTransactionID) VALUES (@p0,
@p1, @p2, @p3, @p4, @p5)',N'@p0 datetime,@p1 nvarchar(9),@p2 bit,@p3
nvarchar(12),@p4 nvarchar(15),@p5 int',@p0='2010-04-03
00:36:25.1100000',@p1=N'logged
in',@p2=0,@p3=N'Authenticate',@p4=N'UsersController',@p5=5589

exec sp_executesql N'INSERT INTO UserTransactions (CreatedAt,
Description, UserID) VALUES (@p0, @p1, @p2)',N'@p0 datetime,@p1
nvarchar(30),@p2 int',@p0='2010-04-03 00:37:26.9600000',@p1=N'viewed
applicant Michael Smith',@p2=1

I needed these formatted as simple SQL statement without the exec sp_executesql with parameters nonsense. I needed to replace these:

(@p0, @p1, @p2)

With these:

@p0='2010-04-03 00:37:26.9600000', @p1=N'viewed applicant Michael
Smith',@p2=1

So it would look like this:

('2010-04-03 00:37:26.9600000', 'viewed applicant Michael Smith', 1)

Shew. As you can imagine a simple gsub like our first example wasn’t going to cut it. But, by using a block we can easily execute additional logic on each match. Here’s the code:

# Match each SQL statement that starts with exec sp_executesql
sql.gsub!(/exec sp_executesql.*?$/) do |match|
  # collect the params from the end of the statement into an array
  values = match.scan(/(@p\d)=N?(.*?)(?=(,@p\d)|$)/)

  # Remove the beginning and end of the statement
  match.gsub!(/exec sp_executesql N'/, "").gsub!(/',N'@p0.*?$/, "")

  # Replace each of the parameters with its corresponding value
  values.each { |v| match.gsub!(v[0], v[1]) }

  # Return our clean SQL statement
  match
end

You can see here that I’m using a block with gsub instead of providing a replacement string. This gives us a match object for each matching SQL statement where we can make additional replacements, and our statements end up looking like this:

INSERT INTO Actions (CreatedAt, Description, IsReversible, Name,
ObjectClass, UserTransactionID) VALUES ('2010-04-03
00:36:25.1100000', 'logged in', 0, 'Authenticate',
'UsersController', 5589)

INSERT INTO UserTransactions (CreatedAt, Description, UserID)
VALUES ('2010-04-03 00:37:26.9600000', 'viewed applicant Michael
Smith', 1)

While some additional explanation about what’s happening in the block would probably be useful, the point here is that this kind of complicated logic is possible and with very little code and hassle.

If your regular expressions are seeming impossible or overly complicated, see if you can make it happen with the regex 2 (or 3 or 4) step instead.

Text

I’ve noticed a somewhat annoying trend where iPad app designers are putting a “frame” around the content of their applications. Nobody did this on the iPhone because pixels were too precious, but it seems the iPad’s plethora of pixels are begging to be wasted. In all the cases below, the extra space could be used to show more information usefully. Articles seems to be the least annoying, but even so, the iPad is a real device that can sit on a real wood surface. No need to draw fake desks for me. Calculator, don’t get me started…

Weather Station Pro (via Well-Placed Pixels)

Articles for iPad (via Well-Placed Pixels)

Twittelator Pad (via Engadget)

Calculator (via Engadget)

You can now add stickers to recommendations for the Tumblr Directory for $1. Tumblr is doing a great job coming up with entertaining, creative and unobtrusive ways to make money. Not to mention that their integrated payment “bubbles” make it positively fun to spend money on the site.

You can now add stickers to recommendations for the Tumblr Directory for $1. Tumblr is doing a great job coming up with entertaining, creative and unobtrusive ways to make money. Not to mention that their integrated payment “bubbles” make it positively fun to spend money on the site.

I love these statistics from Vimeo where the labels for the sparkline graphs are attached to the bottom in matching colors.

I love these statistics from Vimeo where the labels for the sparkline graphs are attached to the bottom in matching colors.

Text

Quick Tip: In the terminal in Mac OS X you can easily pipe the output of commands to your favorite desktop text editor (providing it supports it) for much easier reading.

$ curl http://www.apple.com/ipad/ | mate
$ ruby script_with_massive_output.rb | bbedit