Skip to content


Find differences in both arrays with PHP

Sometimes something looks easy, but it turns out to be a rabbit hole. Take for example the function array_diff in PHP. I thought it would return all the differences in both arrays, but it doesn’t. After going through the function comments thread, I came across a great solution. It’s to the point and it works!

To get the differences in both arrays, you can use:
array_merge(array_diff($array1, $array2),array_diff($array2, $array1));

For example:

$array1 = array('John', 'B', 'Smith');
$array2 = array('John', 'C', 'Smith');

$result = array_merge(array_diff($array1, $array2),array_diff($array2, $array1));

print_r($result);

will return:

Array
(
[0] => B
[1] => C
)

Basically the first call to array_diff returns the differences in $array1 and then the second call returns the differences in $array2. After that, they are merged together as an array, to provide all the differences in both arrays. Simple and sweet.

Credit goes to this comment.

Posted in PHP.


Having IE CSS issues? Use DOCTYPE!

Ok, this is probably silly, but I ran into an issue where everything was working in FireFox, but IE wouldn’t take. So after some searching and pounding my head against the keyboard, I ran across a quick forum post where someone mentioned to put in a DOCTYPE for your page. So I added the correct DOCTYPE and bam! everything work… thank you Google.

Here is a list of DOCTYPEs out there:
http://www.w3.org/QA/2002/04/valid-dtd-list.html

To save you some headache make sure you put one in.

Posted in Web.


HTML dotted border

I recently ran into an issue where I was using an image as part of the navigation and when you clicked it, you would go to a specific section of the website.  When you would click the link, there would be a dotted line around the image and it became real annoying.

After a little bit of research I found out you can remove this dotted line by using the following CSS:

a {
outline: none;
}

After I placed that in my default stylesheet, the lines were no more.

Posted in Web.


Changing the cursor on web pages

I’m getting more into jQuery and I recently ran into a need to change the mouse cursor when I would hover over a section to indicate what’s going on.

The first thing I needed was a cursor type. I accomplished this by adding a quick class entry into my CSS file:

.over {
cursor: pointer;
}

I used the pointer cursor because that’s what I needed. I came across a really awesome CSS cursor compatibility list at:
http://www.quirksmode.org/css/cursor.html

The next step was to add Javascript to handle the mouse over:

$(document).ready(function(){

$('.mybox').mouseover(function() {
$(this).addClass("over");
});

$('.mybox').mouseout(function() {
$(this).removeClass("over");
});

});

Basically the div section I used was:

<div class="mybox">Change the cursor</div>

Now I have a pointer when I hover over the div section.

Posted in Web.


Git Patching on Windows

I just ran into an simple but annoying issue. I wanted to create a patch from a git clone I made a modification on Windows with Git. I kept running into blank git patch files and I finally found out what I was doing wrong. Here are the steps I used to create a patch on Windows with Git:

1. Grabbed a fresh copy of the git clone
I did this because the current clone I had was full of other changes and I wanted to isolate the patch changes.

2. Modify your clone

3. Commit the changes
Run “git commit -a” – Make sure you put in a comment before you save the file.

4. Create the patch
Run “git format-patch -1″ – This will generate a *.patch file. Make sure you are in the correct folder, but don’t worry it will complain if you are not.

That’s it, I hope this helps someone.

Posted in Git.


devLink Day One

The first day of devLink started out the night before at 10:30 PM EST. Mike Eaton and I began our trek down through Indiana, Kentucky, a couple truck stops and were finally dumped into Nashville, Tennessee at 5:30 AM CST.

Josh Holmes was awesome by letting Mike and I stay in his room to catch up on some z’s and shower the road grime off.

The next stop in the day was the Community Leadership Summit at Jack’ s BBQ. This was a great way to start devLink, by giving people in the community an outlet on how to grow and nuture the community. The break down was, there were a couple group chosen lightening talks, moved on to open spaces and then a quick presentation on each open space talk. Prizes were given out through out the event, including a chainmail coif. Who doesn’t want chainmail? really, who? Could you imagine a business meeting if you walked in wearing chainmail? Sweet.

After the summit a group of us went to The Melting Pot. Hooooly cow. I kept eating and eating and eating, I had to leave or I would burst. I didn’t want the waitresses to have to clean up, so I stopped. If you are in Nashville and are looking for a place to eat, make sure you go there at least once.

