Reflection.js

I have been using a fancy snippet of JavaScript ever since I ran into it a few months back.  After giving it some time to prove itself, it’s time to thank Cow for making my blog, reflective.

What is it?
Reflection.js

What does it do?
Reflection.js allows you to add reflections to the images on your web pages using CSS. All you have to do is give the desired images a “reflect” CSS class. Simple as that.

I have used it numerous times, but here are a few more examples…

happy-halloween heart-day ice-cream-day

Whatcha think? Pretty cool right? If you want it? You can download it here… http://cow.neondragon.net/stuff/reflection/

-Thuan

Dotnetnuke Error: BC30451

For all interested parties if you run into this error after compiling a custom module…

Dotnetnuke BC30451: Name ‘Initialize’ is not declared.

It is most likely you didn’t change your reference paths in Visual Studio.

Brian Dukes ran into this problem, discussed here. His solution was to copy a fresh copy of the core Dotnetnuke.dll into your root /bin folders but if you don’t change the reference paths in Visual Studio, each time you compile your custom module the Dotnetnuke.dll will be replaced with the an older one if it exists.

Don’t forget to change the reference paths for both your main module project and the corresponding sqldataprovider project because it will also have the same reference paths.

HTH, Thuan.

Dotnetnuke Infinite Redirect Loop

It had be a long time since I had worked with Dotnetnuke but it was time for me to upgrade a few of my Dotnetnuke sites.  And as always DNN’s installation/upgrading is again culpable for all my recent stress.

The site upgrade in question was going from DNN 3.3.7 to DNN 4.9.0 and the error I kept on getting was an infinite loop redirecting me back to this URL: http://mysite/default.aspx?alias=http://mysite/myalias with a blank screen.

Internet Explorer didn’t know what to do with it so it infinitely reloaded the URL.  Firefox was a little smarter, it detected the loop therefore stopped it and gave out this error message: “Firefox has detected that the server is redirecting the request for this address in a way that will never complete.”

So the search was on, using these keywords… dotnetnuke, infinite, redirect, and loop. I found a couple promising articles with potential solutions to my problem…

http://www.bestwebsites.co.nz/dotnetnuke/solving-the-dotnetnuke-redirect-loop/

http://weblogs.asp.net/christoc/archive/2008/06/19/dotnetnuke-homepage-won-t-load-keeps-redirecting.aspx

But after  much trial and error with my trust settings and going straight to the database and changing my portal’s aliases per those solutions, I was still at a dead end.

It wasn’t until I carefully read this John Mitchell forum thread did I find my solution. The problem was the new Default.aspx page. After the upgrade the page code went from…

<%@ Page Language=”vb” AutoEventWireup=”false” Explicit=”True” Inherits=”DotNetNuke.Framework.DefaultPage” CodeFile=”Default.aspx.vb” %>
<%@ Register TagPrefix=”dnn” Namespace=”DotNetNuke.Common.Controls” Assembly=”DotNetNuke” %>
<asp:literal id=”skinDocType” runat=”server”></asp:literal>
<html <%=xmlns%> <%=LanguageCode%>>
<head id=”Head” runat=”server”>
<meta id=”MetaRefresh” runat=”Server” http-equiv=”Refresh” name=”Refresh” />
<meta id=”MetaDescription” runat=”Server” name=”DESCRIPTION” />
<meta id=”MetaKeywords” runat=”Server” name=”KEYWORDS” />
<meta id=”MetaCopyright” runat=”Server” name=”COPYRIGHT” />
<meta id=”MetaGenerator” runat=”Server” name=”GENERATOR” />
<meta id=”MetaAuthor” runat=”Server” name=”AUTHOR” />
<meta name=”RESOURCE-TYPE” content=”DOCUMENT” />
<meta name=”DISTRIBUTION” content=”GLOBAL” />
<meta name=”ROBOTS” content=”INDEX, FOLLOW” />
<meta name=”REVISIT-AFTER” content=”1 DAYS” />
<meta name=”RATING” content=”GENERAL” />
<meta http-equiv=”PAGE-ENTER” content=”RevealTrans(Duration=0,Transition=1)” />
<style type=”text/css” id=”StylePlaceholder” runat=”server”></style>
<asp:placeholder id=”CSS” runat=”server” />
</head>
<body id=”Body” runat=”server” >
<noscript></noscript>
<dnn:Form id=”Form” runat=”server” ENCTYPE=”multipart/form-data” style=”height: 100%;” autocomplete=”off”>
<asp:Label ID=”SkinError” runat=”server” CssClass=”NormalRed” Visible=”False”></asp:Label>
<asp:PlaceHolder ID=”SkinPlaceHolder” runat=”server” />
<input id=”ScrollTop” runat=”server” name=”ScrollTop” type=”hidden” />
<input id=”__dnnVariable” runat=”server” name=”__dnnVariable” type=”hidden” />
</dnn:Form>
</body>
</html>

to…

<%@ Page language=”VB” %>
<%@ Import Namespace=”DotNetNuke” %>

<script runat=”server”>

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

Dim DomainName As String
Dim ServerPath As String
Dim URL() As String
Dim intURL As Integer

‘ parse the Request URL into a Domain Name token
URL = Split(Request.Url.ToString(), “/”)
For intURL = 2 To URL.GetUpperBound(0)
Select Case URL(intURL).ToLower
Case “admin”, “desktopmodules”, “mobilemodules”, “premiummodules”
Exit For
Case Else
‘ check if filename
If InStr(1, URL(intURL), “.aspx”) = 0 Then
DomainName = DomainName & IIf(DomainName <> “”, “/”, “”) & URL(intURL)
Else
Exit For
End If
End Select
Next intURL

