Blogs

I always keep adding more topics & analysis related to technologies. Hope this will be time saver for at least someone :-) Internet helped me & I need to help internet!

useEffect is Executed in an endless loop react function component

Use of useEffect in React function component is common & frequent. Although useEffect is executed only once per render cycle, but you may have several state updates in your useEffect which cause a re-render. We always need to be careful & make sure we are not consuming too much memory. You can ideally put console.log() inside your useEffect() function and see how many times it is getting printed.

Secure your Drupal site using Apache config file

Using APACHE config file, always Make sure that your files directory is safe & nothing executable inside this. You can globally disable PHP execution from files directory with the help of few lines of code. You can see how we can disable all sites sitting at /var/www/ location and following the sites/*/files pattern for files directory. Drupal files directory normally follow specific pattern which can be used inside config file.

InderWeb dot Com

Inder Singh is a expert web developer and currently working on technologies like PHP drupal Ajax. He has developed more then 100 !!! of sites in last three years and still going on... Just keep watching his project list and wish it to reach soon at target of 10000 Successful & Live Projects !!!! :-) May be fun for you? - We belive in speed and quality

Mandi District

Mandi is known as the Choti Kashi ( a famous temple town of India) of Himachal Pradesh because of manby temples in this town and trust & faith of peoples living here.mandi district is soon becoming a famous tourist spot in himachal but lack still many facilities.

Facebook Stream.publish

This method publishes a post into the stream on the Wall of a friend or a Facebook Page, group, or event connected to the current session or specified user (but not to an application profile page). By default, this call publishes to the current session user's Wall, but if you specify a user ID, Facebook Page ID, group ID, or event ID as the target_id, then the post appears on the Wall of the target, and not the user posting the item. ==>target_id string The ID of the user, Page, group, or event where you are publishing the content.

Jquery Documentation

JQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. http://jquery.com/

Template Variables with preprocessor functions and customizations

In Drupal 6 the variable creation logic lives in the /includes/theme.inc file. The functions of note, located at the bottom of the file, are: * template_preprocess * template_preprocess_page * template_preprocess_node * template_preprocess_block These preprocessor functions can be used for altering variables in their areas. By browsing the function definitions you'll see how the variables are created.

Common method of adding and extracting modules and themes to your drupal installation

Place your custom or downloaded theme folders at:- sites/{sitename}/themes/{themename} folder e.g download acquia_marina theme from http://drupal.org/project/acquia_marina and place it at:- /sites/all/themes/acquia_marina configure it from After placing module folder in your modules directory you can see and configure it from http://localhost/admin/build/themes you can check new module and enable it from this above admin link. More Info:- http://drupal.org/node/120641

Custom sort By ON Fields Mysql

We can use field_functions from mysql for custom sort or Can use CASE, IF,ELSE functionalities in mysql. i.e: ORDER BY CASE WHEN `col` = 'item' THEN 1 WHEN `col` = 'thing' THEN 2 WHEN `col` = 'stuff' THEN 3 WHEN `col` = 'boom' THEN 4 ELSE 5 END Example:- 1) SELECT link_path,mlid FROM `rts1_menu_links` order by CASE WHEN link_path="photos/upload" THEN 1 ELSE 5 END,link_path DESC 2)select id from products where id in (4,5,6,7,8,9) order by field(id,4,7,6,5,9,8) SELECT id, start_date FROM iddt WHERE id IN ('109k7','s3x6','sxmns','wt57') ORDER BY FIELD(id,'109k7','s3x6','sxmns','wt57')

Basic HELPful Modules list for Drupal 6

My Most frequently used module list is below :-) Image Modules:- http://drupal.org/project/image http://drupal.org/project/imageapi http://drupal.org/project/imagecache HTML Mailing:- http://drupal.org/project/mimemail Admin Functions:- http://drupal.org/project/admin_menu Site Navigations:- http://drupal.org/project/nice_menus Editing Page With HTML :- http://drupal.org/project/wysiwyg http://drupal.org/project/ckeditor CCK Helpers:- Video Audio And image files:- http://drupal.org/project/filefield http://drupal.org/project/imagefield http://drupal.org/project/emfield User Profile , reg

Introduction & Installation of Pear And Soap

Before you install PEAR, we recommend you understand what PEAR is and why you should install it. The base installation that comes with the PHP distribution contains all the stuff that is needed to run the PEAR installation tools etc. If you have a recent installation of PHP, you can relax: The PEAR base installation is already there - unless you have compiled your PHP with the ./configure flag --without-pear. The packages that do not come with PHP can be installed with the PEAR package manager.

GetQuery netForumXML xweb operations Avectra

GetQuery Provides a means of retrieving single or multiple data records and returns either the specific columns (pruning the number of elements is governed by how the netforum facade object was constructed, for example, the one-to-many relationships cannot be rendered in a flat-view - in these cases, no value will be returned for the impacted elements) or the complete Facade object record (returning all the fields associated with a netForum Facade object can be done by passing a "*" as the sole value for the szColumnList value). SOAP 1.1 The following is a sample SOAP 1.1 request and respons

Downloading and extracting themes using shell or putty in linux

You can directly download themes from your ssh or putty. 1) Go to themes directory of your drupal installation. E.g:- cd sites/all/themes 2). Download archive using wget command: wget http://ftp.drupal.org/files/projects/acquia_marina-6.x-2.0.tar.gz 3). Uncompress archive: tar zxvf acquia_marina-6.x-2.0.tar.gz 4).

Enabling / downloading modules and themes using shell or putty in linux

You can directly download module or theme from your ssh or putty. 1) Go to modules directory of your drupal installation. E.g:- cd sites/all/modules 2). Download archive using wget command: wget http://ftp.drupal.org/files/projects/image-6.x-1.0-beta5.tar.gz 3). Uncompress archive: tar zxvf image-6.x-1.0-beta5.tar.gz 4).

How to Add Modules To Drupal installations

Adding Modules To Drupal installations:- Extract the code to to your /sites/{sitename}/modules/{modulename} or at your localhost at: /sites/all/modules/{modulename} e.g download Image module from http://drupal.org/project/image and place it in modules folder /sites/all/modules/image After placing module folder in your modules directory you can see and configure it from http://localhost/admin/build/modules you can check new module and enable it from this above admin link. More Info:- http://drupal.org/node/120641 Module List for Drupal 6:- http://drupal.org/node/206666#DRUPAL-6

Code Filter drupal syntax highlighting and filter parsor module

This is a simple helpful filter module if you want to post colored and formated text in body. It handles &ltcode&gt&lt/code&gt and &lt?php ?&gt tags so that users can post code without having to worry about escaping with < and > Project Link page:- http://drupal.org/project/codefilter Related modules/alternatives * Code filter: a simple module with support for PHP syntax highlighting * Syntax Highlighter uses a Javascript library to add syntax highlighting client side (unlike GeSHi filter, which renders the highlighted code server side). * Chili

Customizing the drupal user registration form

--updated added code also-- you can define template for your form in template.php
/**
* @desc ex
*/
function inderin_theme() {
      $themes= array(       
             'user_register' => array(
              'template' => 'user-register',
              'arguments' => array('form' => NULL)
            ),
      );
      return $themes;

Model-view-controller (MVC) architecture is optional / MVC in Drupal

Model-view-controller (MVC) architecture is optional in Drupal. MVC is accomplished by generating data in modules then theming the data in your theme.
Some modules format the data before output, which is not MVC.

Some modules format the output and provide documentation in how to reformat the data in your theme, which is MVO, Model-view-optional.

XWeb:GetQuery sample6 Avectra netFORUM

This is how we can use xweb request and reponse.XWeb:GetQuery sample6 Avectra netFORUM

Request

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header>
<m:AuthorizationToken xmlns:m="http://www.avectra.com/2005/">
<m:Token>04062038-9ee6-4f26-b5a0-443bf9ad21f4</m:Token>
</m:AuthorizationToken>

Detect Flash enabled in IE and firefox

<head>
<script>var hasFlash = false;
try {
  var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
  if(fo) hasFlash = true;
}catch(e){
  if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) hasFlash = true;
}
if(!hasFlash)window.location="/static-content.html";
</script>

