Friday, November 06, 2009

ASP.NET Silverlight 3 Web Service integration DRAFT


Development Environment

Dell Laptop

.Net Framework 3.5 SP1

Visual Studio.Net 2008 SP1 (Team System Developer, Tester, Database)

Silverlight 3.0

Fiddler 2

SQL Server Management Studio 2008 SP1

Alpha/Dev Web Server

Windows Server 2003 Standard Edition SP2

           
IIS v 6.0

Alpha/Dev SQL Server 2005 - databases (2) are 2000 compatible library

Existing Production Application

“Transcript Currier”

ASP.NET 2.0 (VB) Web Application

           
SQL Server 2000

The existing system:

User Type: Customer

1.     
"Login" Page - customer logs in

2.     
"Jobs List" Page - customer chooses a job or creates a
new one

3.     
"Customer Upload" page

a.      
Fill out the basic job information

b.     
Identify the number of transcripts within the job
(GridView Control)


                                                  
i.     
Transcript Header (auto-generated <JobNumber>An)


                                                
ii.     
Case Number, Description, Copies (user input)

c.      
Pick a transcript header (dropdown control) and
associate a file (file upload control) - 10 static control sets

d.     
Process the Job (click button control)


                                                  
i.     
validation run

1.     
required fields

2.     
valid business dates

3.     
check file type (usually audio)


                                                
ii.     
moves the files to File Server via virtual directory on
Web Server IIS Site


                                               
iii.     
compresses files into a <project code directory>/<job
number directory>\<job number>.zip file


                                              
iv.     
processes the job details in database posting compressed
file path for transcriptionists to pick up work

The desire is to modify the existing application to

1.     
replace 10 static control sets with one control set
(transcription header dropdown and file picker)

2.     
allow the user to select multiple files from various
location

3.     
present a list of properly associated files <job number>
<transcript header> and <files>

4.     
 compress files or
take a compressed file <job number>.zip {<transcript header directory>\<fiels>}

5.     
transfer compressed file to the File Server via virtual
directory on Web Server IIS site (as is done now)

The Silverlight User Control as I have it outlined now is a replacement for the
static dropdown/file upload control set and contains a ComboBox, a filepicker,
two textblocks, and a button.


·       
ComboBox – select the transcript header
aka CaseFileName


·       
FilePicker – choose the file(s) from your machine
(may be done repeatedly)


·       
TextBlock1 – display the files picked


·       
TextBlock2 – display the files existing/selected
for the transcript


·       
Button – Upload the files

In the current outlined work flow, when the user is done they’ll process the job
details

I’ve got four issues when I actually tie the tools together at this moment.

  1. Silverlight ComboBox does not populate
  2. Silverlight intermittently spits up
    cross-domain policy soap errors
  3. Silverlight upload file(s) – splits file(s) into small
    packages and moves to the file server – appears to be spawning multiple threads
    resulting in file write conflict errors
  4. The UI looks atrociously worse than it did before – which is
    saying a lot.

So as always, I’ve decoupled the scenarios to try to get to the base issues.

  1. Silverlight ComboBox does not populate

http://10.1.251.62/ys2005web/TestSilverlightControl1.aspx

http://10.1.251.62/ys2005web/SlC1WebService.asmx

SlC1WebService




Click here for a complete list of operations.

GetTranscriptHeaderRecords


Test


The test form is only available for requests from the local machine.

SOAP 1.1

The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.


POST /ys2005web/SlC1WebService.asmx HTTP/1.1
Host: 10.1.251.62
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://10.1.251.62/ys2005web/GetTranscriptHeaderRecords"
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetTranscriptHeaderRecords xmlns="http://10.1.251.62/ys2005web/">
      <jobNumber>int</jobNumber>
    </GetTranscriptHeaderRecords>
  </soap:Body>
