Archive for the 'php' Category

Write to an Airtable with PHP

Feb 21st, 2022

Lately I’ve been rediscovering the joy of PHP. Also been helping an MVP get off the ground which uses a lot of nocode/lowcode bits and pieces and miraculously puts them together. Anyway, I had to write to an Airtable table with PHP and some quick googling didn’t find an example to copy-paste so I’m writing […]

 

How to write unmaintainable PHP code [2009]

Sep 18th, 2015

Originally published at http://phpadvent.org/ in 2009. The site is no more, but I found a copy on my hard drive. I’m not sure but I do hope it’s the final version because Sean Coates (@coates) and Chris Shiflett (@shiflett) did a really nice job editing the pice. Also hope it’s still funny… With the unemployment […]

 

Server-side React with PHP – part 2

Sep 19th, 2013

Part 1 ended with todos. The first one was to couple the server-side generated code with the client-side React, so that any updates past the initial page load will be handled by React’s client JS, which is where React shines. Let’s see how you can do just that. PHP data fetch, gluing JS for v8 […]

 

Server-side React with PHP

Sep 13th, 2013

Problem: Build web UIs Solution: React Problem: UI built in JS is anti-SEO (assuming search engines are still noscript) and bad for perceived performance (blank page till JS arrives) Solution: React page to render the first view Problem: Can’t host node.js apps / I have tons of PHP code Solution: Use PHP then! This post […]

 

Installing v8js for PHP on a Mac

Sep 11th, 2013

Motivation? Run JS code inside PHP. Just… because 🙂 I struggled for a while with this installation, so leaving a trail here for anyone looking. What you need to accomplish? Goal: run JS code inside a PHP script running on a webserver. Already accomplished: Macs come with a webserver (Apache) and PHP. To get there: […]

 

JavaScript-style object literals in PHP

Mar 20th, 2011

The object literal notation in JavaScript looks like: var fido = {name: "Fido", barks: true}; or var fido = {}; fido.name = "Fido"; fido.barks = true; From assoc arrays to objects In PHP you would call that an associative array. $fido = array( ‘name’ => "Fido", ‘barks’ => true ); And you can easily make […]

 

Automating HTTPWatch with PHP #3

Mar 7th, 2011

The first part is here, the second is here. This third post is more about PHP and COM, rather than HTTPWatch or monitoring web performance, so feel free to skip if the title mislead you 🙂 Keep reading if you want to use and improve/update my HTTPWatch class in the future. The problem After running […]

 

Automating HTTPWatch with PHP #2

Mar 7th, 2011

In part 1 I demonstrated how you can use PHP to script and automate HTTPWatch. And how you can get data back, either reading the API docs or using a quick HAR hack to get a lot of data in one go. Now I want to share a little class I wrote to make all […]

 

Automating HTTPWatch with PHP

Mar 5th, 2011

HTTPWatch is a nice tool to inspect HTTP traffic in easy and convenient way and it works in both IE and FF now. Drawback – windows-only and paid. But the free version is good enough for many tasks. HTTPWatch can be automated and scripted which is pretty cool for a number of monitoring-like tasks. Their […]

 

Reducing the payload: compression, minification, 204s

Dec 11th, 2009

2010 update: Lo, the Web Performance Advent Calendar hath moved Dec 11 This post is part of the 2009 performance advent calendar experiment. Stay tuned for the next articles. After removing all the extra HTTP requests you possibly can from your waterfall, it’s time to make sure that those that are left are as small […]

 

Collecting web data with a faster, free server

Dec 8th, 2009

2010 update: Lo, the Web Performance Advent Calendar hath moved Dec 8 This article is part of the 2009 performance advent calendar experiment. This is also the first ever guest post to this blog. Please welcome the world-famous Christian Heilmann! And stay tuned for the next articles. Chris Heilmann is a self confessed data junkie […]

 

Data URIs, MHTML and IE7/Win7/Vista blues

Dec 7th, 2009

2010 update: Lo, the Web Performance Advent Calendar hath moved Dec 7 This is the seventh in the series of performance articles as part of my 2009 performance advent calendar experiment. Stay tuned for the next articles. UPDATE: While this post is an interesting study, the problem it solves turns out to be much simpler. […]

 

Performance tools

Dec 2nd, 2009

2010 update: Lo, the Web Performance Advent Calendar hath moved Dec 2 This is the second in the series of performance articles as part of my 2009 performance advent calendar experiment. Stay tuned for the next articles. While theoretically you can speed up your site by just blindly following advice from this blog and other […]

 

Installing PHP and Apache on Mac OSX – that was (pretty) easy

Mar 7th, 2009