Parallel Payments and Chained Payments Paypal Adaptive Payments

A parallel payment is a payment from a sender that is split directly among 2 to 6 receivers. Technically, a parallel payment is a set of multiple payments made in a single Pay request. Parallel payments are useful in cases when a buyer intends to make a single payment for items from multiple sellers.

Installing and Upgrading Drupal and Modules and themes from the Linux Shell Command Line

Getting started with Drupal install on the command line:

In a Web browser (firefox), go to http://drupal.org/ and copy the latest drupal version folder location which you want to install. Just right click on download Link and copy to clipboard.

Go to www or public_html or your installation folder usign ssh.

Use Wget command to download drupal from site.
    $ wget <paste link here>

$tar -xzf drupal-6.19.tar.gz

how to Install a module or theme on the Linux shell command line

   1)Copy the module download link. Normaly ending with .gz.  In a Web browser, go to the module's page at drupal.org , right-click the Download link for the version you want, and copy the link location.
   2) In an SSH goto module folder of drupal
      cd www/sites/all/modules
      i.e to go to your modules directory. For themes go in www/sites/all/themes in same way.
   3) Usage wget command to download module or theme compressed version from drupal site.
    
      Such as for downloading theme I can simple use from theme folder:-

Create And Extract tar Archive from SSH Linux Drupal

Script and steps can be  used for BUllk Database and directory transfer from one host to another. NOrmaly used for Site transfer.

Create Directory Archive:

CReate archive of current directory to sitesbk.tar file:

$tar cvf /home/indersingh/public_html/sitesbk.tar .

Extract Tar file to directory:

$tar  xvf sitesbk.tar /var/www/html/

Create Dump using mysqldump command.Mysql Dump The database:-

$ mysqldump -u inders_himsky -p  inders_himskydb6 >himskybkp-sql.sql

Import The database using Mysql command:-

Drupal Site As Web Application for Clients XMLprc and SOAP ,Services module

Drupal user keep been developing a system which allows a Drupal website to act as an authentication server and allow client websites to be connected to it. Once you register an account on one of the websites in the network you can use those credentials to gain access to any other website there. There are a lot of other functions such as login, authenticate,file posting,node content posting, comment posting and a lot. A lot of drupal techniques exist for implementing these thing. I will introduce them in my blog.

1)xmlrpc

Flash And Drupal With XML-PRC (Communicating from Flash Actionscript to Drupal)

Dealing with Flash And Drupal With XMLprc. You firstly need to turn on the server and "node" service for the service module, and turn off api key, sid, etc, grant permissions, in the service settings. You need to install XML-PRC client of flash which can be downloaded from:- http://sourceforge.net/projects/xmlrpcflash XML-RPC Client for ActionScript and following xml methods can be easily used:
- node.load
- node.save

Yahoo Local Search Web Services

Local Search Web Services // Submitting Local Queries The latest version of the Local Search Web Service allows you to search the Internet for businesses near a specified location, and now returns both the latitude and longitude and Yahoo! user ratings of the establishment, as well as search by business categories. Request URL http://local.yahooapis.com/LocalSearchService/V3/localSearch More at: http://developer.yahoo.com/search/local/V3/localSearch.html

Paypal SDKs and Downloads

SDKs and Downloads Simplify Integrations with Downloads and SDKs Get a head start on your PayPal integrations with our software development kits (SDKs). They mask integration complexities with client libraries that let you program to "wrapper" library APIs.

Paypal Developer API Error Messages and code return

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_errorcodes Table 1. General API Errors Error Code Short Message Long Message Correcting This Error 10002 Authentication/Authorization Failed Username/Password is incorrect This error can be caused by an incorrect API username, an incorrect API password, or an invalid API signature. Make sure that all three of these values are correct.

x_type AUTH_CAPTURE,AUTH_ONLY authorizenet

AUTH_CAPTURE
Transactions of this type will be sent for authorization. The transaction will be automatically picked up for settlement if approved. This is the default transaction type in the gateway. If no type is indicated when submitting transactions to the gateway, the gateway will assume that the transaction is of the type AUTH_CAPTURE.

AUTH_ONLY

Extract Sql.gz and tar.gz file Drupal and Linux

If you want to decompress / extract an sql archive generated from phpmyadmin you can do it easily:-
gunzip myolddrupaldb.sql.gz
Also you can use tar command for extracting drupal archive in gz. format. e.g a file like drupal-6.15.tar.gz tar -zxvf Drupal-6.15.tar.gz

Authenticate operations SOAP netForumXML OnDemand avectra

Passing correct credentials to Authenticate method will return an authentication token - without an authentication token, the rest of the xWeb web methods will be inoperable. The authentication token is governed by the group privileges assigned to the account invoking the xWeb web methods. Please consult with the administrator of the netForum database to ensure your level of authorization. Test The test form is only available for requests from the local machine. SOAP 1.1 The following is a sample SOAP 1.1 request and response.

Avectra Xml SOAP Web Service supported operations

