Insert new post in to wordpress from php

This code snippet should let you add a new post to your wordpress database 2.5.1

require_once('wp-config.php');

// create post object
class wm_mypost {
    var $post_title;
    var $post_content;
    var $post_status;    /* publish, private */
    var $post_author;    /* author user id (optional) */
    var $post_name;      /* slug (optional) */
    var $post_type;      /* 'page' or 'post' (optional, defaults to 'post') */
    var $comment_status; /* open or closed for commenting (optional) */
    var $post_category ; 
}

// initialize post object
$wm_mypost = new wm_mypost();
$wm_mypost->post_title    = "Title2 ". date( 'r' );
$wm_mypost->post_content  = "content3";
$wm_mypost->post_status   = 'publish'; 
$wm_mypost->post_author   = 1;

// Catagorys
$post_category = split("," , "one");
foreach($post_category as $key=>$val) {
    $post_category[$key] = get_cat_ID($val);
}
$wm_mypost->post_category =  $post_category ; 

// Optional; uncomment as needed
// $wm_mypost->post_type = 'page';
// $wm_mypost->comment_status = 'closed';

// feed object to wp_insert_post
$post_ID = wp_insert_post($wm_mypost);
echo date( 'r' ) . "\n";
echo "post_ID:". $post_ID . "\n"; 

How to install PHPBB 3.0.1

This tutorial will walk you thou the steps to install PHPBB3 on your system.

Intro

PHPBB3 has become one of the more popular bulletin board system (AKA, BBS, or forums) available. It is used for all types of websites, from corporate websites, online stores, online hobby groups, ect.  One of the main selling points for many people that use PHPBB is the strong community of developers developing mods and themes. PHPBB is an open source project released under (General Public License) that started in 2000 by James Atkinson (now a former team member) has come a long way in the last 8 years. As PHPBB grew and became more popular and as its install base reached over 100,000 sites, it started getting targeted by hackers and script kiddies. Forums would be filled with spam comments, links to porn/adult sites, and people trying to sell perscription medication it turned a lot of people away from PHPBB on to other forum systems. The newer versions of PHPBB2 and PHPBB3 made spam and robot prevention a major concern and the exploits that allow robots and script kiddies to make new posts have been reduced significantly.

Requirements (^)

For this tutorial we will be use a apache.org on a UNIX based web server hosted on dreamhost.com using mysql.com for the database.

Directions

1) Download the latest stable version of PHPBB (We are using PHPBB3.0.1)
2) Extract the archive to your desktop, preserving the file tree. (C:\temp\PHPBB3)
3) Upload the contents of the archive to your web server. (/abluestar.com/temp/phpBB3/)
4) Browse to the installation page

5) Click the install tab at the top of the page. Then click the “Proceed to next step” button.

6) On this page your system will be checked for the basic requirements.

7) Enter your database settings

8 ) Set up the boards administrative user

9) Set Advanced settings. Most of these settings can be left as there defaults or changed later.

10) Create database tables. This page creates the nessary tables on your database for the forum system to store your settings.

11) Final stage, this is just a conformation page that everything has been installed correctly. You can now browse to the install directory.

12) Main page. At this stage you should delete the /install/ directory from the PHPBB3 folder.

13) At this point you can log in to your forums adminitation panle and configure your forums to suit your needs, but this beyond the scope of this tutorial.

This tutorial was written for COMP2920, Steven Smethurst, B.J. Wilson, Dennis Warren

WHAT IS reCAPTCHA

A CAPTCHA is a program that can tell whether its user is a human or a computer. You’ve probably seen them — colorful images with distorted text at the bottom of Web registration forms. CAPTCHAs are used by many websites to prevent abuse from “bots,” or automated programs usually written to generate spam. No computer program can read distorted text as well as humans can, so bots cannot navigate sites protected by CAPTCHAs.

About 60 million CAPTCHAs are solved by humans around the world every day. In each case, roughly ten seconds of human time are being spent. Individually, that’s not a lot of time, but in aggregate these little puzzles consume more than 150,000 hours of work each day. What if we could make positive use of this human effort? reCAPTCHA does exactly that by channeling the effort spent solving CAPTCHAs online into “reading” books.

To archive human knowledge and to make information more accessible to the world, multiple projects are currently digitizing physical books that were written before the computer age. The book pages are being photographically scanned, and then, to make them searchable, transformed into text using “Optical Character Recognition” (OCR). The transformation into text is useful because scanning a book produces images, which are difficult to store on small devices, expensive to download, and cannot be searched. The problem is that OCR is not perfect.

sample-ocr.gif

reCAPTCHA improves the process of digitizing books by sending words that cannot be read by computers to the Web in the form of CAPTCHAs for humans to decipher. More specifically, each word that cannot be read correctly by OCR is placed on an image and used as a CAPTCHA. This is possible because most OCR programs alert you when a word cannot be read correctly.

But if a computer can’t read such a CAPTCHA, how does the system know the correct answer to the puzzle? Here’s how: Each new word that cannot be read correctly by OCR is given to a user in conjunction with another word for which the answer is already known. The user is then asked to read both words. If they solve the one for which the answer is known, the system assumes their answer is correct for the new one. The system then gives the new image to a number of other people to determine, with higher confidence, whether the original answer was correct.

Source: http://recaptcha.net/learnmore.html

Supremely awesome!

403 - An arrogant initiative in defense of the web

