Store Procedure example

December 18, 2009 by iampriya

CREATE PROCEDURE [dbo].[test_sp_add_user]
AS

DECLARE @UserPKID BIGINT

INSERT INTO test_user
(FirstName,LastName,Address1,Address2,
Country,EmailID,Password,Status)
VALUES
(@FirstName,@LastName,@Address1,@Address2,
@Country,@EmailID,@Password,@Status)

SET @UserPKID = @@identity
GO

(
@FirstName VARCHAR(255),
@LastName VARCHAR(255),
@Address1 VARCHAR(255),
@Address2 VARCHAR(255),
@Country VARCHAR(255),
@EmailID VARCHAR(255),
@Password VARCHAR(255),
@Status BIT
)

CREATE PROCEDURE [dbo].[test_sp_delete_user]
(
@MemberID nvarchar(1000)
)
AS
exec(‘DELETE FROM kjaya_user WHERE MemberID IN (‘ + @MemberID + ‘) ‘)
GO

CREATE PROCEDURE [dbo].[test_sp_update_user]
(
@MemberID BIGINT,
@FirstName VARCHAR(255),
@LastName VARCHAR(255),
@Address1 VARCHAR(255),
@Address2 VARCHAR(255),
@Country VARCHAR(255),
@EmailID VARCHAR(255),
@Password VARCHAR(255),
@Status BIT
)
AS
UPDATE test_user
SET
FirstName = @FirstName,
LastName = @LastName,
Address1 = @Address1,
Address2 = @Address2,
Country = @Country,
EmailID = @EmailID,
Password = @Password,
Status = @Status
WHERE MemberID = @MemberID
GO

Add the following code to the section to redirect the user to a custom page:

This setting goes in your web.config file. It affects the entire application, though… I don’t think you can set it per page.

“xxx” is in KB. The default is 4096 (= 4 MB).

Cursor

November 2, 2009 by iampriya

Cursors can be considers as result sets which allow a user to move through each record one by one.
Whenever we find some situation where we need to process each record individually we can use cursors.

In order to work with a cursor we need to perform some steps in the following order

1. Declare  cursor
2. Open cursor
3. Fetch row from the cursor
4. Process fetched row
5. Close cursor
6. Deallocate cursor

First of all we need to declare a cursor with the help of Declare statement and in
order to specify the result set contained by this cursor we use Select statement.
For example we can define a cursor named “MyCur” and we can use a table named Users
having two columns UserName, and Password.

Declare MyCur Cursor
For
Select * From Users

Open MyCur

Now, fetch first row from this cursor and loop through the cursor records until the specified criteria is found

Declare @UserName Varchar(50)

Declare @Password Varchar(50)

Fetch Next From Cursor Into @UserName, @Password

While @@Fetch_Status = 0

Begin

–Check if appropriate row was found then process it

–Othewise

–Fetch the next row as we did in the previous fetch  statement

End

When we have worked with the cursor, we’ll close it and deallocate it so that there will remain no reference to this cursor any more.

Close MyCur
Deallocate MyCur

Googl API

August 23, 2009 by iampriya

Google search API URL

http://code.google.com/apis/ajaxsearch/signup.html?url=http://localhost/GoogleAPI/&key=ABQIAAAAfFLlcMdJpi-GA8PmfutjlRRqMtI6TmfFpjE_nNUIeqypmSKrtRSpgusRxFNPdQYEKe8akLUsMtw9Yg

Search API Key

localhost key

ABQIAAAAfFLlcMdJpi-GA8PmfutjlRRqMtI6TmfFpjE_nNUIeqypmSKrtRSpgusRxFNPdQYEKe8akLUsMtw9Yg

WordPress Information

July 28, 2009 by iampriya

WP_MEMORY_LIMIT=>memory_limit=>32M

ABSPATH=>Root Path=>root/wp-load.php

WPINC =>/wp-includes=>root/wp-admin/gears-manifest.php

FUNCTION
is_home()=>root/wp-includes/query.php

post_class()=>root/wp-includes/post-template.php=>Set the class of the post title.
have_posts()=>root/wp-includes/query.php
the_post()=>root/wp-includes/query.php=>For the post FUnction
setup_postdata($post)=>root/wp-includes/query.php=>Just Fecth the content and set no of pages.
process_posts()=>root/wp-admin/import/mt.php

the_title()=>root/wp-includes/post-template.php=>Just echo the title
get_the_content()=>root/wp-includes/post-template.php=>Fetch The Content

the_content()=>root/wp-includes/post-template.php=>Just echo the COntent
get_the_title()=>root/wp-includes/post-template.php=>Fetch The title

the_category()=>root/wp-includes/category-template.php=>Just echo the COntent
get_the_title()=>root/wp-includes/post-template.php=>Fetch The title

get_template_directory_uri()=>root/wp-content/themes/default/
dynamic_sidebar()=>root/wp-includes/widgets.php=>True/False

ajax_calendar()=>root/wp-content/plugins/ajax-calendar2/models/calender.php

wp_widget_calendar()=>root/wp-includes/widgets.php=>For Fetching Calender
get_calendar()=>root/wp-includes/general-template.php=>For Fetching Record With Calender
get_calendar()=>root/wp-includes/general-template.php=>For Setting css to the date for a post.
wp_widget_pages()=>root/wp-includes/widgets.php=>For Fetching Pages
wp_widget_links()=>root/wp-includes/widgets.php=>For Fetching Links
wp_widget_meta()=>root/wp-includes/widgets.php=>For Fetching Meta Tags
wp_widget_search()=>root/wp-includes/widgets.php=>For Fetching Search Function
get_search_form()=>root/wp-includes/general-template.php=>For Fetching Search Form
wp_widget_recent_entries()=>root/wp-includes/widgets.php=>For Get Widget Recent Entries
wp_widget_tag_cloud()=>root/wp-includes/widgets.php=>For Get Tag Function
wp_widget_archives()=>root/wp-includes/widgets.php=>For Get Archive information

Customize Calender
ec3_get_calendar()=>root/wp-content/plugins/event-calendar/template-functions.php
ec3_get_calendar_nav()=>root/wp-content/plugins/event-calendar/template-functions.php

wp_widget_categories()=>root/wp-includes/widgets.php=>For Get Categories
wp_list_categories()=>root/wp-includes/category-template.php=>For Fetching all categories Categories
get_category_link()=>
walk_category_tree()=>root/wp-includes/category-template.php=>Just calling the function to go through the category.
walk()=>root/wp-includes/classes.php=>=>Go through the category
display_element=>root/wp-includes/classes.php=>Display the category element.

Customize Function
wp_list_customized_categories()=>root/wp-includes/category-template.php=>customized categories Categories
walk_customized_category_tree()=>root/wp-includes/category-template.php=>Just calling the function to go through the
walk_customize()=>root/wp-includes/classes.php=>Go through the category.
start_customized_el()=>root/wp-includes/classes.php=>Fetch element to display category.

For Calender
go_next()=>root/wp-content/plugins/event-calendar/ec3.js=>For ajax javascript function.
loadDates()=>root/wp-content/plugins/event-calendar/ec3.js=>For ajax javascript function.
process_xml()=>root/wp-content/plugins/event-calendar/ec3.js=>Ready state function is call.
ec3_Popup.add_tbody()=>root/wp-content/plugins/event-calendar/popup.js=>79 line.
ec3_filter_query_vars()=>root/wp-content/plugins/event-calendar/eventcalendar3.php=>For ajax process page.
ec3_filter_query_vars_xml=>root/wp-content/plugins/event-calendar/eventcalendar3.php=>For ajax process page.

wp_widget_text()=>root/wp-includes/widgets.php=>For Get widget Text
wp_widget_rss()=>root/wp-includes/widgets.php=>For Get widget RSS
wp_widget_recent_comments()=>root/wp-includes/widgets.php=>For Get Comment

M:\wp-content\themes\default\archive.php =>For displaying article from archive.
M:\wp-content\themes\default\archive.php =>For displaying article from Category.
M:\wp-content\themes\default\archive.php =>For displaying article from Calender.

For Customize Calender Template

To Change Calnder year month display=>Go to ec3.js Line Number 121.

Recent Post =>single.php
Blog Archive=>archive.php
Calender Archive=>archive.php
Category Archive=>archive.php

have_posts()=>The have_posts function checks to see if the current post number is less than the number of posts you choose to display in the Admin panel. The loop will then continue until the current post number reachers the maximum number of posts you have decided to show.

the_author()=>Retrieves the author’s name.
the_title()=> Displays the title of the current post.
the_content()=> Displays the contents of the post.
the_permalink()=> Displays the URL for the post in the form of a permalink.
the_ID()=>Displays the post ID.

Global variable authordata can be used in a function using this code:

global $authordata;
echo $authordata->display_name;

The authordata global can also access: nickname, last_name, first_name, ID, user_email, user_url, user_login, description, and several others.

Global variable post can be used in a function using this code:

global $post;
echo $post->post_title;

The post global can also access: ID, post_author, post_date, post_excerpt, comment_count, and several others.

How to change XAMPP server port?

July 28, 2009 by iampriya

We developer needs to use multiple web servers, all running at the same time. For example, an XAMPP server can be used to run the local server, while a JBoss server also needs to be up for testing a java web application or IIS server for .Net app. In such scenarios, if two or more servers are trying to use the same port number, then the late comer will fail to get the port.

XAMPP runs at the port 80, and IIS also use the port 80. So, you cannot run these two server at the same time. In order to avoid this issue, the XAMPP port can be modified to use a different number other the default 80.

Follow these steps to change the XAMPP server port number:

1. Stop the XAMPP server, if it is running already.
2. Open the file [XAMPP Installation Folder]/apache/conf/httpd.conf. As the names suggests, httpd.conf is the file which defines the properties of the Apache server, which the XAMPP is using.
3. Now search for the string Listen 80 (I’m assuming that your XAMPP was using the port 80. Otherwise, just search for the string Listen). This is the port number which XAMPP uses. Change this 80 to any other number which you prefer. (Sorry, you can’t use billion here, as only 65536 ports are supported by computers).
4. There is one more step to do. In the same file, search for the string ServerName. This options defines the server name of the XAMPP server, which includes the port number also. So, it is important to update this port number also.
5. Now save and re-start XAMPP server and you are done.

Regular Expression

July 11, 2009 by iampriya

Common Regular Expressions

Some common regular expressions are shown in Table 1.

Table 1. Common Regular Expressions

