Hover for IE lt 9 works for links only. To fix this problem it needs to add few lines to the page:
This blog is about life of true developer. Projects, coding, testing, ideas, interesting customers from around the world - all these events make life of developer interesting and active. In this blog i will try to describe my experience. Hope it helps someone :)
Wednesday, 9 November 2011
Monday, 26 September 2011
Batch file with non-MSDOS coding
Sometimes it needs to run Batch file with non-MSDOS coding. Have spent a lot of time on it until found a way how to convert it. Just had to use Standard->WordPad, it allows to open file with any encoding and convert it to MSDOS encoding. Easy and fast.
Saturday, 21 May 2011
ModuleSettings and TabModuleSettings Difference in DotNetNuke
If you do not like to read preambula and want to know what is the difference between ModuleSettings and TabModuleSettings, then you can read it here.
Have been worked with it for a long time. Also asked a lot of DotNetNuke gurus, but they did not provide concrete answer about difference between ModuleSettings and TabModuleSettings. In generally it looks the same. For example, we have Settings.ascx. Inside we save some settings, for example Template. So our code should be like this:
Have been worked with it for a long time. Also asked a lot of DotNetNuke gurus, but they did not provide concrete answer about difference between ModuleSettings and TabModuleSettings. In generally it looks the same. For example, we have Settings.ascx. Inside we save some settings, for example Template. So our code should be like this:
Sunday, 8 May 2011
Create User Programmatically in DotNetNuke
One colleague asked about example on how to create user in DotNetNuke programmatically. Here is simple example on C# how to do this:
DotNetNuke Module Development Certification
Last Friday have successfully passed 2 certifications: DotNetNuke Module Development Certification and DotNetNuke Professional Certification. Both are 100% successfully done. Very good feeling after it.
This info should be published at DotNetNuke official site within new Partners Directory and should make more clear selection process for customers.
PS: Will add link, once it will be available at the official DNN site.
DotNetNuke Unauthenticated Users Cache Bug
This is very popular bug for Unauthenticated Users in DotNetNuke. User arrives to the page, clicks link and nothing happens! It looks like page does not refresh at all. No PostBacks, nothing. And this gluck happens only for Unauthenticated Users. When user is logged in, then everything works fine.
This bug relates to the Cache Settings of the module. It can be fixed in few clicks:
This bug relates to the Cache Settings of the module. It can be fixed in few clicks:
- Go to the Settings of the module.
- Scroll down to the "Page Settings" - "Basic Settings" and expand it.
- There is a param "Cache Duration (seconds)". By default it is different from zero. You should set it to zero. It fixes problem.
Hope this helps!
Saturday, 7 May 2011
Custom Event In The Custom Control
It is good rule to add Custom Events in the Custom Controls you build. It allows easy to use your control from the external code without any problems.
How to add Custom Event? Very easy, just add this code to your class:
Custom Events are easy to create and easy to use. Lets use it!
Hope this helps!
How to add Custom Event? Very easy, just add this code to your class:
// delegate declaration
public
delegate
void
ChangingHandler(
object
sender);
// event declaration
public
event
ChangingHandler OnDoFilter;
// this one is to call event
private
void
FireOnDoFilter(
object
sender)
{
if
(OnDoFilter !=
null
)
{
OnDoFilter(sender);
}
}
Custom Events are easy to create and easy to use. Lets use it!
Hope this helps!
Friday, 6 May 2011
DotNetNuke Telerik Editor ToolBars
Each DotNetNuke developer can easy add RichEditor to the project. All what you need is to add control to your .ascx file, like this:
This code adds two RichEditors. One like simple textbox (DefaultMode="BASIC") and another fully WYSIWYG . RichEditor with WYSIWYG looks like this:
This is great! Users like it to use. It has a lot of ToolBars. Control provides very good functionality. But sometimes it needs to remove some ToolBars. So how to do this in the DotNetNuke module?
<%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx" %>
<
dnn:TextEditor
runat
=
"server"
id
=
"tbFirst"
DefaultMode
=
"BASIC"
></
dnn:TextEditor
>
<
dnn:TextEditor
runat
=
"server"
id
=
"tbSecond"
DefaultMode
=
"RICH"
></
dnn:TextEditor
>
This code adds two RichEditors. One like simple textbox (DefaultMode="BASIC") and another fully WYSIWYG . RichEditor with WYSIWYG looks like this:
This is great! Users like it to use. It has a lot of ToolBars. Control provides very good functionality. But sometimes it needs to remove some ToolBars. So how to do this in the DotNetNuke module?
Thursday, 5 May 2011
DataExporter for DotNetNuke
Very often Administrators and Developers of DotNetNuke have to work with data from the DataBase. Usually it needs to receive and to process the DataSet or transmit for processing into another application.
forDNN Team has made this module to make process of retrieving data from the DB more easy.
This module is pretty simple and fast. It allows to select DataSource: table, view or a custom query. List of tables and the view presented in the form like DropDowns. DropDowns contains names and number of entries for each of table/view.
Also module allows to choose the format in which data will be exported from the database. It supports three data formats: Excel, XML and CSV.
Module is available at the CodePlex: Installation and Source.
DotNetNuke Not Uniq Emails
Sometimes clients ask to make registration at the site with uniq emails only. It somehow prevents to appear duplicates of the users. But sometimes site is live already and have a lot of registered users, then it needs to find all users with not uniq emails in DB and to fix. It is possible with query like this:
SELECT
UserID,
UserName, FirstName, LastName, Email, DisplayNameFROM
{databaseOwner}{objectQualifier}Users
WHERE
Email
IN
(
SELECT
Email
FROM
{databaseOwner}{objectQualifier}Users
GROUP
BY
Email
HAVING
COUNT
(Email)>1
);
Hope this helps!
Tuesday, 3 May 2011
JavaScript Object: Properties and Methods
Sometimes it needs to get list of Properties and Methods of the JavaScript Object. Its very easy to do with code like this::
var
keysValues =
""
;
for
(
var
keyName
in
myObject)
{
keysValues += keyName +
" = "
+ myObject[keyName] +
", "
;
}
alert(keysValues);
This code shows list of all Properties and Methods of myObject.
Hope this helps!
The most stupid advertising...
The most stupid decision about advertising of the module for DotNetNuke was banner at the site AllDnnSkins. Small price $100 per month, but prepayment for 3 months forward. And only 5 visitors from this site per month! $20 per visitor - real shit. Experience is crazy expensive.
Friday, 29 April 2011
Configure Users Online in DotNetNuke
Users Online is very good module to display number of users at the site. Also it allows to show usernames of users at the site. To configure Users Online the module it needs to do few steps:
Friday, 22 April 2011
Create new page for DotNetNuke in background
Prehistory:
Some customers need to create a lot of pages at one time. This is why "Bulk Pages Creation" has been added to the Pages Admin - Tabs Manager. But few days ago one customer submitted bug. He tried to create about 500 pages in bulk. Less then 100 have been created, but other have been failed. Problem is httpRuntime executionTimeout in the web.config has small time and after 90 seconds (default value) it fails.
History:
Thursday, 21 April 2011
Number of versions in HTML module (DotNetNuke)
By default HTML module for DotNetNuke has deep of versions equal 5. And there is no way to change it with user interface. This is not good, because sometimes we need more versions to save.
We can fix it easy. Number of versions located in the Portal Settings table and can be easy changed with query like this:
UPDATE
{databaseOwner}{objectQualifier}PortalSettings
SET
SettingValue =
'5'
WHERE
(SettingName =
'MaximumVersionHistory'
)
AND
(PortalID=0);
All you need is just replace '5' with number of versions you need and PortalID with ID of your portal (usually 0).
Do not forget after this query restart Application Pool (Host/Host Settings/ Restart Application). It should update a cache.
Hope this helps!
Tuesday, 19 April 2011
How to add break to the ModuleActions for DotNetNuke module
Sometimes in the module for DotNetNuke there are a lot of Actions, like this:
It is not good for usability. Would be better to group items somehow with small breaks between Actions in the list, like this:
As you see breaks between items in the menu makes it more user friendly and grouped. it is very easy to add breaks like this, just need to pass special character "~" for Title for ModuleAction object. Here is example of code (C#):
Actions.Add(GetNextActionID(),
"Suppliers",
DotNetNuke.Entities.Modules.Actions.ModuleActionType.AddContent,
"", "", EditUrl("Currency"), false, DotNetNuke.Security.SecurityAccessLevel.Edit, true, false);
Actions.Add(new DotNetNuke.Entities.Modules.Actions.ModuleAction(GetNextActionID(), "~", ""));
Hope this helps!
It is not good for usability. Would be better to group items somehow with small breaks between Actions in the list, like this:
As you see breaks between items in the menu makes it more user friendly and grouped. it is very easy to add breaks like this, just need to pass special character "~" for Title for ModuleAction object. Here is example of code (C#):
Actions.Add(GetNextActionID(),
"Suppliers",
DotNetNuke.Entities.Modules.Actions.ModuleActionType.AddContent,
"", "", EditUrl("Currency"), false, DotNetNuke.Security.SecurityAccessLevel.Edit, true, false);
Actions.Add(new DotNetNuke.Entities.Modules.Actions.ModuleAction(GetNextActionID(), "~", ""));
Hope this helps!
Monday, 11 April 2011
Reverse SiteUrls in DotNetNuke
DotNetNuke made very good solution for custom URLs. This is SiteUrls.config file. It allows to add to this file something like this:
<RewriterRule>
<LookFor>.*/About.aspx</LookFor>
<SendTo>~/Default.aspx?TabID=40</SendTo>
</RewriterRule>
When your customers type something like http://mysite.com/About.aspx DotNetNuke Portals shows correct page from tabid=40. Issue happens when you click this page in the menu. Instead http://mysite.com/About.aspx it shows http://mysite.com/About/tabid/40/Default.aspx.
It confuses clients and search bots. Bots can penalize, because it looks like duplicates of content. This is why our team made small additional. It makes reverse lookup in the SiteUrls.config and replaces with related URL (if any).
Additional is free and opensource and available at codeplex.
<RewriterRule>
<LookFor>.*/About.aspx</LookFor>
<SendTo>~/Default.aspx?TabID=40</SendTo>
</RewriterRule>
When your customers type something like http://mysite.com/About.aspx DotNetNuke Portals shows correct page from tabid=40. Issue happens when you click this page in the menu. Instead http://mysite.com/About.aspx it shows http://mysite.com/About/tabid/40/Default.aspx.
It confuses clients and search bots. Bots can penalize, because it looks like duplicates of content. This is why our team made small additional. It makes reverse lookup in the SiteUrls.config and replaces with related URL (if any).
Additional is free and opensource and available at codeplex.
Saturday, 9 April 2011
How to refresh favicon.ico in the browser
Got small problem. After changing favicon.ico it has no affect for browser (Google Chrome). Both F5 and Ctrl+F5 do not help. The most popular recommendation in the web is to clear all history and cache in Google Chrome. This is not good solution for me, because a lot of settings for my work.
After small research i found a way how to do this easy. Just need to type in the address line
http://yoursite.com/favicon.ico
it shows your old icon, then click Ctrl+F5 and it shows correct one now. Then back to the site. See? Icon has been updated.
Hope this helps!
Thursday, 31 March 2011
Force file download instead showing in browser
Sometimes we would like to start attachment downloading instead showing in browser, for example for images (like PNG, JPG, GIF, etc). But usually browser displays content instead to prompt for saving. To fix this issue we just need to add one line of the code:
Response.AddHeader("Content-disposition", "attachment; filename=\"photo.png\"");
It adds header to the response and browser will prompt client for file saving.
Hope this helps.
Tuesday, 29 March 2011
Self-Signed Certificate and Trusted Root
Sometimes we generate own SSL certificates, for example internal use: development or testing. It saves us time and money. But usually browsers or other applications does not accept Self-Signed certificates.
This problem can be fixed easy. All what we need is to add certificate to the Trusted Root Certication Authorities. Sure, you should have admin permissions to do these steps:
1) Open mmc console.
2) Add Snap-in for Certificates.
3) Open Trusted Root Certication Authorities/Certiciates in Certificates.
4) Right click and select Import, then select your .cer or .crt file and click Next.
5) Select to put it under Trusted Root Certification Authorities, click Next and Finish.
Sometimes it requires reboot, but probably does not.
Hope this helps!
Sometimes DotNetNuke DataBase Grows Very Fast
This is very popular problem of DotNetNuke. DB grows very fast, ever you do not add any new modules and content is the same. The most popular problem is quick growing of the log tables SiteLog and EventLog.
One of my clients had this problem, because have been attacked by hackers and log grows very fast with errors. Another is because installed bad written module and this module throws a lot of exceptions.
You can check how many records in each table with query like this:
You can check how many records in each table with query like this:
SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}SiteLog;
and
SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}EventLog;
You can compare number of records for small period of time (for example 1 hour). If it grows fast, then here is a query to fix problem:
TRUNCATE TABLE {databaseOwner}{objectQualifier}SiteLog;
TRUNCATE TABLE {databaseOwner}{objectQualifier}EventLog;
TRUNCATE TABLE {databaseOwner}{objectQualifier}EventLog;
This query removes all records from these tables. It can be runned from Host/SQL menu.
Hope this helps!
Sunday, 27 March 2011
How to upgrade DotNetNuke module or SQL scripts for new versions
DotNetNuke (DNN) is very good CMS. It allows easy and fast build new modules without any problems. Furthermore it allows to do an upgrade of old modules with beautiful and perfect process. For example, we have Module with version 01.00.00. During installation all SQL scripts locate in the 01.00.00.SqlDataProvider. This file contains all required SQL for correct Module functionality.
In case you need to upgrade your module, then all what you do is add to your module new file, like 01.00.01.SqlDataProvider. During installation DNN framework checks current version and runs all scripts above current version. It allows to do cumulative upgrade without any problems.
But some clients do an upgrade manually and it can be a lot of headache. So here is a way how to protect your SQL script:
IF(
NOT EXISTS(
SELECT sc.name
FROM syscolumns sc
WHERE (sc.id IN
(SELECT so.id
FROM sysobjects so
WHERE so.name='{objectQualifier}Survey'))
AND
(sc.name='CategoryID')
)
)
BEGIN
ALTER TABLE {databaseOwner}{objectQualifier}Survey ADD CategoryID int NOT NULL DEFAULT(0)
END
As you see, this script checks for field before creation. So, do not need to worry customer runs it twice or more times.
PS: My old teacher said: Good code allows to remove half of lines and continues to work :)
Saturday, 26 March 2011
Recursive references in the projects
This is the most stupid thing i have ever seen in development. Few years ago there was a project from the client. Project was live already and required some major changes for it. Customer sent me a source and once i started to work, i found about 5 recursive references like: project1 references to the project2 and project2 references to the project1. This is very big problem with development, it means something wrong with architecture. I have moved required methods to the separate project and it fixed 4 recursive references. But 1 recursive reference still exists. This issue did not allow to compile project. Fix was easy: need to set in the properties of the reference "Copy Local" = false.
Hope this helps!
Friday, 25 March 2011
No processes to attach in Visual Studio
Usually to debug projects for DotNetNuke i attach to the aspnet_wp.exe process. Its very good way on how to debug modules for DotNetNuke. But sometimes there was big confuse. Once i opened list of processes to connect i got it empty. It confused me, how it can be?
After deep debugging problem has been found.Source of problem is frozen processes IEXPLORE. Once i killed them in Task Manager and restarted IIS, everything goes back and i can attach to process for Debugging.
Hope this helps!
After deep debugging problem has been found.Source of problem is frozen processes IEXPLORE. Once i killed them in Task Manager and restarted IIS, everything goes back and i can attach to process for Debugging.
Hope this helps!
How to Delete Multiple Pages at One Time at DotNetNuke
Sometimes we have to remove several tabs/pages from the portal in DotNetNuke. With standard tools it can take some time, but with Pages Admin - Tabs Manager it can be done in few seconds and just 3 steps. Just look at these screenshots:
Thursday, 24 March 2011
How to send POST in background
Sometimes it needs to send POST in the background and get some info. In our case we had to send POST to the Protx (UK payment gateway - now its SagePay). Here is quick C# script how to do this:
private string ChargeProtx(CreditCardInfo objCardInfo)
{
System.Net.HttpWebRequest request =
(System.Net.HttpWebRequest) System.Net.HttpWebRequest.Create("https://ukvpstest.protx.com/VSPSimulator/VSPDirectGateway.asp");
request.Method = "POST";
string postData = "VPSProtocol=2.22&" +
"TxType=PAYMENT&" +
"Vendor=vendorname&" +
"VendorTxCode=" + objCardInfo.OrderID + "&" +
"Amount=" + objCardInfo.Amount.ToString().Replace(",",".")+"&"+
"Currency=GBP&" +
"Description=Direct_payment&" +
"CardHolder=" + objCardInfo.FirstName + " " + objCardInfo.LastName + "&" +
"CardNumber=" + objCardInfo.Number + "&";
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(postData);
request.ContentLength = byteArray.Length;
System.IO.Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
System.Net.HttpWebResponse responseX = (System.Net.HttpWebResponse) request.GetResponse();
dataStream = responseX.GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
responseX.Close();
return responseFromServer;
}
private string ChargeProtx(CreditCardInfo objCardInfo)
{
System.Net.HttpWebRequest request =
(System.Net.HttpWebRequest) System.Net.HttpWebRequest.Create("https://ukvpstest.protx.com/VSPSimulator/VSPDirectGateway.asp");
request.Method = "POST";
string postData = "VPSProtocol=2.22&" +
"TxType=PAYMENT&" +
"Vendor=vendorname&" +
"VendorTxCode=" + objCardInfo.OrderID + "&" +
"Amount=" + objCardInfo.Amount.ToString().Replace(",",".")+"&"+
"Currency=GBP&" +
"Description=Direct_payment&" +
"CardHolder=" + objCardInfo.FirstName + " " + objCardInfo.LastName + "&" +
"CardNumber=" + objCardInfo.Number + "&";
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(postData);
request.ContentLength = byteArray.Length;
System.IO.Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
System.Net.HttpWebResponse responseX = (System.Net.HttpWebResponse) request.GetResponse();
dataStream = responseX.GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
responseX.Close();
return responseFromServer;
}
Hope this helps!
Wednesday, 23 March 2011
How to insert one DNN module into another
This is not common task between different modules. But it is good to use controls inside of single project and this is very popular. So, to add one module to another you just need to know name of the primary control. Then your form will be like this:
<%@ Register TagPrefix="dnn" TagName="MultiEdit" Src="~/DesktopModules/dnn.MultiEdit/MultiEdit.ascx" %>
<dnn:multiedit id="objMultiEdit" runat="server"></dnn:multiedit>
Hope this helps!
How to rotate SQL Table
There was very good customer from Australia. He always had interesting projects. One of this project was to show report on products sales. At start it looks like simple project, but there were two issues:
1) Customer had very big amounts of data in MS SQL.
2) He would like to show data grouped in columns, not rows.
First version of project does grouping in the columns at the C# code, but with such big amount of data it was crazy slow and takes a lot of memory. This is why grouping has been moved to the MS SQL side. Here is a beautiful script (sorry, but can't remember original source):
1) Customer had very big amounts of data in MS SQL.
2) He would like to show data grouped in columns, not rows.
First version of project does grouping in the columns at the C# code, but with such big amount of data it was crazy slow and takes a lot of memory. This is why grouping has been moved to the MS SQL side. Here is a beautiful script (sorry, but can't remember original source):
Strip non word or sanitizing text in DotNetNuke
Sometimes in DotNetNuke we would like to prepare some text to the sanitized form. This is very common task for preparing FriendlyUrls. I would like to recommend to use core DNN method:
public static string StripNonWord(string HTML, bool RetainSpace)
Member of DotNetNuke.Common.Utilities.HtmlUtils
It allows to remove not only spaces, but also all non-URL characters.
BTW: This function used in Core DNN on Tabs updating.
Hope this helps!
Tuesday, 22 March 2011
Blocked references in Visual Studio
Sometimes, when you try to compile project for DotNetNuke in Visual Studio it can not to do this. Error says: can't rebuild, because .dll of the project is locked. Sometimes it was real headache for me, because was really unexpected and unusual. First time i thought its problem with IIS, but later i found its problem with Visual Studio references. So, there are 4 steps to fix this issue:
1) Remove all references from your project (or whole solution). Try to rebuild - it shows errors, because can't find references.
2) Close Visual Studio.
3) Open solution and add all references.
4) Rebuild solution. It works now.
Hope this helps.
Let me introduce myself
My name is Sergey. I am developer from the prehistoric times. It starts a lot of years ago, when computers were big and slow and continues until today. For this long period i have got great experience: machine codes, Assembler, Basic, Fortran, C, Pascal, Prolog, later Delphi, VB, C++, C#, Java, PHP, Perl and sure databases DBase, Paradox, FoxPro, MSSQL, MySQL, PostGre...Really it should take a lot of time to describe everything.
Since 2002 i develop for Web. More then 75% of my projects are DotNetNuke oriented. DotNetNuke (DNN) is great Content Management System and this is good to work with this product and community. But DNN is not my single priority. Also a lot of requests from customers on synchronizing data between different products. There were some projects for NopCommerce, Magento, OpenErp, OpenBravo Pos.
This work is good. It allows me to work remotely with different customers from around the world. Thats great opportunity and very good experience!
Subscribe to:
Posts (Atom)