Sunday, March 30, 2008

Subtotal Not Adding Up Correctly in PHP (with Items over 1000)

I am on a few list serves and occasionally I am able to get a few of the questions answered. I will post some of them on my blog occassionally in case you run into the same issues. In this case, one of my fellow programmers ran into an issue where his subtotals where not adding up properly. I had run into the same issue myself. Just read below. It is simply a matter or recognizing that your variable might be formatted to display with a comma, such as 1,432.12


----- Original Message -----
From: Matt
To: List
Cc: Mauricio
Sent: Sunday, March 30, 2008 11:48 PM
Subject: Re: it it a php bug? or am i just slow?

That was it!!

apparently the ',' was settype()ing it on the fly as a string, so when it came to the += it was evaluating wrong..

Many thanks Mauricio!

Mauricio Zuniga - Systems Engineer wrote:
also,
even though you are giving us the values,
could it be possible that you have your number formatted with a comma?
such as 1,321.43.
I once ran into an issue where my subtotals were not correct because of this...
----- Original Message -----
From:
To:
Cc:
Sent: Sunday, March 30, 2008 10:29 PM
Subject: Re: it it a php bug? or am i just slow?

I set up the following loop:
$item_price = 0;
$items = array(50, 100, 1357);
foreach ($items as $v) {
$item_price += $v;
echo "
$item_price";
}
and it gave the following output:
50
150
1507
which is what was expected.

Could you post the actual loop code you are using? Perhaps there is something there we can help with?

Daniel

Mattwrote:
Not sure if this is a bug in PHP, or if I'm just especially slow...

I've got a script that's calculating the total order for items in a cart. To do this it's doing a simple += on the variable $subtotal as it prints each row on the cart page, then it prints $subtotal in the appropriate spot at the end. So on its way through the loop that prints each row, right at the end of the loop it does:

$subtotal += $item_price;

Simple, straight forward, not a problem.

It works perfectly fine. IF the value of $item_price <= 999.99 (?!??!!!?!?!?!?)

Anything >= 1000.00 and it adds 1 to subtotal, not the $itemprice. (?!?!?!?)

I've echoed $item_price and $subtotal while the loop is printing, I get results as below:

// first iteration
echo $item_price; // 50.00
echo $subtotal; // 50.00

// second iteration
echo $item_price; // 100.00
echo $subtotal; // 150.00

// so far, so good, right?

// third iteration
echo $item_price; // 1357.00
echo $subtotal; // 151.00

/// what??

// fourth iteration
echo $item_price; // 100.00
echo $subtotal; // 251.00


Any ideas? The only option I've considered so far is chucking every computer in the house out the damn window and becoming a carpenter, but I'm still on the fence about that.


-M.E.


--
_________________________________________



--
_________________________________________




Labels: , , , , , , , , , , , ,

Friday, March 28, 2008

How to Take a Video Screen Capture in Jing and Send it to Youtube.com

Wow, what a painstacking process this was!
It took me so long that I decided to write a blog entry about it while I am waiting for the conversion.

Here are the ingredients that I used to capture my screen and get it on youtube for sharing.

I went to jingproject.com by techsmith which is my favorite free screen capture tool (and I hope that it stays that way).

When you download and install this program you can then easily create screen videos of whatever you do. Simply talk over what you are doing while recording to create a video. You have a maximum time of 5 minutes and you can pause the video while recording.

It takes a little getting used to, but there is no editing available in jing as of this post. That is ok, we have ways to get around that for now. I personally used Sothink SWF Quicker to edit my SWF file for places where I needed to blank out sensitive information.

I could not figure out anything else I could do with this software, although my intention was to somehow edit it to fix the ending. Regardless... its good enough. This whole process is taking me longer than I would like anyway.

I also found a free flash to video encoder to then get my swf file to a youtube friendly format. I chose mpg as I know this should be small. Now be ready to wait at least 15-25 minutes. You can specify how the length of the conversion (ie you may cut some of the end of the video... wow which is exactly what I wanted to do since I somehow added 10 minutes of nothing at the end while messing with it in the previous program!) But please note that the demo version for the converter I downloaded actually ended up putting up some real annoying ads over the conversion. I would not mind in most cases, but it bounces around in the most annoying fashion all over the screen. Oh well- if I find a better tool, I will post it here. For now, at least I have my video on youtube!

