Codeigniter 2.0

Codeigniter 2.0 is being baked at http://bitbucket.org/ellislab/codeigniter/ There are many changes to the codeigniter 2.0 which are very positive to the development community. There is no longer plugins in new version which i never used actually. scaffolding is gone. Codeigniter 2.0 is said to be not supported on php4 which in my opinion is good as it allows to use the power of php5 efficiently over php4 support. A new security class is added. It’s worth checking out following post by elliot haughin at http://www.haughin.com/2010/03/11/codeigniter-2-critical-changes-implications/

Posted in Uncategorized | Leave a comment

yahoo smileys array for codeigniter

I needed to use yahoo like emoticons in my new project i am working. So i had to replace all existing array of smileys, So in order to make this painful process easier to other who are trying to use yahoo like emoticons in their project. I have included the smileys image zip and config array with this post. I hope it will be use full. Please report any bug in the smileys array if you get one.

Download here

thanks

Posted in codeigniter, php | Leave a comment

Hosting from your home server

I always wanted to play with web servers and domain names. I often tried hosting websites from home server.  After some research over internet i finally got a site hosted from my own home server. The internet connection i am using is 256 kbps from NTC adsl. My IP is dynamic that is it changes from time to time when i restart my router. And for router I am using Tplink W8901G. There were various places where i got confused but i finally got a site hosted at  www.yalamber.co.cc (Not up right now as i kept the server down). Below is the detailed steps i followed. Hope you can catch up with it ;-)

Prepration

Find out your ip address. You can easily findout your ip address by going to www.whatismyip.com or www.whatismyip.com.np You will get your ip address from there. Note it down. This IP address changes from time to time when your router is restarted as this is your dynamic ip address that the ISP assigns to you. For the moment just note down the IP address. we will have use for it later. Go to zoneedit.com and register an account for free.  Zoneedit.com offers free service up to 5 zones. i.e 5 domain names.

Get your server ready:

Install apache for your webserver. I have tested with apache only not any other server. If you don’t know about installing webservers I suggest using xampp from apache friends. setup your web server and go to http://localhost  if you can see the page your server is ready. That part was easy wasn’t it?

Change apache to listen to alternative ports

Since ISP blocks default port 80 for web server we will have to configure apache to listen to other ports. I suggest trying 8080/5000. TO check if ports are blocked or not by your ISP go to www.canyouseeme.org check for port 8080/5000 they should not be blocked by your ISP.

Now, to add additional ports to let apache listen to go to your Apache’s conf  folder. If you have used xampp and are on windows machine then go to C:\xampp\apache\conf (or where ever you have installed the xampp). Open up httpd.conf  in your notepad or fav editor and find line

Listen 80

below that add

Listen 8080

Also look for

ServerName localhost:80

below it add

ServerName localhost:8080

Also go to C:\xampp\apache\conf\extra folder and open httpd-vhosts.conf file

find

NameVirtualHost *:80

below it add

NameVirtualHost *:80

I hope you understood what we are doing here we are just adding port 8080 to apache configuration to make it listen to port 8080

Then restart your webserver.

Now try opening http://localhost:8080 in your browser. You will see the same output as http://localhost

So port adding is achieved.

Configuring router

First get a static local ip for you computer. Find out your local ip, for that you can do ipconfig from command line. Your local IP and the Ip address we noted down before are different. The IP we got before was the IP assigned to us by our ISP and local IP is assigned to us by our router. Your local ip address may look like 192.168.1.2 Now to make it static.(instruction specific for TP link routers/ may or may not match other router)  I first log in to my router control panel.  It’s usually at http://192.168.1.1 for most of the router. Then I go to Interface Setup -> LAN . There you can see DHCP enabled and a list of connected computer with IP in DHCP table.  In mac address column select your mac address and In status choose static. Also note down your local ip. Now you got your local ip address. Note that down too. ;)

