By brian, 4 months and 18 days ago

Freelance Programming Feedback

This post contains comments from people whom I've done custom work for in the WordPress, vBulletin, and vBSEO worlds. I've asked those that I've worked with before to leave a few words here about my quality of work.

If I've done work for you, please leave a few words so others who are considering working with me know that I'm legit and can deliver as promised.

Thanks

By brian, 7 months ago

Wordpress Permalinks on IIS with ISAPI_Rewrite

I've run WordPress here on my CentOS box for nearly 4 years and am quite familiar with the software. Recently, I had a client on a Windows system request a blog be added to their web store. Their webstore is written in ASP and runs on windows. They wanted to stay on the same domain for SEO purposes, (thus site.com/blog/ instead of blog.site.com or a new .com). Without the subdomain or new IP, there's no way to change DNS for a subdirectory to a different server. This meant I had to get it working on IIS.

Native installations for apache tend not to port well (or perhaps, easily) over to windows/IIS. Thankfully, ISAPI3 from HeliconTech.com supports .htaccess files and makes the job a little easier. Wordpress works fine on windows/IIS until you want nice permalinks.

After MUCH searching, testing, and error log analysis, I've got a working solution for Windows Server 2003 with ISAPI_Rewrite 3.1.x, running php 5.2.x and mysql 5.0.x community.

  1. index.php should be set up in IIS as a default document (same place you find default.asp, index.htm, etc)
  2. edit wp-settings.php
    Find:
    1. <?php

    at the very top of the file.

    Replace with:

    1. <?php
    2. //*****************************
    3. //    IIS FIX
    4. //
    5. $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
    6. //*****************************
  3. create the following htaccess file with the Helicon Manager:
    1. RewriteEngine On
    2.  
    3. #RewriteBase /
    4.  
    5. RewriteCond %{REQUEST_FILENAME} -f [OR]
    6. RewriteCond %{REQUEST_FILENAME} -d
    7. RewriteRule . - [L]
    8. RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    9. RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    10. RewriteRule . /blog/index.php [L]

    • Note: You may need to alter the RewriteBase or the last rule to your specific location. In my particular case, I was installed on domain.com/blog/

From here, you can edit your permalink structure as you normally would. If the default options has index.php/ as part of the rule, you can remove that.

By brian, 11 months and 1 day ago

Dreading Tax Season

Every year around this time, I start getting nervous. The fear of getting audited constantly crosses my mind. No accountants around me have a clue about internet marketing. It really is a special niche that most have zero experience with. This is the conversation I had with the last 3 places I called:

ME: Hi, I'm looking to chat with someone experienced with internet marketing income to help me with my taxes.
ACCOUNTANT: ohh, so you run a store?
ME: No, I get paid 1099-misc by many 3rd parties for running their ads and marketing for them.
ACCOUNTANT: Wait, you make money without selling anything?
ME: Yes, I run ads for them on my forums, blogs, and other websites promoting their products, services, etc, of which I get a cut if there's a sale or a click, depending on the type of ad.
ACCOUNTANT: So you don't have an inventory?
ME: Thanks for your time.

While I'm sure they are smart with numbers, I simply can't trust in good faith someone who doesn't have a clue about the type of business I'm in to make the best business tax choices for me.

On top of all my web income and expenses, I also work W2 with a 'real' 9-5 type job. Then, there's my 401k, my stocks that i've bought, sold, and earned dividends on, bank account interest, mortgage interest, my local/state income, property, and car taxes, the percent sq.ft of my dedicated office on my house that I get to write off for a business expense and so on and so forth. At the end of the day, my taxes suck.

To make matters worse, I have an ever-growing pile of tax forms on the floor of my home office.

Tax Forms

The worst part is that I'm still expecting a couple forms in the mail.

Do you dread Tax season as much as I do?

By Brian, 1 year and 1 month ago

Rand() isn't Random

If you use Microsoft SQL 2000, you've probably at one point had to pull random results. The built in rand() function simply doesn't work. It gives you a random value the first time, and every time after it is the same it seems.

