Google vs. Oracle : API vs. implementation

Slashdot is running the story about the Google vs. Oracle court case.  I thought this bit was rather brilliant:

Schwartz’s second attempt at the breakfast menu analogy went much better, as he explained that although two different restaurants could have hamburgers on the menu, the actual hamburgers themselves were different — the terms on the menu were an API, and the hamburgers were implementations.”

Really, FairSearch?

Apparently, there is a new kid on the block – FairSearch.org. Here is a quote from their About page:

FairSearch.org is a group of businesses and organizations united to promote economic growth, innovation and choice across the Internet ecosystem by fostering and defending competition in online and mobile search. We believe in enforcement of existing laws to prevent anticompetitive behavior that harms consumers.

Further down on the same page is the list of companies involved.  Among them, some of those that should not even be allowed to use the word ‘fair’: Microsoft, Oracle, Nokia.

So, this bunch of clowns (my apologies to the clowns) tried and failed to control the web search and the mobile markets, and now they are trying to bring Google down by joining their forces and attempting a government campaign.  Pathetic!  Here is what they write to the EU:

Google’s Android is the dominant smartphone operating system, running in 70% of units shipped at the end of 2012, according to Strategy Analytics. Google also dominates mobile search advertising with 96% of the market, according to eMarketer. The complaint says Google uses deceptive conduct to lockout competition in mobile.

“Google is using its Android mobile operating system as a ‘Trojan Horse’ to deceive partners, monopolize the mobile marketplace, and control consumer data,” said Thomas Vinje, Brussels-based counsel to the FairSearch coalition. “We are asking the Commission to move quickly and decisively to protect competition and innovation in this critical market. Failure to act will only embolden Google to repeat its desktop abuses of dominance as consumers increasingly turn to a mobile platform dominated by Google’s Android operating system.”

FairSearch is an international coalition of 17 specialized search and technology companies whose members include Expedia, Microsoft, Nokia, Oracle, and TripAdvisor.

Google achieved its dominance in the smartphone operating system market by giving Android to device-makers for ‘free.’ But in reality, Android phone makers who want to include must-have Google apps such as Maps, YouTube or Play are required to pre-load an entire suite of Google mobile services and to give them prominent default placement on the phone, the complaint says. This disadvantages other providers, and puts Google’s Android in control of consumer data on a majority of smartphones shipped today.

What a load of bollocks!  Google Android devices aren’t all built by Google.  In fact, the majority of Android devices are shipped by other companies.  Are all of them producing below the cost?  Of course not.  That would just be stupid.   Secondly, Android is very much based on the Open Source Software, Linux and such.  I’m guessing that’s one of the main reasons it grows so fast and is cheaper to make.  Microsoft, Nokia, and Oracle are well-known foes of Open Source.  But guess what, it’s not up to them anymore.  People vote with the wallet.  The choice is here, and people can finally buy the devices that they like, not the ones that are being shoved down their throats.

And as far the as the web search goes, that’s even more pathetic of a subject than mobile.   Just build a better search engine and people will switch over.  It takes nothing, absolutely NOTHING, to use a different search engine. But the truth is, Google is by far superior search engine to Microsoft’s Bing or anything else that popped up recently.  Result manipulation my a$$.  If people who use the search engine will lose trust in the results, they’ll just leave.  But as long as it works, who cares really?

OpenOffice vs. LibreOffice?

OpenOffice vs. LibreOffice?

CyberNet News has a nice coverage of StarOffice / OpenOffice.org / LibreOffice history.

  • August 1999 – Sun Microsystems buys a company (StarDivision) and gets StarOffice.
  • October 2000 – An open source version of StarOffice, called OpenOffice.org, was released.
  • … almost 10 years goes by with several major and successful OpenOffice.org releases.
  • January 2010 – Oracle buys Sun Microsystems.
  • September 2010 – Some members that worked on OpenOffice.org started “The Document Foundation” due to concern over the future of OpenOffice.org now that Oracle owns it. The concerns were understood since Oracle took the OpenSolaris project, which had been around for nearly 20-years, and discontinued open development of it.
  • January 2011 – OpenOffice.org 3.3 released.
  • January 2011 – LibreOffice 3.3 was released (based on OpenOffice.org 3.3). This is the first stable version of the product.
  • April 2011 – Oracle announces that it will no longer be supporting development of OpenOffice.org.
  • June 2011 – Oracle announces that they will contribute OpenOffice.org (the trademark and the code) to the Apache Software Foundation.
  • June 2011 – LibreOffice 3.4 released.
  • February 2012 – LibreOffice 3.5 released.
  • May 2012 – Apache OpenOffice 3.4 released. Note that it’s not called “OpenOffice.org” anymore, and is instead called “Apache OpenOffice”.

Who is suing who in the mobile phone industry?

GigaOm links to an excellent visualization of smartphone patents’ legal battles.  It’s interesting how different is the representation of Apple and Google on this graph.  However, one needs to remember, that Google has acquired Motorola’s mobile division.

 

This seems to be a nice update to another graph that I’ve posted a couple of years ago.  Some of the lawsuits from the old chart are still here.  And there is a whole bunch of new ones.  I like this new updated one better than the old one, because company logos make it more readable. And this one also has references to the actual lawsuits, in case someone wants to follow.

Who’s next in the long list of Oracle acquisitions?

ERP Software Advice has an interesting summary of Oracle’s mergers and acquisitions for the last few years.  Here is an excellent graphical representation:

But not only that.  They are trying to figure out who is the next in line.  If you have an opinion on this matter – vote in their poll.  If you don’t – check the article anyway – it’s pretty cool.

As for me, I am not that well familiar with Oracle’s business, but judging by a few comments here and there, one company that they won’t buy anytime soon is EMC.  If I remember correctly, because there is some personal affair going on.  Or maybe that’s just all rumors and my misunderstanding of it all.

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 PHP.net 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 10.2.0.4 instead of the latest 11.1.0.1), 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 := some.procedure.call(:param1, :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.