Skip to main content

Posts

Showing posts from 2010

Simple HTTP Redirect with Querystring in IIS7

HTTP Redirect seems simple enough. Always was in IIS6 and in IIS7 there's even a button labeled HTTP Redirect that promises relative redirects.  It looks like it'll be as easy Apache finally.  That is until you try to redirect a querystring.  Then everything bombs.

Turns out it still is relatively easy, except you have to know that Microsoft changed $S$Q to $V$Q. Why? $Ss and $Gs I suspect.

And How.
In our example we'll redirect all pages under http://olddomain.com/content to http://mydomain.com/content.
Pick the virtual directory you want to redirect. e.g. http://olddomain.com/content Click HTTP Redirect under IIS in the IIS management console.In the HTTP Redirect Dialog:
Check Redirect requests to this destinationEnter your new path ending with $V$Q.  e.g. http://mydomain.com$V$QCounter-intuitively check Redirect all request to exact destination (instead of relative destination)Choose the appropriate Status Code (Permanent or Temporary)Apply Changes and Test

SEO is officially dead

Yes, I know we're all tired of hearing that some technology is dead. Wired was wrong about the web dying in 1997 and 2010. Truth be told Wired isn't exactly good at identifying mortality. Phone calls aren't dead, the desktop isn't dead, cyberspace isn't dead, drm isn't dead, wifi isn't dead, guitar hero isn't dead and DRM isn't dead, yet (though Zuckerman is trying his best). Well, they were right about the floppy disk.Wait. That wasn't my point.My point was that SEO is *actually* dead.Here's why.Several minutes ago I google "fckeditor background marinelli". I find a solution that works. Using it I figure out a better way. I blog it. I hit the back button to review the search results again. My blog entry (I just typed) is result six.http://lmgtfy.com/?q=fckeditor+background+marinelliSEO is dead. Long live content. Thank you Google Instant.

Theming fckeditor to work with Marinelli Drupal Theme

Marinelli, a nearly flawless Drupal theme has one major flaw. It is not optimized to work with the fckeditor WYSIWYG editor. There are others as well.Some googling located some good tips for configuring modules/fckeditor/fckeditor.config.js to work with Marinelli on http://drupal.fckeditor.net/tricks. This solution is good, but it doesn't work well in multi-site situation or if more than one theme is enabled.Here is a simpler solution:Go to admin/settings/fckeditor and select "edit" next to the profile you want to fix.Make sure under "Style and template files" your Editor CSS is set to "Use theme CSS" Under "Advanced Options", find "Custom javascript configuration" and paste the following:
FCKConfig.BodyId = "primary"; FCKConfig.BodyClass = "singlepage"; FCKConfig.EditorAreaStyles = "body{background:#FFFFFF;text-align:left;font-size:0.8em}"; Spank "Save"If you are running a multi-site inst…

Using Drupal Feeds Module to Import Content from MS Access

Feeds works brilliantly, but there is a couple weird gotchas when working from MS Access to Drupal that are worth documenting:
Seems self-explanatory, but since you are importing as .txt or .csv make sure you remove all carriage returns.  In MS Access this involves writing an update query and doing a replace on all Chr(10) and Chr(13).  e.g. Replace(Replace([myfield],Chr(10),"<br />"),Chr(13),"<br />")
Although CCK Date fields import perfectly as MS Access dates, published dates do not.  This is because the published field in Drupal is a Unix Timestamp which is a quite different than Access dates.  The easiest way I know to fix this is to export your data to Excel and then use the Excel integer date value to convert to a Unix Timestamp.

We've all seen this right?  That really long integer you see when you misformat a date? 

Anyway, to fix you need to first account for the difference between the start dates of the two time systems and then account for t…

Finding and Replacing Special Characters in MS Access

Most special characters like Tabs and Line Break and Carriage Returns can be found and replaced in MS Access by using the character codes.  But you can't use the find and replace dialog.

Instead, author an update query and enter the following to remove tabs:
Replace([myfield],Chr(9),"")

If removing line breaks you need to replace both the line break and carriage return character:
Replace(Replace([myfield],Chr(10),""),Chr(13),"")

If editing for HTML you'd edit this to the following for HTML line breaks:
Replace(Replace([myfield],Chr(10),"<br />"),Chr(13),"<br />")

For other characters, look up the ascii character code. (use the numbers in the "Dec" column in the tables)

MS Access Truncating Exports of Memo Fields at 512 Characters

Recently I was surprised to find that exports of Memo fields to csv and txt truncate at 512 characters.

Thankfully, there is an easy, albeit poorly documented hack.  In the export wizard set "Text Qualifier" to "{none}"





Microsoft.Jet.OLEDB.4.0 on a 64bit OS with IIS7

When attempting to run Microsoft Jet Connection to MS Access Databases on a 64bit Machine you will get the following unhelpful error:
The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

Googling will point you on a couple crazy paths involving recompiling your application in 32 bit mode. The solution isn't that complicated if you are using IIS7.

In IIS7 right-click on your application pool and choose "Advanced Settings"
In the dialog that opens, set "Enable 32-bit Applications" to "True".

There I fixed it.

Working with Views Templates in Drupal

Working with Views can be a little confusing for anyone new to Drupal. Don't get me wrong, Views is an absolutely brilliant piece of programming (thanks merlinofchaos!), but there are so many options that finding the correct toggle can be daunting. And no matter how brilliant, eventually you'll discover you've outgrown all available options in rewriting and variable usage and you need to figure out how to modify values via php. The answer? Views templates. And Views helps you out there too!And HowFor this example we are going to focus on one specific problem: creating a list of image thumbnails.In our hypothetical we have extended a node type via cck to include an image upload called [field_image_value] that we display when viewing the full node.  When each node is created a thumbnail is auto-created via the IMCE Plugin on upload. We've given them a suffix of _thumbnail such that our-image-filename.jpg becomes thumbnail our-image-filename_thumbnail.jpg.For our bl…

Making Code Samples Readable Online

After lazily just pasting code in <pre> blocks for years, this morning I finally got around to researching a code highlighter like you see on almost all the programming websites.

Thanks to SyntaxHighlighter adding this feature was embarrassingly easy. It is self-contained javascript that works on a pre or script tag decorated with a html class calling a brush alias, e.g.
<pre class="brush: sql"> INSERT INTO MyWebsite (pre, script) VALUES (complete, awesomeness) </pre>
Oh, but it's not just SQL, no there's a whole easel of brushes included:
Brush name
Brush aliases
File name
ActionScript3
as3, actionscript3
shBrushAS3.js
Bash/shell
bash, shell
shBrushBash.js
C#
c-sharp, csharp
shBrushCSharp.js

C++
cpp, c
shBrushCpp.js
CSS
css
shBrushCss.js

Delphi
delphi, pas, pascal
shBrushDelphi.js
Diff
diff, patch
shBrushDiff.js

Groovy
groovy
shBrushGroovy.js
JavaScript
js, jscript, javascript
shBrushJScript.js

Java
java
shBrushJava.js
JavaFX
jfx, javafx
shBrushJav…