<?xml version="1.0" encoding="UTF-8"?>
<posts type="array">
  <post>
    <author-id type="integer">1</author-id>
    <body>Like many people I downloaded Safari 4 Beta with some excitement (is that sad?) as soon as it was released a couple of days ago. My first thought upon opening the shiny new browser was that the user interface was a bit crazy (are Apple going cover flow crazy?) but there was something else that felt really wrong.. what was it? Then it hit me.. it was the new tabs UI where Apple have now positioned tabs at the top of the window, in fact they're located so close to the top of the window that they have entered the sacred area of the window title and become one with it, eugh.

As far as I know this is the first time this has happened in OS X and I think it is *a really bad idea*. I know its takes up less space, I know its more compact than Camino, but I don't care. I think it is at best, an ugly solution, and at worst, a confusing interface implementation for users. It goes against every other window seen in OS X (yes, even those sexy transparent black HUD windows) and after a little digging in &quot;Apple's Human Interface Guidelines on Window Elements&quot;:http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGWindows/chapter_18_section_4.html#//apple_ref/doc/uid/20000961-SW8 I found the following:

bq. The only controls that belong in a title bar are the close, minimize, and zoom buttons. If a title bar is combined with a toolbar, the unified area can contain the toolbar control and the toolbar customization contextual menu (these controls are described in &quot;Title Bar Buttons&quot;). Do not place other controls in a title bar.

There you go Apple. *You're violating your own guidelines* by putting other controls, i.e tabs, into the window title. I *pray* that Apple will rethink this interface design. Anyway, I present (da da daa!) my idea for the tab interface implementation. It's no more compact that Safari 3's tab UI but it does have the correct hierarchy of Window Title, Tab with Page Title, Address, Content and it doesn't violate the &quot;Human Interface Guidelines&quot;:http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGIntro/chapter_1_section_1.html.

&quot;!http://seventytwo.co.uk/assets/0000/0016/safari4tabuimockupsmall.jpg!&quot;:http://seventytwo.co.uk/assets/0000/0012/safari4tabuimockup.jpg

&quot;View a larger version&quot;:http://seventytwo.co.uk/assets/0000/0012/safari4tabuimockup.jpg</body>
    <body-html>&lt;p&gt;Like many people I downloaded Safari 4 Beta with some excitement (is that sad?) as soon as it was released a couple of days ago. My first thought upon opening the shiny new browser was that the user interface was a bit crazy (are Apple going cover flow crazy?) but there was something else that felt really wrong.. what was it? Then it hit me.. it was the new tabs UI where Apple have now positioned tabs at the top of the window, in fact they&amp;#8217;re located so close to the top of the window that they have entered the sacred area of the window title and become one with it, eugh.&lt;/p&gt;
&lt;p&gt;As far as I know this is the first time this has happened in OS X and I think it is &lt;strong&gt;a really bad idea&lt;/strong&gt;. I know its takes up less space, I know its more compact than Camino, but I don&amp;#8217;t care. I think it is at best, an ugly solution, and at worst, a confusing interface implementation for users. It goes against every other window seen in OS X (yes, even those sexy transparent black &lt;span class=&quot;caps&quot;&gt;HUD&lt;/span&gt; windows) and after a little digging in &lt;a href=&quot;http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGWindows/chapter_18_section_4.html#//apple_ref/doc/uid/20000961-SW8&quot;&gt;Apple&amp;#8217;s Human Interface Guidelines on Window Elements&lt;/a&gt; I found the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The only controls that belong in a title bar are the close, minimize, and zoom buttons. If a title bar is combined with a toolbar, the unified area can contain the toolbar control and the toolbar customization contextual menu (these controls are described in &amp;#8220;Title Bar Buttons&amp;#8221;). Do not place other controls in a title bar.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There you go Apple. &lt;strong&gt;You&amp;#8217;re violating your own guidelines&lt;/strong&gt; by putting other controls, i.e tabs, into the window title. I &lt;strong&gt;pray&lt;/strong&gt; that Apple will rethink this interface design. Anyway, I present (da da daa!) my idea for the tab interface implementation. It&amp;#8217;s no more compact that Safari 3&amp;#8217;s tab UI but it does have the correct hierarchy of Window Title, Tab with Page Title, Address, Content and it doesn&amp;#8217;t violate the &lt;a href=&quot;http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGIntro/chapter_1_section_1.html&quot;&gt;Human Interface Guidelines&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://seventytwo.co.uk/assets/0000/0012/safari4tabuimockup.jpg&quot;&gt;&lt;img src=&quot;http://seventytwo.co.uk/assets/0000/0016/safari4tabuimockupsmall.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://seventytwo.co.uk/assets/0000/0012/safari4tabuimockup.jpg&quot;&gt;View a larger version&lt;/a&gt;&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2009-02-25T16:42:13+00:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">30</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2009-02-25T16:00:00+00:00</published-on>
    <title>Improving Safari 4's Tab User Interface</title>
    <updated-at type="datetime">2009-02-25T16:51:01+00:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>I've just finished implementing 'remember me' functionality in a Merb app I'm working on and I came across a gotcha when setting cookies that I thought I'd post up for anyone coming across the same thing.

You can set a cookie with and expiry date in Merb using something like:

&lt;notextile&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;cookies&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;set_cookie&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;foo&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;true&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;secure&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_ruby&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;expires&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;days&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;from_now&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/notextile&gt;

I was setting a cookie using the value of a DateTime property on my model, something like this:

&lt;notextile&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;cookies&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;set_cookie&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;auth_token&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;user&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;remember_token&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;expires&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; session&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;user&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;remember_token_expires_at&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/notextile&gt;

Unfortunately the above code didn't work. I eventually found out that it was down to the DateTime property on the model that I was using for the &lt;code&gt;:expires&lt;/code&gt; option. The &lt;code&gt;#set_cookie&lt;/code&gt; method expects &lt;code&gt;:expires&lt;/code&gt; to be supplied with a Time object, not a DateTime object. If it isn't given a Time object then it will not convert the value to the correct format required for a cookie. Thus you end up with a cookie that will expire at the end of the browser session instead.</body>
    <body-html>&lt;p&gt;I&amp;#8217;ve just finished implementing &amp;#8216;remember me&amp;#8217; functionality in a Merb app I&amp;#8217;m working on and I came across a gotcha when setting cookies that I thought I&amp;#8217;d post up for anyone coming across the same thing.&lt;/p&gt;
&lt;p&gt;You can set a cookie with and expiry date in Merb using something like:&lt;/p&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;cookies&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;set_cookie&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;foo&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;true&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;secure&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_ruby&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;expires&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;days&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;from_now&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;I was setting a cookie using the value of a DateTime property on my model, something like this:&lt;/p&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;cookies&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;set_cookie&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;auth_token&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; session&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;user&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;remember_token&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;expires&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; session&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;user&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;remember_token_expires_at&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;Unfortunately the above code didn&amp;#8217;t work. I eventually found out that it was down to the DateTime property on the model that I was using for the &lt;code&gt;:expires&lt;/code&gt; option. The &lt;code&gt;#set_cookie&lt;/code&gt; method expects &lt;code&gt;:expires&lt;/code&gt; to be supplied with a Time object, not a DateTime object. If it isn&amp;#8217;t given a Time object then it will not convert the value to the correct format required for a cookie. Thus you end up with a cookie that will expire at the end of the browser session instead.&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2009-01-14T07:23:34+00:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading>* &quot;http://wiki.merbivore.com/howto/cookies&quot;:http://wiki.merbivore.com/howto/cookies</further-reading>
    <further-reading-html>&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://wiki.merbivore.com/howto/cookies&quot;&gt;http://wiki.merbivore.com/howto/cookies&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</further-reading-html>
    <id type="integer">27</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2009-01-14T06:50:00+00:00</published-on>
    <title>Gotcha when setting expires on cookies in Merb</title>
    <updated-at type="datetime">2009-01-14T07:25:30+00:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>Simon and I would like to wish you all a very merry Christmas!</body>
    <body-html>&lt;p&gt;Simon and I would like to wish you all a very merry Christmas!&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-12-25T14:23:44+00:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">25</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-12-25T14:21:00+00:00</published-on>
    <title>Merry Christmas!</title>
    <updated-at type="datetime">2008-12-25T14:23:44+00:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>!http://seventytwo.co.uk/assets/0000/0010/railsmerbmerge.gif!

Wow. This is exciting. Rails and Merb have got it on and are carrying a love child, its called Rails 3. Merb has been a great thing for the Rails world helping to push Rails in a better direction. Many ideas from Merb are already appearing in Rails edge but from now on they'll be combining the &quot;great minds&quot;:http://rubyonrails.org/merb of both frameworks to create a *killer ruby web framework*. More information can be found at the &quot;official rails blog announcement&quot;:http://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3. Exciting times ahead!

bq. Rails 3 is going to kick ass.</body>
    <body-html>&lt;p&gt;&lt;img src=&quot;http://seventytwo.co.uk/assets/0000/0010/railsmerbmerge.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Wow. This is exciting. Rails and Merb have got it on and are carrying a love child, its called Rails 3. Merb has been a great thing for the Rails world helping to push Rails in a better direction. Many ideas from Merb are already appearing in Rails edge but from now on they&amp;#8217;ll be combining the &lt;a href=&quot;http://rubyonrails.org/merb&quot;&gt;great minds&lt;/a&gt; of both frameworks to create a &lt;strong&gt;killer ruby web framework&lt;/strong&gt;. More information can be found at the &lt;a href=&quot;http://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3&quot;&gt;official rails blog announcement&lt;/a&gt;. Exciting times ahead!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rails 3 is going to kick ass.&lt;/p&gt;
&lt;/blockquote&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-12-23T12:58:09+00:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">24</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-12-23T12:31:00+00:00</published-on>
    <title>Merb and Rails evolve into Rails 3</title>
    <updated-at type="datetime">2008-12-23T12:58:56+00:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>bq. A website wireframe is a basic visual guide used in web design to suggest the layout of fundamental elements in the interface.

Let me start of with saying that *wireframes save time, effort and money*. By spending time making wireframes at the start of development we can make things easier, faster and more enjoyable for ourselves in the long run. Consider building a house without any architects drawings and you'll get the idea.

When we started on our latest project at Makito Labs we wanted to make sure we had everything planned out to the nth degree to make our development process as smooth as possible. One of the things we decided upon very early in the project was that we were going to use wireframing for laying out the interface. Usually we would find ourselves jumping in, sketching out very rough ideas on paper, constructing them in Photoshop, and then iterating through a few different revisions. That can get seriously draining and time consuming. I now know that there is a better way.

This time we're producing the wireframes before even thinking about the site design. Wireframes allow us to quickly come up and play around with possible UI layouts while being free from not having to care about the final design, instead we can focus on achieving the optimum layout of elements for our users.

h2. Before you get started

It's easier to start producing your wireframes if you have an idea of your how your site's or app's is going to be structured so I'd advise making a site map before you move into the wireframing otherwise you may end up wasting more time by wireframing things you don't need or missing things that you do.

h2. Producing Wireframes

As with most things there are quite a few ways of generating wireframes. Of course there is the good old pencil and paper but there are some other options which are easier to manipulate, not to mention easier on the environment.

h3. HTML Wireframes

Some people suggest using HTML but I belive it takes too much time to produce and can be a lot of hassle. &quot;Paul Boag&quot;:http://boagworld.com/usability/quick_and_dirty_wireframes/ summed it up nicely:

bq. ...the most common way to build wireframes is using HTML. Of course the downside of this approach is that it can take longer if you are overly precious about your code. Personally, when it comes to wireframes I prefer the quick and dirty approach. I create my HTML wireframes using the WYSIWYG editor in Dreamweaver, churning out the pages through a mixture of CSS and tables. I don&#8217;t care what is going on under the hood. All I care about is that I can get a sense of how the site would work.

Taking this somewhat cavalier attitude to HTML wireframes is not without its drawbacks. Because the underlying code is a mess, ultimately the wireframe has to be thrown away. A better approach would be to use nice clean semantic code which can then be reused for the final build. However, in my experience this rarely works in reality

h3. Software for Wireframing

So if we're not going to use pencils or HTML, what else is there? Welll there are a few pieces for Windows users such as &quot;Microsoft Visio&quot;:http://office.microsoft.com/en-us/visio/default.aspx or the full featured &quot;Axure RP&quot;:http://www.axure.com/Default.aspx. Both of them looked pretty good to me but I'm a Mac man so I needed something OS X friendly.

I finally narrowed my choices down to two products - the lovely &quot;OmniGraffle&quot;:http://www.omnigroup.com/applications/OmniGraffle/ and a funky little piece of cross-platform software - a Mac *and* Windows friendly app called &quot;Balsamiq Mockups&quot;:http://www.balsamiq.com/products/mockups.

I already use &quot;OmniGraffle&quot;:http://www.omnigroup.com/applications/OmniGraffle/ for quite a lot things like producing site maps, database schemas and domain models and there are quite a lot of &quot;UI stencils available to download for free&quot;:http://graffletopia.com/categories/user-interface but after taking a look at &quot;Balsamiq Mockups&quot;:http://www.balsamiq.com/products/mockups I was hooked. Unlike OmniGraffle it's made for one thing and one thing only - wireframing. Mockups gives you exactly what you want to create wireframes including possibly every UI element you can think of (I havent found any missing yet) and a nice sketchy feel which stops you from thinking about design and allows you to focus solely on laying out the UI.

!http://seventytwo.co.uk/assets/0000/0008/balsamiq-mockups.jpg!

h2. Life with wireframes

Hopefully this post will make those of you who aren't wireframing consider using them in the future. We've found them to a very useful step in the development process and we'll definitely be continuing to use them in all our future projects.</body>
    <body-html>&lt;blockquote&gt;
