Wednesday, November 14, 2018

My Goodreads - Reading Challenge 2018

I registered to Goodreads couple of yours back out of curiosity and started to actively reading books in 2016 and 2017 but was just struggling to allocate enough time to regularly read. At the very end of 2017, I found about reading challenge in Goodreads and opt in for the reading challenge of 2018 to read 8 books. I shortlisted books before 2018 started and bought paper back copies of first three books before new year starts.

Was it difficult?

Well, I admit it was difficult. Taking a challenge builds pressure on you and its not good to add another reason to stress out yourself when you have so many of them already! All I focused to think was to try look for suitable time to read and always keep a book with me in my bag. Its okay if I do not finish the challenge but at least I would be able to read some books or in a worst case pages.

There were times when I was moving along with the book in my bag and did not read any single page in weeks. At times the books that I chose seems to be boring, so I had to pause with that book and switch over to other ones. I talked about my challenges to lot many people in office and friend circle so that they keep asking me about the progress.

All these things helped but it was still difficult to finish 8 books.

Here are books that I completed. Feel free to react on the challenge if you have good reads account.


What's the catch?

In the beginning I started with some of the big and lengthy books. Based on the time left in the year, I just adjusted my reading list with some small books that I wanted to read out of my big list of books. You will see In search of excellence, thinking fast and slow etc are big books with heavy concepts that takes time to understand. As the year progressed, I just picked up small books like zero to one and I cheated by adding Sea Prayer which is just a picture book that hardly takes 20mins to read.

Join in, let's try it in 2019

As we are heading towards 2019, I will be taking up Goodreads Reading challenge to read 10 books this time. Do you want to join in? Let's do it together!

P.S. - I am in Ahmedabad and all my books are available to be borrowed free of cost for reading.






Saturday, September 2, 2017

Leadership in software development - At Level 1

John Maxwell has described 5 levels of leadership which help leaders in any business domain to understand where they are and where to go from there. His book "The 5 Levels of Leadership: Proven Steps to Maximize Your Potential" covers the levels in much more details with example. In this article, I will share what I have learned from my experiences and challenges I faced during my Level 1 of leadership and how I was able to make it through to next level.

How you make team feel?

Being a newly introduced leader, team will not be knowing you beyond a formal introduction. Communications and action during initial days are most important  and here is what is recommended.
  • Be a curious listener and allow your team members to speak. 
  • Do not provide solutions right away. Make sure that its just information that do not require action, a general complain that requires taking note or a problematic situation where immediate action from your end is required.
  • Do not talk about your expertise, experiences etc to show you are right person to solve their problems. Instead, take appropriate actions, solve the in hand problem in your responsibility and thank the team for helping you. Actions influence the team more than talking!
By having you in the team, they should start feeling more empower, supported and capable.

Focus on basics

Being a leader of any software development team, you must understand what they work on daily basis and how they accomplish expected output with very good details and here is what is recommended.
  • Know what work means in your team and how everybody feels about the timelines, deliveries and output (productivity + quality) expected. 
  • Know what is maturity level of must have basic processes that can help them.
  • Do not criticize or change anything unless you understand WHY they follow existing processes. Ask WHY to the team and listen to them carefully.
  • Do not start changing anything until you fully monitor and understand full set of followed processes for several time.
By having you in the team, when team talks to you about work, you should be able to fully understand it. Even if you cannot solve all their problems as a new leader, listening and understanding  their problems will help you a lot build confidence and trust in the team.

Ask how can you help? 

There are times when team is busy doing their regular work disconnected from you. Visit them at least once in a day asking how they are dong with their work and if you can you help with something. This will give a clear message that you are available to them and open to help.

Appreciate

Keep an eye on smallest achievements of the team and make them feel proud by doing a quick team meeting. Give credit to full team work and celebrate by clapping and appreciating all hard work that has been done by the full team.

In my experience, periodic round of appreciation always motivate people to create a great team bonding. People will prefer to help each other more, crave to achieve more and work harder to receive more of these kind of achievements.

Conclusion

Being at Level 1 is exciting! You are full of energy, learning initial lessons of leadership and working hard towards moving forward to level 2! Hope this quick tips will help you! Feel feel to share your ideas and experience on the same by putting comments below!

Stay in touch & Good luck with your journey of leadership!

Wednesday, October 12, 2016

How to create certificate for any domain from free certificate authority

Before we start

Before we start we will need the domain/sub domain for which you want to generate https certificate is up and running on http.