This posts is one of those “note to self” kinda posts. I just finished installing PHP and Apache on my Mac OS 10.5.6 and though I should document the experience should I (or you) need to do it again. It could already be there The default OS install came with goodies like ruby and php […]

 

image diff

Nov 15th, 2008

Was having fun today with idiff.php – a PHP shell script to tell you if two images are visually different by comparing them pixel by pixel. If there’s a difference, the script creates a third image – black background with the different pixels in green. Only after writing the script I found that there’s an […]

 

Best open-source PHP CMS 2008

Oct 26th, 2008

It’s that time of the year again. Time to cast my vote as part of the jury in Packt’s open-source awards, category “PHP CMS”. (for my last year’s rant, check the internet archive copy) How to judge a CMS? How to judge a CMS? Tough one. How do you judge any piece of software anyway? […]

 

php|works and pyWorks

Sep 10th, 2008

I’ll be speaking at the php|works and pyWorks conferences in Atlanta, Georgia in November, they’ll be held together and there is a central track that has topics of interest to both phpiers and pythonistas, this is where I come in. The conference(s) schedule is here and this is me: “Image optimization for the web”

 

My online footprint lately

Jul 23rd, 2008

This is a sort of a catch-up post for listing what I’ve been up to lately. YUI Blog just published my first article, I’m so proud. It’s about loading JavaScript in non-blocking fashion, because JavaScripts, they, you know, like, block downloads. Luckily, there’s an easy fix – DOM includes, which I’ve previously discussed, discussed and […]

 

www vs no-www and cookies

May 13th, 2008

One of Yahoo’s performance rules says: Use cookie-free domains for static components. This is good because the server has no use for cookie information when serving a JPEG or another static component, so all this cookie information creates network traffic for no reason. One of the implications of following the rule is related to the […]

 

strftime() in JavaScript

Apr 25th, 2008

Philip “Bluesmoon” Tellis has posted a tiny (under 3K minified) JavaScript library to format dates, inspired by PHP’s strftime() Examples: d.strftime(‘%Y/%m/%d’) » en: 2008/04/25 » fr: 2008/04/25 » de: 2008/04/25 d.strftime(‘%A, %d %B’) » en: Friday, 25 April » fr: Vendredi, 25 Avril » de: Freitag, 25 April There’s also a demo to fiddle with. […]

 

Simultaneuos HTTP requests in PHP with cURL

Feb 19th, 2008

The basic idea of a Web 2.0-style “mashup” is that you consume data from several services, often from different providers and combine them in interesting ways. This means you often need to do more than one HTTP request to a service or services. In PHP if you use something like file_get_contents() this means all the […]

 

Fancy formatting

Dec 21st, 2007

Writing readable code means proper indentation. Usually you’d tab (or use 2 or 4 or 3 spaces) after every curly bracket. Something like this: if (true) { // indent if (false) { // another indent // and some more } } Same goes when you have a bigger hash/object sort of thing: var memememe = […]

 

Image fun with PHP – part 2

Nov 13th, 2007

This post is a demo of what the imagefilter() PHP function can do for you. The Original imagefilter() called with different filter constants Filter: IMG_FILTER_BRIGHTNESSCode to reproduce: <?php $image = imagecreatefrompng(‘nathalie.png’); imagefilter($image, IMG_FILTER_BRIGHTNESS, 5); imagepng($image, ‘img_filter_brightness_5.png’); imagedestroy($image); ?> Filter: IMG_FILTER_BRIGHTNESSCode to reproduce: <?php $image = imagecreatefrompng(‘nathalie.png’); imagefilter($image, IMG_FILTER_BRIGHTNESS, 50); imagepng($image, ‘img_filter_brightness_50.png’); imagedestroy($image); ?> Filter: IMG_FILTER_BRIGHTNESSCode to reproduce: <?php $image = imagecreatefrompng(‘nathalie.png’); imagefilter($image, IMG_FILTER_BRIGHTNESS, 100); imagepng($image, ‘img_filter_brightness_100.png’); imagedestroy($image); […]

 

Maui, PHP Quebec, etc

Nov 9th, 2007

Aloha, I’m back from a family vacation in Maui, HI, feeling rejuvenated after having fun on some nice beaches with crystal water, seen an ex-volcano, sunsets, etc. An email from PHP Quebec was in my inbox saying I’ll be speaking at the 2008 PHP Conference in Montreal. Isn’t that great?! I’ll have a chance to […]

 

JS/PHP string concatenation mistype

Oct 25th, 2007

Another one from the “this is not a syntax error” department. The front-end developer is a strange beast who has to jiggle to and fro and code in several languages literally at the same time – javascript, html, css, php or some other server side language, some SQL dialect… No wonder that sometimes we make […]