Avectra Xml Web Services with Authentication Token release: http://www.avectra.com/2005/ - For additional information or for questions concerning xWeb please navigate to netForum xWeb Online help at http://wiki.avectra.com/index.php?title=XWeb. Please note: all xWeb message exchanges are recommended to occur over SSL. The following operations are supported. For a formal definition, please review the Service Description.

xWebSecureClient Class SOAP Awetra

xWebSecureClient Class - an extension of the php SoapClient class to provide for seamless sliding token based authentication with Avectra's netFORUM. xWeb documentation is provided with your system.Licensed under the BSD license, a copy of which should have been included with this file. If you are not familiar with the BSD license please take a moment to read it - it is short!

PHP imap POP3 protocol function Implementation In Scripts Example list mailbox

IMAP functions enable you to operate with the IMAP protocol, as well as the NNTP, POP3 and local mailbox access methods. Be warned, however, that some IMAP functions will not work correctly with the POP protocol. Make sure your PHP is enabled with imap via the phpinfo() function
<?php
'--with-imap-dir=/opt/lampp' '--with-imap-ssl' '--with-imap=/opt/lampp'

Linux VI CHEET Sheet - Cheat Sheet for the VI editor

This document is a vi cheat sheet, designed to be kept nearby while using the vi editor. In general, vi commands follow the convention of "one from column A and one from column B", using the two tables below, Operators and Operands, as columns A and B.

Drupal Email Server Cpanel Accounts Useful Module List

http://drupal.org/project/cpanel_api Includes admin interface for setting cPanel user and pass, SSL and port.Currently provides functions for: Mail - add, delete, edit pass, edit quota FTP - add, delete, edit pass, edit quota MailMan - add list, delete list, edit pass http://drupal.org/project/webmail_plus Webmail Plus is a full-featured email client for Drupal.

Theme a CCK and content typeusing your custom theme Drupal 6

Spending several days for me to find out how to theming Input Form in CCK2 on Drupal 6, hope this can help you and save your time.

To theming CCK2 Input you just need:

  1. Edit template.php
  2. Create node-content_type-edit.tpl.php
  3. Clear Cache Data before view your result: Administer-Site Building-Performance: Clear Cache Data

EXAMPLE

Suppose your content-type is: "account_registration" and you theme is "bluemarine"

Creating Drupal Script for inserting / importing data from external sources

Migrating to Drupal can seem intimidating if you already maintain a database-driven website.When interacting with Drupal, it's a good idea to do things the Drupal way. Fortunately, Drupal core allows you to bootstrap Drupal and use all of its API functionality outside of a normal Drupal instance. For yours truly, learning about this has been a godsend because it provides a fast, simple way to migrate data When writing an import script, you will need to bootstrap Drupal to use the API functions.

Mysql Sorting Field function ,Number And character fields Mysql

For sorting in ascending order numbers which are written in text or characters:- mysql> select number from (table) order by number; +--------+ | number | +--------+ | 1 | | 10 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | +--------+ Use this: mysql> select number from (tablename) order by (number+0); +--------+ | number | +--------+ | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | | 10 | +--------+ The (field + 0 ) converts the text/character in t

Remove Delete All .svn files and directories from Drupal INstallation

Want to bulk delete .svn folders recursively? Warning: Before you use this command make sure you have changed to the correct directory where you want to apply this. example: Lets say you want to delete all .svn files from drupal folder "inderweb"
cd htdocs/inderweb


find -name "\.svn" -exec rm -rf {} \;
rm -rf `find . -type d -name .svn`
Bash Script for Removing All .zvn folder/directories:-
#!/bin/sh
echo "recursively removing .svn folders from"

General guidelines JavaScript and Ajax Jquery with Drupal

A few general guidelines for JavaScript and Ajax Jquery with Drupal: 1)Do not rely on JavaScript for validation; users can disable JavaScript. 2)Do not assume that data sent to AJAX postback functions is sent by your JavaScript function. 3)Do not assume that data sent to or by a JavaScript function cannot be observed by the user. 4)Beware that certain DOM functions decode HTML entities. Do not reinsert those into a page without escaping.

Setting UP roundcube webmail Integration interface for emails in drupal And PHP

We can check our email accounts remotely using PHP and its imap functions, which allow us to communicate with mail servers via IMAP, POP3 or NNTP protocols. You can build a PHP mail scriptof your own that will accept an email account, password and optional IMAP port number. In drupal you have few modules available for 5X versions which you can us for integrating email clients with drupal site. Here I will List and discuss most of them. Roundcube Roundcube is a browser-based multilingual IMAP client with an application-like user interface.