Thursday, December 29, 2011
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:
Hope this will help to the developers who are new OR not knowing the way to find which process to attach.
Happy coding.
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.
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
New Version for Cash and Multiflex is available for download. This time we have three common changes for both of the skin packages.
- There is only single package for skin and container installation
- Portal template is available to quickly evaluate the skin.
- Both of the skins are tested in dnn 6.0.0.44
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:
Better Solution:
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!
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)
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)
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!
Subscribe to:
Posts (Atom)
Popular Posts
-
Hi all, Creating a modal popup for asp.net users is always easy, its simply a modal panel, modal popup extender of asp.net ajax and all is ...
-
// using DotNetNuke.Entities.Portals; // using System.Collections; PortalAliasController paController = new PortalAliasController(); PortalA...
-
I was configuring one of our clients farm which required FBA on different web applications (around 5) and he wanted each web application sho...