Tuesday, June 1, 2010

Enabling mod_cgi, python in lighttpd

Hi Folks,

Enabling mod_cgi,python in lighttpd

Create cgi-bin directory in /var/www

mkdir -p cgi-bin
chown www-data:www-data cgi-bin/
chmod 755 test.py

open lighttpd.conf

vi /etc/lighttpd/lighttpd.conf

append .py extension and save the file
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".py" )

open 10-cgi.conf

vi /etc/lighttpd/conf-enabled/10-cgi.conf

enable mod_cgi
server.modules += ( "mod_cgi" )

Change the alias.url for your cgi-bin directory

$HTTP["remoteip"] =~ "127.0.0.1" {
alias.url += ( "/cgi-bin/" => "/var/www/cgi-bin/" )
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( "" => "" )
}
}

$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( "" => "" )
}

## Warning this represents a security risk, as it allow to execute any file
## with a .pl/.php/.py even outside of /usr/lib/cgi-bin.
#

Uncomment the .py entry and save the file
cgi.assign = (
# ".pl" => "/usr/bin/perl",
# ".php" => "/usr/bin/php-cgi",
".py" => "/usr/bin/python",
)

Restart lighttpd
/etc/init.d/lighttpd stop
/etc/init.d/lighttpd start

Saturday, February 20, 2010

How to take an ISO from linux machine

Hi Folks,

If you want to take an iso of the ubuntu/kubuntu machine, Type command in terminal as a root user

$> remastersys clean

$> remastersys backup isoname.iso

It will take some time and the ISO image automatically saved into you /home/remastersys/remastersys folder itself.

Tuesday, June 3, 2008

Facebook App Creation

Step-by-step Guide to Creating an Application



Contents




  1. Introduction

  2. Integrating Hello World

  3. Pushing FBML to the profile box

  4. Using mock-AJAX in the profile box

  5. Using MySQL to create a counter

  6. Putting the examples together

  7. Downloads




Introduction



This tutorial describes how we created a platform application called 'tutorialapp' that you can use as a template when creating your own platform app. The tutorial assumes that you have access to a web server running php5.


The final version of 'tutorialapp' is hosted at http://tperry256.dreamhost.com/f8/tutorialapp/. If you follow this link it will ask you to login to Facebook and add the 'tutorialapp' application. You can get access to a server like this from a variety of hosting companies for just a few dollars a month.


When you create your own app, you will using a different application name and a different server. We have highlighted these things that will be different for your application.





Integrating Hello World



  1. Go to http://developers.facebook.com/

  2. Click on 'Get Started'

  3. Click on 'Add Facebook Developer Application'

  4. A link to 'Developer' should appear in the left nav on Facebook now. Go to the Developer App.

  5. Click on the button that says 'Setup New Application'

  6. Here are the steps for filling out the form:


    1. Application Name: for our app, we put 'Tutorial Application' - you should put in a different name.

    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://tperry256.dreamhost.com/f8/tutorialapp/' - 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 'tutorialapp' - you must put in a different name.

    7. Use FBML: 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/tutorialapp/' -- 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/tutorialapp/' -- 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.


  7. Click on the 'Submit' button.

  8. Go the the 'My Applications' page and check that your application was created. There are a couple ways to get here depending on where you are in the Developer application.

  9. Copy the latest version of the php5 client library into your application's directory on the server.

  10. There are some links to the client library in the downloads section. If you are using a unix shell and are currently in that directory, these commands will work:


  11. wget http://developers.facebook.com/clientlibs/facebook-platform.tar.gz
    
    tar zxvf facebook-platform.tar.gz
    cp facebook-platform/client/facebook.php .
    cp facebook-platform/client/facebookapi_php5_restlib.php .
    rm -rf facebook-platform.tar.gz facebook-platform


  12. Create an 'appinclude.php' file that you will include at the top of all the php pages in your app. Paste this code into the file:


  13. require_once 'facebook.php';
    

    $appapikey = '[your api_key]';
    $appsecret = '[your secret]';
    $facebook = new Facebook($appapikey, $appsecret);
    $user = $facebook->require_login();

    //[todo: change the following url to your callback url]
    $appcallbackurl = 'http://tperry256.dreamhost.com/f8/tutorialapp/';

    //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);
    }


  14. Replace '[your app_key]' and '[your secret]' with the 'app_key' and 'secret' for your application that are shown on the 'My Applications' page of the Developer app. You should also replace our callback url with your callback url.


  15. Create a 'index.php' file which will be your application's home page. Paste this code into the file:


  16. require_once 'appinclude.php';
    

    echo "

    hello $user

    ";


  17. Type YOUR APP's callback url into your browser's address bar. You could also type in your canvas page url because going here will also cause your 'index.php' to run. Either way, the only way to get your application added at this time is to type a url into your browser's address bar.



  18. here is OUR APP's callback url: http://tperry256.dreamhost.com/f8/tutorialapp/



    here is OUR APP's canvas page url:http://apps.facebook.com/tutorialapp/



  19. Click 'I agree' to accept the terms of service for your application and then click the button to 'Add [your application name]' to add it.


  20. You should then be redirected to a canvas page which contains the output of your 'index.php' file.


  21. Go to your profile and look for a profile box for your application which contains the 'hello' -- this is the default FBML that you set before.


  22. Finally look for a left-nav link that will take you back to your canvas page.





