P'unk Avenue Window

Author Archive

There Is No Philadelphia Blog Tax… Just A Philadelphia Everything Tax

August 24th, 2010 by Tom 9 Comments

Philly does not have a special tax on bloggers. All the outrage about this is silly and overblown. So why am I still ticked off at the city? Because Philly has a tax code that punishes new businesses, period.

Many news outlets are carrying the story of the “Philly blog tax.” This staff opinion piece in the Washington Examiner is typical. Bloggers are waking up to discover that the city demands they pay $300! Sarah Palin was right— the First Amendment is dead!

Except that’s not what happened at all.

1. These bloggers were deriving a (very small) amount of income from ads. They signed up for that, provided bank account numbers so Google or whoever could pay them, the whole bit. They were very much aware they were trying to make money, successfully or not.

2.They reported that income to the IRS.

3. The IRS made that information available to the city and state authorities, and the city did what it did with everyone who operates a business in the city: they required the business owner to pay their one-time, lifetime $300 business license fee.

The city is not gunning for bloggers or even looking for blogs at all. They are just reading the information the IRS gives them.

Bloggers who are not trying to make money- bloggers who are not running ads for a cut of the profit- are not being required to pay $300. There is no free speech issue here.

You can certainly argue that the city shouldn’t require a business license for entities that have not earned at least $100 in a given year. I would agree with you— $100 would be twice the city’s alternative $50 annual fee for those who don’t want to shell out $300 up front in the belief that their business will one day be viable. A $100 cutoff seems fair and sane.

You can also argue that local taxes are unnecessarily complicated, requiring small business owners to pay as much to accountants as they do to the local government because their tax software refuses to even consider handling every little municipality’s crazy unique tax code. I would agree with you there too. State and local taxes on personal and business earnings should be percentages of your adjusted gross income, or the corporate equivalent. Nothing more complicated than that. (Property tax is another story entirely.)

But the city is not specifically going after bloggers. They are doing what they have always done to collect taxes on all business activities in Philly.

Two recent Inky stories got the facts right, but it’s worth emphasizing the most important point: the city is responding to information from the IRS about people who reported business income to the feds but not to the city. That’s it, and that’s all. They have no idea which businesses are blogs. The underlying problem is that Philly punishes new businesses in general.

Apostrophe Updates

August 6th, 2010 by Tom 2 Comments

Apostrophe has received quite a few fixes and improvements over the past few months. We’ve made upgraded releases of our open source software available. To learn more, visit the Apostrophe developer site.

Read on for a changelog of what’s new in four Symfony plugins that go into practically every Apostrophe site: apostrophePlugin and apostropheBlogPlugin (which we created) and sfJqueryReloadedPlugin and sfDoctrineActAsTaggablePlugin (which we contribute to).
(more…)

Star Wars Uncut, Uncut

August 3rd, 2010 by Tom 9 Comments

Star Wars Uncut is finished! And next Wednesday, August 11th at 6pm we’ll be screening the entire crowdsourced, fan-remade movie on the projector in our office. I’ve downloaded the whole darn thing and assembled the most popular scenes as voted by the participants. This stuff is awesome.

Please join us for beer, snacks and force-fueled goodness. Or as Chewbacca would put it, “AROUUUUHUUHHHH! ARRRRRGGUUUUU! ARROOOOHAAAAAAH!”

PLEASE RSVP by commenting here so we have a rough idea how many people to expect. Keep an eye on this blog for updates in the event of catastrophic popularity and other natural disasters.

FREQUENTLY ASKED QUESTIONS

“Where?” 1168 E. Passyunk Ave, South Philly.

“When?” Wednesday August 11th, 6pm.

“Who?” Grownups and teens. There is some adult humor in two very funny scenes that totally deserve to be in the movie.

“Who made this?” Casey Pugh of Vimeo created and executed this brilliant project. Fans all over the world contributed 15-second scenes.

“Did you guys submit a scene?” Yes, I (Tom) did, but it didn’t top the voting for that scene. Here’s my scene:

“Will there be more crowdsourced movies?” Pugh says there will be an Empire Strikes Back Uncut. Personally I’d like to see Big Lebowski Uncut. If you know what I mean. And I think you do.

