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:

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.

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.

Posted in Guides, Web Technologies | Comments Off on Using JQuery Color Picker and Cookie Plugins to Change Element Background Colors Dynamically Based on User Preference

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:

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.

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.

Posted in Guides, Ubuntu Linux | Comments Off on How to Make MATE Look Like Windows XP using the Luna Theme

Secure your Ubuntu Server from Flood and Other Attacks Using IPTables and WonderShaper

The following commands use IPTables to prevent common flooding and other miscellaneous malicious attacks. These commands can prevent a Linux server from lagging and spending resources on malformed packets. Some of these attacks can cause DDoS attacks, so it is best to use these filters and rules. Use at your own risk. A detailed explanation can be found here.

Limiting download and upload speeds globally does not make a server any more secure than before. However, it can aleviate network lag, which in my opinion ensures availability enhancing security. In Ubuntu, it's easy to limit the max download and upload speed that can be used on an interface. It wasn't always this easy, but thanks to a tool called wondershaper, you don't have to worry about any of the complexities. To install, run the following command:

sudo apt-get install wondershaper

Now, we need to tell wondershaper to start limiting our max download and upload rate on our particular interface. To see a list of interfaces, type the following command:

ifconfig

To determine what your max download and max upload speed should be, use SpeedTest to run a couple of bandwidth tests using your connection. With your results, convert the speeds from mbps to kilobits per second. Use this bandwidth calculator / converter to help you out. Then, I'd subtract 20-30% of each value, as you want to leave some room between your max speed so that bandwith will still be available to other computers / nodes on the network.

Once you have your speeds, start wondershaper (modifying the example below to fit your needs):

Make sure you change your max download and upload speed in both of the examples. Settings will now apply when the computer boots into Linux.

Exclude LAN from Speed Limits

WonderShaper does not differentiate between LAN traffic and external traffic by default. To prevent WonderShaper from limiting LAN network download and upload speeds, install this updated WonderShaper script: