Monday, August 31, 2009

ORA-06502: PL/SQL: numeric or value error: character string buffer too small

This is a common error faced by many of us and some times it takes hours to find what went wrong.

The reason it happens is

1) The size of the Varchar2 parameter, the maximum allowed size of the Varchar2 datatype is 4000, if the input string exceeds that number you will get this error.

2) Or you have defind your parameter of size 10 and trying to write 12 characters.

Workaround - For first reason, there is no way out you can use the Varchar2 datatype, better use CLOB objects.

For second, try to increase the size of the parameter.

Hope this helps.

Thanks
-Azhar

Monday, August 3, 2009

PL SQL query to create a search query.

Hi,

Often we search for a particular value in the user tables of a database, for each table we have to change the query, if not the column name, at least the table name. The good new is, we can avoid doing that. We can write a query which will create a search query as its result records each for a user table in the database.

select 'select * from '||table_name||'
where upper (to_char(&in_column)) = upper (to_char('||'''&in_value'''||'));'
from user_tab_columns
where column_name = upper ('&in_column');


Run tha above query in PL SQL and see the magic.

Hope that helps you.

Thanks..

Thursday, July 30, 2009

Website structure does matter.

When you have decided to create a website for your business or say you are a developer and designing a website for your customer, you should always keep in mind that the Web site structure should not be complicated. A website should be well-organized, a well-organized website is one which is easy to understand, navigate and find easily what the visitor is looking for.

The intensionof the article is to make you understand the level of leaves/pages of the website should reside in. A good well organized website makes it easy for you to grow your site logically.

The page (which has the content) of your website must not be more than two level in the depth, that is the required page should not take more than two clicks from the home page. This is very important with regards to Search Engines.

A typical website structure could be as in the picture below.



Tier 1 – The home page

Tier 2 – The team sites/folders/sub sites

Tier 3 – The leaves/pages with contents

References

website structure

website structure

website structure

Hope this helps.

Wednesday, July 29, 2009

Experts have listed Top 25 dangerous errors in the programming world.

click here for Top 25 Errors

SQL Reporting on Microsoft Sharepoint.

Guys, the listed links are very helpful in reporting on sharepoint lists. Reporting on sharepoint list is not that simple as you do with any of the database. It requires specialized skills and creativity. If you can think then you may discover a new method as well.

Click here

Here

and here


You can do query the data from two different lists like you do with tables but then you need a third party tool like Enyses RS Extension.

Hope this helps!!

How to pull Active Directory Users and populate into a drop down.

Sometimes it is very hard to get it done, use this code to pull all the users from your active directory.


private void populateUsers()
{
ddlUsers.Items.Clear();

using (HostingEnvironment.Impersonate()) // To break the security for some time
{
DirectoryEntry entry = new DirectoryEntry("your AD server name");
DirectorySearcher searcher = new DirectorySearcher(entry);
try
{

searcher.Filter = " (&(objectClass=user)(objectCategory=person)(DN=*) "; //DN is the distinguished name of the AD user

foreach (SearchResult sResultSet in searcher.FindAll())
{
ListItem item = new ListItem();

item.Text = GetProperty(sResultSet, "givenName") + SPACE + GetProperty(sResultSet, "sn"); // sn - Surname
item.Value = "your domain" + GetProperty(sResultSet, "sAMAccountName"); // sAMAccountName - login name

ddlUsers.Items.Add(item);
}

ddlUsers.Items.Insert(0, "Select User");
}
catch (Exception ex)
{
throw new AppException(ex);
}
}
}
public static string GetProperty(SearchResult searchResult, string PropertyName)
{
if (searchResult.Properties.Contains(PropertyName))
{
return searchResult.Properties[PropertyName][0].ToString();
}
else
{
return string.Empty;
}
}

Hope this helps!!

Tuesday, July 28, 2009

Custom webpart development using ASP .NET.

There are many references found on the web for custom webpart development, some of which I am adding here, if you want any specific functinality then let me know.

http://www.codeguru.com/csharp/.net/net_asp/webforms/article.php/c12293/

http://www.datasprings.com/Resources/ArticlesInformation/Sharepoint2007CustomWebParts/tabid/775/language/en-US/Default.aspx

http://msdn.microsoft.com/en-us/library/ms452873.aspx

Hope this helps!!

Thanks.