On one of my current projects, I am adding alternating shading (”zebra striping”) to rows in a table with javascript. This last week I encountered a scenario where I needed this to work on a table that had some cells that spanned multiple rows.
My current script could not handle this as it was using jQuery’s :odd selector and I now needed to stripe all of the spanned rows together instead of just every other one. The additional shading that I was applying when hovering over the row was also broken as it too needed to shade all of the spanned rows instead of just the one the mouse was over.
So, I enhanced my script to work with both scenarios. I hope it can be of use to someone.
// check for rowspans rows = $('.datatable > tbody > tr:first > td:first').attr('rowspan'); var rows_count = rows * 1; // if, shade spanned rows; else, shade for every other row if(rows_count > 1) { // find the row group leader function rgl(who) { var current = who; for(i = 0; i < rows_count; i++) { if($(current).find('td:first').attr('rowspan') > 1) { var rgl = current; break; } current = $(current).prev('tr'); } return rgl; } // row shading for(r = 1; r <= rows_count; r++) { var nth = (rows_count * 2) + 'n+' + (rows_count + r); $('.datatable > tbody > tr:nth-child(' + nth + ')').addClass('odd'); } // row hover shading $('.datatable > tbody > tr').hover( function() { var who = rgl(this); for(i = 0; i < rows_count; i++) { $(who).find('td').toggleClass('hover'); who = $(who).next('tr'); } }, function() { var who = rgl(this); for(i = 0; i < rows_count; i++) { $(who).find('td').toggleClass('hover'); who = $(who).next('tr'); } } ); } else { $('.datatable > tbody > tr:odd').addClass('odd'); }
I’m very pleased to announce the topic for November’s UPHPU Meeting : Streamlined Web Development using a VNC and Trac.
Starting the meeting off will be Code Greene’s Kevin Carter. Kevin, who has used Git in a production environment for several months now, will be presenting a primer on how to get started with Git. Additionally, he’ll cover the advantages of distrusted source code control and possibly some topics on using git in an svn eniroment. His blog can be found at http://dexterthedragon.com.
Following Kevin will be are main speaker, Justin Carmony. His presentation will focus on the unique challenges with developing, deploying, & managing Website development. Justin Carmony has put together his trips, tricks, and suggestions for streamlining the development cycle. With a focus on automation, using SVN and Trac allows developers to focus on development rather than redundant tasks. Whether a small project with a single developer, or a large project with a big team, SVN and Trac in a LAMP environment can help any developer. Time permitting he will show some of his own live examples of using SVN & Trac. If you have a specific topics or questions you would like addressed in his presentation, please feel free to let him know on his blog.
Justin Carmony has worked in web development professionally for the last four years. With emphasis on PHP, .NET, and Web Services, he has worked on projects ranging from simple websites to complex communications between thousands of remote systems. He currently is working as an independent contractor & private consultant. If you have any questions, comments, or curiosities you can contact him (justin AT justincarmony DOT com) or read about his latest endeavors at his blog (www.justincarmony.com/blog).
We will have streaming as usual and slides will be posted early.
This page isn’t updated yet, but it will be the day before the meeting, and is where the slides will be available:
http://uphpu.org/live-meeting/
Mindjuju / victor
I am pleased to announce that the job announcement form on the website no longer requires the user to be logged in. This is significant as most people posting job announcements are managers, human resources staff, or recruiters and therefor have no reason to have an account. If you are someone that only created an account to post a job, please send me a note so that we can remove your profile.
Any other cyclists out there? You a chainlove junkie too? After finding myself spending too much time refreshing and refreshing, I wrote the following script to watch the site for things I was interested in and send me a text message when they come up. I put it on my machine that’s always on and scheduled it to run every ten minutes with launchd. Hopefully it will save you a little time and sanity as well. (Note the wrapped lines.)
/* * CHAINLOVE ALERTS * * This script scrapes chainlove.com and sends an email when words in * the "watch list" are included in the current product offering. */ // list of words to watch for $watch_list = array('sunglasses', 'warmers', 'jersey', 'giordana'); // cache file (including path) $cache_file = '/tmp/chainlove_alerts.cache'; // scrape page $ch = curl_init() or die(curl_error()); curl_setopt($ch, CURLOPT_URL, "http://www.chainlove.com"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $page = curl_exec($ch) or die(curl_error()); curl_close($ch); // pull out the product details preg_match('/<h1 id="item_title">([^<]+)<\/h1>.*<h3 class="price"> ¬ ([^<]+)<\/h3>.*<div id="regular_price">\n*\t*\s*([^<]+)<br \/> ¬ \n\t*\s*([^<]+)<\/div>/sm', $page, $matches); // compare current product against cache product... if same, exit if(!file_exists($cache_file)) { file_put_contents($cache_file, trim($matches[1])); } else { $cache_product = file_get_contents($cache_file); if($cache_product == trim($matches[1])) { exit(); } else { file_put_contents($cache_file, trim($matches[1])); } } // search current product title with "watch list" $send_mail = 0; foreach($watch_list as $watch_item) { if(stripos($matches[1], $watch_item)) { $send_mail++; } } // send email if($send_mail > 0) { $mail['to'] = '8015551212@txt.att.net'; $mail['subject'] = trim($matches[1]); $mail['message'] = trim($matches[2]) . ' (' . trim($matches[3]) . ', ' . trim($matches[4]) . ')'; $mail['from'] = 'Chainlove Alerts <user@example.com>'; $mail['additional_headers'] = 'From: ' . $mail['from']; mail($mail['to'], $mail['subject'], $mail['message'], ¬ $mail['additional_headers']); }
Greets codepoets, bloggers, sysadmins, dbas and other citizenry of the net populous!
The October UTOS / UPHPU Geek lunch will be held at The Happy Sumo at the Gateway on THURSDAY, October 9th, 1pm.
Please RSVP.
The Happy Sumo
153 S Rio Grande St. Salt Lake City, UT
tele 801.456.7866
mj/v
For our October meeting, Ryan Stewart, a technical evangelist with Adobe will present on AMF and Flex. Rich Internet applications (RIAs) are everywhere. With Web businesses like Google and Yahoo! and brick and mortar companies like Harley Davidson and Sherwin Williams embracing RIAs for their online presence, the media buzz is giving way to the reality of a better Internet.
Adobe has recently contributed AMF support to the Zend Framework, allowing PHP developers to easily build Rich Internet Applications using Flex and Adobe AIR that interact with a PHP backend.
Ryan will give an introduction to Adobe Flex and Adobe AIR, and will walk through how to create a Flex application powered by PHP and the Zend Framework. Working with Zend Studio for Eclipse, and Flex Builder (an Eclipse plugin), Ryan will demonstrate how to build, debug and deploy applications built with Adobe Flex, and how to have these same applications run on the desktop using the Adobe AIR runtime.
With this knowledge, developers will be able to easily build rich Internet applications that combine data from PHP and rich media like audio and video into a compelling application.
September’s meeting is going to be on PHP and PostgreSQL. That’s NEXT Thursday at 7p.
Databases play an integral part of what we do as PHP programmers. Using the right database and schema is critical to scalability and what functionality we can offer our clients.
For this meeting we will have 2 speakers, Joseph Scott and Joshua Tolley. Joseph will be focusing on using Postgres in a PHP environment. Joshua will be presenting on “that other open source database”. His presentation will cover several interesting and useful PostgreSQL features that make it an excellent choice for situations that would often include MySQL or another database. It will also address common misconceptions about PostgreSQL, as well as some of its deficiencies. Time permitting, the presentation will demonstrate getting started with PostgreSQL.
Ray Hunter of Toro Systems will be sponsoring this meeting along with swag from the UTOS conference. Heck, might even throw in a week long guest pass for Team Fortress 2.
Last but not least, if for nothing else, come join us for the UPHPU afterhours party at Applebees after the meeting. We usually get there around 8:45 and stay until 1a or so.
Details:
18 Sept. 2008, 7:00 PM
Bill Good Marketing
12393 Gateway Park Place Suite 600
Draper, UT 84020
Greets All,
We are postponing our August meeting for one month so that we can focus on the Utah Open Source Conference on August 28 – 30. This year’s conference topics look really solid with many national and community level speakers including:
- Paul Frields (Red hat, Inc) - KEYNOTE: Fedora: The Future, First
- Joe Brockmeier (Novell) - KEYNOTE: How to bootstrap a community
- Matt Asay (Alfresco) - The Billion Dollar (Free) Software Opportunity
- Mac Newbold (Code Greene) - Local Keynote: How To Leverage Open Source in a For-Profit Business
- Jared Smith ( co-author of O’Reilly’s Asterisk: The Future of Telephony) - Dialplans for Dummies: An Introduction to the Asterisk Dialplan
- Joseph Scott (Automattic) - WordPress Performance and Scalability
These are literally, just a handful of an awesome lineup of speakers. Having participated last year and this year, I can tell you Clint Savage and the UTOS foundation spend a lot of time getting this conference up and running right. I strongly recommend if you have time to attend some or all the days that you take advantage.
The line up can be seen here - http://2008.utosc.com/speaker/list/
Registration is here - http://utosc2008.eventbrite.com/+
UPHPU Group code – UPHPUOTWOH
mj/v
I am pleased to announce the formation of a new local users group: The Utah Apple Users Group. We are a group of technophiles that use—and even cherish—products designed by Apple in California. We mainly exist simply as a mailing list where we converse and assist each other.
The state currently has two other related user groups—the BYU Macintosh Users Group and the Utah Macintosh Users Group—but both are affiliated with universities and thus governed by external policies and politics.They are also Macintosh groups, whereas this group covers all things Apple; and, as you are probably aware, Apple has recently expanded it’s product line in significant areas other than their Macintosh computer. UMUG also doesn’t have a mailing list and their forum has been offline for a long time. So, wether you’re a photographer using Aperture, a home theater nut hooking up your Apple TV, an entrepreneur using an iPhone, or a novice with a new iPod, jump on our mailing list and lets chat. We want everyone to feel welcome wether you are a student, a professional, or anyone else.
We do not plan on coordinating any events; we’re going to keep this simple. A website will be coming soon with syndicated news and events and we have an IRC channel for chatting in real time. Join the mailing list by sending an email to utahapple-subscribe@utahapple.org.
Greets UPHPU!
Pleased to announce Kevin Carter as the presenter for this month. The topic is error Handling and Debugging with PHP All code has bugs. In order to fix them you have to find them. This presentation will go over tips and tricks for detecting when errors occur. Then it will go over ways to efficiently track down bugs. It will also cover some code optimization items.
More about Kevin:
Kevin Carter works as a backend php developer for Code Greene. He’s been coding php nonstop for the past 3 years. Is a linux enthusiast, serving as vice-president for the Ogden Area Linux Users Group. His (almost) never updated blog can be found at http://dexterthedragon.com
administered by Anavi Design
colocated at Tier Four