Field Expression Format Samples Description
Name ^[a-zA-Z''-'\s]{1,40}$ John Doe
O’Dell
Validates a name. Allows up to 40 uppercase and lowercase characters and a few special characters that are common to some names. You can modify this list.
Social Security Number ^\d{3}-\d{2}-\d{4}$ 111-11-1111 Validates the format, type, and length of the supplied input field. The input must consist of 3 numeric characters followed by a dash, then 2 numeric characters followed by a dash, and then 4 numeric characters.
Phone Number ^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$ (425) 555-0123
425-555-0123
425 555 0123
1-425-555-0123
Validates a U.S. phone number. It must consist of 3 numeric characters, optionally enclosed in parentheses, followed by a set of 3 numeric characters and then a set of 4 numeric characters.
E-mail ^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$ someone@example.com Validates an e-mail address.
URL ^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$ http://www.microsoft.com Validates a URL
ZIP Code ^(\d{5}-\d{4}|\d{5}|\d{9})$|^([a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d)$ 12345 Validates a U.S. ZIP Code. The code must consist of 5 or 9 numeric characters.
Password (?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,10})$   Validates a strong password. It must be between 8 and 10 characters, contain at least one digit and one alphabetic character, and must not contain special characters.
Non- negative integer ^\d+$ 0
986
Validates that the field contains an integer greater than zero.
Currency (non- negative) ^\d+(\.\d\d)?$ 1.00 Validates a positive currency amount. If there is a decimal point, it requires 2 numeric characters after the decimal point. For example, 3.00 is valid but 3.1 is not.
Currency (positive or negative) ^(-)?\d+(\.\d\d)?$ 1.20 Validates for a positive or negative currency amount. If there is a decimal point, it requires 2 numeric characters after the decimal point.

Joomla Problem

July 8, 2009 by iampriya

jfolder create could not create directory warning failed to move file.

SOlution:
First ensure the temp path is correct.
For windows the path should read :
c:\domains\domainname\wwwroot\tmp , it usually reads “/tmp”

To change the path go=>
Site -> Global Configuration -> Server
Then under Server Settings change the ” Path to Temp-folder”

Joomla Information

July 8, 2009 by iampriya

How to activate System – Legacy
Plugin Manager=>FInd Plugin name System – Legacy

How to Off Backoffice administrator header color.
GO to the path
root/crimsonacademy/administrator/templates/template Name/templateDetails.xml
And just hide the parameter panel.

How to create a menu and display at desire position?
1>First create the article from article manager
2>Create the menu from menu manager
3>create the menu item
4>Assign the article to the specific menu item.
5>Create the module and select the menu name from menu name collumn
6>Specify the postion.Activate legacy mode so as to your postion previledge
increase from user4=>user9.Use any one of the postion.
7>Open the page in a edition and stuck the module in a desire position.

COmponent SIte

http://www.topshareware.com/component-video-joomla-1.5.7/downloads/1.htm

Free template component site

http://www.siteground.com/joomla-hosting/joomla15-templates.htm

http://www.freehostia.com/free-design-themes/joomla/

http://joomlatp.com/joomla-1.5-templates/

Video Component

http://www.joomlaholic.com/index.php?option=com_docman&task=cat_view&gid=1&Itemid=2

Joomla Help

July 6, 2009 by iampriya

JPATH_BASE=>root/crimsonacademy
DS=>”/”=>Directory Seperator

JPATH_ROOT=>root/crimsonacademy
JPATH_SITE=>root/crimsonacademy
JPATH_CONFIGURATION=>root/crimsonacademy
JPATH_ADMINISTRATOR=>root/crimsonacademy/administrator
JPATH_XMLRPC=>root/crimsonacademy/xmlrpc
JPATH_LIBRARIES=>root/crimsonacademy/libraries
JPATH_PLUGINS=>root/crimsonacademy/plugins
JPATH_INSTALLATION=>root/crimsonacademy/installation
JPATH_THEMES=>root/crimsonacademy/templates
JPATH_CACHE=>root/crimsonacademy/cache

mod_mainmenu=>root/crimsonacademy/modules/mod_mainmenu/

getLayoutPath()=>root/crimsonacademy/libraries/joomla/application/module/helper.php

getLayoutPath()(Return path)=>root/crimsonacademy/modules/mod_footer/tmpl/default.php

For main menu item=>
modules/mod_mainmenu/helper.php

class modMainMenuHelper=>render()=>getXML()=>buildXML()=>
class JMenuTree=>_getItemData()=>addNode()=>_getLevelXML()=>
toXML()=>

For Leftnav
modChrome_rounded()=>root/crimsonacademy/templates/system/html/modules.php

For Login Form

Change register text=>
=>root/crimsonacademy/modules/mod_login/tmpl/default.php
=>Line Number=>66

For Login Content
root/crimsonacademy/Component/com_user/views/login/tmpl/default_login.php

FOr Forget Password
=>root/crimsonacademy/Component/com_user/views/reset/tmpl/default.php

JText CLass

=>root/crimsonacademy/libraries/joomla/method.php

For Inner COntent
root/crimsonacademy/Component/com_content/views/article/tmpl/default.php

Position Array
root/crimsonacademy/administrator/component/com_modules/modules/modules.php

Footer Menu Is comming
root/crimsonacademy/modules/mod_mainmenu/legacy.php=>mosShowHFMenu()=>Line Number 380

=>TOp COntent
= >Top Nav COntent
= > Search Content
= > Breadcam COntent
= >Message COntent SHowing at position top

Module related function are here=>
root/crimsonacademy/templates/system/html/modules.php

In the above syntax
=>type=”modules” means modules type.
=>style=”rounded” means this file called a function with name modChrome_rounded
=>name=”left” means this file will include at the left postion.

Note :If style is not specified then

Link

July 2, 2009 by iampriya

http://developer.amazonwebservices.com/connect/entry.jspa?externalID=773&categoryID=14

http://www.getafreelancer.com/

http://quickstarts.asp.net/Futures/Silverlight/media.aspx

http://www.sql-server-performance.com/articles/dev/triggers_2000_p3.aspx

Content management demonstrationhttp://php.opensourcecms.com/free/videos.php#zencart