PLEASE RSVP by commenting here. Thank you!

Security hole in Mobile Safari PDF support a bigger story than jailbreakme

August 2nd, 2010 by Tom 2 Comments

The buzz today is that a new site, jailbreakme, will jailbreak your iPhone without the need to install any software on your host computer.

What’s bizarre about this is that everyone thinks it is cool and no one is pointing out that this site must be exploiting a truck-sized security hole in Mobile Safari.

Understand this: if jailbreakme can take over your phone, then any website run by a malicious hacker with skillz can take over your phone and run executables that do anything it pleases. This is very bad and Apple needs to issue iOS 4.0.2 today.

Of course, when they do, people will accuse them of being meanies, completely missing the point that exploitable browser bugs are extremely dangerous and are not always used to do cool stuff by nice white-hat hackers.

As one friend tweeted back, “not from what I understand. It just dls a package that that then, as allowed, unpacks and runs. It’s basically a web app.”

No, it is not a web app! A web app is something that stays in your browser and goes away when you close the page. Taking over your entire phone’s operating system is not how a web app behaves. It is the reason why we patiently tell all of our friends not to install .exe files people email to them.

Alas, now iPhone users are so trusting that if Mobile Safari allows something to happen, they assume it must be intentional.

Just because this particular site delivers what it says it will deliver and even asks nicely doesn’t mean that other sites exploiting the same hack must be innocent or will ask at all before installing malware on your phone.

But what is the security hole? Apparently it’s PDF-related. I ran the source code of www.jailbreakme.com through a couple of prettyprinters and tracked down this snippet determining what page it loads in an iframe:

("/_/" + model + "_" + firmware + ".pdf")

Apparently Apple’s PDF viewer on the iPhone has a security hole that allows native code to be loaded and run. This is not awesome. Raising the profile of an exploitable security hole before Apple has a chance to fix it is not awesome either as it will lead to innocent people getting their phones hacked.

This is a Big Bug, and hopefully Apple will patch it before the week is out.

Symfony Almost Live

July 30th, 2010 by Tom 2 Comments

You’ll want to watch fullscreen for readability.

Which web development framework is the best? I can tell you this: Symfony gets the job done fast.

Last week Alex and I took part in a panel discussion of web frameworks at the Wharton UI Conference. I had half an hour to kill beforehand, so I decided to build a web application with Symfony. I had time left over to play with the CSS and demonstrate the power of layout templates. After we returned I went upstairs and made a screencast while building the app once more.

I made a number of educational mistakes along the way, so I included those along with their solutions.

Is this a full-fledged practical web application? Not quite— there’s no user management, for one thing. But that’s a topic for another screencast. Be sure to comment if you’d like to see additional installments.

Google’s new “App Inventor” is a game-changer

July 12th, 2010 by Tom 8 Comments

There are now 10,000 Android developers, as opposed to 40,000 for the iPhone. And Google is gearing up to release App Inventor, a tool for nontechnical Android app developers that is strikingly similar to the Scratch programming environment for kids. Meanwhile Android phones themselves are catching up quickly, although the iPhone 4 remains the coolest thing around.

Like many others I’m sure, I considered developing a tool like this and abandoned it after coming to grips with Apple’s harsh policies on the subject of alternative programming environments:

3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).

Google’s reliance on crowdsourced quality control for apps isn’t perfect but it is beginning to add up to a real difference in spirit. As Android phone sales grow, making development for it an even more viable proposition, content creators will eventually vote with their feet for the platform where they feel most welcome and walk away from the walled garden.

I have an iPhone and I love it, in part because of Apple’s excellent quality control in the core applications. If Apple’s competition here were as bad as their competition in the MP3 player market— companies with almost no grasp of design— I wouldn’t doubt the outcome for a moment. But Android also has quality designers at play. Google’s approach to design may be a bit plodding and obsessed with A/B testing, but it does get results.

Apple knows they must continue to release cutting-edge hardware, but they don’t seem to grasp what it takes to maintain a welcoming developer platform once there are viable alternatives in the game.

