< Detroit Coder />

March 8, 2010

CSS Rounded Corners and Drop Shadows

Filed under: Uncategorized — admin @ 11:37 am

If you have been developing for the web, the request for things like “less boxy”, “rounded corners” and “drop shadows” have made you cringe more than once.

Now there might be plenty of design reasons not to have drop shadows and rounded corners, but for the times that it makes sense, here is a solution that will work for Firefox, Safari and Chrome*: [For those that ask what about IE, please read an interview with Dan Cederholm on Graceful Degradation]

Four images with incremental CSS applied

The above image show the same image with 4 different stylesheets.

The html is straightforward

<img src="/images/icon.jpg" alt="example" />

And the CSS for each image:

First Image:

img.game-icon {
}

Second Image:

img.game-icon {
   padding: 4px;
   background: #fff;
}

Third Image:

img.game-icon {
   padding: 4px;
   background: #fff;
      -moz-border-radius: 5px;
      -webkit-border-radius: 5px;
}

Forth Image:

img.game-icon {
   padding: 4px;
   background: #fff;
      -moz-border-radius: 5px;
      -webkit-border-radius: 5px;

      -moz-box-shadow: 3px 3px 6px #ccc;
      -webkit-box-shadow: 3px 3px 6px #ccc;
}

And that is it. IE works up to the first 2 images, then Firefox picks up “-moz” requests and Safari and Chrome picks up “-webkit” requests, all without IE choking on the requests that it doesn’t understand.

This of course is just the tip of the iceberg for what you can start to do with CSS3, including animations, delayed styles, pretty cool stuff. A quick Google search on “-webkit” or “-moz” will reveal a lot – happy exploring!

March 7, 2010

Keychain Access

Filed under: Mac — admin @ 9:41 am

It amazes me that I see applications being marketed to Mac users that allow them to create “safe, secure, encrypted notes” on their computer. You don’t need them because OS X comes with this feature built in, it is called Keychain Access.

Here is a quick intro into using Keychain Access:

  1. Open up the Keychain Access application from your /Applications/Utilities/ folder.
  2. From the menu, select “File > New Keychain”
  3. Type in a name for your keychain, I will choose “DCoder”
  4. Create a password for this Keychain – click OK

Keychain Access Screenshot

Now you have a Keychain (Folder) to store secure information. For example, maybe you want to save Grandma’s famous Cheese Cake recipe (or credit card, medical info, whatever). Under the Category Window on the left, select “Secure Notes”. On the footer of the application click on the “+” button and that will create a new note. It will prompt you to name the entry – like “Gma Cheesecake”, then enter the information you want kept safe, like “Sara Lee, Frozen Aisle”, enter your password and you are done.
You will now see a list of entries in Secure Notes. Clicking on one will open the note. You will then be prompted for your password before you can view the contents of the note. From here you edit the note, etc. Repeat as needed.

Tip: Keychain access is also where you system stores all the passwords you have used, whether as part of a website, or somewhere on your system. You can retreive those passwords form Keychain Access by using the System and Passwords Keychains with the Password Category.

March 6, 2010

My Public IP Address

Filed under: network — admin @ 9:48 am

This comes up a lot. You are troubleshooting a security thing, playing an online game with your friend or you need to connect to a network, and they need your public address so they can allow you to connect. There are some other reasons for obtaining your current public IP address, but that is not the purpose of this post.

By far the easiest way to obtain your public address, every time without fail, is to bookmark one of the many “services” on the web that essentially read back to you your requesting IP Address, which is your public IP address.

So in short, if you need to know your current public address, just browse to a site like FreeIP.info to get your current Public IP Address.

March 5, 2010

WordPress Schedule Future Post Date

Filed under: Web Apps — admin @ 6:15 am

For whatever reason you want to create a new WordPress Blog Post now, but not make it public until a future date/time. No problem as WordPress makes this easy.

From your Admin/Posts screen, on the right side of the screen, in the Publish Box, you will see an entry for “Publish Immediately”. Simply click on the “Edit” link on the right and select the date you want your blog post to go live. It is really that easy, but there are 2 little gotchas:

  1. Make sure you take the time to set up your time zone.
  2. Your post will not go public unless you press the “schedule” button after you choose a date/time for your post. If you don’t do this, WordPress thinks that your blog post is just a draft and will not publish it.

March 4, 2010

uncompress tar.gz

Filed under: *nix, Command Line — admin @ 7:57 am

So you get a file like: somefile.tar.gz, and all you want to do is uncompress so you can use it and move on. You do a Google search and see that if you type:

tar -xvzf somefile.tar.gz

that does the job, but in the back of your mind you wish you knew what you just did, and what are all those option flags?

somefile.tar.gz is just a collection of files that have been archived and compressed using the tar and gzip commands in *nix.

Two things are actually happening here. First, a Tape Archive “TAR” of any number of files and folders was created. These files stay uncompressed unless they are explicitly compressed with the GZIP command (or option).

A few examples:

To create your own archive, for example,  of files: myfile1.txt and myfile2.txt into a single new file called myfiles.tar you type:

tar -cvf myfiles.tar myfile1.txt myfile2.txt

If you also want to compress the files at the same time, you simply add the “z” option so:

tar -cvfz myfiles.tar.gz myfile1 myfile2

will create a compressed archive of the files of your choosing.

Uncompressing is almost the same, just replace the ‘c’ with a ‘z’.

tar -xvzf myfiles.tar.gz

A note on options:

-c     Create a new archive
-v     Verbose, tell me what's happening, when it's happening.
-f     Specify a specific file
-x     Extract files/folders
-z     Compress files/folders with gzip

March 3, 2010

Command Line Navigation

Filed under: Command Line — admin @ 6:32 pm

Have you ever been in the command line, with a really long command and need to edit something at the start or the line? I used to use the left arrow key and wait. Here are few shortcuts:

CTRL-A will take you to the start of the line.

CTRL-E will take you the end of the line.

CTRL-[Left Arrow] or ESC then B  will move the cursor one word left.

CTRL-[Right Arrow] or ESC then F will move the cursor one word right.

Powered by WordPress