Pushing FBML to the profile box




  1. Here is an extended version of 'index.php'. When the user submits the form, this code puts the text they submitted in the profile box.

  2. Note that submitting the empty string causes the profile box to disappear!


  3. require_once 'appinclude.php';
    

    echo "

    hello $user

    ";

    if (isset($_REQUEST['profiletext'])) {
    $facebook->api_client->profile_setFBML($_REQUEST['profiletext'], $user);
    $facebook->redirect($facebook->get_facebook_url() . '/profile.php');
    }

    echo '
    ';
    echo '
    ';
    echo '';
    echo '
    ';





Using mock-AJAX in the profile box




  1. This code pushes a form into the profile box that uses the mock-AJAX feature of FBML to give the illusion that you can dynamically update the content of the profile box.

  2. Notice how the if statement at the very top of this 'index.php' file handles the mock-AJAX call.


  3. if (isset($_REQUEST['mockfbmltext'])) {
    
    echo $_REQUEST['mockfbmltext'];
    exit;
    }

    require_once 'appinclude.php';

    echo "

    hello $user

    ";

    $fbml = <<This is the subtitle





    clickrewriteurl="$appcallbackurl"
    clickrewriteid="preview" value="Draw text below"
    />





    EndHereDoc;

    $facebook->api_client->profile_setFBML($fbml, $user);

    echo "

    the following form was added to the profile box:

    ";

    echo $fbml;





Using MySQL to create a counter




  1. This example assumes that you have a way to create a mysql database which the php scripts on your server can connect to.


  2. If you don't already have a database, create one.

  3. Create a table in the database called 'counter' which has a single integer column called 'count'.

  4. Create a new file called 'dbappinclude.php' and paste the following code into the file. Don't forget to replace the items in brackets with your actual db host, user, pass, and name.


  5. require_once 'appinclude.php';
    

    $dbhost = '[your db host]';
    $dbuser = '[your db user]';
    $dbpass = '[your db pass]';
    $dbname = '[your db name]';

    $conn = mysql_connect($dbhost, $dbuser, $dbpass);
    mysql_select_db($dbname, $conn);

    function query($q) {
    global $conn;
    $result = mysql_query($q, $conn);
    if (!$result) {
    die("Invalid query -- $q -- " . mysql_error());
    }
    return $result;
    }



  6. Now try out this version of 'index.php'. It displays a counter that gets updated every time 'index.php' is loaded.



  7. require_once 'dbappinclude.php';
    

    echo "

    hello $user

    ";

    $rs = query("select count from counter");
    if ($row = mysql_fetch_assoc($rs)) {
    $count = $row['count'];
    query("update counter set count=count+1");
    } else {
    query("insert into counter values (1)");
    $count = 1;
    }

    echo "

    the count is $count

    ";