I hate internet explorer, I hate it so much. At lest once a day I curse it to the pits of hell to be torched endlessly by a Richard Simmons kazoo band. My hate for internet explorer mainly comes from my own laziness, I just don’t want to spend the time to create the same website twice, once for internet explorer and again for everyone else. I don’t believe that we should have too, Microsoft should follow the standard set out by The World Wide Web Consortium (W3C). A standard that all the other major browsers support.

Internet explore hurts the internet.

A while ago I had this idea, to create a javascript that you install on your website that created a DHTML pop up if you browse the site with internet explorer. The pop up would tell you about the advantages of using other browsers, the disadvantages of using IE, and links to download locations. At the bottom there would be a check box that disables the pop up for a single session. next time they come back the would get the same pop up until they change browsers.

But it looks like someone else beat me too it. http://403day.org/

I would love to install this script on all the websites that I have Dev accesses to but that wouldn’t be nice. So instead I have installed it on my two biggest websites. Funvill.com and Abluestar.com. Funvill.com still pulls in about 20k a month in unique visitors even thou I shut it down about a year ago and Abluestar.com last month got 675k unique visitors thanks to stumbleupon. Between Abluestar.com and Funvill.com 88% of visitors are using Firefox and 11% internet explore. So basically I am throwing away 76k unique visitors in hopes that some of them will upgrade to a new browser.

I HATE INTERNET EXPLORE

Below I have included some hate quotes about internet explore that I enjoyed.

This is why web developers need to stop working around shitty rendering engines en masse. Every single time we - as developers - utilize hacks to make things work in IE where they’re fine in WebKit, Gecko, et. al., we further allow IE to be as bad as it is. Do you honestly think IE would be the POS it is today if the world’s web sites didn’t work in it? Every single time we work around it we provide Microsoft reason not to change anything. Literally. Microsoft’s biggest concern has always been backwards compatibility, and it is that reason that so many of the issues we have now we also had then. It would be one thing if IE7 had shown considerable improvement in this regard, but that simply isn’t the case. IE7 kept some bugs, and swapped out some well-known ones for others, which we now have to hack around, again.
Source: http://developers.slashdot.org/article.pl?sid=07/12/07/1859205

MS doesn’t want those fixed. Seriously, they make money by ensuring that other browsers can’t compete because the Web is broken to conform to IE’s modifications of the standards. In this way they lock people into their platform. If IE was standard compliant, then soon Web apps would be standard compliant, and then why the hell would big companies stick with IE and an expensive OS, when they can just run Linux for free?
Source: http://developers.slashdot.org/article.pl?sid=07/12/07/1859205

IE will never have the same functionality, at least in terms of standards compliance, as other browsers as long as MS is allowed to bundle it without also bundling competitors. The Web will remain broken so long as MS is allowed to abuse their monopoly and numerous other markets will be broken as well, with innovation intentionally slowed for their profit. It is long past time the government enforced the fucking laws against MS, despite all the campaign contributions they made to both parties
Source: http://developers.slashdot.org/article.pl?sid=07/12/07/1859205

If browsers actually required that we provide valid code each and every time, things would be a lot better. How many browser security holes can be traced to a parser that would not have been affected had it simply seen invalid input and rejected it? How much simpler and faster would browsers be if they didn’t spend so much time trying to figure out what the person who wrote the code intended? How much more accessible would the content on those pages be to alternative browsers, like screenreaders?
Source: http://developers.slashdot.org/article.pl?sid=07/12/07/1859205

We’ve been running for way too long on the mindset that anybody can build web pages. Web browsers were built with this mentality. If I’m integrating with an enterprise XML API, and I feed it bad data, it gives me the proverbial finger. Why should web pages be any different? If you want to put stuff online, learn how to do it properly. The web is a cesspool for precisely this reason, and you can’t blame the standards themselves. The XHTML and CSS specs are by no means perfect, but writing well-formed XHTML and CSS is not difficult. Requiring developers to ensure that every start tag has an end tag, proper nested order, alt tags, and the like, would go a long way toward keeping the architecture of the Internet sustainable. Granted, it might put sites like Myspace out of business, but I’ll go out on a limb and say that’s not a bad thing.
Source: http://developers.slashdot.org/article.pl?sid=07/12/07/1859205

“In yet another instance of up-and-coming browser developers fighting back against the Microsoft behemoth, the makers of Opera have filed a complaint with the European Union against Microsoft. In their complaint, they allege that IE’s 77% market share abuses its dominant position by tying IE to Windows and its refusal to accept Web standards, causing significant interoperability issues. The complaint also requests that the EU’s Antitrust Division force Microsoft to separate IE from Windows and accept several different standards, thereby resolving major interoperability issues and providing consumers more choice in the browser market.”
Source: http://slashdot.org/article.pl?sid=07/12/14/192240

Open DNS

OpenDNS is a custom DNS server that you can use instead of using your IPS’s DNS server.
It checks any address that you lookup against its own list of bad sites (phishing scams, and other things) and redirects you accordingly. It also provides a simple way of enabling/disabling blocking of adult websites.

It often used in schools and big office networks because it allows you to enter in your own black list of sites to block such as YouTube, MySpace and Facebook. (Note: If your school or work blocks MySpace, Facebook, or YouTube, you might be able to regain access by changing your DNS address to different public DNS server or use a public proxy) It also provides trending stats on what web pages are visited most, how often, how how long each visit was. (Great for network techs)

A side effect of letting you black list domains is that it lets you disable most ad network, by disabling the DNS look up of there domain. (great for people that hate ads)

