 |
Friday, 13 February 2009
Fix Exchange 2007 OWA
|
Had a problem with Exchange recently which required me to fix the security settings for all the IIS virtual directories for Exchange 2007 web access. To fix i had to remove and then re-install the Client Access Server role. The following article outlines how to do this not just with 2007 but also with 2000 and 2003:
http://support.microsoft.com/kb/320202
To summarise, open command prompt and enter the following commands (One at a time):
- exsetup.exe /mode:uninstall /roles:ca
- exsetup.exe /mode:install /roles:ca
Cheers, James
|
Saturday, 31 January 2009
Flash Actionscript CS3 Tween Brightness
|
Onto Flash now. After a lot of searching and dead ends (And flash CS3 docs giving code for AS2!) i finally figured out an easy way to tween brightness of an object. As this uses the Colour (Color) matrix transformations this also applied to colour tweening.
The Method:
Perform a tween on a new object, and set it to tween an arbitrary property. Set the easing and brightnes values (between 0 for dark and 255 for light), and timings as needed. Then add a listener for TweenEvent.MOTION_CHANGE. Within this event we build a brightness colour matrix using the current tween position and apply to the mc.filters array!
The Code:
import fl.transitions.Tween; import fl.transitions.TweenEvent; import fl.transitions.easing.*; import flash.filters.ColorMatrixFilter;
var tw:Tween = new Tween(new Object(),"x",None.easeNone,200,0,5,true); tw.addEventListener(TweenEvent.MOTION_CHANGE, function(e:TweenEvent):void { var val:Number = e.position; var brightness_array:Array = [1, 0, 0, 0, val, 0, 1, 0, 0, val, 0, 0, 1, 0, val, 0, 0, 0, 1, 0]; mc.filters = [new ColorMatrixFilter(brightness_array)]; });
I hope this helps someone out there!
Cheers, James
|
Monday, 13 October 2008
Devsta 2008 Gadget
|
Hello again,
Since entering into the Devsta challenge 2008, i have been watching the devsta Vista sidebar gadget and waiting for it to countdown the draw results. Instead i have been watching 00:00:00:00!
Well not anymore! I have modified the gadget to actually countdown the draw (well, until 8AM on 29th October). I have also modified it so that it actually displays the correct icon in the gadget pane, and when dragging onto the sidebar. You can download from the following URL (Its safe, i promise):
Devsta Gadget Download
Now you can sit and wait and watch the countdown!!
cheers,
James
|
Tuesday, 7 October 2008
Microsoft Devsta 2008 submission - Ataye Ascii Image Viewer - 5th Place!!
|
UPDATE: Well i came in at 5th place, and wn $2000 worth of prizes, i'm pretty chuffed :D
Its been a while since i've updated this blog so I am finally updating with my entry in the Microsoft Devsta 2008 competition.
In keeping with the old school demo and graphics scene, i have created an ascii image viewer. It takes you back to the old image rendering method of using text to display graphics.
It is also complete with an ascii based intro / demo.
Whats different about this?? It take an 'old school' methodology and re-creates it using new cool technologies like GDI+ with Visual Studio 2008.
Lets see how it goes :O)
|
Monday, 31 December 2007
HttpListener using SSL
|
I have been trying for a while to get the HttpListener to work with SSL (vs2005 on XP SP2) and finally i got a break through. All info i've found so far points to making a certificate and using httpcfg to bind the certificate to the given prefix endpoint. I followed instructions but still it would not work (see link below, this was most helpful):
http://answers.google.com/answers/threadview?id=735306
(btw, dont change 0.0.0.0: to your ip address, leave it as is ;)
So after looking into the MSDN docs some more and playing with the httpcfg tool i found i needed to not only bind the certificate to the endpoint but also to the application. You do this by passing the applications GUID to the set ssl command!!
Following are some commands i used to figure things out a bit:
httpcfg query ssl <-- get a list of bound certificates
and found the guid empty. So i deleted any bound certificates:
httpcfg delete ssl -i 0.0.0.0:90
Then re issued the httpcfg set ssl command and specified the GUID from my vs2005 projects AssemblyInfo.cs, under [assembly: Guid("xxx")] as in:
httpcfg set ssl -i 0.0.0.0:8585 -c "MY" -g {E27BC593-0E2b-4043-AA07-1DBAFD724990} <-- App GUID -h 99F065C41348FBFB261E959C1A76892E91176999 <-- Cert footprint
Then i reran my app and it worked (it complained about an invalid certificate, but it is a test certificate)!!
Now this is a bit interesting: I moved my certificate from LOCAL_MACHINE\Trusted Root Certification Authorities\Certificates into LOCAL_MACHINE\Personal\Certificates before i used httpcfg. This seems contrairy to previous advice of leaving it in Trusted Root store but i guess this is because im running on my dev machine, not prod server!!
I hope this sheds some light on using HttpListener with SSL.
cheers James
|
Sunday, 28 October 2007
Using Clientside Validator
|
Hello,
To use the client side validator you first need to add one to your page. Then in html view add a new javascript method as follows: (Im using the dotnet v2.0)
< script type="text/javascript"> function ValidateClientItem(sender, args) { var sMyVal = args.Value;
if (sMyVal != sValidString) { args.IsValid = false; return; } args.IsValid = true; } </script>
Then, set the ClientValidationFunction property of the custom validator to the name of the function, in this case 'ValidateClientItem'. You dont need to set ControlToValidate if you dont want, but you wont be able to use args.Value.
Thats all there is to it. When the client form is submitted, the validator is called and will in turn call your client side javascript method. Setting args.IsValid to false cancels the form submit and displays the validator error message.
Happy coding,
James
|
Thursday, 25 October 2007
ASP.Net secure (or unsecure) parts of a site using web.config
|
Hello,
To secure my dotnet sites i like to use the built-in authorization module of dotnet using the login control. I usually set the main web.config to allow="*" and deny="?" and by setting the authentication mode="Forms" and supplying a loginUrl="~/Login.aspx" (or some other login page) sends the user to the login page if they havn't already logged in, thus requiring authentication before access the site.
The problem with this is having the web.config sitting in the root of the site and denying all unauthorized users. This now secures *everything* including stylesheets and images etc. To get around this you can specify security exclusions in the web.config file using the location node.
Heres a sample:
< configuration> <system.web> <authentication mode="Forms"> <forms name="SiteLogin" loginUrl="~/Login.aspx"/> </authentication> <authorization> <deny users="?"/> <allow users="*"/> </authorization> </system.web>
< location path="SiteStyle.css"> <system.web> <authorization> <allow users="?" /> </authorization> </system.web> </location>
<location path="images"> <system.web> <authorization> <allow users="?" /> </authorization> </system.web> </location> <configuration>
The above is the web.config which sits in the root of the site. The two location nodes specifies that anonymous users can access the SiteStyle.css file and all files within the images folder!
Cheers,
James
|
Tuesday, 9 October 2007
How to return identity after doing an Insert with ADODB and Classic ASP.
|
Hello,
Today i thought i'd share an easy way to return an identity after doing an insert with classic ASP and the ADODB object.
Basically we open a connection and perform actions on the open connection, then close when we are finished. By keeping the connection open we are re-using the same session. Following is a code listing.
Dim cnn, rsPK, sSql, iTablePK
' Open a connection: Set cnn = Server.CreateObject("ADODB.Connection") cnn.Open ConnString
' Perform the insert into our table: sSql = "INSERT INTO tbOrderDetails (FKOrderID, TourCode) values (1, 'Code')" cnn.Execute sSql, , adCmdText + adExecuteNoRecords
' Retrieve the identity: set rsPK = Server.CreateObject("ADODB.Recordset") rsPK.Open "SELECT @@Identity", cnn, 0, 1, 1
' We now have the new record PK in iTablePK! if (not rsPK.EOF) then iTablePK = rsPK(0) end if
' Clean up: cnn.close set cnn = nothing
So, we open a connection and while we keep it open we perform the insert into the table with the identity field. We then select the new table field using @@identity. Keep in mind @@identity is GLOBAL to the connection, meaning it will return the latest identity regardless of where the insert occured!! (i.e. table trigger performing an insert). To be safer you could use the SCOPE_IDENTITY() method, which is LOCAL to the table.
Ok, i hope this helps.
Cheers, James
|
Monday, 1 October 2007
How to return identity after insert using DotNET Sql Data source without using Stored Procedure
|
Here is a little trick i use to return the identity from a PK column after doing an insert with the Sql Data source component. Since this is done at the data source level it can be used with any databound control like the FormView, DetailsView or any other 2-way databound control.
To make this happen just do the following:
- Enter your insert command and setup your datasource for inserting.
- Append to the end of the insert (this can be done in the Source view of the page) the following:
-
; select @PK=SCOPE_IDENTITY();
- Now add a new parameter to the <InsertParameters> node of the SqlDataSource (Change the datatype to match):
-
< asp:Parameter Name="PK" Direction="Output" Type="Int16" />
- No you can access the new PK value in the 'Inserted' event after the data has been inserted eg:
-
this .Response.Write(e.Command.Parameters["@PK"].Value.ToString());
So what happenes is after the insert the sql sets the new identity to the parameter @PK which is declared on the data source as an output parameter. Then the value can be read after the insert through the Inserted event.
I hope this helps.
Happy coding.
|
Thursday, 13 September 2007
My First Post
|
Hello,
This is my first post to what hopefully should be the beginning of something special!!
Cheers,
James
|
|
|
 |