HTTP/1.1 just got a major update

HTTP/1.1 just got a major update – somehow I missed this last month.

The IETF just published several new RFCs that update HTTP/1.1:

These documents make the original specification for HTTP/1.1 obsolete. As a HTTP geek, this is a big deal.

RFC 2616, which was written more than 15 years ago, was the specification everybody has implemented, and I suspect many of you occassionally have used as a reference.

Burying the URL

Burying the URL

Today, a Canary build of Google Chrome removed something kind of important from the browser: the URL.


Facebook today announced AppLinks, a documented standard for app-to-app linking that has the backing of other big names like Dropbox and Pinterest. While Google is taking the web out of the browser, Facebook is putting the web into apps.

Interesting …

Oracle and PHP – the deadly mix

WI’ve spent most of the last week getting into, around, and out of the issues related to interoperability of Oracle and PHP.  Before you start laughing, cursing, and blaming, Oracle wasn’t my choice of the database for this specific project.  It’s just the company already had it installed and working for the background, and there needed to be some integration with the front, which is of course MySQL and PHP based.

First thing I do, obviously, is visit to check for the prefix of the functions that I need for Oracle.  Through out my experience with PHP, that’s about the only thing I need to know to start working with the new database.  Oh, and the PHP module installed to provide those functions. Oracle interface for PHP is called is called OCI8.  All you need to do now is install the oci8 module.

Here comes the first trouble.  oci8 is not provided as a pre-compiled package for Fedora Linux.  There is an alternative yum repository – Remi, which has oci8 RPMs, but first of all, the oci8 module is compiled against somewhat outdated Oracle headers (version instead of the latest, and it also needs to replace your native PHP and MySQL packages.  I tried that, and it sort of worked, but I wasn’t happy.  So I got my Fedora packages back and decided that I need to compile oci8 myself.

In order to compile oci8, one needs to download Oracle InstantClient (basic package) and some header files (devel package).  These can be downloaded from the Oracle web site, for free, minus the time for the registration.  The little trick here is that during oci8 compilation process, the includes are searched from locations which do not include the one from Oracle RPM.  I did a simple symlink of the includes folder to where Oracle headers were, and compilation went on just fine.  (Hint: otherwise you’ll get a whole lot of Zend related messages and a fatal error).  Gladly, I only had to do this path correction on the Fedora 9 machine.  My production server with Red Hat Enterprise Linux 5 compiled oci8 without any problems all by itself.

Update: more detailed instructions on the actual installation can be found here and here.

Now that oci8 installed and configured, I spent some time figuring the correct way to specify the DSN.   Oracle uses some weirdly name file (tnsnames.ora) in some weird location, but luckily there is a way to go around it.  More so, I recommend that you remove tnsnames.ora file altogether, since it can add to your troubles.  For example, if you mix spaces and tabs as whitespaces in that file, you are screwed.  So, just get rid of it.  The way you specify DSN is directly in the PHP script, and you use the syntax like so:  “//hostname.or.ip:port/dbname“.  Intuitive, I know.

Once you’ll get connected to the server, you have a whole bag of surprises waiting for you.  That is if you are too used to working with MySQL.  First is the syntax.  Oracle is using PL/SQL, so you wipe the dust of from that really old Pascal textbook that you have somewhere.  “begin :result :=, :param2); end;” – that sort of thing.  Secondly, you’ll be happy to know that prepared queries are supported.  So your workflow will slightly change.  Perl programmers will feel more at home here.  oci_bind_by_name() and oci_execute() are your friends here.  Oh, and while you are at, get familiar with the types of the parameters, because they are important.  And don’t forget that you’ll have to bind each and every variable in the query, or get a fatal error. And since you are learning something here, get ready for the oracle errors.  The most frequent one you’ll get would be something like “Failed to retreive the error message for ORA-12345”, where 12345 would be a number of the error.  So you’ll google for ORA-12345 and ORA-54321 and ORA-XYZZZ a lot.  But than you’ll have a wrapper library and you’ll be OK.

Update: as was noted in the comments, PL/SQL is just an option, not a requirement.  Also, most of the headaches of the above paragraph could be avoided by using one of the PHP frameworks.  I personally haven’t yet tried the framework yet, since I’d like to see things working directly first.  Especially since we are not in the test mode only.