I had so many great hallway conversations and I’m looking forward to the rest of the weekend. Oh and I finally got to bed around 1:30 AM.

Posted in Community, Events.


Getting to know the Ruby Koans

Since the Ruby fad isn’t going away I figured, “Hey, why not”. I know a bunch of people who use Ruby on a daily basis and even make a living off it. So with an addiction to different languages, I started my trek through the Koans. What’s great is, I’m going to an event next week where I’m attending a session called, “The Ruby-Koans: Path to Ruby Enlightenment” with Leon Gersing in the drivers seat, awesome guy (Who now is working at EdgeCase, company that created the Koans)

I’m 25% through the Koans right now and expect to be the majority of the way through by this event. I’m not done yet, but the Koans are easy so far. I’ve had a couple, “aah that’s cool” kind of moments, but fairly standard stuff. I really like this way of learning a new language and I highly suggest you go through them if you plan on learning Ruby.

Git the Koans here:
http://github.com/edgecase/ruby_koans/tree/master

Posted in Ruby.


Paypal button with Joomla

I wanted to post this to save someone some time.

I recently ran into an issue where I was trying to display a Paypal button on an article within Joomla. The button showed on the page, but when you clicked the button, it would send you to a Paypal page with an odd error. I was posting the Paypal button using the HTML form code they provide.

What I found out was, the email cloaking plugin was taking the email address in the form code and replacing it with Javascript. Once I disabled the email cloaking plugin, everything worked without any issues. You can disable/enable the email cloaking plugin by going to Extensions->Plugin Manager and clicking on the red circle/green checkmark in the Enabled column.

Posted in Joomla.


Zen, not just for devs

I used Zen (www.agilezen.com) a couple weekends ago on a project for the Ann Arbor GiveCamp. Prior to GiveCamp I didn’t see a need for Zen in my life and to be honest I’m a structured kind of guy. However I used Zen to manage this project and it helped keep the flow going, even at 3 am in the morning. I knew what needed to be done, what was being worked on and what was completed. So I had good sense of where I was and if I was going to finish on time. This was a lot easier than using post-it notes and paper.

After the event I kept thinking, “Is Zen a good fit for the list of projects in my life?”. The magic 8 ball said, “Ask again later”.

Well, my brain didn’t stop churning, I wondered where Lean and Zen could be applied to other parts of my small business.

A little background. My wife and I have a process where she identifies contract leads, I follow up on the lead and hopefully get a contract out of it. We (I), have been struggling with how to track lead status and make sure 100% of them are either contacted or processed in some way. Currently it’s in Outlook with no real way for me to keep my wife in the loop. I know there is Exchange and others, but I want something simple, with some basic performance metrics.

While eating lunch thinking about process and work flow stuff, somehow the lead tracking issue and Zen came together. Must be the fast food.

After looking through Zen and the ability to customize the work flow through phases (Click Process at the top), I realized this would be an awesome way to track sales leads. I will have the ease of managing leads and my wife will have the ability to track my “performance”. Another useful feature for tracking leads, is the ability to mark one as blocked and being able to give a reason. That way someone else will know what’s going on and help move it along.

I think I’m going to use a customized light version of the sales process listed on wikipedia:
http://en.wikipedia.org/wiki/Sales_process

It would be great to be able to create projects based on process templates. *wink* *wink*

If this works out as well as I think it will, then I just need to integrate it with Freshbooks and I’ll be rockin’.

Now I just have to convince someone we need another monthly expense.

Posted in Lean.


SQL Server Express 2008 Download

I don’t know when Microsoft switched over to basically forcing you to install via the Web Install system, but after five SQL Server Express 2008 install attempts, I had to find the tried and true way, downloading the install. So my hunting on Bing lead me to a SQL Express blog post, outlining how to install SQL Server 2008 without the web install, awesome. Now I’m up and running with error messages that make sense guiding the install. I think the web install concept is interesting, but I think someone on that team needs to look at Apt or Yum for an example on how to build a package manager.

Here is the post outlining how to install SQL Server Express 2008:
http://blogs.msdn.com/sqlexpress/archive/2009/06/15/installing-sql-server-2008-guidance.aspx

Posted in SQL Server.