Get Certificate, Key and CA Certificate

  1. Goto https://www.sslforfree.com/ and enter your domain/sub domain and click on Create Free SSL Certificate
  2. Click on "Manual Verification" and then "Manually Verify Domain"
  3. download the file "Download File #1" and upload it to specified path
  4. Click on download certificate and download certificate, key and ca certificate.
  5. download openssl for windows from http://slproweb.com/products/Win32OpenSSL.html
  6. put your certificate and key in bin directory of openssl installation where you have openssl.exe.
  7. fire command "OpenSSL.exe pkcs12 -export -in cer.cer -inkey key.key -out iis-cert.pfx" where cer.cer is the certificate and key.key is the key file download from sslforfree.com.
  8. It will ask you for a password and as it again to confirm. Once you type same password twice, it will generate iis-cert.pfx that you can rename.
  9. go to iis server and select the iis server node
  10. click on server certificates
  11. click on import in the top right section and choose iis-cert.pfx and enter password.
  12. This will import ssl certificate in the iis certificate store that you can assign to any site in iis when you choose https binding.


 
 

Thursday, November 27, 2014

Integrating servicestack 3 into DNN - Part 1 - Introduction

Introduction

In this series of blogs, I will try to share my thoughts of using ServiceStack 3 in DotNetNuke 6, difficulties, limitations and how I finally solve each problem step by step.

Part 1 - Introduction

Background

I started looking at ServiceStack 3 years back when I was working with one of the client who provided ServiceStack services and asked me to use them as back end instead of storing data in DotNetNuke database.

At the end of project, I learned a lot about servicestack.client and associated facilities and then I invested some time using servicestack to deliver rest base services. Now a days ServiceStack and asp.net web API both are obvious options if you are planning to start any asp.net web services along with WCF. It depends on your experience, your team's experience an vision a lot.

After learning ServiceStack, I utilized it in couple of asp.net based projects which are either conversion of cold fusion to .net services or interoperable database independent service development with .net and I was very happy with the way I achieved best results because of ServiceStack

So, some time back, when I started architect a new web platform for one of my recent client, who was using DotNetNuke and wanted their platform to support APIs so that they can be used with navite mobile apps, I decided to use ServiceStack again in this scenario as well!

Try ServiceStack 3 Hello world!

  1. From Nuget Package Manager Console:
    install-package servicestack -version 3
  2. Since I wanted the base url of the servicestack to start from /api/ instead of / I did some web.config modifications:
    1. In handlers section added following line:
       <add path="api*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
    2. in modules section added following line:
       <add name="ServiceStack.Factory" path="api*" verb="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" resourceType="Unspecified" requireAccess="Script" allowPathInfo="true" preCondition="integratedMode" /> 
    3. If you have webdev enabled, do following to support PUT, DELETE verbers ONLY if these verbs are not working in handlers section:
      <remove name="WebDAV" />
Now, servicestack hosting on web requires writing code in global.asax Application_Start event and I was stuck there! I found more than one solution on internet to achieve this, but I decided to modify the code to add another line to initialize servicestack by writing: new AppHost().Init()

I know change dotnetnuke core dll is not good practice. Suggestions are welcome to fix this in the best possible way!

In the next part we will start coding a real api!

Saturday, July 26, 2014

Do you really need role base pages in dotnetnuke?

Introduction & Background

I have experience working on an existing dnn site that has lots of custom features and I join the team to contribute as developer, lead or code reviewer. Many times during last 8 years of such experience, I found lots of people are creating role base pages in dotnetnuke and implement some custom login in either login module or somewhere else that can check the role and redirect.

Is this really required?

Example Scenario

Lets say you are working on a hospital portal in dotnetnuke and want to prepare a dashboard for care taker, admin, manager, and bunch of other roles. 

If you create different pages and drop a single module for role wise dashboard, and use some custom logic to redirect user after login to that page, that is something that needs a second though.

Dotnetnuke security inherited from portal > Tab > Module. Inheriting up to module level is recommended for most of the cases.

I would create a page(tab) and drop all the modules that I prepared for role wise dashboards. I would do multiple modules to make things separate and clean but drop all modules to the same page. In module settings of each module, uncheck the inherit permission button and check the role which is expected to see this module. 

Now, without having too much of coding/customization and tricks, each role can easily access data that is expected to their roles. Easy!

What do you think?



Sunday, January 6, 2013