I’m going out on a limb here: a year from now there will be as many Android apps as iPhone apps. 18 months from now Android phone sales will surpass iPhone sales. Apple will still have the sexiest phones, and will still command a premium price for them. But inside two years the iPhone will occupy a niche similar to that of the Macbook.

Symfony 2 hub-bub

June 10th, 2010 by Tom 6 Comments

Symfony is the best framework for building web applications in PHP. The forthcoming Symfony 2 is a dramatic improvement and a complete rewrite with many new features and, even more importantly, better software architecture. Enthusiasts may have heard about the State of Symfony 2 Online Conference to be held on June 23rd. Fabien and the Sensio team have encouraged folks to become “Symfony conference hubs” and invite others to attend the conference from our offices and enjoy the benefits of our lovely projector, coffee, etc. And P’unk Avenue is definitely all about it. Please RSVP by commenting here.

WHAT: Symfony 2 Live Conference
WHERE: P’unk Avenue offices, 1168 E. Passyunk Ave, Philadelphia PA
WHEN: 11am Wednesday, June 23rd

Thanks to our hub status, You do not have to buy your own Symfony 2 ticket to attend at our office.

We’re looking forward to discussion and possibly busting out the Symfony 2 sandbox and experimenting after the conference.


Amid the excitement about Symfony 2, this would be a good time to mention our ongoing support for Symfony 1.4, and by extension Apostrophe 1.x. If Symfony 2.0 is coming, does that mean we’re going to abandon Symfony 1.x and Apostrophe 1.x?

No, not by a long shot, not any time soon. Symfony 2 will not be backwards compatible in a “super easy upgrade path” way, which is a valid choice to make improvements that would otherwise be impossible but an obvious problem for existing projects. And we have plenty of those. What’s more, Symfony 2 requires PHP 5.3.x at a minimum, and we know how tough it can be to move clients along just to PHP 5.2.x.

Fortunately, Sensio had the wisdom to make Symfony 1.4 a long-term-support release. And since Apostrophe 1.x is happily married to Symfony 1.4, that means we’re all in good shape.

Symfony 1.4 is supported until November of 2012, and Apostrophe 1.x will also be supported until at least November of 2012.

At some point, Apostrophe 2.x will come into being and it will be based on Symfony 2, but we have many client and internal projects that are purring away happily on Symfony 1.4 and we have absolutely no interest in abandoning it. So you can very safely pursue client projects based on the current stable releases of Apostrophe.

Introducing Apostrophe’s Blog Plugin

June 7th, 2010 by Tom 4 Comments

Apostrophe, our content management system, now sports a nifty new blog plugin. And you can see it in action on GPTMC’s Philly360.

Wondering where the blog is? In the context of a larger website, a blog doesn’t always jump out and shake you by the lapels. On philly360 it’s the engine behind The Insider:


Screen shot 2010-06-07 at 9.19.17 AM


Notice the navigation links at the left. You can spelunk by category, date or tag.

Don’t see the categories? That’s because, on this particular site, they have been rebranded as “Features.” This is a common way to use Apostrophe blog categories: as separate “blogs.” It’s possible to set them up with entirely separate pages at any point in the site or, as in this case, as subpages of the main blog.

The Apostrophe blog plugin also drives the Events page:


Screen shot 2010-06-07 at 9.23.19 AM


But that’s not quite the whole story. In truth, the blog is front and center on the home page. Let’s take another look:


Screen shot 2010-06-07 at 9.22.56 AM


Notice the “News” and “Events” sections. These are Apostrophe slots pulling in recent blog posts and recent events from the blog plugin. Editors can plug in recent posts and events, or plug specific posts and events into specific pages. And designers can customize the presentation of posts to suit any page template.

Visitors can comment on blog posts in a spam-free environment, optionally logging in via Facebook, Twitter and several other services thanks to the excellent Disqus blog comment management service.

All of these capabilities are standard in Apostrophe’s blog plugin. And it’s open source, so Symfony developers can dive right in. Visit the Apostrophe documentation for details.

“Great, so how come your own blog is still running WordPress?” That will change! It’s not broken and we have plenty of client projects to build, so it’s not our first priority today. But our blog will be migrating to punkave.com/window. We need to take a little time to design it nicely and take advantage of Disqus’ “import comments from Wordpress” feature.