&lt;p&gt;A website wireframe is a basic visual guide used in web design to suggest the layout of fundamental elements in the interface.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Let me start of with saying that &lt;strong&gt;wireframes save time, effort and money&lt;/strong&gt;. By spending time making wireframes at the start of development we can make things easier, faster and more enjoyable for ourselves in the long run. Consider building a house without any architects drawings and you&amp;#8217;ll get the idea.&lt;/p&gt;
&lt;p&gt;When we started on our latest project at Makito Labs we wanted to make sure we had everything planned out to the nth degree to make our development process as smooth as possible. One of the things we decided upon very early in the project was that we were going to use wireframing for laying out the interface. Usually we would find ourselves jumping in, sketching out very rough ideas on paper, constructing them in Photoshop, and then iterating through a few different revisions. That can get seriously draining and time consuming. I now know that there is a better way.&lt;/p&gt;
&lt;p&gt;This time we&amp;#8217;re producing the wireframes before even thinking about the site design. Wireframes allow us to quickly come up and play around with possible UI layouts while being free from not having to care about the final design, instead we can focus on achieving the optimum layout of elements for our users.&lt;/p&gt;
&lt;h2&gt;Before you get started&lt;/h2&gt;
&lt;p&gt;It&amp;#8217;s easier to start producing your wireframes if you have an idea of your how your site&amp;#8217;s or app&amp;#8217;s is going to be structured so I&amp;#8217;d advise making a site map before you move into the wireframing otherwise you may end up wasting more time by wireframing things you don&amp;#8217;t need or missing things that you do.&lt;/p&gt;
&lt;h2&gt;Producing Wireframes&lt;/h2&gt;
&lt;p&gt;As with most things there are quite a few ways of generating wireframes. Of course there is the good old pencil and paper but there are some other options which are easier to manipulate, not to mention easier on the environment.&lt;/p&gt;
&lt;h3&gt;&lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; Wireframes&lt;/h3&gt;
&lt;p&gt;Some people suggest using &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; but I belive it takes too much time to produce and can be a lot of hassle. &lt;a href=&quot;http://boagworld.com/usability/quick_and_dirty_wireframes/&quot;&gt;Paul Boag&lt;/a&gt; summed it up nicely:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;#8230;the most common way to build wireframes is using &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;. Of course the downside of this approach is that it can take longer if you are overly precious about your code. Personally, when it comes to wireframes I prefer the quick and dirty approach. I create my &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; wireframes using the &lt;span class=&quot;caps&quot;&gt;WYSIWYG&lt;/span&gt; editor in Dreamweaver, churning out the pages through a mixture of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; and tables. I don&#8217;t care what is going on under the hood. All I care about is that I can get a sense of how the site would work.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Taking this somewhat cavalier attitude to &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; wireframes is not without its drawbacks. Because the underlying code is a mess, ultimately the wireframe has to be thrown away. A better approach would be to use nice clean semantic code which can then be reused for the final build. However, in my experience this rarely works in reality&lt;/p&gt;
&lt;h3&gt;Software for Wireframing&lt;/h3&gt;
&lt;p&gt;So if we&amp;#8217;re not going to use pencils or &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;, what else is there? Welll there are a few pieces for Windows users such as &lt;a href=&quot;http://office.microsoft.com/en-us/visio/default.aspx&quot;&gt;Microsoft Visio&lt;/a&gt; or the full featured &lt;a href=&quot;http://www.axure.com/Default.aspx&quot;&gt;Axure RP&lt;/a&gt;. Both of them looked pretty good to me but I&amp;#8217;m a Mac man so I needed something OS X friendly.&lt;/p&gt;
&lt;p&gt;I finally narrowed my choices down to two products &amp;#8211; the lovely &lt;a href=&quot;http://www.omnigroup.com/applications/OmniGraffle/&quot;&gt;OmniGraffle&lt;/a&gt; and a funky little piece of cross-platform software &amp;#8211; a Mac &lt;strong&gt;and&lt;/strong&gt; Windows friendly app called &lt;a href=&quot;http://www.balsamiq.com/products/mockups&quot;&gt;Balsamiq Mockups&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I already use &lt;a href=&quot;http://www.omnigroup.com/applications/OmniGraffle/&quot;&gt;OmniGraffle&lt;/a&gt; for quite a lot things like producing site maps, database schemas and domain models and there are quite a lot of &lt;a href=&quot;http://graffletopia.com/categories/user-interface&quot;&gt;UI stencils available to download for free&lt;/a&gt; but after taking a look at &lt;a href=&quot;http://www.balsamiq.com/products/mockups&quot;&gt;Balsamiq Mockups&lt;/a&gt; I was hooked. Unlike OmniGraffle it&amp;#8217;s made for one thing and one thing only &amp;#8211; wireframing. Mockups gives you exactly what you want to create wireframes including possibly every UI element you can think of (I havent found any missing yet) and a nice sketchy feel which stops you from thinking about design and allows you to focus solely on laying out the UI.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://seventytwo.co.uk/assets/0000/0008/balsamiq-mockups.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Life with wireframes&lt;/h2&gt;
&lt;p&gt;Hopefully this post will make those of you who aren&amp;#8217;t wireframing consider using them in the future. We&amp;#8217;ve found them to a very useful step in the development process and we&amp;#8217;ll definitely be continuing to use them in all our future projects.&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-10-22T11:08:17+01:00</created-at>
    <excerpt>Having recently discovered the joy of using wireframes for web development I thought it would be nice to write a little post about them and how you can make use of them in your development process.</excerpt>
    <excerpt-html>&lt;p&gt;Having recently discovered the joy of using wireframes for web development I thought it would be nice to write a little post about them and how you can make use of them in your development process.&lt;/p&gt;</excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">20</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-10-31T06:15:00+00:00</published-on>
    <title>Working with Wireframes for the Web</title>
    <updated-at type="datetime">2008-10-31T06:15:47+00:00</updated-at>
  </post>
  <post>
    <author-id type="integer">2</author-id>
    <body>We're on the roll again, heading back to Brighton for a few days later this week. Next year Alistair and I will be moving to Brighton so that we can work on our devious plans more efficiently and set up Makito Labs HQ, so we're taking this trip to check out more of what Brighton has to offer and figure out boring things like how much moolah we're going to be taxed for renting office space.

We'll be in Brighton from Thursday 30th October until Saturday 1st November, so if you're a Brighton local and fancy joining us for a pint or two then please &quot;give one of us a shout&quot;:http://seventytwo.co.uk/authors or drop us a direct message on &quot;Twitter&quot;:http://twitter.com/makitolabs. We'll be heading out on Thursday evening for drinks, so if you're able to drop by and fill us in on the best and worst that Brighton has to offer, you're more than welcome to a pint on us!</body>
    <body-html>&lt;p&gt;We&amp;#8217;re on the roll again, heading back to Brighton for a few days later this week. Next year Alistair and I will be moving to Brighton so that we can work on our devious plans more efficiently and set up Makito Labs HQ, so we&amp;#8217;re taking this trip to check out more of what Brighton has to offer and figure out boring things like how much moolah we&amp;#8217;re going to be taxed for renting office space.&lt;/p&gt;
&lt;p&gt;We&amp;#8217;ll be in Brighton from Thursday 30th October until Saturday 1st November, so if you&amp;#8217;re a Brighton local and fancy joining us for a pint or two then please &lt;a href=&quot;http://seventytwo.co.uk/authors&quot;&gt;give one of us a shout&lt;/a&gt; or drop us a direct message on &lt;a href=&quot;http://twitter.com/makitolabs&quot;&gt;Twitter&lt;/a&gt;. We&amp;#8217;ll be heading out on Thursday evening for drinks, so if you&amp;#8217;re able to drop by and fill us in on the best and worst that Brighton has to offer, you&amp;#8217;re more than welcome to a pint on us!&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-10-27T15:28:18+00:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">22</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-10-28T07:25:00+00:00</published-on>
    <title>Brighton Ahoy!</title>
    <updated-at type="datetime">2008-10-28T10:09:30+00:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>We recently had to install beanstalkd the messaging queue system from Philotic, Inc on our development machines. MacPorts didn't work so we decided to build it ourselves but any guides for installing on OS X are pretty thin on the ground so I thought I'd share what we had to do.

# You need libevent installed for beanstalkd to work so download latest stable release of libevent from &quot;their site&quot;:http://monkey.org/~provos/libevent/.
# Unzip and &lt;code&gt;cd&lt;/code&gt; into the libevent directory
# Run &lt;code&gt;./configure &amp;&amp; make&lt;/code&gt;
# Run &lt;code&gt;sudo make install&lt;/code&gt;
# Download latest stable release of beanstalkd from &quot;their site&quot;:http://xph.us/software/beanstalkd/download.html
# Unzip and &lt;code&gt;cd&lt;/code&gt; into the beanstalkd directory
# Open the Makefile in your favourite text editor and remove &lt;code&gt;-Wall&lt;/code&gt; from &lt;code&gt;CFLAGS&lt;/code&gt;. It causes some warnings when building in OS X for some reason. Save it.
# Run &lt;code&gt;make&lt;/code&gt;
# Now we just need to move the beanstalkd executable. Run &lt;code&gt;sudo mv beanstalkd /usr/local/bin/&lt;/code&gt;

You should now be able to start the beanstalkd server. Open a new console and type &lt;code&gt;beanstalkd&lt;/code&gt;. You should see something like:

&lt;pre&gt;
% beanstalkd
beanstalkd: net.c:90 in unbrake: releasing the brakes
&lt;/pre&gt;

Happy beanstalkd-ing!</body>
    <body-html>&lt;p&gt;We recently had to install beanstalkd the messaging queue system from Philotic, Inc on our development machines. MacPorts didn&amp;#8217;t work so we decided to build it ourselves but any guides for installing on OS X are pretty thin on the ground so I thought I&amp;#8217;d share what we had to do.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;You need libevent installed for beanstalkd to work so download latest stable release of libevent from &lt;a href=&quot;http://monkey.org/~provos/libevent/&quot;&gt;their site&lt;/a&gt;.&lt;/li&gt;
	&lt;li&gt;Unzip and &lt;code&gt;cd&lt;/code&gt; into the libevent directory&lt;/li&gt;
	&lt;li&gt;Run &lt;code&gt;./configure &amp;amp;&amp;amp; make&lt;/code&gt;&lt;/li&gt;
	&lt;li&gt;Run &lt;code&gt;sudo make install&lt;/code&gt;&lt;/li&gt;
	&lt;li&gt;Download latest stable release of beanstalkd from &lt;a href=&quot;http://xph.us/software/beanstalkd/download.html&quot;&gt;their site&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Unzip and &lt;code&gt;cd&lt;/code&gt; into the beanstalkd directory&lt;/li&gt;
	&lt;li&gt;Open the Makefile in your favourite text editor and remove &lt;code&gt;-Wall&lt;/code&gt; from &lt;code&gt;CFLAGS&lt;/code&gt;. It causes some warnings when building in OS X for some reason. Save it.&lt;/li&gt;
	&lt;li&gt;Run &lt;code&gt;make&lt;/code&gt;&lt;/li&gt;
	&lt;li&gt;Now we just need to move the beanstalkd executable. Run &lt;code&gt;sudo mv beanstalkd /usr/local/bin/&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You should now be able to start the beanstalkd server. Open a new console and type &lt;code&gt;beanstalkd&lt;/code&gt;. You should see something like:&lt;/p&gt;
&lt;pre&gt;
% beanstalkd
beanstalkd: net.c:90 in unbrake: releasing the brakes
&lt;/pre&gt;
&lt;p&gt;Happy beanstalkd-ing!&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-10-25T08:54:26+01:00</created-at>
    <excerpt>We recently had to install beanstalkd the messaging queue system from Philotic, Inc on our development machines. MacPorts didn't work so we decided to build it ourselves but any guides for installing on OS X are pretty thin on the ground so I thought I'd share what we had to do.</excerpt>
    <excerpt-html>&lt;p&gt;We recently had to install beanstalkd the messaging queue system from Philotic, Inc on our development machines. MacPorts didn&amp;#8217;t work so we decided to build it ourselves but any guides for installing on OS X are pretty thin on the ground so I thought I&amp;#8217;d share what we had to do.&lt;/p&gt;</excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">21</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-10-25T08:35:00+01:00</published-on>
    <title>Installing beanstalkd on Mac OS X 10.5 (Leopard)</title>
    <updated-at type="datetime">2008-10-25T08:54:49+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>!http://seventytwo.co.uk/assets/0000/0006/happeningapp.jpg!

If you're wondering why It's been a little quiet around here for a few weeks, its because Simon and I have been working flat out on our first big web app, &quot;Happeningapp&quot;:http://happeningapp.com/, for our newly found company, &quot;Makito Labs&quot;:http://makitolabs.com/.

The site went up yesterday and we're now accepting beta signups!

bq. Happeningapp is the missing glue between you and all those lovely websites you&#8217;ve developed. Whether you need to know a little more about what&#8217;s going or prevent something catastrophic that&#8217;s waiting in the wings to trample all over your chi, we&#8217;re sure that Happeningapp is the answer.</body>
    <body-html>&lt;p&gt;&lt;img src=&quot;http://seventytwo.co.uk/assets/0000/0006/happeningapp.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;If you&amp;#8217;re wondering why It&amp;#8217;s been a little quiet around here for a few weeks, its because Simon and I have been working flat out on our first big web app, &lt;a href=&quot;http://happeningapp.com/&quot;&gt;Happeningapp&lt;/a&gt;, for our newly found company, &lt;a href=&quot;http://makitolabs.com/&quot;&gt;Makito Labs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The site went up yesterday and we&amp;#8217;re now accepting beta signups!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Happeningapp is the missing glue between you and all those lovely websites you&#8217;ve developed. Whether you need to know a little more about what&#8217;s going or prevent something catastrophic that&#8217;s waiting in the wings to trample all over your chi, we&#8217;re sure that Happeningapp is the answer.&lt;/p&gt;
&lt;/blockquote&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-10-17T03:33:35+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">19</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-10-17T03:17:00+01:00</published-on>
    <title>Happeningapp is accepting beta signups!</title>
    <updated-at type="datetime">2008-10-17T03:45:15+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>Just a quick note to tell everyone that we've changed the way our comments system works. It previously required you to create a user account before being able to post a comment and featured nice things like threaded comments. After a brief discussion we decided that the user accounts feature was probably inhibiting user participation and that we didn't really need threaded comments right now - so *bang* its gone!. Now there's no excuse for not participating. ;)</body>
    <body-html>&lt;p&gt;Just a quick note to tell everyone that we&amp;#8217;ve changed the way our comments system works. It previously required you to create a user account before being able to post a comment and featured nice things like threaded comments. After a brief discussion we decided that the user accounts feature was probably inhibiting user participation and that we didn&amp;#8217;t really need threaded comments right now &amp;#8211; so &lt;strong&gt;bang&lt;/strong&gt; its gone!. Now there&amp;#8217;s no excuse for not participating. ;)&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-09-15T11:01:04+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">18</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-09-15T10:53:00+01:00</published-on>
    <title>Note: We have a new comments system</title>
    <updated-at type="datetime">2008-09-15T11:01:04+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">2</author-id>
    <body>Alistair and I are both major fanboys of &quot;TextMate&quot;:http://macromates.com/ and espouse its use wherever possible. We thought it would be nice to share some of the TextMate bundles and plugins that keep us coding with optimum efficiency, so without further ado...

* &quot;TextMate Official SVN Repository&quot;:http://wiki.macromates.com/Main/SubversionCheckout - What it says on the tin!
* &quot;GetBundle&quot;:http://projects.validcode.net/getbundle - A really handy tool for downloading and updating bundles.

h2. Bundles

* &quot;Minimal Design's Textmate HTML Bundle&quot;:http://minimaldesign.net/downloads/tools/textmate-html-bundle -  This is a really great bundle which saves a lot of time and typing when working with (X)HTML. Stuffed full of tab triggers.
* &quot;Minimal Design's Textmate CSS Bundle&quot;:http://minimaldesign.net/downloads/tools/textmate-css-bundle - The brother to the above HTML bundle from Minimal Design. Equally useful for working with CSS.
* &quot;JavaScript Tools (Lint Checker and Compressor)&quot;:http://bundleforge.com/ - A fantastic JavaScript Lint Checker and compressor that will save you so much debugging pain it's unreal. Taste and see!
* &quot;jQuery&quot;:http://www.learningjquery.com/2006/09/textmate-bundle-for-jquery - A nice little plugin for our favourite JavaScript library. Plenty of tab triggers, genius.

h2. Plugins

* &quot;ProjectPlus&quot;:http://ciaranwal.sh/2008/08/29/projectplus-update-2 - An invaluable plugin for any TextMate developer. Includes SCM status badges (SVN and Git), the missing drawer and lots of other little tweaks for keeping your project organised.
* &quot;XMLMate&quot;:http://ditchnet.org/xmlmate/ - Checks XML and XHTML documents for Well-Formedness and Validity whilst editing them in TextMate. Very handy indeed.
* &quot;XSLMate&quot;:http://www.ditchnet.org/xslmate/ - Turns TextMate into a nice XSTL/XQuery editor/debugger.

