JFolder-folder-Path-is-not-a-folder

December 29, 2011 Leave a comment

Hello Friends,

Today, one of my colleges getting an error in Joomla admin – “JFolder::folder: Path is not a folder“ . We’ve tried lots of thing but cannot resolve, finally we’ve found the below solution.

Please remove the cache from cache folder or make a new cache folder.

Thanks.

Categories: Uncategorized

Remove duplicate rows from a table in SQL Server

May 12, 2011 Leave a comment

Hello Friends,

I have tried to remove the duplicate rows from the table using row_number function. Here I am explaining the demo using the temp table.

Steps:

1. Create Temp Table or Select your table

Create Table #Main

(

id int,

item varchar(100)

)

2. Insert some records

insert into #main values (119,1)

insert into #main values (119,2)

insert into #main values (119,2)

insert into #main values (119,3)

insert into #main values (119,3)

insert into #main values (119,4)

insert into #main values (119,5)

insert into #main values (119,6)

insert into #main values (119,7)

insert into #main values (119,8)

insert into #main values (119,8)

insert into #main values (119,8)

3. expected Output

–Output

–119 1

–119 2

–119 3

–119 4

–119 5

–119 6

–119 7

–119 8

4. first we have start to get single records

–we got those record which count =1

select id,item from

(

select *,

(select count(item) as NoOfCount from #Main where item =Mst.Item group by id,item) as NCount

from #Main Mst

)a

where NCount =1

5. Result 1

–Result

–119  1

–119  4

–119  5

–119  6

–119  7

6. Now find the records where item count is >1

–we got those record which count >1

select id,item from

(

select id,item,ROW_NUMBER()Over(Partition by Item Order by Item) As Rep

from

(

select *,

(select count(item) as NoOfCount from #Main where item =Mst.Item group by id,item) as NCount

from #Main Mst

)a where NCount>1

)RepT where rep=1

7. Result 2

–Result

–119  2

–119  3

–119  8

8. Result 1 Union Result 2

9. Output

–Result

–119  1

–119  4

–119  5

–119  6

–119  7

–119  2

–119  3

–119  8

Thanks,

Http://www.ibusiness-management.com

Outlook blocked access to the following potentially unsafe attachments

May 11, 2011 Leave a comment

Hello Friends,

I have come across the problem when I getting the .chm extension in my mail.

I have found the solution which is below.

Steps:

  1. Exit Outlook if it is running.
  1. Click Start, and then click Run. Copy and paste (or type) the following command in the Open box, and then press ENTER:

              regedit

  1. Verify that the following registry key for your version of Outlook exists.
    Microsoft Office Outlook 2010

HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security

             Microsoft Office Outlook 2007

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security

             Microsoft Office Outlook 2003

             HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Security

             Microsoft Outlook 2002

             HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Security

             Microsoft Outlook 2000

             HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Security

             If the registry key exists, go to step 5.

             If the registry key does not exist, follow these steps to create it:

    1. Locate, and then click the following registry key:

HKEY_CURRENT_USER\Software\Microsoft

    1. Under Edit, click New, and then click Key.
    2. Type Office, and then press ENTER.
    3. Under Edit, click New, and then click Key.
    4. For Outlook 2010, type 14.0, and then press ENTER.
      For Outlook 2007, type 12.0, and then press ENTER.
      For Outlook 2003, type 11.0, and then press ENTER.
      For Outlook 2002, type 10.0, and then press ENTER.
      For Outlook 2000, type 9.0, and then press ENTER.
    5. Under Edit, click New, and then click Key.
    6. Type Outlook, and then press ENTER.
    7. Under Edit, click New, and then click Key.
    8. Type Security, and then press ENTER.
  1. Under Edit, click New, and then click String Value.
  1. Copy and paste (or type) the following name for the new value:

Level1Remove

  1. Press ENTER.
  1. Right-click the new string value name, and then click Modify.
  1. Type the file name extension of the file type that you want to open in Outlook. For example:

.exe

To specify multiple file types, use the following format:

.exe;.chm

  1. Click OK.
  1. Exit Registry Editor.
  1. Restart your computer.

Thanks.

http://www.ibusiness-management.com

Reference Site:

http://support.microsoft.com/kb/829982

Categories: Uncategorized

export select query result in to pipe delimiter Textfile

April 2, 2010 Leave a comment

Hello Friends,

I have a table that I need to export to a pipe delimited .txt file.please follow the below step to do that things.

Steps 1: [http://amitpatriwala.wordpress.com/2010/04/02/save-select-query-result-into-textfile/]

Enabled the xp_cmdshell

By default disabled in SQL 2005 for security reasons.

To enable it, use the Surface Area Configuration tool or sp_configure

To enable xp_cmdshell using sp_configure, use below query :

EXEC master.dbo.sp_configure ‘show advanced options’, 1

RECONFIGURE

EXEC master.dbo.sp_configure ‘xp_cmdshell’, 1

RECONFIGURE

Steps 2:

EXEC master..xp_cmdshell ‘bcp “select * from Adbrite..Adtype” queryout “c:\text.txt” -U sa -P sa123-c -t^| -x’

Database Name : Adbrite

Table Name : Adtype

Sql User Name : sa

Sql Password : sa123

delimiter option : t^|

thnx


http://www.ibusiness-management.com/

Save Select query result into Textfile

April 2, 2010 2 comments

Here I am explaining how to export query results into text file. Please follow below steps to archive this thing.

Step 1:

Enabled the xp_cmdshell

By default disabled in SQL 2005 for security reasons.

To enable it, use the Surface Area Configuration tool or sp_configure

To enable xp_cmdshell using sp_configure, use below query :

EXEC master.dbo.sp_configure ‘show advanced options’, 1

RECONFIGURE

EXEC master.dbo.sp_configure ‘xp_cmdshell’, 1

RECONFIGURE

Step2:

To save your SELECT query results to a text file, use below query :

EXEC master..xp_cmdshell ‘bcp “select * from adtype.dbo.adbrite” queryout “c:\text.txt” -c -T -x’

or

EXEC master..xp_cmdshell ‘bcp “select * from Adbrite..Adtype” queryout “c:\text.txt” -U sa -P sa123-c -T -x’

Database Name : Adbrite

Table Name : Adtype

Database User Name : sa

Database Password : sa123

Thnx

http://www.ibusiness-management.com/

Database configuration Error on drupal

January 29, 2010 1 comment

Hello,

I have confused when I entering the right database credentials into the page but page is reload and shows the Database configuration again, without any error.
I have start the search and finding that during the installation if you renamed the /sites/default/default.settings.php

to  /sites/default/settings.php.

Solutions:

Copy the Settings File and rename it to default.settings.php.

Thnx

http://www.ibusiness-management.com/

Deprecated: Function ereg() is deprecated in C:\wamp\www\drupal-6.14\includes\file.inc on line 902

January 29, 2010 9 comments

Hello,

This message appear because I use latest wamp software that utilize php 5.3.0 where ereg() function is deprecated.

Solutions:

step 1: Goto Folder Drupal\includes

step 2: Select File “file.inc”

step 3:

Goto 902 Line

elseif ($depth >= $min_depth && ereg($mask, $file)) {

Change the function ereg to mb_ereg

elseif ($depth >= $min_depth && mb_ereg($mask, $file)) {

Thnx

HierarchyId Data Type

October 23, 2009 Leave a comment

Here I Explained the New Data Type in Sqlserver 2008.

What is HierarchIyd Data Type? 

HierarchyId data type is a variable length System Data Type.

What is the use of HierarchyId Data Type?

Represent position in a hierarchy manner.

HierarchyId does not automatically represent a tree, it is depend on how to application generate and assign HierarchyId values.

HierarchyId have following properties:

1) Extremely Compact

2) Comparison is in depth-first-order.

3) Support for arbitrary insertions and deletions.

Limitation Of HierarchyId :

1)  Does not automatically represent a Tree

2) It is up to Application to manage concurrency in generating and assigning HierarchyId Values.

3) There is no any dependency on HierarchyId relationship.

 

See more about HierarchyId example refer :

http://amitpatriwala.wordpress.com/2009/10/23/sql-server-2008-feature-part1/

Reference Site :

http://technet.microsoft.com/en-us/library/bb677290.aspx

Sql Server 2008 Feature – Part1

October 23, 2009 Leave a comment

Here I am explaining Sql Server 2008 Key Features.

1) Initializing variable when you declare

declare @val as int =0
declare @currentdate as datetime = getdate
()
print @val
print @currentdate

2) Compound assignment operators

–operator like +=,-=,/=,*/,%=
declare @val as int = 0
set @val += 10
;
print @val

3) Add multiple row in single Insert Statement

CREATE TABLE Employee
(
EmpId int,
EmpCode varchar(50),
EmpName varchar(50)
);

INSERT INTO Employee(EmpId, EmpCode,EmpName)
  VALUES
  (1, 'emp1','emp1'),
  (2, 'emp1','emp1'),
  (3, 'emp1','emp1');

select * from Employee
4) New Data Types
Data Type Data Type Use
Date The Date property returns a Date data type.
Time Returns values for any valid time of day between 00:00:00 and 23:59:59:9999999. It has a length of at least 8 positions and contains the time in hours,minutes, seconds and fractional seconds.
DateTime2 DateTime2 is an extension of the existing DATETIME type. It has a large date range and large default fractional precision. It has a length of at least 19 positions.
DateTimeOffSet Returns values for year, month, day, valid time of day between 00:00:00 and 23:59:59:9999999 and offset, in hours, from UTC. It has a length of at least 25 positions.
Hierarchyid The HierarchyId property is used to identify a position in a hierarchy.
Geography The SQL Server geography data type stores ellipsoidal (round-earth) data, such as GPS latitude and longitude coordinates
Geometry The Geometry property contains spatial data that represents information about the physical location and shape of geometric objects.
HierarchyId Data Type
   1: --Create Table Employee

   2: CREATE TABLE Employee

   3: (

   4: EmpId int,

   5: EmpBossId HIERARCHYID,

   6: --GetLevel --> returns the level of the current node in the hierarchy

   7: EmpLevel as EmpBossId.GetLevel() PERSISTED,

   8: EmpCode varchar(50),

   9: EmpName varchar(50)

  10: );

  11: Go

  12: -- Create Insert Store Procedure

  13: Alter PROCEDURE Employee_isp

  14:     @empid int,

  15:     @empbossid int,

  16:     @empcode varchar(50),

  17:     @empname varchar(50)

  18: AS

  19: BEGIN

  20: declare @hid HIERARCHYID,@empboss_hid HIERARCHYID,@last_hid HIERARCHYID

  21:  

  22: if @empbossid = 0 

  23: begin

  24:     set @hid = HIERARCHYID::GetRoot();

  25: end 

  26: else 

  27: begin

  28:   

  29:   SET @empboss_hid = (SELECT EmpBossId FROM Employee  WHERE empid = @empbossid);

  30:   SET @last_hid = (SELECT MAX(EmpBossId) FROM Employee WHERE EmpBossId.GetAncestor(1)= @empboss_hid);

  31:   SET @hid = @empboss_hid.GetDescendant(@last_hid, NULL);

  32: end

  33: INSERT INTO Employee(empid, EmpBossId, EmpCode, EmpName)

  34:             VALUES(@empid, @hid, @empcode, @empname);

  35: END

  36: GO

  37: --insert data

  38: --                     A1

  39: --                AL1           AR1

  40: --           AL1L     AL1R  AR1L   AR1R  

  41: --

  42: --

  43: EXEC Employee_isp @empid =  1, @empbossid = 0, @empcode = 'A1' ,@empname = 'A1';

  44: EXEC Employee_isp @empid =  2, @empbossid = 1, @empcode = 'AL1' ,@empname = 'AL1';

  45: EXEC Employee_isp @empid =  3, @empbossid = 1, @empcode = 'AR1' ,@empname = 'AR1';

  46: EXEC Employee_isp @empid =  4, @empbossid = 2, @empcode = 'AL1L' ,@empname = 'AL1L';

  47: EXEC Employee_isp @empid =  5, @empbossid = 2, @empcode = 'AL1R' ,@empname = 'AL1R';

  48: EXEC Employee_isp @empid =  6, @empbossid = 3, @empcode = 'AR1L' ,@empname = 'AR1L';

  49: EXEC Employee_isp @empid =  7, @empbossid = 3, @empcode = 'AR1R' ,@empname = 'AR1R';

Inserted Data Into Table 
HIERARCHYID 
Different Selection Criteria :
1) Find Employee As Per their Level means Grade 
   select * from Employee where Emplevel = 2
2) Get Child Node 
   SELECT Child.empid, Child.empname FROM Employee AS Parent JOIN Employee AS Child
          ON Parent.empid = 2 AND child.empbossid.IsDescendantOf(Parent.empbossid) = 1;
3) Get Parent Node
SELECT parent.empid, parent.empname
  FROM Employee AS Parent JOIN Employee AS Child
    ON child.empid = 4 AND child.empbossid.IsDescendantOf(Parent.empbossid) = 1;
more on HierarchyId Data Types refer:
http://amitpatriwala.wordpress.com/2009/10/23/hierarchyid-data-type/

5) Introduced New Functions
Function Name Function Use
SYSDATETIME Returns current date and time as DateTime2 value.
SYSUTCDATETIME Returns current date and time in UTC as DateTime2 value
SYSDATETIMEOFFSET Returns current date and time along with the system time zone as a DATETIMEOFFSET value
SWITCHOFFSET Adjusts an input DATETIMEOFFSET value to a specified time zone, while preserving the UTC value.

For example, the following code adjusts the current system datetimeoffset value to time zone GMT +05:00:

SELECT SWITCHOFFSET(SYSDATETIMEOFFSET(), ‘-05:00′);

TODATETIMEOFFSET sets the time zone offset of an input date and time value
6) Support Large User Define Types [UDT]
Sql Server 2008 supports large UDT,large UDTs can now reach up to 2 GB in size.
 
Reference Sites: 
http://technet.microsoft.com/en-us/library/cc721270.aspx

URL rewriting in asp.net

October 2, 2009 Leave a comment

what is URL rewriting ?

URL rewriting is the process of intercepting an incoming Web request and redirecting the request to a different resource. When performing URL rewriting, typically the URL being requested is checked and, based on its value, the request is redirected to a different URL.

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

why URL rewriting?

1) Make User Friendly and Secure URL

Example :  In your application, you create a page which display category information and it’s relevant category. At that time we normally passing a value via query string,

http://Site.com/category.aspx?categoryid=1. Any user play with URL, you can also do the URL Encryption. but sometime case is complex at that time it is not possible.

2) Make SEO Friendly URL

3) Usability & Maintainability

Use Of Browser file?

ASP.NET uses .browser files to determine the capabilities of the browser, and how to render markup to that browser.

Browser files are used to reduce the load of the page made by the view state by storing it in a server side session variable.

In particular Rewriting Module: Handling Post back with URL Rewriting.

what is ControlAdapter?

for more detail please check :

http://msdn.microsoft.com/en-us/library/system.web.ui.adapters.controladapter.aspx

Create demo project for URL Rewriting:

Step 1:

Create Web application with (Asp.net 2.0 with c#)

Step 2:

Put two button in the form (default.aspx)

Put Below code for Button1_Click Event :

Response.Redirect("Default.aspx?id=1");

Put Below code for Button2 _Click Event:

Response.Redirect("/urlrewriting/FirstSection/Default.html");

Step 3: Run Application

once you press Button2 it give Error page.

Step 4:

Create Class FormRewriterControlAdapter.cs

   1: using System;

   2: using System.Data;

   3: using System.Configuration;

   4: using System.Web;

   5: using System.Web.Security;

   6: using System.Web.UI;

   7: using System.Web.UI.WebControls;

   8: using System.Web.UI.WebControls.WebParts;

   9: using System.Web.UI.HtmlControls;

  10:  

  11: public class FormRewriterControlAdapter : System.Web.UI.Adapters.ControlAdapter

  12: {

  13:     protected override void Render(HtmlTextWriter writer)

  14:     {

  15:         base.Render(new RewriteFormHtmlTextWriter(writer));

  16:     }

  17: }

  18:  

  19: public class RewriteFormHtmlTextWriter : HtmlTextWriter

  20: {

  21:     public RewriteFormHtmlTextWriter(HtmlTextWriter writer)

  22:         : base(writer)

  23:     {

  24:         this.InnerWriter = writer.InnerWriter;

  25:     }

  26:  

  27:     public RewriteFormHtmlTextWriter(System.IO.TextWriter writer)

  28:         : base(writer)

  29:     {

  30:         base.InnerWriter = writer;

  31:     }

  32:  

  33:     public override void WriteAttribute(string name, string value, bool fEncode)

  34:     {

  35:         if (name == "action")

  36:         {

  37:             HttpContext Context = HttpContext.Current;

  38:             if (Context.Items["ActionAlreadyWritten"] == null)

  39:             {

  40:                 value = Context.Request.RawUrl;

  41:                 Context.Items["ActionAlreadyWritten"] = true;

  42:             }

  43:         }

  44:         base.WriteAttribute(name, value, fEncode);

  45:     }

  46: } 

 

Create Class MyHttpHandler.cs

   1: using System;

   2: using System.Data;

   3: using System.Configuration;

   4: using System.Web;

   5: using System.Web.Security;

   6: using System.Web.UI;

   7: using System.Web.UI.WebControls;

   8: using System.Web.UI.WebControls.WebParts;

   9: using System.Web.UI.HtmlControls;

  10:  

  11: public class MyHttpHandler : IHttpModule

  12:  

  13: {

  14:     public MyHttpHandler()

  15:     {

  16:         //

  17:         // TODO: Add constructor logic here

  18:         //

  19:     }

  20:  

  21:     #region IHttpModule Members

  22:  

  23:     public void Dispose()

  24:     {

  25:        

  26:     }

  27:  

  28:     public void Init(HttpApplication app)

  29:     {

  30:         app.BeginRequest += new EventHandler(Application_BeginRequest);

  31:     }

  32:  

  33:     private void Application_BeginRequest(object sender, EventArgs e)

  34:     {

  35:         System.Web.HttpApplication app = (System.Web.HttpApplication)sender;

  36:         string requestedUrl = app.Request.Path.ToLower();

  37:         string realUrl = GetRealUrl(requestedUrl);

  38:         if (!String.IsNullOrEmpty(realUrl))

  39:             app.Context.RewritePath(realUrl, false);

  40:     }

  41:  

  42:     private string GetRealUrl(string requestedUrl)

  43:     {

  44:         // Implement your own logic here

  45:         MyURL obj = new MyURL();

  46:         return obj.GetRealPath(requestedUrl);

  47:     } 

  48:     #endregion

  49: }

 

create Class MyURL.cs

   1:  

   2: using System;

   3: using System.Data;

   4: using System.Configuration;

   5: using System.Web;

   6: using System.Web.Security;

   7: using System.Web.UI;

   8: using System.Web.UI.WebControls;

   9: using System.Web.UI.WebControls.WebParts;

  10: using System.Web.UI.HtmlControls;

  11: using System.Collections.Generic;

  12:  

  13: /// <summary>

  14: /// Summary description for MyURL

  15: /// </summary>

  16: public class MyURL

  17: {

  18:     public MyURL()

  19:     {

  20:         //

  21:         // TODO: Add constructor logic here

  22:         //

  23:     }

  24:  

  25:     public string GetRealPath(string requestedUrl)

  26:     {

  27:         string path = "";

  28:         Dictionary<string, string> paths = GetPathsFromDatabase();

  29:         if (paths.ContainsKey(requestedUrl))

  30:             paths.TryGetValue(requestedUrl, out path);

  31:         return path;

  32:     }

  33:  

  34:     private static Dictionary<string, string> GetPathsFromDatabase()

  35:     {

  36:         Dictionary<string, string> paths = new Dictionary<string, string>();

  37:         paths.Add("/urlrewriting/FirstSection/Default.html".ToLower(), "/urlrewriting/Default.aspx?SectionID=1");

  38:         paths.Add("/urlrewriting/SecondSection/Default.aspx".ToLower(), "/urlrewriting/Default.aspx?SectionID=2");

  39:         paths.Add("/urlrewriting/FirstSection/Page1.aspx".ToLower(), "/urlrewriting/Default.aspx?SectionID=1&Item=1");

  40:         paths.Add("/urlrewriting/FirstSection/Page2.aspx".ToLower(), "/urlrewriting/Default.aspx?SectionID=1&Item=2");

  41:         paths.Add("/urlrewriting/SecondSection/Page1.aspx".ToLower(), "/urlrewriting/Default.aspx?SectionID=2&Item=1");

  42:         paths.Add("/urlrewriting/SecondSection/SubSection/AnotherOne/Page5.aspx".ToLower(), "/urlrewriting/Default.aspx?SectionID=2&Item=5");

  43:         paths.Add("/urlrewriting/Default.aspx".ToLower(), "/urlrewriting/Default.aspx");

  44:         return paths;

  45:     } 

  46: }

Register Http Handler in to Web.Config

   1: <system.web>

   2:         <httpModules>

   3:             <add name="MyHttpHandler" type="MyHttpHandler"/>

.Browser File

Add New .browser file from Add New Item.

   1: <browsers>

   2:     <browser id="NewBrowser" parentID="Mozilla">

   3:         <identification>

   4:             <userAgent match="Unique User Agent Regular Expression" />

   5:         </identification>

   6:  

   7:         <capture>

   8:             <userAgent match="NewBrowser (?'version'\d+\.\d+)" />

   9:         </capture>

  10:  

  11:         <capabilities>

  12:             <capability name="browser" value="My New Browser" />

  13:             <capability name="version" value="${version}" />

  14:         </capabilities>

  15:     </browser>

  16:  

  17:     <browser refID="Mozilla">

  18:         <capabilities>

  19:             <capability name="xml" value="true" />

  20:         </capabilities>

  21:     </browser>

  22: <!--FormRewrite Control Adapter-->

  23:     <browser refID="Default">

  24:         <controlAdapters>

  25:             <adapter controlType="System.Web.UI.HtmlControls.HtmlForm"

  26:                 adapterType="FormRewriterControlAdapter" />

  27:         </controlAdapters>

  28:     </browser>

  29: </browsers>

step 5: Run Application

Now Press Button 2:

http://localhost:2696/urlrewriting/FirstSection/Default.html and it is run.

 

Now made some change in to system. Remove browser file and click button2, after that made postback at that time above URL is change to original URL.

Reference Site :

For Detail Example :

http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

 

Hope this help you.

Thnx

 

Follow

Get every new post delivered to your Inbox.

Join 237 other followers