Monday, 28 March 2011

git help

http://www.kernel.org/pub/software/scm/git/docs/git-config.html

http://gitref.org/basic/#add

http://book.git-scm.com/3_basic_branching_and_merging.html





Thursday, 3 March 2011

Theming Menus

  1. Navigate to Administer, Site building, Menus.
  2. Choose the Settings tab.
  3. Change the “Source for the secondary links” so that it matches the menu that is set in the “Source for the primary links.”
  4. Scroll to the bottom of the Web page and click “Save configuration.”
The page template variable $secondary_links now contains the subsection links that have been defined for each of the items in $primary_links. Referring to the previous example, “Kitten” will now be displayed in the output of $secondary_links when you select “Mammal” from the list of menu options provided by the variable $primary_links.
 
 
function blog_preprocess_page(&$variables) {
// Make a shortcut for the primary links variables
$primary_links = $variables['primary_links'];


// Loop through the menu, adding a new class for CSS selections
$i = 1;


foreach ($primary_links as $link => $attributes) {
  // Append the new class to existing classes for each menu item
  $class = $attributes['attributes']['class'] . " item-$i";


  // Add revised classes back to the primary links temp variable
  $primary_links[$link]['attributes']['class'] = $class;
  $i++;
}
 // End of the foreach loop


// reset the variable to contain the new markup
$variables['primary_links'] = $primary_links;


} // End of the preprocess function
 
get help from http://www.informit.com/articles/article.aspx?p=1336146&seqNum=3 

Tuesday, 1 March 2011

Finding Duplicates in MySQL

I get quite a few Excel files from clients that need to get cleaned up and inserted in to MySQL. Sometimes the import goes smoothly, sometimes it doesn’t. This last time, I had 3,741 rows in an Excel file, but somehow wound up with 3,751 rows in the database - what went wrong? Don’t know, and don’t have time to figure it out - so I just used this query to isolate all the duplicates.
My database table consists of nothing more than an id, a part number (number), a description, and a price. Here’s the query that located all duplicate part numbers - from there I was able to easily delete them:
SELECT number,
 COUNT(number) AS NumOccurrences
FROM part_prices_new
GROUP BY number
HAVING ( COUNT(number) > 1 )

Source base installation of php, mysql and apache in ubuntu/ linux

Compile and Install a LAMP(Linux/Apache/MySQL/PHP) Server from Source In the last post, I described the method to install a LAMP ser...