Well, that's your lot for now! Hopefully there's some gems in there that will enhance your jedi coding skills, or at the very least make you go &quot;daaaaaaamn, that's cool!&quot;. Enjoy!</body>
    <body-html>&lt;p&gt;Alistair and I are both major fanboys of &lt;a href=&quot;http://macromates.com/&quot;&gt;TextMate&lt;/a&gt; and espouse its use wherever possible. We thought it would be nice to share some of the TextMate bundles and plugins that keep us coding with optimum efficiency, so without further ado&amp;#8230;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://wiki.macromates.com/Main/SubversionCheckout&quot;&gt;TextMate Official &lt;span class=&quot;caps&quot;&gt;SVN&lt;/span&gt; Repository&lt;/a&gt; &amp;#8211; What it says on the tin!&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://projects.validcode.net/getbundle&quot;&gt;GetBundle&lt;/a&gt; &amp;#8211; A really handy tool for downloading and updating bundles.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Bundles&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://minimaldesign.net/downloads/tools/textmate-html-bundle&quot;&gt;Minimal Design&amp;#8217;s Textmate &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; Bundle&lt;/a&gt; &amp;#8211;  This is a really great bundle which saves a lot of time and typing when working with (X)HTML. Stuffed full of tab triggers.&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://minimaldesign.net/downloads/tools/textmate-css-bundle&quot;&gt;Minimal Design&amp;#8217;s Textmate &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Bundle&lt;/a&gt; &amp;#8211; The brother to the above &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; bundle from Minimal Design. Equally useful for working with &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;.&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://bundleforge.com/&quot; title=&quot;Lint Checker and Compressor&quot;&gt;JavaScript Tools&lt;/a&gt; &amp;#8211; A fantastic JavaScript Lint Checker and compressor that will save you so much debugging pain it&amp;#8217;s unreal. Taste and see!&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.learningjquery.com/2006/09/textmate-bundle-for-jquery&quot;&gt;jQuery&lt;/a&gt; &amp;#8211; A nice little plugin for our favourite JavaScript library. Plenty of tab triggers, genius.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Plugins&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://ciaranwal.sh/2008/08/29/projectplus-update-2&quot;&gt;ProjectPlus&lt;/a&gt; &amp;#8211; An invaluable plugin for any TextMate developer. Includes &lt;span class=&quot;caps&quot;&gt;SCM&lt;/span&gt; status badges (&lt;span class=&quot;caps&quot;&gt;SVN&lt;/span&gt; and Git), the missing drawer and lots of other little tweaks for keeping your project organised.&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://ditchnet.org/xmlmate/&quot;&gt;XMLMate&lt;/a&gt; &amp;#8211; Checks &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;XHTML&lt;/span&gt; documents for Well-Formedness and Validity whilst editing them in TextMate. Very handy indeed.&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.ditchnet.org/xslmate/&quot;&gt;XSLMate&lt;/a&gt; &amp;#8211; Turns TextMate into a nice &lt;span class=&quot;caps&quot;&gt;XSTL&lt;/span&gt;/XQuery editor/debugger.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Well, that&amp;#8217;s your lot for now! Hopefully there&amp;#8217;s some gems in there that will enhance your jedi coding skills, or at the very least make you go &amp;#8220;daaaaaaamn, that&amp;#8217;s cool!&amp;#8221;. Enjoy!&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-08-09T17:08:23+01:00</created-at>
    <excerpt>Alistair and I are both major fanboys of &quot;TextMate&quot;:http://macromates.com/ and espouse its use wherever possible. We thought it would be nice to share some of the TextMate bundles and plugins that keep us coding with optimum efficiency, so without further ado...</excerpt>
    <excerpt-html>&lt;p&gt;Alistair and I are both major fanboys of &lt;a href=&quot;http://macromates.com/&quot;&gt;TextMate&lt;/a&gt; and espouse its use wherever possible. We thought it would be nice to share some of the TextMate bundles and plugins that keep us coding with optimum efficiency, so without further ado&amp;#8230;&lt;/p&gt;</excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">13</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-09-12T03:50:00+01:00</published-on>
    <title>TextMate Plugins and Bundles Goodness</title>
    <updated-at type="datetime">2008-09-15T08:15:11+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">2</author-id>
    <body>I'm still recovering from the fantastic &quot;dConstruct&quot;:http://2008.dconstruct.org/ conference, but already rared up for BathCamp this coming Saturday. I'll be doing a wee talk on how we built &quot;PingMyMap&quot;:http://pingmymap.com/ in five days, and the trials and tribulations we encountered on the way.

You will likely be able to locate me hovering around any beer/food related areas, so please come over and say hi. I'll even give you a 72 sticker for your troubles.

See you there!</body>
    <body-html>&lt;p&gt;I&amp;#8217;m still recovering from the fantastic &lt;a href=&quot;http://2008.dconstruct.org/&quot;&gt;dConstruct&lt;/a&gt; conference, but already rared up for BathCamp this coming Saturday. I&amp;#8217;ll be doing a wee talk on how we built &lt;a href=&quot;http://pingmymap.com/&quot;&gt;PingMyMap&lt;/a&gt; in five days, and the trials and tribulations we encountered on the way.&lt;/p&gt;
&lt;p&gt;You will likely be able to locate me hovering around any beer/food related areas, so please come over and say hi. I&amp;#8217;ll even give you a 72 sticker for your troubles.&lt;/p&gt;
&lt;p&gt;See you there!&lt;/p&gt;</body-html>
    <commentable type="boolean">false</commentable>
    <created-at type="datetime">2008-09-08T04:08:17+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">17</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-09-08T04:05:00+01:00</published-on>
    <title>Another week, another geek fest</title>
    <updated-at type="datetime">2008-09-08T04:08:17+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>!http://farm4.static.flickr.com/3036/2832804602_dd15cc3b1f.jpg!

We're back from the mighty dConstruct 08 in Brighton! There were some fantastic talks, my personal favourites being 'Designing for the Coral Reef' from Matt Biddulph and Matt Jones of &quot;Dopplr&quot;:http://www.dopplr.com/ fame (really funny guys) and &quot;Jeremy Keith's&quot;:http://adactio.com/ epic 'The System of the World' which was rather mind expanding indeed.

We met some really nice people, had some fun with our stickering antics (if you found the 72 stickered banana I hope it was tasty) and we really enjoyed the after party even if it was a bit of a squeeze.

Hopefully we'll see some of you again soon. If you want to follow us on twitter (who doesn't like following new people) you catch me at &quot;twitter.com/alistairholt&quot;:http://twitter.com/alistairholt and Simon is at &quot;twitter.com/allidid&quot;:http://twitter.com/allidid</body>
    <body-html>&lt;p&gt;&lt;img src=&quot;http://farm4.static.flickr.com/3036/2832804602_dd15cc3b1f.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;We&amp;#8217;re back from the mighty dConstruct 08 in Brighton! There were some fantastic talks, my personal favourites being &amp;#8216;Designing for the Coral Reef&amp;#8217; from Matt Biddulph and Matt Jones of &lt;a href=&quot;http://www.dopplr.com/&quot;&gt;Dopplr&lt;/a&gt; fame (really funny guys) and &lt;a href=&quot;http://adactio.com/&quot;&gt;Jeremy Keith&amp;#8217;s&lt;/a&gt; epic &amp;#8216;The System of the World&amp;#8217; which was rather mind expanding indeed.&lt;/p&gt;
&lt;p&gt;We met some really nice people, had some fun with our stickering antics (if you found the 72 stickered banana I hope it was tasty) and we really enjoyed the after party even if it was a bit of a squeeze.&lt;/p&gt;
&lt;p&gt;Hopefully we&amp;#8217;ll see some of you again soon. If you want to follow us on twitter (who doesn&amp;#8217;t like following new people) you catch me at &lt;a href=&quot;http://twitter.com/alistairholt&quot;&gt;twitter.com/alistairholt&lt;/a&gt; and Simon is at &lt;a href=&quot;http://twitter.com/allidid&quot;&gt;twitter.com/allidid&lt;/a&gt;&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-09-06T09:47:44+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">16</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-09-08T02:30:00+01:00</published-on>
    <title>Back from dConstruct08</title>
    <updated-at type="datetime">2008-09-08T03:45:19+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">2</author-id>
    <body>Recently I've decided that I really need to get some kind of solid database schema versioning system in place for my PHP apps. &quot;Rails&quot;:http://rubyonrails.org/ has its lovely &quot;migrations&quot;:http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations system, but sadly there's no equivalent functionality built into the PHP &quot;Zend_Db&quot;:http://framework.zend.com/manual/en/zend.db.html component at the moment. This is probably due to the fact that &quot;Zend Framework&quot;:http://framework.zend.com/ is a decoupled framework, instead of being a full stack like Rails, so migrations may well never see the light of day.

In my quest for a good PHP solution, I came across &quot;Doctrine&quot;:http://www.phpdoctrine.org/. It's an open source PHP ORM (Object Relational Mapper) and DBAL (Database Abstraction Layer), so they tell me, but the part that interests me the most is the migrations. These are scripted in a very similar way to Rails migrations, with up and down methods to facilitate the creation/removal of tables, indexes and fields, and postUp and postDown methods to insert/delete data.

I'll need to learn Doctrine's API fully before I can integrate it seamlessly into my apps, but being impatient as I am, I haven't done that yet. Instead I've hacked together a quick and dirty solution that uses &quot;Subversion&quot;:http://subversion.tigris.org/ and &quot;Bash&quot;:http://www.gnu.org/software/bash/ scripting for the legwork. I thought I'd share it here as it may well be handy for other developers in need of a quick solution.

So, we'll assume that the following code is a part of a Bash script that you have on your server to deploy new releases...

&lt;notextile&gt;&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_shell&quot;&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell&quot;&gt;#&lt;/span&gt; Run the latest database migration if it exists
  &lt;/span&gt;db_migrations=&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;./working-copy/trunk/migrations&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  db_migration_latest=&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migrations&lt;/span&gt;/latest.sql&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_shell&quot;&gt;if&lt;/span&gt; [ -e &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migration_latest&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; ]
  &lt;span class=&quot;keyword keyword_control keyword_control_shell&quot;&gt;then&lt;/span&gt;
    current_date=&lt;span class=&quot;string string_interpolated string_interpolated_backtick string_interpolated_backtick_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;`&lt;/span&gt;date +%Y-%m-%d_%H-%M-%S&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;`&lt;/span&gt;&lt;/span&gt;
    new_filename=&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;migration_&lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;current_date&lt;/span&gt;.sql&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
    mysql -uYOURMYSQLUSER -hlocalhost -pYOURMYSQLPASSWORD YOURDATABASENAME &lt;span class=&quot;keyword keyword_operator keyword_operator_redirect keyword_operator_redirect_shell&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migration_latest&lt;/span&gt;
    svn mv &lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migration_latest&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migrations&lt;/span&gt;/&lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;new_filename&lt;/span&gt;
    svn commit -m &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;DEPLOY - Ran latest database migration and saved for reference as &lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;new_filename&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_shell&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/notextile&gt;

A nice simple way of doing releases is to have a working copy of your Subversion repository checked out on the live server (&lt;code&gt;svn checkout&lt;/code&gt;). When you want to deploy a new release, all you have to do is run &lt;code&gt;svn update&lt;/code&gt; (you can of course use &lt;code&gt;svn export&lt;/code&gt; if you wish to export a clean, full release of your app without the &lt;code&gt;.svn&lt;/code&gt; meta-data). In the trunk of your repository you could set it up to have two directories: &lt;code&gt;application&lt;/code&gt; and &lt;code&gt;migrations&lt;/code&gt;. The &lt;code&gt;application&lt;/code&gt; directory would contain your application (website or blog etc.). To add a migration to be applied when you next deploy to the live server, just create a file in &lt;code&gt;migrations&lt;/code&gt; called &lt;code&gt;latest.sql&lt;/code&gt;. As you change the database schema for new features to be deployed in the next release, you can log the SQL you've run to make development database changes in &lt;code&gt;latest.sql&lt;/code&gt;. Commit the &lt;code&gt;latest.sql&lt;/code&gt; file along with all your other code, then when you deploy the latest release to your live server with the Bash script, it will check to see if &lt;code&gt;latest.sql&lt;/code&gt; exists, import it into MySQL if it does, rename &lt;code&gt;latest.sql&lt;/code&gt; with the current date and time, and then commit it back to the Subversion repository for archival purposes.

I like this solution as it piggybacks on a version control system (Subversion in this case) and uses raw SQL, removing the need to write custom migration scripts. It's also language agnostic - always a bonus. The example I've given is pretty basic, but it could easily be expanded to support reverting to previous migrations if you also log SQL to revert database changes.

Go forth and migrate!</body>
    <body-html>&lt;p&gt;Recently I&amp;#8217;ve decided that I really need to get some kind of solid database schema versioning system in place for my &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; apps. &lt;a href=&quot;http://rubyonrails.org/&quot;&gt;Rails&lt;/a&gt; has its lovely &lt;a href=&quot;http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations&quot;&gt;migrations&lt;/a&gt; system, but sadly there&amp;#8217;s no equivalent functionality built into the &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; &lt;a href=&quot;http://framework.zend.com/manual/en/zend.db.html&quot;&gt;Zend_Db&lt;/a&gt; component at the moment. This is probably due to the fact that &lt;a href=&quot;http://framework.zend.com/&quot;&gt;Zend Framework&lt;/a&gt; is a decoupled framework, instead of being a full stack like Rails, so migrations may well never see the light of day.&lt;/p&gt;
