programming

Tag: programming

Powershell Backup to S3 Script

Have you ever used Powershell? Well, neither have I. Until recently I’d been happily scripting my server maintenance routines in batch files (I know, I know) but figured when one of our dev servers turned out to need to be a Windows Server 2012, I found that my tried and true batch files would need to be massively rewritten so I figured, time to dive into PowerShell.

There were three aspects of what the routine that I needed to address

Read more

More Fun with php.ini: Allow WordPress Plugin to Access Data On Remote Server

Have you ever found that a WordPress plugin that works fine on one web host isn’t working as you would have expected when you move it to a new webhost? We recently experienced this with a plugin that reaches out to a remote server to collect XML data to be displayed by the plugin. The problem manifested itself as a blank page where the plugin’s shortcode SHOULD have displayed formatted version of the remote data. 

The quickest way to diagnose issues like this is to modify the wp-config.php so that the line “define(‘WP_DEBUG’, false);” reads as “define(‘WP_DEBUG’, true);” temporarily so you can view the errors that WordPress by default will hide from you.

Doing so in this case returned the following error:

Read more

Access StoreId from Codebehind in AspDotNetStorefront

If you’ve ever worked in the codebehinds of the latest versions of AspDotNetStorefront, you’ve probably run into this problem before. Or perhaps you’re smarter than me and already knew this in which case, this isn’t for you. 😉

With the new Multi-Store feature in v9.x of AspDotNetStorefront, there are instances where you need to access the StoreId for one reason or another. The problem is, none of the available classes (this, order, page, etc) seemed to be exposing this value. You could look at this.SkinId but this is not an optimum solution since you can add multiple stores to the same Skin.

Read more

Running Asp.Net 4.0 Application on IIS6 under Asp.Net 2.0 Parent App

Phew, that title sure is a mouthful… but it is kinda hard to describe the problem in so few words.

I had just finished the primary work on a new customer’s website (http://www.BuyMyBatteries.com) and was trying to hook up the latest and greatest build of BlogEngine.Net (2.5) underneath it for the corporate blog.

The challenge, as you might have guessed is that while BE.NET requires Asp.Net 4.0, the server was running IIS 6.0 and more importantly, the parent website is running ASP.NET v2.0. Resolving this took a number steps but it appears to be working quite nicely now

Step 1

Read more

Stop YouTube Videos from Hiding Your Menus – Two Methods

image

Has putting YouTube videos on your website embarrassed you by being so bold as to insist on being in front of other elements on your website? This is a common problem seen across the Internet daily. However, just ‘cause main people suffer from this ailment doesn’t mean that you have to. The resolution to this problem doesn’t rely on setting Z-Index or anything fancy, just making some small changes to the original code provided by YouTube to embed the video.

The preferred method these days for embedding a video appears to be to <iframe> in the video. This is clean, simple, and more importantly, won’t get stripped out like the embed code or javascript embeds by most WYSIWYG editors that people use online to edit their content. A normal IFrame call would look like this:

Read more

How To Extend ASPDNSF Product Name Field

On of the nice features of AspDotNetStorefront is that it supports multiple languages right out of the box. It does this by storing the multiple locale phrases as XML fragments inside the particular field. So, in the case of a product name, this means stuffing each of the multi-lingual product names into the Name field in the Product table. It also needs to be properly defined in this field with the XML code so a sample, multiple language name field could contain something similar to the following:

<ml>
    <locale name=”de-DE”>CMS-6R4</locale>
    <locale name=”en-US”>CMS-6R4</locale>
    <locale name=”fr-FR”>CMS-6R4</locale>
    <locale name=”ja-JP”>CMS-6R4</locale>
</ml>

Read more

Search and Replace in SQL TEXT or NTEXT column

In the past, when doing global search and replaces across text fields in SQL server, I’d been taking the path of least resistance and just writing ASP.NET pages to loop through and performing .Replace() on the SQL column in question.

Of course a devoted programmer, or at least one with more time on their hands, would have instead spent the time trying to find a better way to skin that cat. Well, courtesy of Google, I think I’ve found one. This article from SQLTeam.com all but handed me the answer. Since you can’t use the TSQL REPLACE function against a TEXT (or NTEXT) column the code below will work using UPDATETEXT instead:

Read more