I found a new way to do this today after 20 pages of searching, so hopefully this will help someone else.

ORDER BY newid()

yup, it's that simple.

  1. SELECT
  2.   TOP 2
  3.     field1
  4.    ,field2
  5. FROM
  6.   TABLE
  7. WHERE
  8.   field1 = 1
  9. ORDER BY
  10.   newid()

To be noted, this will put a full table scan in place before it selects the top 2, so keep performance in mind.

By Brian, 1 year and 1 month ago

New Toy for the Office

Christmas is coming, and so is the end of the year. I need to spend some money on my business so i don't get taxed to hell like I did last year. So, I upgraded my office computer.

I'm currently working on a 2yr old HP dv8000 amd turion laptop. it's had its hay day. The video card on it keeps over heating. I guess it wasn't meant to be on for nearly 2 years straight. The only time it was off was when i moved, and when we lost power for longer than the battery would last (i don't even think there was more than one time that happened)

I hit up new egg for a new tower. Back to the tower. Why? Well, I never used my laptop as a laptop at all in the first place. And it's still good, so i can take it with me on business trips or whatever.... just can't do anything that requires a lot of video memory like watching movies without it crashing. So, new desktop it is.

Parts coming include vista ultimate, Q6600 quad core processor, 2gb ram, 8600gt video card, dfi T2R (or is it TR2.. i forget) board and a bunch of other random goodies.

With it, I ordered a monitor. I'm still waiting on my parts to build the tower, but the monitor showed up today. Go big, or go home! The Samsung 30» now sits on my desk. It's unbelievably huge.

My measly 17» widescreen laptop on my desk, with my MAudio BX5 powered studio monitors.

laptop - before

With the new 30» behind it, waiting patiently...

samsung 30 inch monitor

Can't wait to try this bad boy out!!

By Brian, 1 year and 1 month ago

Getting the Big «Oops» from a Server

I had some minor problems with xCache recently that ended up causing segfaults in my apache install. I had left my SSH putty session open last night and didn't check my laptop before I trecked into the office this morning (yes, some of us bloggers still have 9-5's). When I got to work, I noticed my server was down. I had to hard reboot it through the IPMI switch at my data center. I removed xCache from my php.ini and things have been solid since.

I came home from work and looked at my putty session and got a good laugh. «Oops» it tells me. haha. I had a good chuckle about it.