Now that you know how... you should be ready to take your video and upload that baby!

By the way, I recently found out the sothink has a swf to video conversion tool which is much better than the one that i originally used. All the software mentioned here has at least a 30 day trial limit.

Labels: , , , , , , , , , , , , , ,

Configuring Linux Apache on Virtual Dedicated Server via SSH

So I ran into an issue these last few days where I was taking way too much RAM on my server. Of course, that is the woe of someone who is always pushing the limits of whatever computing power I can get my hands on.

I had to get my feet wet a little bit more with ssh, apache configurations, httpd.conf, and even little things such as commands on how to navigate within Linux. I am fairly versed in many computer aspects, and this wasn't too difficult, but I imagine I will forget how to do this in the next week, so I try to keep a good record of what I do.

I have decided to publish my video for others. I hope you will use it for good and reciprocate my efforts by providing a link to either my site http://www.SaveonAtoZ.com or this one http://www.MauricioZuniga.com.

So without further ado, here is the video on how to configure your httpd.conf on your virtual dedicated server. Mine, as you can see was hosted on eDealdomains.com - But I am sure it can work for you on almost any control panel with SSH connection (please refer to your control panel).

Lastly, I did run out of time in the video right at the end ... the only thing left for you to do is restart apache service and you are set to go. In my control panel there is a way to do that. Worst case scenario, you could always reboot the server if you can't figure out how to reboot just the apache service (this is how you will know if your edits broke something or not!). Just google restart apache and I am sure you can find the answer with your new tools and the ability to work with ssh.

By the way, i would recommend making one change at a time in your httpd.conf then restarting Apache. That way you can easily debug for issues and you will know where your problems are. Good luck to you, and remember to make backups before you do anything. Lastly don't blame me - please use any of my information at your own risk!

Link to SWF Video :Configuring Linux Apache On Virtual Dedicated Server via SSH (Will Start Video, Right Click to Stop it). To download video right click on link from here.

Start Video By Clickin on Image :

(Right click on video to stop it)

Labels: , , , , , , , , , , , , , ,

Thursday, March 27, 2008

Futher Evaluation of BuildTraffic com and Adwords

On my site, I don't have that great of a bounce rate. I attribute this partially to the Ajax programming that does not require page loads to view further content.
Regardless, it is one of the few ways that I can see whether people are using the site. I tried to setup a goal in Google Analytics to measure how much I am converting in click throughs but it is a little bit tricker than I had anticipated.

Regardless, After running my ad campaigns with BuildTraffic.com, the Bounce Rate is 86.94 (How many people only load 1 page).

However, if I look closely, the bounce rate for just my build traffic campaign in and of itself is 98.53%. This means that hardly anyone clicked through or used the site as a result of the campaign. The average pages per user is a low 1.02. I suspect that some of this might be the same user getting the same advertisement rather than actually using the site. I kept a close watch on my stats and I am sad to say that although the traffic was targeted as promised and the numbers were fairly impressive; the conversion rates are so bad that its probably not worth it.

