Code (27)

25-09-2019 Programmatic Logic - Munafiq, Amanat may Khayanat - Hypocrite, Breach of Trust
06-10-2018 From wireframe to HTML, Design to Code - AI Power Sample
08-11-2012 Recursive Query Parent Child Concatenation
25-04-2012 Change or remove filter / filter content from Sharepoint list / library view columns
20-04-2011 Sigin as different user in asp.net using Windows authentication
26-01-2011 Powershell CmdLets
30-05-2010 Update Statistics - Query to find tables and index number of statistics being old
15-03-2010 Passing encrypted data between JavaScript and C#
12-02-2010 Sharepoint - SPWeb.Groups Vs SPWeb.SiteGroups
28-01-2010 Accessing JD Edwards Data on iSeries or AS/400 from a ASP.NET / SQL Encoding / Error problem
28-01-2010 Controls not functional after Export to Excel or Export to PDF of Telerik in Sharepoint Application page
05-10-2009 ASP.NET Cannot open log for source {0}. You may not have write access. - Access is denied
28-08-2009 CRM - The SELECT permission was denied on the object 'BuildVersion', database 'MicrosoftCRM_MSCRM', schema 'dbo'
22-08-2009 CRM - Retrieve Cultures information from CRM into your Custom Web Application
21-08-2009 CRM - Globalization / Localization in Custom Web Application
19-08-2009 CRM - Do you want to save this file? Blank.aspx?
18-08-2009 CRM Exception - Microsoft.Crm Application.Platform.Report. InternalCreate(String xml)
18-08-2009 CRM Exception - Microsoft.Crm.Reporting SRSReport.convertDataSource()
24-06-2009 Oracle SQL Developer - Unable to create an instance of the Java Virtual Machine
27-01-2009 Detecting Idle time or Inactivity in Windows Forms
23-01-2009 PasswordChar and Set focus on page load for ToolStripTextBox
21-01-2009 Capture Form Close Event
21-01-2009 Richtextbox or multiline textbox and AcceptButton to handle Enter or Tab key press
21-01-2009 Key Combination shortcuts in C# Windows Form
01-01-2009 Convert string to hexadecimal and hexadecimal to string
31-12-2008 Implementing Transaction in Stored Procedure
31-12-2008 Implementing Transaction in .NET
Wed 25 Sep 2019

HandleMunafiq()
{
     switch (Amanat)
     {
          case Khayanat:
               Put_Munafiq_in_Dozakh();
          break;
          .
          .
          .
          .
          .
     }

}

HandleHypocrite()
{
     switch (Trust)
     {
          case Breach_of_Trust:
               Put_Hypocrite_in_Hell();
          break;
          .
          .
          .
          .
          .
     }

}

Categories : Thoughts / Lessons
Comments here
Sat 6 Oct 2018

Comments here
Thu 8 Nov 2012

If you want to show records (Parent Child concatenation), then following SQL Server recursive query could help you in achieve. For a clear picture have a look at following snap

 

 Recursive+Qeury+Parent+Child+Concatenation.jpg

Recursive Query showing only child Records

                           

with parentChildResult as

(

       select ItemId,

                     ItemDescription,

                     ItemCategoryId,

                     cast('' as nvarchar(max)) as ParentNames

       from Items

       where ItemCategoryId is null

        union all

        select i2.ItemId,

                     i2.ItemDescription,

                     i2.ItemCategoryId,

                     parentChildResult.ParentNames + ' > ' + parentChildResult.ItemDescription

       from Items as i2

       inner join parentChildResult

              on parentChildResult.ItemId = i2.ItemCategoryId

)     

 select ItemId,

              stuff(ParentNames, 1, 3, '') + ' > ' + ItemDescription as ParentNames

from parentChildResult

 where ItemId in

(

       SELECT i.ItemId FROM Items i

       WHERE NOT EXISTS(SELECT 1 FROM Items I2 WHERE i.ItemId = I2.ItemCategoryId)

)

 

order by ParentNames

 

  

Recursive Query showing All parents and Child Records

 

with parentChildResult as

(

       select ItemId,

                     ItemDescription,

                     ItemCategoryId,

                     cast('' as nvarchar(max)) as ParentNames

       from Items

       where ItemCategoryId is null

        union all

        select i2.ItemId,

                     i2.ItemDescription,

                     i2.ItemCategoryId,

                     parentChildResult.ParentNames + ' > ' + parentChildResult.ItemDescription

       from Items as i2

       inner join parentChildResult

              on parentChildResult.ItemId = i2.ItemCategoryId

)     

 select ItemId,

              stuff(ParentNames, 1, 3, '') + ' > ' + ItemDescription as ParentNames

from parentChildResult

 order by ParentNames

 

Comments here
Wed 25 Apr 2012

In sharepoint, if it is required to disable the filter and to keep only the sorting, then following workaround could be the solution one.
(Following change are done to sharepoint 2010 using sharepoint designer 2010, might be it works for 2007 aswell)

Please keep the copy of file(s) which you are going to change, incase if some mishap happen J

·         Open the desired sharepoint site in sharepoint designer

·         Select Lists and Libraries from the Site Objects

·         Select desired list / library