Oops

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 ...
sv03 kernel: Oops: 0002 [#1]

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 ...
sv03 kernel: SMP

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 ...
sv03 kernel: CPU: 1

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 ...
sv03 kernel: EIP is at kernel_thread_helper+0x7/0x10

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 ...
sv03 kernel: eax: 00000000 ebx: c0434cd9 ecx: ffffffff edx: ffffffff

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 ...
sv03 kernel: esi: 00000000 edi: 00000000 ebp: 00000000 esp: e8121fe8

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 ...
sv03 kernel: ds: 007b es: 007b ss: 0068

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 ...
sv03 kernel: Process pdflush (pid: 8071, ti=e8121000 task=f67d3000 task.ti=e8121 000)

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 ...
sv03 kernel: Stack: c2858f60 00000000 00000000 00000000 00000000 00000000

Message from syslogd@sv03 at Wed Nov 14 04:56:14 2007 ...
sv03 kernel: Call Trace:

By Brian, 1 year and 1 month ago

xCache is More Trouble than it's Worth

Two servers and a just about every option variation later, I've officially given up on xCache.

The first round of problems involved caching config files and forms that needed to be updated all the time. I made exclude rules for those, and eventually it just got too long and became way too tedious to restart apache every time i changed a config file.

Second round of problems involved Apache segfaults. Happened to me twice in 12 hours and cost me a good amount of money as it happened at 5am the second time, and I didn't log in to check my server until noon (because I was sleeping). 7 hours of downtime across multiple sites that my server hosts, and I'm out some cash because of it, and missed out on some traffic due to a digg'ed post that is currently about to break from upcoming into popular.

I've disabled xcache for now, and things seem to be stable again.

Running it, it saved me about .2 average load, and memory usage was about the same at 25% most the time.

I can't say the site ran faster with it on either.

Maybe i'll try it again in a later version, but in my opinion, version 1.2.1 is not all it's cracked up to be.

By Brian, 1 year and 1 month ago

You Comment, I Follow

In a lame-duck attempt to get some feedback on some of my posts, I have implemented a plugin so that links posted in the comments will ignore the rel='nofollow' attribute. If you leave a comment here, you will get a free natural link-back.

By Brian, 1 year and 1 month ago

Restart Windows via Remote Desktop

Ever try to restart a machine via remote desktop? I just ran into it for the first time tonight. I generally deal with linux servers and don't ever RDP into them. Tonight, I needed to reboot a windows server. No «shutdown» exists on the Start menu. Even on the task manager, there's no shutdown option.

It's an easy bypass though.

Instead of CTRL+ALT+DEL like usual, use

CTRL+ALT+END

From here, you will be able to shut down or graceful reboot the system.

By Brian, 1 year and 1 month ago

Intro to CURL with PHP

CURL is a command-line style function to send data via a URL. WikiPedia has a more detailed article on what it is and does.

Preface - your php installation on your server must be CURL-enabled. You can download the CURL package for free. This article assumes your server is ready to go.

While CURL is not an alternative to AJAX, it can be used in similar situations where you need to send data out somewhere without the user having to go there. In it's most basic operation, you have some data to send out to a script.

We need a a simple function to handle our data, a page to process said data, and a source page where the function is called from.

The call page is simple. Something as simple as:

  1. <?php
  2. print sendCURL($var1, $var2, $var3)
  3. ?>

where $var1 -3 are predefined, or even hard-coded strings will suffice for basic testing. This php block sets us up to print the output of our function:

  1. function sendCURL($var1, $var2, $var3, $referrer="") {
  2.   $mycurl = curl_init("http://domain.com/curl_processor_page.php");
  3.   
  4.   $fields = array(
  5.     "var1" => $var1,
  6.     "var2" => $var2,
  7.     "var3" => $var3
  8.   );
  9.  
  10.   $curlagent = array(
  11.     "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
  12.   );
  13.  
  14.   curl_setopt($mycurl, CURLOPT_POST, 1);
  15.   curl_setopt($mycurl, CURLOPT_HEADER, 0);
  16.   curl_setopt($mycurl, CURLOPT_NOBODY, 0);
  17.   curl_setopt($mycurl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
  18.   curl_setopt($mycurl, CURLOPT_REFERER, $referer);
  19.   curl_setopt($mycurl, CURLOPT_RETURNTRANSFER, 1);
  20.   curl_setopt($mycurl, CURLOPT_SSL_VERIFYPEER, FALSE);
  21.   curl_setopt($mycurl, CURLOPT_HTTPHEADER, $curlagent);
  22.   curl_setopt($mycurl, CURLOPT_POSTFIELDS, $fields);
  23.  
  24.   $response = curl_exec($mycurl);
  25.   curl_close ($mycurl);
  26.   
  27.   return $response;
  28. }

This function is your basic CURL request. Setting the variables into an array to pass, and setting headers and Options within CURL on how to process it. The only real change you will need to make to this function are your variables in the array and your URL that you wish to send it to.

The curl_processor_page.php is no different than any other php page that can handle incoming $_REQUEST parameters. Those var's need to be set up in the function that the page is looking for, perhaps a username, password, and a realname.

What that script does is entirely up to you. I won't post an example, because I don't want anyone to think that you can only do one method with this function set.

You could have the response be ANYTHING that gets returned from the processor page. A remote login, a simple welcome screen, or even creating accounts (how do you think those auto MySpace friend adder bots work?!)

A useful tool when playing with CURL is the LiveHTTP Headers plugin for FireFox. This plugin let's you see what's getting sent via HTTP AS it happens. It's a real-time watchdog and is very useful for debugging CURL requests to see where it's bombing.

Happy CURLing :)

← Previous 01 02 03 04 Next →