How to generate pkcs12 certificate on windows?

Open a command prompt and go to the bin directory under the installation directory.

To create the private certificate type: “openssl genrsa –out private-key.pem 1024” and press [Enter].

For the public certificate type: “openssl req –new –key private-key.pem –x509 –days 365 –out public-cert.pem”
Now it will ask you to enter some information, you can just skip them by pressing [Enter].

Now we need to create the p12 file. Type the following in the prompt: “openssl pkcs12 –export –in public-cert.pem –inkey private-key.pem –out my_pkcs12.p12” followed by [Enter].


Reference: http://docs.ucommerce.net/ucommerce/v6/payment-providers/setup-paypal-standard-website-payments-as-a-payment-method.html
Thursday, 13 November 2014
Posted by Jebastin

Razor Code and Configuration for Umbraco Examine Search

Examine allows you to index and search data easily and wraps the Lucene.Net indexing/searching engine. Lucene is super fast and allows for very fast searching even on very large amounts of data. Examine is provider based so is very extensible and allows you to configure as many indexes as you like and each may be configured individually. Out of the box our UmbracoExamine library that is shipped with Umbraco gives you Umbraco based implementations for indexers and searchers to get started quickly.

Configuration:
 
Step 1: Open the ‘ExamineSettings.config’ file from the ‘config’ folder.
 
Step 2: Create a new Index Provider in the ExamineIndexProviders section:

<add name="MyIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"/>

Step 3: Create a new Search Provider in the ExamineSearchProviders section:

<add name="MySearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"/>

Step 4: Open the ‘ExamineIndex.config’ file from the ‘config’ folder.
Create a new Index Set in the ExamineLuceneIndexSets section:

<IndexSet SetName="MyIndexSet" IndexPath="~/App_Data/TEMP/MyIndex" />

Code:
 
@using Examine;
@{
  var searchTerm = Request.QueryString["search"];
}
<ul class="search-results">
  @foreach (var result in ExamineManager.Instance.Search(searchTerm, true))
  {       
    <li>
        <span>@result.Score</span>
        <a href="@umbraco.library.NiceUrl(result.Id)">
            @result.Fields["nodeName"]
        </a>       
    </li>   
  }
</ul>
Posted by Jebastin

Send Email in Umbraco

Instead using the ASP.Net email sending code, we can use the following code to send email in Umbraco web applications.

Web.Config Configuration:

Gmail SMTP Settings:

<system.net>
    <mailSettings>
      <smtp>
        <network
         host="smtp.gmail.com"
         port="587"
         userName="email@gmail.com"
         password="password"
         defaultCredentials="false"
         enableSsl="true" />
      </smtp>
   </mailSettings>
</system.net>

Yahoo Mail SMTP Settings:

<system.net>
    <mailSettings>
      <smtp>
        <network
         host="smtp.mail.yahoo.com"
         port="465"
         userName="email@yahoo.com"
         password="password"
         defaultCredentials="false"
         enableSsl="true" />
     </smtp>
   </mailSettings>
</system.net>

Razor:

if (IsPost) {
        library.SendMail("from@email.com", "to@email.com", "Subject", "Body", false);
    }
Thursday, 25 September 2014
Posted by Jebastin

Solved: Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list

It turns out that this is because ASP.Net was not completely installed with IIS even though I checked that box in the "Add Feature" dialog. To fix this, I simply ran the following command at the command prompt

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

If I had been on a 32 bit system, it would have looked like the following:

%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i
Reference: StackOverflow
Wednesday, 10 September 2014
Posted by Jebastin
Tag : ,

How to set/change the SQL Server 2008 R2 sa’s password after installation?

In this article we will take a look at how to change SA Password in SQL Server using TSQL code and by using SQL Server Management Studio. The steps mentioned in this article are applicable to change any SQL Server Login Password works on SQL Server 2005 and higher versions.

T-SQL Statement:

Use Master
Go

ALTER LOGIN [sa] WITH PASSWORD=N'JJSqlServer', CHECK_POLICY = OFF
Go



Monday, 8 September 2014
Posted by Jebastin

Generic Handler to Unpublish Past Events in Umbraco

The following Generic Handler (C#) is used to unpublish the past/old Events automatically after it's expiration date in Umbraco.

Source Code:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Configuration;
  6. using umbraco.MacroEngines;
  7. using umbraco.cms.businesslogic.web;
  8. namespace KPMGAudit.Web.GenericHandlers
  9. {
  10.     /// <summary>
  11.     /// Summary description for UnpublishExpiredEvents
  12.     /// </summary>
  13.     public class UnpublishExpiredEvents : IHttpHandler
  14.     {
  15.         public void ProcessRequest(HttpContext context)
  16.         {
  17.             int EventsNodeId = Convert.ToInt32(ConfigurationManager.AppSettings["EventsNodeId"]);
  18.             string strEventStartDate = string.Empty, strEventEndDate = string.Empty;
  19.             context.Response.ContentType = "text/plain";
  20.             dynamic EventsNode = new DynamicNode().NodeById(EventsNodeId);
  21.             List<DynamicNode> eList = EventsNode.Children.Items;
  22.             foreach (var Event in eList)
  23.             {
  24.                 int CurrentEventNodeId = Convert.ToInt32(Event.Id);
  25.                 try
  26.                 {
  27.                     DateTime EventStartDate = Convert.ToDateTime(Event.GetProperty("eventStartDate").Value);
  28.                     strEventStartDate = EventStartDate.ToString("MM/dd/yyyy");
  29.                 }
  30.                 catch { strEventStartDate = string.Empty; }
  31.                 try
  32.                 {
  33.                     DateTime EventEndDate = Convert.ToDateTime(Event.GetProperty("eventEndDate").Value);
  34.                     strEventEndDate = EventEndDate.ToString("MM/dd/yyyy");
  35.                 }
  36.                 catch { strEventEndDate = string.Empty; }
  37.                 Document CurrentEventNode = new Document(CurrentEventNodeId);
  38.                 if (!string.IsNullOrEmpty(strEventEndDate))
  39.                 {
  40.                     if (Convert.ToDateTime(strEventEndDate) < DateTime.Now)
  41.                     {
  42.                         CurrentEventNode.UnPublish();
  43.                     }
  44.                 }
  45.                 else
  46.                 {
  47.                     if (Convert.ToDateTime(strEventStartDate) < DateTime.Now)
  48.                     {
  49.                         CurrentEventNode.UnPublish();
  50.                     }
  51.                 }
  52.             }
  53.         }
  54.         public bool IsReusable
  55.         {
  56.             get
  57.             {
  58.                 return false;
  59.             }
  60.         }
  61.     }
  62. }
Or
  1. public void UnpublishNode(Document CurrentContentNode, DateTime ContentExpiryDate)
  2.         {
  3.             if (ContentExpiryDate != DateTime.MinValue)
  4.             {
  5.                 if (Convert.ToDateTime(ContentExpiryDate) < DateTime.Now)
  6.                 {
  7.                     CurrentContentNode.UnPublish();
  8.                 }
  9.             }
  10.         }

Configuration: (umbracoSettings.config)

  1.   <scheduledTasks>
  2.     <!-- add tasks that should be called with an interval (seconds) -->
  3.     <!--    <task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>-->
  4.     <task log="false" alias="ExpiredEventsUnpublishScheduler" interval="60" url="http://local.kpmg.com/GenericHandlers/UnpublishExpiredEvents.ashx"/>
  5.   </scheduledTasks>
Thursday, 7 August 2014
Posted by Jebastin

How to Use CDATA in XML?

All text in an XML document will be parsed by the parser. But text inside a CDATA section will be ignored by the parser.

XML parsers normally parse all the text in an XML document.
When an XML element is parsed, the text between the XML tags is also parsed:
<message>This text is also parsed</message>
 The parser does this because XML elements can contain other elements, as in this example, where the <name> element contains two other elements (first and last):
<name><first>Bill</first><last>Gates</last></name>
and the parser will break it up into sub-elements like this:
<name>
  <first>Bill</first>
  <last>Gates</last>
</name>
 Parsed Character Data (PCDATA) is a term used about text data that will be parsed by the XML parser.

CDATA - (Unparsed) Character Data

The term CDATA is used about text data that should not be parsed by the XML parser.
Characters like "<" and "&" are illegal in XML elements.
"<" will generate an error because the parser interprets it as the start of a new element.
"&" will generate an error because the parser interprets it as the start of an character entity.
Some text, like JavaScript code, contains a lot of "<" or "&" characters. To avoid errors script code can be defined as CDATA.
Everything inside a CDATA section is ignored by the parser.
A CDATA section starts with "<![CDATA[" and ends with "]]>":

<script>
<![CDATA[
function matchwo(a,b)
{
if (a < b && a < 0) then
  {
  return 1;
  }
else
  {
  return 0;
  }
}
]]>
</script>
In the example above, everything inside the CDATA section is ignored by the parser.

Code:
  1.  string CDATAStart = "<![CDATA[", CDATAEnd = "]]>";
  2.  LongDescription = CDATAStart + mcLongDescription.Trim() + CDATAEnd;
Notes on CDATA sections:
A CDATA section cannot contain the string "]]>". Nested CDATA sections are not allowed.
The "]]>" that marks the end of the CDATA section cannot contain spaces or line breaks. 

Reference: W3Schools, StackOverflow
Posted by Jebastin
Tag : ,

Link To This Post/Page

Spread The Word

Add this button to your blog:
JJ Technology Solutions

Blog Archive

Trackers

eXTReMe Tracker
facebook

- Copyright © JJ Technology Solutions - Powered by Source Code Solutions -