System.ArgumentException: Exception of type 'System.ArgumentException' was thrown. Parameter name: encodedValue

I was configuring one of our clients farm which required FBA on different web applications (around 5) and he wanted each web application should have separate user store. That was too tricky since you just need to set up Application property of the membership provider and you are done.

After completion of these settings, all of my applications were having a common exception either in log out or login to the web application. Here was the exception.

System.ArgumentException: Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue    at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(IClaimsIdentity claimsIdentity, String encodedIdentityClaimSuffix)     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)     at Microsoft.SharePoint.Utilities.SPUtility.GetFullUserKeyFromLoginName(String loginName)     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

After checking all my steps right through starting. After getting all the other exeptions cleared the above exception was the only exception that I was getting. That was resolved using "Exception of type 'System.ArgumentException' was thrown" got error when i have signout from webapplication in sharepoint 2010?.

I hope this will help to you if you are getting same error due to a silly custom property of a custom web part for registration!

Monday, December 31, 2012

SharePoint 2010 foundation on windows 7

If you are planning to install SharePoint 2010 foundation in your windows 7 machine, there are very good references out there in many blogs. But after I installed it I was not able to create new web applications.

I noticed, I was an administrator account with different name than administrator. I found here that we can enable in built administrator account.

I enabled administrator account and added it to managed accounts and farm administrators group.

After trying so many things from forums, finally I got everything working in SharePoint Foundation in my machine!

Monday, July 23, 2012

DotNetNuke: As an E-commerce help portal

DotNetNuke is a powerful content management system. I can say this because I am following DotNetNuke and improving myself since early 4.x release of it. I decided to spend some time on highlighting some of the key projects that I have done during last 6 years, that can describe capabilities of DotNetNuke. Here is the first one.

GolfOnline.co.uk - is an online e-commerce portal. An e-commerce portal feel completed once integrated with an easy to use, and great performing CMS. As a solution Help.GolfOnline.co.uk is built as an answer. This site is built using DotNetNuke and is working so well.

Here is the highlight of key features:
  1. Authoring: Contents can be hidden to users unless they are approved and intended to show to end users. 
  2. Branding: Flexible enough to re-use some of the ASCX controls from e-commerce web application for branding purpose. Integration went a little tricky but no problems at all. Most of the css/js/images are used from 
  3. Performance: Performs like accessing html pages
  4. Customization: Build/customize in whatever way you can. Good examples is sub tabs module to - showing child pages are tabs. (jQuery UI, jQuery, DotNetNuke API)
  5. CDN: Capability to integrate CDN so that css, js and some static html can be steamed through CDN.
  6. SEO: Free of cost implementation of custom urls (Thanks to iFinity Friendly Url Provider), along with all the goodness of SEO. 
  7. Search: This feature isn't used on site but it can be. In built search engine to find content.
  8. Quick: Go live in no time.
Please get some time and visit help.golfonline.co.uk and feel the strength of DotNetNuke. Notice the yslow rating and responsiveness of the site. 
I believe DotNetNuke can be smartly utilize to provide such kind of solutions in no-time. Isn't it?



Wednesday, February 1, 2012

Database Design : Smartly storing many user settings with Boolean values in a single value - Part 2

If you have visited a previous post, where I have demonstrated how you can use bit masks to reduce your settings table.

Update:
There are situations where this solution will NOT do well. Example are cases where you are having many settings OR expecting more settings in future. After some point, your calculated integer or big integer will become very huge and may cause out of limit. so be careful while deciding to use this solution.

ALSO, in place of integers, you can use bitbinary datatype with appropriate length and use appropriate bitwise operators in sql server. That will surely gain more performance.

Thanks to Yougeshwar Patel, Team Lead, Silver touch technologies for bring this to my notice.

Sharepoint: Creating web application from existing content database

There are situations where you want to propagate one SharePoint web application to some other farm/machine.   I feel the fastest way is to take content database backup and restore it in your destination farm. I have done so in last couple of weeks and I have leaned how to quickly do that.

Here are quick notes from my experience:
Pre-requisites:
I was provided with content database backup and source code. That makes be able to restore site and generate wsps from source code.

Creating  content database from backup:
Go to your database server and do following:

  • Create a blank database that will be used as content database 
  • Restore a database using content database back up from source farm.


Creating a web application:

  • Go to sharepoint central administration and create a new web application
  • While creating a new web application, use existing content database in database section
  • Sometimes if your database is too large, web application creation takes too long and times out. Don't worry at all. web application is still created successfully. It happened to me 4 times out of 5. 
