we may code
Coding tips and tricks for web development
Monday, March 12, 2018
Sitecore Check Droptree Field for Value
CurrentItem.Fields["FIELD NAME"].Value != "" ? true : false;
Wednesday, March 7, 2018
IIS Redirect Tips
When writing and testing custom IIS Redirects/Rewrites, make sure to clear your browser cache after making any changes. The browser will keep using the old redirect/rewrite until the cache is cleared, which will prevent your new changes from going through.
Friday, January 19, 2018
Fixing the repeating loop of signing in on Adobe products
Quit all Adobe CC apps including Creative Cloud (Also launch Task Manager, find the CreativeCloud process and select "End Task"
On Windows 10, go to C:\ProgramData\Adobe
Find the folder named "SLStore" and rename it "SLStore_old"
https://forums.adobe.com/thread/2165483
Tuesday, July 25, 2017
Update Wordpress Domain When Migrating
When you're migrating a Wordpress site to a new environment, having to change the domain name can be a bit of a pain. There are some plugins you can use, but if you're relatively comfortable with SQL queries you can do it manually.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.com','http://www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.com', 'http://www.newsite.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldsite.com','http://www.newsite.com');
Monday, June 26, 2017
Get rid of Sitecore trying to set language from URL
Could not parse the language 'XXXX'. Note that a custom language name must be on the form: isoLanguageCode-isoRegionCode-customName. The language codes are two-letter ISO 639-1, and the regions codes are are two-letter ISO 3166. Also, customName must not exceed 8 characters in length. Valid example: en-US-East. For the full list of requirements, see...
If you're getting the following error when loading URLs, and you don't need a language requirement, you can turn off the Sitecore setting in the web.config.
If you're getting the following error when loading URLs, and you don't need a language requirement, you can turn off the Sitecore setting in the web.config.
- Under the "linkManager" sitecore item, set "languageEmbedding" to "never"
- Under the "Languages.AlwaysStripLanguage" setting, set value to "false"
Wednesday, June 21, 2017
Updating npm and node on Windows
To update npm and node on Windows, follow these steps from a StackOverflow answer:
Run PowerShell as Administrator
How do I update node and npm on windows?
Run PowerShell as Administrator
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
How do I update node and npm on windows?
Thursday, June 15, 2017
Creating a Website in Microsoft Azure with GitHub deployment
Microsoft Azure is a scalable, cloud-based web hosting solution.
At the moment, it's not possible to use an external Git repository for Azure and have staging and master branches that automatically deploy to Azure. GitHub is the suggested method of source control for now. First, create the GitHub repository and the master and staging branches. Once created, go back into Azure to connect the Web App to the repository.
Setting up a new Web App
- Create a Subscription
- This is the billing account to use. You can use an existing one or create a new one.
- To create a new Subscription account, in the Azure portal left sidebar, click on Subscriptions > Add
- Select the payment account to use
- Create a new Web App and App Service Plan
- The App Service Plan is the container for Web Apps. You can have multiple Web Apps in a single App Service Plan. Plans vary in bandwidth and are priced in tiers.
- In the left sidebar again, click on App Services > Add
- Select Web App > Create
- Fill in App name -- this will be used for your Azure URL on *.azurewebsites.net
- Select Subscription that you created previously
- Resource Group can be new, or you can use an existing one if there is one for that App Service
- App Service Plan: Create new is default, but only use if there isn't one already; otherwise use one that's already there.
- Click Create and Azure will begin deploying the new site. After 1-2 minutes, you should see an Alert that deployment is complete
- Now if you go to App Services the new web app will be there. If you select it and click Overview you will see URL, FTP and other info.
- Select/Change Service Plan ***Azure will select Standard by default, so you need to manually change it if you want a free/cheaper plan
- Go to App Services > Scale Up and view the current plan or select a different plan
Setting up a Staging Environment
You can create a separate Web App for staging in the same App Service Plan, or you can create a Deployment Slot in the existing production Web App. Personally I think it is cleaner to use Deployment Slots, to minimize the number of Web Apps. Originally Deployment Slots were meant to be a pre-production environment that you can swap out with the real production environment. For example, you could deploy code changes to the Deployment Slot, then once it's working "Swap" the Deployment Slot and it will immediately update the Production environment. However I think this a different type of workflow than what I usually do with Git and having staging and master branches that deploy to the environments. I don't plan on using the Swap functionality, but many others like using it.- To create a deployment slot, select the App Service and click on Deployment slots > Add Slot
- Name it, i.e. "staging" -- this will create a new subdomain on the *.azurewebsites.net site by adding the slot name to the existing Azure domain
- Under Configuration Source, select to clone from the existing Web App
- Click OK to create the new deployment slot
Setting up GitHub Deployment
At the moment, it's not possible to use an external Git repository for Azure and have staging and master branches that automatically deploy to Azure. GitHub is the suggested method of source control for now. First, create the GitHub repository and the master and staging branches. Once created, go back into Azure to connect the Web App to the repository.- Select the App Service (or App Service's Deployment Slot) > Deployment option
- Under Choose Source, select GitHub. You may be prompted to log into GitHub; if so, log in using devservices (Credentials in 1Pass under GitHub)
- Select Authorization, Organization, Project, and Branch.
- Click OK to create the Deployment option.
- Depending on how many files are in the repo, it make take a few minutes or longer to finish building the site. You can check the deployment status under Web App > Deployment options
Subscribe to:
Posts (Atom)