&lt;p&gt;In my quest for a good &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; solution, I came across &lt;a href=&quot;http://www.phpdoctrine.org/&quot;&gt;Doctrine&lt;/a&gt;. It&amp;#8217;s an open source &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;ORM&lt;/span&gt; (Object Relational Mapper) and &lt;span class=&quot;caps&quot;&gt;DBAL&lt;/span&gt; (Database Abstraction Layer), so they tell me, but the part that interests me the most is the migrations. These are scripted in a very similar way to Rails migrations, with up and down methods to facilitate the creation/removal of tables, indexes and fields, and postUp and postDown methods to insert/delete data.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ll need to learn Doctrine&amp;#8217;s &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; fully before I can integrate it seamlessly into my apps, but being impatient as I am, I haven&amp;#8217;t done that yet. Instead I&amp;#8217;ve hacked together a quick and dirty solution that uses &lt;a href=&quot;http://subversion.tigris.org/&quot;&gt;Subversion&lt;/a&gt; and &lt;a href=&quot;http://www.gnu.org/software/bash/&quot;&gt;Bash&lt;/a&gt; scripting for the legwork. I thought I&amp;#8217;d share it here as it may well be handy for other developers in need of a quick solution.&lt;/p&gt;
&lt;p&gt;So, we&amp;#8217;ll assume that the following code is a part of a Bash script that you have on your server to deploy new releases&amp;#8230;&lt;/p&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_shell&quot;&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_shell&quot;&gt;#&lt;/span&gt; Run the latest database migration if it exists
  &lt;/span&gt;db_migrations=&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;./working-copy/trunk/migrations&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  db_migration_latest=&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migrations&lt;/span&gt;/latest.sql&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_shell&quot;&gt;if&lt;/span&gt; [ -e &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migration_latest&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; ]
  &lt;span class=&quot;keyword keyword_control keyword_control_shell&quot;&gt;then&lt;/span&gt;
    current_date=&lt;span class=&quot;string string_interpolated string_interpolated_backtick string_interpolated_backtick_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;`&lt;/span&gt;date +%Y-%m-%d_%H-%M-%S&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;`&lt;/span&gt;&lt;/span&gt;
    new_filename=&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;migration_&lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;current_date&lt;/span&gt;.sql&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
    mysql -uYOURMYSQLUSER -hlocalhost -pYOURMYSQLPASSWORD YOURDATABASENAME &lt;span class=&quot;keyword keyword_operator keyword_operator_redirect keyword_operator_redirect_shell&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migration_latest&lt;/span&gt;
    svn mv &lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migration_latest&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;db_migrations&lt;/span&gt;/&lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;new_filename&lt;/span&gt;
    svn commit -m &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_shell&quot;&gt;&quot;&lt;/span&gt;DEPLOY - Ran latest database migration and saved for reference as &lt;span class=&quot;variable variable_other variable_other_normal variable_other_normal_shell&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_shell&quot;&gt;$&lt;/span&gt;new_filename&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_shell&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_shell&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;A nice simple way of doing releases is to have a working copy of your Subversion repository checked out on the live server (&lt;code&gt;svn checkout&lt;/code&gt;). When you want to deploy a new release, all you have to do is run &lt;code&gt;svn update&lt;/code&gt; (you can of course use &lt;code&gt;svn export&lt;/code&gt; if you wish to export a clean, full release of your app without the &lt;code&gt;.svn&lt;/code&gt; meta-data). In the trunk of your repository you could set it up to have two directories: &lt;code&gt;application&lt;/code&gt; and &lt;code&gt;migrations&lt;/code&gt;. The &lt;code&gt;application&lt;/code&gt; directory would contain your application (website or blog etc.). To add a migration to be applied when you next deploy to the live server, just create a file in &lt;code&gt;migrations&lt;/code&gt; called &lt;code&gt;latest.sql&lt;/code&gt;. As you change the database schema for new features to be deployed in the next release, you can log the &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; you&amp;#8217;ve run to make development database changes in &lt;code&gt;latest.sql&lt;/code&gt;. Commit the &lt;code&gt;latest.sql&lt;/code&gt; file along with all your other code, then when you deploy the latest release to your live server with the Bash script, it will check to see if &lt;code&gt;latest.sql&lt;/code&gt; exists, import it into MySQL if it does, rename &lt;code&gt;latest.sql&lt;/code&gt; with the current date and time, and then commit it back to the Subversion repository for archival purposes.&lt;/p&gt;
&lt;p&gt;I like this solution as it piggybacks on a version control system (Subversion in this case) and uses raw &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt;, removing the need to write custom migration scripts. It&amp;#8217;s also language agnostic &amp;#8211; always a bonus. The example I&amp;#8217;ve given is pretty basic, but it could easily be expanded to support reverting to previous migrations if you also log &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; to revert database changes.&lt;/p&gt;
&lt;p&gt;Go forth and migrate!&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-08-12T14:38:03+01:00</created-at>
    <excerpt>Recently I've decided that I really need to get some kind of solid database schema versioning system in place for my PHP apps. &quot;Rails&quot;:http://rubyonrails.org/ has its lovely &quot;migrations&quot;:http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations system, but sadly there's no equivalent functionality built into the PHP &quot;Zend_Db&quot;:http://framework.zend.com/manual/en/zend.db.html component at the moment. This is probably due to the fact that &quot;Zend Framework&quot;:http://framework.zend.com/ is a decoupled framework, instead of being a full stack like Rails, so migrations may well never see the light of day. I'm taking matters into my own hands...</excerpt>
    <excerpt-html>&lt;p&gt;Recently I&amp;#8217;ve decided that I really need to get some kind of solid database schema versioning system in place for my &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; apps. &lt;a href=&quot;http://rubyonrails.org/&quot;&gt;Rails&lt;/a&gt; has its lovely &lt;a href=&quot;http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations&quot;&gt;migrations&lt;/a&gt; system, but sadly there&amp;#8217;s no equivalent functionality built into the &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; &lt;a href=&quot;http://framework.zend.com/manual/en/zend.db.html&quot;&gt;Zend_Db&lt;/a&gt; component at the moment. This is probably due to the fact that &lt;a href=&quot;http://framework.zend.com/&quot;&gt;Zend Framework&lt;/a&gt; is a decoupled framework, instead of being a full stack like Rails, so migrations may well never see the light of day. I&amp;#8217;m taking matters into my own hands&amp;#8230;&lt;/p&gt;</excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">15</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-08-13T14:29:00+01:00</published-on>
    <title>Super Simple Database Migrations with Subversion and Bash Scripting</title>
    <updated-at type="datetime">2008-08-14T09:45:32+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">2</author-id>
    <body>Sitting here relaxing on a grey Sunday afternoon, it's been to nice to reflect on how far things have come with Seventytwo in just a few weeks. Our articles have been featured by the &quot;Rails Envy Podcast&quot;:http://railsenvy.com/podcast, we've launched our &quot;first mini web app&quot;:http://seventytwo.co.uk/posts/pingmymap-launched and there's plenty more in the pipeline.

You may have noticed that we rolled out a new discussion feature at the end of last week, courtesy of Alistair's Rails Skillz (TM). Check it out, and of course, don't forget to join in the discussion!

PingMyMap's just received a bunch of updates. Most of them are under the hood, but one bit of eye candy we've added is screenshots of the sites that you've added under 'My Sites'. With our love of openness, we're also planning to add &quot;OpenID&quot;:http://openid.net/ support soon.

To whet your appetite, here are some of the other things we'll be serving up in the coming weeks...

* Article: TextMate Plugins and Bundles Goodness
* Article: How A One Day Web App Hack Became Five (Lessons Learnt Developing PingMyMap)
* Article: Zend Framework Form Decorators (Lessons Learnt Developing PingMyMap)
* Article:  Zend Framework Caching Configuration Files (Lessons Learnt Developing PingMyMap)
* Article:  Best Practices Breed Passion
* Project: Zend Framework Classes
* Project: TargetOrder jQuery Plugin (a remake of &quot;this script&quot;:http://dancinginquicksand.com/targetorder/)
* Project: Another Web App!</body>
    <body-html>&lt;p&gt;Sitting here relaxing on a grey Sunday afternoon, it&amp;#8217;s been to nice to reflect on how far things have come with Seventytwo in just a few weeks. Our articles have been featured by the &lt;a href=&quot;http://railsenvy.com/podcast&quot;&gt;Rails Envy Podcast&lt;/a&gt;, we&amp;#8217;ve launched our &lt;a href=&quot;http://seventytwo.co.uk/posts/pingmymap-launched&quot;&gt;first mini web app&lt;/a&gt; and there&amp;#8217;s plenty more in the pipeline.&lt;/p&gt;
&lt;p&gt;You may have noticed that we rolled out a new discussion feature at the end of last week, courtesy of Alistair&amp;#8217;s Rails Skillz&amp;#8482;. Check it out, and of course, don&amp;#8217;t forget to join in the discussion!&lt;/p&gt;
&lt;p&gt;PingMyMap&amp;#8217;s just received a bunch of updates. Most of them are under the hood, but one bit of eye candy we&amp;#8217;ve added is screenshots of the sites that you&amp;#8217;ve added under &amp;#8216;My Sites&amp;#8217;. With our love of openness, we&amp;#8217;re also planning to add &lt;a href=&quot;http://openid.net/&quot;&gt;OpenID&lt;/a&gt; support soon.&lt;/p&gt;
&lt;p&gt;To whet your appetite, here are some of the other things we&amp;#8217;ll be serving up in the coming weeks&amp;#8230;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Article: TextMate Plugins and Bundles Goodness&lt;/li&gt;
	&lt;li&gt;Article: How A One Day Web App Hack Became Five (Lessons Learnt Developing PingMyMap)&lt;/li&gt;
	&lt;li&gt;Article: Zend Framework Form Decorators (Lessons Learnt Developing PingMyMap)&lt;/li&gt;
	&lt;li&gt;Article:  Zend Framework Caching Configuration Files (Lessons Learnt Developing PingMyMap)&lt;/li&gt;
	&lt;li&gt;Article:  Best Practices Breed Passion&lt;/li&gt;
	&lt;li&gt;Project: Zend Framework Classes&lt;/li&gt;
	&lt;li&gt;Project: TargetOrder jQuery Plugin (a remake of &lt;a href=&quot;http://dancinginquicksand.com/targetorder/&quot;&gt;this script&lt;/a&gt;)&lt;/li&gt;
	&lt;li&gt;Project: Another Web App!&lt;/li&gt;
&lt;/ul&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-08-10T09:30:46+01:00</created-at>
    <excerpt>Sitting here relaxing on a grey Sunday afternoon, it's been to nice to reflect on how far things have come with Seventytwo in just a few weeks. Our articles have been featured by the &quot;Rails Envy Podcast&quot;:http://railsenvy.com/podcast, we've launched our &quot;first mini web app&quot;:http://seventytwo.co.uk/posts/pingmymap-launched and there's plenty more in the pipeline.</excerpt>
    <excerpt-html>&lt;p&gt;Sitting here relaxing on a grey Sunday afternoon, it&amp;#8217;s been to nice to reflect on how far things have come with Seventytwo in just a few weeks. Our articles have been featured by the &lt;a href=&quot;http://railsenvy.com/podcast&quot;&gt;Rails Envy Podcast&lt;/a&gt;, we&amp;#8217;ve launched our &lt;a href=&quot;http://seventytwo.co.uk/posts/pingmymap-launched&quot;&gt;first mini web app&lt;/a&gt; and there&amp;#8217;s plenty more in the pipeline.&lt;/p&gt;</excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">14</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-08-10T08:56:00+01:00</published-on>
    <title>Blood, Sweat and a Taste of Things to Come</title>
    <updated-at type="datetime">2008-08-12T05:37:47+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>We've had to change our RSS feed URL again, it is now &quot;http://feeds.feedburner.com/seventytwocouk&quot;:http://feeds.feedburner.com/seventytwocouk.</body>
    <body-html>&lt;p&gt;We&amp;#8217;ve had to change our &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; feed &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; again, it is now &lt;a href=&quot;http://feeds.feedburner.com/seventytwocouk&quot;&gt;http://feeds.feedburner.com/seventytwocouk&lt;/a&gt;.&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-08-06T09:56:21+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">12</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-08-06T09:55:00+01:00</published-on>
    <title>New Feed URL.. again</title>
    <updated-at type="datetime">2008-08-06T09:56:33+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">2</author-id>
    <body>!http://seventytwo.co.uk/assets/0000/0001/pingmymap.jpg!

The One Day Web App Hack finished yesterday after 5 days (yes, you read that right!). Much sleep has been lost, many things cursed and possibly a few tears shed to bring you this pingtastic web app! You can check out the fruit of our efforts over at &quot;PingMyMap.com&quot;:http://pingmymap.com.

To get all the details on our API you just can tuck into the &quot;Documentation&quot;:http://pingmymap.com/documentation/, or even better go ahead and &quot;sign up&quot;:http://pingmymap.com/#register (it'll only take you 30 seconds, we promise). We'd love to know what you think, so drop us a message over at &quot;Get Satisfaction&quot;:http://getsatisfaction.com/pingmymap.

Next week we'll be telling the saga of the One &quot;But Really Five&quot; Day Web App Hack, sharing some handy design and development tips that we learnt in the process of building PingMyMap. For now we're going to get going with promoting the site and enjoy a few well deserved beers! Cheers!</body>
    <body-html>&lt;p&gt;&lt;img src=&quot;http://seventytwo.co.uk/assets/0000/0001/pingmymap.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The One Day Web App Hack finished yesterday after 5 days (yes, you read that right!). Much sleep has been lost, many things cursed and possibly a few tears shed to bring you this pingtastic web app! You can check out the fruit of our efforts over at &lt;a href=&quot;http://pingmymap.com&quot;&gt;PingMyMap.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To get all the details on our &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; you just can tuck into the &lt;a href=&quot;http://pingmymap.com/documentation/&quot;&gt;Documentation&lt;/a&gt;, or even better go ahead and &lt;a href=&quot;http://pingmymap.com/#register&quot;&gt;sign up&lt;/a&gt; (it&amp;#8217;ll only take you 30 seconds, we promise). We&amp;#8217;d love to know what you think, so drop us a message over at &lt;a href=&quot;http://getsatisfaction.com/pingmymap&quot;&gt;Get Satisfaction&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Next week we&amp;#8217;ll be telling the saga of the One &amp;#8220;But Really Five&amp;#8221; Day Web App Hack, sharing some handy design and development tips that we learnt in the process of building PingMyMap. For now we&amp;#8217;re going to get going with promoting the site and enjoy a few well deserved beers! Cheers!&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-08-04T08:07:31+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">11</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-08-05T14:51:00+01:00</published-on>
    <title>PingMyMap Launched!</title>
    <updated-at type="datetime">2008-08-06T14:18:02+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>We thought we should let you know where we are up to on our 'One Day Web App Hack' adventure. Simon and I have been working flat out for two days solid, apart from the odd break for food and beverages, and we're probably about 90% there at the time of writing.

Unfortunately we've had a few issues getting the &quot;Zend PHP framework&quot;:http://framework.zend.com/ to do exactly what we want in certain places. This is the first time Simon has really used the framework for a serious project and he's learning as we go, but pretty rapidly I might add. Simon tells me &quot;its beautiful but I'm just stupid&quot;.

Things are going pretty well on my side of the app, the designs are done, builds are almost complete and the UI is looking good. After that, all that remains to be done is some cross-browser testing and implementation of alpha PNG fixes for IE6.

Overall we're really pleased with progress so far and the app is shaping up to be very nice indeed. Stay tuned for more updates soon!</body>
    <body-html>&lt;p&gt;We thought we should let you know where we are up to on our &amp;#8216;One Day Web App Hack&amp;#8217; adventure. Simon and I have been working flat out for two days solid, apart from the odd break for food and beverages, and we&amp;#8217;re probably about 90% there at the time of writing.&lt;/p&gt;
&lt;p&gt;Unfortunately we&amp;#8217;ve had a few issues getting the &lt;a href=&quot;http://framework.zend.com/&quot;&gt;Zend &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; framework&lt;/a&gt; to do exactly what we want in certain places. This is the first time Simon has really used the framework for a serious project and he&amp;#8217;s learning as we go, but pretty rapidly I might add. Simon tells me &amp;#8220;its beautiful but I&amp;#8217;m just stupid&amp;#8221;.&lt;/p&gt;
&lt;p&gt;Things are going pretty well on my side of the app, the designs are done, builds are almost complete and the UI is looking good. After that, all that remains to be done is some cross-browser testing and implementation of alpha &lt;span class=&quot;caps&quot;&gt;PNG&lt;/span&gt; fixes for IE6.&lt;/p&gt;
&lt;p&gt;Overall we&amp;#8217;re really pleased with progress so far and the app is shaping up to be very nice indeed. Stay tuned for more updates soon!&lt;/p&gt;</body-html>
    <commentable type="boolean">false</commentable>
    <created-at type="datetime">2008-07-31T10:38:53+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">10</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-07-31T10:24:00+01:00</published-on>
    <title>Update: One Day Web App Hack</title>
    <updated-at type="datetime">2008-08-06T08:58:05+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">2</author-id>
    <body>Our one day of web app hacking madness has begun! Alistair's in Chester, limbering up to pump out some sexy eye candy and I'm down here in Plymouth, poised to code the heart of the beast that we're naming PingMyMap.com!

You can keep track of the mayhem via our &quot;Twitter feed&quot;:http://twitter.com/onedaywebapp (as long as it doesn't go down...).

Catch you on the flip side!

&lt;notextile&gt;
&lt;div id=&quot;twitter_div&quot;&gt;
&lt;h2 class=&quot;twitter-title&quot;&gt;Twitter Updates&lt;/h2&gt;
&lt;ul id=&quot;twitter_update_list&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://twitter.com/javascripts/blogger.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://twitter.com/statuses/user_timeline/onedaywebapp.json?callback=twitterCallback2&amp;amp;count=10&quot;&gt;&lt;/script&gt;
&lt;/notextile&gt;</body>
    <body-html>&lt;p&gt;Our one day of web app hacking madness has begun! Alistair&amp;#8217;s in Chester, limbering up to pump out some sexy eye candy and I&amp;#8217;m down here in Plymouth, poised to code the heart of the beast that we&amp;#8217;re naming PingMyMap.com!&lt;/p&gt;
&lt;p&gt;You can keep track of the mayhem via our &lt;a href=&quot;http://twitter.com/onedaywebapp&quot;&gt;Twitter feed&lt;/a&gt; (as long as it doesn&amp;#8217;t go down&amp;#8230;).&lt;/p&gt;
&lt;p&gt;Catch you on the flip side!&lt;/p&gt;
&lt;div id=&quot;twitter_div&quot;&gt;
&lt;h2 class=&quot;twitter-title&quot;&gt;Twitter Updates&lt;/h2&gt;
&lt;ul id=&quot;twitter_update_list&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://twitter.com/javascripts/blogger.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://twitter.com/statuses/user_timeline/onedaywebapp.json?callback=twitterCallback2&amp;amp;count=10&quot;&gt;&lt;/script&gt;</body-html>
    <commentable type="boolean">false</commentable>
    <created-at type="datetime">2008-07-30T01:52:03+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">9</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-07-30T01:45:00+01:00</published-on>
    <title>One Day Web App Hack Begins!</title>
    <updated-at type="datetime">2008-08-12T14:54:10+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">2</author-id>
    <body>As a follow up to my article on getting your sites indexed with Sitemaps and search engine pings, we've decided to develop a simple web app that will handle all the pinging for you. The challenge is that we've only got one day to design and develop it in. On Wednesday (30th July), Alistair and myself will be designing, coding and building a pingtastic web app from scratch.

Tune in on Wednesday evening (GMT) to share our triumph (or watch us fall flat on our faces)!</body>
    <body-html>&lt;p&gt;As a follow up to my article on getting your sites indexed with Sitemaps and search engine pings, we&amp;#8217;ve decided to develop a simple web app that will handle all the pinging for you. The challenge is that we&amp;#8217;ve only got one day to design and develop it in. On Wednesday (30th July), Alistair and myself will be designing, coding and building a pingtastic web app from scratch.&lt;/p&gt;
&lt;p&gt;Tune in on Wednesday evening (GMT) to share our triumph (or watch us fall flat on our faces)!&lt;/p&gt;</body-html>
    <commentable type="boolean">false</commentable>
    <created-at type="datetime">2008-07-28T07:41:50+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">8</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-07-28T07:13:00+01:00</published-on>
    <title>Announcement: One Day Web App Hack</title>
    <updated-at type="datetime">2008-08-06T08:58:05+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>Both Simon and I will be attending the &quot;dConstruct 08&quot;:http://2008.dconstruct.org/ web conference on the 5th September in Brighton, UK. Please say hello if you see us there, we're quite friendly.

If you haven't booked your place it looks like there are some &quot;tickets still available&quot;:http://clearleft.eventwax.com/dconstruct-2008/.</body>
    <body-html>&lt;p&gt;Both Simon and I will be attending the &lt;a href=&quot;http://2008.dconstruct.org/&quot;&gt;dConstruct 08&lt;/a&gt; web conference on the 5th September in Brighton, UK. Please say hello if you see us there, we&amp;#8217;re quite friendly.&lt;/p&gt;
&lt;p&gt;If you haven&amp;#8217;t booked your place it looks like there are some &lt;a href=&quot;http://clearleft.eventwax.com/dconstruct-2008/&quot;&gt;tickets still available&lt;/a&gt;.&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-07-26T03:28:46+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">7</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-07-26T03:23:00+01:00</published-on>
    <title>Seventytwo at dConstruct 08</title>
    <updated-at type="datetime">2008-08-06T13:38:17+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>With the site re-launch comes a new feed URL! The old URLs are getting redirected but if you're having any trouble then the new URL to subscribe to is &quot;http://feeds.feedburner.com/seventytwo&quot;:http://feeds.feedburner.com/seventytwo</body>
    <body-html>&lt;p&gt;With the site re-launch comes a new feed &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;! The old URLs are getting redirected but if you&amp;#8217;re having any trouble then the new &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; to subscribe to is &lt;a href=&quot;http://feeds.feedburner.com/seventytwo&quot;&gt;http://feeds.feedburner.com/seventytwo&lt;/a&gt;&lt;/p&gt;</body-html>
    <commentable type="boolean">false</commentable>
    <created-at type="datetime">2008-07-21T10:19:24+01:00</created-at>
    <excerpt></excerpt>
    <excerpt-html></excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">5</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-07-21T10:10:00+01:00</published-on>
    <title>New Feed URL</title>
    <updated-at type="datetime">2008-08-06T08:58:05+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">2</author-id>
    <body>&lt;div class=&quot;note&quot;&gt;
h2. Update

If you don't fancy getting your hands dirty with code or just love automation, then check out the mini web app we launched earlier this week, &quot;PingMyMap&quot;:http://pingmymap.com/. It's a free service for web developers and site admins which allows you to easily notify multiple search engines of updates to your site's Sitemaps. Pingtastic!
&lt;/div&gt;

For various reasons, some sites simply aren't well indexed. Despite having highly relevant content, you just can't get your site to show up in search engine results, or perhaps you have some pages that are unfortunately tucked away.

h2. All Content is Not Created Equal

I personally advocate progressively enhanced, standards-based and accessible content solutions (damn I sound so buzzword!), but it's pretty clear that there's a lot of content out there that just isn't so ready to expose itself to search engine crawlers.

Flash movies are notorious for suffering from indexing issues due to their non-semantic structure (although credit is due to Google, who are &quot;taking action&quot;:http://googlewebmastercentral.blogspot.com/2008/06/improved-flash-indexing.html). Complex JavaScript heavy sites often have many potential pitfalls when it comes to crawlers sussing out the structure and content, such as hash links (e.g. &lt;a href=&quot;#&quot;&gt;Save&lt;/a&gt;) and content that is dynamically loaded via AJAX requests.

Even if your content is on the most accessible, standards compliant site in the whole of the web, there's a fantastic tool that will give you indexing bliss, no matter how your site is structured.

h2. Google et Al To The Rescue

Google Sitemaps will be familiar to a lot of web developers as a mechanism to make Google aware of pages and content on your site. What many people still don't know, is that several other web giants support XML Sitemaps as a standard: Yahoo!, Microsoft, Ask.com, Moreover.com and IBM. These companies &quot;got on board&quot;:http://www.google.com/press/pressrel/sitemapsorg.html in the couple of years after Google Sitemaps were launched (June 2005), and the &quot;Sitemaps protocol&quot;:http://www.sitemaps.org/protocol.php was established.

The &quot;Sitemaps protocol&quot;:http://www.sitemaps.org/protocol.php is comprehensive and equips you with everything you need to know to create Sitemaps.

h2. Ping - A World of Discovery

Well, this is all well and good, and we're jolly happy that these collaborating search engines can find our stuff, but how are we going to make sure that they keep checking our sitemaps for updates? It's a chicken and egg situation, but one for which there is a tasteful solution.

Google, Yahoo!, Microsoft and Ask.com all offer ping services that you can submit your sitemap URLs to. This means that you can notify these search engines of sitemap updates on your terms and in an automated fashion without having to manually submit your sitemap URL to each service one by one.

Here's a PHP script to help you get your Sitemaps ping action on the go. I've opted to use the cURL functions (which are compiled into most PHP installations) over &lt;code&gt;file_get_contents()&lt;/code&gt; with the fopen_url wrapper as it's a more secure solution.

h3. PHP Ping Script

&lt;notextile&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;text text_html text_html_basic&quot;&gt;&lt;span class=&quot;source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_begin punctuation_section_embedded_begin_php&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Switch output on or off
&lt;/span&gt;&lt;span class=&quot;support support_function support_function_builtin_functions support_function_builtin_functions_php&quot;&gt;define&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;OUTPUT&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;true&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Sitemap URL
&lt;/span&gt;&lt;span class=&quot;support support_function support_function_builtin_functions support_function_builtin_functions_php&quot;&gt;define&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;SITEMAP_URL&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;http://www.example.com/sitemap.xml&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Search engine pings configuration
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Google&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://www.google.com/webmasters/sitemaps/ping?sitemap=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Yahoo!&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Ask.com&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://submissions.ask.com/ping?sitemap=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Microsoft Live Search&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://webmaster.live.com/ping.aspx?siteMap=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Moreover.com&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://api.moreover.com/ping?u=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; .................................................................
&lt;/span&gt;
&lt;span class=&quot;meta meta_class meta_class_php&quot;&gt;&lt;span class=&quot;storage storage_type storage_type_class storage_type_class_php&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_php&quot;&gt;Ping&lt;/span&gt; {&lt;/span&gt;

&lt;span class=&quot;meta meta_function meta_function_php&quot;&gt;    &lt;span class=&quot;storage storage_modifier storage_modifier_php&quot;&gt;public &lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_function storage_type_function_php&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;support support_function support_function_magic support_function_magic_php&quot;&gt;__construct&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_php&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;meta meta_function meta_function_arguments meta_function_arguments_php&quot;&gt;&lt;span class=&quot;meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php&quot;&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt;&lt;/span&gt;,&lt;span class=&quot;meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php&quot;&gt;&lt;span class=&quot;storage storage_modifier storage_modifier_php&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;{
        &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Loop through sites to ping
&lt;/span&gt;        &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_php&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;foreach&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_php&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_config&lt;/span&gt;){
            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;result&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Construct ping URL
&lt;/span&gt;            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_url&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_config&lt;/span&gt;[&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;]&lt;span class=&quot;keyword keyword_operator keyword_operator_string keyword_operator_string_php&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;support support_function support_function_url support_function_url_php&quot;&gt;urlencode&lt;/span&gt;(&lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;SITEMAP_URL&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Initialize cURL session
&lt;/span&gt;            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_init&lt;/span&gt;()&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_php&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;false&lt;/span&gt;){
                &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Set cURL options
&lt;/span&gt;                &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_setopt&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;, &lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;CURLOPT_URL&lt;/span&gt;, &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_url&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_setopt&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;, &lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;CURLOPT_HEADER&lt;/span&gt;, &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;true&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_setopt&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;, &lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;, &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;true&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Execute HTTP request to ping URL
&lt;/span&gt;                &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;response&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_exec&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Check for any cURL error
&lt;/span&gt;                &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_php&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_errno&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;)){
                    &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;support support_function support_function_php_pcre support_function_php_pcre_php&quot;&gt;preg_match&lt;/span&gt;(&lt;span class=&quot;string string_regexp string_regexp_single-quoted string_regexp_single-quoted_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'/&lt;/span&gt;\d\d\d&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;/'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;response&lt;/span&gt;, &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;status_code&lt;/span&gt;)){
                        &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Check HTTP status code
&lt;/span&gt;                        &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;status_code&lt;/span&gt;[&lt;span class=&quot;constant constant_numeric constant_numeric_php&quot;&gt;0&lt;/span&gt;]&lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;constant constant_numeric constant_numeric_php&quot;&gt;200&lt;/span&gt;){
                            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;result&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                            &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Increment the pinged_count if successfully pinged
&lt;/span&gt;                            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_increment-decrement keyword_operator_increment-decrement_php&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                        }
                    }
                }
                &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Close cURL session
&lt;/span&gt;                &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_close&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            }
            &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Output ping result
&lt;/span&gt;            &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;OUTPUT&lt;/span&gt;){
                &lt;span class=&quot;support support_function support_function_construct support_function_construct_php&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;, (&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;result&lt;/span&gt; ? &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;OK&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; : &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;ERROR&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;) , &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;] &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_config&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_index-start keyword_operator_index-start_php&quot;&gt;[&lt;/span&gt;'name'&lt;span class=&quot;keyword keyword_operator keyword_operator_index-end keyword_operator_index-end_php&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;constant constant_character constant_character_escape constant_character_escape_php&quot;&gt;\n&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            }
        }
    }

}

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Count number of sites to ping
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;stat_pings_count&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_function support_function_array support_function_array_php&quot;&gt;count&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Ping the sites
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_php&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping&lt;/span&gt;   &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;keyword keyword_other keyword_other_new keyword_other_new_php&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;support support_class support_class_php&quot;&gt;Ping&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt;, &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Output ping results summary
&lt;/span&gt;&lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;OUTPUT&lt;/span&gt;){
    &lt;span class=&quot;support support_function support_function_construct support_function_construct_php&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;Pinged &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt; out of &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;stat_pings_count&lt;/span&gt; sites successfully&lt;span class=&quot;constant constant_character constant_character_escape constant_character_escape_php&quot;&gt;\n&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
}

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; exit(0); # Needed if script is run from the CLI&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/notextile&gt;

For you Ruby divas out there, here's an auto-magical script that will give you the same jazz.

h3. Ruby Ping Script

&lt;notextile&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Switch output on or off
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;OUTPUT&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_ruby&quot;&gt;true&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Sitemap URL
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;SITEMAP_URL&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://www.example.com/sitemap.xml&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Search engine pings configuration
&lt;/span&gt;pings_config &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Google&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://www.google.com/webmasters/sitemaps/ping?sitemap=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Yahoo!&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Ask.com&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://submissions.ask.com/ping?sitemap=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Microsoft Live Search&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://webmaster.live.com/ping.aspx?siteMap=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Moreover.com&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://api.moreover.com/ping?u=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; .................................................................
&lt;/span&gt;
&lt;span class=&quot;meta meta_require meta_require_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;cgi&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;meta meta_require meta_require_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;net/http&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;meta meta_class meta_class_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_class keyword_control_class_ruby&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby&quot;&gt;Ping&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;attr_accessor&lt;/span&gt; &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;pinged_count&lt;/span&gt;

  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_parameter variable_parameter_function variable_parameter_function_ruby&quot;&gt;pings_config&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;    &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Loop through sites to ping
&lt;/span&gt;    &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;pinged_count&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby&quot;&gt;;&lt;/span&gt;
    pings_config&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;each &lt;span class=&quot;keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_block variable_other_block_ruby&quot;&gt;ping_config&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby&quot;&gt;|&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Construct ping URL
&lt;/span&gt;      ping_url &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; ping_config&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;support support_class support_class_ruby&quot;&gt;CGI&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;::&lt;/span&gt;escape&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;SITEMAP_URL&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Execute HTTP request to ping URL
&lt;/span&gt;      response &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_class support_class_ruby&quot;&gt;Net&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;HTTP&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;get_response&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;URI&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;ping_url&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Check HTTP status code
&lt;/span&gt;      result &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_ruby&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; response&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;code &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;200&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Increment the pinged_count if successfully pinged
&lt;/span&gt;      &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;pinged_count&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; result
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Output ping result
&lt;/span&gt;      puts &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;[&lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;result &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;OK&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;ERROR&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;] &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;ping_config&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;OUTPUT&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Count number of sites to ping
&lt;/span&gt;stat_pings_count &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; pings_config&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;size&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Ping the sites
&lt;/span&gt;ping &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_class support_class_ruby&quot;&gt;Ping&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;pings_config&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Output ping results summary
&lt;/span&gt;puts &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;Pinged &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;ping&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;pinged_count&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; out of &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;stat_pings_count&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; sites successfully&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;OUTPUT&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; exit 0 # Needed if script is run from the CLI&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/notextile&gt;