Putting the examples together




  1. Here's a final version of 'index.php' which puts all these examples together. It assumes that you have created 'dbappinclude.php' from the previous example.


  2. if (isset($_REQUEST['mockfbmltext'])) {
    
    echo $_REQUEST['mockfbmltext'];
    exit;
    }

    require_once 'dbappinclude.php';

    echo "

    hello $user

    ";

    $rs = query("select count from counter");
    if ($row = mysql_fetch_assoc($rs)) {
    $count = $row['count'];
    query("update counter set count=count+1");
    } else {
    query("insert into counter values (1)");
    $count = 1;
    }

    echo "

    the count is $count

    ";

    if (isset($_REQUEST['profiletext'])) {
    $facebook->api_client->profile_setFBML($_REQUEST['profiletext'], $user);
    $facebook->redirect($facebook->get_facebook_url() . '/profile.php');
    }

    echo '
    ';
    echo '
    ';
    echo '';
    echo '
    ';

    $fbml = <<




    clickrewriteurl="$appcallbackurl"
    clickrewriteid="preview" value="Draw text below"
    />





    EndHereDoc;

    $facebook->api_client->profile_setFBML($fbml, $user);

    echo "

    the following form was added to the profile box:

    ";

    echo $fbml;





Downloads




  1. facebook_client.tar.gz -- the latest php5 platform client library

  2. tutorialapp.tar.gz -- source fo the final combined example; you need to fill in your own app_key, application secret, and db info to make it work on your server

  3. tutorialapp.zip -- same as tutorialapp.tar.gz but in a zip file



Friday, September 7, 2007

Mac Cocoa - Java API

Hi all, My new Project is Mac OS Project, Using XCode, Interface Builder..., Its my new Experience in Cocoa application development. its very interesting... i share my experience. First i tell what is Cocoa, it can be following here....

Cocoa is an object-oriented application environment designed specifically for developing Mac OS X-only native applications. The Cocoa frameworks include a complete set of classes, and for developers starting new Mac OS X-only projects, Cocoa provides the fastest way to full-featured, extensible, and maintainable applications. You can bring applications from UNIX and other platforms to Mac OS X quickly by using Cocoa to build state-of-the-art Aqua user interfaces while retaining most existing core code.

Cocoa is one of the application environments of Mac OS X and a peer to Carbon and Java. It consists of a suite of object-oriented software libraries and a runtime engine, and shares an integrated development environment with the other application environments. You can write Cocoa applications in either Objective-C or Objective-C++ (there are Java bindings as well) but you can also call Carbon C functions.

Cocoa is one of the application environments of Mac OS X and a peer to Carbon and Java. It consists of a suite of object-oriented software libraries and a runtime engine, and shares an integrated development environment with the other application environments. You can write Cocoa applications in either Objective-C or Objective-C++ (there are Java bindings as well) but you can also call Carbon C functions.

First U can download and install the Xcode in ur Mac Os, its also available for opensource in Mac Website clickhere.

And then u can run the Xcode application, then the same procedure for all other project development, click the File new Project then select the cocoa project, then u can give the project name,


after that click the finsh button the Project will ready to work... then u click the Main Meni.nib file, u automatically redirected to the Interface Builder.
then what ever u want to build the application window... then save the file, then return back to Xcode click the Build and go button. u can see, what u make the window as like..



Thats all... then we add the business logic and other programming stuffs to this project...

This is one of the best experience in my project life...

Saturday, August 18, 2007

JavaFX

This is my next Tech bitssssss..., The JavaFx is a scripting language. Can Create rich content applications for mobile, set-top, and desktop devices with JavaFX. The JavaFX Script™ (hereinafter referred to as JavaFX) language is a declarative and statically typed scripting language. It has first-class functions, declarative syntax, list-comprehensions, and incremental dependency-based evaluation. The JavaFX language makes intensive use of the Java2D Swing GUI components and allows for easy creation of graphical user interfaces or GUIs.

The Technical Details followed here.,

At A Glance
* The JavaFX product family leverages the Java platform's write-once-run-anywhere portability, application security model, ubiquitous distribution and enterprise connectivity
* JavaFX initially is comprised of JavaFX Script and JavaFX Mobile
* JavaFX Script is a highly productive scripting language for content developers to create rich media and interactive content
* JavaFX Mobile, Sun's software system for mobile devices, is available via OEM license to carriers, handset manufacturers and others seeking a branded relationship with consumers

The JavaFX product family delivers the ability to create interactive content, applications and services from the desktop to mobile devices to the living room.