Validating the web application:
  • Go to sharepoint central administration, click on application management. In "Databases" section you will find "Manage content databases"
  • Choose your application and it will show database status and number of site collections. If you are not sure how many site collections are there in backup, anything greater than 0 is good news.
Configure web application to work properly:
we are almost done now. Do following:
  • Go to sharepoint central administration
  • Click on "Application Management"
  • In "Site Collections" section click on "Change site collection administrators"
  • choose your web application set proper data in site admins.
Additional optional steps:
After performing all the above steps, it is still possible that you are not able to access your web application. 
  • Last thing to do is to install and deploy wsp by using stsadm or your favorite method. 
Conclusion:
It is always challenging to move applications from one farm to another. Specially when they are depending upon other service applications. In spent last two weeks to learn how to properly do that. I hope this will help you at some point during your sharepoint development.

Happy sharepoint administration!

Thursday, January 5, 2012

Exeception: admin/Menus/DNNActions OR DotNetNuke.UI.Containers.ActionButtonList.get_ModuleActions throws null reference exception

Problem:

If you have deleted or your dotnetnuke installation failed to install DDR Menu module, you will get following.

an error has occurred. DotNetNuke.Services.Exceptions.PageLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.UI.Containers.ActionButtonList.get_ModuleActions() at DotNetNuke.UI.Containers.ActionButtonList.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---

OR

An error has occurred.DotNetNuke.Services.Exceptions.PageLoadException: Couldn't load menu style 'admin/Menus/DNNActions': System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Web.DDRMenu.DNNCommon.DNNContext.get_ModuleFolder() at DotNetNuke.Web.DDRMenu.DNNCommon.PathResolver.Resolve(String path, RelativeTo[] roots) at DotNetNuke.Web.DDRMenu.MenuBase.Instantiate(String menuStyle) ---> System.ApplicationException: Couldn't load menu style 'admin/Menus/DNNActions': System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Web.DDRMenu.DNNCommon.DNNContext.get_ModuleFolder() at DotNetNuke.Web.DDRMenu.DNNCommon.PathResolver.Resolve(String path, RelativeTo[] roots) at DotNetNuke.Web.DDRMenu.MenuBase.Instantiate(String menuStyle) at DotNetNuke.Web.DDRMenu.MenuBase.Instantiate(String menuStyle) at DotNetNuke.Web.DDRMenu.DDRMenuControl.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---

Solution

It is a good news if you are installing your new dnn instance, you can download latest installation source from dotnetunke.codeplex.com and that will work just fine.

If you are already having dnn site running and you uninstalled the  DDR menu  by mistake, or you are upgrading the site or DDR menu  and that caused this problem, there are some ways to fix this.

Download and setup local copy of fresh dnn installation and do following:

  1. Open web.config of fresh install, and search ddr in it. Copy the DDR entry from it and paste it to appropriate section of your site's web.config.
  2. from fresh install replace /admin/menus and /desktopmodules/ddrmenu folders to your site folder.
  3. download  http://dnnddrmenu.codeplex.com/releases/70987/download/264940 and paste it into /install/module folder
  4. Browser for yoursite.com/Install/install.aspx?mode=InstallResources and that's it
In my case, we were trying to upgrade the DDR menu and found the broken site that was restored using above steps. 

For more updates and hints visit this thread on dotnetnuke forums

Monday, January 2, 2012

Using dapper .net to log site visitors in sqlite database - Part 1

Dapper .net is a simple light weight micro ORM

I came to this library (in fact a single page) while I was learning posts related to how StackOverflow.com is built. I also noticed that the library is independent of the database, and is useful if you are using any database.

I feel it is promising, and I am going to write a very simple site visitor logging component with this. The database I will use will be Sqlite and will log all the page views into database with the user, user agent and url referrer.

There will be following two NuGet packages that I will require:
  1. Dapper .net
  2. System.Data.Sqlite (I am using x86)
I am going to use Application_AuthenticateRequest in Global.asax to add logging.

All the code will be available at https://trickycoders.svn.codeplex.com/svn/WebsiteLogging

stsadmin -o deploysolution: access denied error

When

As like 80% of the sharepoing developers, if you are deploying your solutions trough command line.

What

After firing deploysolution, looking at system settings > farm solutions and the error looks something like "Can not overrite xxxx file, access is denied".

Solution

