- <Lakario> i need a hand with a query. i have two tables- one containing questions and one containing answers. i need to perform a select that will get all of the questions and, if there is an answer, the answers joined to them. Multiple answers can exist to the same question and they are grouped by a ClaimId (so 'WHERE ClaimId = 1415' or whatever). How can I achieve this?
- <CorticalStack> !m Lakario join
- <the_wench> Lakario see http://dev.mysql.com/doc/refman/5.1/en/join.html
- <CorticalStack> Lakario: left join, in fact join
- <Lakario> i know join... but the WHERE ClaimID is the problem
- <Lakario> because it's going to return nothing if there isn't an answer in the answers table
- <CorticalStack> SELECT `t1`.`foo`, `t2`.`bar` FROM `table_1` AS `t1` INNER JOIN `table_2` AS `t2` ON `t1`.`uid` = `t2`.`uid` WHERE `t2`.`feh` = 'somevalue';
- <CorticalStack> Lakario: adapt that example?
- <Lakario> ya that is what i was doing. Nothing returns
This is why I love FLOSS
Cookie free domains for static content
When the browser makes a request for a static image and sends cookies together with the request, the server doesn't have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host all your static components there.
If your domain is www.example.org, you can host your static components on static.example.org. However, if you've already set cookies on the top-level domain example.org as opposed to www.example.org, then all the requests to static.example.org will include those cookies. In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free.
Storing Drupal Sessions in Memcache
Drupal tries to cater to 80% of the market by taking most decisions for you. Generally this is a good idea. But if you fall in the remaining 20% then you need to get your hands dirty and start hacking around. Drupal by default stores all sessions in the database. This is a good idea if your site does not get a lot of load. But as your site starts growing, this will soon become a major bottleneck. Storing sessions in memcache works best in such situations. Not only is memcache easy to maintain, install and work with, but also provides in depth stats about itself. This is very handy if your planning on monitoring memcache using nagios or zabbix for example.
Drupal adds LOWER() to column names when doing a SELECT
I have been playing a lot with Drupal lately. I must say it does feel weird getting back to PHP after so much Ruby; but it is a refreshing change. One of the the things I noticed is that Drupal 6 adds a LOWER() to the column names when it does a select. Not that this is bad but then it confuses MySQL, and instead of using the "name" index it runs through the entire database. This is not a issue if your site has a few hundred users. But now consider a site that has about 5 million users (which is what I am dealing with)
I just finished hacking up this patch, that prevents it from adding the LOWER() to the column names. This boosted something as simple as the login process from 5 seconds to milliseconds. 5 seconds may not sound a lot to you; but then I use a Dell 1950 as my development box. Not that it is the best box in the world, but it is pretty powerful.
Simple RAID Cheat Sheet
| Level | Redundancy | Disk Required | Faster Reads | Faster Writes |
| RAID 0 | No | N | Yes | Yes |
| RAID 1 | Yes | 2 | Yes | No |
| RAID 5 | Yes | N+1 | Yes | No |
| RAID 10 | Yes | N*2 | Yes | Yes |
| JBOD | No | N/A | No | No |
Corruption in India (Delhi, Rajisthan, Madhya Pradesh)
1/3 MLA in Delhi has a criminal charge
1/6 politician in Madhya Pradesh has a criminal record
1/9 politician in Rajisthan has a criminal record
Some people with charges
- Phoolan Devi
- Shibu Soren
- Sadhu Yadav
Gmail now supports Themes
Google launched themes some time back. They really seem to be on a roll with Gmail. First we get audio video chat, now this. I did not face much of a speed difference. Right now they have about 30 themes to chose from. I think I am going to stick to my clean and simple UI from the past.
Here are some screenshots:








