SQL Server 2008 saving changes is not permitted
Tuesday, February 16, 2010 2:55 AM

i was using SQL Server management studio 2008 diagram editor which i was using after years of using sql server managemenr studio 2005 whcih i think is the easiest tool for modeling Database.

 

and i came across this message

image

 

turns out there’s an option that i have to uncheck for this to work

tools ==> options and then find this option

image

by amir.magdy | with no comments
Filed under: ,
Create a picklist quickly for CRM 4.0
Wednesday, January 13, 2010 3:55 AM

a very simple tool to add a large list like a countries list to a picklist

doing that using MS CRM UI can be very tedious

Warning : DON’T TRY THIS IF YOU DON’T HAVE EXPERIENCE ON XML EDITING , this tool is meant for expert customizers

Developer Blog  URL :

http://marioraunig.blogspot.com/2007/03/save-time-and-energy-creating-large.html

how to :

Here's how to use it

  1. Create the attribute/picklist in the Microsoft CRM entity customization
  2. Add at least one option
  3. Export the entity as XML
  4. go here: http://www.beatnik.at/picklist_for_mscrm.php
  5. Choose the appropriate language setting (if missing, contact me)
  6. Enter the desired picklist values into the textbox
  7. Click "Generate XML"
  8. Open the XML-File that you exported in step (3) with WordPad or your favourite TextEditor (Notepad tends to have problems with encoding)
  9. Search for the displayname or the schemaname of the attribute
  10. Replace the options tag with the XML-String generated in (7).
    It might look like that:
    <options nextvalue="3">
    ...
    </options>
  11. Save the XML-Customizations File
  12. Import the File into MS CRM and publish
Webclient downloading content/files from an Https (SSL)
Monday, October 05, 2009 2:09 AM

i was using the webclient object to download files from a website and my application worked fine. my client decided to add an SSL certeficate to the website and has required me to change my code to request the file through https instead of http

all i had to do was change the URL to have https:// instead of http://

but when i first tried the code. i got this exception:

System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

 

after doing a little research i found out that this error can not be fixed on the development environment.

 

this is because one of the following issues is occuring

  1. The certificate cannot be found for any reason
  2. One of issuers in the chain cannot be validated successfully
  3. The name of the certificate is invalid or does not match the name of the site.

source

now what i had to do is write a piece of code that ignores the SSL errors when the application is in the development environment.

 

ServicePointManager.ServerCertificateValidationCallback +=
 new System.Net.Security.RemoteCertificateValidationCallback
(bypassSSLErrors);
// now this is only static code needs to execute once 
private static bool bypassSSLErrors(object sender,
           X509Certificate cert, X509Chain chain, 
           System.Net.Security.SslPolicyErrors error)
           {
              return true;
           }
by amir.magdy | 1 comment(s)
Filed under: ,
The visual studio language support for style has not been installed. code-editing Intellisense will not be available. Markup Intellisense for server controls may not work.”
Thursday, August 13, 2009 5:04 AM

I have visual studio 2008 installed

Only on my machine when I open a solution that contains web sites I get this error.

“The visual studio language support for style has not been installed. code-editing Intellisense will not be available. Markup Intellisense for server controls may not work.”

 

This error is preventing me from having automated builds as it runs visual studio in the background and user interaction is needed to click “OK”, Visual studio is the only tool (that I know of) that can build Web sites (vs. web applications) and converting to web applications is a large effort.

On Microsoft Connect i have found this page.

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=477297 if you know how to resolve as in the ticket please call.

 

Resolution is simpler actually , close visual studio go to your windows run box

and type

Devenv /ResetSkipPkgs

this has fixed my problem

by amir.magdy | with no comments
Filed under:
SQL server data base restore script
Friday, July 03, 2009 7:29 AM

this is a quick trick that i googled from bits and pieces in a caffe when my laptop didn’t have a Management studio installed

i found a way to execute sql scripts to my instance of sql express

well to restore you need to have the logical names of files in the database backup to know that

just type

RESTORE FILELISTONLY
FROM DISK = ‘<path to your backup file>’

this will display all the logical file’s in the backup in the result sets

you’ll need the logical file names for the coming script (the actual restore)

 

RESTORE DATABASE <DataBaseName>
FROM DISK = ‘<path to your backup file>’
WITH MOVE ‘<Data file logical Name>’ TO '<path to resotre your datafile>',
MOVE '<log file logical name >' TO '<path to restore your log file>'

by amir.magdy | with no comments
Filed under: ,
How To Design A Good API by Joshua Bloch Google
Wednesday, June 24, 2009 1:55 PM
http://www.youtube.com/v/aAb7hSCtvGw&hl=en&fs=1&
Database or Object Size in SQL server [sp_spaceused]
Monday, June 01, 2009 1:02 AM

Space used by the objects in the database is a tricky subject, this can be very useful when planning your database maintenance plan