</soap:Envelope>

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetTranscriptHeaderRecordsResponse xmlns="http://10.1.251.62/ys2005web/">
      <GetTranscriptHeaderRecordsResult>
        <vwTranscriptHeaderRecords>
          <CaseNo>string</CaseNo>
          <Copies>string</Copies>
          <Description>string</Description>
          <Dumped>boolean</Dumped>
          <Filename>string</Filename>
          <JobNumber>int</JobNumber>
        </vwTranscriptHeaderRecords>
        <vwTranscriptHeaderRecords>
          <CaseNo>string</CaseNo>
          <Copies>string</Copies>
          <Description>string</Description>
          <Dumped>boolean</Dumped>
          <Filename>string</Filename>
          <JobNumber>int</JobNumber>
        </vwTranscriptHeaderRecords>
      </GetTranscriptHeaderRecordsResult>
    </GetTranscriptHeaderRecordsResponse>
  </soap:Body>
</soap:Envelope>



SOAP 1.2

The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.

POST /ys2005web/SlC1WebService.asmx HTTP/1.1
Host: 10.1.251.62
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetTranscriptHeaderRecords xmlns="http://10.1.251.62/ys2005web/">
      <jobNumber>int</jobNumber>
    </GetTranscriptHeaderRecords>
  </soap12:Body>
</soap12:Envelope>

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetTranscriptHeaderRecordsResponse xmlns="http://10.1.251.62/ys2005web/">
      <GetTranscriptHeaderRecordsResult>
        <vwTranscriptHeaderRecords>
          <CaseNo>string</CaseNo>
          <Copies>string</Copies>
          <Description>string</Description>
          <Dumped>boolean</Dumped>
          <Filename>string</Filename>
          <JobNumber>int</JobNumber>
        </vwTranscriptHeaderRecords>
        <vwTranscriptHeaderRecords>
          <CaseNo>string</CaseNo>
          <Copies>string</Copies>
          <Description>string</Description>
          <Dumped>boolean</Dumped>
          <Filename>string</Filename>
          <JobNumber>int</JobNumber>
        </vwTranscriptHeaderRecords>
      </GetTranscriptHeaderRecordsResult>
    </GetTranscriptHeaderRecordsResponse>
  </soap12:Body>
</soap12:Envelope>



B. The Silverlight Control


Imports

System.Diagnostics


Imports

System.Windows.Browser


Partial

Public Class
SilverlightControl1


   
Inherits UserControl


   
Public Sub
New()


       
InitializeComponent()


   
End Sub


   
Public Sub
New(ByVal
JobNumber As String)


       
InitializeComponent()


       
cboTranscriptHeader_Load(JobNumber)


   
End Sub


   
'
-------------------------------------------------------------------------------------


#Region

"** event handling"


   
Protected Sub
cboTranscriptHeader_ItemSelected( _


       
ByVal sender As
Object, _


       
ByVal e As
SelectionChangedEventArgs) Handles
cboTranscriptHeader.SelectionChanged


       
Debug.Assert(sender IsNot
Nothing, "sender is
null."
)


       
Debug.Assert(e IsNot
Nothing
, "e is null.")


       
If cboTranscriptHeader.SelectedItem
Is Nothing
Then


           
Return


       
End If


       
'Note: "Transcript Header Id"
(WebDumper.dbo.CustomerUploadFiles.CaseFileName)


       
Dim TranscriptHeader As
String =
Convert.ToString(cboTranscriptHeader.SelectedItem)


       
'ToDo: Code required when a Transcript Header Id is
selected


       
'   A
specific Customer Job have one Job Header Record (DB: WebDumper TBL:
CustomerUploadHeader)


       
'  
Each Customer Job has one or more Transcript Header Records (DB: WebDumper TBL:
CustomerUploadFiles)


       
'  
Each set of uploaded files should reside in a direcory named after the
Transcript Header Id


       
'  
All the Transcript Header Id Directories should be complessed into a single file
named by the "Job Number" 


       
'  
Direcory Structure:


       
'      
"Project Code" (dir)


       
'      
-->  "Job Number" (dir)


       
'      
-->  -->  "Job Number".ZIP (compressed file)


       
'      
-->  -->
 --> 
"Transcript Header Id" (dir)


       
'      
-->  -->  --> 
-->  *.* (audio and text
files)


   
End Sub


   
Public Function
BuildAbsoluteUri(ByVal relativeUri
As String)
As Uri


       
' Get current absolute Uri; this depends on where the
app is deployed


       
Dim uri1 As Uri
= System.Windows.Browser.HtmlPage.Document.DocumentUri


       
Dim uriString As
String = uri1.AbsoluteUri


       
' Replace page name with relative service Uri


       
Dim ls As Int32
= uriString.LastIndexOf("/"c)


       
uriString = uriString.Substring(0, ls + 1) + relativeUri


       
' Return new Uri


       
Return New
Uri(uriString, UriKind.Absolute)


   
End Function


   
Private _jobNumber As
Nullable(Of Integer)


   
Public Property
jobNumber() As Nullable(Of Integer)


        Get


           
Return _jobNumber


       
End Get


       
Set(ByVal value
As Nullable(Of
Integer))


           
_jobNumber = value


       
End Set


   
End Property


   
Private Sub
MainPage_Loaded(ByVal sender
As Object,
ByVal e As
System.Windows.RoutedEventArgs) Handles
Me.Loaded


       
Debug.Assert(sender IsNot
Nothing, "sender is
null."
)


       
Debug.Assert(e IsNot
Nothing
, "e is null.")


       
HtmlPage.RegisterScriptableObject("SilverlightComponentOne",
Me)


       
'' 
Scriptable Member accessible by JavaScript/Ajax and Silverlight interface


       
''  
loadtranscriptheaderdropdownlist(jobNumber)


   
End Sub


    <ScriptableMember()> _


   
Sub cboTranscriptHeader_Load(ByVal jobnumber As
String)


       
'ToDo: A cleaner way to go from String to Nullable
Integer?


       
Dim _value As
Integer


       
If Integer.TryParse(jobnumber,
_value) Then


           
_jobNumber = _value


       
Else


           
_jobNumber = Nothing


       
End If


       
Dim ws As
SilverlightApplicationUploader.SLC1WebService.SlC1WebServiceSoapClient = _


          
New
SilverlightApplicationUploader.SLC1WebService.SlC1WebServiceSoapClient()


       
Dim request As
New
SLC1WebService.GetTranscriptHeaderRecordsRequest(Me.jobNumber)


       
AddHandler
ws.GetTranscriptHeaderRecordsCompleted, AddressOf
ws_GetTranscriptHeaderRecords


       
ws.GetTranscriptHeaderRecordsAsync(request)


   
End Sub


   
Private Sub
ws_GetTranscriptHeaderRecords(ByVal sender
As Object, _


       
ByVal e As
SLC1WebService.GetTranscriptHeaderRecordsCompletedEventArgs)


       
Me.cboTranscriptHeader.Items.Clear()


       
For Each record
As
SilverlightApplicationUploader.SLC1WebService.vwTranscriptHeaderRecords
In e.Result.GetTranscriptHeaderRecordsResult


           
Me.cboTranscriptHeader.Items.Add(record.Filename)


       
Next


   
End Sub


#End

Region '"** event
handling"


   
''
-------------------------------------------------------------------------------------


End

Class

C. The client config


<?
xml
version="1.0"
encoding="utf-8" ?>


<
configuration>


  <
system.serviceModel>


    <
bindings>


      <
basicHttpBinding>


       
<
binding

name="SlC1WebServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"


           

receiveTimeout="00:10:00"
sendTimeout="00:01:00"


           

maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"


           

textEncoding="utf-8" >


         
<
security

mode="None"/>


       
</
binding>


      </
basicHttpBinding>


    </
bindings>


    <
client>


      <
endpoint

address="http://localhost:2443/SlC1WebService.asmx"


         

binding="basicHttpBinding"
bindingConfiguration="SlC1WebServiceSoap"


           

contract="SLC1WebService.SlC1WebServiceSoap" name="SlC1WebServiceSoap" />


    </
client>


  </
system.serviceModel>


</
configuration>

D. The Silverlight Control xaml


<
UserControl x:Class="SilverlightApplicationUploader.SilverlightControl1"


  
 xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"


  
 xmlns
:x="http://schemas.microsoft.com/winfx/2006/xaml"


           
 xmlns:data="clr-namespace:SilverlightApplicationUploader.SLC1WebService"


  
 Width
="400" Height="300">

   
<UserControl.Resources>

       


<
Style x:Key="ControlBorder"
TargetType
="Border">

           


<
Setter Property="BorderThickness"
Value
="3" />

           


<
Setter Property="Background"
Value
="#FFC2F5CB" />

           


<
Setter Property="BorderBrush"
Value
="#FF257004" />

           


<
Setter Property="CornerRadius"
Value
="6" />

           


<
Setter Property="Margin"
Value
="5" />

           


<
Setter Property="Padding"
Value
="5" />

       


</
Style>

       


<
Style x:Key="ControlTitle"
TargetType
="TextBlock">

           


<
Setter Property="FontSize"
Value
="14" />

           


<
Setter Property="HorizontalAlignment"
Value
="Center" />

           


<
Setter Property="FontFamily"
Value
="Courier New" />

           


<
Setter Property="FontWeight"
Value
="Bold" />

           


<
Setter Property="Foreground"
Value
="#FF1F6900" />

       


</
Style>

   
</UserControl.Resources>

   
<Grid x:Name="LayoutRoot"
Background
="White">

       


<
ScrollViewer>

           


<
StackPanel x:Name="_mainPanel"
Margin
="6" >

               


<
Border Style="{StaticResource ControlBorder}">

                   


<
StackPanel>

                       


<
TextBlock x:Name="DisplayTranscriptHeader"
Text
="TranscriptHeader" Style="{StaticResource ControlTitle}" />

                        <StackPanel Orientation="Horizontal"
Height
="50">

                           


<
ComboBox x:Name="cboTranscriptHeader"
Width
="80" Height="30"


                                    
 VerticalAlignment="Top" Margin="5"


                      
              
 SelectionChanged="cboTranscriptHeader_ItemSelected"


                                    
 ItemsSource="{Binding Mode=OneWay}" >

                               


<
ComboBoxItem Content="CaseFileNumber" />

                           


</
ComboBox>

                       


</
StackPanel>

                   


</
StackPanel>

               


</
Border>

           


</
StackPanel>

       


</
ScrollViewer>

   
</Grid>


</
UserControl>

E. The Application Class


Partial

Public Class App


   
Inherits Application


    public
Sub New()


       
InitializeComponent()


   
End Sub


   
Private Sub
Application_Startup(ByVal o
As Object,
ByVal e As
StartupEventArgs) Handles
Me.Startup


       
Dim JobNumber As
String = e.InitParams("JobNumber")


       
Me.RootVisual = New
SilverlightControl1(JobNumber)


   
End Sub


   
Private Sub
Application_Exit(ByVal o
As Object,
ByVal e As
EventArgs) Handles Me.Exit


   
End Sub


   
Private Sub
Application_UnhandledException(ByVal sender
As object,
ByVal e As
ApplicationUnhandledExceptionEventArgs) Handles
Me.UnhandledException


       
' If the app is running outside of the debugger then
report the exception using


       
' the browser's exception mechanism. On IE this will
display it a yellow alert


       
' icon in the status bar and Firefox will display a
script error.


       
If Not
System.Diagnostics.Debugger.IsAttached Then


           
' NOTE: This will allow the application to
continue running after an exception has been thrown


           
' but not handled.


        
   
' For production applications this error
handling should be replaced with something that will


           
' report the error to the website and stop the
application.


           
e.Handled = True


           
Deployment.Current.Dispatcher.BeginInvoke(New
Action(Of
ApplicationUnhandledExceptionEventArgs)(AddressOf
ReportErrorToDOM), e)


       
End If


   
End Sub


  
Private
Sub ReportErrorToDOM(ByVal e As
ApplicationUnhandledExceptionEventArgs)


       
Try


           
Dim errorMsg As
String = e.ExceptionObject.Message +
e.ExceptionObject.StackTrace


           
errorMsg = errorMsg.Replace(""""c,
"'"c).Replace(ChrW(13) & ChrW(10), "\n")


           
System.Windows.Browser.HtmlPage.Window.Eval("throw
new Error(""Unhandled Error in Silverlight Application "
+ errorMsg +
""");")


       
Catch


       
End Try


   
End Sub


End

Class

F. The Application xaml


<
Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"


           
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"


           
 x:Class="SilverlightApplicationUploader.App"


           
 >

   
<Application.Resources>

       

   
</Application.Resources>


</
Application>

G. The client access policy


<?
xml
version="1.0"
encoding="utf-8" ?>


<
access-policy>


  <
cross-domain-access>


    <
policy>


      <
allow-from

http-request-headers="*">


       
<!--
/*Specify
request headers like Content-Type,SOAPAction*/
-->


       
<
domain

uri="*"/>


      </
allow-from>


      <
grant-to>


       
<
resource

include-subpaths="true"
path="/"/>


      </
grant-to>


    </
policy>


  </
cross-domain-access>

</access-policy>

 

H. The cross domain policy


<?
xml
version="1.0"
encoding="utf-8" ?>


<
cross-domain-policy>


  <
allow-http-request-headers-from

domain="*" headers="*"/>

</cross-domain-policy>

I. The Web Service


<System.Web.Services.WebService(Namespace:="http://localhost:2443/")>
_


<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
_


<ToolboxItem(False)> _


Public

Class SlC1WebService


   
Inherits System.Web.Services.WebService


    <WebMethod()> _


    
Public Function
GetTranscriptHeaderRecords(ByVal jobNumber
As Global.System.Nullable(Of Integer))
As List(Of
vwTranscriptHeaderRecords)


       
'ToDo: Call this method from SL passing JobNumber and
Retreiving list of transcriptHeaders

 


       
Dim transcriptHeaders
As
New List(Of
vwTranscriptHeaderRecords)


 


       
Dim de As
New StenoMainEntities


 
       
' Execute the query and get the
ObjectQueryResult.


       
Dim TranscriptHeaderRecordsResult
As Objects.ObjectResult(Of vwTranscriptHeaderRecords) =
de.GetTranscriptHeaderRecords(jobNumber)


       
' Iterate through the collection of Product items.


       
Dim result As
vwTranscriptHeaderRecords


       
For Each result
In TranscriptHeaderRecordsResult


           
transcriptHeaders.Add(result)


       
Next


       
Return transcriptHeaders

   
End Function


End

Class


 
'''
<summary>

''' Parameter class

'''
</summary>


Public

Class Parameter


   
Private _Key As
String


   
Public Property
Key() As String


       
Get


           
Return _Key


       
End Get


       
Set(ByVal value
As String)


           
_Key = value


       
End Set


   
End Property


   
Private _Value As
String


   
Public Property
Value() As String


       
Get


           
Return _Value


       
End Get


       
Set(ByVal value
As String)


           
_Value = value


       
End Set


   
End Property


End

Class

 A direct call of the data transcript function works - - - 


Public

Partial Class
TestGetTranscriptHeader


   
Inherits System.Web.UI.Page


   
Protected Sub
Page_Load(ByVal sender
As
Object, ByVal
e As System.EventArgs)
Handles
Me.Load


       
Dim jobNumber As
Nullable(Of Integer)
= 520124


       
Dim transcriptHeaders
As
New List(Of
vwTranscriptHeaderRecords)


       
Dim de As
New DBEntities


       
' Execute the query and get the ObjectQueryResult.


       
Dim TranscriptHeaderRecordsResult
As Objects.ObjectResult(Of vwTranscriptHeaderRecords) =
de.GetTranscriptHeaderRecords(jobNumber)


       
' Iterate through the collection of Product items.


       
Dim result As
vwTranscriptHeaderRecords


       
For Each result
In TranscriptHeaderRecordsResult


           
transcriptHeaders.Add(result)


       
Next


       
Response.Write("Results" & vbCrLf)


       
For Each result
In transcriptHeaders


           
Response.Write("-" & result.JobNumber
& ", " & result.Filename & vbCrLf)


       
Next


   
End Sub

End Class

Friday, October 09, 2009

Sync Yahoo iPhone/iPod Touch Calenders

http://blog.alltechrelated.com/2009/08/31/how-to-sync-your-yahoo-calender-with-your-iphoneipod-touchs-calender/

Yahoo finally posted an article explaining how users can sync their Yahoo calender with the calender on your iPhones. The process is rather simple but does require you to have the latest iPhone/iPod Touch firmware, OS 3.0.

You should also take note:

Once you start syncing your Calendar with your iPhone you will be upgraded to Yahoo! Calendar Beta automatically. You will not be able to go back to the old calendar product once this is complete.

Without furthur ado, here is the guide:

1.Open up the Settings application and navigate to Mail, Contacts, Calendars -> Add Account -> Other
2.Click on ‘Add CalDAV Account’
3.Where it says server, type in ‘Yahoo’.
4.Enter in your Yahoo username and password and click next.
Thats all there is too it. Your iPhone should now sync perfectly with your Yahoo calender.

Wednesday, September 30, 2009

Oracle 10g not for testing

Update 2009-10-01: If you run into the following story - you have to run Oracle 10 g on Windows Server 2003 R 2 - Use Oracle Database 10g Release 2 (10.2.0.1.0)

2009-09-28: Just a "quick" install of Oracle 10g Standard Edition (10.1.0.2.0) on a virtual server to test creation of a database from a template built off an existing oracle database instance on another server.

The installation reports a Java VM installation error "details in hs_err_pid.log" Update 2009-10-01: the log does not appear to exist on the machine D:\oracle\product\10.1.0\db_1\BIN\*.log.

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x77BD8FA7
Function=wcsncpy+0x16
Library=C:\WINDOWS\system32\MSVCRT.dll ...


The DBCA - Database Configuration Assistant works for every activity except when walking through the process of creating a database from a template... When Step 10 of 12 : Initalization Parameters is set to hit NEXT (good bye DBCA) - No Log, No Warning, Nothing - just a gone DBCA.

Attempt to reinstall the tool (installer - custom - show all - reinstall) provides you the same none descriptive Java VM installation error message.

Google searches on "Java VM installation error", "Oracle 10g installation error", "Database Configuration Assistant Crashes" leads one to believe this is a known bug in Java HotSpot VM - bug where is a simple to understand download/update of it?

The best that I can understand is that this is a known bug in Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode) that is causing the crash.

From what I see via Oracle and Sun – Java "Support" {build 1.4.2.x is very old – upgrade to a newer version}

I wonder where to get the newest build of 1.4.2.x, old from Sun’s perspective, but what Oracle 10g R1 is using.

http://www.oracle.com/technology/products/oraclenet/pdf/ADsupport_10g.pdf
Oracle® Database
Platform Guide
10g Release 1 (10.1) for Windows
Part No. B10113-02
June 2004

Section 3.2 Pg 51, 52

Creating a Database on Windows Using Database Configuration Assistant
Oracle recommends you use Database Configuration Assistant to create a database,
because it is easier. It offers the same interface and operates the same way on all
supported platforms, so no step-by-step procedures or screen shots are included here.
Database Configuration Assistant enables you to:
■ Create a Database
■ Configure Database Options in a database
■ Delete a Database
■ Manage Templates
An initialization parameter file is an ASCII text file containing parameters. It can be
used to create and modify a database using command-line tools. When you create a
database using Database Configuration Assistant, a server parameter file (SPFILE) is
created from the initialization parameter file, and the initialization parameter file is
renamed. Oracle does not recognize the renamed file as an initialization parameter file,
and it is not used after the instance is started.
If you want to modify an instance created with Database Configuration Assistant after
it starts up, you must use ALTER SYSTEM statements. You cannot change the SPFILE
itself, because it is a binary file that cannot be browsed or edited using a text editor.
The location of the newly-created SPFILE is ORACLE_BASE\ORACLE_
HOME\database. The SPFILE filename is spfileSID.ora.
See Also: "Managing Initialization Parameters Using a Server
Parameter File" in Oracle Database Administrator's Guide

Saturday, September 12, 2009

FileUpload failed in Firefox worked in IE6, IE7, IE8

I am not a graphics designer and most of what I consider to look professional and clean is not what is approved for a web based user interface. It was therefor a massive pain in my rear end to take a mess of hobbled together presentation that started very clean and concise from an extremely good web designer and was completely mucked up by stakeholders into a CSS 2.1 compliant presentation that looked consistent on IE 6, IE 7, IE 8 and Firefox.
Getting the presentation right for Firefox handled IE 7 actually, but took a lot of work and only minor modification via conditional overriding CSS sheets was needed for IE 8 and IE 6.
The thing was, we found that one particular piece of functionality, an ASP.NET 2.0 Web Application FileUpload process was not working in Firefox.

The cause was the rendering of the HTTPInputButton used to trigger the FileUpload clicked event. The original code which works fin in IEs was

<input type="button" runat="server" id="btnUpload" value="Upload File" onclick="this.disabled=true; this.value='Sending...'; document.aspnetForm.submit();" />

The fix was to switch to call this.click; which renders as a _doPostBack method in IE 6,7,8 and Firefox 3.5.x browsers

<input type="button" runat="server" id="btnUpload" value="Upload File" onclick="this.disabled=true; this.value='Sending...'; this.click;" />

I’ve found a lot of resizing issues to cope with, but at least the functionality is back on track.

Silverligt 3 ComponetOne ASP.NET 2.0 Integration

Silverlight 3 requires user-initiation for opening file dialogs operations
User-initiated operations in Silverlight by Ashish Shetty On Saturday, May 09, 2009

Silverlight 3 will not honor user-initiated operations that start from an HTML element, have a JavaScript handler which calls into a Silverlight scriptable API or other such endpoint.

Which means a completely natural integration of a Muliple File or File Part upload tool such as ComponentOne's Silverlight Uploader into a click event on an existing ASP.NET 2.0 web application to meet user requirements will require rethinking, rewriting and probably more steps for the user than the stakeholder wants the user to take, unless I pull together a credible workaround that does not require knowledge and/or action on the part of the user.

So currently a user clicks an ASP.NET 2.0 Web Application Page GridView Record Button which should launch Silverlight 3.0 ComponentOne Silverlight Uploader process which would open one or many files, load and catalog them. Of course, this throws the "User-Initiated" SecurityException.
If however you click a button in the embedded silverlight panel the process works and the presentation works.
The original design was ten upload inputs with an associated drop down list to pick the associated transcript header record (GridView Record) waiting at the bottom of the page.
It appears I'll have to keep that design, with a dropdown list and button within the Silverlight panel and do the presentation by transcript header record.
It still seems chunky - unclean - to me.

Thursday, September 10, 2009

ASP.NET Session state is not available in the current context

I actually ran into the issue discribed in Siderite Zackwehdex's Blog: Session state is not available in the current context

An almost duplicate reprint of his article with my own specific account wired in follows ...

An ASP.Net web site that was recently switched to ASP.Net 3.5 and is suddenly returning "Sys is undefined"
Upon entering the url of the offending item into the browser address bar the ASP.Net error page displays "Session state is not available in this context.".

The reason - in global.asax - code was attempting to work with Session.
The error was returned by the Session property of the HttpApplication object, the one that the global.asax file represents!

First mistake: there was Session property available and it was immediately assumed that is the same as Page.Session or HttpContext.Current.Session. While the HttpApplication Session is nearly identical, it throws an error if the underlying Session object is null.

Ok, but why is Session null? You are a smart .Net developer and you know that the Session should be available in that event. Any documentation says so! Well, yes, but it applies to your page, not to all the IHttpHandler implementations, like the ScriptResource.axd! The css and image problems only occured for me only when seeing the site in Cassini, not in IIS, so maybe it opens separate threads to load those resources and ignores the session or something, at least at that level.

Well, how does one fix it? Adding in global.asax a condition on Session not being null throws the same error. Ok, then add it on HttpContext.Current.Session. In other words:

if (HttpContext.Current.Session!=null) //do stuff with sessions.

Maybe this problem occurs in other places as well, but only the Session property of the HttpApplication will throw the "Session state is not available in this context." error.

Wednesday, July 29, 2009

ASP.NET 3.5 WebConfigurationManager

ASP.NET 3.5 Web Project Connection Strings
This is just a quick sample of how to get a connection string in an ASP.NET 3.5 Web Project.
Assuming you've set up a Project Application Setting of Type (Connection String) you would have the following settings throughout.
References include
System.Configuration (c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll)
Web.Config includes
<configuration>
<!-- ... More Stuff ... -->
<connectionstrings>
<add name="DatabaseConnection" connectionstring="Data Source=SQLServerName;Initial Catalog=DatabaseName;Uid=SQLLogin;Pwd=pa$$w0rd;">
</connectionstrings>
<!-- ... More Stuff ... -->
</configuration>
Code Behind Includes
private sub RunStoredProcedureSample()
    Using SqlClientConnection As New SqlConnection(WebConfigurationManager.ConnectionStrings("DatabaseConnection").ConnectionString())
        If Not SqlClientConnection.State = ConnectionState.Open Then
            SqlClientConnection.Open()
        End If
        Using SqlClientSqlCommand As New SqlCommand("spDoSomthing", SqlClientConnection)
            With SqlClientSqlCommand
                .CommandType = CommandType.StoredProcedure
                With .Parameters
                    .Clear
                    .AddWithValue("@Param1", Convert.ToString(Session("Something")))
                    .AddWithValue("@Param2", Something2)
                    .AddWithValue("@Param3", Convert.ToString(Session("ESomething3")))
                    .AddWithValue("@Param4", Something4)
                End With
                .ExecuteNonQuery()
            End With
        End Using
    End Using
End Sub
This has been the recommended way to deal with getting settings since .Net 2.0 but as most developers, I kept writing .NET 1.0 and/or .NET 1.1 based code even in .Net 2.0.
I know of entire .NET 2.0 certification programs instructed by individuals who have no working or academic experience actually using the .NET 2.0 framework specifications. Microsoft apparently is not concerned enough about the integrity of their certified training partners to enforce and/or police such things. Of course, if you have had the great misfortune of attempting to attend any of Microsoft’s “advanced” partner application and/or development webinars in the 2008/2009 sessions, you would have little doubt as to the lapse of quality control.
Anyway, since I cannot correct the system, maybe I can be of some assistance to others who are endeavoring to improve their own professional integrity through some small but often unaddressed basics that seem to always get lost in the discussions.
Now against the .NET 3.5 framework many of the deprecations have actually taken effect.

Monday, July 13, 2009

IIS ASP.NET Tab - No 3.x?

While preparing to publish a workaround to drop front page extensions, I ran into an interesting quandary which I found excellently explained in the following post from Rick Stahl's Web Log on March 24, 2008 @ 12:36 pm from Maui, Hawaii Where's my .NET 3.5 (on IIS), Dude? in which he explains why you wont see a ASP.NET version 3.x in IIS properties ASP.NET Tab.
I’m just thankful he is keeping notes.