Wednesday, July 22, 2009

DotNetNuke module development : Broke UI while using AjaxControlToolkit TabPanel

I was developing a DotNetNuke module for our Code71.com website. I was using ajaxcontroltoolkit’s tabpanel for this module. Everything was working fine in firefox. But when I checked that module in IE, UI of the TabPanel was broken :(.


casestudy_broken

I searched in for the issue, but could not find related to this problem. After spending a whole day trying to solve the problem (by changing css), I found that it was working fine with the default skin of DotNetNuke but broken with my custom skin! Then I copied all code from default skin to my custom skin, but still it was broken :(. Then I compared rendered HTML for two different skin and found that only difference is in DOCTYPE!


In my custom skin, I did not defined any DOCTYPE, so it was automatically generating -

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">


Then I changed the DOCTYPE and the UI was working fine.




casestudy_fixed




To define a DOCTYPE for your skin in DotNetNuke, you have to create a xml file defining the DOCTYPE in your skin directory. This xml file should be named as [SkinName].doctype.xml. For example, if your skin name is MySkin then DOCTYPE file name will be MySkin.doctype.xml. Content of the xml file should be like this -



<SkinDocType>

  <![CDATA[<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">]]>


</SkinDocType>

Thursday, July 2, 2009

Elasticfox showing error “Invalid EC2 private key” while trying to get “Administrator Password”

If you are using Amazon EC2 and Elasticfox then getting the error “Invalid EC2 private key” is very common with Windows instance while trying to use command “Get Administrator Password”.


invalid_key

To solve this problem you need to change the "EC2 Private Key Template" setting of Elasticfox. Click on "Tools" in elasticfox window. It will bring the settings window.


ec2_settings

You will find that the settings for "EC2 Private Key Template" is set with the file extension ".ppk". For example "C:\EC2\AWS_KEY${keyname}.ppk".
Now change this value with the path where your private key file is saved which was used to create the instance and change the extension to .pem. So after changing the setting it will look something like "C:\EC2\AWS_KEY\${keyname}.pem"


ec2_settings_correct
Hope this tips will solve the problem with getting administrator password using Elasticfox.

Tuesday, June 2, 2009

DotNetNuke module development : Custom module permission

By default dotnetnuke provides role based permission in Page and module level. In module level it provides View/Edit permission by default. By using this module level permission you can give access to all View or Edit controls to any numbers of roles. But if you need this permission in more granular level, for example – you want to create an Article module where a regular user will be able to view any article and post comment (all view controls). You want another type of permission (ArticleWriter) which will be able to add new articles and to approve and publish those articles you need another permission (AritclePublisher) who will be able to add as well as approve any article. To implement this scenario you will need to add another two permission in your module.

 

By default DotNetNuke does not provide any easy way to do it without writing some codes. I have found one blog post in DotNetNuke.com and one article in CodeProject which explains the way to add new permissions in a module. I think these two articles will be very useful for anyone trying to add custom permission in his module.

Wednesday, April 22, 2009

How to get Skin directory in DotNetNuke

If you want to keep your skin images or any other type of file that is related to your skin into skin directory, you need to get the path of that skin directory. To resolve the path of your skin directory DotNetNuke provides a property named “SkinPath” which belongs to DotNetNuke.UI.Skins.Skin class. You need to use <%= SkinPath %> to get the path of skin directory.

 

If you stored an image named “nav_back.jpg” in your skin directory and you want to set it as a background of a <td>, your code should be like -

<td style="background-image: url(<%= SkinPath %>nav_back.jpg);">

Friday, April 10, 2009

NetBeans J2ME Project debugging problem : Attaching to localhost:xxxxx Connection refused

After a long time I was working on a J2ME application using NetBeans. Previously that application was built using WTK and I was trying to add those source file in new netbeans project.

Application was compiling properly. But When I was starting debug, it was showing "Attaching to locahost:5999 Connection refused" in "Debugger Console". At first I thought that port is used by some other program or firewall was blocking NetBeans to use that port. But I found that port was not being used or blocked by any other program. Then I carefully examined all of the messages in NetBeans output window and found following message -
com.sun.kvem.midletsuite.InvalidJadException: Reason = 22
The manifest or the application descriptor MUST contain the attribute: MIDlet-1

After some googling I found the way to solve this "com.sun.kvem.midletsuite.InvalidJadException: Reason = 22" exception. When this exception was solved, "Attaching to localhost:xxxxx Connection refused" problem was also solved!!!

Here are the process to solve that InvalidJadException -

From your problematic NetBeans Mobility Project folder open /nbproject/project.properties (default project directory is My Documents\NetBeansProjects) file using any text editor. Search for the property "manifest.midlets". You will find something like - manifest.midlets=MIDlet-1: , , \n
In this manifest.midlets property, midlet name is missing, so NetBeans was giving that error. To solve that exception you need to add your midlet name here. For example, if your midlet name is "HelloMidlet" which is under package "hello" then you need to change the line like -
manifest.midlets=MIDlet-1: HelloMidlet, , hello.HelloMidlet\n