Warning: Invalid argument supplied for foreach() in /home/jared/jaredquinn.info/public_html/wordpress/wp-content/plugins/head-meta-desc.php on line 56
Jared Quinn :: Ask JaredQuinn
Jared Quinn

IT Consulting :: Design :: Events Management

Ask JaredQuinn

Another new section of this website has just been kicked off, I’m calling it “Ask JaredQuinn”. In this section I will attempt to answer HTML, CSS, JavaScript, PHP, Perl and WordPress related questions.


Business Blog Consulting


The majority of my time is currently spent answering a few questions from prospective clients, I figured I should cover a few of these questions here.

Which Blogging Software should I use?

I may be a little biased with this one, the obvious answer to me is WordPress. Why? Because WordPress is flexible, easy to use for non-technical people, easy to extend for the slightly more technical, and completely customisable for the fully technical.

Can WordPress do …

Yes. Yes it can. Whatever it is. It may not be able to do it now, but with the right amount of time WordPress can be setup to do almost anything you like. An example of this is a job I am currently working on which has extended WordPress to include a full CMS with specific options dedicated to storing and sorting Printer Information.

Why should I blog?

You should blog for multiple reasons. The most common reason I recommend businesses start blogging is to drive traffic to their website and to keep in touch with a client base for regular product and market information.

Driving traffic to your site depends on your content. A blog is the simplest way to regularly publish and provide up to date info to your customers.

What is SEO?

SEO is simply Search Engine Optimization. In more detail it is customising your website to achieve better results in a search engine. The most effective way of increasing your search engine ranking is a simple on. Providing content people want.

If people link to your content, your rank on google will increase. More people will link to your content if you provide good content. More people will link to your content if you provide fresh, updated content.

Why do I need a good search engine result?

Rarely will users go past the first page of results returned by a search engine. You should aim to be in that first page on a search for relevant search terms.

Why do I need a Consultant?

Do you re-wire your house, do your plumbing, mow your lawn, fix your car and television? No you generally find someone who is experienced in doing these, or can save you money by really knowing what they are doing.

Why should I pick you?

Sure Joe Bloggs has a cheaper price. But does he have 10 years experience in IT, with a focus on Web Technologies? Is he also a competent programmer, with the ability to provide custom code for a specific job? Does he also have graphics and HTML experience to provide layout tweaks. Does he understand XHTML and CSS standards, and strive to meet those standards?

I can answer yes to all of these questions and more.

I also provide my time voluntarilly to the WordPress community, answering questions in the support forums and providing plugins to WordPress released under the GNU Public License, making them free to use, distribute and modify.

Essential Web Tools Collection


What tools do you recommend to help other Website Developers?

This is a particular tough question. My background is in UNIX administration, and all my web and development work is performed using Firefox and Vi1.

However I have come to rely on a few tools in particular, and found some others very usefull on occasion. All of these tools are browser based (and therefore cross-platform) and more importantly freely available. Please contact me if any are broken, shouldn’t be here or you have suggestions.

Standards Compliance
Site Layout
Search Engine Optimization
Spelling, Links etc.

Footnotes

  1. vi is a traditional UNIX text editor []

Auto Setting the Timestamp in WordPress


How can I automatically set all posts to 00:01am for the following Monday morning?

