MongoDB + MySQL with Doctrine 2. Example of listener to maintain redundant data (alternative to joins)

If you are developing an application with MongoDb, sooner or later you will face the need of solving a query that involves more than one collections (or a MongoDB collection with a MySQL table). In this case, an SQL join operation won’t be available.

If you have a small amount of data, you can perform two MongoDB/MySQL queries and then join the results at the application level, but – depending on your needs – that could be not feasible or turn out to be inconvenient. A possible better solution for that could be redundancy.

Example
Continue reading

97 things every programmer should know: personal notes

Last month I saw a book flying about the office, containing useful tips from developers. 97 suggestions from experienced developers. Amazon is still selling it, so I suggest you read it if work as a software developer or you occasionally dip into coding: 97 Things Every Programmer Should Know: Collective Wisdom from the Experts

I’ve finished reading it, and I took some notes while reading. Some concepts and suggestions were obvious, as I hear them many times from the community (blogs, conferences, colleagues) or I’ve already personally experienced them. I’ll paste those my notes here, with the hope that you can find something valuable from looking through them.

Continue reading

Startup notes

Interesting article shared by some colleagues. If you work for a startup I’m sure you’ll find truth in most of the points the post raises. I’ll share some parts of it.

Don’t waste your time in crappy startup jobs. « Michael O.Church

Startups often involve, for engineers, very long hours, rapidly changing requirements, and tight deadlines, which means the quality of the code they write is generally very poor in comparison to what they’d be able to produce in saner conditions. It’s not that they’re bad at their jobs, but that it’s almost impossible to produce quality software under those kinds of deadlines

The result of this is that the engineer’s job isn’t to build great infrastructure that will last 10 years… because if the company fails on the marketing front, there will be no “in 10 years”. The engineer’s job is to crank out features quickly, and keep the house of cards from falling down long enough to make the next milestone. If this means that he loads up on “technical debt”, that’s what he does.

A competent manager can do a lot for a person’s career that he wouldn’t realistically be able to do on his own. Still, the idea that joining a startup means not having a boss is just nonsense.

Git rebase and remote operations

Taken from http://git-scm.com/book/

When you rebase stuff, you’re abandoning existing commits and creating new ones that are similar but different. If you push commits somewhere and others pull them down and base work on them, and then you rewrite those commits with git rebase and push them up again, your collaborators will have to re-merge their work and things will get messy when you try to pull their work back into yours.

NoSQL and MySQL notes

NoSQL: If Only It Was That Easy at Marked As Pertinent

What am I going to build my next app on? Probably Postgres. Will I use NoSQL? Maybe. I might also use Hadoop and Hive. I might keep everything in flat files. Maybe I’ll start hacking on Maglev. I’ll use whatever is best for the job. If I need reporting, I won’t be using any NoSQL. If I need caching, I’ll probably use Tokyo Tyrant. If I need ACIDity, I won’t use NoSQL. If I need a ton of counters, I’ll use Redis. If I need transactions, I’ll use Postgres. If I have a ton of a single type of documents, I’ll probably use Mongo. If I need to write 1 billion objects a day, I’d probably use Voldemort. If I need full text search, I’d probably use Solr. If I need full text search of volatile data, I’d probably use Sphinx.

Which is faster: MySQL or MongoDB? Does it depend on the use case? – Quora

To me, the Mysql vs MongoDB benchmarks are revealing as they show that with beefy hardware, a NoSQL engine does not have to be faster than a well indexed Mysql Table, which might seem the case.

 

MySQL became the most popular relational database on the planet by turning its weaknesses into strengths and successfully leveraging its ubiquity.

 

It would be foolish to predict the same success that MySQL enjoyed for MongoDB, because the underlying market context has changed.

Know your framework !

I agree with this article

you need to know your framework before saying that is fast or not. If you need to save some ms (if that helps, does it ?), profile and optimize. With some simple optimization (the one in the article + apc cache of conf files if you have them) you can easily dispath a ZF route in < 30 ms. Now, do you really need it to save more ms ? profile the whole system, probably your bottleneck are other things, inside and outside your server

PHP Framework Benchmarks: Entertaining But Ultimately Useless | Pádraic Brady

To create a positive benchmark, you need to understand that all frameworks were born as festering piles of unoptimised stinking crap. They were all born bad and get worse with age. This sounds quite sad, but actually it’s an inevitable compromise between performance and features. It’s also a compromise between performance and ease-of-use. So you see, performance is unfairly faced by two opponents: features and ease-of-use. All performance is sacrificed in the name of serving the needs of rapid development, flexibility, prototyping, and making your source code look prettier than the other guy’s. As if.

idbdata problem with MySQL

How to shrink/purge ibdata1 file in MySQL – Stack Overflow

That ibdata1 isn’t shrinking is a particularly annoying feature of MySQL. The ibdata1 file can´t actually be shrunk unless you delete all databases, remove the files and reload a dump. But you can configure MySQL so that each table, including its indexes, is stored as a separate file. In that way ibdata1 will not grow as large. It was a while ago I did this. However, to setup your server to use separate files for each table you need to change my.cnf in order to enable this: [mysqld] innodb_file_per_table=1