(Thanks to Alistair for beautifying my wretched Ruby script!)

h3. Let's Automate, Baby

For bonus points you can schedule your ping script with &quot;CRON&quot;:http://en.wikipedia.org/wiki/Cron so that it pings the search engines with your Sitemap every week, for example. You can either include it within a scheduled script that generates your Sitemaps (which will be a typical approach for CMS-driven sites), or simply call it directly.

If you're calling the ping script directly by itself then make sure you uncomment the last line so that it returns an exit code when it's executed. You'll also want to add a &quot;shebang&quot;:http://tinyurl.com/2pscey line to the start of the script (alter your path as required):

* PHP: &lt;code&gt;#!/usr/bin/php&lt;/code&gt;
* Ruby: &lt;code&gt;#!/usr/bin/ruby&lt;/code&gt;

h3. Minor Caveat

The scripts both check the HTTP status code of the search engine ping URL that has been requested (not your Sitemap URL) is 200 (OK). The Microsoft Live Search ping endpoint appears to be the only one that returns a 404 (Not Found) status code if you submit a Sitemap URL that doesn't exist. Unfortunately none of the search engines return a parsable response (unless you really want to parse inconsistent HTML!).

h2. No Blackhat Required!

Combined with &quot;mod_rewritten&quot;:http://www.apacheref.com/ref/mod_rewrite.html URLs (surely the greatest freebie in the SEO toolkit!), Sitemaps give us a perfect opportunity for shameless self-promotion. Instead of twiddling your thumbs and hoping that search engines will discover all of your site and its updates, you can now be confident that they'll have the inside dope. Now that's what I call standards satisfaction!

If anyone would like to contribute a port of the ping script shown above to Python, please drop me an e-mail at simon [at] seventytwo [dot] co [dot] uk.</body>
    <body-html>&lt;div class=&quot;note&quot;&gt;
&lt;h2&gt;Update&lt;/h2&gt;
&lt;p&gt;If you don&amp;#8217;t fancy getting your hands dirty with code or just love automation, then check out the mini web app we launched earlier this week, &lt;a href=&quot;http://pingmymap.com/&quot;&gt;PingMyMap&lt;/a&gt;. It&amp;#8217;s a free service for web developers and site admins which allows you to easily notify multiple search engines of updates to your site&amp;#8217;s Sitemaps. Pingtastic!&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;For various reasons, some sites simply aren&amp;#8217;t well indexed. Despite having highly relevant content, you just can&amp;#8217;t get your site to show up in search engine results, or perhaps you have some pages that are unfortunately tucked away.&lt;/p&gt;
&lt;h2&gt;All Content is Not Created Equal&lt;/h2&gt;
&lt;p&gt;I personally advocate progressively enhanced, standards-based and accessible content solutions (damn I sound so buzzword!), but it&amp;#8217;s pretty clear that there&amp;#8217;s a lot of content out there that just isn&amp;#8217;t so ready to expose itself to search engine crawlers.&lt;/p&gt;
&lt;p&gt;Flash movies are notorious for suffering from indexing issues due to their non-semantic structure (although credit is due to Google, who are &lt;a href=&quot;http://googlewebmastercentral.blogspot.com/2008/06/improved-flash-indexing.html&quot;&gt;taking action&lt;/a&gt;). Complex JavaScript heavy sites often have many potential pitfalls when it comes to crawlers sussing out the structure and content, such as hash links (e.g. &lt;a href=&quot;#&quot;&gt;Save&lt;/a&gt;) and content that is dynamically loaded via &lt;span class=&quot;caps&quot;&gt;AJAX&lt;/span&gt; requests.&lt;/p&gt;
&lt;p&gt;Even if your content is on the most accessible, standards compliant site in the whole of the web, there&amp;#8217;s a fantastic tool that will give you indexing bliss, no matter how your site is structured.&lt;/p&gt;
&lt;h2&gt;Google et Al To The Rescue&lt;/h2&gt;
&lt;p&gt;Google Sitemaps will be familiar to a lot of web developers as a mechanism to make Google aware of pages and content on your site. What many people still don&amp;#8217;t know, is that several other web giants support &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt; Sitemaps as a standard: Yahoo!, Microsoft, Ask.com, Moreover.com and &lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt;. These companies &lt;a href=&quot;http://www.google.com/press/pressrel/sitemapsorg.html&quot;&gt;got on board&lt;/a&gt; in the couple of years after Google Sitemaps were launched (June 2005), and the &lt;a href=&quot;http://www.sitemaps.org/protocol.php&quot;&gt;Sitemaps protocol&lt;/a&gt; was established.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://www.sitemaps.org/protocol.php&quot;&gt;Sitemaps protocol&lt;/a&gt; is comprehensive and equips you with everything you need to know to create Sitemaps.&lt;/p&gt;
&lt;h2&gt;Ping &amp;#8211; A World of Discovery&lt;/h2&gt;
&lt;p&gt;Well, this is all well and good, and we&amp;#8217;re jolly happy that these collaborating search engines can find our stuff, but how are we going to make sure that they keep checking our sitemaps for updates? It&amp;#8217;s a chicken and egg situation, but one for which there is a tasteful solution.&lt;/p&gt;
&lt;p&gt;Google, Yahoo!, Microsoft and Ask.com all offer ping services that you can submit your sitemap URLs to. This means that you can notify these search engines of sitemap updates on your terms and in an automated fashion without having to manually submit your sitemap &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; to each service one by one.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s a &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; script to help you get your Sitemaps ping action on the go. I&amp;#8217;ve opted to use the cURL functions (which are compiled into most &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; installations) over &lt;code&gt;file_get_contents()&lt;/code&gt; with the fopen_url wrapper as it&amp;#8217;s a more secure solution.&lt;/p&gt;
&lt;h3&gt;&lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt; Ping Script&lt;/h3&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;text text_html text_html_basic&quot;&gt;&lt;span class=&quot;source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_begin punctuation_section_embedded_begin_php&quot;&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Switch output on or off
&lt;/span&gt;&lt;span class=&quot;support support_function support_function_builtin_functions support_function_builtin_functions_php&quot;&gt;define&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;OUTPUT&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;true&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Sitemap URL
&lt;/span&gt;&lt;span class=&quot;support support_function support_function_builtin_functions support_function_builtin_functions_php&quot;&gt;define&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;SITEMAP_URL&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;http://www.example.com/sitemap.xml&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Search engine pings configuration
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Google&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://www.google.com/webmasters/sitemaps/ping?sitemap=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Yahoo!&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Ask.com&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://submissions.ask.com/ping?sitemap=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Microsoft Live Search&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://webmaster.live.com/ping.aspx?siteMap=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
    &lt;span class=&quot;meta meta_function-call meta_function-call_php&quot;&gt;Array&lt;/span&gt;(&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;Moreover.com&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
          &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;  &lt;span class=&quot;keyword keyword_operator keyword_operator_key keyword_operator_key_php&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;http://api.moreover.com/ping?u=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;),
)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; .................................................................
&lt;/span&gt;
&lt;span class=&quot;meta meta_class meta_class_php&quot;&gt;&lt;span class=&quot;storage storage_type storage_type_class storage_type_class_php&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_php&quot;&gt;Ping&lt;/span&gt; {&lt;/span&gt;

&lt;span class=&quot;meta meta_function meta_function_php&quot;&gt;    &lt;span class=&quot;storage storage_modifier storage_modifier_php&quot;&gt;public &lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_function storage_type_function_php&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;support support_function support_function_magic support_function_magic_php&quot;&gt;__construct&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_php&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;meta meta_function meta_function_arguments meta_function_arguments_php&quot;&gt;&lt;span class=&quot;meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php&quot;&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt;&lt;/span&gt;,&lt;span class=&quot;meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php&quot;&gt;&lt;span class=&quot;storage storage_modifier storage_modifier_php&quot;&gt; &amp;amp;&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;{
        &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Loop through sites to ping
&lt;/span&gt;        &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_php&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;foreach&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_php&quot;&gt;AS&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_config&lt;/span&gt;){
            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;result&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Construct ping URL
&lt;/span&gt;            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_url&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_config&lt;/span&gt;[&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;'&lt;/span&gt;&lt;/span&gt;]&lt;span class=&quot;keyword keyword_operator keyword_operator_string keyword_operator_string_php&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;support support_function support_function_url support_function_url_php&quot;&gt;urlencode&lt;/span&gt;(&lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;SITEMAP_URL&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Initialize cURL session
&lt;/span&gt;            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_init&lt;/span&gt;()&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_php&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;false&lt;/span&gt;){
                &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Set cURL options
&lt;/span&gt;                &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_setopt&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;, &lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;CURLOPT_URL&lt;/span&gt;, &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_url&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_setopt&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;, &lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;CURLOPT_HEADER&lt;/span&gt;, &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;true&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_setopt&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;, &lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;, &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;true&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Execute HTTP request to ping URL
&lt;/span&gt;                &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;response&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_exec&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Check for any cURL error
&lt;/span&gt;                &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_php&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_errno&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;)){
                    &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;support support_function support_function_php_pcre support_function_php_pcre_php&quot;&gt;preg_match&lt;/span&gt;(&lt;span class=&quot;string string_regexp string_regexp_single-quoted string_regexp_single-quoted_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;'/&lt;/span&gt;\d\d\d&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;/'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;response&lt;/span&gt;, &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;status_code&lt;/span&gt;)){
                        &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Check HTTP status code
&lt;/span&gt;                        &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;status_code&lt;/span&gt;[&lt;span class=&quot;constant constant_numeric constant_numeric_php&quot;&gt;0&lt;/span&gt;]&lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;constant constant_numeric constant_numeric_php&quot;&gt;200&lt;/span&gt;){
                            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;result&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_php&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                            &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Increment the pinged_count if successfully pinged
&lt;/span&gt;                            &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_increment-decrement keyword_operator_increment-decrement_php&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
                        }
                    }
                }
                &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Close cURL session
&lt;/span&gt;                &lt;span class=&quot;support support_function support_function_interface support_function_interface_php&quot;&gt;curl_close&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ch&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            }
            &lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Output ping result
&lt;/span&gt;            &lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;OUTPUT&lt;/span&gt;){
                &lt;span class=&quot;support support_function support_function_construct support_function_construct_php&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;, (&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;result&lt;/span&gt; ? &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;OK&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; : &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;ERROR&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;) , &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;] &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping_config&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_index-start keyword_operator_index-start_php&quot;&gt;[&lt;/span&gt;'name'&lt;span class=&quot;keyword keyword_operator keyword_operator_index-end keyword_operator_index-end_php&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;constant constant_character constant_character_escape constant_character_escape_php&quot;&gt;\n&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
            }
        }
    }

}

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Count number of sites to ping
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;stat_pings_count&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_function support_function_array support_function_array_php&quot;&gt;count&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Ping the sites
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_php&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;ping&lt;/span&gt;   &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;keyword keyword_other keyword_other_new keyword_other_new_php&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;support support_class support_class_php&quot;&gt;Ping&lt;/span&gt;(&lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pings_config&lt;/span&gt;, &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt;)&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; Output ping results summary
&lt;/span&gt;&lt;span class=&quot;keyword keyword_control keyword_control_php&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;constant constant_other constant_other_php&quot;&gt;OUTPUT&lt;/span&gt;){
    &lt;span class=&quot;support support_function support_function_construct support_function_construct_php&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php&quot;&gt;Pinged &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;pinged&lt;/span&gt; out of &lt;span class=&quot;variable variable_other variable_other_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php&quot;&gt;$&lt;/span&gt;stat_pings_count&lt;/span&gt; sites successfully&lt;span class=&quot;constant constant_character constant_character_escape constant_character_escape_php&quot;&gt;\n&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php&quot;&gt;;&lt;/span&gt;
}

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_php&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php&quot;&gt;#&lt;/span&gt; exit(0); # Needed if script is run from the CLI&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;For you Ruby divas out there, here&amp;#8217;s an auto-magical script that will give you the same jazz.&lt;/p&gt;
&lt;h3&gt;Ruby Ping Script&lt;/h3&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby&quot;&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Switch output on or off
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;OUTPUT&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_ruby&quot;&gt;true&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Sitemap URL
&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;SITEMAP_URL&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://www.example.com/sitemap.xml&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Search engine pings configuration
&lt;/span&gt;pings_config &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Google&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://www.google.com/webmasters/sitemaps/ping?sitemap=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Yahoo!&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Ask.com&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://submissions.ask.com/ping?sitemap=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Microsoft Live Search&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://webmaster.live.com/ping.aspx?siteMap=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;Moreover.com&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
   &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;  &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;http://api.moreover.com/ping?u=&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; .................................................................
&lt;/span&gt;
&lt;span class=&quot;meta meta_require meta_require_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;cgi&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;meta meta_require meta_require_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;net/http&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;meta meta_class meta_class_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_class keyword_control_class_ruby&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby&quot;&gt;Ping&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;attr_accessor&lt;/span&gt; &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;pinged_count&lt;/span&gt;

  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_parameter variable_parameter_function variable_parameter_function_ruby&quot;&gt;pings_config&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;    &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Loop through sites to ping
&lt;/span&gt;    &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;pinged_count&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby&quot;&gt;;&lt;/span&gt;
    pings_config&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;each &lt;span class=&quot;keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_block variable_other_block_ruby&quot;&gt;ping_config&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_variable punctuation_separator_variable_ruby&quot;&gt;|&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Construct ping URL
&lt;/span&gt;      ping_url &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; ping_config&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;url&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;support support_class support_class_ruby&quot;&gt;CGI&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;::&lt;/span&gt;escape&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;SITEMAP_URL&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Execute HTTP request to ping URL
&lt;/span&gt;      response &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_class support_class_ruby&quot;&gt;Net&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;HTTP&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;get_response&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;URI&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;parse&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;ping_url&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Check HTTP status code
&lt;/span&gt;      result &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_ruby&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; response&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;code &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;200&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Increment the pinged_count if successfully pinged
&lt;/span&gt;      &lt;span class=&quot;variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby&quot;&gt;@&lt;/span&gt;pinged_count&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; result
&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;      &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Output ping result
&lt;/span&gt;      puts &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;[&lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;result &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;OK&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;ERROR&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;] &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;ping_config&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;name&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;OUTPUT&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Count number of sites to ping
&lt;/span&gt;stat_pings_count &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; pings_config&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;size&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_statement punctuation_separator_statement_ruby&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Ping the sites
&lt;/span&gt;ping &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;support support_class support_class_ruby&quot;&gt;Ping&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;pings_config&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Output ping results summary
&lt;/span&gt;puts &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;Pinged &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;ping&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;pinged_count&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; out of &lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;stat_pings_count&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt; sites successfully&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;OUTPUT&lt;/span&gt;

