Tuesday, December 9, 2014

Extract only emails from string using Javascript

Today I'm going to show you how to extract only email from string. This can be done using javascript. Here sample code
function extractEmails(text) {
   return text.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
 } 

Monday, November 10, 2014

An error occurred while copying image, check your memory limit. prestashop

This is not related to prestashop. You have to increase memory limit in php.ini file in your server.

I'm using fatcow as my service provider. Here the steps for solve this

  1. Log in to your FatCow Control Panel.
  2. Go to CGI and Scripted Language Support.
  3. Click PHP Scripting.
  4. Your php.ini file is displayed in a text box at the bottom. Click Edit if you cannot edit the php.ini file text.
  5. Locate the following block of code within your php.ini file:
    ; Maximum amount of memory a script may consume (128MB)
    ; http://php.net/memory-limit
    memory_limit = 32M
  6. Modify the highlighted value for memory_limit as desired (example: 35M, or 40M, or 45M).
  7. Click Save.

Tuesday, October 28, 2014

Get ASPX control value in ASCX page

Hello,

To achieve this scenario, you have to first define public property in aspx page like this.
public DropDownList AffinityGroupDDL
        {
            get
            {
                return ddlAffinityGroup;
            }
        }

After that you can access your page controls like below
var dropDownList = ((StMainDashboard)Page).AffinityGroupDDL;

Try this.

Tuesday, April 22, 2014

List locally installed digital certificates with C#

X509Store store = new X509Store(StoreName.Root,StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
Console.WriteLine("Friendly Name\t\t\t\t\t Expiration date");
foreach (X509Certificate2 certificate in store.Certificates)
{
   Console.WriteLine("{0}\t{1}", certificate.FriendlyName,certificate.NotAfter);
}
store.Close();
 
Note: You should import this namespace (System.Security.Cryptography.X509Certificates) 

Keyset does not exist

I got this error message when get installed certificates in my server. The problem was permission issue. Follow these steps to resolve it.
 1) Open Windows Explorer and navigate to the directory where the keys are located: C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys

 2) Make sure you’re not using the "Simple File Sharing" mode in Windows Explorer. In the Windows Explorer Tools menu, select "Folder Options". Then select the "View" tab. Scroll down and make sure the "Use simple file sharing" checkbox is unchecked.

3) Right-click on the MachineKeys folder. Select "Properties", then select the "Security" tab. (Note: If you didn’t turn off simple file sharing, you wouldn’t see the "security" tab.)

 4) You’re going to add your IUSR_**** account and give it full permission. Click the "Add.." button. Type your IUSR account name and click "Check Names". Then click "OK".

5) The IUSR account is now listed. Select it and then check the "Full Control" checkbox (causing all the other Allow checkboxes to be selected). Then click "Apply". Thanks

TinyMCE Insert/Edit link not editable

 To fix this add  e.stopImmediatePropagation()  as below. $(document).on('focusin', function (e) {             if ($(e.target).close...