Now we need to forward the incoming request for IP assigned by our ISP that we noted down before  to our this local ip address from our router. Go to Advanced setup->NAT  in router and Select the virtual circuit you use. From there go to virtual server.

select application from the dropdown list to HTTP_Server

Protocol-> TCP

Start Port Number->8080

End Port Number->8080

LocalIP address->192.168.1.2 (the one you noted down as local IP)

Now save it. You have now successfully forwarded the incoming request at port 8080 to your webserver at local ip. Router configuration part is done

Assigning domain name to your server

You can assign domain name to your server now. For that you need to get a domain first. If you already have a domain you can change it’s name server to below address:

ns2.zoneedit.com

ns4.zoneedit.com

Since we will use zone edit for dns management. You can use free domain name .co.cc if you don’t want to mess with your precious domain name. co.cc provides  free domain with dns management facility. After registration change your domains name server to above name servers provided.

After changing name servers go to zoneedit.com login with the username and password provided.

Go to Add Zone from header and add your domain name there.

You will get message as success or congratulations. Now click on start editing domain in real time below the success message then,

On Next page click on Ip address(A) on header.

In name field add ww2 and in next IP address field add your ip address. Not the local IP address here. The one we noted down at the first. Click on add new ip address and then,

Go to web forward option in header.

In the new domain field add www and in destination field add full url like this http://ww2.yourdomain.com:8080 . Here 8080 is the port number we used and the yourdomain.com is the domain name you want to get hosted. Now it’s done. we are doing web redirect or forward as because simply opening yourdomain.com won’t let us listen to port 80 as it is blocked.

Also as you may have dynamic Ip address. so you need software to automatically update your ip address to zoneedit.com. There is already made tool for that in this link http://www.zoneedit.com/doc/dynamic.html#faq3 I used zeDyn . If you can’t use that tool. you may have to manually update the ip address field at zoneedit.com when your ip address changes that is when your router restarts.

Now everything done. Try opening first your ip address. the one we noted at first with port number like 11.22.22.222:8080. if you can see your site your router is setuped correctly. Then try accessing www.yourdomain.com the domain you registered .You should see your site opening. You may have to wait for some hrs as the dns gets updated accross your dns server you are using.  You can try accessing your sites through proxy or ask your friend if they can see it.

I hope this tutorial was helpful setting up your own server. Also your own home server may be slower due to slow connection. May have lot’s of downtime.  But who cares we finally got our site up with our own home server. :D Follow me up through comments.

Posted in webserver | 2 Comments

embedding fonts with typeface.js

Ever wanted to embeed fonts toyour webpages but not sure if your end users will have those fonts in their computer, here enters typeface.js. you can embeed any kind of fonts to the site with the help of typeface.js. Just include the typeface.js file and create a js file for your desired font from their online service at http://typeface.neocracy.org/fonts.html the process of using typeface.js in your website is very easy:

<script src="typeface-0.13.js"></script> <script src="helvetiker_regular.typeface.js"></script>
<div style="font-family: Helvetiker">Text here in Helvetiker font...</div>

contact me if you will need any help embeeding fonts in your site with typeface.js

for more information you can go to http://typeface.neocracy.org/

Posted in Uncategorized | 2 Comments

uploadrobots.com

Upload Robots is the coolest file sharing site I have seen or used till date. Many file sharing sites are swarmed with advertisements, popups, waiting times, and other unwanted garbage. This site has no advertisements at all and has a very professional design. Free accounts are provided with 1 gigabyte of storage; more than enough for most users. However you receive lot more with just $5 per month. It offers features like SSL encryption, subdomain login, and more. Also, files uploaded are not expired like other file sharing websites. Having used it, I must say I love it. I would recommend everyone to give it a try, I am sure you will love it as well. Below is a video where you can see about Upload Robots. http://www.uploadrobots.com to start uploading files.

Upload Robots Demo from David Merfield on Vimeo.

Posted in site review | 1 Comment