&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; exit 0 # Needed if script is run from the CLI&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;(Thanks to Alistair for beautifying my wretched Ruby script!)&lt;/p&gt;
&lt;h3&gt;Let&amp;#8217;s Automate, Baby&lt;/h3&gt;
&lt;p&gt;For bonus points you can schedule your ping script with &lt;a href=&quot;http://en.wikipedia.org/wiki/Cron&quot;&gt;&lt;span class=&quot;caps&quot;&gt;CRON&lt;/span&gt;&lt;/a&gt; so that it pings the search engines with your Sitemap every week, for example. You can either include it within a scheduled script that generates your Sitemaps (which will be a typical approach for &lt;span class=&quot;caps&quot;&gt;CMS&lt;/span&gt;-driven sites), or simply call it directly.&lt;/p&gt;
&lt;p&gt;If you&amp;#8217;re calling the ping script directly by itself then make sure you uncomment the last line so that it returns an exit code when it&amp;#8217;s executed. You&amp;#8217;ll also want to add a &lt;a href=&quot;http://tinyurl.com/2pscey&quot;&gt;shebang&lt;/a&gt; line to the start of the script (alter your path as required):&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt;: &lt;code&gt;#!/usr/bin/php&lt;/code&gt;&lt;/li&gt;
	&lt;li&gt;Ruby: &lt;code&gt;#!/usr/bin/ruby&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Minor Caveat&lt;/h3&gt;
&lt;p&gt;The scripts both check the &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; status code of the search engine ping &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; that has been requested (not your Sitemap URL) is 200 (OK). The Microsoft Live Search ping endpoint appears to be the only one that returns a 404 (Not Found) status code if you submit a Sitemap &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; that doesn&amp;#8217;t exist. Unfortunately none of the search engines return a parsable response (unless you really want to parse inconsistent &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;!).&lt;/p&gt;
&lt;h2&gt;No Blackhat Required!&lt;/h2&gt;
&lt;p&gt;Combined with &lt;a href=&quot;http://www.apacheref.com/ref/mod_rewrite.html&quot;&gt;mod_rewritten&lt;/a&gt; URLs (surely the greatest freebie in the &lt;span class=&quot;caps&quot;&gt;SEO&lt;/span&gt; toolkit!), Sitemaps give us a perfect opportunity for shameless self-promotion. Instead of twiddling your thumbs and hoping that search engines will discover all of your site and its updates, you can now be confident that they&amp;#8217;ll have the inside dope. Now that&amp;#8217;s what I call standards satisfaction!&lt;/p&gt;
&lt;p&gt;If anyone would like to contribute a port of the ping script shown above to Python, please drop me an e-mail at simon [at] seventytwo [dot] co [dot] uk.&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-07-13T13:23:10+01:00</created-at>
    <excerpt>Since the dawn of web search, getting your site well ranked in search engines has been the holy grail of web spinners everywhere. In this world of proprietary algorithms and SEO speculation, there is (gasp) a simple standard between search engines that has the power to unite us all and bring world peace! Well, at the very least it can give your site a fighting chance at getting indexed. Behold, Sitemaps, the standard.</excerpt>
    <excerpt-html>&lt;p&gt;Since the dawn of web search, getting your site well ranked in search engines has been the holy grail of web spinners everywhere. In this world of proprietary algorithms and &lt;span class=&quot;caps&quot;&gt;SEO&lt;/span&gt; speculation, there is (gasp) a simple standard between search engines that has the power to unite us all and bring world peace! Well, at the very least it can give your site a fighting chance at getting indexed. Behold, Sitemaps, the standard.&lt;/p&gt;</excerpt-html>
    <further-reading>* &quot;Official Sitemaps Website&quot;:http://www.sitemaps.org/ - Sponsored by Google, Yahoo! and Microsoft
* &quot;XML Sitemaps Generator&quot;:http://www.xml-sitemaps.com/ - Bear in mind that this will only include pages/content that are accessible to their crawler
* &quot;Mephisto (Google) Sitemap&quot;:http://www.appelsiini.net/projects/mephisto_sitemap - Plugin for Mephisto that generates Sitemaps
* &quot;Wikipedia on Sitemaps&quot;:http://en.wikipedia.org/wiki/Google_Sitemaps
</further-reading>
    <further-reading-html>&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.sitemaps.org/&quot;&gt;Official Sitemaps Website&lt;/a&gt; &amp;#8211; Sponsored by Google, Yahoo! and Microsoft&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.xml-sitemaps.com/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt; Sitemaps Generator&lt;/a&gt; &amp;#8211; Bear in mind that this will only include pages/content that are accessible to their crawler&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.appelsiini.net/projects/mephisto_sitemap&quot;&gt;Mephisto (Google) Sitemap&lt;/a&gt; &amp;#8211; Plugin for Mephisto that generates Sitemaps&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Google_Sitemaps&quot;&gt;Wikipedia on Sitemaps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</further-reading-html>
    <id type="integer">2</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-07-20T16:00:00+01:00</published-on>
    <title>How to Reach Enlightenment and Get Your Site Indexed by Search Engines</title>
    <updated-at type="datetime">2008-08-10T09:26:42+01:00</updated-at>
  </post>
  <post>
    <author-id type="integer">1</author-id>
    <body>Let's face it. HTML file uploads aren't that great. Luckily we have tools like &quot;SWFUpload&quot;:http://swfupload.org/ out there which allow us to make file uploading a lot better.

SWFUpload will allow us to do all sorts of fancy things including upload queues, multiple file uploads and progress info/bars.

Utilising SWFUpload with Rails can be tricky. For this tutorial we're going to be using SWFUpload, the popular &quot;attachment_fu plugin&quot;:http://github.com/technoweenie/attachment_fu/tree/master, some attachment_fu hacks and the &quot;mimetype_fu plugin&quot;:http://github.com/mattetti/mimetype-fu/tree/master.

We will assume that you have got as far as installing attachment_fu, setting up your models and controllers and integrating SWFUpload into the process.

h2. So what are the problems?

# Flash 8 doesn't send meta data along with uploaded files which will stop Rails loading the users session, and thus, processing the uploads
# Rails 2 comes with &quot;Cross-Site Request Forging&quot;:http://en.wikipedia.org/wiki/Cross-site_request_forgery protection on any non-GET HTML/Ajax requests. SWFUpload uses POST requests to upload files
# Flash 8 sends incorrect MIME type data with uploaded files which will stop attachment_fu from recognising image uploads

h2. 1. Making SWFUpload work with Rails sessions

We're going to need to hack the CGI::Session class in Rails so that we can pass the session ID in the query string of the Flash request and have Rails load the session correctly.

Below is the code required to make this alteration to CGI::Session courtesy of &quot;Duane Johnson&quot;:http://blog.inquirylabs.com/2006/12/09/getting-the-_session_id-from-swfupload/.

