Archive for April, 2013

Using JQuery Color Picker and Cookie Plugins to Change Element Background Colors Dynamically Based on User Preference

Sunday, April 21st, 2013

Changing Website Element Colors Dynamically Based on User Preferences

Wouldn't it be cool to dynamically style a website or webpage based on a user's favorite color?  Thanks to several JQuery plugins, it is now possible to do so!  The JQuery Color Picker plugin allows users to select a color based on a color pallete / color wheel similar to those found within photo editing software such as Adobe Photoshop or Corel PaintShop Pro.  The JQuery Color Plugin can darken, lighten, add, multiply, subtract, find color hues, change rgb values, and manipulate colors in all sorts of ways you probably never imagined possible.  The final piece to dynamically styling a page based on a user selected color is to save the picked color's value in a cookie using the JQuery-Cookie Plugin.  When any page loads, you will need to use the document.ready JQuery function to read the cookie and restyle elements as necessary.  If a cookie is not set, the default color can also be specified here. 

Here's a screenshot of the JQuery Color Picker in action:

To load / use the color picker, place this function within the document.ready function:

// Color Picker Loader
       color: defaultColor,
         onShow: function (colpkr) {
              return false;
         onHide: function (colpkr) {
              return false;
         onChange: function (hsb, hex, rgb) {
          var origColor = '#' + hex;
          // Set the main div background colors to what was selected in the color picker
              $('#colorpicker').css('backgroundColor', origColor);
          $('#origColor').css('backgroundColor', origColor);
          // Set the cookie
          $.cookie("color", '#' + hex, { path: '/' });
          // Set the dark and light colors (multi-iterations)
          darkColor = $.xcolor.darken('#' + hex).getHex();
          for (var i = 0; i < iterations; i++) {
            darkColor = $.xcolor.darken(darkColor).getHex();
          lightColor = $.xcolor.lighten('#' + hex).getHex();
          for (var i = 0; i < iterations; i++) {
            lightColor = $.xcolor.lighten(lightColor).getHex();
          // Set the light and dark divs
          $('#darkColor').css('backgroundColor', darkColor);
          $('#lightColor').css('backgroundColor', lightColor);
          // Change class attributes
          $('.light').css('backgroundColor', lightColor);
          $('.dark').css('backgroundColor', darkColor);
          $('.pad').css('backgroundColor', origColor);
          // Set the border
          $('#colorpicker').css('border-color', darkColor);

Assign a DIV element the ID of "colorpicker" in your HTML file to activate the color picker.    Don't change the "onShow" or "onHide" JQuery sub-functions of the ColorPicker.  When a user chooses a color from the color picker, the color picker "onChange" function is called.  This is where you need to define what should be done with the color the user has picked.  In my example, I call the $.xcolor.lighten and $.xcolor.darken Color Plugin functions to generate a lighter and darker color.  I use then use the color selected, a lighter variant of that color, and a darker variant of that color to style elements appropriately to keep text readable while offering a new color scheme.  As you can see from the code above, I mainly change the css attributes of certain classes, which the elements have been assigned.  What is changed is the backgroundColor and border-color of certain classes based on the three colors that were generated.

To see what other cool things you can do with all of these plugins, check out the links in the first paragraph.  Click here to see a live demonstration of all three plugins in action and download the source for how it all works based on the example discussed above.  The only Javascript file that needs to be changed to experiment with this sample is the "main.js" file within the "js" folder.

I hope this guide helps.  The plugin websites did not provide all of the code needed for a working sample, but luckily, I did the combination work for you.  Go ahead and use my source for anything!  Please comment if you have questions.

How to Make MATE Look Like Windows XP using the Luna Theme

Sunday, April 14th, 2013

Make MATE or GNOME2 Look Like Windows XP Using the Luna Theme

If you want your Linux installation to look like the original theme used in Windows XP, you can do that! This guide will walk you through the process of easily making any MATE or GNOME2 Desktop Environment look like the Windows XP GUI. The Luna Theme can be downloaded here and installed using our simple installation script. If you already have MATE installed or are already running GNOME2, skip to the Luna Theme install instructions.

Install MATE on Ubuntu:

Run the below commands for your matching Ubuntu version in a terminal to install MATE.  To find out which version of Ubuntu you're running, use this command:

lsb_release -a

For Ubuntu 12.04:

sudo add-apt-repository "deb precise main"
sudo apt-get update 
sudo apt-get --yes --quiet --allow-unauthenticated install mate-archive-keyring 
sudo apt-get update
sudo apt-get install -y mate-desktop-environment

For Ubuntu 14.04:

sudo apt-add-repository ppa:ubuntu-mate-dev/ppa
sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y mate-desktop-environment-extras

For Ubuntu 16.04:

sudo add-apt-repository ppa:ubuntu-mate-dev/xenial-mate
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y mate-desktop-environment

For Other Distributions (Distros):

Installing the Luna Theme:

Our version of the Luna theme has been converted and ported over to GTK3, so it should work with all newer flavors of Linux running MATE while still working on older Linux installs running GNOME2.To install the Luna Theme which will make Linux look like Windows XP, run the following commands. The theme files will be downloaded and saved in your Downloads directory.

cd ~/Downloads
wget -O linux_xp_luna_theme_install.tar.gz
mkdir Luna
tar -zxvf linux_xp_luna_theme_install.tar.gz -C Luna
cd Luna
sudo rm -rf /usr/share/themes/Luna
rm -rf ~/.themes/Luna
sudo bash

Next, Right Click on the Desktop, and choose "Change Desktop Background".  Click on the "Themes" tab.  Select "Luna".  Click on the "Background" tab.  If you want the default XP wallpaper set as your background, click on the "Add" button.   Select your "Pictures" folder.  Select "luna_background.jpg".  Click "Open".  Click on "Close" to change it. 

Now, MATE or GNOME2 looks like XP!  Enjoy!  This theme was copied from Ylmf OS 3.0.

The Monsanto Protection Act – “Farmer Assurance Provision, Section 735” – Promotes the Growth and Engineering of GMO Foods and Seeds Without Any Judicial Oversight or Regulation

Tuesday, April 9th, 2013

The Monsanto Protection Act & What It Means For YOU

"Free from Any Judicial Litigation" – WAIT WHAT?!?!?!

The “Farmer Assurance Provision, Section 735”, known as the Monsanto Protection Act, is a provision that was slipped into the "Continuing Resolution" spending bill.  This spending bill is designed to prevent the government shutdown and sequester.  The Continuing Resolution bill, including the Farmer Assurance Provision, passed the house and was signed by President Obama on March 29, 2013.  A sub-committee slipped the provision into the bill anonymously.  However, news has spread that Missouri Sen. Roy Blunt (R) drafted the provision in direct conjunction with Monsanto.  His reasoning for supporting such a provision: "it is only a one-year protection.”

So, What Does this Do?

In short, the Farmer Assurance Provision, Section 735 "allows agribusiness giant Monsanto to promote and plant genetically modified organisms (GMOs) and genetically engineered (GE) seeds, free from any judicial litigation that might decide the crops are unsafe".

It stipulates that the U.S. Department of Agriculture (USDA) “ignore any court ruling that would otherwise halt the planting of new genetically-engineered crops.”  Typically, the USDA approves GMO products and seeds as long as they pass certain filing regulations and conditions.  Unfortunately, the USDA does not conduct thorough reviews or tests of the many submitted food products it receives.  To speed up the process, the USDA typically approves products without performing tests that study long term effects.

Tests of these controversial products are usually performed much later by independent groups.  Some are sponsored by Monsanto and conclude that these products are safe.  Others are sanctioned by independent groups funded by "the people" who are protecting their health interests.  Typically, results from studies not financed by Monsanto show that GMO products can increase the risk of cancer and cause adverse health issues.

GE and GMOs can damage the environment and introduce additional pesticides into the food supply endangering the health of all consumers.  The unfortunate truth is that 80% of the food supply is already contaminated by GMOs.  The effects to our health are unknown.  

Do you really want to be a guinea pig?

What can we do?

Fight this by mandating the labeling of GMO products on food labels:

Spread the news on Facebook.  

Read these articles to find out why GMOs and GE seeds are bad for you, your neighbors, and the environment.

Main Sources: