Monday, August 28, 2017

Open Oracle dmp file and export to SQL DDL file

Problem:

Working a project to migrate a system off of Oracle and onto SQL Server.
The current host responded to my request for DDL with a dmp file!  The dmp
file is a binary format which is used by Oracle toolset to import and export database
content and structures.  The point being that without Oracle installed on a system
you cannot read this file.  Minor point we are not an Oracle shop and so do not
have the in-house expertise.  Say hello to Prof Google.


Solution:

1.) Download Oracle OracleXE112_Win64.zip.  Available on the Oracle site once you register.
2.) Install this onto your box
3.) Most likely will install at c:\oraclexe\app\oracle
4.) Get your dmp file (YourDBA.dmp)
5.) Place it into following location: c:\oraclexe\app\oracle\admin\xe\dpdump
Note: You can place this dmp file in another folder but you will be required to configure
the database settings.(https://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_overview.htm#SUTIL819)
6.) Start up a command prompt and navigate to directory: c:\oraclexe\app\oracle\product\11.2.0\server\bin
7.) Issue following command
impdp 'system/root AS SYSDBA' show=Y file=YourDBA.dmp


End result was the creation of the YourDBA.sql which gives us the file we wanted in the first place!


Reference:

  1. https://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_overview.htm#SUTIL819



Monday, August 21, 2017

ADFS 2.0 Token based Authentication Token Expiry





Token based Authentication Token Expiry

Tokens issued by AD FS 2.0 expire after a default time of 60 minutes. This requires users to be re-authenticated (for internal access) or to sign in again (for IFD access). The token lifetime is set separately for each relying party trust (internal and external).
To check the life time, complete the following steps on the AD FS 2.0 server:
  1. Check the names for the relying party trusts in the AD FS 2.0 Management Console and use the appropriate names in the following steps.
  2. Start Windows Powershell (use Run as Administrator).
  3. In Powershell, type Add-PSSnapin Microsoft.Adfs.Powershell.
  4. To view information for the internal relying party trust, type Get-ADFSRelyingPartyTrust –Name “CRM Internal Claims Relying Party”. Replace CRM Internal Claims Relying Party with the appropriate name for your ADFS configuration.
  5. Review the value for TokenLifetime. The value is measured in minutes.
  6. To change the value, type Set-ADFSRelyingPartyTrust –Targetname “CRM Claims Relying Party” –TokenLifetime newvalue where newvalue is the value in minutes.
  7. Repeat this process for the external (IFD) relying party trust.


Source:
  1. http://www.fkbase.info/node/163
  2. https://technet.microsoft.com/en-us/library/gg188586(v=crm.6).aspx
  3. https://samlman.wordpress.com/2015/03/01/setting-the-login-token-expiration-correctly-for-sharepoint-2010-saml-claims-users/
  4. http://stackoverflow.com/questions/23692326/adfs-2-0-microsoft-identityserver-web-invalidrequestexception-msis7042

Working with MVC5 and bootstrap DateTimePicker (eonasdan)


Issue:



Install-Package Bootstrap.v3.Datetimepicker.CSS



bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/bootstrap-datetimepicker.min.js",
                      "~/Scripts/respond.js"));

bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/bootstrap-datetimepicker.min.css",
                      "~/Content/site.css"));


<script type="text/javascript">
    $('#DateTest').datetimepicker(
        {
   //v3 turn off the time selector
            format: 'DD-MMM-YYYY'
            //pickDate: true                 //en/disables the date picker
           // pickTime: false,                 //en/disables the time picker
            //useMinutes: false,              //en/disables the minutes picker
           // useSeconds: false,              //en/disables the seconds picker
          //  startDate: moment().subtract('days', 1)// a minimum date

        });
</script>


Source:


https://blog.jigsawpieces.me/2014/07/23/lbd-adding-datetimepicker-control-to-mvc-project/
http://eonasdan.github.io/bootstrap-datetimepicker/Options/

date type IE-11 limitation




Working in MVC project and using different browser's, I ran into this issue with the date picker supported natively in Chrome but not in IE.


@Stephen Muecke pointed the reason of the problem:

Refer comparision here. The type="date" attribute is not supported in either IE-11 or FireFox-38 so you're out of luck for the time being.


@section Scripts {
    /* ... */
    <script type="text/javascript">
        /* ... */
        if (!Modernizr.inputtypes.date) {
            $('.datepicker').datepicker();
        }
    });

</script>



Source
https://stackoverflow.com/questions/31099367/datetime-picker-doesnt-appear-in-internet-explorer-and-firefox-with-bootstrap

C# date comparison MVC Razor

Issue:
I had a problem with a conditional test which was failing.  I was trying to compare two dates but the condition was not firing in my view.




claimPayments.Payment_Date.Value.ToString("dd-MMM-yyyy") == temp.ToString("dd-MMM-yyyy")


changed it to


claimPayments.Payment_Date.Value.Ticks.Equals(temp.Ticks)


This fixed the problem.  Using the ticks function gets around the issue of trying to match date formats.