Author Archives: cwillett

Amazing handset support with Mobile plugin…

by  • September 8, 2011 • Uncategorized

Came across this little gem last night and launched my new mobile version of chriswillett.com:

http://wordpress.org/extend/plugins/wapple-architect/

 

They use native WAPL and have a large database of handsets they support and update. SEO, dynamic image resizing, Customizable themes (you can override any of them with your own stylesheet), navigation placement (top and/or bottom), a logo, background images,  pagination, search and comments are just some of the things you can configure with this bad boy. So far I’m impressed. I have a couple more tweeks to make to the css and I haven’t tested on a tons of handsets yet, but for something that takes 10 min to stylize and 30 seconds to install….it’s tight.

Multiple urls in one form action? No problem!

by  • September 8, 2011 • Uncategorized

I was trying to update a bing module today at work with some new click and tracking codes. The new click urls required me to daisy chain two urls together for the form action AND pass some other params over, including the search term. I tried pass one url in the query string to the other with no avail, then our VP of Engineering (you may no him as Cha0ticZ) sends me this little gem (with one modification to launch in a new window). No rocket science here, just good old fashion javascript.

<form method=”GET” name=”bing-form-submit” id=”bing-form-submit” onsubmit=”var newLocation=’http://ad.doubleclick.net/clk;xxxxxxxxxx;xxxxxxxxx;c?http://www.bing.com/search?q=’ + document.getElementById(‘q’).value; window.open(newLocation,’bing_results’,scrollbars=1,resizable=1); return false;” action=””>…</form>

So rather than submitting the form, we’re really just launching a new window with the url we want (like all the other links in the unit). Rok.

Creating a shortcut for find/grep

by  • September 6, 2011 • Uncategorized

I don’t know about you, but I find myself having to use find/grep constantly to find things on the servers I work on. And I get tired of typing long commands over and over again. If you feel the same, this article may help. Now, if you’re a bit new at linux or a little rusty on your command line chops, you may not know or remember how to use find and grep. Many people just use grep, but using find and grep together is faster and more effective. So if I wanted to find all the php files that have the word “content” in it. My favorite command for accomplishing this is like so:

find . -name '*.php' | xargs grep -s 'content'

What this means is, find all the files that end with the extension .php in the current directory and pipe the results into grep. Suppressing all errors (-s) look for the word “content” in every file and display the name of the file as well as the line of code that appears on.

If you’re anything like me, it took me awhile (years ago) to remember this command when I needed it. And now, I use it constantly, but frankly, I get tired of typing it. So, I figured out (not really being a “linux guy”) how to create an alias or shortcut for this command. Start by editing the .bashrc file in your root directory like so:

vi ~/.bashrc

Then add these lines of code to the bottom:

alias search="find . -name '*.php'|xargs grep -s "

alias searchjs="find . -name '*.js'|xargs grep -s "

Notice, that I created two shortcuts, one for php (most common) and one for javascript. For some odd reason, when I tried searching both extensions, it did not work. If anyone knows the reason for this, please leave a comment. After you save your file, source it, like so:

source ~/.bashrc

And now you can use your command, but typing it from anywhere followed by the phrase you want to search for. Finit!

May the force be with you.

Great facebook like button plugins…

by  • September 2, 2011 • Uncategorized

Here’s a good link describing some of the different plugins for the fb like button (or how to add it yourself). If have added many fb buttons, but I wanted something really quick and dirty last night (hey-o!) and went with Facebook Like Button Plugin. However, the dark scheme did not appear when I selected it and the Like box is also difficult to style. But that has nothing to do with the plugin. I will probably end up adding the buttons myself. But it was fast way to add them in 5 min.

http://mashable.com/2010/05/07/wordpress-facebook-like-buttons/

Enjoy!!