Archive for category Programming
Browser Extensions For Developers and Internet Marketers
Posted by Randy in Internet, Programming, SEO, Web Development on May 3, 2010
I'm on the fence when it comes to my favorite browser. I've recently started using chrome much more, due to some bad performance issues in Firefox. Firefox on my 64-bit Windows 7 installed sits and eats memory. I've seen it use nearly 2gb of RAM. This was after it had been open on the computer for a few days, and a restart of the browser fixed the issue. However, I'm not sure why this leak is there. The last time I can remember truly liking Firefox completely was back in the version 1.5 days, and even then there was supposedly a huge memory leak. Back then I didn't notice a memory leak, but these days I do.
It could be that Firefox utilize memory different, and it may be the new way Windows 7 display memory usage. I still see sluggishness. Thus, my move to Chrome. There area a few different things that could have caused the slowness, such as the added extensions in Firefox. After installing about seven extensions in Chrome, however, I see no performance hit. So, I still suspect that there is an issue with the browser itself. Even with all of these woes, it is still better than using IE. I hate that browser. I don't necessarily hate using it, but it is difficult to write web sites that work well in it along with all other browser. It's the odd ball which never works the way I want.
For web development, Javascript is necessary for client-side scripting. However, Javascript is difficult to debug. Luckily, we have the Firebug extension for Firefox. This is the uber-extension for web developers. I've used it quite a lot, so much so that it has become a necessity. I probably couldn't write Javascript without it. There are also other features to this extension, like being able to examine the DOM and such. Internet Explorer has a similar tool set but it's slow and hard to utilize. I would dare say that there are some IE users who installed Firefox just so they can use Firebug. One setback here is that IE's Javascript engine has certain nuances that do not readily show up in Firebug. So, while you can debug a majority of javascript errors with Firebug, it will miss certain IE javascript issues.
The next must-have extension for web development is the Firefox Web Developer extension. It gives you a host of options to example page elements and CSS rules within the page itself. This plugin along with Firebug have saved me TONS of time, while working on websites.
SEO is important to not only marketers but web site developers as well. Getting a site online is one thing. Getting it to show up in search results is another. A couple of excellent extensions for examining the search engine optimization of a site are the Firefox SearchStatus extension and the Chrome SEO extension for Chrome. The Chrome SEO extension is great for getting a brief synapsis of your site's backlinks, pagerank, and indexed pages at various search engines. Neither of these offer a lot of advice for SEO, but they do show some stats to get your started.
These are only a few of the extensions available for Firefox and Chrome. There are many others. They are a good reason to switch from IE. PLEASE DO!
ExtJS Bug – Form doesn’t submit
Posted by Randy in Programming, Web Development on October 22, 2009
Let me start off by saying that I love the ExtJS framework and it has been a pleasure to learn it over the last few days. It is probably the most professional JavaScript framework I've seen, thus the reason I wanted to add it to my latest app. The documentation is very thorough and it's very easy to learn.
However, I've spent most of my day (when not taking care of kids and doing school work) trying to figure out why a simple form I've created doesn't submit. The thing that really had me perplexed is that almost the exact same code worked for another form on another page. It was frustrating because I just knew it was something I was doing wrong.
Perhaps the most frustrating part about it was the fact that it was a bug in the framework itself. From what I've since found by researching on their forums, the bug was reported a few versions ago. There's a work-around and I'll get to that in a bit, but I want everyone to see the code.
var dbPanel = new Ext.form.FormPanel({
id : 'dbPanel',
name : 'dbPanel',
height : 'auto',
width : 'auto',
standardSubmit : true,
layout : 'form',
method : 'POST',
url : 'db_verify.php',
border : false,
bbar : tb,
keys : [{
key : Ext.EventObject.ENTER,
fn : verifyDB
}]
});
This is the code that doesn't work. It's a basic form and it should POST data to the db_verify.php page. The "standardSubmit : true" sets the form panel to use the old standard submit instead of Ajax. Here is another example that works:
var loginPanel = new Ext.form.FormPanel({
id : "loginPanel",
height : 'auto',
width : 'auto',
layout : 'form',
border : false,
standardSubmit : true,
url : 'login.php',
method : 'POST',
bbar : tb,
keys : [{
key: Ext.EventObject.ENTER,
fn : doSubmit
}]
});
There's very little different in these two instances of FormPanel. The only difference I could find was that the first one doesn't work and the second one does. In fact, I changed just about every option three times or more just to make sure I wasn't missing anything. Everything I did gave me the same result. The page would refresh to itself and my form data would just disappear.
The eventual fix for the problem is to manually set the DOM action for the form when the handler is fired. So, for the first code listing, my handler went from looking like this:
var verifyDB = function(){
dbPanel.getForm().submit();
};
To looking like this:
var verifyDB = function(){
dbPanel.getForm().getEl().dom.action = 'db_verify.php';
dbPanel.getForm().submit();
};
The first handler worked perfectly well with the other form submit. For some reason, it just seems to randomly decide it isn't going to work for this scenario. It's an easy fixed, but when you are trying to learn a new framework it's not good to deal with a bug like this during your first few days.
Twutils.com
Posted by Randy in Programming, Web Development, technology on October 6, 2009
I've starting a new website and have almost completed development on the first tool. It's a site devoted to Twitter tools. I call it Twutils. The first utility is a spam removing tool called Spit Remover. I've settled on "Spit" as a good name for Twitter Spam. I'm in the process of moving the site to a new host due to DNS issues on the previous host. A few other ideas I have for Twutils are:
1.) Tweet Scheduler
2.) Follower generator
3.) Unfollow those that don't follow you (like Huitter.com's Mutuality.
I'm also planning to keep track of users who are removed with the spit remover. I may use this to show blacklisted spammers. I may generate a list of the most removed spammers, and allow people to remove these people automatically. Or I may just use it to create the biggest spammers list.
Warning: simplexml_load_file() [function.simplexml-load-file]: URL file-access is disabled in the server configuration
Posted by Randy in Apple, Internet, Programming, Web Development, technology on September 24, 2009
If you've seen that error message you've probably happened upon a security feature that your shared web hosting provider has enabled. There are a few work-arounds for this error but most require you to have certain privileges on the server that you probably don't have. Quite frankly, if you are getting these errors you probably don't have the ability to change these settings yourself.
Rather than try to get the provider to change these settings (let's face it, they have this enabled for a reason and surely someone else has already tried to get this changed, right?) one can easily get around this with Curl. In most cases, curl will be enabled on the server. So here is the quick and dirty way to get around it:
Create a PHP file and name it anything you want. For the sake of this article we'll refer to it as curl_functions.php. In this file put the following functions:
<?php
function setupMyCurl() {
$myCurl = curl_init();
$temp = curl_setopt($myCurl, CURLOPT_RETURNTRANSFER, 1);
return($myCurl);
}
define("myCurl", setupMyCurl());
function curl_get_contents($url) {
$temp = curl_setopt(myCurl, CURLOPT_URL, $url);
return(curl_exec(myCurl));
}
?>
Include or require this file. Then, all you have to do is use the curl_get_contents($url) in your code to pull in the xml to a string. Then use the simplexml_load_string() instead of simplexml_load_file(). This will give you the same results but works around the url fopen feature. If you don't have curl enabled on your host, GET ANOTHER HOST.
Why do Google Search Results Change?
Posted by Randy in Internet, Networking, Programming, SEO on July 30, 2009
I was recently asked by my wife why Google search results change. I had noticed it before but didn't spend much time dwelling on it because my first thought was that Google uses many locations and many datacenters to hand out search results. The varying results are differences in the data stored at each location. Depending on which datacenter you are getting results from at any given time, you can see a huge change in results. As an example to this I made a quick video to show how going through a proxy server can change search results. In this video I'm going through a Linux server in Texas at first. Note the total results for the keyword while going through the proxy are 282. By removing the proxy and refreshing the search the number changed dramatically to 635,000 results.
I saw a video explanation of this behavior that stated that Google was a beach, and while I enjoyed the analogy, it isn't entirely correct. There is a lot happening on the internet, but there's no way Google can index it all at once, or even catch it all. That's why they have many data centers, each pulling their own part of the weight. I'd imagine that the synchronization of the data takes time, that is if they actually synchronize the data at all. It may be that Google does this to randomize search results a bit in order to gauge relevancy of each result. At any rate, the keyword results can vary.
Also, after making this video, I captured the packets using wireshark and found that the request from my home internet connection was querying IP 208.67.217.231 and my proxy server is pulling the query from 74.125.159.103. Also neither of the search results were correct. After digging into the other pages of results there is a total of 64 results omitting the repeats. ICHY reports that the keyword has 3,640 competition. So, from what I can see of the data on both sides, ICHY doesn't report very accurate competition numbers according to their own explanation of the relevant results. Other keywords in their list yielded similar results discrepancies.
Automated twitter status updates
Posted by Randy in Applications, Linux Stuff, Programming on April 20, 2009
Once you have a following on Twitter, it's easy to gather a little extra traffic to your site from it. To help automate the process, I make use of Twitter's API and a Linux command line. I create some cron jobs to update my status using curl. This is pretty simple to do and may be helpful for people with a Linux box and the need to advertise something.
The curl command is structured as follows:
curl -u username:password -d status="My new status message" http://twitter.com/statuses/update.xml
Now it's important to note that for the automated crons the returned xml isn't really needed. You can also use this in the programming language of choice to fetch the xml and make use of it. You can also get JSON results by changing the end from .xml to .json.
So, once you have the code, all you have to do is create the cron jobs in Linux. Edit the crontab with crontab -e
Your default editor should open your cron. Here is an example showing how to create the cron job:
5 * * * * curl -username:password -d status="My Message" http://twitter.com/statuses/update.xml
That cron job would run at 5 minutes after the hour, every hour, every day. This is, however, not a good idea because your account will not last long
Programming ideas
Posted by Randy in Applications, Open Source, Programming, Web Development on April 17, 2009
I'm not a very good programmer. I think the biggest reason for that is that I've not had enough practice at it. I've written plenty of apps and web sites but most were very simple. My latest app, whats-hot-weekly.com is actually a simplified version of another app I wrote that is located at givemeaniche.com. There are many differences between the two apps even though they basically do the same thing. The exception to this being that givemeaniche actually shows the most searched for terms as well as the most watched items.
The hardest part of it all is coming up with new ideas for serious work projects. I have a few but being a solo developer, designer, etc means that I'll have to put some time into them. Any ideas for apps and websites would be much appreciated.
responseXML.documentElement is null or not an object
Posted by Randy in Programming, Web Development on April 5, 2009
Ok I have yet another reason to loath IE7. I had an error on Whats-hot-weekly.com earlier in regard to this error message on my ajax XML object:
responsexml.documentElement is null or not an object
Everything worked in Firefox, Chrome, and even my Nokia N810's browser, but IE7 just wasn't going to cooperate. I knew that it was working last night, but I made a few changes before going to bed.
Two of the changes I made was in relation to the meta tags in the HTML of the main index page. I added keywords and description for search engine optimization. Little did I know that one of these was the culprit.
After much Googling, I came upon this article. In it I immediately found the reason for the error. It should have been a little obvious but I had overlooked something simple. My search box for entering in keywords had an id(and name) of "keywords". The new meta tag for keywords also used the "name=keywords" attribute.
In the article, it was the "description" meta tag that had caused the conflict. Upon evaluating that, I realized my mistake. This effected IE only because IE checks the name attribute when you call document.getElementById. It was grabbing the meta element instead of the search box.
I hope this helps someone else, in the event that all the variables fall into place for this to happen again.
