avatar

Andres Jaimes

CentOS useful commands

To get your CentOS version type: cat /etc/redhat-release To update all your CentOS packages at once: yum update To install nslookup, dig and other network utilities: yum install bind-utils -y

Show User Library Directory in Mac OS X Lion

Show User ~/Library in OS X Lion Launch Terminal from Spotlight or Launchpad > Utilities, and enter the following command to show the directory: `` chflags nohidden ~/Library/ The users Library folder will immediately become visible. Reverting this back to the standard Lion setting is simple too: Hide User ~/Library in OS X Lion (default setting) This returns to the default setting of hiding the user Library directory: ``

How to create a simple gradient in C#

Creating a simple gradient using two colors is very simple: Rectangle rect = new Rectangle(0, 0, 100, 100); LinearGradientBrush lgb = new LinearGradientBrush(rect, Color.White, Color.Blue, 90); e.Graphics.FillRectangle(lgb, rect); This code will generate a gradient in the given rectangle that goes from white to blue in a vertical way (see last parameter in constructor). In this case, e, is any class that encapsulates the System.Drawing.Graphics class. Once the gradient is ready, well, you have to actually draw it by calling the FillRectangle function.

Printing in C# – The easy way

Believe me, it is easy. As with any class, before we can use any of the Classes, Events and Objects available to us in the .Net Framework we need to import the Namespaces we need. For this we need 3 namespaces. VB.Net users only required 2 because VB.Net assumes the System Namespace, whereas C# isn’t so kind: System System.Drawing System.Drawing.Printing These 3 Namespaces contain everything we need for this class, so you will need to add the following lines to the top of your class file:

How to know if a hex color is light or dark

There is a simple way to know this. The following code takes white (#ffffff) divided it by two as our reference color. If the comparing color is lower than the reference color, then the given color is dark, otherwise it’s light color. function isLightOrDark($hexcolor) { return (hexdec($hexcolor) > 0xffffff/2) ? 'light color' : 'dark color'; }

How to choose a printer using C#

You can assign a printer and other settings by using the basic PrintDocument and PrintDialog controls properties. Look at the next example: if (printDialog.ShowDialog() == DialogResult.OK) { printDocument.PrinterSettings.PrinterName = printDialog.PrinterSettings.PrinterName; printDocument.PrinterSettings.Copies = printDialog.PrinterSettings.Copies; }

How to Move a WordPress Blog to a New Domain or Location

Before trying the queries in this page, I recommend you to read this full article to learn more about the process. To update WordPress options with the new blog location, use the following SQL command: UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl'; After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guid field.

Kiwi!

Worth watching

How to install Papyrus on Eclipse Indigo

Papyrus is a UML designer plugin for the eclipse development environment. Installing it on the Indigo version is very easy: Go to Help > Install New Software… Under Work with, select All Available Sites and look for Modeling on the tree view. Under Modeling, look for MDT Papyrus – SDK and press the Next button Press Next again Accept the Licence and press Finish You will be asked to restart Eclipse, so go ahead… Next time you create a project, you will see the Papyrus project listed.

Reocities, a web time traveller…

If you are one of those who started surfing and creating the web in the 90’s, Reocities will take you back in time to the beginning of an era. Blue text on green or yellow wallpapers and animated gif’s overloaded the pages during the last decade of last century. After Geocities closed in 2009, Reocities started saving a lot of websites stored on mentioned website trying to keep the history alive.