The service is great, lots of features, flexibility, its free and easy to use. I will probably install on my parents computer BUT!

How does OpenDNS make money?
OpenDNS makes money by offering clearly labeled advertisements alongside organic search results when the domain entered is not valid and not a typo we can fix. OpenDNS will provide additional services on top of its enhanced DNS service, and some of them may cost money. Speedy, reliable DNS will always be free.

When you type in a bad domain instead of returning “domain not found” error message it forwards you to a search page with ads on it, this is how they pay for this service. A lot of my applications that I write rely on this “domain not found” error message. I been getting an increase in the amount of support calls from people that are use this service and because it disables the 404 error and my free utilities. I now have to update some my utilities to support DNS servers that don’t support “domain not found” error message.

Great service but it has one fatal flaw, it tried to make money.

The OpenDNS Name Servers are 208.67.222.222 and 208.67.220.220.


Update:
John Roberts from OpenDNS contacted me via comment asking me for more details on this problem. I’m always impressed when support staff search the internet for reviews, questions and comments about there products.I have included two Wireshark log files nonopendns.txt, opendns.txtIn the first file nonOpenDNS log in frame#2 in the DNS section it read

Flags: 0×8183 (Standard query response, No such name)

In the second file the OpenDNS log in frame #3 in the DNS section it reads

Flags: 0×8180 (Standard query response, No error)
Answers
xxxxxxxxxxnothere.com: type A, class IN, addr 208.67.217.130

The open DNS server redirected the response from a dead address, my utilities can not longer find out if a domain is valid or not and no longer work. I’m in the process of creating a work around and it shouldn’t be too hard.

I should also mention that I am by no means an expert at DNS stuff. Most of knowledge comes from hacking together what I needed when I needed it.

Twitter vs Tumblr

Introduction
There has been a lot of talk recently about the micro blogging. Micro blogging is a blogging platform that lets you post very small updates about your life, to help keep you and your friends up to date with each others lives. The services are kept very simple so anyone can use them easily.

Two of the biggest players in this field are Twitter.com and Tumblr.com. I don’t have any friends on any of these services so I decided to try them both out and see what they are like.

Who is more popular
One for the first things I do when evaluating two different online communities is look at the usage statistics. I usually will go with the bigger company, more stable, more secure, etc. According to compete.com twitter.com seems to have a pretty good lead on tumblr.com.
+1 point for twitter.com

Domains
I like having my own sub domain, personal preference that comes from the old geocities days. tumblr.com provides a sub domain while twitter.com doesn’t.
https://twitter.com/funvill
http://funvill.tumblr.com/
+1 point for tumblr.com

Who owns your data
I am very paranoid about losing my data or a free service that becomes pay and holds my data ransom. These are things that wake me up in the middle of the night in a cold sweat. Lucky both of these sites allow for offsite backups and YOU OWN your own data. They also let you use your own domain just incase your mini blog ever becomes super popular and you want to switch services.
+3 points for twitter.com
+3 points for tumblr.com

Post categories
tumblr.com lets you identify posts under media types such as text, photos, links, chat, audio, video, etc. twitter.com doesn’t let you set a category.
+1 point for tumblr.com

How do I create a new post
Both allow you to post via IM, Email, Phone, Client, API, etc
+5 points each twitter.com, tumblr.com

Themes look and feel
Twitter.com only gives you the very basic theme options, good enough for most people. Tumblr.com other hand gives you full control while keeping it simple enough for the basic user to use.
+2 points for tumblr.com (I really like there theme viewer/editor)

Conclusion
Go with whatever service has more of your friends on it. There both pretty much the same. If you are the first or a trendsetter I would suggest tumblr.com. I personally will not be switching off of Wordpress myself. Wordpress is just too powerful and I can host it on my own servers (+10,000 points) my own paranoia wont let me use any of these services for too long.

9 points for twitter.com
12 points for tumblr.com

If you build it they will come mentality…

If you build it they will come. That’s the mentality that most people have when building there first website. That’s just not the way the internet works. You have to advertise, you have to tell people that you exist.

Ask your self how you found the last item you purchased from the internet.
Did you search with Google? What search terms did you use? Did you stumble upon it from someone else’s website? Did you read a review about it and searched Google for it? Put yourself in the mind of your customers, how do you expect them to find you?

The first thing you should do with all new domains is manually add them to the search engines like Google or Yahoo.
http://www.google.com/addurl/
http://search.yahoo.com/info/submit.html
You can pay some money to be included in there index quickly but I never have found it to be worth the money that charge.

The next thing I would consider is setting up a google/yahoo adwords campaign. Depending on your product or service, you could run a successful adwords campaign on as little as $10 a month. It all depends on what keywords you want to use. Selecting the right keywords is an art in its self, there are plenty of book out there that are just dedicated to helping you select good keywords. Ask yourself this question what search words would your customers use to find you?
http://adwords.google.com/
http://publisher.yahoo.com/

Next is to manually get the word out there. This step can be one of the hardest and most time consuming steps. What you need to do is get people talking about your product, get people to link to your website from theirs, get people to promote your service/product for you because they believe in your product.
- Write a review of your product and add it to a consumer reports website
- Ask a blogger or review site to do a review of your product/service
- Find people Forums/blogs/that are talking about your competitors and suggest your own.
- Create links back to yourself anyway you can.
- Be creative,

Search engine optimization (SEO) and advertisement are huge subjects. I only slimed the service in this article.

How to access Facebook’s data

In my last article I talked about how to create a very simple Facebook Application.
We created a simple hello world application that didn’t do too much besides login to the Facebook API.

In this article we are going to use the Facebook API to access you and your friends information.
We are then going to display the information a different manner then Facebook.

Requirements

The Facebook API is well documented.
If you want more information on any of the topics that I touch in this article is suggest that you search the Facebook API.

The Facebook API uses a REST-based interface. This means that Facebook method calls are made over the internet by sending HTTP GET or POST requests to the Facebook REST server.

The Facebook API has about a hundred different methods, in this tourial we will be using;

  • friends.get - Returns the identifiers of the current user’s Facebook friends
  • friends.areFriends - Returns whether or not each pair of specified users is friends with each other
  • users.getInfo - Returns a wide array of user-specific information for each user identifier passed, limited by the view of the current user

For a full list of all the different Facebook methods see the Facebook API documentation

Basic Application Architecture
First we need to understand how the Facebook API works.

  1. A browse makes a request
    1. A user browse to the Application canvas page
      Example: http://apps.facebook.com/ninteentwenty/
    2. acebook looks at the call back URL associated with the application.
      Example: http://www.abluestar.com/dev/facebook/
  2. Facebook sends a request for that call back page with the user’s ID as a parameter
  3. Our webserver gets the request and builds a page for this user.
    1. In the process of building the response page, we can request additional information from Facebook REST server.
  4. After the page has been built on our server its sent to Facebook
  5. Facebook serves our response to the user.

Most of the time the user doesn’t know that a 3rd party (our server) was involved at all.
The page appears to come from Facebook its self and is embedded in to a page with an iframe.

Make a request using the Facebook API

When starting off a great place to start is the API Test Console. It a tool for building requests for the Facebook Rest server.

You can select the method, call back function (most of the time left blank) and respond type (XML, PHP array, JSON).

For example if we where to select the friends.get method and the a response type of XML.
It would query the Facebook server for a list of all the currents users friends and return the results in XML.

$friends = $facebook->api_client->friends_get();

We could then take two of these UID (aka user IDs) and test to see if they are friends with the friends.areFriends method.
In this case these two people are not friends with each other.

$friends_areFriends = $facebook->api_client->friends_areFriends( ‘508673161′, ‘504464182′ );

The UID is a great method for uniquely identify members but it would be nice to know who 508673161, and 504464182 are.
To do this we can use the method users.getInfo to get information about these users including there names.

$users_getInfo = $facebook->api_client->users_getInfo( ‘732945108′, “name” );

The test console is a great tool for testing out how methods work and how the response is formated.

Now we want to put all three of these functions together to create a application that lists all your friends common friend.
PopFriends.txt demonstrates how to do this.

How to make a facebook applcation.

We are going to build a simple facebook application to demonstrate how to use the Facebook API.

Requirements:

  • Basic knowledge of php
  • A webserver running php5 that is open to the internet.
  • A facebook account (sign up)

Directions

  1. Add the developers application to your facebook account.
    Goto: http://www.facebook.com/developers/ and add the developers application to your account.
    After you sugsefuly add the devlopers application you should see the devlopers icon on the left sidebar.
  2. Create a new application
    Goto: http://www.facebook.com/developers/editapp.php?new

    1. Application Name: for our app, we put ‘Comp1920 Application’
    2. Check the Terms of service box.
    3. Click on the Optional Fields link - this will bring up more options.
    4. Support E-mail: your Facebook contact email may be filled in automatically, but you might not want to give out your personal email to everyone who adds your app! You do have to put a valid email address that you can check, however.
    5. Callback Url: for our app, we put ‘http://www.abluestar.com/dev/facebook/’ - you should put something DIFFERENT - in particular, you should put the url of the directory on your server where you will create your application.
    6. Canvas Page URL: http://apps.facebook.com/: for our app, we put ‘comp1920tutorialapp’ - you must put in a different name.
    7. Use Iframe: keep this setting.
    8. Application Type: leave this set to ‘Website’.
    9. Can your application be added to Facebook: set to ‘yes’ - this will bring up more options.
    10. TOS URL: you can leave this blank.
    11. Post-Add Url: for our app, we put ‘http://apps.facebook.com/comp1920tutorialapp/’ — you should put something DIFFERENT - in particular, you should put your full canvas page url.
    12. Default FBML: type in the text ‘hello’.
    13. Leave everything else under Installation Options blank.
    14. Side Nav Url: for our app, we put ‘http://apps.facebook.com/comp1920tutorialapp/’ — you should put something DIFFERENT - in particular, you should put your canvas page url here as well.
    15. Leave everything else under Integration Points blank.

    All the fields are described in detail on the Facebook documentations wiki.

    We have created out first Facebook application.
    People will be able to add this application to there accounts but it will not do anything just yet.

  3. Download the Facebook php5 API
    GoTo: http://developers.facebook.com/resources.php
    Extract it to a folder on your local computer.
  4. Create a basic Facebook Application with the Facebook php5 API
    1. Download and edit Step1.php with your faviorite php editor. (I suggest and use notepad++)// Include the Facebook php API
      // The API can be downloaded from facebook’s website. http://developers.facebook.com/resources.php
      require_once ‘facebook.php’;// These are settings that are given to you when you register your applcation.
      // ToDo: Change these setting to match the ones found on your
      // My Applcation page http://www.facebook.com/developers/apps.php
      $appapikey = ‘[your api_key]’;
      $appsecret = ‘[your secret]’;

      // Create an instance of the facebook class.
      $facebook = new Facebook($appapikey, $appsecret);

      // attempt to log in to facebook
      // We will attemp to log in as the current user,
      $user = $facebook->require_login();

      // The call back url for all internal links on this page.
      $appcallbackurl = ‘http://www.abluestar.com/dev/facebook/’;

      // catch the exception that gets thrown if the cookie has an invalid session_key in it
      try {
      if (!$facebook->api_client->users_isAppAdded()) {
      $facebook->redirect($facebook->get_add_url());
      }
      } catch (Exception $ex) {
      // this will clear cookies for your application and
      // redirect them to a login prompt
      $facebook->set_user(null, null);
      $facebook->redirect($appcallbackurl);
      die( “can not load facebook class” );
      }

      // Print the users number.
      echo “hello $user”;

  5. Upload the Facebook API and step1.php to your webserver.
  6. Add the application to your own Facebook account to test it.
    Goto your applications Canvas page: http://apps.facebook.com/comp1920tutorialapp/
    Add your application to your Facebook account.
  7. Browse to your applications page
    Goto your applications Canvas page: http://apps.facebook.com/comp1920tutorialapp/

You have made your first working Facebook Application.
In the next article we will be adding some functionality to the application to make it useful and describing how it all works.

When big people steal small guys ideas

colourlovers.jpg

I was reading some of the posts on the top three contest by dailyblogtips.com.
One that caught my attention was 3+1 things bloggers should never ever do

  • Stealing others content
  • Being rude to your commenter
  • Posting invalid facts
  • Stealing others ideas

The stealing others ideas has a great example of how Adobe aka 500 gorillas in photo editing riped off an idea from a small website ColourLovers.com. Not just the idea but the color set for there own site is very similar.
I have used the Colour lovers website before its fantastic for finding just the right complementary colors for websites. I used it back in 2005 for my first version of Games games and more games theme.

ColourLovers.com has a good post on all the similarities between the two sites.

This kind of thing angers me allot being a little guy. If I build something, I spent 200 hours getting it running and building a community and a big guy like Adobe or Microsoft steals the idea and makes there own version I have no way of competing with a company that can put unlimited man hours in to a project.

Adobe should do one of three things

What are your ideas on this?
If a big company steals a little guys project and adds a bunch of features making it “Better” is it right?

Where is gets sticky is if you cant build on other peoples work then there would only be one OS in the world. As far as I know IBM was the first company to build an OS. Windows, Apple’s OS, Linux all came after and I can’t really image a world with out Windows and other compedators.

Internet explorer (IE) caching AJAX requests.

The project was to create a status web page that showed the temperature of a room. The temperature of the room changes rapidly and I wanted the changes to appear on the page without my users having to click refresh every time they wanted an updated value.The ideal solution was AJAX.
I would use a bit of JavaScript to query anther page for the temperature of a room and refresh a div on the status page every n seconds.

It worked fine in FireFox and opera but when I tried it in Internet Explorer (IE) I found that the value never refreshed.
Example: http://www.abluestar.com/dev/web/ajax/temperature/

It turns out that Internet explorer loves to cache everything even when it’s told that the data has expired. IE is happy to shows you the catches version.

The first thing I tried was to set the Last-Modified, Date, Cache-Control headers so that it shouldn’t cache anything. Of course Internet Explorer ignored these settings.

Then as a good internet enabled programmer I searched the internet for a solution and came across this page Ajax IE caching issue. His solution was to use a POST instead of a GET to retrieve the data but it didn’t work for me

After a bit of smashing my head up against the wall, cursing the devil that is internet explorer I finely found a working solution.
Added a parameter to the end of the URL with the time in Sec’s

So instead of requesting value.php I request value.php?s=1828399595. It worked flawlessly
Example: http://www.abluestar.com/dev/web/ajax/temperature/index2.htm


<html>
<head>
<title>Temperature</title>
<script type="text/javascript">
function GetXmlHttpObject() {
var objXMLHttp=null
if (window.XMLHttpRequest) {
objXMLHttp=new XMLHttpRequest()
} else if (window.ActiveXObject) {
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
function RefreshData() {
// Get The value span
var value_span = document.getElementById("temperature_a") ;
if( value_span == null ) {
return ;
}
// Get XmlHttp Object
var xmlhttp=GetXmlHttpObject();
if (xmlhttp==null) {
alert ("Browser does not support HTTP Request")
return ;
}
// Create the request
xmlhttp.open("POST", "value.php" + "?ms=" + new Date().getTime() , true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if( xmlhttp.status==200 ) {
value_span.innerHTML = xmlhttp.responseText ;
} else {
// Error
value_span.innerHTML = 'Error loading data. Error=' + xmlhttp.status ;
}
}
}
// Set the request
try {
xmlhttp.send(null);
}
catch (E) { }
// Set a timer to call this function again in 1 sec
timerID = self.setTimeout("RefreshData( );", 1000 )
}
</script>
</head>
<body onload='RefreshData();' >
<strong>Temperature:</strong> <span id='temperature_a'>Loading</span>
</body>
</html>

Resize thumbnails in Wordpress

I get asked this question lot, how to change the default size of the thumbnail that wordpress creates when you upload an image. There are two different ways of doing it depending on what version of your Wordpress you have installed.

If you have Wordpress prior to 2.1
Open /wp-admin/inline-uploading.php and look for the following code:
if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
$thumb = wp_create_thumbnail($file, 128);
elseif ( $imagedata['height'] > 96 )
$thumb = wp_create_thumbnail($file, 96);

The default max size is 128 x 96. You can change these numbers to whatever you like, although you must keep the proper aspect ratio (4 / 3).
For example, to double the size of the thumbnails, replace 128 with 256, and 96 with 192. Be sure to change both sets of numbers - they are each listed in the code twice.

Instructions for WordPress 2.1 or 2.2 and later
Open /wp-admin/admin-functions.php and look for the following code:
$max_side = apply_filters( 'wp_thumbnail_max_side_length', 128, $attachment_id, $file );

This works a bit differently than earlier versions of WordPress. The number specified here (128 by default) is the maximum size of either dimension. You can still just change this to whatever number you like though.

Technorati faves

technoratiicon.gifTechnorati is becoming one of the biggest players in blogging. Its a great tool for ranking one site against anther and its also a search engine of content. Before I make a post I do a quick search on Technorati and see who else has written about it. After I make a post I search Technorati for other blogs that might benefit from my content and posts comments on there blogs.

Technorati has a neat feature where you can add blogs to your favorite list, it generates a single RSS feed of all the posts and its great for building good back links. Some people got it in there mind that they could make a viral cross linking scheme to build your fave count in Technorati.

I found this via Msdanielle.com post You Fave My Blog, I’ll Fave Yours: A Technorati Experiment

Here’s how it goes:
1. Click Here and Add me to your Technorati Favorites List
2. Leave a comment on this post that you’ve added me. Put YOUR Technorati Favorite URL in the comment so I can add you too.
3. I’ll add you to my Technorati Favorites list once I receive your comment.
Then copy and paste this stuff and follow the directions in to your blog.
***Start Copying Here:***

Here are the rules:

  1. Write a short introduction paragraph about how you found the list, including a link to the blog post that referred you to it.
  2. Copy the rules and entire list below and post it on your blog. To avoid duplicate content and increase the number of keywords to each site, change up the titles of the blogs. Just don’t change the links.
  3. Take the “My New Faves” and move them into “The Original Faves” list along with your site. Make sure all links are working properly.
  4. Add 3 blogs to your Technorati Favorites and link them in the “My New Faves” section. Don’t forget to add the “Fave Me” link next to the new blogs (i.e. http://technorati.com/faves?sub=addfavbtn&add=http://www.yourfavesdomain.com)
  5. Add Everyone on this list to your Technorati Favorites List by clicking on “Fave this Site.” Those who want good kharma will fave you back. If not, you will for sure get the benefits of faves from the bloggers who continue this list after you.

My New Faves

Games games and more games Fave this Site
Without Really Trying Fave this Site
Criticaloddness Fave this Site

The Original Faves

Steven Smethurst Fave this Site
Danny Dang
Fave this Site
ReFormatThis Fave this Site
Little Money Fave this Site
MrGaryLee
- Fave this Site
DoshDosh - Fave this Site
NateWhitehill
- Fave this Site
MsDanielle - Fave this Site
JeffKee - Fave this Site
ScribbleOnTheWall - Fave this Site
JimiMorrisonsHead - Fave this Site
JonLee - Fave this Site
Samanathon - Fave this Site
EatDrinknBeMerry - Fave this Site
TheManOfSilver
- Fave this Site
HannesJohnson - Fave this Site
MyDandelionPatch
- Fave this Site
NathanDrach - Fave this Site
SiteLogic - Fave this Site
JuliesJournal - Fave this Site
TeaAndSlippers - Fave this Site
EdLau - Fave this Site
QMusings - Fave this Site
StephenFung - Fave this Site

***End Copying Here***

Wordpress robots.txt

Recently Daily blog tips ran an article about Robots.txt files. The article gives examples of other major websites and there robots.txt files but fails to mention the reason behind each rule.

I am going to run thou my robots.txt file and describe each and every rule.
Hopefully by the end of this article you will have a better understanding of the robots.txt file.

http://www.abluestar.com/robots.txt

sitemap: http://www.abluestar.com/sitemap.xml

User-agent:  *
Disallow: /img/
Disallow: /blog/wp-admin/
Disallow: /blog/wp-includes/
Disallow: /blog/category/
Disallow: /blog/feed/

User-agent: duggmirror
Disallow: /

Line 01: ’sitemap: http://www.abluestar.com/sitemap.xml’
I included a link to my site map, this is for Google Site map utility. Google Site map utility lets you define your site map in your robots.tst file or on there webmasters configuration page. I use both just incase.

Line 02: ‘User-agent: *’
This tell search engines that the following rules apply to all robots and everyone should follow it.

Line 03: ‘Disallow: /img/’
This line tells the search engines that I don’t want them to index my /img/ folder. The folder mainly contains pictures of my family and friends. There is no reason for robots to search this directory, infact I don’t want pictures of my family showing up randomly on the internet.

Line 04: ‘Disallow: /blog/wp-admin/’
Line 05: ‘Disallow: /blog/wp-includes/’

These two lines tell robots to say out of the Wordpress softwares application data, most of these files are password protected and there is no reason for a robot to go here.

Line 06: ‘Disallow: /blog/category/’
Line 07: ‘Disallow: /blog/feed/’

These two lines are important for SEO. Most search engines will penalize you for duplicate content (Content that appears in more the once place at a time). Your category pages and RSS feed is all duplicate content, copies of your psts. To prevent search engines from penalizing my site I ask them not to index these pages. This reduces the amount of duplicate pages that the search engine will fine.

Line 08: ‘User-agent: duggmirror’
Line 09: ‘Disallow: /’

These two lines tells a specific robot duggmirror robot that I don’t want them indexing any of my site. The duggmirror is used by digg.com to make copies of your website before posting it on digg. On slow servers this is a good idea it prevents your site from falling over because of the massive amount of traffic that these social bookmark sites can produce. Instead of the traffic going to your site it goes to this mirror site and everone gets a chance to see your content. Sounds like a good thing right?.. The problem is that you don’t get the traffic, your ads don’t get clicked on and you cant see the traffic stats. I host this site on a server that can take all the traffic that digg/fark/slashdot/stumble upon can thou at it so there is no reason for someone else to mirror my site, so I disable this robot from crawling any of my site.

I hope you found this article useful, if you have any suggestions for other rules that might be handy.
Feel free to comment.

Always add the www

When creating a new website you want to create as little duplicate content as possible. Most host let your users access your website from either the http://abluestar.com or the www version http://www.abluestar.com. This can be dramaticly reduce your site’s Page rank because is that most search engines see the ‘www’ and the ‘non www’ version as two different websites and Googles’s Page rank is split between the two sites. Instead of getting a solid PR4 you get two measly PR2 sites.

There is a solution
You can force your users browser to redirect to the www version with a Mod Rewrite script.

Directions

  1. Create a new file called .htaccess
  2. Copy and past the snippet below in to the file.

    RewriteEngine on
    RewriteBase /
    # Always add the www
    RewriteCond %{HTTP_HOST} !^www.abluestar.com$
    RewriteRule ^.*$ http://www.abluestar.com%{REQUEST_URI} [R=301,L]

  3. Replace ‘abluestar.com’ with your domain (replace in two locations)
  4. Upload the file to your base directory on your web server.

The next time your users try to browse to your non ‘www’ version of your website they will be automatically forwarded to you www version.

Timeless content

clockicon.jpgI have talked before about creating timeless content but never in detail till now. Its one of the first things I check when searching for content is when it was written.

Content is king.
The internet is about content, about finding answers to your questions, it’s supposes to make things easier. As people search the internet for content they are dropped off on your pages. If the content is relevant or useful they will stay and read it, if not they will go somewhere else to find what they need.

Current events only live a short time.
When you write a post about a current event in your local town or new and shinny toy, that content is only useful for a short period of time, a few weeks before the event happens and maybe a week after it happens. After the even has taken place and everything has been cleaned up the post becomes useless no one is going to search for it and if they do find it randomly it will not be useful to them, its dead content.

Old information is regarded as useless and out of date information.

I’m not saying there is no place for current events sites (I subscribe to more then a few) but there archives past a few months are useless. Once they stop posting they will fall out of interest with in weeks.

It’s all about timeless content
Instead you should be writing timeless content. Content that will still be valid and useful 5 to 10 years after it’s been posted.

This is one of main reasons that I started my offline games website, the rules and games posted there will still be useful in 5-10 years. Maybe even 50 years down the road people will still be searching for how to play crazy 8s, big 2, or king’s cup.

One of the easiest ways to write timeless content is to write about history. The history of a place or person is easy timeless content.

Tips for creating timeless content

  • Include extra information – When writing about a current events or new project, include a history, Include a time line of events that that caused it, and its predecessors. Add extra information that will be useful even after this event as passed and the product has been replaces.
  • Avoid words that give a sense of age – Whenever it is possible don’t mention dates or any reference to how old this content is. If you have to reference the date use a full date Feb 2007 instead of 3 days a go, or last year.
  • Don’t talk about things that change – Don’t talk about things that may change next year. If you are caught it’s a sure sign of the age of the content.

12 Tips for creating a killer landing page.

Good landing pages are a key to creating conversations from your advertisement. It’s the first page that your users see when they click on one of your ads its got to be exactly what they want.

I created these tips for creating killer landing pages when I was helping a good friend of mine fixes his adwords campaign. I created landing pages and optimized his adwords campaign and in 2 months he was getting 7-10 times as many leads from his website as he once was. From 2 a day to 12-25 a day it a huge improvement and I ended up getting a nice bounce.

He made the biggest mistake you can made with any type of advertisement, all his ads lead back to the main page of his website, the landing page has nothing to do with the ad its self. Barley anyone that came thou an adsense ad ever took the time to search his website for what they where looking for. Why would they when they can just click the back button and find something more relevant.

12 Tips for creating a killer landing page.

  1. Opening statement - All lading pages should have an opening statement that should answer the main questions right away. It should be short and sweet.
  2. Call to action - There should be a call to action above the cut of the screen (top 300 px) that should tell the users what they need to do next to continue. BUY NOW, Subscribe, contact us, etc.
  3. Make it stand out - Make the call to action button stand out from the rest of the page. Larger and a different colors, nothing works better then a big red button that tells them what to do.
  4. Keep it short - Everything should be short less then 200 words for each paragraph anything that doesn’t have to be on the page should be moved to a support page. You can always add a link to the bottom of a long chunk of text “for more information…”
  5. Offer an avenue for more information - You should always give them a chance to ask questions or get more information on a subject, these links should stay local to your website or open in a new window.
  6. One offer only - Each page should only have one offer on them, don’t confuse your users give them exactly what they want.
  7. Be crystal clear - The offer should be crystal clear on what you are offing.
  8. Add a picture - People tend to scan a page before committing to reading it, adding a picture to a page can really help convince people that the page is worth reading.
  9. Important stuff at the top - Keep anything you want your users to read near the top of the page.
  10. Make it personal - Write in 2nd person using. ‘you’ and ‘your’
  11. Lots of White space - an uncluttered page with lots of blank space.
  12. Remove anything that does not need to be there - No navigation, no side bar, no ads for other products, remove anything that’s distracting. You should still have your sites logo near the top of the page with a link back to your main page.

You should also take a look at yesterdays post, 23 tips for writing good blog posts and articles

John Chow - How to make money online

johnchow.jpgI recently reached the 200 mark in subscribed RSS feeds it was becoming unmanageable and I spent maybe 4 hours a day reading posts instead of making posts, not very productive.

Then I decided to clean out my subscription list and shrink it down to 10 feeds. It wasn’t as hard as I expected it to be. anyone that didn’t post in the last 3 months… gone. Anyone that post more then 50 times a day… gone. Anyones that hasn’t had an interesting post in 10 posts… gone. That left me with about 20 good solid feeds, it was very hard to get rid of the last 10 feeds but I was successful.

One of the feeds that I decided to keep was to John Chow blog. I really enjoy reading about his late schema to make money online.

A little while ago someone ordered a review of their site from his reviewme.com account, it was an affiliates scam. Instead of being all nice and a good boy he exposed his entire plan for what it was… after that post I was hooked.

Hes also from my home town (Vancouver) or pretty close to. I hope to run in to him one day on the street and say ‘hey I know you’ shake his hand and go on my merry way.

The main reason that I am making this post that I am sure I will get flamed for later is that he has this contest thats going on right now. Make a post about him and link to a few key pages and he will link back from his rank 6 home page. The reason that I waited so long to do a review of his site is that he is also almost at 100 site reviews, and I really want to be on that post, maybe I will get lucky.

To do a review of his site you have to post the following text in one of your posts.

John Chow dot Com is blog that helps you make money online. If you do a review of his blog, he’ll link to you so his readers can check you out.

23 Tips for writing good blog posts and articles.

writting.jpg I try to keep a list of good blog and article writing tips in my head while I am trying to write posts for you. I don’t always follow them all but I try my best.
In no particular order

  1. Use bulleted lists - Bulleted lists help a lot to break up paragraphs and make it easier for online readers. If you bold the fist part of the bulleted list it makes it a lot easier for the users to scan the article and determine if they want to read it.
  2. Good openings - Most articles should have an opening statement, statistically most readers never made it past the 2 sentence.
  3. Get to the point – Make sure the topic of the post is known immediately, if they have to read 100 words before they get to the point there probably going to move on.
  4. Write less - Not everyone has 8 hours to read Blogs a day, if you can write something in 200 words instead of 500, do it in 200 words.
  5. Split up big articles – If you can split up large articles in to mutable posts and link them to each other. It makes posts more manageable to read for the user.
  6. Write series posts – Write a series of posts forces the user to come back the next day to read the next article in the series. It can be good for splitting up large articles in to manageable chunks.
  7. Keep on subject – Try to keep on one subject, if you have more then one thing to say split it up in to two posts and link them to each other.
  8. Make head lines snappy, - Contain your whole argument in your headline. Check out National newspapers to see how they do it.
  9. Use sub headlines - Each sub paragraph should have a sub headline, to make it easier for the users to read.
  10. Write lists – Write top 10 lists, Top 5 lists, Top 23 lists, have you ever noticed how there is always a top 10 list on every magazine at the check out. Add numbers to the titles of posts its helps.
  11. Be useful – Write useful content that people will use and search for. Useful content gets bookmarked and websites that have lots of good useful content get subscribed too.
  12. Be unique – Add a person touch to all your posts, it gives the reader a sense where the writer is coming from. If they wanted bland articles they would read a manual.
  13. Add a quote – People love quotes, it make them feel smart to know quotes and a quote near the top of a post helps keep it memorable.
  14. Don’t over use quotes – things like, don’t put all your eggs in one basket has been used so many times that its lost all meaning, don’t use them. if you have to personalize it a little. Don’t put all your giant man eating lizard eggs in one basket.
  15. Use deep linking – Write articles that link to your old content, this can be useful for many reasons. When people steal your content you still have a link back to your own website, you can resurrect old dead articles, I have already talked about deep linking before in a pervious article.
  16. Link love – Create lots of context links that make it easier for the users to get more information about the subjects that you are talking about. Link to other bloggers, stroke there ego and hopefully they will post back to you. Never be afraid to link out.
  17. Give credit where credit is due – It you copied something from anther blog, tell your users about it don’t try to tip toe around it, it’s not worth it. Any pictures, text, media, or where you got the idea for the post in the first place. This links back to link love.
  18. Ask the user to get involved – Ask a question, ask for feedback, do a small non invasive poll, get people to comment and add there own point of view.
  19. Use pictures – Use pictures to break up an article, make sure there above the crease of the article (the first 200 words). People tend to scroll thou the article before deciding to read it and pictures help a lot in convincing them.
  20. Use paragraphs – One giant paragraph can be intimidating to the reader but if you break it down to smaller parts it can a lot little more digestible.
  21. Reward top commenters – Mention the name of a commenter that posted a good comment on an older post, give them some credit they work hard too.
  22. Don’t use the same word twice – its one of the biggest signs that you are an amateur, using the same words over and over and over again like a favorite word.
  23. Make posts timeless - Try not to put in words like ‘summer of 2005’ or other information that would give the sense that in a year this information is useless. Make posts timeless

Please comment with any other tips that you might have, I will add them to the list.