Now to be fair, any marketing campaign might change for you. You might have the midas touch. For instance, my campaign with build traffic would probably work better if I offered something for free rather than getting people to use my site and come back to it. At worst, I wasted my money. At best, I gained some web presence - but I cannot verify that ny of my sales through affiliates came from buildtraffic.com traffic. Again there was nothing wrong with the targeting of the users sent our ways, but I did find that our stats differed greatly from what they said that they referred to us. Even though they told us to check the server logs, I was suspicious that their javascript based system would not show up in our counters. I am not sure what, if any, limitations there are to statcounter.com or google-analytics.com (i'm running both to try and get as much info as possible), but our 3rd party counters did not match up. In one case about 1000 users didn't show up for a campaign which I found highly suspect.

I have started using adwords a bit to see whether that is worthwhile. Although I try to make money from adsense myself, I have a few affiliate programs which have higher payouts for conversions. I will try some experiments with adwords as I have already seen that the conversion rate is much better than anything with build traffic. Bottom line is if the ad is being pushed to you, chances are the user will do their best to ignore it. If you entice a prequalified user directly to a targeted landing page, you will have much better luck. That is all the time I have to post tonight. I must get some sleep now.

Labels: , , , , , , , , , ,

Tuesday, March 25, 2008

Save Money with My Mashup/Coding Project (Featured on Programmable Web)

My Coding and Side Project, SaveOnAtoZ.com was recently featured on Programmable Web a few weeks back. It simply appeared on the front page. I did not have time to write a blurb on it then, but I wanted to write it down as one of my accomplishments. Programmable web features a list of API's and their corresponding web "Mashups". Mashups are defined as
a mashup is a web application that combines data from more than one source into a single integrated tool; an example is the use of cartographic data from Google Maps to add location information to real-estate data from Craigslist, thereby creating a new and distinct web service that was not originally provided by either source.
- Wikipedia

What is Save On A To Z? Well the goal is to save money on everything. Simply speaking, the site connects to various apis and helps you conduct product searches based on keywords. The different result sets are segmented and / or listed on the same page according to your preferences. You can bookmark and compare the items side to side. The result sets can be loaded in to the same page via ajax.

The results are drawn from Amazon, Ebay, Half, Shopzilla, Buy.com, Best Buy, Shop.com, Google Base (Formerly Froogle), Nextag, Sortprice, MSN just to name a few of the engines. You can seriously check across all these sites within a few seconds. In addition, I am always expanding the result sets.

My goal is to provide you one of the most comprehensive resources for comparing prices and saving you money. With today's economy in a downward spiral and gas prices rising, we need to be sure that we are saving as much money as possible.

I hope you find my project useful. You can visit it here. If you can bookmark it on a social site, share it with friends, or link it in your blog, i would be most grateful. Thanks for reading. Hope this saves you a lot of money!

Labels: , , , , , , , , , , ,

Tuesday, March 18, 2008

How Much Does Google Pay - Unique Visitors, Pageloads, and the Traffic Circus

Simply put- I want help others (and myself) find the best way to monetize their website. I figure, maybe if I share some my information, I will gain some insight into my own methods and perhaps you will reciprocate if you have found a better solution. Simply speaking, for my last pay period (not that long) until today I have received

132,423 page impressions
504 clicks
0.38% conversion
net: $102.85

This equals out to approximately 20 cents a click on average. Depending on your ad positioning and your conversion rate (and the topic of your site), you can expect to do more. But with these stats, you can easily see that it takes quite a few page loads and views in order to actually convert into real money. Now let's try to take that into the context of trying to get this done in one month: 132,423 page impressions/1.3 (average page views per visitor) = 101,864 unique visitors.

Now to achieve this in 30 days => 101,864/30 days = 3400 users a day!!
Please check my calculations - and I hope they are wrong, but that is a lot of users to accomodate a day just to make $100. There must be easier ways of making money. It seems people have learned to ignore them in many cases.

Even if your average payout for each click is 40 cents, you would still need 1700 users a day. Well the first thing you can do is put multiple Google Ads on the page. I have heard that, on average, it takes a person 6 exposures to finally convince them to follow through. So put those ads on Top, side and bottom. To increase the conversion rate, try making your ad relevant in design to your site (e.g. use the same colors of your site).

In addition, as we all know, video is hot - try integrating the new Youtube Video Ad Units into your site. There are some great advantages to this unit as it is extremely interactive, dynamic, and outright fun. I have had some luck with it, but honestly - the most successful Google solution almost always come from the Google AdSense for Search which pays about the same per click but gives me a 10% conversion rate. This is the searchbox that will take you directly to Google search engine with Google ads displayed at the top. Here is an example.

I hope you will find this information useful for your own website. Perhaps you can leave me some tips for my own. Thanks for reading!

Labels: , , , , , , , , , , ,

Monday, March 17, 2008

Review of BuildTraffic.com and Other thoughts on web traffic

Nowadays, everyone is looking for a good way to make money online. Part of the key to making money via the internet is to bring visitors to your website. Amongst the various link exchanges and search engine tweaks you can make, there is a relatively small amount of traffic to be had for your average joe shmoe. It takes months of dedication and link exchanging, blogging, social linking - and don't forget money in marketing and hosting.

How much money are you spending on marketing? Chances are either too much or not enough. I was in the not enough category and I am thinking I am moving into the too much category. Part of the problem is the Return On Investment (ROI) and your conversion rates. If you don't convert with your marketing money; you are essentially throwing it down the drain. And how do you know where to spend your advertising dollars without some experimentation? How do you know what works for you? To be honest, I don't know the answers to these questions.

As such, I have started doing some research on various traffic building methods. Aside from owning various domains and also doing a fair bit of research into search engine optimization, I am looking for a solution which allows a good amount of traffic - hopefully prequalified (but not necessarily - the scope of my website is such that I can put whatever landing page on just about any product type I want). Part of my problem is that I am trying to make revenue on adsense, so my traffic source has to come in at much lower than an adsense actual conversion. For example, if I am getting 10 cents for a click from google, and it cost me $1.00 to bring that visitor, I just lost 90 cents. I know that I can optimize google ads in such a way that my pay per click is somewhat low if I am highly relevant and with a good conversion on my ads. Regardless, my first few forays into ad words did not work out as good means to fuel traffic to my site. It did not seem cost effective. I need more organic traffic (and I have a decent amount). Perhaps if I only spent 30% of the revenue that came in from my organic traffic then that would be a decent investment - ensuring that it is profitable.

In any case, I am doing some tests with BuildTraffic.com. I have purchased a series of 20,000 unique visitors from around the world sent to SAVEonAtoZ.com. And I have also purchased a campaign for 10,000 unique visitors prequalified for computer browsing to land on buy-computers.info. To optimize for a worlwide campaign - I added a translate widget from Google to see if this will help with the conversion. My rationale is that I get worlwide traffic as is... much more so than I would like (I was planning on being more regional to USA). Rather than fight it - I am trying to go with the flow...

I will post updates in my comments section. If you have similar websites I should checkout I will let you know here.

Labels: , , , ,

Sunday, March 9, 2008

Web Hosting, Virtual Dedicated Servers, and Clusters - My experiences

Hi Rammahi,
This brings me to notion that i need to do some more reviews of hosting companies as I have been through a few of them since i am a very heavy hosting user. I am always looking for the best value.

So depending on your needs and your budget these are my recommendations:

Under $7 contenders:
Godaddy.com : Their servers are reliable and never had a problem with ther linux system until I tried to load over 500 domains in my account. I was then told that I had network violation because I was redlining the server; this is understandable. But I must warn you that their console broke down before I got to the network violation; I had domains stuck in their system in limbo for weeks upon weeks, without any action in their system with several tickets. Godaddy is fairly good about customer service, but don't expect top notch ticket support for 7 dollars a month (I can also understand this; you are hardly paying for an hour worth of a persons time and their system is meant to be self-service in order to give you those cost-savings).

A eDealDomains.com - They have $3.99 Windows and Linux Hosting; but this limits you to one domain. For $7 you can get a shared hosting plan with 'unlimited' domains.

eDealDomains provide some better domain rates for .coms so is why I have an account with them. They have all the luxuries that Godaddy does from what i can tell; but they have same limitations that Godaddy does. You can find their hosting deals here: AllRightHosting.com


You can get all the benefits of the $1.99 domain with any non-domain purchase as well as free email, and free hosting with your domain purchase, etc. I ended up using a virtual dedicated server for my purposes and it seems to be working out since I get 500 gbytes of transfer per month.

ReliableSite.net - They deserve an honorable mention as I have an account with them and I have some of my major sites with them since I had to move off WebHost4Life.com. What they offer: Windows load/balanced clustered hosting solution compatible with PHP/MySQL projects. Since its Windows, you get ASP, ASP.NET. Cons: its not the cheapest, it seems to be a small operation, it can't handle everything I can throw at it. I did some research and a Windows 'Clustered' Solution seems to be limited to 4 (or was it 8?) Servers as compared to what I was looking for - something more akin to a Amazon Elastic Computing Cloud power for a shared hosting environment.

Alas, my friend pointed me out to mediatemple.net. I do not have an account with them, but I am very curious as their copy and graphics make me want to try it out. I think that I would have to end up going with the dedicated virtual solution, but at $50 it seems a bit expensive as compared to the $30 virtual dedicated server I have with edealdomains.com; with almost the same specifications. Mind you there do some to be a series of perks to media temple that make it a better product: it runs on a linux cluster service (I don't think that is the case for edealdomains.com, but I could be wrong). Media temple provides you with reseller tools for the service you are purchasing. Chances are you will only use a small portion of the resources allocated to you and they have provided you with whm/cpanel solution for reselling. They have a shared solution starting at $16.67 called the Grid, but its limited to 100 domains; so it doesn't work for me. But they do seem to have instant activation.

Labels: , , , , , , , , , ,

Thursday, March 6, 2008

Mysterious Page Loading Twice Issue

Today I dealt with a very mysterious issue.
Every time a page would load, it seemed to reload.

I cannot actually explain what was happening to be honest... but i was able to track down the culprit to a problematic table tag:
<table border="0" cellpadding="0" cellspacing="0" width="100" background="#DEEFEF" id="sidebartable">

the problem ended up being in the background tag...
once I changed this background tag to bgcolor it worked fine!
<table border="0" cellpadding="0" cellspacing="0" bgcolor="">


This was some extremely bizarre behavior and what I did to debug it: I disabled pieces of code until I could isolate where the issue was stemming from. Even then, it took me a while to see that the tag and fix it. I ended up spending a good 2 hours just isolating the piece of code that was causing the issue. I would never have guessed; I honestly still can't explain it. If you know what is going on, I would love it if you told me.

Labels: , , , , , , , , ,

Flex Upload IO File Error

So we kept getting the infamous file io error when we were doing some very large uploads with our flex upload. We spent a lot of time debugging this and we kept thinking that it had to do with the HTTP Keep Alive on PHP level.

The symptoms are as follows:
User uploads file and it seems to go fine or get through most of the way.
Upon completion of upload (or not), the flex module hangs at 100% uploaded or returns a File IO Error (or similar).
The upload module will work through PHP in most cases, usually when the large files are uploaded, this is when you have issues.

This is what I did to debug the issue.
I went into the PHP tmp folder to actually watch the files as they uploaded. From here I was able to start discerning a pattern of what was happening. It seemed that the file was getting stuck at 5:00 minutes exactly. I was able to replicate the issue and I realized that the process which was handling the upload, must be getting stuck or timing out.

Since it is PHP that is handling the file upload, I went on see what was in phpinfo(). I noticed that the HTTP_Keep alive was exactly 300 seconds = 5 minutes.

This lead me (eventually to the right location), but it was not the http keep alive. I went through regedit in windows and actually searched all the registry kees for the term alive and also for a value of 300.

Nothing seemed to add up.
I eventually remembered that there were several settings in the IIS Metabase that are usually hidden (or rather deep). I went through and did a search for 300 (seconds). I found that the cgi timeout setting was set to exactly this.

I changed this setting to a much higher value, and what do you know... it solved the problem. The CGI timeout value will limit how long your upload will last, so be sure that it is adequate for the size of files that you will be expecting.

Labels: , , , , , , , , , , , , , , , , , ,

Tuesday, March 4, 2008

Webhost4life.com Hosting Review

Webhost4life? More like webhost 4 one month.
If you are thinking of using their linux cluster for a large web project, DON'T.
Read on...


Call ID 416205
Status OPEN
Logged 3/3/2008 2:18:31 AM
Priority 1
Categroy Service Interruptions (Urgent)
Subcategory Websites

Elaspsed Time 2 Day(s)

website down
Description:
----------------------------------
please go to the website, it gets connection timed.
it might be back when you get to this, but I am putting in the ticket as it is currently down.


Error Message:
----------------------------------
Internet Explorer cannot display the webpage

Most likely causes:
You are not connected to the Internet. (yes i am)
The website is encountering problems. (looks like it)
There might be a typing error in the address.

What you can try:
Diagnose Connection Problems

More information




URL to see the error:
----------------------------------
http://www.SAVEonAtoZ.com


It was working before.:
----------------------------------
Yes





Raymond (Staff)
3/3/2008 8:43:19 AM Dear client, your site is fine now. There maybe temporary routing issue before, would you give it a try now?

Please feel free to let us know if your problem persist.

Thank you.


-------------
Thank you for using our Hosting Service.
If you like our service, submit your Testimonial here!
Mauricio Zuniga
3/3/2008 3:13:25 PM yes it resolved itself, but i am now getting this issue. pleaes help...

Forbidden

You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.0.59 (CentOS) Server at saveonatoz.com Port 80
Erwin Yu (Manager)
3/3/2008 3:47:28 PM We've just suspended your account. Your account was the one that caused 100% cpu usage and bring down the server. You'll need a dedicated server for it because all of your sites added together are way too busy for the system to handle.


-------------
Thank you for using our Hosting Service.
If you like our service, submit your Testimonial here!
Mauricio Zuniga
3/3/2008 3:54:10 PM can you please give me some warning! your advertisement says:

Our Clustering technology will also give you high scalability. If your website begins to scale up, we can simply add another server to the cluster to offset the load.

This is exactly the reason why I went with this solution!

I can move some of the domains off the server... but i have traffic that I am paying for etc!
Mauricio Zuniga
3/3/2008 4:12:23 PM I have routed about 500 domains to another server that I have as a backup (ip address 208.68.171.70). This will significanly relieve your servers.

I would also remove some functionality which might be causing issues with spiders asking for too much information: but it seems you have disabled my ftp access as well.

I suspect it might be causing the issue, because its new functionality that we added and the site was running fine for few weeks previously.

will you reinstate my account now? Please allow me to try and address the issue before you discontinue allowing me to use your service..
Mauricio Zuniga
3/3/2008 4:18:20 PM can you please give me ftp access to my files so that I may retrieve the files and images which I may still need

thank you
Erwin Yu (Manager)
3/3/2008 4:35:46 PM We didn't have time to give the warning, we were checking on it and when I am about to send the suspension notice, you open a ticket already.

Yes we do have cluster, but your usage is just too high and there's no way we can provide service to your kind of website.

I would suggest you getting a dedicated server for this kind of usage. I've re-enabled your account, please do not point the domain back, or else we'll have no choice but to terminate your account.

Thanks.


-------------
Thank you for using our Hosting Service.
If you like our service, submit your Testimonial here!
Mauricio Zuniga
3/3/2008 5:22:47 PM i did not move the domains back to the server, yet my account is disabled - so i am assuming that it is still too much for your servers to handle...

where does this leave me?

if you will not host my site, can you give me ftp access to retrieve my files ; there are still some that I need to get off the server. Please let me know how a refund is to be handled.
Erwin Yu (Manager)
3/3/2008 5:31:34 PM The server just got killed again, we've disabled your account. I can zip the files for you to download, which folder do you want me to zip?


-------------
Thank you for using our Hosting Service.
If you like our service, submit your Testimonial here!
Mauricio Zuniga
3/3/2008 5:39:05 PM i need the following folders:

/images

/includes

/articles

and any files in the the root folder
Yue (staff)
3/3/2008 10:58:05 PM Your message is urgently passed to our linux server technicians. Would you please check it back later? Thanks


-------------
Thank you for using our Hosting Service.
If you like our service, submit your Testimonial here!
Mauricio Zuniga
3/4/2008 3:20:16 PM [ Escalate request ]
I have moved almost everything off the server in terms of traffic: I can agree to limit the number of domains on your server to about 200 versus the 1000 I had. I think that should take care of maxing your server as it is only 20% of what I was sending in terms of spiders, traffic, etc...

If you would like, you can delete all of the domain aliases except for SAVEonAtoZ.com and then I will start from scratch...

Please reinstate my account or make arrangements to issue a refund.
thank you,
mauricio
Jack (staff)
3/4/2008 5:15:27 PM Sorry, we won't be able to host you. Please FTP to get your .tar files now.

Thanks.


-------------
Thank you for using our Hosting Service.
If you like our service, submit your Testimonial here!


After all this transpired, I finally got my files off the server. But the problem remains that they have not credited my account: it looks like they will, but they made me jump throug more hoops to 'confirm' my identity and that I indeed wanted to cancel the account. Mind you, this is in the same exact ticket... so the entire history of what had transpired (and that they would not provide me with the services I paid for)

It left me infuriated; You terminate my account even though it seemed to me that it was false advertising AND then you make me jump through more hoops to confirm my identity and that I wanted to cancel the account. I mean, come on - your company already said it would not provide me with the services and I already paid for them - just credit my account already so I can move on.

Labels: , , , , ,