Features
# avaFX Script uses a declarative syntax for specifying GUI components, so a developer's code closely matches the actual layout of the GUI
# Through declarative databinding and incremental evaluation, JavaFX Script enables developers to easily create and configure individual components by automatically synchronizing application data and GUI components
# JavaFX Script will work with all major IDEs, including NetBeans, which is the reference implementation IDE for Java development
# Unlike many other Java scripting languages, JavaFX Script is statically typed and will have most of the same code structuring, reuse, and encapsulation features that make it possible to create and maintain very large programs in Java
# JavaFX Script is capable of supporting GUIs of any size or complexity
# JavaFX Script makes it easier to use Swing, one of the best GUI development toolkits of its kind

Benefits
* Increases developer productivity
* Offers an intuitive language design
* Requires less code
* Enables faster development cycles
* Zero loss of functionality across devices

JavaFX Mobile - Overview
JavaFX Mobile is a complete, pre-integrated software system for advanced mobile devices designed to enable developers to author rich, high-impact content and network-based services. Built around open and standards-based technologies, JavaFX Mobile enables control and flexibility for the mobile ecosystem.

JavaFX Mobile Architecture Key Benefits
Device Manufacturers
Business Challenges


* More advanced architectures and increasingly complex functionality result in significant time dedicated to porting and integration rather than creating value-added services
* Getting to market quickly with new services and functionality is critical
* Need a platform that is sufficiently customizable and that can be leveraged across a wide range of devices

Advantages of JavaFX Mobile Software


* JavaFX Mobile is a complete and pre-integrated solution enabling device manufacturers to focus on developing new services
* Because JavaFX Mobile is built around standard Java APIs, porting costs will be reduced
* JavaFX Mobile will implement libraries, middleware, and applications in Java and rely on standardized APIs, so porting the software to new hardware and adding/replacing software components is much easier than it would be with proprietary components
* JavaFX Mobile will simplify and accelerate the development of highly customizable, richly branded and secure user interfaces across mobile feature phone handsets

Content Developers
Business Challenges


* The proliferation of devices in the mobile space has made it very costly to develop and deploy mobile applications and services
* Developers want to take advantage of the latest device capabilities, but not all software platforms enable the use of the latest functionality
* Developer tools that have been loosely coupled with the application platform can present a variety of development challenges and compatibility issues

Advantages of JavaFX Mobile Software


* With more than 1.8 billion handsets running Java, this software will enable developers to validate applications on almost any mobile device with little or no porting
* Developers can create content using the product's open, standard Java APIs, fully integrated with a complete mobile software system to provide more consistent application behavior and functionality
* Developers can freely leverage numerous tools available for Java, including the award-winning NetBeans IDE and the Sun Java Wireless Toolkit

Mobile Operators
Business Challenges


* Proliferation and fragmentation of mobile platforms has resulted in high operational costs and has increased the cost of deploying new content
* Compelling content and superior customer experience is necessary to fuel subscriber growth

Advantages of JavaFX Mobile Software

* JavaFX Mobile is highly portable, so it's easy to deploy applications and services in a consistent fashion across a wide range of devices, enabling faster time-to-market and improved customer experience
* JavaFX Mobile will improve consistency between handsets supplied into the operator's network, resulting in reduced validation, porting, and support costs.

System Requirements

Systems Requirements section of the NetBeans IDE 5.5 Release Notes or the NetBeans IDE 6.0 Preview (M10) Release Notes in order to run the IDE.
See More technical details, tutorials, examples,click here
another link

Friday, August 10, 2007

Why i Love Linux Very Much

What is Linux?
Linux is an operating system for your computer, in a similar way that Microsoft Windows and Apple's OSX are operating systems for your computer. Linux is very different however (and we believe, better!).

Linux was started in 1992 by then university student Linus Torvalds, who released his software for free, including all of the source code. Because Linus made his source code freely available, thousands of developers around the world have downloaded it, made changes and sent improvements back to him!

Because of this global collaboration effort, Linux is stable, extremely flexible and well supported. It is the fastest growing operating system in the world and it is freely available for you to install onto your computer! Sound great? It is!

Linux comes with thousands of free applications, which are maintained by thousands of volunteers around the world. These projects also release their source code, which means they too are 'open source'.

"But how can they do all this for free?" I hear you ask. The Linux and open source communities do all this for free because they love the software, not because they try to make money from it. They are doing it for prestige, honour and because they believe in open source ideals.

It is important to note that due to the nature of open source software (the ability to customise it however you like) there are many different version of Linux. This is great because you can find a version that suits you best! These different versions of Linux are called 'distributions'. This is because the creators of the various versions take Linux and make their own changes to it, add their own packages and then distribute it for free. It might sound complicated, but it's not. So don't worry, we'll help you get started on the right track!

