Nov 27 2009

How NOT to be an enormous douche when you are getting to know a woman.

I came across this blog entry from a friend of mine, named Zach Schneider in Michigan.  When I read this entry I found it to be very true and I wanted to spread the word to all guys out there so that they can treat women the way women should be treated.

###########################################

1.) SINCERITY If you can’t act or speak with sincerity then just don’t. Nothing is more unattractive. If you don’t mean it, don’t say it. Don’t try and make yourself up to be something you are not. She will know, and she will laugh her ass off at you later.

2.) STFU Don’t talk about yourself too much, if you must expound upon your latest and greatest exploit don’t be a braggart. Make the story entertaining, short, and the ending should lead into a question you would like them to answer about themselves. You are trying to get to know them. Rattling your bonebox about yourself all night shows women one thing: your complete and utter lack of interest for anyone but yourself.

3.) BE A GENTLEMAN Your actions speak louder than your words. You are being examined most likely under a hell of a lot more scrutiny than your feeble mind could manage in her direction. She is paying attention to how you are moving, your facial expressions, and especially how you treat and speak of other people. You are a man act like one. Be respectful to those you come into contact with. Stand up when she approaches the table if you are sitting. Take her jacket. Open doors (car doors too lazy ass). Pay for her drinks. Should she decide to thank you, her company and continued tolerance of your dumb ass should be thanks enough. Nothing is more disgusting than expectation of compensation monetary or otherwise.

4.) OTHER WOMEN Don’t talk in any amount of detail about other women. Ever. The only exception: how much you love your mother (don’t take that too far either lest she confuse it for an Oedipus complex). Contrary to what you might think she doesn’t want to hear about how well you treated the last woman that dumped your dumb ass. She also doesn’t care how many other women think you are great. All that matters is her attention, and you won’t be getting it talking that way because again it only enhances the appearance of your own self interest. Seriously this is a great way to move a girl from love interest to permanent friend status real quick. You will know this has happened when they start telling you about their exes.

5.) MANNERISMS Show your interest by maintaining eye contact. Yes eye contact. You may let your eyes stray across her features on occasion, but nothing will class you as a pig faster than you staring at her body. Move with confidence and intent. If you are going to do something do it with aplomb. If you fear a fiery crash you will create one. Don’t. Women can read facial cues much better than you. Nothing is more disgusting or sad than a man who looks at a woman with needy desire written all over his face. I saw it sitting there, that means she saw it 10 fold. You can get away with a lot of facial expressions, but needy/unsure is not one of them.

6.) TOUCH Don’t grab women. Ever. If she wants you to touch her she will invite you to. When you decide to take this invitation touch should be light, fleeting, and it should be directed toward a respectful part of her person. Her arm, shoulder, hands, neck, and for the bold her face. Again if you can’t do this with confidence just don’t. Confident movement and sincere intent is the difference between desirable contact and disgusting groping. Gentleman don’t grope women.

Anyway if you are an ENORMOUS DOUCHE and have read this note, hopefully you can get over yourself and realize that sincere intent trumps posturing bravado and can lead to an actual relationship as opposed to… well whatever the hell else you might manage on your own. In so doing perhaps you can shed your previous title and become a real man. Good luck!


Oct 20 2009

Nine Words Women Use

(1) Fine: This is the word women use to end an argument when they are right and you need to shut up.

(2) Five Minutes: If she is getting dressed, this means a half an hour. Five minutes is only five minutes if you have just been given five more minutes to watch the game before helping around the house.

(3) Nothing: This is the calm before the storm. This means something, and you should be on your toes. Arguments that begin with nothing usually end in fine.

(4) Go Ahead:
This is a dare, not permission. Don’t Do It!