No Symfony users group meeting this week

May 10th, 2010 by Tom No Comments

We’re looking at doing a meeting the following week or possibly next month. Fact is, we’re busy!

Speaking of Symfony and being busy, if this announcement disappoints you— if you’re eager to hobnob with other Symfony developers— may I suggest you apply to work here? You’ll have all the Symfony you can eat! We’re particularly eager to talk to experienced PHP5 framework coders, and to Ruby on Rails coders who are open to working in PHP (sekrit plans to convert us to Ruby are a bit unrealistic given the depth of our commitment to PHP and Symfony).

Faster, Windows PHP! Kill! Kill!

April 26th, 2010 by Tom 1 Comment

IN WHICH our hero is narrowly saved by vague memories of a really dull presentation by some guys in suits.

You may recall my recent post on speeding up PHP on Linux without changing your PHP code. Those techniques have become standard practice around here, and the article has since been retweeted, linked to, engraved on an unobtanium disc embedded in a space probe to be launched next week by the Malaysian space forces, et cetera. So it seems we have the Linux PHP thing down to a science, for now.

But not every shop runs Linux, and one of our clients has asked us to deploy in a Windows environment. We’ve deployed PHP sites for them before, but that was in the Symfony 1.0 days, and there just weren’t nearly as many class files to compile. When we set out to deploy a modern site built with Apostrophe, our content management system based on Symfony 1.4 and Doctrine, we were reminded that out-of-the-box PHP is slow, slow, slow.

I would gladly have addressed this the same way we do it on Linux: FastCGI, APC and Apache’s worker thread MPM. And in fact Apache for Windows seems to only support a special threaded MPM under Windows anyway, so that part is already familiar.

Unfortunately, the official PHP infrastructure for Windows has, frankly, undergone a bit of code rot lately:

The PHP binaries don’t seem to include a CGI/FastCGI binary! Shoot. Well, maybe APC alone will be enough. But APC is not standard with the Windows PHP binaries, so I need to get it from PECL. Okay, but the PECL for Windows site is “temporarily out of service.” A new solution is coming, but it’s not here yet.

Searches led me to Pierre Joye’s folder on downloads.php.net. Pierre is a core PHP developer, so I trust him, no problem there. But the version of APC found there just locks up Windows PHP, at least in my tests. I investigated alternative PHP bytecode caches and wound up with xcache. xcache worked for a while, then started spewing errors about classes being redefined, and always began doing so again within a few page views after each restart of Apache.

Yuck!

Fortunately, by this point a vague memory was stirring somewhere in my geeky cortex. I was in Paris… I was full of pain au chocolat… I was very sleepy… two guys in suits were droning on and on about something while the crowd ignored them… AHA! Those Microsoft guys at Symfony Live! They were talking about speeding up PHP on Windows. They even mentioned hiring Pierre Joye to help out. But they didn’t demonstrate anything on Symfony, so I wasn’t paying a lot of attention—

Just enough as it turns out. The deal is this: Microsoft knows that PHP has, historically, sucked on Windows. And they have taken steps. And this is good news for the rest of us.

PHP can now be installed via the Microsoft Web Platform installer. That gives you single-threaded PHP running via fastcgi— exactly like my Linux setup, except for the bytecode cache part. And now the new Windows Cache Extension for PHP delivers a bytecode cache, equivalent to APC.

The end result is definitely in the ballpark with the performance of my Linux solution. Since I haven’t tested them on the same hardware (both boxes were VMs, and they were provided by different datacenters), I cannot say for certain which was faster. The Microsoft speakers at Symfony Live characterized it as better but still not as fast as the best PHP setups on Apache. At any rate it’s a big improvement and well worth your time if you need to host on Windows.

So here’s a HOWTO for configuring Symfony and PHP on Windows with good performance:

To configure IIS for Symfony:

1. Make sure IIS is installed. I know, right?

We want IIS 7. IIS 7 features an excellent importer for mod_rewrite rules, and Symfony loves mod_rewrite rules.

2. Install PHP from the Microsoft Web Platform. Click that link from IE running on your server (hint: remote desktop connection) for the easiest download-and-install process.