The bigger surprise is still waiting for you though.  You are very likely to discover that OCI8 implementation for PHP is very slow.  And I do mean extremely very slow.  I couldn’t believe that it could be slow, so I went into the source code and OMG!  It is really slow.  The slow part is around fetch_all() against fetch_row().  Basically, it’s always row by row and never all, even if you tell it how many rows you need fetched.

In my case, I have the server a bit far away, and there is a possibility to get many rows back.  So even for a simple query with 140 rows in results I was getting 20 seconds execution time.  Oracle was serving results fast, the network was OK, machines on both sides were powerful and all, but it was still taking 20 seconds or more.

I am still trying to find the solution to this issue, but so far it seems that the current way I do it will be the way to do it.  And the way I do it now is the following.  Never ever run direct SQL queries.  Everything goes through a stored procedure.  The results are returned all in a single row.  And that single row has the BLOB (CLOB actually) with all results in one single XML.  Fetching works good enough to get it, and then parsing is done with one of the billion XML parsers for PHP.

In my case MiniXML worked pretty good until bigger results started coming in.  That’s when I learned an important lesson.  MiniXML parses XML with a regular expression.  PHP has a couple of settings in the configuration file that limits the size of the memory and recursion during regex parsing – pcre.backtrack_limit and pcre.recursion_limit.  If you really want to kill your server, set these to -1 (instead of default 100000) and try a regex against a 1 MB XML file.  Enjoy, cause it won’t be long before everything goes down. I didn’t feel like changing from MiniXML so we just implemented some limits in the queries and stored procedures on the Oracle side, and add a few checks in PHP fail rather than crash the system.

So, to some it up, here is my experience with Oracle and PHP from the last week:

  • I had to register on Oracle web site to download packages
  • I had to re-learn my long forgotten compilation skills
  • I had to go read some C
  • I had to step on the “re-inventing the wheel” path more than once
  • I am parsing XML when working with the database
  • I had a head ache more than twice
  • I didn’t have much fun
  • After all, it works.  Sort of.

One last point in this saga is about Googling.  Ask me any question, and I do mean any question, about MySQL.  Heck, even PostgreSQL.  And the answer is just there, on the first page of Google results.  In any human or programming language.  For any operating system.  You’ll be sorted out and working in less then a minute.   Then, try asking even the simplest of the simplest questions about Oracle and PHP.  Sometimes you’ll find something.  Some other times, you won’t.  The overall feeling I have is that not a lot of people are using Oracle with PHP, and those of them who do are in their majority not very happy.

Now I’ve joined the army.

Social Networking – Do you know that you do it?

I came across a brief blog post titled “Social Networking – Do you do it?“.  While the context of the question in that post was more along the lines of “Do you use social networking to promote your products and servers, and drive more traffic towards your site?“, it got me thinking.  And, as usual, in a somewhat different direction.

If we are to ask “Social Networking – Do you do do it?” to a large Internet crowd, what sort of responses would we get?  I guess, the majority will be somewhere in between “No” and “What’s social networking?“.  I think that the majority of people on the Web have no idea of what social networking is, where to find it, and if they are using it already or if they should use it at all.  And I also think that the majority of Web population do use social networking, either for their personal or business purposes.

Examples from the top of my head include – the most popular blogging platform in Russia, Flickr – one of the most popular image sharing services, YouTube – the most popular video sharing service, – the most popular (in Russia) social network for people to find and communicate with their class mates, and a few other, similar services.  A huge chunk of their userbase have no idea that these services are a part of social networking. “Oh, no, I don’t do no social networking.  I use this web site to communicate with some of my friends and share blah blah blah“.

And I’m not sure if we need to push the term “social networking” any further.  We are humans.  That what humans do – social networks.  Give us a communication tool and we’ll start networking with it.  Then, instead of asking us if we use the tool for social networks, just ask us how we use it.  Yeah.

Google Chrome – a new punch in the browser fight

For the last few days, the biggest thing in the technical news is Google Chrome browser (check the comics book, introducing the browser, download beta).  Sure, we had our share of browser wars, and we still do, but this is something completely different.  Most of today’s browsers started back in the days when the Web was totally different.  Since then, some browsers changed more than others.  Some new ones appeared.  But there was no a big break through.  It was mostly an evolutionary approach.

I’m glad to see these big news from Google, that they decided to create a new browser from scratch.  They built it with solutions to many of the today’s problems.  They’ve put some flexbility for the future.  And it seems like they’ve thought a lot about it.