a system stored procedure as you probably had figured is called sp_spaceused gets you the needed information

that procedure can be used in multiple ways

use Northwind
exec sp_spaceused

when this is executed against your database this data appears

image

it shows two result sets the first one which is a Whole Database statistics

  1. DatabasName
  2. database size in MBs and
  3. Space in the database that has not been reserved for database objects in MB also (this is space that is reserved by the Database and has not been allocated to any database objects yet)

the second group shows

  1. data that has been reserved for all objects (this includes pages that has no data and fragmented pages)
  2. Actual Data size inside the tables pages
  3. index size
  4. unused space

 

sometimes you might get negative values, that is normal as sometimes the usage information is not updated in that case you can do this

 

USE Northwind
GO
EXEC sp_spaceused @updateusage = N'TRUE';

 

it will update usage information and then return the same values as the first sample

now. you can also get statistics that are specific to an object

you can do this simply by

 

USE Northwind;
GO
EXEC sp_spaceused N'Employees';
GO
image

in addition to reserved space and data and index size you also get the rows count

by amir.magdy | with no comments
Filed under: ,
Fiddler 2 to monitor localhost ie7
Wednesday, May 27, 2009 6:46 AM

IE7 and .net framework are programmed never to request data localhost

Just change the wording Localhost to your machine Name.

this is a better explanation http://www.fiddler2.com/fiddler/help/hookup.asp#Q-LocalTraffic

by amir.magdy | with no comments
Filed under: ,
Change Web Service test page [wsdlHelpGenerator]
Tuesday, May 26, 2009 4:24 AM

the default web service page is a page that reveals a lot of the internal information of the application, this is something that you want to hide.

Warning this does not really secure your web service. may be you should read something like this

<configuration>
   <system.web>
      <webServices>
         <wsdlHelpGenerator href="yourEmptyPage.aspx"/>
      </webServices>
   </system.web>
</configuration>

 

just make sure you add a page to your site’s root folder and name it yourEmptyPage.aspx this way whenever someone navigates to your web services URL that page is going to render

by amir.magdy | with no comments
Filed under: , ,
Windows Debugging tools Quick tutorial [WinDbg]
Sunday, May 17, 2009 11:42 PM

last week end we have faced memory leaks, we had no idea what was the cause of the problem. we were directed by microsoft to use the debugging tools.

this is a quickest possible startup tutorial for that tool.

[Warning] using this tool affects the performance of your applications dramatically please make sure you don’t run it on a production server unless there’s no other way.

    1. download link
      you are looking for “Install Debugging Tools for Windows xx-bit Version”
      you’ll be redirected to the download page u’ll need to look for the “current version”
    2. install the tool
      this is probably the only straight forward step in this tutorial
    3. Copy SOS.dll *
      u need to copy this dll from your framework folder
      usually %windir%\Microsoft.NET\Framework\v2.0.50727
      to your windbg folder
      usually %ProgramFiles%\Debugging Tools for Windows (x86)
    4. Open the WindDbgTool
      image
    5. Symbol data
      to view internals of assemblies you need symbol data the easiest way is to have it downloaded automatically. you can do that by
      image
      and typing in

      srv*c:\symbols\public*http://msdl.microsoft.com/download/symbols
       
      image

      just make sure you have internet connection so this can be downloaded.
    6. Get a Memory Dump of your application
      well this is another 3 step tutorial
      .
    7. Open the Dump
      ”File”->”Open Crash dump” (if prompted you don’t have to save.)
      select the file and wait for the application to be ready
      image 

      this is actually an option i like as attaching to the process causes the application to be extremely slow and you can always ask your client to create a dump and FTP it to you
    8. you need to load “SOS”
      in the previous window the text box in the bottom is where you’ll type in commands.
      the first you need is to load SOS

      so type in
      .load SOS
      AND NOTHING HAPPENS, yes there’s no confirmation that the thing was loaded.

    9. your first Command
      now there’s a whole bunch of commands that can be executed from the SOS you can list all these commands by typing in
      !sos.help
    10. need help
      and now you can explore the memory dump of your application on your own just consider the hints in the next box.

      //!SOS.help <methodName>
      
      !SOS.help DumpDomain
      
      !SOS.DumpDomain



This is just a quick help to get you started. if you need to understand what’s behind this please refer http://blogs.msdn.com/tess/  thank you Tess for the time

by amir.magdy | 1 comment(s)
Filed under: , ,
Fastest way for Creating a memory Dump of your application [DebugDiag]
Sunday, May 17, 2009 11:37 PM
  1. First you need to download the tool here is the link
  2. now just install the tool and run it
  3. then ignore the wizard and go to the third tab in the application UI
    image

right click your process and select create a full dump, the dump is going to be created

now if you need to configure where these dumps are created go to tools –> options and configure the dumps folder.

