<?xml version="1.0" encoding="iso-8859-1"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">
	<channel>
		<title>Joomla! powered Site</title>
		<description>Joomla! site syndication</description>
		<link>http://www.brettbrewer.com</link>
		<lastBuildDate>Fri, 18 May 2012 18:26:14 +0100</lastBuildDate>
		<generator>FeedCreator 1.7.2</generator>
		<image>
			<url>http://www.brettbrewer.com/images/M_images/joomla_rss.png</url>
			<title>Powered by Joomla!</title>
			<link>http://www.brettbrewer.com</link>
			<description>Joomla! site syndication</description>
		</image>
		<item>
			<title>What is X-Commerce and what does it have to do with PayPal?</title>
			<link>http://www.brettbrewer.com/content/view/124/2/</link>
			<description>I recently did a hasty implementation of PayPal ExpressCheckout for a client and while talking to a PayPal sales rep prior to the integration he directed me to x.com for documentation, but then couldn&amp;#39;t explain exactly how it related to PayPal and the traditional PayPal developer site. I was left wondering whether to use the docs on x.com or the docs on the paypal developer site. Then today I was reading the JanRain technical blog looking for some info about their social sign-in API and stumbled across this line in a blurb about the Innovate Developer Conference (http://www.innovate-conference.com/). Now in its third year, Innovate has evolved quickly from a developer  conference put on by eBay&amp;rsquo;s PayPal unit to a broader event featuring  X.commerce, which unifies the commerce tools and technology platforms of  eBay, PayPal, Magento, Milo and other eBay companies for developers and  merchants.So now I know. </description>
			<category>News - Web Technology</category>
			<pubDate>Mon, 26 Mar 2012 20:56:08 +0100</pubDate>
		</item>
		<item>
			<title>Catching uncatchable fatal errors in PHP</title>
			<link>http://www.brettbrewer.com/content/view/123/45/</link>
			<description>Ever been annoyed when your custom error handlers or exceptions don&amp;#39;t catch fatal PHP errors and leave you with the dreaded  white screen of death  on your web pages instead of a useful stack trace? Me too. So I was happy to find this helpful article (http://insomanic.me.uk/post/229851073/php-trick-catching-fatal-errors-e-error-with-a)  that shows a trick you can use to catch fatal errors such as  out of memory  errors.   &amp;lt;?phpset_error_handler(&amp;#39;myErrorHandler&amp;#39;); register_shutdown_function(&amp;#39;fatalErrorShutdownHandler&amp;#39;);function myErrorHandler($code, $message, $file, $line)   function fatalErrorShutdownHandler()  }?&amp;gt; You may also need to put this in your script to get fatal errors onto the error stack...&amp;lt;?phperror_reporting(0);?&amp;gt;Also keep in mind, if you have any other functions registered as shutdown functions and one of them throws an error, your custom fatalErrorShutdownHandler will not work.</description>
			<category>Tips &amp; Tricks - PHP Tips</category>
			<pubDate>Thu, 01 Dec 2011 13:39:38 +0100</pubDate>
		</item>
		<item>
			<title>Google Plus finally comes to Google Apps users</title>
			<link>http://www.brettbrewer.com/content/view/122/2/</link>
			<description>Google finally annnounced  Google+  support for Google Apps users (http://googleenterprise.blogspot.com/2011/10/google-is-now-available-with-google.html) . Now those of us that have been using google apps to host our email and other domain services can finally see what all the fuss is about. Previously, if you wanted to use Google+ you had to use a Gmail account, which for many Google Apps users like myself meant creating yet another gmail account just to use Google+. And since many of us tend to stay logged into Google under our Google Apps account, this meant that most of us have been ignoring Google+ entirely. This has been especially bad for the Google+ adoption since power users who host their own sites also tend to be the early adopters that new services like Google+ need. In fact, early reports on Google+ suggest that many users have tried it and then not returned and I suspect that some of that behavior was caused by early adopters who needed to create new accounts for Google+ access. Perhaps now the Google+ metrics will start improving as an influx of Google Apps users join the ranks. </description>
			<category>News - Web Technology</category>
			<pubDate>Tue, 01 Nov 2011 18:55:14 +0100</pubDate>
		</item>
		<item>
			<title>dosarrest.com - the real deal</title>
			<link>http://www.brettbrewer.com/content/view/121/2/</link>
			<description>I recently had the unpleasant experience of weathering a rather nasty distributed denial of service (DDoS) attack on one of the sites I manage. It&amp;#39;s a high traffic site that does many tens of thousands of dollars of business each and every day. Downtime on the site costs a lot of money and makes us look really bad. Earlier this week we received a short, poorly worded email from an anonymous email address informing us that our site was under attack and demanding an unspecified ransom to cease the attack. The attack took the site down early Monday morning and I, along with a few other people, scrambled to find a solution, working with our dedicated server company and Akamai to block the deluge of traffic that had maxxed out the connections on our firewall. This particular type of attack is known as a  SYN Flood Attack .  It is very hard to defend against.  We tried blocking IP addresses with our firewall and some POS software from Cisco called  Cisco Guard  which proved utterly useless. Akamai tried some other things that took hours to implement and also proved fruitless. In the end, both the dedicated server company and Akamai advised us there was little we could do other than  wait it out . That was simply not an option. By late in the day, we had lost thousands in revenue, not to mention the sinking feeling of utter helplessness at the hands of some asshole  hackers  who we could not hope to track down or identify. We suspected they were in eastern Europe, possibly in Hungary, but that was about all we could deduce. We called the FBI and got a recording and a message about submitting an incident report on their web site. I called CERT&amp;#39;s 1-800 number to see if they had any advice or knew who I could report this to and they nearly laughed at me when I told them I&amp;#39;d tried to call the FBI to report it. CERT also directed me to a web form where I could fill out a report, but advised me that most likely nothing would be done. Apparently the WWW in internet addresses really does stand for  Wild Wild West . When it comes to dealing with a DDoS attack, you really are on your own. So what were we to do? Would we pay some unknown stranger an unspecified ransom? Would we wait another day and lose thousands more? Would we hire our own hackers to fight back? Finally as the day was quckly turning to evening and financial losses were piling up, we called one of our business associates who runs an even bigger and more prominent web site and told them what was happening to us and asked if they had any suggestions. They had two words for us..... Call Dosarrest.com , they said.  We&amp;#39;d already done some research online looking for solutions and came across dosarrest&amp;#39;s web site, but we were hesitant to try them at first. There were dozens of companies out there claiming to be experts in stopping DoS attacks. Some were big, some were small, some had proprietary hardware they would want to sell us to install at our datacenter, some were just services with no explanation of how they would help. But after the recommendation from our business associates, we decided to give dosarrest.com a call. Our associates assured us that when they had gone through a similar situation, they used dosarrest&amp;#39;s services and though it wasn&amp;#39;t particularly cheap,  dosarrest got them back online within an hour or two. We had nothing to lose. Our mounting lost revenue had already cost us far more than dosarrest wanted to get us set up with their service. We made contact with dosarrest&amp;#39;s sales rep who told us that depending on how quick we could make the required config changes to our site and DNS, they could have us back online within minutes or at most an hour or two. The sale rep wasn&amp;#39;t joking.  Within a few minutes of agreeing to the terms of their contract and making our initial paypal payment, their support team had sent us all the required configuration information, set up a proxy server to filter our traffic and were waiting on us to make the needed changes to our web server and dns config. Within the next hour we had completed the DNS and web server updates and our site was back in business.  Throughout the process, I emailed their support with questions and had answers within minutes. When I called them, I was quickly connected to a tech-savvy support person who had all the answers I needed. Each time I have contacted them via email since, I have had a response within minutes. I think the longest response time from them was about 20 minutes for a non-emergency email, but usually it&amp;#39;s much quicker. In fact, this evening, after several days of running with their service, I made a major update to the web site. About 100 files were changed and out of that 100 files I made 1 mistake in a config file that caused an endless redirect loop on the site. Because I had updated so many files at once, it took about 15 minutes to find my mistake and correct it. When I finished fixing the redirect problem, I checked my inbox to find an email already waiting from dosalert.com support informing me that they had detected that our site was down, had determined that it was not the result of an attack, had added some additional traffic filters as a precaution and were continuing to monitor the situation. It was not an automated message, it was from an actual support person who was actually on top of the situation. I immediately emailed them back to let them know the problem was caused by a stupid mistake on my part and to tell them how impressed I was that they were so diligent in monitoring our site. And then I sat down to write this post. I&amp;#39;m just not used to service this good. We pay a lot of money to our dedicated server company for 24/7 support and though they are often good, they don&amp;#39;t come close to the level of service we&amp;#39;ve gotten from dosarrest so far. In fact, our web server company is supposed to be monitoring our server for downtime too, but I didn&amp;#39;t get any messages from them tonight when I took our server down for 15 minutes. Dosarrest was on top of it within a few minutes. My only complaint with dosarrest is that they don&amp;#39;t offer dedicated server hosting because I&amp;#39;d probably bite the bullet and go through all hassles to switch to them for that too. So, in summary, if you are dealing with a DDoS attack on your servers and don&amp;#39;t know what to do, call dosarrest.com. Tell &amp;#39;em Brett Brewer sent you. I won&amp;#39;t say they are cheap, but I will say that if your business lives and dies by its web site, there is no substitute for the kind of service they provide. They are the real deal.  </description>
			<category>News - Web Technology</category>
			<pubDate>Thu, 23 Jun 2011 03:45:06 +0100</pubDate>
		</item>
		<item>
			<title>How to get a Github post-recieve URL hook working on a non-public site</title>
			<link>http://www.brettbrewer.com/content/view/120/45/</link>
			<description>            I&amp;#39;ve been getting cozy with Github lately and I thought I should share my experiences of getting a post-receive URL hook working so that when someone does a git push to my main development repository it will force my dev site to do a git pull to deploy all the latest changes from the repository to the staging server. In my case, I have a fairly secure development server running on a domain that has no public DNS records. This means that to view the site, someone must have the ip-hostname mapping in their computer&amp;#39;s host file. This also means that Github has no way of finding the site to call any post-recieve url scripts to trigger the git pull on the remote site. What follows is a list of everything that needed to be done to make this work.                 First off, if you&amp;#39;re using PHP like me, and your server has the slightest modicum of security, there&amp;#39;s no way you&amp;#39;re going to be able to successfully issue a shell_exec(&amp;#39;git pull&amp;#39;) command via php and have it work because php will only have the priviliges of your web server and chances are your repos and site files are owned by a different user. Enter a nice little apache module called  suphp . I can&amp;#39;t get into the details of how to prperly set up suphp because I had my dedicated server experts do that for me, but assuming you can get that set up so that your staging server serves your development site under the same user that owns the site files and git repos, you can then set up a php script that can successfully do a shell_exec(&amp;#39;git pull&amp;#39;) and have it work. So, assuming you got suphp set up, or you&amp;#39;re running a really insecure setup that allows your webserver user to run shell commands, you can create a php script on your server such as this:          &amp;lt;?php$payload = json_decode(stripslashes(@$_POST[&amp;#39;payload&amp;#39;]));$message = print_r(@$payload,true);$message .= shell_exec(&amp;#39;/usr/bin/git pull&amp;#39;);mail(&amp;#39;me@mydomain.com&amp;#39;,&amp;#39;gihub post receive hook fired&amp;#39;,$message);echo $message;exit;?&amp;gt;             That was my first post-recieve URL hook script. I saved it on my staging domain&amp;#39;s webroot folder and then in the Github admin for my repos, I just entered something like http://my.staging.server.com/Github.php. This worked great so long as my staging domain had a public dns record that allowed Github to find it, but for security reasons I didn&amp;#39;t really want most people having access to the staging server, so I removed the public dns records and just added a hostfile mapping for my domain to my computers so I could browse it like it had a normal dns record. Of course, this broke the Github post-receive url hook. The first thing I thought to do was to ask Github support for a way to map my ip to my staging server in their system so I fired off an email to them to see if they would comply and then immediately thought of a rather simple solution. Github can&amp;#39;t find a site with no DNS records, but it could easily find my server via its ip address. Since my staging server serves some other domains, I couldn&amp;#39;t just give Github the server ip and expect it to find the right domain to call the script on, so I created a new apache config file to handle all requests that don&amp;#39;t map to a specific server. For example if your staging server is on ip address 123.123.123.123, you could create an apache VirtualHost container such as this:          &amp;lt;VirtualHost 123.123.123.123:80&amp;gt;        ServerAdmin me@mydomain.com        ServerName 123.123.123.123        ErrorLog /var/log/default.error        CustomLog /var/log/default.access combined        DocumentRoot /var/www/html       #turn on suphp for this site        suPHP_Engine on        AddHandler x-httpd-php .php .php3 .php4 .php5        suPHP_AddHandler x-httpd-php&amp;lt;/VirtualHost&amp;gt;              This makes any requests to your main ip address look for files in the defaut apache docroot at /var/www/html. The suPHP_Engine directives force the requests for php files to be handled by suPHP so it uses whatever user you&amp;#39;ve got configured for suPHP. There are ways to get suPHP to use different users based on directive you put in the VirtualHost containers, but that&amp;#39;s another story. We only needed one user so we&amp;#39;ve got suPHP configured to always use that user and restricted to only work in certain directories. Securing your system is up to you. So anyway, I threw my post-receive URL php script in /var/www/html and add some things to allow it to update the proper dev site....            &amp;lt;?php  //put your own email address here if you want to receive email updates //when commits happen otherwise leave it blank or set it to false $email =  gitadmin@mydomain.com ; //set $output_message to true if you want to be able to //view the output of the script in a browser $output_message = true; $message =  Github script called on staging server&amp;lt;br/&amp;gt; ; //look for a request var named &amp;#39;site&amp;#39;. This way you could theoretically //have the same script update different sites depending on the site //you pass in when you call the script. $site = isset($_GET[&amp;#39;site&amp;#39;])?$_GET[&amp;#39;site&amp;#39;]:isset($_POST[&amp;#39;site&amp;#39;])?$_POST[&amp;#39;site&amp;#39;]:  ; if($site==&amp;#39;my.staging.domain.com&amp;#39;)else if(!empty($email))if($output_message)exit; ?&amp;gt;             Then for the post-recieve-url hook in Github I used something like this:                 http://123.123.123.123/?site=my.staging.domain.com                 There is an apparently undocumented feature in the Github post-receive-url hook that converts any $_GET vars passed in the url into $_POST vars, so in addition to the  payload  post var you will get any other vars you passed as $_GET vars in your $_POST array. I just included the check for a $_GET[&amp;#39;site&amp;#39;] var in my script so that I can also call the script from a normal request in my browser. The above script obviously provides very little security, but since the domain I&amp;#39;m using it for has no public dns records, there&amp;#39;s not much chance of someone stumbling across it without knowing the site&amp;#39;s IP. Since the script restricts the  git pull  command to running only on the domains specified in the $_GET[&amp;#39;site&amp;#39;] request var, the worst someone could do is update my staging server with the latest code in my repos if they called it with the right site in the request, which is sort of the whole point of the script anyway so that&amp;#39;s not much of a worry. Having the script email me the results every time it runs keeps me informed of what is going on, so if anyone starts messing around with the script it will be hard to miss in my inbox.                 Now all is well in my Github world.      </description>
			<category>Tips &amp; Tricks - PHP Tips</category>
			<pubDate>Tue, 24 May 2011 19:54:32 +0100</pubDate>
		</item>
	</channel>
</rss>

