Tips and Tricks in a world of Mix

Archive for May, 2011

Permissions for Shared Folder for IIS 7 Application Pool Identity Across Domain

So the scenario today , is upgraded to IIS 7 and using now the Application Pool Identity as defined in the best practice of Microsoft .

In the IIS 7 , standing on MY APPLICATION POOL

press Advanced Settings :

image

 

We’ve deployed the application and it tries to access some  shared folder on some other server .

“\\OtherServerName\Some Folder”

 

Once we were Network Service , IIS IUSR and so on , but not any more..

So who are we now ? How can we access the folder ?

Who is that mysterious ApplicationPoolIdentity guy ?

 

So the answer is quite simple :

Go to the Shared Folder –> right click –> properties  -> security –>edit –> add (so far as usual ) -> choose object types –> check on computers –> now enter the computer name where your application is working from , where you published your application.

image

That’s it – now you have the access to the Shared Folder!

Good luck!

Advertisements

What ODP.NET version in ODAC 11.2.0.2.1 ?

station name

odp.net

oracle

os

Terminal1 tk

2.111.7.20

11g

Win 7 64bit

Server 1 tw

2.112.1.0

11g

Win Server 2008 R2  64 bit

Server 2 tt

1.111.7.0

11g

Win Server 2008  32 bit
 

2.111.7.0

   

Terminal 2 aa

1.111.6.20

11g

Win Xp Professional 32 bit
 

2.111.6.20

   

 

We are starting using TFS build templates  , so that we need to install the ODP.NET on the tfs server . So the most updated version for now to install is 2.112.2.0 I think.

I’ve found

32-bit ODAC 11.2 Release 3 (11.2.0.2.1) Installation Instructions, Setup, and Notes

December 2010

at your site .

What version of ODP.NET does it contain ?
What versions of the OS does it support?

What previous versions of ODP.NET does it support ?

 

Answer of Oracle team :

Best choice if OS Range is from XP to W2008R2 / W7 and both 32bit and 64bit software is used,ODP.NET 2.112.2 or higher should be used – since ODAC 11.2.0.2.1 exists for 32bit and 64bit Platformsand it supports .NET 2.x and 4.X this underlines the recommendation.

The only limitation is the used database – 11.2.0.X cannot access DB 9.2.0.4 and less and DB 10.2.0.1 – but since 9.2 is desupported since years and 10.2 will be in extends support in July 2011 this should not play a role.
Future Version of ODAC maybe 11.2.0.3 (maybe end of 2011) – or 12.1 (no target date) –
depending if there is a need for 11.2.0.3 ODP or not.

The ODP.NET nomenclature is
Oracle 9.2.0.X: ODP.NET 9.2.0.7
Oracle 10.1 / .NET 1.X : ODP.NET 1.101.X.Y
Oracle 10.1 / .NET 2.X : ODP.NET 2.101.X.Y
Oracle 10.2 / .NET 1.X : ODP.NET 1.102.X.Y
Oracle 10.2 / .NET 2.X : ODP.NET 2.102.X.Y
Oracle 11.1 / .NET 1.X : ODP.NET 1.111.X.Y
Oracle 11.1 / .NET 2.X : ODP.NET 2.111.X.Y
Oracle 11.2 / .NET 2.X : ODP.NET 2.112.X.Y
Oracle 11.2 / .NET 4.X : ODP.NET 4.112.X.Y

The X describe the patch set level – for example for 11.1.0.7 X=Y
And the Y describes a internal revision – ODAC and Full Client sometimes differed – for example Full Client Y=0 and ODAC = 20 etc..
Next, if there are 9.2 DB on the system I would suggest you lift the DB to 9.2.0.8 – or upgrade it to 10.2.0.5 since 9.2 is desupported since years
Installation of two ODP.NET can be done – but in that case you have to ensure that ORACLE_HOME and PATH is set correctly
before a specific app is started using a special ODP.NET

Problem Using Stored Procedure with Fluent Nhibernate

    1. Gave the mapping file the extension .hbm.xml
    2. Set the build action to ‘Embedded Resource’
    3. Set the copy-to-output to ‘Copy Always’
    4. Created the Hbm for SP:

