Get the Source Code and Modify an Ubuntu Package

Tuesday, October 6th, 2015

Modifiying the Source of a Package and Creating a New Deb Binary

In order to download the source code of an existing package, first install the prerequisites:

sudo apt-get install build-essential debhelper

To get the source code of a package, run the following command:

apt-get source {name_of_package_interested_in}

Make changes to the source using an editor like geany or via terminal through nano.  Edit the changelog file and add a record of your changes to build a new revision number.  After you have made the changes, run the following commands to build the package which should include your changes.

dpkg-source --commit
dpkg-buildpackage -b

The updated package has been built.  To install the package, simply use the below commands:

sudo dpkg --install {name_of_new_deb_file}

To remove the software:

sudo dpkg -r {name_of_package [NOT NAME OF DEB FILE]}

Now you can release it!

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
    $('#colorpicker').ColorPicker({
    
       color: defaultColor,
         onShow: function (colpkr) {
              $(colpkr).fadeIn(500);
              return false;
         },
         onHide: function (colpkr) {
              $(colpkr).fadeOut(500);
              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.

My Favorite Ubuntu Distribution and Software

Thursday, March 29th, 2012

My Favorite Ubuntu Distribution and Software

I run my own personal dedicated server, and I choose Ubuntu to power my server.  But, I don't just use any version of Ubuntu.  I use Ylmf OS, a Windows XP GUI interface Ubuntu 10.04 distribution.  Yes, the Chinese wrote it, but we can all trust the Chinese, right?

Why Do I Use Ylmf OS

I used to be a n00b to Linux a few years back, and I wanted something that looked like Windows XP.  You should be able to tell by now that I love Windows XP and Windows XP x64 with a passion.  Everything just works unlike in Windows 7 and Windows Vista.

List of Best Open Source Software for Ubuntu

  • EHCP Hosting Control Panel – Automatically configures all services you'd need for a dedicated apache2 web server with VSFTPD and includes a fully functional advanced GUI control panel for easy user management, MySQL functionality, subdomains, addon domains, easy install scripts, everything you'd find in CPanel X3, and more!
  • Open Game Panel – An open source game server management panel software.  Allows you and your customers the ability to start, stop, restart, and modify config files for gaming servers on the fly.
  • Mumble Client and Server – Great open source voice over IP client that resembles Teamspeak and has greater functionality.  Install it using:
    sudo apt-get install mumble-server
  • FreeNX – An open source remote SSH GUI login which allows you to remote desktop with encryption without having to learn those nasty ssh commands in the terminal (yes they're simple, but I like the GUI better thanks).

More to come as I think of them.