phpizabi is not dead

We almost thought phpizabi was dead. But with this statement by Claude D. at phpizabi.net it’s alive. A new version i under work. it’s named PHPizabi 2 VCP, Orion.

What would it be if we would break the barriers between the informative and the social web – If we would fusion applicative and interactive? What would it be if we would revise the nature of the software that became a powerful social platform and reorient it to become a global axe for virtual content distribution? – What would your V2 be?

I hope for all success of this project. please visit http://ww2.phpizabi.net/?L=special.vcp to know more about it.

Posted in phpizabi | 2 Comments

php frameworks

To let you know, I have never been fan of any CMS system or frameworks. I liked developing custom codes. I even developed my own small php framework to get the things done quickly. But working singly on it made it no good. Soon i realized, Why waste a bulk of time reinventing the wheel. I decided to use the available php framework. For my choice of framework, it had to be easy to get started, faster, scalable. I didn’t want to waste my time learning frameworks. After some reasearch over internet and googling stuffs, I lowered my framework search to Zend, cake, codeigniter.  And I choosed Codeigniter among these. I choosed it as it was easiest amongst to get started,  good support forum, nice tutorials. On my next framework choice will be Zend and cakephp. Currently codeigniter seems to be sufficient for my projects.

Posted in Uncategorized | 3 Comments

using youtube api to upload videos from your site

I wanted to create a video site but lacked the server resources to run it, I am using a shared server, it has ffmpeg but when converting a video it takes lot’s of system resources. I successfully made the fmpeg video site, But didn’t decide to use it. I searched for youtube APIs and i came to know we could simply use the youtube api to upload videos from our site to youtube. So i decided to use it for my video site. Below is step by step tutorial on using youtube api to upload videos from your site to youtube, I used the clientLogin method of youtube api to upload videos.

  1. First get the developer key for using youtube api.
    Go to http://code.google.com/apis/youtube/dashboard/ and regsiter a developer key
    You will be given client id and  developer key. Note it down, it will be used in your own application later.
  2. Get the php client libraries, Go to http://framework.zend.com/download/gdata
  3. extract it to your server. I assume you put the Zend direcctory in your server document root.
  4. Create a form in your site as below which i assume will be pointed to upload.php file in your srver.
<form action="upload.php"  method="post" enctype="multipart/form-data">
<select name="videoCategory">
<option value="Autos">Autos &amp;amp; Vehicles</option>
<option value="Music">Music</option>
<option value="Animals">Pets &amp;amp; Animals</option>
<option value="Sports">Sports</option>
<option value="Travel">Travel &amp;amp; Events</option>
<option value="Games">Gadgets &amp;amp; Games</option>
<option value="Comedy">Comedy</option>
<option value="People">People &amp;amp; Blogs</option>
<option value="News">News &amp;amp; Politics</option>
<option value="Entertainment">Entertainment</option>
<option value="Education">Education</option>
<option value="Howto">Howto &amp;amp; Style</option>
<option value="Nonprofit">Nonprofit &amp;amp; Activism</option>
<option value="Tech">Science &amp;amp; Technology</option>
</select>
<label for="title">Title</label>
<input id="title" name="title" type="text">
<label for="description">Description</label>
<textarea id="description" name="description" rows="5"></textarea>
<label for="keywords">Kewords (use comma , to separate)</label>
<input id="keywords" name="keywords" value="" type="text">
<br class="clr" />
<input value="Next -> choose video" name="add" type="submit" />
</form>

Create upload.php


<?php

