A chance meeting in Glastonbury with a friend (John) who I hadn't seen for a number of years has lead me to starting the development of spotting software - which was something I had on my mind for a few months as a good projects to start using my new C#/.NET development skills.
We meet up a few days ago and discussed the many spotting interests he has (birds, planes, ships, trains, etc) and birds and merchant ships came to the fore and soon it was decided to begin with Merchant Ships.
Enthused by the wealth of information and knowledge of John had, I was soon planning the general look and structure of the application.
Now a couple of days later (and another meeting showing John my mock up) I'll start coding the application.
Richard
Visionscape
Thursday, 28 May 2009
Kiwee - Fatal error: Call to a member function getChunk()
Installed Kiwee v1.0.7b onto the beginning of a new website (using MODx cms) and soon found that when I clicked on the tabs of some of the management sections under KiweeCommerce that I was getting the following error:
Fatal error: Call to a member function getChunk() on a non-object in C:\wamp\www\countryvintage\assets\
snippets\shoppingCart\eCart\include\eValues.inc.php
on line 240
I found that the line was trying to get a Chunk called 'gDiscountTplx' which was not installed under the HTMLSnippets section. Hunting through the 'installconfig.inc' file in the installation folder for HTMLSnippets I soon found that the problem was that although the entry existed the following (and last) Tpl file 'gCouponTplx' was incorrectly using the same index number for the $html array thus it was overwriting the details for 'gDiscountTplx' and therefore it was never to be installed.
This has been fixed for the any new release (which should be called v1.0.8)
Richard
Visionscape
Fatal error: Call to a member function getChunk() on a non-object in C:\wamp\www\countryvintage\assets\
snippets\shoppingCart\eCart\include\eValues.inc.php
on line 240
I found that the line was trying to get a Chunk called 'gDiscountTplx' which was not installed under the HTMLSnippets section. Hunting through the 'installconfig.inc' file in the installation folder for HTMLSnippets I soon found that the problem was that although the entry existed the following (and last) Tpl file 'gCouponTplx' was incorrectly using the same index number for the $html array thus it was overwriting the details for 'gDiscountTplx' and therefore it was never to be installed.
This has been fixed for the any new release (which should be called v1.0.8)
Richard
Visionscape
Labels:
Fatal error,
getChunk,
Kiwee,
KiweeCommerce,
MODx
KiweeCommerce - a renewed start after a long break
After a break from doing any development on Kiwee (KiweeCommerce - a Ecommerce module for the MODx CMS Framework) I am now making a renewed start (though it may be filled with breaks as I am using the development of an ecommerce website, for which I'm doing as a favour, as a means to check through what I have added to Kiwee and what other bugs still need ironing out and features to smooth out and maybe introduce).
I will attempt to comment on the progress of this work whether its solving bugs/issues or changing things or adding things (features, etc) through this blog and will do my best to respond to any queries and comments posted.
Richard
Visionscape
I will attempt to comment on the progress of this work whether its solving bugs/issues or changing things or adding things (features, etc) through this blog and will do my best to respond to any queries and comments posted.
Richard
Visionscape
Friday, 22 May 2009
Spambot KIller ASP.NET
It had got to the point in developing my first ASP.Net website (for my first C#/.Net application - Accommodation Booking System) that I needed to explore a good way of 'encoding' any email addresses on the website. I had seen this mentioned from time to time over the many years but it wasn't until looking for something else did I feel that now was the time to see what other people were doing/suggesting.
Soon I found that the 'web.config' file could hold details of this and thus also making it globally available to the site, so I added the code under the 'controls' section
<add tagprefix="pab" namespace="PAB.WebControls"></add>
and sure enough now my page that was trying to use it was no longer complaining and I could remove my attempt at trying to Register it before the HTML code.
<pab:emaillink id="supportHyperLink" runat="server" tooltip="Support email address">
As you will notice I have missed out the NavigateURL attribute as well as Text. I have done this so I could add these in the code-behind file
supportEmail = ConfigurationSettings.AppSettings["SupportEmail"];
supportHyperLink.Text = supportEmail;
supportHyperLink.NavigateUrl = "mailto:" + supportEmail;
The supportEmail variable is a public string that I declared in the Class. This has the value of a AppSetting called 'SupportEmail' from the web.config file and then this value is attributed to Text and NavigateURL (prefixed with 'mailto:').
<pab:emailLink ID="supportHyperLink" runat="server" ToolTip="Support email address" / >
link.NavigateUrl = HtmlObfuscate(link.NavigateUrl);
writer.WriteAttribute("href", link.NavigateUrl);
if(Text.IndexOf('@') > -1) Text = HtmlObfuscate(Text);
thus if the Text attribute is identified as having an '@' symbol in it it should be obfuscated as there is a good chance it is an email address.
In addition to this I added
if (!string.IsNullOrEmpty(link.ToolTip))
{
if (link.ToolTip.IndexOf('@') > -1) link.ToolTip = HtmlObfuscate(link.ToolTip);
writer.WriteAttribute("title", link.ToolTip);
}
again to make sure if it appeared to be an email address within the ToolTip (if there it wasn't null or empty) that it was obfuscated.
Richard
Visionscape
ASP.NET Hyperlink Control
I soon found an article by Peter Bromberg called: Spambot Killer ASP.NET Mailto: Hyperlink Control where in Peter goes through some custom code that overrides certain Hyperlink functions and "... convert everything into it's HTML Entity representation." thus making it difficult for spambots to recognize as an email address.Registering the Custom Control
Not having had much experience of Custom Controls I was suddenly finding it difficult to figure out how to Register this new feature.Soon I found that the 'web.config' file could hold details of this and thus also making it globally available to the site, so I added the code under the 'controls' section
<add tagprefix="pab" namespace="PAB.WebControls"></add>
and sure enough now my page that was trying to use it was no longer complaining and I could remove my attempt at trying to Register it before the HTML code.
<pab:emaillink id="supportHyperLink" runat="server" tooltip="Support email address">
As you will notice I have missed out the NavigateURL attribute as well as Text. I have done this so I could add these in the code-behind file
supportEmail = ConfigurationSettings.AppSettings["SupportEmail"];
supportHyperLink.Text = supportEmail;
supportHyperLink.NavigateUrl = "mailto:" + supportEmail;
The supportEmail variable is a public string that I declared in the Class. This has the value of a AppSetting called 'SupportEmail' from the web.config file and then this value is attributed to Text and NavigateURL (prefixed with 'mailto:').
<pab:emailLink ID="supportHyperLink" runat="server" ToolTip="Support email address" / >
Adding/Changing the EmailLink Class
I noticed (of course) that the Text generated (which in my case is also the email address) was kept as plain text and although the function had done the job of obfuscating/encoding the email address as part of the hyperlink I calso needed the same process to happen to the Text attribute otherwise I would expect it would be all for nothing. I decided to change the else if relating to 'mailto:' code block under the Render functionlink.NavigateUrl = HtmlObfuscate(link.NavigateUrl);
writer.WriteAttribute("href", link.NavigateUrl);
if(Text.IndexOf('@') > -1) Text = HtmlObfuscate(Text);
thus if the Text attribute is identified as having an '@' symbol in it it should be obfuscated as there is a good chance it is an email address.
In addition to this I added
if (!string.IsNullOrEmpty(link.ToolTip))
{
if (link.ToolTip.IndexOf('@') > -1) link.ToolTip = HtmlObfuscate(link.ToolTip);
writer.WriteAttribute("title", link.ToolTip);
}
again to make sure if it appeared to be an email address within the ToolTip (if there it wasn't null or empty) that it was obfuscated.
Richard
Visionscape
Labels:
anti-spam,
ASP.NET,
email,
hyperlink,
pab,
Peter Bromberg,
Spambot Killer,
Visual C#,
webcontrols
Friday, 1 May 2009
Installing and Running VS2008 developed application with Vista's UAC enabled
The problems with UAC
After testing my new application developed in Visual Studio 2008 (with C#) and seeing it working on both my development machine (running Vista) and my laptop with XP I thought I had covered the basics of the main Windows OSes but then when testing it on another Vista machine I realised I had problems, and that problem was User Access Control (UAC).This hadn't been an issue on the development machine as I had UAC turned off (it bugged me too much - can't wait to see what Windows 7 various levels are like). So it was back to searching the net for help.
After searching on the errors that appeared as soon as the application was trying to write to the registry or write to the database (lack of permissions eg. 'Access to the database file is not allowed. [File name = ....'), I found mention of changing their permissions to overcome the errors. However, this didn't seem to work.
I decided to do some proper testing on my development machine with UAC enabled and soon found an issue with a Cryptography process
rsa = new RSACryptoServiceProvider(cspParams);
saying that the object already existed - this was possibly an issue, again, with UAC.
More searches and then I seemed to start getting somewhere.
Application Manifest file
First I came across:VS2008: Embedding UAC Manifest Optionsthen
Enabling Your Application for UACthis latter article was just what I was looking for and (though I created the manifest per the former article). But like always another issue.
ClickOnce doesn't like 'requireAdministrator'
I had added my Application Manifest File (app.manifest), as suggested.
Changed the 'requestedExecutionLevel' to make 'level=requireAdministrator', but now when I tried to build my application I was getting a critical error complaining about this new setting.
Well then I need to disable ClickOnce as I'm deploying my application with Inno Setup - how do I disabled ClickOnce?
Disabling ClickOnce
I found the following thread on MSDNHow to remove "clickOnce" from an applicationwhere TaylorMitchell advises to check both the Signing and Security tabs of the project's properties - there may have been one or two other pointers in the thread so if those two don't switch ClickOnce off read through the rest.
Now with ClickOnce disabled I was able to continue with the previous article (Enabling Your Application for UAC) and soon I had my application with the Vista security shield showing.
After processing my application files as a setup file with my Inno configuration I found my last hurdle with UAC (well I hope it is :)).
Create Process failed; code 740
After the setup process came to an end and it then tried to launch my application the following error message showedUnable to execute file c:\ .....
Create Process failed; code 740.
The requested operation requires elevation.
After more Googlings I soon found that the answer was down to a near simple running the setup program as an Administrator (right-clicking on it and selecting 'Run as administrator').
This worked. The setup program completed as expected and then launched my application. The application ran without the errors that showed in relation to writing to the database or the registry - registry entries are being written using Cryptography process on every use.
Richard
Visionscape
Subscribe to:
Posts (Atom)