(5) Loud Sigh:
This is actually a word, but is a non-verbal statement often misunderstood by men. A loud sigh means she thinks you are an idiot and wonders why she is wasting her time standing here and arguing with you about nothing. (Refer back to #3 for the meaning of nothing.)

(6) That’s Okay: This is one of the most dangerous statements a women can make to a man. That’s okay means she wants to think long and hard before deciding how and when you will pay for your mistake.

(7) Thanks: A woman is thanking you, do not question, or faint. Just say you’re welcome. (I want to add in a clause here – This is true, unless she says ‘Thanks a lot’ – that is PURE sarcasm and she is not thanking you at all. DO NOT say ‘you’re welcome’ . That will bring on a ‘whatever’).

(8) Whatever:
Is a woman’s way of saying GO TO HELL

(9) Don’t worry about it, I got it:
Another dangerous statement, meaning this is something that a woman has told a man to do several times, but is now doing it herself. This will later result in a man asking ‘What’s wrong?’ For the woman’s response refer to #3.


Sep 21 2009

Setup LAMP on Ubuntu

Install Apache

To start off we will install Apache.

1. Open up the Terminal (Applications > Accessories > Terminal).

2. Copy/Paste the following line of code into Terminal and then press enter:

sudo apt-get install apache2

3. The Terminal will then ask you for you’re password, type it and then press enter.

Testing Apache

To make sure everything installed correctly we will now test Apache to ensure it is working properly.

1. Open up any web browser and then enter the following into the web address:

http://localhost/

You should see a folder entitled apache2-default/. Open it and you will see a message saying “It works!” , congrats to you!

Install PHP

In this part we will install PHP 5.

Step 1. Again open up the Terminal (Applications > Accessories > Terminal).

Step 2. Copy/Paste the following line into Terminal and press enter:

sudo apt-get install php5 libapache2-mod-php5

Step 3. In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this:

sudo /etc/init.d/apache2 restart

Test PHP

To ensure there are no issues with PHP let’s give it a quick test run.

Step 1. In the terminal copy/paste the following line:

sudo gedit /var/www/testphp.php

This will open up a file called phptest.php.

Step 2. Copy/Paste this line into the phptest file:

<?php phpinfo(); ?>

Step 3. Save and close the file.

Step 4. Now open you’re web browser and type the following into the web address:

http://localhost/testphp.php

Congrats you have now installed both Apache and PHP!

Install MySQL

To finish this guide up we will install MySQL. (Note – Out of Apache and PHP, MySQL is the most difficult to set up. I will provide some great resources for anyone having trouble at the end of this guide.)

Step 1. Once again open up the amazing Terminal and then copy/paste this line:

sudo apt-get install mysql-server

Step 2 (optional). In order for other computers on your network to view the server you have created, you must first edit the “Bind Address”. Begin by opening up Terminal to edit the my.cnf file.

gksudo gedit /etc/mysql/my.cnf

Change the line

bind-address = 127.0.0.1

And change the 127.0.0.1 to your IP address.

Step 3. We are now going to install a program called phpMyAdmin which is an easy tool to edit your databases. Copy/paste the following line into Terminal:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

Step 4. Now linking phpMyAdmin to Apache’s www folder

sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled php.ini. To open it type the following:

gksudo gedit /etc/php5/apache2/php.ini

Now we are going to have to uncomment the following line by taking out the semicolon (;).

Change this line:

;extension=mysql.so

To look like this:

extension=mysql.so

Now just restart Apache and you are all set!

sudo /etc/init.d/apache2 restart


Aug 23 2009

Linux Command-Line Cheat Sheet

Moving Around the Filesystem

Commands for moving around the filesystem include the following.

  • pwd: The pwd command allows you to know the directory in which you’re located (pwd stands for “print working directory”). For example, pwd in the desktop directory will show ~/Desktop. Note that the GNOME terminal also displays this information in the title bar of its window.
  • cd: The cd command allows you to change directories. When you open a terminal, you will be in your home directory. To move around the filesystem, use cd. To navigate to your desktop directory, use cd ~/Desktop
    To navigate into the root directory, use cd /

    To navigate to your home directory, use cd

    To navigate up one directory level, use cd ..

    To navigate to the previous directory (or back), use cd -

    To navigate through multiple levels of directories at once, use cd /var/www, for example, which will take you directly to the /www subdirectory of /var.

Manipulating Files and Folders

You can manipulate files and folders by using the following commands.

  • cp: The cp command makes a copy of a file for you. For example, cp file foo makes an exact copy of the file whose name you entered and names the copy foo, but the first file will still exist with its original name. After you use mv, the original file no longer exists, but after you use cp, that file stays and a new copy is made.
  • mv: The mv command moves a file to a different location or renames a file. Examples are as follows: mv file foo renames the original file to foo. mv foo ~/Desktop moves the file foo to your desktop directory but does not rename it. You must specify a new filename to rename a file.
  • To save on typing, you can substitute ~ in place of the home directory.Note: If you are using mv with sudo, you will not be able to use the ~ shortcut. Instead, you will have to use the full pathnames to your files.
  • rm: Use this command to remove or delete a file in your directory. It does not work on directories that contain files.
  • ls: The ls command shows you the files in your current directory. Used with certain options, it lets you see file sizes, when files where created, and file permissions. For example, ls ~ shows you the files that are in your home directory.
  • mkdir: The mkdir command allows you to create directories. For example, mkdir music creates a music directory.
  • chmod: The chmod command changes the permissions on the files listed.Permissions are based on a fairly simple model. You can set permissions for user, group, and world, and you can set whether each can read, write, and/or execute the file. For example, if a file had permission to allow everybody to read but only the user could write, the permissions would read rwxr–r–. To add or remove a permission, you append a + or a - in front of the specific permission. For example, to add the capability for the group to edit in the previous example, you could type chmod g+x file.
  • chown: The chown command allows the user to change the user and group ownerships of a file. For example, chown jim file changes the ownership of the file to Jim.


System Information Commands

System information commands include the following.

  • df: The df command displays filesystem disk space usage for all partitions. The command df-h is probably the most useful. It uses megabytes (M) and gigabytes (G) instead of blocks to report. (-h means “human-readable.”)
  • free: The free command displays the amount of free and used memory in the system. For example, free -m gives the information using megabytes, which is probably most useful for current computers.
  • top: The top command displays information on your Linux system, running processes, and system resources, including the CPU, RAM, swap usage, and total number of tasks being run. To exit top, press Q.
  • uname -a: The uname command with the -a option prints all system information, including machine name, kernel name, version, and a few other details. This command is most useful for checking which kernel you’re using.
  • lsb_release -a: The lsb_release command with the -a option prints version information for the Linux release you’re running. For example:user@computer:~$ lsb_release -aLSB Version: n/a

    Distributor ID: Ubuntu

    Description: Ubuntu (The Breezy Badger Release)

    Release:

    Codename: breezy

  • ifconfig: This reports on your system’s network interfaces.
  • iwconfig: The iwconfig command shows you any wireless network adapters and the wireless-specific information from them, such as speed and network connected.
  • ps: The ps command allows you to view all the processes running on the machine.

The following commands list the hardware on your computer, either of a specific type or with a specific method. They are most useful for debugging when a piece of hardware does not function correctly.

  • lspci: The lspci command lists all PCI buses and devices connected to them. This commonly includes network cards and sound cards.
  • lsusb: The lsusb command lists all USB buses and any connected USB devices, such as printers and thumb drives.
  • lshal: The lshal command lists all devices the hardware abstraction layer (HAL) knows about, which should be most hardware on your system.
  • lshw: The lshw command lists hardware on your system, including maker, type, and where it is connected.


Searching and Editing Text Files

Search and edit text files by using the following commands.

  • grep: The grep command allows you to search inside a number of files for a particular search pattern and then print matching lines. For example, grep blah file will search for the text “blah” in the file and then print any matching lines.
  • sed: The sed (or Stream EDitor) command allows search and replace of a particular string in a file. For example, if you want to find the string “cat” and replace it with “dog” in a file named pets, type
    sed s/cat/dog/g pets.

Both grep and sed are extremely powerful programs. There are many excellent tutorials available on using them, but here are a few good Web sites to get you started:

Three other commands are useful for dealing with text.

  • cat: The cat command, short for concatenate, is useful for viewing and adding to text files. The simple command cat FILENAME displays the contents of the file. Using cat FILENAME file adds the contents of the first file to the second.
  • nano: Nano is a simple text editor for the command line. To open a file, use nano filename. Commands listed at the bottom of the screen are accessed via pressing Ctrl followed by the letter.
  • less: The less command is used for viewing text files as well as standard output. A common usage is to pipe another command through less to be able to see all the output, such as ls | less.

Dealing with Users and Groups

You can use the following commands to administer users and groups.

  • adduser: The adduser command creates a new user. To create a new user, simply type sudo adduser $loginname. This creates the user’s home directory and default group. It prompts for a user password and then further details about the user.
  • passwd: The passwd command changes the user’s password. If run by a regular user, it will change his or her password. If run using sudo, it can change any user’s password. For example, sudo passwd joe changes Joe’s password.
  • who: The who command tells you who is currently logged into the machine.
  • addgroup: The addgroup command adds a new group. To create a new group, type sudo addgroup $groupname.
  • deluser: The deluser command removes a user from the system. To remove the user’s files and home directory, you need to add the-remove-home option.
  • delgroup: The delgroup command removes a group from the system. You cannot remove a group that is the primary group of any users.


Getting Help on the Command Line

This section provides you with some tips for getting help on the command line. The commands –help and man are the two most important tools at the command line.

Virtually all commands understand the -h (or –help) option, which produces a short usage description of the command and its options, then exits back to the command prompt. Try man -h or man –help to see this in action.

Every command and nearly every application in Linux has a man (manual) file, so finding such a file is as simple as typing man command to bring up a longer manual entry for the specified command. For example, man mv brings up the mv (move) manual.

Some helpful tips for using the man command include the following.

  • Arrow keys: Move up and down the man file by using the arrow keys.
  • q: Quit back to the command prompt by typing q.
  • man man: man man brings up the manual entry for the man command, which is a good place to start!
  • man intro: man intro is especially useful. It displays the Introduction to User Commands, which is a well-written, fairly brief introduction to the Linux command line.

There are also info pages, which are generally more in-depth than man pages. Try info info for the introduction to info pages.

Searching for Man Files

If you aren’t sure which command or application you need to use, you can try searching the man files.

  • man -k foo: This searches the man files for “foo”. Try man -k nautilus to see how this works.
    Note: man -k foo is the same as the apropos command.
  • man -f foo: This searches only the titles of your system’s man files. Try man -f gnome, for example.Note: man -f foo is the same as the whatis command.

Using Wildcards

Sometimes you need to look at or use multiple files at the same time. For instance, you might want to delete all .rar files or move all .odt files to another directory. Thankfully, you can use a series of wildcards to accomplish such tasks.

  • * matches any number of characters. For example, *.rar matches any file with the ending .rar.
  • ? matches any single character. For example, ?.rar matches a.rar but not ab.rar.
  • [characters] matches any of the characters within the brackets. For example, [ab].rar matches a.rar and b.rar but not c.rar.
  • [!characters] matches any characters that are not listed. For example, [!ab].rar matches c.rar but not a.rar or b.rar.


Executing Multiple Commands

Often you may want to execute several commands together, either by running one after another or by passing output from one to another.

Running Sequentially

If you need to execute multiple commands in sequence but don’t need to pass output between them, there are two options based on whether or not you want the subsequent commands to run only if the previous commands succeed or not. If you want the commands to run one after the other regardless of whether or not preceding commands succeed, place a ; between the commands. For example, if you want to get information about your hardware, you could run lspci ; lsusb, which would output information on your PCI buses and USB devices in sequence.

However, if you need to conditionally run the commands based on whether the previous command has succeeded, insert && between commands. An example of this is building a program from source, which is traditionally done with ./configure, make, and make install. The commands make and make install require that the previous commands have completed successfully, so you would use ./configure && make && make install.

Passing Output

If you need to pass the output of one command so that it goes to the input of the next, after the character used between the commands, you need something called a pipe, which looks like a vertical bar or pipe (|).

To use the pipe, insert the | between each command. For example, using the | in the command ls | less allows you to view the contents of the ls more easily.


Aug 23 2009

Install Gimp 2.6 in Ubuntu 8.04

Remove the old version of GIMP from Synaptic or in a terminal:

sudo apt-get remove gimp

Download and save all five GIMP packages from GetDeb. Double-click on the packages to install them, in this order:

  1. libbabl-0.0-0_0.0.22-1~getdeb1_i386.deb
  2. libgegl-0.0-0_0.0.18-1~getdeb1_i386.deb
  3. libgimp2.0_2.6.1-1~getdeb1_i386.deb
  4. gimp-data_2.6.1-1~getdeb1_all.deb
  5. gimp_2.6.1-1~getdeb1_i386.deb

Now you can start GIMP normally, from Applications->Graphics->GIMP Image Editor.
gimp-splash


Aug 7 2009

CSS Image Rollover

The CSS method uses what is known as an image sprite to load all the rollover effects as a single image and we then use CSS to do the transition. To create the image sprite just create a single image containing all of the individual transitions.  Once you have your image sprite you just need the HTML and CSS code:

CSS Code:
a.grnBTN
{
display: block;
width: 200px;
height: 45px;
text-decoration: none;
background: url(“greenBTN.png”);
background-position: 200px;
}

a.grnBTN:hover {
background-position: 0 0;
}

.displace {
position: absolute;
left: -5000px;
}

HTML Code:

<a href="#" class="grnBTN" title="Image Title">
<span class="displace">Alternative Text</span>
</a>

  • The width and height values in a.rollover are the size of the original image.
  • The value of background-position is that of the original image width since we are literally moving from one part of the image sprite to another.
  • The <span> tag was included with a text alternative to the image and displaced it off the side of the visible screen so that screen readers will read it and in the event of no CSS support a text link will be shown instead.

Working Example:

Alternative Text


Aug 5 2009

IE Specific Stylesheets

ie-only-css

Internet Explorer has it’s problems with CSS (OK, it’s pretty much awful) but if you are worth your salt as a CSS coder, you should be able to deal with it. I am of the opinion that you can handle anything IE can throw at you without a ton of hacks and without having alternate stylesheets. But if you (or your client) really wants to get pixel-perfect results cross-browser, you may need to specify alternate stylesheets for different browsers, especially Internet Explorer.

Here is the basic technique for an IE-Only stylesheet:

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie-only.css" />
<![endif]-->

The opposite technique, targeting only NON-IE browsers:

<!--[if !IE]>
<link rel="stylesheet" type="text/css" href="not-ie.css" />
<![endif]-->

If you need to get down and dirty with specific versions of IE, here are a few examples.

IE 7 ONLY:

<!--[if IE 7]>
<link href="IE-7-SPECIFIC.css" rel="stylesheet" type="text/css">
<![endif]-->

IE 6 ONLY:

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="IE-6-SPECIFIC.css" />
<![endif]-->

IE 5 ONLY:

<!--[if IE 5]>
<link rel="stylesheet" type="text/css" href="IE-5-SPECIFIC.css" />
<![endif]-->

IE 5.5 ONLY:

<!--[if IE 5.5000]>
<link rel="stylesheet" type="text/css" href="IE-55-SPECIFIC.css" />
<![endif]-->

VERSION OF IE VERSION 6 OR LOWER: (I find this one pretty handy)

<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="IE-6-OR-LOWER-SPECIFIC.css" />
<![endif]-->

Why would you want to use these conditional stylesheets?

  • It’s more future-proof than hacks. A new browser or a new version of a browser may come along one day that wrecks up interprets your hacks in a strange way and will mess up your styling. That’s no good! For example, there is a really effective min-height hack out there right now, but who is to say that will work forever? The solution here would be to declare a min-height like normal in your real stylesheet, then declare a height (the workaround) in an IE-6-and-Lower stylesheet.
  • It keeps your CSS clean. And valid! If having CS code that passes W3C snuff is important to you, this is the way to go
  • Expandability. If a new browser comes along that you want to also support, you can create a conditional statement and stylesheet for that and you are all set, instead of re-tweaking your existing stuff.

If you think it is overkill for you to have IE-Specific stylesheets, you can use hacks to make things happen. Again, I don’t really recommend this, but this is how it’s done.

IE-7 ONLY:

* html #div {
    height: 300px;
}

NON IE-7 ONLY:

#div {
   _height: 300px;
}

HIDE FROM IE 6 AND LOWER:

#div {
   height/**/: 300px;
}

HIDE FROM IE 6 AND LOWER: (another way)

html > body #div {
      height: 300px;
}