3. Install Windows Cache for PHP to get acceptable speed from the above. I installed version 1.0 because 1.1 is in beta. The beta does look interesting because it has an alternate PHP session handler that uses shared memory. You’d have to configure symfony to actually use that feature I believe (welcome to factories.yml).

4. Let’s say your project’s short name (aka “Unix name”) is mysite. So copy your Symfony project to c:\mysite. (I’m assuming a virtual machine for a single client project. Choose a better folder structure if you’re deploying lots of sites on this box.) You can set up cygwin to allow ssh access and rsync those files with project:deploy, and in fact we do, but that’s a subject for another day. FTP also works.

5. Launch the IIS manager (Start -> Administrative Tools -> IIS Manager).

6. Open the server’s icon, then “Sites,” then delete the “default site” entry.

7. Add a new site entry called mysite. Map the site’s web folder to be the web subfolder of the Symfony project which you should have copied to c:\mysite by now. So the web folder path would be c:\mysite\web. Assign it to port 80. Do NOT set the web folder to be the root of your project! That is very dangerous as it exposes your databases.yml file. Point it to the web subfolder.

8. Always clear your Symfony cache after copying a site to a new server. At the command shell (start->run->cmd.exe), type:

cd \mysite
php symfony cc

10. PHP needs write access to c:\windows\temp to store session data in order for logon sessions to work. You should have no trouble here on a new setup with just IIS I suspect, but if you previously ran Apache you might need to clean up. Clobber any existing session files in c:\windows\temp. Note that this is also the folder where the PHP error log file is found:

c:\windows\temp\php-errors.log

You can watch that file using a Cygwin shell and the tail -f command, or peek at it as needed with a text editor.

9. Try the site out, with a frontend controller name in the URL. You’ll get the home page but subpages won’t work yet without manually putting the controller name back in the URL. In IE running on the server itself, visit:

http://localhost/index.php

10. We need to add the mod_rewrite rules that remove the need for `/index.php`. But IIS doesn’t have mod_rewrite. Fortunately IIS7 has its own URL rewriting feature… and it can import your rules.

In the IIS manager, double-click mysite, then double-click “URL Rewrite.” In the “Actions” area at right, click “Import Rules” under “Inbound Rules.”

Edit: if “Inbound Rules” is missing, close “URL Rewrite” and then open that feature again. Also try adding one empty rule manually first. The “incredible disappearing/reappearing ‘Inbound Rules’ feature” appears to be a bug in the IIS manager.

Paste the mod_rewrite rules from your web/.htaccess file. IIS will do a pretty snazzy job of converting them when you click Import (but if you have fancy rules that go beyond the usual Symfony rules, give the end results a careful look-see). Then click “Apply.”

Edit: IIS won’t tell you, but the settings you just created live in a file called web.config in the web subfolder of your project. You must not crush this file when you sync your project. Add the file to your project, or rsync exclude it if you’re using cygwin and project:deploy. Since you might want to add more rules to it manually I generally recommend the former. But one disadvantage of adding it to your project is that any edits you make in the GUI will get clobbered on future syncs if you don’t manually copy the resulting changes from web.config on the server back to your project.

11. Try the site again. You should be able to browse the entire site now.

12. Whoops, you can’t log in because IIS is hijacking the 401 Unauthorized error page. To fix that, go back to the IIS Manager pane for mysite. Double-click “Modules” and remove the “Custom Error” module.

Now your site’s login page will appear properly. Also your custom 404 and 500 error pages.

That’s it – you should be ready to go with much speedier Windows PHP.

Note that for the time being the Microsoft Web Platform seems to offer only PHP 5.2.13. This is a stable and sane choice and until recently I would have done it no differently. But PHP 5.3.2 is much better than 5.3.0 and 5.3.1 and offers new features that matter— improved memory management, faster performance and new PHP language features that the forthcoming Symfony 2.0 requires. Hopefully PHP 5.3.x will appear in the Web Platform installer soon.

(*) Yes, I sorted through the maze and found versions of PHP and APC that were supposedly for the same C runtime, et cetera. Still no love. xcache was better, but alas the redefined class errors put paid to that too.