<?xml version=1.0encoding=utf-8?>
<
hibernate-mapping xmlns=urn:nhibernate-mapping-2.2assembly=Infranamespace=Infra.Entities>
<sql-query name=GETMYDATA>
<
return class=Kav>
<
return-property column=Kav.MAKAT8name=MAKAT8/>
<
return-property column=Kav.DESCRIPTIONname=DESCRIPTION/>
</
return>
exec  GETMYDATA  :P_PARAM1 , :P_PARAM2 , :MY_CURSOR
</sql-query>

</hibernate-mapping>

5. Created the Entity class :

using System;

namespace Infra.Entities
{
[Serializable]
public class Kav : Entity
{
public virtual string Makat8 { get; set; }
public virtual string Description { get; set; }
}
}

6. Created the Mapping class for the entity:

namespace Infra.Entities.Mapping
{
public class KavMapping : EntityClassMap<Kav>
{
public KavMapping()
{
Table(“kav_tkufa”);
ReadOnly();
Id(x => x.Makat8).Column(“MAKAT8”).Length(10);
Map(x => x.Description).Column(“Description”).Length(50);

}
}
}

7. Added the mapping to the FNH configuration (the entities and hbm in the same assembly) :

.Mappings(m =>
{
m.FluentMappings.AddFromAssemblyOf<KavMapping>();
m.HbmMappings.AddFromAssemblyOf<KavMapping>();
m.MergeMappings();
} )

I’ve read Ayende’s post http://ayende.com/blog/1692/using-nhibernate-with-stored-procedures on connecting to SP , but I’m failing to connect.

How should I map the Kav so that I could get the list of entities from SP ?

Managing External Dlls–Make Your Project Portable and Independent

   I think that any programmer have tackled with this problem of missing dlls , or suddenly the dlls are upgraded in the server and you are left with your application to pick up the pieces.

  SO , how can we handle the dlls so that our application won’t be effected by almost anything?

  First of all , it is important to understand that the solution presented here does not cancel the need to install the Framework on the destination machine, meaning that the correct framework must be there always in order for your application to work properly.

  There are few solutions for managing your dlls :

1)Reference to GAC as usual

2)Add a folder to specific project with your needed dlls

3)Add a solution folder to your solution and locate your needed dlls there

4)Locate your dlls on some Shared Folder in your organization

5)Build a new Project and insert the dlls there

 

 

In each and every solutions there are Pros and Cons as always :

method pros cons
1)Reference to GAC as usual You don’t need to worry about anything, it’s all in the system. If you are using standard Microsoft dlls , even if there will be an upgrade of the dlls version , Microsoft always tries to make it backward compatible – it won’t touch you. If you have some specific dlls , such as Oracle.DataAccess.dll etc. then it can happen that the dll that you have on your terminal , that you develop with is a different version – in this case when you publish your application on the server your application won’t work properly. You’ll get mistakes of bad assembly reference or one of it dependencies.
2)Add a folder to specific project It’s easy, and whenever you deploy the project you are carrying your dlls with you. If you have a few projects in your solution you can’t use it properly between the projects. You need to keep the location of the folder specific.You could reference the dlls for your current project from a different project folder but when you’ll take the current project as a reference to some third component and then one of the dlls change – you’ll need to recompile all components.
3)Add a solution folder to your solution and locate your needed dlls there It’s a logical unit just holding the dlls – you are adding a logic meaning composing the dlls by logical themes. When you work with TFS or VSS or any source safe you need to have a physical object of a folder. Another thing – if you have a lot of dlls and you need to drag and drop a whole folder of them into solution folder – you CAN’T, so you’ll have to create every folder by hand inside that solution folder and then import dlls files , folder by folder.
4)Locate your dlls on some Shared Folder in your organization That’s one of the “good” solutions if you work in organization with LAN , and ability to control permission over domains . You just throw the dlls to some folder and share it with every one you like. If there are multiple users on the same dll , the system creates copies and you won’t get stacked. The down side is handling the source safe again . It creates decentralization of your application. Another thing , in terms of maintenance  you can always forget the specific location of the shared folder or not get enough permissions after system team will perform some update on the server.
5)Build a new Project and insert the dlls there SO, the great solution yet is to add a new Class Library project , drag and drop the folders you need to take with you and recompile.
Any component in your solution will reference the  autonomic defined component . You can manage it under your source safe and you can enter it in your deployment package – leaving the hierarchy as predefined at the begging. If the dlls change – all you’ll need to do is to throw the External Dlls project to the server.
When you create the project and drag and drop the folders you’ll get “Project file must include the .NET Framework assembly ‘WindowsBase, PresentationCore, PresentationFramework’ in the reference list.”  error . It means that your dlls are defined as a Content . You need to go through the folders , choose the dlls(can choose list of them) and in properties change the Build Action to Resource. That’s it.

 