(Modified version of a question I answered in the WordPress support forums at http://wordpress.org/support/topic/59803)

This is something that I quickly hacked together. I’ve never actually tried plugging anything into the Admin interface to over-ride/replace anything, so for the moment it’ll stay as a quick hack.

Open up and Edit wp-admin/admin-functions.php, we’re going to put a new function in there.

function get_next_week($tint) {
   $weekdayid = date(“w”, $tint);
   $startoftoday=mktime(0,1,0,date(“n”, $tint), date(“j”, $tint), date(“Y”, $tint));
   return $startoftoday + ((8 - $weekdayid) * 86400);
}

Now, Find the ‘touch_time’ function and in particular the line that says:

$time_adj = time() + (get_settings(‘gmt_offset’) * 3600);

Change it so that it looks like:

// $time_adj = time() + (get_settings(’gmt_offset’) * 3600);
$time_adj = get_next_week(time());

This will cause all posts to default to 00:01 on the following monday. If you want to change that particular date/time, play with the get_ext_week function defined above.

MAC Address Filtering with iptables


When I was visiting recently, I needed to have my MAC address added to your firewall configuration to be allowed to access your network, how did you do this?

The simple answer to this question is that I actually use Shorewall running on my Debian-based router. It has a maclist configuration file with a layout that looks like:

eth0  00:50:22:E7:3A:B2  192.168.1.2    # usajii
eth0  00:0F:EA:B3:A9:64  192.168.1.101 # tachan
eth0  00:06:5B:E5:6F:BD  192.168.1.102 # binky

Of course, I also only give DHCP addresses to registered mac’s as well, and ensure that the address corresponds to the host it is assigned. I haven’t automated the update of both Shorewall and DHCP configuration files, yet. That’s something thats on that extremely long to-do list of mine!

So, DHCP configuration for these hosts (just for interest) looks like:

host usajii { hardware ethernet 00:50:22:E7:3A:B2;
                 fixed-address usajii.home;
                 server-name "usajii.home"; }

host binky  { hardware ethernet 00:06:5B:E5:6F:BD;
                  fixed-address binky.home;
                  server-name "binky.home"; }

You don’t want to run Shorewall? That’s fine. It’s still possible of course. I am just particularly fond of the way that Shorewall works. I like it’s flexibility and general approach to doing things, so I use it. If you prefer raw iptables or something else, good, go for it. Here’s how to do it with pure iptables:

# iptables -A INPUT -i eth0 -m state --state NEW -j macfilter
# iptables -A macfilter -s 192.168.1.101 
        -m mac --mac-source 00:0F:EA:B3:A9:64 -j RETURN
# iptables -A macfilter -s 192.168.1.102 
        -m mac --mac-source 00:06:5B:E5:6F:BD -j RETURN
# iptables -A macfilter -j REJECT

You would have to change the INPUT rule to insert the rule in a relevant spot in your INPUT chain, you probably don’t want it below a rule that rejects everything first! (check the manpage for iptables for how to do that one). You can leave out the –state and -m options if you want to check every packet, but I feel safe enough only checking the first packet of every connection the host makes, you don’t really need to check every packet sent for a 800Mb samba transfer for instance!

The following rules instruct iptables to ‘return’ to the calling chain (the chain which used -j to jump to the macfilter chain), so these packets get processed by the upcoming rules.

If the packet manages to fall through all the rules granting a ‘return’ it hits a ‘REJECT’ rule, which will reject all packets that get to that point. You could be mean and ‘DROP’ them instead, or you may wish to insert some logging prior to it:

iptables -A maclist -j LOG --log-prefix "MAC Filter:" --log-level 7

You will want that before the ‘REJECT’ rule, otherwise the packet will get rejected before it gets logged, and therefore not get logged.

If you don’t want to restrict particular mac addresses to particular IPs you don’t have to. You can leave the IP section out of both styles - the shorewall config is happy without them and so is the raw iptables way, e.g.:

# iptables -A macfilter -m mac --mac-source 00:06:5B:E5:6F:BD -j RETURN

Hope this helps you secure your network a little further.

The reason I originally setup mac filtering on my network was for my wireless subnet, which isn’t up and running at the moment, but I expanded the idea to be the whole network when I started sharehousing and not being sure I could trust just anyone plugging into the network.

Image Submit and New Windows


“I’m wondering if you could help me. I have an image and i need to give it this as it’s link <input type=submit value=Login>, how can i do it, any ideas? Is there any chance i can get it so it opens in a new window?”

Firstly, without me ranting, I really do not like anything that opens in a new window, unless it is part of an web based application, has a good reason to do so and the action is not unexpected for the user. Apart from that on with answering your question.

The first part is easy, standard HTML, something like the below code snippet should do exactly what you want.

<input type=“image” name=“submit” value=“login” src=“/image.jpg” />

Now to open your form in a new window. I personally think using JavaScript is the best way to do this.

Let’s define a function to do it. This can be inserted anywhere in your HTML.

<script language=“JavaScript”>
<!–
function openWin() {
  var p = window.open(‘’,‘popUp’,’scrollbars=no,resizable=no,h=100,w=200′);
  document.MyForm.target = ‘p’;
}
//–>
</script>

Now we put our form together, noting that the form’s name is the same as the one used in our function.

<form method=“post” name=“MyForm” action=“dest.php” onSubmit=“openWin();”>
<input type=“image” name=“submit” value=“login” src=“/image.jpg” />
</form>

I hope this answers your question sufficiently.