if(isset($_POST['add'],$_POST['videoCategory'],$_POST['title'],$_POST['description']))
{
//add the video meta data to session
$_SESSION['vidmeta']['category'] = $_POST['videoCategory'];
$_SESSION['vidmeta']['title'] = $_POST['title'];
$_SESSION['vidmeta']['description'] = $_POST['description'];
$_SESSION['vidmeta']['keywords'] = $_POST['keywords'];

//application id change this to our applicationId
$applicationId = 'onnepalvideosite';
//client id change this to our own client id
$clientId = "ytapi-xxxxxx-xxxx-xxxxx";
//developer key change this to your own key
$developerKey = "xxxxxxx-xxxxxxx-xxxxxxxxx-xxxxxxx";
//include zend loader
require_once('Zend/Loader.php'); // the Zend dir must be in your include_path
//include youtube class
Zend_Loader::loadClass('Zend_Gdata_YouTube');
//include the client login class
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
//Client login
$authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = 'your username here',
$password = 'our password here',
$service = 'youtube',
$client = null,
$source = 'onnepal', // a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);

$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
// create a new VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();

$myVideoEntry->setVideoTitle($_POST['title']);
$myVideoEntry->setVideoDescription($_POST['description']);
// The category must be a valid YouTube category!
$myVideoEntry->setVideoCategory($_POST['videoCategory']);

// Set keywords. Please note that this must be a comma-separated string
// and that individual keywords cannot contain whitespace
$myVideoEntry->SetVideoTags($_POST['keywords']);

$tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
$tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
$tokenValue = $tokenArray['token'];
$postUrl = $tokenArray['url'];
$nextUrl = 'http://www.yoursite.com/yt.php';
print <<< END
<br /><form action="${postUrl}?nexturl=${nextUrl}"
method="post" enctype="multipart/form-data">
<input name="file" type="file"/>
<input name="token" type="hidden" value="${tokenValue}"/>
<input value="Upload Video File" type="submit" />
</form>
END;
}
?>

This code takes the category, title, description and keywords from the form and generates a form to upload video to youtube. You can then upload video to youtube using the form.
Next make yt.php file which is the $nexturl file, $nexturl is the location to which youtube will redirect after the upload is complete. YouTube appends id and status parameters to the URL as shown in the following example

http://www.yoursite.com/yt.php?status=200&id=JPF-DXF7hzc

Afterou get the youtube video id in your yt.php file you can add it to your own database to show videos in your site. You can do anything you wish with the variables you get through yt.php.I hope it will be help ful to all wishing to use youtube apis to upload video.

This can also be implemented to phpizabi sites.

Posted in Tutorials, Uncategorized, api, google, php, phpizabi, socialnetwork | Tagged | Leave a comment

google is buying twitter

According to techcrunch google is in it’s early stage in talks to acquire twitter. Twitter has also turned down the offer to be bought by facebook lately. With these steps gogle is soon going to occupy all the major web share. In majority of internet users, google has a daily impact. It has become the most important part of all the internet users. It would be great to see the deal between twitter and google. If it will be successfull, We can be sure google will bring the changes that will reflect the dynamic effect to the twitter user.

Posted in google | Leave a comment

me2everyone.com

Hello

Something incredible has arrived!

Click here to know more

I just became a shareholder in me2everyone and I never had to pay a single penny for the shares! It can only be described as the gold-rush for 2009. This company is going to be huge and shares will soar in value over the coming months! You can register for free and it never has to cost you a single penny!

me2everyone is going to be a cool new virtual world where you can meet friends, chat, shop, play, watch videos, create an art gallery, open a virtual newspaper, play the free inworld lottery and make money from your own online store! You and everyone you know make the decisions, shape the world, create real incomes and share in the profits. It’s a new place where you meet new people or invite your friends. Learn new skills or expand your business. Find the love of your life or help the planet.

Membership is free and every member automatically becomes a shareholder in me2everyone Limited. Personally I have WRITE YOUR SHARES HERE shares in the venture and I am going to increase my shares very soon. This is an excellent chance for all of us to make some real progress in 2009 and beyond! Please do not miss it.

If you are looking for something really good in 2009: something that changes your view on the world, then you really have to spend just one minute and look at this website.

http://www.clrurl.com/j

Posted in site review | Leave a comment