‘ format the Request.ApplicationPath
ServerPath = Request.ApplicationPath
If Mid(ServerPath, Len(ServerPath), 1) <> “/” Then
ServerPath = ServerPath & “/”
End If

DomainName = ServerPath & “Default.aspx?alias=” & DomainName

Response.Redirect(DomainName,True)

End Sub

</script>

This made me look at all my files a second time. What I found was that the old Default.aspx was backed up as old_Default.aspx and a new one was created. So my solution was simply to replace the original Default.aspx page with the new one generated from the upgrade.

And although, my solution got the site working again and under ASP.NET v2 (the reason for my upgrade), it also leaves me to question what I did, if I messed anything fundamental up, and why the Dotnetnuke Team changed the Default.aspx page.

If anyone could enlighten me on this, please leave a comment.

Recipient Name

Well, I just released a new contribution that I think everyone needs…

Its an extension to the /admin/orders.php page in osCommerce. It needed yet more useful information. What more do you want?

The recipient name (in the osCommerce DB its aka delivery_name) was a recent necessity for a client because he couldn’t find an order. The recipient knew who sent it but the sender [customer] also sent to many other persons. The only way to find that specific order was by looking into each order the sender made.

This contribution was a work-a-round for that type of dilemma, but again it seemed useful so I released it as a contribution, click here.

Oh, it’s easy install. all you have to do is edit a few lines in /admin/orders.php

Finding/Editing BOX_WIDTH

I spent some time looking for BOX_WIDTH because I needed to change the width of my admin boxes. It’s where you’d expect it but it isn’t so obvious…

Public viewable boxes…

/includes/application_top.php
~line 61

Admin boxes…

/admin/includes/application_top.php
~line 52

BTW, your lines might be different depending on your version of osCommerce.

Happy Coding,
Thuan

Agree to Terms then Confirm

I couldn’t find a “Agree To Terms” module that was really simple to set up so I made one. There are a few out there but they required changing the database and/or javascript and/or the osCommerce checkout process.

My contribution only edits the checkout_confirmation.php page but doesn’t change the checkout process at all. It simply takes the user to conditions.php so he/she can read it or redirects him/her back to the homepage.

Sounds interesting? Click Here, to download it. Enjoy…

osCommerce and OpenSSL

How does one get OpenSSL to work after you have enabled osCommerce’s “PayPal Website Payments Standard” module? That is actually a very hard question to answer even with my IT knowledge. But with a lot of research and the piecing together of two articles, I was able to get everything working…

My primary challenge was I couldn’t figure out, “how to generate the encryption keys on my shared hosting Linux server”… necessary for OpenSSL to work. I eventually learned that the keys are not generated from the servers, you only upload the keys to the server. Just as you would with standard html files.

osCommerce OpenSSL

As you can see the module calls for: 2 keys generated by you, and the only way I was able to generate “both” keys was by following a post by Martin Hughes-Jones, click here.

For the remainder of the field items asked by the module I followed a Lunarpages post, click here.

A few notes:

  • Your file paths will not match mine.
  • The keys should be in a password protected folder, e.g. I put mine in a folder called openssl in my admin folder.
  • Don’t forget to create the “working directory” folder… or you will get an error as I did.

Well, that’s it, your osCommerce “PayPal Website Payments Standard” web payments are now encrypted.

Javascript: Month + Year

I recently needed to use javascript to write out the current month and year. Here, HTH…

<script type=”text/javascript”>
<!–
var currentMonthYear = new Date()
var monthNumber = currentMonthYear.getMonth() + 1
var year = currentMonthYear.getFullYear()
if (monthNumber==1) monthName=(‘January’);
else if (monthNumber==2) monthName=(‘February’);
else if (monthNumber==3) monthName=(‘March’);
else if (monthNumber==4) monthName=(‘April’);
else if (monthNumber==5) monthName=(‘May’);
else if (monthNumber==6) monthName=(‘June’);
else if (monthNumber==7) monthName=(‘July’);
else if (monthNumber==8) monthName=(‘August’);
else if (monthNumber==9) monthName=(‘September’);
else if (monthNumber==10) monthName=(‘October’);
else if (monthNumber===11) monthName=(‘November’);
else monthName=(‘December’);
document.write(monthName + ” ” + year)
//–>
</script>

Standard osCommerce Buttons

Standard osCommerce Buttons

While setting up an osCommerce installation, I decided that I needed “regular, plain, standard, whatever you want to call them” buttons for it’s frontend. I searched the osCommerce contributions/addons site and found nothing “standard”. So, I opened up my image editor of choice (Fireworks), then did a little magic and ended up with a contribution, here.

Final Thoughts: Standard is not so standard anymore!? Grrr…

The Subtract Join

Subtract Join

I needed a way of selecting all primary key(s) from a certain table (Table_1) that was not used as a foreign key in a sub-table (Table_2). So I went at it with my SQL know-how to no end. It was obvious that I needed to do a little catching up. 🙂

I googled the following:

• all instances of unique id not found in sub-table
• primary key not found as foreign key in sub-table
• select all rows if not exist in sub-table
• sql tutorial
• sql join
• sql reference
• sql relational databases

…and found nothing useful. However, my research did lead me to one conclusion… what I needed was the opposite of a join. I googled for it, it as in “opposite of a join”. What I found was a very useful MS KB, http://support.microsoft.com/kb/136699.

The described “Subtract Join” was exactly what I was looking for and it works! What’s odd is of all the SQL tutorials I ran into, none of them mentioned the SUBTRACT JOIN. That makes me think there might be a better way of doing this query. Is there a better way? Am I simply not using the right keywords when I search? Anyways, if there is I couldn’t find it…