It was due to my source file was read only. I tried by un-checking the read only attribute from properties for source file and tried the command again. I got the same error couple of times and repeating the same solution fixed the problem.

Conclusion

As a social animal, when I get such kind of error first time in my life, I first ask to couple of developers around me if they have seen the same error ever, that helps a lot. When I do same, I got many useful hints that can either quickly solves the problem or useful for some future problems.

Update - 3-Jan-2011:

If you are having more than one application server in farm then you have to go through all of them and uncheck read only to get it working.

Got the same error? Don't worry try above solution and let me know if same OR some other solution worked for you.

Happy sharepoing deployment!






Thursday, December 29, 2011

GoDaddy - Using host entries to access your site by IP

Problem

Your site is live right now and you want to transfer it to another account hosted in GoDaddy.com. You have configured the site in new account and want to test it, but you can not directly update the DNS records without testing. You don't want to purchase a static IP for this. So, there should be a way to test your site before updating DNS records.

Solution

One of the solution is the use hosts entries. That will help you to access your domain point to the new IP only for you. That way, when other people accesses www.yoursite.com, it will be served from original site, but because of the host entry, when you try to access www.yoursite.com it will be served from the new server. I found the detailed instruction here: http://help.godaddy.com/article/3354

Friday, December 23, 2011

Runtime error: ; expected


I was working in asp.net with vb.net for for almost 3 years now, and now after 3 years, just started working on c# as back end language. So many times in a day I miss writing ; and got the this error!

I recently got this error in ascx control as well, when I was working in a repeater item template and missed # and write Eval like <% Eval...

Compiling code in C# reminds me to the starting of my career since I have worked on C# first.

Friday, December 16, 2011

Sharepoint: Debugging - which process to attach

As some of you may already be knowing, I have just joined a team of sharepoint developers and right now learning sharepoint development.



This is my first day to work on a development after watching videos and reading books and I already find myself lost while attaching to the process for debugging a webpart control in sharepoint. Here is how I finally got my ProcessID to attach:

Just open command prompt as administrator and type following:

%windir%\system32\inetsrv\appcmd.exe list wp

Hope this will help to the developers who are new OR not knowing the way to find which process to attach.

Happy coding.

Sunday, April 10, 2011

OSDNNSKINS: New version of cash and multiflex with portal template available

Hi all,

New Version for Cash and Multiflex is available for download. This time we have three common changes for both of the skin packages.
  1. There is only single package for skin and container installation
  2. Portal template is available to quickly evaluate the skin. 
  3. Both of the skins are tested in dnn 6.0.0.44 
For those who are not knowing about this, open source dotnetnuke skins is an initiative to provide high quality free skins to dnn community.

More contributors to osdnnskins:

We have more contributors to join the party, so we welcome issues and suggestions from community in order to help them provide quality skins for free.

there are lots of evaluations and  also there are many sites using skins from osdnnskins, there are very less number of comments and feedback that we get.


Please please please provide your feedback about any skin that you evaluate and you can directly go to osdnnskins.codeplex.com to create a new issue or you can email me any time for any kind of help regading the same.
You can contact email @ lakhlaniprashant [at} gmail [dot} com

Thursday, April 7, 2011

Database Design : Smartly storing many user settings with Boolean values in a single value

It is obvious that when we design database tables for storing user preferences we look user settings as one-to-many relationship, but there are cases when all your setting values are boolean. For example, you have many type of newsletters (infoq.com has .net, java, soa etc) and you want to user choices, OR you have many categories of articles and you want to store which categories user is interested to browse, user choose tags (fev tags)  are also good example in stackoverflow.com.

Problem:
How to efficiently store user preferences which are all having boolean values.

Classic solution:
  • Create a subscription_type database which stores all the subscription types
  • Create a user_subscription table user_subscriptions with columns user_id and subscription_id
  • Insert a new row for each kind of subscription for each user
  • Delete a row for each kind of subscription user un-check (In case user checks the subscription and un-checks it after some days)
This will work fine but the only problem is to maintain an extra table for storing the details.

Better Solution:
  • Create a subscription_type table which stores all the subscription types.
  • add a new column in users table for subscription.
  • use following query to retried user subscriptions:
    select
            user_id,
            case when
                subscription & power(2,subscription_type_id) =0
            then 0
            else 1 end as is_subscribed,
            subscription_type_id,
            subscription_type_name
        from users cross join subscription_types
        where user_id = @user_id
  • user following query to store user subscription:
    select sum( power(2,subscription_type_id)) from subscription_types where subscription_type_id in (1,2,3)