by amir.magdy | 2 comment(s)
Filed under: , ,
JSON Serialization in AJAX.net both Client side and Server side
Tuesday, April 14, 2009 6:34 AM

JSON objects representations are small and lightweight compared to XML they are now the core of AJAX.net services serialization. in AJAX.net they work out of the box

you can serilaize/deserialize  your objects to JSON using this snippet of server side code

using System.Web.Script.Serialization;
JavaScriptSerializer jss = new JavaScriptSerializer();
//Serialize
jss.Serialize(object);
//Deserialize
yourCustomType result = jss.Deserialize<yourCustomType>(yourJSONString);

 

and on the client side you can do the same as long as you have a script manager in your page

// Serialization
var jsonString= Sys.Serialization.JavaScriptSerializer.serialize(JSObject);
//deserialization 
var JSObject= Sys.Serialization.JavaScriptSerializer.deserialize(jsonString);
AL.exe error when compiling in Visual Studio 2008
Tuesday, March 10, 2009 4:48 AM

when i first Installed Visual Studio 2008 Team system i was trying to compile the application i just migrated from visual studio 2005

and i got the error

 

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1950,9): error MSB3011: "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\AL.exe" was not found. Either 1) Install the .NET Framework SDK, which will install AL.exe. Or 2) Pass the correct location of AL.exe into the "ToolPath" parameter of the AL task.

Solution 1 :

the fix is simple you need to download the AL.exe as part of the SDK you can find it here 

Solution 2 :

or you can download a zip file that i have copied from another computer which has the SDK i have included the files here 41Kb

copy that to your SDK folder as you have installed visual studio it’s already created so copy the two files from the zip to this path

C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

and then you have to update the registry of its location

so

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows]
"CurrentIA64Folder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v5.0\\"
"CurrentIA64Version"="v5.0"
"CurrentInstallFolder"="C:\\Program Files\\\\Microsoft SDKs\\Windows\\v6.0A\\"

 

copy the previous code snippet to a new text file called “newfile.reg” double click it

you may have to restart visual studio for it to work

visual studio 2008 Team System setup a problem encountered while loading the setup components canceling setup
Tuesday, March 10, 2009 4:27 AM

i wanted to install an additional feature of Visual studio 2008 but when i started the setup process or tried to uninstall the application i got this error

“Setup a problem encountered while loading the setup components. Canceling setup.”

the Fix

i went to check for fixes under that application uninstalled it and the the setup worked fine

by amir.magdy | with no comments
Filed under: , ,
Dynamically create domain users
Tuesday, February 10, 2009 2:14 AM

My Team was planning a Stress test scenario to be run on our stress lab, the application we were planning to test needed windows authentication to function.

The plan was to create a set of users with predefined passwords and add them to the domain so the application can be tested correctly. We used VBscript that creates the users from a database table this is the code used.

Dim aConnectionString
aConnectionString = "Provider=SQLOLEDB;Data " _
& "Source=srvr;Database=UrDataBaseName;" _
& "UID=usr; PWD=psw;"
Dim conn,R,SQL,RecsAffected
'connect to database
Set conn=CreateObject("ADODB.Connection")
conn.Mode =3
conn.ConnectionString = aConnectionString
conn.Open
Dim strCommand
Dim Users,comm,UsersCommandText
Set comm=CreateObject("ADODB.Command")
comm.ActiveConnection =conn
UsersCommandText= "SELECT [UserName] from [Users]"
comm.commandtext= UsersCommandText
Set Users = Comm.Execute
' this is like assigning 
' a reader with the result set
' only here it's called a recordset
If Not (Users.Eof and Users.Bof ) Then
Users.MoveNext
While Not Users.EOF
  
  Dim strUser
  Dim objRootLDAP, objContainer, objNewUser
  strUser = Users("UserName")
  
  ' Bind to Active Directory, Users container.
  Set objRootLDAP = GetObject("LDAP://YourDomainName")
  Dim defaultContext  
  defaultContext = "DC=YourDomainName,DC=com" 
  Set objContainer = GetObject("LDAP://cn=Users," & defaultContext  ) 
  ' now this is the container that you are going to use
  
  ' now you can Build the actual User.
  Set objNewUser = objContainer.Create("User", "cn=" & strUser)
  objNewUser.Put "sAMAccountName", strUser
  objNewUser.AccountDisabled=False  
  objNewUser.setpassword "123"
        objNewUser.SetInfo 
  
  Set objNewUser = objContainer.GetObject("User", "cn=" & strUser)
  objNewUser.AccountDisabled=False
  objNewUser.SetInfo   
  
  MsgBox (Users("UserName")) 
  ' seriously don't do this if u have a few hundred users
  Users.MoveNext
Wend
End If
conn.Close
by amir.magdy | 1 comment(s)
Filed under: ,
More Posts Next page »