·         Select the desired view from the views list where you want to remove to remove filter

·         Click on advance mode

·         Search for the <ViewFields> inside <XmlDefinition>

·         Now add following desired attribute to all desired columns. (All column are  <FieldRef Name="ModifiedOn" />)

as

 <FieldRef Name=" ModifiedOn " LinkToItem="TRUE" Filterable="FALSE" FilterDisableMessage="No filter available "/>

After that, edit the page where the list / library webpart exists or add webpart (list / library) if not already added on the page,  edit webpart properties and select the desired view again then click apply button to reflect changes.

 

In above,

·         You can change the default text for disabled filter using FilterDisableMessage="No filter available " attribute

·         By adding Filterable="FALSE", now the filter will not be available

·         If you want to make a particular column clickable, then add LinkToItem="TRUE"

 

Comments (4)
Wed 20 Apr 2011

If you want to have signin as different user functionality like sharepoint in your asp.net application, following workaround you might be looking for.
After setting your web.config file's 

<authentication mode="Windows" />

and in IIS after remove anonymous authentication and enable windows authentication, have following code snippet where you want to have this functionality

In your aspx page

    <div>You are logged in as <br /> <%=User.Identity.Name%> <br /><br /> 
    <asp:LinkButton ID="lnkSignOut" runat="server" Text="Sign in as different user" onclick="lnkSignOut_Click"></asp:LinkButton>


In your code behind file

 protected void Page_Load(object sender, EventArgs e)
{
    if (!this.IsPostBack)
    {
        Session["logOutRequested"] = false; //Initialize value. This will be set to true when user will click on sign in as differnet user
    }
}


protected
void lnkSignOut_Click(object sender, EventArgs e)
{
    if (null != Session["logOutRequested"] && !Convert.ToBoolean(Session["logOutRequested"])) // Check if user is clicking link first time
    {
        Session["logOutRequested"] = true; //Set value that user want to sign in as differnet user
        Response.StatusCode = 401;
        Response.StatusDescription = "Unauthorized";
        Response.End();
    }
    else
    {
        Session["logOutRequested"] = false; //Initialize value again after user is authenticated with differnet or same user again.
    }
}


Hope this workaround will help.

In case if above workaround is not working, you may try following one
www.roelvanlisdonk.nl/?p=825

 

 

 

Tags: , ,
Comments (1)
Wed 26 Jan 2011

Get-SPSite | where {$_.url -like "http://a *"}

Get-SPFarm | Format-List Id, BuildVersion, Servers, Solutions

Add-PSSnapin Microsoft.SharePoint.Powershell

===========

ExecuteHelloWorldScript from batchfile

powershell -Command "& {.\Hello.ps1}" -NoExit
pause


powershell -Command "& {Set-ExecutionPolicy bypass}" -NoExit


===========

CreateContosoSite

if($args) {
  $SiteName = $args[0]
  $SiteUrl = "http://a:3811/sites/ " + $SiteName
  Write-Host "Begin creating Contoso site at" $SiteUrl
  Write-Host
  $NewSite = New-SPSite -URL $SiteUrl -OwnerAlias Administrator -Template STS#1 -Name $SiteName
  $RootWeb = $NewSite.RootWeb
  $RootWeb.Title = "Contoso Site: " + $SiteName
  $RootWeb.Update()
  Write-Host "New Contoso site successfully created"
  Write-Host "-------------------------------------"
  Write-Host "Title:" $RootWeb.Title -foregroundcolor Yellow
  Write-Host "URL:" $RootWeb.Url -foregroundcolor Yellow
  Write-Host "ID:" $RootWeb.Id.ToString() -foregroundcolor Yellow
}
Else {
  Write-Host "ERROR: You must supply Name as parameter when calling CreateContosoSite.ps1"
}


===========

GetSharePointDlls

$path = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14"

Get-ChildItem $path -recurse |
  Where-Object {$_.name -like "*SharePoint*.dll"} |
  Sort-Object -Property Name -unique |
  Format-Table Name


===========


GetSharePointPublishingFeatures

Get-SPFeature -Limit ALL |
  Where-Object {$_.DisplayName -like "*Publishing*"} |
  Sort-Object -Property Scope
  Format-Table DisplayName, Id, Scope

 

===========

.\GetSharePointPublishingFeatures.ps1
Get-SPFarm | Format-List
Get-SPSite | where {$_.url -like "http://a *"}
.\CreateContosoSite.ps1 lab01test


===========

Comments here
Sun 30 May 2010

Query to find all the Tables and Index with number of days statistics being old. Then run Update Statistics command to update statictics for optimized query plan.

SELECT
OBJECT_NAME(A.object_id) AS Object_Name,
A.name AS index_name,
STATS_DATE(A.OBJECT_ID, index_id) AS StatsUpdated ,
DATEDIFF(d,STATS_DATE(A.OBJECT_ID, index_id),
getdate()) DaysOld
FROM sys.indexes A
INNER JOIN sys.tables B ON A.object_id = B.object_id
WHERE A.name IS NOT NULL
ORDER BY DATEDIFF(d,STATS_DATE(A.OBJECT_ID, index_id),getdate()) DESC

 

Comments here




Ads