|
Subject:
|
Articles/links that have TBH relevance
|
|
Posted By:
|
jimibt
|
Post Date:
|
10/15/2007 7:22:18 AM
|
The idea of this thread is that articles or links are posted hi-lighting various techniques or tips that can be adapted for use in TBH to either make it more scalable, simpler or generally more elegant. I'll kick off with this article:
http://davidhayden.com/blog/dave/archive/2007/09/26/SoftwareDevelopmentTipAvoidRaceConditionsUsingTesterDoerPattern.aspx
followed by code examples of it's use presently and proposed in TBH:
presently from BLL\Forums\Forum.cs:
public static Forum GetForumByID(int forumID) { Forum forum = null; string key = "Forums_Forum_" + forumID.ToString();
if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null) { forum = (Forum)BizObject.Cache[key]; } else { forum = GetForumFromForumDetails(SiteProvider.Forums.GetForumByID(forumID)); BaseForum.CacheData(key, forum); } return forum; }
proposed/amended:
public static Forum GetForumByID(int forumID) { Forum forum = null; string key = "Forums_Forum_" + forumID.ToString();
// get the cachedata upfront into an object object data = BizObject.Cache[key]; if (BaseForum.Settings.EnableCaching && data != null) { // if test is passed, then set forum to typeof (Forum)data; forum = (Forum)data; } else { forum = GetForumFromForumDetails(SiteProvider.Forums.GetForumByID(forumID)); BaseForum.CacheData(key, forum); } return forum; }
hope this makes sense. it certainly 'beats' the race condition and the if statement really only tests for cacheing being enabled as well as the data object not being null. if the condition is met, then the Forum forum object is set to the data object as type Forum.
one worth modifying and using throughout.
[edit] the url above is making the page very wide, i couldn't get the standard <a href="www.site.com">description</a> to work. any tips??
jimi
http://www.originaltalent.com
|
|
Reply By:
|
Maxxim
|
Reply Date:
|
10/15/2007 8:00:11 AM
|
It's a good point!
The first version was:
if (BaseForum.Settings.EnableCaching && BizObject.GetCacheData(key) != null)
But, and if you write:
if (BizObject.GetCacheData(key) != null && BaseForum.Settings.EnableCaching)
?
Did you tested if the first condition is FALSE, ASPNET will verify the second condition?
|
|
Reply By:
|
Maxxim
|
Reply Date:
|
10/15/2007 8:16:04 AM
|
:( I forgot the Null Check
I'll edit the last post
|
|
Reply By:
|
jimibt
|
Reply Date:
|
10/15/2007 8:36:53 AM
|
Max,
yes, no matter the order of the expressions within the brackets, both will be evaluated. however, if an exception were to occur on the 1st expression, then the second would not be evaluated.
jimi
http://www.originaltalent.com
|
|
Reply By:
|
jimibt
|
Reply Date:
|
10/15/2007 9:06:47 AM
|
Another little TIP. based on a question by trystanc on this forum, he asked about the thread safety of singleton patterns. after a bit of research, i came up with a minor change that addresses the failure in the TBH implementation. anyway, here's a link to the original thread, as well as my code changes below:
http://p2p.wrox.com/topic.asp?TOPIC_ID=65461
here's how my ForumsProvider (DAL\Provider\ForumsProvider.cs) 'intro' looks now:
namespace MB.TheBeerHouse.DAL { public abstract class ForumsProvider : DataAccess { static private readonly ForumsProvider _instance = (ForumsProvider)Activator.CreateInstance( Type.GetType(Globals.Settings.Forums.ProviderType));
static ForumsProvider() { }
static public ForumsProvider Instance { get { return _instance; } }
public ForumsProvider() { this.ConnectionString = Globals.Settings.Forums.ConnectionString; this.EnableCaching = Globals.Settings.Forums.EnableCaching; this.CacheDuration = Globals.Settings.Forums.CacheDuration; } // other code below unchanged
hope this makes sense.
jimi
http://www.originaltalent.com
|
|
Reply By:
|
Maxxim
|
Reply Date:
|
10/17/2007 6:25:45 PM
|
If someone wants to add Page Threads Links to BrowseThreads Page do follow the link on the bottom. (This script can redirect too to last page! If you want to go to the second page of thread127 you use ...showthread.aspx?threadid=127&pg=2 If you want to go to the last page of thread127 you use ...showthread.aspx?threadid=127&pg=last)
The result is: http://img521.imageshack.us/img521/1346/linkpagespm9.jpg
The script is: http://p2p.wrox.com/topic.asp?TOPIC_ID=65938
|
|
Reply By:
|
ViagraFalls
|
Reply Date:
|
10/18/2007 4:49:14 AM
|
Jimi, I'd nominate your post where you described how to add threads to the breadcrumbs to be posted here, too :)
http://entropia-online.blogspot.com/
|
|
Reply By:
|
jimibt
|
Reply Date:
|
10/18/2007 4:51:33 AM
|
quote: Originally posted by ViagraFalls
Jimi, I'd nominate your post where you described how to add threads to the breadcrumbs to be posted here, too :)
http://entropia-online.blogspot.com/
Peter,
ermm - i can't remember that one . could you add the link??
thanks !!
jimi
http://www.originaltalent.com
|
|
Reply By:
|
ViagraFalls
|
Reply Date:
|
10/18/2007 5:45:13 AM
|
Posted - 03/20/2007 : 4:53:20 PM Report Abuse
-------------------------------------------------------------------------------- TIP!! ========
quick tip (this may have been covered before but it bugged me for a few hours). to get the breadcrumbs to 'follow' from forum to threads, you have to do 2 things:
1. amend the web.sitemap as follows:
<siteMapNode title="$Resources: SiteMap, Forum" url="~/ShowForums.aspx"> <siteMapNode title="$Resources: SiteMap, Browse_Threads" url="~/BrowseThreads.aspx" /> <siteMapNode title="$Resources: SiteMap, Thread" url="~/ShowThread.aspx" /> </siteMapNode>
2. open the App_GlobalResources\SiteMap.resx and add a new entry:
name: Browse_Threads Value: Browse Threads
thats it - rebake and your breadcrumbs should now be complete!! :) Posted by jimi in this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=57522&whichpage=1#top
http://entropia-online.blogspot.com/
|
|
Reply By:
|
jimibt
|
Reply Date:
|
6/4/2008 5:01:03 AM
|
found an interesting article re a project called 'velocity' which describes the 'next' big thing in layering the application architecture. basically, it's a kind of distributed 'super-cache' that sits between the business layer and the data access layer. does it sound familiar . anyway, i think the idea would be to have an actual cache layer between the BLL and DAL. you can read the 1st thoughts on it here:
http://blogs.msdn.com/velocity/archive/2008/06/02/introducing-project-codename-velocity.aspx
[edit] plus followup on the initial blog:
http://blogs.msdn.com/velocity/archive/2008/06/03/microsoft-project-code-named-velocity-followup.aspx
jimi
http://www.originaltalent.com
|
|
Reply By:
|
jimibt
|
Reply Date:
|
6/4/2008 5:27:38 AM
|
i'm also kinda liking the idea on NxBRE (RuleML in a c# format) as a 1sr step twds taking the domain object rules out of the code and saving as XML (with a hgraphical user interface for the business user). i think this has great milage if properly implemented and kept very simple (i.e the user interface for this would have to be akin to using word/excel/visio etc, but even simpler!!)
anyway, here's a little background on that:
http://www.computerboek.nl/pdf/9780596527549.pdf
plus the actual sourceforege link to the project:
http://nxbre.wiki.sourceforge.net/
jimi
http://www.originaltalent.com
|
|
Reply By:
|
jimibt
|
Reply Date:
|
8/1/2008 7:46:02 AM
|
i found a nice site for a good standards compliant css template. it's pretty extensible insofaras it gives options to create the site layout in a multitude of formats. i'm going to be adapting a few of them for my own site in the coming weeks but you can get an idea of what you can expect by taking a sneak peak at the 'demo' page. the site includes a link for the full download of the 'kit' as well.
have fun:
http://www.1234.info/webtemplates/multiflex5/demo/
jimi
http://www.originaltalent.com
|
|
Reply By:
|
jimibt
|
Reply Date:
|
8/18/2008 1:53:06 PM
|
a little genral tip that i have overlooked sharing for ages and thought it time that i added it. this 'tip' allows the editor in vs to show faint 'tramlines' at various indentation levels to allow for easy 'eyeballing' of related code structures etc...
basically, you need to copy the code below and save it to a file called (for example) vs tramlines.reg
here's the code:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor] "Guides"="RGB(240, 240, 216) 4, 8, 12, 16"
the code can be expanded to as many or few 'tramlines' as you please by adding/removing the digits after the RGB expression as can the indentation 'level' (for example, 3,6,9 would result in 3 tramlines with a 3 space separation etc).
hope this is clear(ish)...
[edit] forgot to add, you'll need to close and reopen vs to see the effect of th4e change...
jimi
http://www.originaltalent.com
|