We invite you to look further into Linux and welcome you to 'make the move' into an amazing new world.

There are many reasons why you might want to 'make the move' to Linux. Here are some of them:

Viruses and Spyware
Linux does not suffer from virus and spyware problems like Windows does. This is because of the secure way Linux was designed. Imagine not having to worry about getting a virus or opening that email attachment! Feel confident when using your computer.


Security and Stability

Linux is designed to be stable, safe and secure. Due to the nature of open source software, any security flaws are fixed very quickly. The world's best programmers and thousands of people contribute to the programs you would use everyday and this means you get the best software packages available which are continually being improved. In the much less frequent case of an application either misbehaving or crashing, Linux itself rarely fails completely. This results in your computer normally remaining active and usable. No more 'reboot and try again' syndrome! Often these situations can be resolved quite quickly using the tools available within Linux rather than purchased in addition to the operating system itself. You can access helpful log files and if you have the skills even the source code of the software, not to mention there's a great community of users willing to help! Using Linux puts you in control of your computer and you can rest knowing your system is safe, secure, and the software will always exist. Security updates are always available and you don't have to worry about issues like Microsoft no-longer supporting your version of Windows and having to pay for an upgrade (and probably a new computer!).

Package Management
You can search for and install software on your Linux computer in a single convenient application. No searching the internet for the files you need or fumbling through the latest CD you got in the mail, just hit the install button to watch Linux download the required files from the internet and install them for you. Not only this, but once you have your system and applications installed, Linux keeps track of all of the application updates automatically, regardless of whether you have used those applications before or even knew that they were installed! So whether it's a security update, a new version of OpenOffice.org, or even the core Linux system itself, it is all handled seamlessly and easily. And, most importantly, being open source you know you can trust the software that is being installed!

Features
Linux is often at the forefront of computer technology and innovation. It is not bound by the same pressures as commercial entities and people are free to be creative and innovative. Some examples of where Linux has already included features before Windows are: fancy 3D desktop effects with Xgl and beryl; TV and media centre with mythtv; desktop searching with beagle; desktop widgets with superkaramba; and many more. Plus, Linux is available for free right now!

Compatibility
Linux runs on anything. In fact it is the most widely supported operating system in the world! From brand new computers to old ones you were going to throw away there is always a Linux version for you. With Linux you can still browse websites all over the internet, watch movies, listen to your music, access your digital camera, use your scanner and much much more. You can also send emails and create documents that are compatible with Windows systems.

Free (as in freedom)
Linux is free open source software. This might not mean much to you if you are not a programmer but even if you are just an end user it means you can trust the software (see the section on 'What is FOSS?' for more information). Free open source software is also gaining popularity all over the world and is on the rise. Now is a good time to start learning a valuable new skill set.


Free (as in price)

You might think that your computer came with Windows for free, but you actually did pay for it (unless it's an illegal copy). Linux however, actually is free. Forget worrying about pirated software! From complete office suites to media programs and internet applications, the open source software that comes with Linux is not only fully featured, it doesn't cost a cent.

Easy and Intuitive
A single 20 minute install of Linux will set up all your software and all your hardware in one go! You don't need to waste time searching for driver disks and going through the frustration of installing all your software. Once your Linux system is installed you will find it is very simple and easy to use. Linux is continually being improved and made more intuitive because people have the freedom to make changes to the software. These are then made available for everyone else to benefit from.


Choice and Control

Linux also puts you in control by giving you choice. Choice about what software to run and how you run it. You don't have to worry about being stuck with one particular program or a set way of doing something. There are thousands of free computer programs available for you to install at the click of a button! Indeed you can even customise the interface to your liking, or choose one of the various Linux versions available that work differently out of the box. Linux is flexible and lets you create a system that works for you. Find or create something that suits you!

Community
Everyone using Linux does so because they chose to, not because they had to. People develop Linux because they have a passion for it, not because they do it for money or market share. This means things are done for the right reasons. Users are always willing to help others and Linux is a global collaboration effort. The Linux community is made up of people just like you and it's a great community to be a part of.


Fun!

Linux is also FUN to use. Imagine actually enjoying using your computer again! There's just something great about running Linux on your computer, even computer savvy people will be impressed!