Posted by robeano on July 4, 2007 at 2:35am
Start:
2007-07-19 18:00 - 20:00 US/Pacific We're meeting Thursday (7/19) at 6 pm PST.
Location:
Espresso Vivace
227 Yale Ave N.
Seattle, WA 98109
We'll be discussing:
* Drupal Camp (wrap-up, questions, comments, ideas for next year)
* Let's take our DUG to the next level: work on a project for a local nonprofit?
* Questions
* Announcements
Post other topics as comments to this event. Also a quick "I'll be there" comment would be great too.
Comments
Should be able to make it
Walk down there from work all the time anyways!
Sadly now looks like I won't
Sadly now looks like I won't be there, hope it goes well
I will be there
Looking forward to hearing how Dupal Camp went. Will there be some video for me to edit? I saw some streaming and it looked good.
-jared
I'll be there.
I'll be there.
Beverage Bounty for Dupes Code
I am offering a Beverage Bounty* to anyone who can provide an efficient SQL select/update statement to find duplicate records in a content type and update a CCK count field if dupe count > 1. (*Any beverage of your choice: beer, coffee, HeySong Sarsaparilla, etc.)
Before updating the count fields, any count field greater than 1 should be set to null.
Bonus points: The SQL should run in a PHP file and provide screen output in test mode. PHP file to run on demand or via cron. To make it easier, test mode can be turned on/off with a code patch and database updates with similar on/off code patch.
Bonus points: SQL select should cause minimal load, so outputting run time is helpful. (I have a web host who frowns on long sessions and will shut down the offending process with directory chmod.)
Example screen output in test mode, where dupes are zip codes:
Drupal Application: After I batch update the dupe counts, I will View List duplicates by filtering on the count field.
========================================
I used this PHP/SQL code on 1000+ Drupal records and it got shutdown by the web host admin after running it 3 times:
==============================
Here are two references I found which might be helpful:
http://dev.mysql.com/doc/refman/5.0/en/select.html
Posted by Paul Montgomery on August 13 2005 8:06am
http://www.delphifaq.com/faq/delphi/database/f20.shtml
=================================
John Walling
wallingconsulting @ yahoo .com
Update duplicates
I posted my problem here for solutions:
http://www.phpfreaks.com/forums/index.php/topic,149025.0.html
I am getting some feedback. If you have SQL experience, please join in.
John
Finding duplicates - on the road again
I decided updating duplicates is not the best choice for now. Instead, I am providing Drupal search links for discovered matches. I made 4 match searches to increase the chances of finding unintended duplicates in a large and growing database.
1 Resource ID - Duplicate Matches
2 Org Name + Org City - Duplicate Matches
3 Web URL - Duplicate Matches
4 Org Name - Duplicate Matches
To see it in action go here:
http://www.disasterassistancenetwork.com/drupal-dupes/duplicate_match.php
HTML/PHP/SQL for match #2, an example of hacking for the complete idiot:
Note: Replace the word 'asterisk' with the single character.
<table>
<?php
echo '<tr><td colspan="3" CLASS="darkrow"><b>Org Name + Org City</b> - Duplicate Matches</td></tr>';
echo '<tr><th WIDTH="10%">NID<em></th><th WIDTH="60%">Organization</th><th>City</th></tr>';
set_time_limit(10);
$time_start = microtime(true);
$space = " ";
$plus = "+";
if ($db = @mysqli_connect('localhost', 'userid', 'password')) {
mysqli_select_db($db, 'drupal_db');
$result = mysqli_query($db, 'SELECT nid,field_org_name_value,field_org_city_value,count(asterisk) AS total FROM content_type_resource GROUP BY field_org_name_value,field_org_city_value HAVING COUNT(asterisk)>1');
while ($row = mysqli_fetch_object($result)) {
$nid = htmlspecialchars($row->nid);
$name = htmlspecialchars($row->field_org_name_value);
$city = htmlspecialchars($row->field_org_city_value);
$name2 = str_replace($space, $plus, $name);
$city2 = str_replace($space, $plus, $city);
$name = '<A HREF=http://www.disasterassistancenetwork.com/drupal/search/node/
...%22'.$name2.'%22+%22'.$city2.'%22+type%3Aresource
...TARGET=_blank>'.$name.'</A>';
$nid = '<A HREF=http://www.disasterassistancenetwork.com/drupal/node/'.$nid.' TARGET=_blank>'.$nid.'</A>';
$name = $name.' ('.$row->total.')';
printf(
'<tr><td>%s</td><td>%s</td><td>%s</td></tr>',
$nid,
$name,
$city
);
}
mysqli_close($db);
$time = microtime(true) - $time_start;
$time = round($time,4);
echo '<tr><td colspan="3"> </td></tr>';
echo '<tr><td colspan="3"><i></em>NID links to 1 of 2 or more duplicate matches</i></td></tr>';
echo '<tr><td colspan="3">Run time: '.$time.' seconds</td></tr>';
} else {
echo '<tr><td colspan="3">Connection failed.</td></tr>';
}
?>
</table>
Asterisks converted to em tags
Caveat lector: I saw more cases of asterisks converted to
<em>em tags</em>in my previous post of php code. There is something quirky going in the Drupal code text parser.workGroup
at the July DUG meeting there was discussion about meeting for a couple hours before the next meeting to have a little co-work time. I am wondering if there might be any interest in setting up a co-work afternoon or early evening before the date of the next meeting. if you are interested please reply here and we could set it up- maybe 3-5 some afternoon next week @ Vivace?
thanks
-jared