&lt;notextile&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby source_ruby_rails&quot;&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; The following code is a work-around for the Flash 8 bug that prevents our multiple file uploader
&lt;/span&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; from sending the _session_id.  Here, we hack the Session#initialize method and force the session_id
&lt;/span&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; to load from the query string via the request uri. (Tested on Lighttpd, Mongrel, Apache)
&lt;/span&gt;&lt;span class=&quot;meta meta_class meta_class_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_class keyword_control_class_ruby&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby&quot;&gt;CGI::Session&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;alias&lt;/span&gt; original_initialize &lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;initialize&lt;/span&gt;
  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_parameter variable_parameter_function variable_parameter_function_ruby&quot;&gt;request&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; option &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
    session_key &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; option&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;session_key&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;_session_id&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
    query_string &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;qs &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; request&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;env_table&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;QUERY_STRING&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby&quot;&gt;and&lt;/span&gt; qs &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
      qs
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;elsif&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;ru &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; request&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;env_table&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;REQUEST_URI&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;include?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;?&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
      ru&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;ru&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;index&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;?&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; query_string &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby&quot;&gt;and&lt;/span&gt; query_string&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;include?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;session_key&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
      option&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;session_id&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; query_string&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;scan&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;string string_regexp string_regexp_classic string_regexp_classic_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;session_key&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;=&lt;span class=&quot;string string_regexp string_regexp_group string_regexp_group_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_ruby&quot;&gt;(&lt;/span&gt;.*?&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_ruby&quot;&gt;)(&lt;/span&gt;&amp;amp;.*?&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;*$&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;flatten&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;first
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
    original_initialize&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;request&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; option&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/notextile&gt;

h3. Rails 2

You should put this code into a file, swfupload_session_hack.rb for example, and then put this file into the config/initializers directory of your application. Rails 2 will automatically load any files in there so this is the perfect place for it.

h3. Older version of Rails

If you're not yet on Rails 2 then simply append the code to the bottom of your environment.rb file.

Basically this code will look at the request URL and if it finds the session ID being passed it will load the session from this ID. The key that the code will look for in the query string will depend on how you have you app configured. It will first look for your &lt;code&gt;session_key&lt;/code&gt; value which would normally be defined in environment.rb. For example, you can see that the session_key for the app below is &lt;code&gt;_mylovelyapp_session&lt;/code&gt;. If it doesn't find &lt;code&gt;session_key&lt;/code&gt; defined in environment.rb it will instead default to looking for the &lt;code&gt;_session_id&lt;/code&gt; key in the request URL.

The following is an example of what you might have in your environment.rb. In this case, we would need to pass the following key and value pair in the SWFUpload upload URL: &lt;code&gt;_mylovelyapp_session=thesessionid&lt;/code&gt;.

&lt;notextile&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby source_ruby_rails&quot;&gt;  config&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;action_controller&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;session &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block&quot;&gt;
&lt;/span&gt;    &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;session_key&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;_mylovelyapp_session&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;secret&lt;/span&gt;      &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;xxx&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/notextile&gt;

Passing the session ID in the query string is simple. All we need to do is append our key/value pair to the &lt;code&gt;upload_url&lt;/code&gt; we have defined for our SWFUpload implementation. &lt;code&gt;&lt;%= session.session_id %&gt;&lt;/code&gt; will get us the session ID. Nice.

&lt;notextile&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;text text_html text_html_ruby&quot;&gt;&lt;span class=&quot;source source_js source_js_embedded source_js_embedded_html&quot;&gt;&lt;span class=&quot;storage storage_type storage_type_js&quot;&gt;var&lt;/span&gt; swfu&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;keyword keyword_operator keyword_operator_js&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_js&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;{&lt;/span&gt;
  swfu &lt;span class=&quot;keyword keyword_operator keyword_operator_js&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;meta meta_class meta_class_instance meta_class_instance_constructor&quot;&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_new keyword_operator_new_js&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_instance entity_name_type_instance_js&quot;&gt;SWFUpload&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;{&lt;/span&gt;
    upload_url : &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_js&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js&quot;&gt;'&lt;/span&gt;&amp;lt;%= your_upload_path %&amp;gt;?_mylovelyapp_session=&amp;lt;%= session.session_id %&amp;gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js&quot;&gt;...&lt;/span&gt;
  &lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/notextile&gt;

h2. 2. Working with Cross-site Request Forging protection in Rails 2

If you're using anything below Rails 2 you can skip this part as &quot;CSRF&quot;:http://en.wikipedia.org/wiki/Cross-site_request_forgery protection was introduced in Rails 2.0.

Rails 2 auto-magically passes an authenticity token in any non-GET request by appending a hidden field to your forms. Because we're not using a form for SWFUpload wer're going to need to append the authenticy_token to the &lt;code&gt;upload_url&lt;/code&gt; ourselves.

Fortunately this is very simple and only requires another key/value addition to the URL:

&lt;notextile&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;text text_html text_html_ruby&quot;&gt;&lt;span class=&quot;source source_js source_js_embedded source_js_embedded_html&quot;&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_js&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_js&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;{&lt;/span&gt;
  swfu &lt;span class=&quot;keyword keyword_operator keyword_operator_js&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;meta meta_class meta_class_instance meta_class_instance_constructor&quot;&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_new keyword_operator_new_js&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_instance entity_name_type_instance_js&quot;&gt;SWFUpload&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;{&lt;/span&gt;
    upload_url : &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_js&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js&quot;&gt;'&lt;/span&gt;&amp;lt;%= your_upload_path %&amp;gt;?_mylovelyapp_session=&amp;lt;%= session.session_id %&amp;gt;&amp;amp;authenticity_token=&amp;lt;%= form_authenticity_token %&amp;gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js&quot;&gt;...&lt;/span&gt;
  &lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/notextile&gt;

It's easy to get the value for the authenticity token manually by using &lt;code&gt;&lt;%= form_authenticity_token %&gt;&lt;/code&gt;.

*Rails will look for the &lt;code&gt;authenticity_token&lt;/code&gt; key in the request URL so you must use this as the key.*

h2. 3. Hacking attachment_fu to allow content type detection of SWFUpload-ed files

The final problem we're going to run into when using SWFUpload with Rails and attachment_fu is that SWFUpload submits files to Rails with their content type set to &lt;code&gt;application/octet-stream&lt;/code&gt; which will prevent attachment_fu from recognising image uploads.

We're going to use the &quot;mimetype_fu plugin&quot;:http://github.com/mattetti/mimetype-fu/tree/master to detect the mime type from our file uploads. This plugin will use the Operating System that the Rails app is running under to open the file and check on the header for the mime type. Pretty nifty. Unfortunately, for Windows users the plugin will only look at the file extension to try to determine the content type of the file.

We'll run one of the following commands at the root of our Rails app to get it installed:

* Git: &lt;code&gt;script/plugin install git://github.com/mattetti/mimetype-fu.git&lt;/code&gt;
* Subversion: &lt;code&gt;script/plugin install http://mimetype-fu.googlecode.com/svn/trunk/&lt;/code&gt;

*Note:* There are several other ways to install plugins. E.g. &quot;Piston&quot;:http://piston.rubyforge.org/ for SVN (&quot;and unofficially, git&quot;:http://technicalpickles.com/posts/piston-and-git-for-the-win), Git Submodules and SVN Externals to name a few.

Add the code below into the config/initializers directory of your application. I called my file attachment_fu_hacks.rb.

&lt;notextile&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby source_ruby_rails&quot;&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;Technoweenie&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;AttachmentFu&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;InstanceMethods&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;module_eval &lt;span class=&quot;keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block&quot;&gt;do
&lt;/span&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;  &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Overriding this method to allow content_type to be detected when
&lt;/span&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;  &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; swfupload submits images with content_type set to 'application/octet-stream'
&lt;/span&gt;  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;uploaded_data=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_parameter variable_parameter_function variable_parameter_function_ruby&quot;&gt;file_data&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_ruby&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;nil? &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby&quot;&gt;||&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;size &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;variable variable_language variable_language_ruby&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;content_type &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; detect_mimetype&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;file_data&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;variable variable_language variable_language_ruby&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;filename     &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;original_filename &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; respond_to?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;filename&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;is_a?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;StringIO&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
      file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;rewind
      &lt;span class=&quot;variable variable_language variable_language_ruby&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;temp_data &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;read
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;variable variable_language variable_language_ruby&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;temp_path &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;path
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;detect_mimetype&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_parameter variable_parameter_function variable_parameter_function_ruby&quot;&gt;file_data&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;content_type&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;strip &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;application/octet-stream&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;support support_class support_class_ruby&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;mime_type?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;original_filename&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;return&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;content_type
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/notextile&gt;

Attachment_fu will now check all file uploads it receives to see if their content type is 'application/octet-stream' and if so, will use mimetype_fu to determine the content type of the file.

h2. Finished

And that's all there is to it. Happy SWFUpload-ing!</body>
    <body-html>&lt;p&gt;Let&amp;#8217;s face it. &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; file uploads aren&amp;#8217;t that great. Luckily we have tools like &lt;a href=&quot;http://swfupload.org/&quot;&gt;SWFUpload&lt;/a&gt; out there which allow us to make file uploading a lot better.&lt;/p&gt;
&lt;p&gt;SWFUpload will allow us to do all sorts of fancy things including upload queues, multiple file uploads and progress info/bars.&lt;/p&gt;
&lt;p&gt;Utilising SWFUpload with Rails can be tricky. For this tutorial we&amp;#8217;re going to be using SWFUpload, the popular &lt;a href=&quot;http://github.com/technoweenie/attachment_fu/tree/master&quot;&gt;attachment_fu plugin&lt;/a&gt;, some attachment_fu hacks and the &lt;a href=&quot;http://github.com/mattetti/mimetype-fu/tree/master&quot;&gt;mimetype_fu plugin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We will assume that you have got as far as installing attachment_fu, setting up your models and controllers and integrating SWFUpload into the process.&lt;/p&gt;
&lt;h2&gt;So what are the problems?&lt;/h2&gt;
&lt;ol&gt;
	&lt;li&gt;Flash 8 doesn&amp;#8217;t send meta data along with uploaded files which will stop Rails loading the users session, and thus, processing the uploads&lt;/li&gt;
	&lt;li&gt;Rails 2 comes with &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-site_request_forgery&quot;&gt;Cross-Site Request Forging&lt;/a&gt; protection on any non-&lt;span class=&quot;caps&quot;&gt;GET&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;/Ajax requests. SWFUpload uses &lt;span class=&quot;caps&quot;&gt;POST&lt;/span&gt; requests to upload files&lt;/li&gt;
	&lt;li&gt;Flash 8 sends incorrect &lt;span class=&quot;caps&quot;&gt;MIME&lt;/span&gt; type data with uploaded files which will stop attachment_fu from recognising image uploads&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;1. Making SWFUpload work with Rails sessions&lt;/h2&gt;
&lt;p&gt;We&amp;#8217;re going to need to hack the &lt;span class=&quot;caps&quot;&gt;CGI&lt;/span&gt;::Session class in Rails so that we can pass the session ID in the query string of the Flash request and have Rails load the session correctly.&lt;/p&gt;
&lt;p&gt;Below is the code required to make this alteration to &lt;span class=&quot;caps&quot;&gt;CGI&lt;/span&gt;::Session courtesy of &lt;a href=&quot;http://blog.inquirylabs.com/2006/12/09/getting-the-_session_id-from-swfupload/&quot;&gt;Duane Johnson&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby source_ruby_rails&quot;&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; The following code is a work-around for the Flash 8 bug that prevents our multiple file uploader
&lt;/span&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; from sending the _session_id.  Here, we hack the Session#initialize method and force the session_id
&lt;/span&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; to load from the query string via the request uri. (Tested on Lighttpd, Mongrel, Apache)
&lt;/span&gt;&lt;span class=&quot;meta meta_class meta_class_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_class keyword_control_class_ruby&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby&quot;&gt;CGI::Session&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;alias&lt;/span&gt; original_initialize &lt;span class=&quot;keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby&quot;&gt;initialize&lt;/span&gt;
  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_parameter variable_parameter_function variable_parameter_function_ruby&quot;&gt;request&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; option &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
    session_key &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; option&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;session_key&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;_session_id&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
    query_string &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;qs &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; request&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;env_table&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;QUERY_STRING&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby&quot;&gt;and&lt;/span&gt; qs &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
      qs
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;elsif&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;ru &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; request&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;env_table&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;REQUEST_URI&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;include?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;?&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
      ru&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;ru&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;index&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;?&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_ruby&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; query_string &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby&quot;&gt;and&lt;/span&gt; query_string&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;include?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;session_key&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
      option&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;session_id&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; query_string&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;scan&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;string string_regexp string_regexp_classic string_regexp_classic_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;source source_ruby source_ruby_embedded source_ruby_embedded_source&quot;&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;#{&lt;/span&gt;session_key&lt;span class=&quot;punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;=&lt;span class=&quot;string string_regexp string_regexp_group string_regexp_group_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_ruby&quot;&gt;(&lt;/span&gt;.*?&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_ruby&quot;&gt;)(&lt;/span&gt;&amp;amp;.*?&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_group punctuation_definition_group_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;*$&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;flatten&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;first
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
    original_initialize&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;request&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt; option&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h3&gt;Rails 2&lt;/h3&gt;
&lt;p&gt;You should put this code into a file, swfupload_session_hack.rb for example, and then put this file into the config/initializers directory of your application. Rails 2 will automatically load any files in there so this is the perfect place for it.&lt;/p&gt;
&lt;h3&gt;Older version of Rails&lt;/h3&gt;
&lt;p&gt;If you&amp;#8217;re not yet on Rails 2 then simply append the code to the bottom of your environment.rb file.&lt;/p&gt;
&lt;p&gt;Basically this code will look at the request &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; and if it finds the session ID being passed it will load the session from this ID. The key that the code will look for in the query string will depend on how you have you app configured. It will first look for your &lt;code&gt;session_key&lt;/code&gt; value which would normally be defined in environment.rb. For example, you can see that the session_key for the app below is &lt;code&gt;_mylovelyapp_session&lt;/code&gt;. If it doesn&amp;#8217;t find &lt;code&gt;session_key&lt;/code&gt; defined in environment.rb it will instead default to looking for the &lt;code&gt;_session_id&lt;/code&gt; key in the request &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The following is an example of what you might have in your environment.rb. In this case, we would need to pass the following key and value pair in the SWFUpload upload &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;: &lt;code&gt;_mylovelyapp_session=thesessionid&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby source_ruby_rails&quot;&gt;  config&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;action_controller&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;session &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block&quot;&gt;
&lt;/span&gt;    &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;session_key&lt;/span&gt; &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;_mylovelyapp_session&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;secret&lt;/span&gt;      &lt;span class=&quot;punctuation punctuation_separator punctuation_separator_key-value&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;'&lt;/span&gt;xxx&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;punctuation punctuation_section punctuation_section_scope punctuation_section_scope_ruby&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;Passing the session ID in the query string is simple. All we need to do is append our key/value pair to the &lt;code&gt;upload_url&lt;/code&gt; we have defined for our SWFUpload implementation. &lt;code&gt;&amp;lt;%= session.session_id %&amp;gt;&lt;/code&gt; will get us the session ID. Nice.&lt;/p&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;text text_html text_html_ruby&quot;&gt;&lt;span class=&quot;source source_js source_js_embedded source_js_embedded_html&quot;&gt;&lt;span class=&quot;storage storage_type storage_type_js&quot;&gt;var&lt;/span&gt; swfu&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;keyword keyword_operator keyword_operator_js&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_js&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;{&lt;/span&gt;
  swfu &lt;span class=&quot;keyword keyword_operator keyword_operator_js&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;meta meta_class meta_class_instance meta_class_instance_constructor&quot;&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_new keyword_operator_new_js&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_instance entity_name_type_instance_js&quot;&gt;SWFUpload&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;{&lt;/span&gt;
    upload_url : &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_js&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js&quot;&gt;'&lt;/span&gt;&amp;lt;%= your_upload_path %&amp;gt;?_mylovelyapp_session=&amp;lt;%= session.session_id %&amp;gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js&quot;&gt;...&lt;/span&gt;
  &lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h2&gt;2. Working with Cross-site Request Forging protection in Rails 2&lt;/h2&gt;
&lt;p&gt;If you&amp;#8217;re using anything below Rails 2 you can skip this part as &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-site_request_forgery&quot;&gt;&lt;span class=&quot;caps&quot;&gt;CSRF&lt;/span&gt;&lt;/a&gt; protection was introduced in Rails 2.0.&lt;/p&gt;
&lt;p&gt;Rails 2 auto-magically passes an authenticity token in any non-&lt;span class=&quot;caps&quot;&gt;GET&lt;/span&gt; request by appending a hidden field to your forms. Because we&amp;#8217;re not using a form for SWFUpload wer&amp;#8217;re going to need to append the authenticy_token to the &lt;code&gt;upload_url&lt;/code&gt; ourselves.&lt;/p&gt;
&lt;p&gt;Fortunately this is very simple and only requires another key/value addition to the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;:&lt;/p&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;text text_html text_html_ruby&quot;&gt;&lt;span class=&quot;source source_js source_js_embedded source_js_embedded_html&quot;&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_js&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;storage storage_type storage_type_js&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;{&lt;/span&gt;
  swfu &lt;span class=&quot;keyword keyword_operator keyword_operator_js&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;meta meta_class meta_class_instance meta_class_instance_constructor&quot;&gt;&lt;span class=&quot;keyword keyword_operator keyword_operator_new keyword_operator_new_js&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_type entity_name_type_instance entity_name_type_instance_js&quot;&gt;SWFUpload&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;{&lt;/span&gt;
    upload_url : &lt;span class=&quot;string string_quoted string_quoted_single string_quoted_single_js&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_js&quot;&gt;'&lt;/span&gt;&amp;lt;%= your_upload_path %&amp;gt;?_mylovelyapp_session=&amp;lt;%= session.session_id %&amp;gt;&amp;amp;authenticity_token=&amp;lt;%= form_authenticity_token %&amp;gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_js&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;meta meta_delimiter meta_delimiter_object meta_delimiter_object_comma meta_delimiter_object_comma_js&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;meta meta_delimiter meta_delimiter_method meta_delimiter_method_period meta_delimiter_method_period_js&quot;&gt;...&lt;/span&gt;
  &lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;meta meta_brace meta_brace_curly meta_brace_curly_js&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;meta meta_brace meta_brace_round meta_brace_round_js&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_terminator punctuation_terminator_statement punctuation_terminator_statement_js&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;It&amp;#8217;s easy to get the value for the authenticity token manually by using &lt;code&gt;&amp;lt;%= form_authenticity_token %&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Rails will look for the &lt;code&gt;authenticity_token&lt;/code&gt; key in the request &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; so you must use this as the key.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;3. Hacking attachment_fu to allow content type detection of SWFUpload-ed files&lt;/h2&gt;
&lt;p&gt;The final problem we&amp;#8217;re going to run into when using SWFUpload with Rails and attachment_fu is that SWFUpload submits files to Rails with their content type set to &lt;code&gt;application/octet-stream&lt;/code&gt; which will prevent attachment_fu from recognising image uploads.&lt;/p&gt;
&lt;p&gt;We&amp;#8217;re going to use the &lt;a href=&quot;http://github.com/mattetti/mimetype-fu/tree/master&quot;&gt;mimetype_fu plugin&lt;/a&gt; to detect the mime type from our file uploads. This plugin will use the Operating System that the Rails app is running under to open the file and check on the header for the mime type. Pretty nifty. Unfortunately, for Windows users the plugin will only look at the file extension to try to determine the content type of the file.&lt;/p&gt;
&lt;p&gt;We&amp;#8217;ll run one of the following commands at the root of our Rails app to get it installed:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Git: &lt;code&gt;script/plugin install git://github.com/mattetti/mimetype-fu.git&lt;/code&gt;&lt;/li&gt;
	&lt;li&gt;Subversion: &lt;code&gt;script/plugin install http://mimetype-fu.googlecode.com/svn/trunk/&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; There are several other ways to install plugins. E.g. &lt;a href=&quot;http://piston.rubyforge.org/&quot;&gt;Piston&lt;/a&gt; for &lt;span class=&quot;caps&quot;&gt;SVN&lt;/span&gt; (&lt;a href=&quot;http://technicalpickles.com/posts/piston-and-git-for-the-win&quot;&gt;and unofficially, git&lt;/a&gt;), Git Submodules and &lt;span class=&quot;caps&quot;&gt;SVN&lt;/span&gt; Externals to name a few.&lt;/p&gt;
&lt;p&gt;Add the code below into the config/initializers directory of your application. I called my file attachment_fu_hacks.rb.&lt;/p&gt;
&lt;pre class=&quot;textmate-source&quot;&gt;&lt;span class=&quot;source source_ruby source_ruby_rails&quot;&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;Technoweenie&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;AttachmentFu&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;support support_class support_class_ruby&quot;&gt;InstanceMethods&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;module_eval &lt;span class=&quot;keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block&quot;&gt;do
&lt;/span&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;  &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; Overriding this method to allow content_type to be detected when
&lt;/span&gt;&lt;span class=&quot;comment comment_line comment_line_number-sign comment_line_number-sign_ruby&quot;&gt;  &lt;span class=&quot;punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby&quot;&gt;#&lt;/span&gt; swfupload submits images with content_type set to 'application/octet-stream'
&lt;/span&gt;  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;uploaded_data=&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_parameter variable_parameter_function variable_parameter_function_ruby&quot;&gt;file_data&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;constant constant_language constant_language_ruby&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;nil? &lt;span class=&quot;keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby&quot;&gt;||&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;size &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;constant constant_numeric constant_numeric_ruby&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;variable variable_language variable_language_ruby&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;content_type &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; detect_mimetype&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;file_data&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;variable variable_language variable_language_ruby&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;filename     &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;original_filename &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; respond_to?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;constant constant_other constant_other_symbol constant_other_symbol_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby&quot;&gt;:&lt;/span&gt;filename&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;is_a?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_other variable_other_constant variable_other_constant_ruby&quot;&gt;StringIO&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
      file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;rewind
      &lt;span class=&quot;variable variable_language variable_language_ruby&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;temp_data &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;read
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;variable variable_language variable_language_ruby&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;temp_path &lt;span class=&quot;keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby&quot;&gt;=&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;path
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby&quot;&gt;&lt;span class=&quot;keyword keyword_control keyword_control_def keyword_control_def_ruby&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;entity entity_name entity_name_function entity_name_function_ruby&quot;&gt;detect_mimetype&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;variable variable_parameter variable_parameter_function variable_parameter_function_ruby&quot;&gt;file_data&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;if&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;content_type&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;strip &lt;span class=&quot;keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;string string_quoted string_quoted_double string_quoted_double_ruby&quot;&gt;&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby&quot;&gt;&quot;&lt;/span&gt;application/octet-stream&lt;span class=&quot;punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;support support_class support_class_ruby&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;mime_type?&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;(&lt;/span&gt;file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;original_filename&lt;span class=&quot;punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby&quot;&gt;return&lt;/span&gt; file_data&lt;span class=&quot;punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby&quot;&gt;.&lt;/span&gt;content_type
    &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;keyword keyword_control keyword_control_ruby&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;Attachment_fu will now check all file uploads it receives to see if their content type is &amp;#8216;application/octet-stream&amp;#8217; and if so, will use mimetype_fu to determine the content type of the file.&lt;/p&gt;
&lt;h2&gt;Finished&lt;/h2&gt;
&lt;p&gt;And that&amp;#8217;s all there is to it. Happy SWFUpload-ing!&lt;/p&gt;</body-html>
    <commentable type="boolean">true</commentable>
    <created-at type="datetime">2008-07-08T14:36:57+01:00</created-at>
    <excerpt>Unfortunately Rails and SWFUpload don't work together without a little bit of tweaking to our Rails applications. We'll show you how to make it work.</excerpt>
    <excerpt-html>&lt;p&gt;Unfortunately Rails and SWFUpload don&amp;#8217;t work together without a little bit of tweaking to our Rails applications. We&amp;#8217;ll show you how to make it work.&lt;/p&gt;</excerpt-html>
    <further-reading></further-reading>
    <further-reading-html></further-reading-html>
    <id type="integer">1</id>
    <published type="boolean">true</published>
    <published-on type="datetime">2008-07-20T16:00:00+01:00</published-on>
    <title>Making SWFUpload and Rails work together</title>
    <updated-at type="datetime">2008-08-06T13:38:10+01:00</updated-at>
  </post>
</posts>
