How to print object attributes values with javascript?

Here is code snippet of Javascript to iterate through object and display as an alert:

<script language=”Javascript”>
var obj = new Object();
obj["firstName"]=”YourFirstName”;
obj["lastName"]=”YourLastName”;
var str=”";
for(prop in obj)
{
str+=prop + ” value :”+ obj[prop]+”\n”;
}
alert(str);
</script>

setup HTTP Authentication using htpasswd and htaccess

First create .htpasswd file for allowed users. You can create .htpasswd file using one of the following ways:

  1. By using command line
    htpasswd [-m | -d | -s | -p] /path/to/passwdfile/ <username>
    Above command will prompt for password. Given password will be assigned to <username>
    -m : Use MD5 encryption for passwords
    -d : Use crypt() encryption for passwords
    -s : Use SHA encryption for passwords
    -p: Use plaintext passwords
  2. By directly editing .htpasswd file
    open the file .htpasswd and add like username:password -> then save and close.
    This will store password in plaintext format.

Ref. URL: http://httpd.apache.org/docs/1.3/programs/htpasswd.html

Now Modify .htaccess which is placed into directory which you want to protect to refer htpasswd file as authenticated user.

Add the following in .htaccess file

AuthName “Restricted Area”
AuthType Basic
AuthUserFile /path/to/.htpasswd # full path to .htpasswd file
AuthGroupFile /dev/null
require valid-user

Now whenever anyone try to access directory or sub-directories in which .htaccess file is place then browser will prompt for HTTP Authentication Popup.

Please Note: Above will only work on Linux OS.

For more information please refer: http://mitulmpatel.wordpress.com/2009/11/20/htaccess-useful-tricks/

Post comment if you have any problem.

htaccess helpful links

Following are useful links to learn htaccess:

  • http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteCond
  • http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

How to change session.save_path?

There can be multiple ways to modify session.save_path.

  1. If you have root access or access to php.ini then modify
    [session]
    .
    .
    .
    save_path = “/path/to/session/storage/”
  2. You can modify .htaccess file
    php_value session.save_path “/path/to/session/storage/”
  3. by using PHP file
    ini_set(“session.save_path”,”/path/to/session/storage/”);

Please post if you have any problem or need any help.

 

HTACCESS useful tricks

Apache Configuration

  • Apache web servers have two main places for configuration information:
    • httpd Config files (httpd.conf)
    • Per-directory .htaccess files
  • Usually only the administrators of a server have access to the httpd config files. Individual users are able to place .htaccess files in their individual directories in order to override the options in the httpd config files.
  • .htaccess files are reread upon every hit within that directory.

Restricted access:

  1. Access for particular IP
    order deny,allow
    deny from all
    allow from 203.168.130.194 #ip
  2. Username/Password Protected

    AuthUserFile /path/to/htpasswd #FULL path to the password file
    AuthGroupFile /path/to/htgroup #FULL path to the htgroup file
    AuthName “Lee’s Secret Area” # This description will appear in the login screen
    AuthType Basic
    <Limit GET POST>
    require valid-user #for all allowed users defined in htpasswd
    require user cisco #for individual access
    require group managers  #for group access
    </Limit>

Build iGoogle-Like Personal Information Dashboards using Picok

Picok is an enterprise open source application useful to build iGoogle-Like personal information dashboards. The content is loaded into small portlets (small draggable boxes) and layed out in a tabbed 3-column interface. The maintainers of picok installations can create portlets of their own. The application collects information from external sources and displays them in a clear and readable design.

Features include:

  • Multi user application & Multi language
  • Extendible (the application can be extended with custom portlets and contents)
  • Administration Panel
  • Drag & Drop
  • Tabbed Interface
  • Portlet & Tab Management
  • Portlet auto refresh
  • Graded loading

Picok is written in PHP 5, uses the Yahoo User Interface Library and Zend Framework Components and supports MySQL, Microsoft SQL Server, IBM Lotus Notes and is ready to be integrated into your corporate intranet, website or community platform as well.

* Requirements: Okapi Framework, PHP 5.1.6+, MySQL
* Source: http://www.picok.org/
* Download: http://picok.org/get_picok/

Article Source from: http://www.bitrepository.com/picok.html

What is Web2.0? Difference between web1.0 and web2.0

Web 2.0 vs. Web 1.0 The tale of these two Webs is best told once we understand the meaning, importance and the differences between the following key words for each of the two versions of the web:
  • Communities
  • Content
  • Communication
  • Conversations

Pages: 1 2

How to install pear packages on WAMP/window?

Follow following steps to install any pear package on window using WAMP architecture:

  1. Go to command prompt using start->run->cmd
  2. Type “pear install <packagename>” (where<packagename> is the name of the package you want to install)

OR

  1. If the above one does not work, manually download the package from the website and go to that directory that contains the downloaded package.
  2. Type “pear install <packagename>” (where<packagename> is the name of the downloaded package)

Drop me comment if you have any problem.

migrate SVN Repositories to another server

Make sure you have enough rights to the existing repository:

First, dump the repository using svnadmin:

svnadmin dump /path/to/your-repository-name > your-repository-name.repo

Create your new repository (if you haven’t already):

svnadmin create your-new-repository-name

Then, load it into the new repository:

svnadmin load your-new-repository-name < your-repository-name.repo

Then, in your checked out code directory, change the repository location to point to the new location:

svn switch –relocate /path/to/old-repository /path/to/new-repository

What is Amazon S3?

Amazon S3 enables you to upload, download, and store data across the Internet. You can also use the
data with other AWS(Amazon WebService) services, such as EC2, Amazon Elastic MapReduce, and Amazon Import/Export.
With Amazon S3, you can charge people who download data you make available. You can store up to
5 GB of data in one object but you can store as many objects as you like on Amazon S3. The path to
the data is a URL, which makes accessing the data easy.

The following list describes the features of Amazon S3:

  1. Create Buckets—Create and name a bucket that stores data
    Buckets are the fundamental container in Amazon S3 for data storage.
  2. Store Data in the Bucket—Store an infinite amount of data in a bucket
    Upload as many objects as you like into an Amazon S3 bucket. Each object can contain up to 5 GB
    of data.
  3. Download Data—Download your data or enable others to
    Download your data any time you like or allow others to do the same.
  4. Permissions—Grant or deny access to others who want to upload or download data into your Amazon S3 bucket
    Grant upload and download permissions to three types of users.

Key concept of Amazon S3:

Objects
Objects are the fundamental entities stored in Amazon S3. Objects consist of object data and metadata
and can range in size from 1 byte to 5 gigabytes. The data portion is opaque to Amazon S3. The
metadata is a set of name-value pairs that describe the object. The developer can specify custom
metadata and standard HTTP metadata, such as Content-Type.

Buckets
You upload objects in buckets. There is no limit to the number of objects that you can store in a bucket.
The bucket provides a unique namespace for the management of objects contained in the bucket.
Because the namespace for bucket names is global, each developer can own up to 100 buckets at a
time.
You own each bucket you create. Amazon charge you for storing objects in your buckets and for
transferring objects in and out of your buckets.

Keys
A key is the unique identifier for an object within a bucket. In simple terms, the key is the bucket’s
name. Every object has exactly one key. Together, a bucket name and a key uniquely identify an
object in Amazon S3.You can access every object in Amazon S3 by a combination of the service
endpoint, bucket name, and key. For example, in http://doc.s3.amazonaws.com/2006-03-01/
AmazonS3.wsdl, “doc” is the bucket name and “2006-03-01/AmazonS3.wsdl” is the key.

Follow

Get every new post delivered to your Inbox.