Archive for March, 2010

What is Passive FTP?

After years of using passive FTP I figured I should find out what it actually does compared to Active FTP.

The difference is in Active, your client tells the server what port you will be doing your business on.  Active has worked fine for years, usually on port 21. However with more and more firewalls there had to be a different way. This is where passive mode comes in. In Passive FTP, the client asks the server what is the best port for the server to use. The server responds with a non-blocked port and you can go ahead and transfer.

As a note, in my experience with ftp, if you are getting errors trying to connect. First check all the host/login information.  If that is all inputted correctly its a pretty safe bet you need to use passive ftp.

Deducting Business Startup Costs

For the most part, business start-up costs and organizational costs must be deducted over a 180-month (15 year) period. For example, if your start-up costs were $18,000, and you started your business on August 1, 2009, you would be able to deduct $500 in 2009 for your start-up costs. ($18,000 divided by 180 months = $100 per month. If started in August, the business will be operating for five months in 2009.)

Getting your Google Base Items to be listed in main comparisons

I have recently been listing items for sale onto Google Base through XML Feed created by a custom PHP script. There was an issue that I was having trouble fixing however. All my items were at the bottom of search results. Many items that were not even the same thing being searched for were being listed before mine. Meanwhile the number 1 item listed was usually a grand comparison of major sellers displaying their price for it. From there you can filter the results. My goal was to list my electronic goods right next to Best Buy or Newegg and have a better price.

After searching the internet for the answer I got no where. From there I had hunch it had to be based on some sort of identifier that groups all of these together. With this idea in mind I found some Google documentation on adding what’s called a GTIN, basically a unique identifier for a certain product. This can be UPC, ISBN, SKU among others.  I eventually added a <g:upc></g:upc> tag to my feed and the next day I was right with the big boys. The difference in traffic is absolutely tremendous and has transferred into a big sales jump.

The GTIN is not required. But you should add this for your benefit.

Curly Braces in Mysql Queries

I came across a few queries in our newest project and noticed a bunch of them injected their variable data inside curly braces.

I come to find out you can use this in any string in php to encapsulate whatever data you need. Whether it is a simple variable like $x = 0 or a part of an array or object.  I happen to never be aware of this since I usually achieve  the same results by popping out of the string to add my data, ex. $x = “My favorite baseball team is “.$fav_baseball_team.”!”.  It really comes down to aesthetics but still interesting to know.

FPDF

I’m considering using FPDF as a solution to creating PDF’s on Debian since FDFlib isn’t installed. It isn’t as efficient as the native PDFlib, but apparently is sufficient for most things. I’m impressed so far.

If interested, this is actually installable through apt, though I’ll probably just include it on a per application basis. It makes applications more portable.

Here’s some sample code from the FPDF website.

require('fpdf.php');
 
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();