I absolutely support their choice of open source in this matter.  Nobody, not even Google can build a browser that will satisfy everyone and everything, and then keep developing and maintaining it.  That’s not possible with the current state of the Web affairs.  The only way to pull it off is to open source it, so that the Web itself could help them with this mega task.  Also, it’s nice to see that they don’t want to reinvent the wheel either – taking both WebKit (open source web rendering engine) and V8 (open source JavaScript implementation) is smart decision.

It’s nice to see some real competition in the browser world.  Microsoft’s Internet Explorer has changed a lot in the last few years, and the biggest reason for those changes was Mozilla’s Firefox.  Firefox changed a lot too, but it sure could use a push from another open source product.  Google’s Chrome could be exactly that product.

Also, for once it would be nice to see a browser built by someone who knows the Web, and not how to build software.  Yes, browser is a software, but it’s not on its own.  You need to know more and have access to a lot more data to build a good browser.  In particular, what, who, and how uses the Web.  Neither Microsoft, nor Mozilla, nor Opera Software have these information.  Or at least not on the scale that Google has.

And, of course, there always will be downsides to any good initiative.  In the case with Google Chrome, my biggest concern is the situation with themes and extensions.  Firefox has an excellent community in this regard.  This community has built all possible and impossible thems and extensions for practically anyone anywhere.  And it still continues to do so.  Google Chrome starts from scratch, so there won’t be anything for some time.  And since the whole browser thing is new, it’ll need to start with a new set of developers, testers, users, and so on.  And so it will take them some time build that all up.

As with anything, there are a billion of other ways to look at Google Chrome, the way the Web is going, the way Google is going, the way software development in general and IT as a whole is going.  But I’ll leave that up to you.  Here are, however, a few links to get you started.

Longer video? Maybe.

Scobleizer believes in longer videos:

Advertisers also will pay a lot higher rates for those long-form ads.


Because someone who’ll watch a 30-minute video is HIGHLY ENGAGED. They are far more likely to become a customer than someone who just watches a two-minute entertaining video.

I think that “video” is too broad for this topic.  To consider only educational and entertainment videos, I see a huge difference.  I don’t believe that entertainment videos will become longer.   Entertainment is a sort of thing that doesn’t have to go either deep or long.  Thus it doesn’t need large chunks of time.  Educational video is a totally other story.  While there are many “howto” type of videos, many topics require more than 5 minutes to explain.  Take Google Tech Talks for example.  They are pretty popular and each one takes about an hour.

There is also this factor of production costs.  It’s much harder to create 60 minutes of high quality (and I don’t mean pixels or bytes) video material, than 10 minutes.  Or 5.  Filmmakers know that.  And the audience knows that.   While less and less filmmakers will risk it, and more and more of those who do risk it will produce crapy long videos, the audience will learn the benefit of a short video and will be more inclined into choosing shorter formats.

However, since I am not at all involved in any video production or distrubtion, I might be totally wrong on this.  Judging purely from my own experience.  And my own experience mostly comes from YouTube and Google Video.

Toolbox : WordPress, CakePHP, SugarCRM, RT

Over the last couple of years I’ve been working a lot with these four applications – WordPress, CakePHP, SugarCRM, and RT.  Each of these is beautiful in its own way.  Each of these tools is an Open Source Software. Each of these tools has a large community. Each of these tools has a free and commercial support and development. Each of these can be used in a number of ways to solve a whole range of problems.  Let me briefly introduce each one of them.

Continue reading “Toolbox : WordPress, CakePHP, SugarCRM, RT”

Web site awards and trust certifications

Back in the 1990’s, when the Web just got popular, it seemed like every more or less large web site had to have a bunch of awards.   Awards were the first web promotion tricks that I’ve learned of.  Anyone could establish his own award.  All you needed was a little image that looked like a medal or a star.

Awards were demanded by the “big guys” who wanted to show how “special” they were.  And they were often taken advantage of by really small guys, who were making the awards, and used them to promote their own “award giving” web sites.

Then there were so many web awards that nobody cared about them anymore.  And it was quite for some time.

The new wave started with trust certifications.  Lots and lots of people on the web were followed by all sorts of scammers, spammers, crackers, hackers, and what not.  Many got worried and afraid.  So, the certification boom started.  Trust of that, protection of this, guarantee of something, warranty of something else, etc.

Surprisingly, after all these years, so many web sites still use this non-sense.  What is even more surprsing is that so many of them are prepared to pay money (and huge money in some cases) to get the award or certification.   Why?  That’s really beyond me.