here subscription_type_id in (1,2,3) describes the subscription type id user is subscribed to.

How It Works:
We are storing sum of binary power as user preference. For example, user is subscribed to subscription type 0,1, and 3 we are storing power(2,0) + power(2,1) + power(2,3) = 1 + 2 + 8 = 11.
For reading a boolean value of subscription we are using t-sql’s AND (&) operator. We are doing and operation of 11 and binary power of subscription type, and it we get 0 means user is not subscribed, otherwise we will get power(2,subscription_type) as result of AND operation.

Conclusion:
We can say the solution is better because you can using single query to read and write the subscription. It is more faster, and requires no additional table. There are many other advantages that you can think of.

Limitations:
Every time you take this kind of solution, you are killing possibility to store details that depends on the relationships. In our subscription example, you will never get information about when does a user subscribed to which subscription type individually.
If that is not important to you, you can obviously go for it.

Note:
Please note that in actually situations, subscription table and related designs are really more complicated than what I’ve shown above, so it demonstrates the example scenario and not the example database design for any kind of system.
Have fun with your database design!

Saturday, December 11, 2010

Using master pages and aspx pages in dnn

In this post, we are going to see how we can add new aspx pages by re-using the existing skin designs to implement some helpfull programming in it.


Why?


If you are running a multi-portal dnn website and want to build some common pages to share between those portals, there are couple of quick ways to do that.

  1. 1. Create a new tab in portal 0 and then share link in all other portals.
    This technique works fine when you want to show "how to" page or help page, static contents or offers related pages. You don't need any custom coding for this and it will be a matter of adding a text html module and paste the html that you designed!
  2. 2. Create a new aspx page and share link in all other portals.
    Well, this one also looks similar to first option but let's think about this: If you are running a multi-portal dnn site and want to show latest offers from all the portals into a page based on user's country, and users having at least 5 orders in history. Now, this will involve some quick coding to do. So, basically, if you want to show content based on some dynamic parameters like user or portal data or similar data, it will be good to create an aspx page.
There is another option! obviously you can create a new module to do this, but remember that we are not doing anything that depends on moduleId or tabId but depends on UserId or PortalId, so I believe it's a quick way to create a new page in place of building an entire dnn module.

How?

  1. 1. Create a new theme
    Create a new theme with the name of your skin and paste your skin's css and images into it.
  2. 2. Create a new master page
    Create a new master page and paste your skin's ascx control's entire markup over there. Replace all your content pane (i.e. div or tds with runat=server) with CotentPlace holder
  3. 3. Create a new page
    - Add a new aspx page called Default2.aspx and select the new master page when creating it. 
    - Go to .aspx.vb file and make your parial page class inherit from DotNetNuke.Framework.PageBase in place of System.Web.UI.Page 
    - And that's it you are ready to go!

Conclusion

It is really easy to add a new aspx page in dnn that is re-using skin and you will be able to access all the information like PortalSettings, UserInfo etc. Things like Tab and Module will not be there and it's obvious!
This post doesn't say you should create a new aspx page in some cases or not, but demonstrates how to do it if you want. If you have some good examples WHEN we can use it or some good examples WHEN we should NOT use it, I welcome them! 
This example will probably work with dnn 4.x and 5.x, though I've used this in dnn 4.5.6 and 5.2.0 etc.

Downloads

You can download the example code for this example from codeplex Happy coding with dnn

Saturday, December 4, 2010

DotNetNuke 5.6 - A potentially dangerous Request.Form value was detected from the client

Today morning, when I was preparing for a new installation instance for dnn 5.6, I was facing trouble to install new module, create new tab and I come to the conclusion that any post back event from the site was causing the "potentially dangerous Request.Form value".

I was still able to install module using /Install/Install.aspx?mode=installresource but finally stuck when I was not able to add the installed module into page.

Finally, after reading several articles on web, I found web.config's httpRuntime element needs another attribute called : requestValidationMode="2.0"

I go the solution here (
http://stackoverflow.com/questions/81991/a-potentially-dangerous-request-form-value-was-detected-from-the-client/3368769#3368769).

And finally, I was on my way to regular work.
please note that I was trying this on having webmatrix installed and I was browsing the site in asp.net 4.0 integrated mode.
Hope this will help to someone in the same kind of trouble.

Popular Posts