So , in this review I’ve shown the best way to make your project portable and independent.

Now you can enjoy the deployment. Cheers!

Silverlight–Formatting Xaml – beautify

1. In VS2008 or VS2010 go to Tools –> Options

2. Expand Text Editor -> XAML -> Formatting –> Spacing

image

 

image

 

 

3. Under "Attribute Spacing" check "Position each attribute on separate line".

4. If you prefer, you can also put the first attribute on the same line as the tag by checking the box.  I use this setting because it isn’t offensive and still saves a little space.

image

Now, whenever you edit XAML in Visual Studio, press "Ctrl+K+D" and Visual Studio will reformat the XAML as desired.

image

if you check

Position first attribute on same line as start tag it’ll look like this :

image

I think that I preffer the second option.

Comparing ListView with GridView,DataList and Repeater

 

 

The ListView control is a new data presentation control that was added in ASP.Net 3.5.You may wonder why its added to the framework , and what it provide .

From what i have seen, ListView control was added to provide The following functionalities :

  1. A very flexible and customizable layout.
  2. A built in data paging support with the new DataPager control.
  3. Support data grouping (repeating items) in a flexible way.
  4. Built in support for deleting,inserting,paging,sorting,and updating the data.

Now , to compare the ListView control with the dataList,GridView and repeater control , lets look at the table below :

Supported Funcationalities

image

* Supported: means that it’s provided out of the box without any custom code or hacks.

* Not Supported: means that it’s not provided out of the box by the control but it could be possible to implement it using custom code \ hacks.

The GridView : it supports paging but it doesn’t provide a flexible layout , since its mainly used to display the data in a table based layout.And If we looked at data inserting , the Gridview doesn’t have a built in support for inserting data( since it doesn’t call the insert method of it underlying data source when you click on a button with a CommadName set to "Insert" ).

The DataList : it support data grouping ( through its RepeatColumns property) , but it doesn’t have a built in support for paging,inserting ,deleting , updating the data. and if you looked at its laout , you will find that by default  the datalist renders as html table and you will have to set its flowLayout to "Flow" to stop that behaviour.

The Repeater control : you will find that it provides a flexible layout but it doesn’t support data grouping ,inserting,deleting , updating  and paging through the data .

Summary :

The ListView control was added to provide a rich data control that can support all the required functionalities at the same time , so now you can easily display a fully customizable layout that supports Grouping,paging , inserting , deleting , updating and sorting the data.


* Supported: means that it’s provided out of the box without any custom code or hacks.

* Not Supported: means that it’s not provided out of the box by the control but it could be possible to implement it using custom code \ hacks.

The GridView : it supports paging but it doesn’t provide a flexible layout , since its mainly used to display the data in a table based layout.And If we looked at data inserting , the Gridview doesn’t have a built in support for inserting data( since it doesn’t call the insert method of it underlying data source when you click on a button with a CommadName set to "Insert" ).

The DataList : it support data grouping ( through its RepeatColumns property) , but it doesn’t have a built in support for paging,inserting ,deleting , updating the data. and if you looked at its laout , you will find that by default  the datalist renders as html table and you will have to set its flowLayout to "Flow" to stop that behaviour.

The Repeater control : you will find that it provides a flexible layout but it doesn’t support data grouping ,inserting,deleting , updating  and paging through the data .

Summary :

The ListView control was added to provide a rich data control that can support all the required functionalities at the same time , so now you can easily display a fully customizable layout that supports Grouping,paging , inserting , deleting , updating and sorting the data.

Article Source –http://weblogs.asp.net/anasghanem/archive/2008/09/06/comparing-listview-with-gridview-datalist-and-repeater.aspx

Tag Cloud

%d bloggers like this: