GitHub For Mac Released

GitHub For Mac ReleasedIf you are into coding and own a Mac then this post is for you. GitHub, the web-based project source hosting service has announced an official client for Mac users.

GitHub users normally has to make use of command line tools to update and commit to repositories, but the company has now released an official Mac client for GitHub with a complete GUI.

GitHub for Mac will allow you to manage all your repositories from an easy to use GUI, allowing you to view switch between branches, view commit history, see the diff between certain commits and allow you to perform operations on it.

For more information on GitHub for Mac and to see some screenshots see the official post on GitHub or go download GitHub for Mac for free here.

Forrst WP WordPress Plugin

Forrst is a new online community where developers and designers can share inspiring code, links and screenshots. Think of it as a social network for developers and designers out there.

Forrst is currently only available on invite and I am lucky enough to be part of this great community, checking in daily to see what interesting things like-minded peers are up to.

Forrst recently released a, lets call it API, with limited functionality where you can look up user info and posts for specific users. It got me thinking seeing as I am such a big fan of WordPress, why not have a nice widget where you can showcase your latest Forrest Post and this is where Forrst WP was born.

Forrst WP is a WordPress plugin that enables you to place a WordPress Widget on your site showing your the latest Forrst Posts for the user you specified. Forrst WP currently has limited functionality seeing that the Forrst API is very restricted at the moment only allowing you to look up posts and user information for specific users.

Forrst WordPress Widget PluginTo use Forrst WP, simply download the file below, extract and upload it to your WordPress plugins directory. In you WordPress dashboard under the Plugins menu, activate Forrst WP and then head over to your Widgets and simply drag the Forrst Widget to where you’d like it and enter the options as desired.

Download Forrst WP v1.0

PHP South African ID Number Validation

It’s not often that I post some code here on iGeek, which is a pitty because coding is a real passion of mine specially PHP, but sometimes you just write something you need to share with your fellow enthusiasts.

Here is a function I wrote in PHP that validates South African ID Numbers based on Luhn Check:

function ValidateSAIDNumber($idnr) {
	$d = -1;
	$a = 0;
	for($i=0;$i<6;$i++)
		$a += substr($idnr,$i*2,1);
	for($i=0;$i<6;$i++)
		$b = $b * 10 + substr($idnr,(2*$i)+1,1);
	$b *= 2;
	$c = 0;

	while($b > 0) {
		$c += $b % 10;
		$b = $b / 10;
	}
	$c += $a;
	$d = 10 - ($c % 10);
	if($d == 10)
		$d = 0;
	if($d == substr($idnr,strlen($idnr)-1,1))
		return true;
	else
		return false;
}

To use simply call ValidateSAIDNumber(IDNR) where IDNR is the South African ID Number and it will either return true if its a valid number or false if its not.

HTML5: Are you as Web Developer ready?

HTML5 Are you as Web Developer ready?It is without a doubt that HTML5 is the future of the web. With almost all the major web browsers already starting to support HTML5 what has you as Web Developer done to become familiar with HTML5?

With HTML5 allot can be done using only HTML and Javascript code where previously Flash or Silverlight was needed to accomplish the same task. Things like video and audio playback can be done natively with HTML5 without the need for any third party application. Developing 2D and 3D games also just became allot easier. With the new HTML5 canvas developers can now do 2D and 3D graphics with just a few simple lines of Javascript code.

The question is what have you as Web Developer done to become more familiar with the new HTML5 capabilities? Have you started reading up on it and tried your hand at some examples?

Most mobile phones out there today does not support Flash or Silverlight, even the new iPad which I would say was designed to be a web device does not support these third party applications, but one thing they do support is HTML5. This is why I would say it is so important for Web Developers to start experimenting with HTML5.

I took the weekend to do some tests and familiarise myself with HTML5 and I must say I am impressed. I will be doing some basic tutorials during the next couple of days to showcase the capabilities of HTML5 and just how easy it really is.

Are you HTML5 ready?

Twitter counts down to the OAuthcalypse

Twitter to kill Basic Authentication, switch to OAuthEvery Twitter developer has been made aware that this day may come, and now the date has been set for the termination of basic authentication on the Twitter API.

Twitter is to terminate support for basic authentication on the 30th of June 2010, from that day any applications that makes use of the Twitter basic authentication method to log users into the service won’t work anymore.

Good news is that there is an alternative method and is much safer way to use your Twitter credential to access services. It’s called OAuth and it does not require users to enter any of their credentials, the service will just redirect you to the Twitter service once and ask if you give permission to the application to access your service.

Facebook also recently introduced their brand new Graph API that is basically equivalent to Twitter’s API in the sense that it also makes use of RESTfull calls and uses OAuth for authentication.

If your Twitter application is still using basic authentication to retrieve data it’s time to switch over to OAuth as you only have 9 weeks left before your application won’t function anymore. Please note that this only applies to the RESTfull API and not the streaming API. Check out the count down timer here.

For more on how to use OAuth for your Twitter applications visit the Twitter Developers Authentication page.

I made TweSMS use OAuth from the start, is your application OAuth ready?

WordPress goes real-time with PubSubHubbub

WordPress goes real-time with PubSubHubbubWordPress just released the wonderful news that every self hosted WordPress site out there is about to get more real-time thanks to some new behind the scenes developments.

WordPress announced on its official blog that it has turned on support for PubSubHubbub, yeah that’s a mouth full, a move that will get RSS content of WordPress blogs to RSS readers like Google Reader or Bloglines in real-time.

How RSS feeds current works is readers poll the feed every few minutes checking if there is new content available, how it will work with PubSubHubbub is that the WordPress blogs will now push the feeds to the respective RSS readers as new content is posted.

Just today I wrote an article on the South African blog aggregators, this now opens up a hole new field for them as well. Blog aggregators like MyScoop and Afrigator will now have the ability to get your content in real time without you needing to log into the aggregator and ping your blogs. Real-time aggregation, I would like to hear if the local blog aggregators will make use of this service.

Here is a nice demo of PuSH (PubSubHubbub) in what WordPress call a “cheesy video”, for even more info on the PuSH protocol you can head over to the PuSH project page.

PHP5 json_decode bug

With my latest project TweSMS I decided to go the json route with the twitter API. Now if you have worked with the twitter API before you would know that twitter has some serious big id values thus it was important to store these values in big int fields in the database.

I first discovered the bug when I had to get mention ids from twitter and saw that every time I get the same id returned, the id returned was 2147483647 the maximum value a 32 bit integer can store. After some investigation I found that the php5 json_decode function converted big int values to a normal 32bit integer. With the help of some regex I soon came up with a fix for this, the fix is to convert the integer to a string.

function jsonIntToStr($json){
$pattern = “/\”id\”:([0-9]+),/”;
$replace = “\”id\”:\”$1\”,”;
$new_json = preg_replace($pattern, $replace, $json);
return $new_json;
}

To use this replace id with the json fields you are trying to convert to string and call it like this json_decode(jsonIntToStr($jsonstring))

Google Maps coming to Cape Town

Google Maps Cape Town

Google organises the world’s information and makes it accessible to all. Information also comes in the shape of geographical data, local business listings and user generated maps, and for this reason Google would like to invite you to the Google Maps South Africa launch.

Google is now giving Capetonians the oppertunity to take part in the launch of Google Maps in South Africa, on Friday the 30th of October at UCT in Cape Town.

Speakers will include Jarda Bengl, Business Product Manager, Google.

The talk will cover Introduction to development with the Google Maps API.
They’ll show some examples of great implementations, then cover the basics of how to add a map to your site including Javascript techniques to create maps, place markers, handle clicks, geocode addresses, add driving directions and how to work with Street View.

Just note that basic knowledge of XHTML, CSS, XML and Javascript is required.

Everybody is welcome from Developers and Web Masters who are new to Google Maps API, Computer Science Students.

To ensure you place is booked for the Google Maps South Africa, Cape Town launch just leave a comment and I’ll send through the rsvp email address.

How to mirror Wikipedia

Being part of CTWUG we are alway on the lookout for new services to run on our network that could prove usefull to the users of the CTWUG network.

The latest idea we got was to provide users with a local copy of the Wikipedia website, this would enable CTWUG users to view wikipedia content at local network speeds without having an internet connection.

After extensive research I came across this nice tutorial on how to run your own copy of Wikipedia from a database dump of the real Wikipedia website. Who whould have thought that Wikipedia would offer a montly database dump of their Website for users to download, good news is that they do.

I’ll provide the steps for you to follow to set up your own Wikipedia mirror, please note basic knowledge of linux, bash, apache and mysql is required. The steps is for installing the mirror on a Ubuntu machine.

So here is the steps for setting up your own Wikipedia mirror from their database dump.

  1. Install LAMP: Linux Apache MySQL PHP
    apt-get update
    apt-get install apache2 php5 libapache2-mod-php5 mysql-server mysql-client php5-mysql phpmyadmin
  2. Setup MySQL: You need to set your mysql root password
    $ mysql
    mysql> USE mysql;
    mysql> UPDATE user SET Password=PASSWORD(’new-password’) WHERE user=’root’;
    mysql> FLUSH PRIVILEGES;

    You also need to create a database for your incoming Wikipedia. Go to http://localhost/ and click on phpmyadmin. Log in using your new root password. Under Create new database, enter wikidb and click Create. On the new page, click on Privileges, add the new user wikiuser and click check all, then Go.

  3. Download the MediaWiki software: This is the software wikipedia is running on. Go to the MediaWiki download page. On the right, download the .tar.gz file.
    wget http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz

    Decompress it and move it to /var/www/

    tar xf mediawiki-1.15.1.tar.gz
    mv mediawiki-1.15.1.tar.gz wikipedia
    sudo mv wikipedia /var/www/

    I am installing it under the directory wikipedia.
    Change the file permissions of the config directory

    cd /var/www/wikipedia/
    chmod a+x config/

    Now navigate to http://localhost/wikipedia/ From here, the only things you need to put in are

    • Site name (I chose WikiMirror)
    • WikiSysop’s password (The administrator password)
    • DB password

    Now you need to move LocalSettings.php out of config.

    mv config/LocalSettings.php

    Now you can go to http://localhost/wikipedia/ and you should see your virgin MediaWiki install!

  4. Get Wikipedia’s database dumpYou can get the latest version of Wikipedia’s database dump by subscribing to http://download.wikimedia.org/enwiki/latest/enwiki-latest-pages-articles.xml.bz2-rss.xml the latest file I got was http://download.wikimedia.org/enwiki/20091009/enwiki-20091009-pages-articles.xml.bz2
    wget http://download.wikimedia.org/enwiki/20091009/enwiki-20091009-pages-articles.xml.bz2

    The file is 5.2GB so it should take a while to download.
    After downloading decompress the file

    tar xf enwiki-20091009-pages-articles.xml.bz2

    The uncompressed size is almost 20 GB so be sure you have enough disk space available.
    Now for the lenghty part of the process, you need to import the file into your mysql database.
    Download mwimport.sh and save it and run it like this

    cat enwiki-<date>.xml | mwimport | mysql -f -u <admin name> -p <database name>

    This process should take a few hours to complete, from 7-12 hours depending on your HDD speed and processor.

That should be all, if all went well your will have a complete working copy of wikipedia on your local machine. CTWUG members can look forward to this service very soon.

WordPress change author comment background

Lately I have noticed that when I leave comments sometimes the readers leaving comments aswell has no idea that I am the author of the post. This made me realise that I had to find a way of showing that I am the author of the posts in the comments section.

After some consideration I decided on just changing the background colour of my comments, I’ve seen many other blogs using this approach and it seems to work well and looks nice and clean.

Here is how I did it:

Open up comments.php and find

<li class=”<?php echo $oddcomment; ?>” id=”comment-<?php comment_ID() ?>”>

Replace it with

<li class=”<?php if (1 == $comment->user_id) $oddcomment = “authorcomment”;

echo $oddcomment; ?>” id=”comment-<?php comment_ID() ?>”>

After that add the following to you style.css file

.authorcomment {
background-color: #B3FFCC !important;
}

And that is it, all the comments made by admin will now be displayed with a background colour. If you would like to change the background colour just modify the hex value you put in the style.css file.

  • Page 1 of 2
  • 1
  • 2
  • >
Afrigator SA Topsites ::