<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WhyPad</title>
	<atom:link href="http://www.whypad.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.whypad.com</link>
	<description>Tips, tricks, and hacks for life and tech...</description>
	<lastBuildDate>Mon, 15 Feb 2010 14:14:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ASP.NET: Hide Menu Items by Role with Security Trimming</title>
		<link>http://www.whypad.com/posts/asp-net-hide-menu-items-by-role-with-security-trimming/757/</link>
		<comments>http://www.whypad.com/posts/asp-net-hide-menu-items-by-role-with-security-trimming/757/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 17:37:56 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[ASP.NET/C#]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=757</guid>
		<description><![CDATA[ASP.NET makes authorizations and security fairly simple with its roleManager, Authentication, and SiteMap providers.  This quick hint only covers how to hide a particular menu item from the standard Menu and TreeList navigation components when using a SiteMap provider.
Web.config Settings for Role-based Menu Security
1) When you declare your sitemap provider, turn sucrityTrimmingEnabled to true:

&#60;siteMap defaultProvider=&#34;XmlSiteMapProvider&#34; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whypad.com/wp-content/uploads/hideme.png"><img class="alignleft size-thumbnail wp-image-758" title="hideme" src="http://www.whypad.com/wp-content/uploads/hideme-150x150.png" alt="" width="150" height="150" /></a>ASP.NET makes authorizations and security fairly simple with its roleManager, Authentication, and SiteMap providers.  This quick hint only covers how to hide a particular menu item from the standard Menu and TreeList navigation components when using a SiteMap provider.<span id="more-757"></span></p>
<h2>Web.config Settings for Role-based Menu Security</h2>
<p>1) When you declare your sitemap provider, turn sucrityTrimmingEnabled to true:</p>
<pre class="brush: xml;">
&lt;siteMap defaultProvider=&quot;XmlSiteMapProvider&quot; enabled=&quot;true&quot;&gt;
&lt;providers&gt;
    &lt;add name=&quot;XmlSiteMapProvider&quot; description=&quot;Default SiteMap provider.&quot; type=&quot;System.Web.XmlSiteMapProvider &quot; siteMapFile=&quot;Web.sitemap&quot; securityTrimmingEnabled=&quot;true&quot;/&gt;
&lt;/providers&gt;
&lt;/siteMap&gt;
</pre>
<p>2) After you&#8217;ve turned securityTrimmingEnabled on, then you can tell ASP what &#8220;locations&#8221; or url node to hide&#8230;again, in your web.config file, after you close out &lt;/system.web&gt;:</p>
<pre class="brush: xml;">

&lt;location path=&quot;~/MgrReports&quot;&gt;

&lt;system.web&gt;

&lt;authorization&gt;

&lt;allow roles=&quot;managers&quot;/&gt;

&lt;deny users=&quot;*&quot;/&gt;

&lt;/authorization&gt;

&lt;/system.web&gt;

&lt;/location&gt;
</pre>
<p>You can set which roles get access in the &lt;allow roles&gt; node&#8230;use commas to separate multiple roles.</p>
<p>I searched long and hard for this, and finally found a great post by Danny Chen.  Read his post for a much fuller explanation:  <a href="http://blogs.msdn.com/dannychen/archive/2006/03/16/553005.aspx">http://blogs.msdn.com/dannychen/archive/2006/03/16/553005.aspx</a></p>
<p>Cheers,</p>
<p>Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=757&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/asp-net-hide-menu-items-by-role-with-security-trimming/757/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Add Scripts to the Pages You Want</title>
		<link>http://www.whypad.com/posts/wordpress-add-scripts-to-the-pages-you-want/749/</link>
		<comments>http://www.whypad.com/posts/wordpress-add-scripts-to-the-pages-you-want/749/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 20:18:47 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=749</guid>
		<description><![CDATA[WordPress makes it very easy to load Scripts into your blog. The beauty of the method that WordPress provides is that it allows plugins and themes to use the same script at the same time by ensuring the script is loaded only once.  

The problem we often run into is that not everyone plays by [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whypad.com/wp-content/uploads/Lisu_script.gif"><img class="alignleft size-thumbnail wp-image-748" title="Lisu_script" src="http://www.whypad.com/wp-content/uploads/Lisu_script-150x150.gif" alt="" width="150" height="150" /></a>WordPress makes it very easy to load Scripts into your blog. The beauty of the method that WordPress provides is that it allows plugins and themes to use the same script at the same time by ensuring the script is loaded only once.  </p>
<p><span id="more-749"></span></p>
<p>The problem we often run into is that not everyone plays by the rules, and so you get plugin conflicts and fatal errors!</p>
<p>In this tip, I&#8217;ll show you how easy it is load scripts the right way with wp_enqueue_script and also, how to load them on only the pages you want.</p>
<h2>Load Scripts the Right Way with wp_enqueue_script()</h2>
<p>I have a couple of plugins out there that use jQuery and Thickbox, and probably 30% of my support questions are related to themes and/or plugins that load jQuery by hardcoding the link into the header!  This is a major sin by developers, because it assumes that your theme or your plugin is the only one in the whole wide world that your users will be using that rely on jQuery.  </p>
<p>When the jQuery (or really any other script) is hardcoded by a theme or plugin and it is loaded by another plugin (right way or wrong way), jQuery stops working!</p>
<p>WordPress, thankfully makes it amazingly simple to load jQuery and a ton of other scripts.  Here&#8217;s how:</p>
<pre class="brush: php;">
&lt;?php
//To load a script that isn't already registered with WordPress (it has a ton of pre-registered scripts like jQuery, Thickbox, etc)
wp_enqueue_script( $handle, $source, $deps, $ver, $in_footer );

//Here's one loading a script that's in my template folder
wp_enqueue_script('stlouie',get_bloginfo('template_url') . '/js/stl.js');

//Here's one loading a pre-registered script
wp_enqueue_script('jquery');
?&gt;
</pre>
<p>Check out the <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">WP Codex page</a> for a full description of how to use wp_enqueue_script and a list of the pre-registered javascripts that you can easily use.</p>
<p><strong>Note: I was trying to use wp_enqueue_script with TinyMCE outside of the Admin, and it didn&#8217;t work.  So, some scripts might be Admin Only&#8230;not sure <img src='http://www.whypad.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </strong></p>
<h2><strong>Where to Use wp_enqueue_script()</strong></h2>
<p>If you want to use wp_enqueue_script() in your posts and pages, and you want to limit it to certain pages or posts, you can put the following in your theme&#8217;s functions.php file:</p>
<pre class="brush: php;">
&lt;?php
add_action('wp_print_scripts', 'enqueueMyScripts');

function enqueueMyScripts(){
  // To load a script only on a Page with ID = 23, follow this format:
    if( is_page('23') ) {
         wp_enqueue_script( 'myscript', get_bloginfo('template_url') . '/js/myscript.js');
   }

  //To load for any page/post that's not Admin
   if( !is_admin() ){
        wp_enqueue_script( 'myscript', get_bloginfo('template_url') . '/js/myscript.js');
   }

  //You can use pretty much any of the WP conditional tags to determine whether to enqueue or not
}
?&gt;
</pre>
<p>Here&#8217;s the link to the <a href="http://codex.wordpress.org/Conditional_Tags">WP Conditional Tags</a>.</p>
<p>Notice that you need to tap into the wp_print_scripts action instead of the &#8216;init&#8217; action since is_page() is not available yet in the init action.</p>
<p>I&#8217;ve recorded this because it took me a good bit of time to figure out to use wp_print_scripts instead of init&#8230;Placing the add_action() inside header.php didn&#8217;t work either. Vladimir Prelovac&#8217;s <a href="http://www.prelovac.com/vladimir/best-practice-for-adding-javascript-code-to-http://www.prelovac.com/vladimir/best-practice-for-adding-javascript-code-to-wordpress-plugin">helpful post</a> put me on the right track&#8230;He also has a great book,<a href="http://www.amazon.com/gp/product/1847193595?ie=UTF8&amp;tag=byronbennett-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1847193595">WordPress Plugin Development (Beginner&#8217;s Guide)</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=byronbennett-20&amp;l=as2&amp;o=1&amp;a=1847193595" border="0" alt="" width="1" height="1" />*! This book was very helpful to me with several techniques, particularly around adding images to the WordPress media library.</p>
<p>Cheers,<br />
Byron</p>
<p>* Note: the link to Vladimir&#8217;s book is my affiliate link, and I&#8217;ll receive a small commission should you click and buy.</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=749&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/wordpress-add-scripts-to-the-pages-you-want/749/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; Can&#8217;t Automatically Upgrade to New Versions?</title>
		<link>http://www.whypad.com/posts/wordpress-problem-automatic-upgrade/743/</link>
		<comments>http://www.whypad.com/posts/wordpress-problem-automatic-upgrade/743/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 04:52:06 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=743</guid>
		<description><![CDATA[So, another security fix comes out for WordPress&#8230;2.8.6 this time.  And I begin making the rounds to my sites upgrading.  This is now a ritual for me since some kind hacker hacked me with the 2.7 hidden admin user exploit.  Everything is going smooth&#8230;I&#8217;ve done 3 sites, when I get to a new site I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whypad.com/wp-content/uploads/wp.png"><img class="alignleft size-thumbnail wp-image-715" title="wp" src="http://www.whypad.com/wp-content/uploads/wp-150x150.png" alt="wp" width="150" height="150" /></a>So, another security fix comes out for WordPress&#8230;2.8.6 this time.  And I begin making the rounds to my sites upgrading.  This is now a ritual for me since some kind hacker hacked me with the 2.7 hidden admin user exploit.  Everything is going smooth&#8230;I&#8217;ve done 3 sites, when I get to a new site I&#8217;m working on, and it will not automatically upgrade for anything.<span id="more-743"></span></p>
<h2>Symptom: Upgrade WordPress Automatically gets Hung</h2>
<p>The symptoms here are that after clicking the Upgrade now link and then Upgrade Automatically, it goes through and faithfully uploads the new WordPress files from WordPress.org, but then it stops!  I&#8217;m stuck at the Uploading files message. </p>
<h2>Solution: You&#8217;ve gotta be on PHP5 (or at least some later version than my hosts version of 4)</h2>
<p>I found a Google post that recommended deactivating all plugins&#8230;no luck <img src='http://www.whypad.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>I&#8217;m deleting folders and checking permissions&#8230;everything I can think of.  I had the same problem last week when I upgraded to 2.8.5 and I don&#8217;t want this to be an ongoing issue.</p>
<p>This site is on the same server that 2 other sites upgraded perfectly on, mind you.</p>
<p><a href="http://www.whypad.com/wp-content/uploads/php.gif"><img class="alignright size-full wp-image-502" title="php" src="http://www.whypad.com/wp-content/uploads/php.gif" alt="php" width="120" height="67" /></a>Then, some synapse fires and I think&#8230;hmmm&#8230;.htaccess&#8230;PHP 4&#8230;.hmmm.</p>
<p>My host defaults to PHP 4 by default.  You have to include a cryptic little line in your .htaccess file to get it to use PHP 5: </p>
<p>AddType x-mapp-php5 .php</p>
<p>This is a new site and I forgot to do that&#8230;once added, the automatic WordPress upgrade works like a charm.</p>
<p>Your host may have a setting in the Admin panel or some other means of designating to use PHP5 instead of 4.  If you&#8217;re reading this, I hope this is your problem, simply because it&#8217;s easy to fix!</p>
<p>Mystery solved.  Hope it helps!</p>
<p>Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=743&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/wordpress-problem-automatic-upgrade/743/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress ReWrite &#8211; new Plugin Coming and a Hint</title>
		<link>http://www.whypad.com/posts/wordpress-rewrite-new-plugin-coming-and-a-hint/738/</link>
		<comments>http://www.whypad.com/posts/wordpress-rewrite-new-plugin-coming-and-a-hint/738/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 06:08:07 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=738</guid>
		<description><![CDATA[First of all, let me start by saying that Custom ReWriting in WordPress has consumed way more of my time than it ever should have.  I have prayed and pleaded, even considered asking one of the WordPress Gurus on their message board, but I&#8217;ve not had much luck getting responses there (questions were probably so [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, let me start by saying that Custom ReWriting in WordPress has consumed way more of my time than it ever should have.  I have prayed and pleaded, even considered asking one of the WordPress Gurus on their message board, but I&#8217;ve not had much luck getting responses there (questions were probably so esoteric that nobody cared but me <img src='http://www.whypad.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ).</p>
<p><span id="more-738"></span></p>
<p>Finally, I have my new plugin working, I think!  It gives you an interface in the Admin for setting up your ReWrite Rules and then handles all the rest behind the scenes.  I&#8217;m not sure how robust it is, but it meets my needs.</p>
<p>I had 2 humongous problems that ate up 10 hours or more of my time.  Hope this helps you if you decide not to go the easy route and just you Smashly ReWriter (coming soon to a download near you!).</p>
<h2>Page ID, ID, Post ID, PageName, P</h2>
<p>The aliases for getting a page to come up in WP are nearly endless.  But when using $wp_rewrite rules, you have to be careful.  While index.php?page_id=245 might work for a post if you type it into a browser, save yourself, oh, about 6 hours and make sure you match up Pages with ?page_id= and Posts with ?p= when creating rewrite rules.</p>
<h2>&amp;amp; or &amp; ?</h2>
<p>Save yourself another 4 hours and don&#8217;t try to get fancy and write your urls the way you think they ought to be to be XHTML compliant&#8230;that is, using &amp;amp; to join multiple query variables.  Sometimes it doesn&#8217;t pay to be too proper.</p>
<p>A good xhtml url would have parameters inserted like:  state=NC&amp;amp;city=CLT</p>
<p>WP Rewriter wants it just plain ole:  state=NC&amp;city=CLT</p>
<p>Well, I hope the new plugin will help somebody out there.  I&#8217;m planning to release in the next few days over on <a href="http://smashly.net">Smashly.net</a>.  It makes this business about as simple as I can possibly come up with.  Hopefully some RegEx wizards will contribute some common match rules to help people along.</p>
<p>Cheers,</p>
<p>Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=738&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/wordpress-rewrite-new-plugin-coming-and-a-hint/738/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mac OS X Snow Leopard &#8211; NotificationExec Pop Up Annoyance</title>
		<link>http://www.whypad.com/posts/mac-os-x-snow-leopard-notificationexec-pop-up-annoyance/732/</link>
		<comments>http://www.whypad.com/posts/mac-os-x-snow-leopard-notificationexec-pop-up-annoyance/732/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 00:53:33 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=732</guid>
		<description><![CDATA[Just installed Mac OS X 10.6 on my home iMac.  It was truly a perfectly painless experience&#8230;click about 4 buttons and type your password and walk away for 45 minutes.

The only thing that marred the experience was a nasty and undying popup for installing Rosetta so it could run NotificationExec.  Click Not Now [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whypad.com/wp-content/uploads/snowleopard.png"><img class="alignleft size-full wp-image-734" title="snowleopard" src="http://www.whypad.com/wp-content/uploads/snowleopard.png" alt="snowleopard" width="143" height="146" /></a>Just installed Mac OS X 10.6 on my home iMac.  It was truly a perfectly painless experience&#8230;click about 4 buttons and type your password and walk away for 45 minutes.</p>
<p><span id="more-732"></span></p>
<p>The only thing that marred the experience was a nasty and undying popup for installing Rosetta so it could run NotificationExec.  Click Not Now and it just comes back a few seconds later.  Truly annoying!</p>
<p>A couple minutes on Google yielded this <a href="http://forums.macrumors.com/showthread.php?t=435236">form post</a> on MacRumors.</p>
<p>The answer for me was to navigate to /Library/Driver Support/ and to trash the NotificationExec.app in between the popups.</p>
<p>So, the steps are:</p>
<ol>
<li>Navigate to: /Library/Driver Support/   &#8211; you should see NotificationExec.app in that folder</li>
<li>Go to Force Quit (Apple menu) and make sure there aren&#8217;t any instances of the popup hanging out</li>
<li>Wait for the popup and click:  &#8220;Not Now&#8221;</li>
<li>Then trash:  NotificationExec.app</li>
<li>You may have to enter your admin password so you can change Finder</li>
<li>Empty trash and resume life!</li>
</ol>
<p>Hope that helps!</p>
<p>Cheers,<br />
Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=732&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/mac-os-x-snow-leopard-notificationexec-pop-up-annoyance/732/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Dilbert &#8211; Successful Work Avoider</title>
		<link>http://www.whypad.com/posts/dilbert-successful-work-avoider/722/</link>
		<comments>http://www.whypad.com/posts/dilbert-successful-work-avoider/722/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 15:31:35 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[Miscellany]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=722</guid>
		<description><![CDATA[My gosh, these are good!  Enjoy!

]]></description>
			<content:encoded><![CDATA[<p>My gosh, these are good!  Enjoy!</p>
<p><a href="http://dilbert.com/strips/comic/2009-08-08/" title="Dilbert.com"><img src="http://dilbert.com/dyn/str_strip/000000000/00000000/0000000/000000/60000/3000/300/63348/63348.strip.gif" border="0" width='96%' alt="Dilbert.com" /></a></p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=722&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/dilbert-successful-work-avoider/722/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgraded to WordPress 2.8.1</title>
		<link>http://www.whypad.com/posts/upgraded-to-wordpress-2-8-1/714/</link>
		<comments>http://www.whypad.com/posts/upgraded-to-wordpress-2-8-1/714/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 04:55:35 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[Miscellany]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=714</guid>
		<description><![CDATA[I&#8217;ve upgraded three sites to WordPress 2.8.1.  None of them missed a beat.  Also, PhotoSmash seems completely unfazed by its new bedfellow.

The auto-upgrade function/feature purely rocks.   It takes less than a minute, while FTP&#8217;ing the entire 2.2 MB to you server can take a dozen.
Thanks for the smoothness, WP Heros!
Cheers,
Byron
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whypad.com/wp-content/uploads/wp.png"><img class="alignleft size-thumbnail wp-image-715" title="wp" src="http://www.whypad.com/wp-content/uploads/wp-150x150.png" alt="wp" width="150" height="150" /></a>I&#8217;ve upgraded three sites to <a href="http://wordpress.org/development/2009/07/wordpress-2-8-1/">WordPress 2.8.1</a>.  None of them missed a beat.  Also, <a href="http://www.whypad.com/posts/photosmash-galleries-wordpress-plugin-released/507/">PhotoSmash</a> seems completely unfazed by its new bedfellow.</p>
<p><span id="more-714"></span></p>
<p>The auto-upgrade function/feature purely rocks.   It takes less than a minute, while FTP&#8217;ing the entire 2.2 MB to you server can take a dozen.</p>
<p>Thanks for the smoothness, WP Heros!</p>
<p>Cheers,</p>
<p>Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=714&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/upgraded-to-wordpress-2-8-1/714/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP &#8211; How to Block a Profit Center from Posting</title>
		<link>http://www.whypad.com/posts/sap-how-to-block-a-profit-center-from-posting/696/</link>
		<comments>http://www.whypad.com/posts/sap-how-to-block-a-profit-center-from-posting/696/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 15:31:09 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[SAP]]></category>
		<category><![CDATA[SAP FICO]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=696</guid>
		<description><![CDATA[Blocking a Profit Center from posting in SAP should be easy, right?  Well, it is, but there is one little trick you need to know, or you will spend hours trying to figure out why you can still post to your supposedly blocked profit center.

Here is the step-by-step:

Go to T-code KE52 and call up your [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whypad.com/wp-content/uploads/sap_logo.jpg"><img class="alignleft size-full wp-image-698" title="sap_logo" src="http://www.whypad.com/wp-content/uploads/sap_logo.jpg" alt="sap_logo" width="125" height="63" /></a>Blocking a Profit Center from posting in SAP should be easy, right?  Well, it is, but there is one little trick you need to know, or you will spend hours trying to figure out why you can still post to your supposedly blocked profit center.</p>
<p><span id="more-696"></span></p>
<p><a href="http://www.whypad.com/wp-content/uploads/ke52.jpg"><img class="alignright size-full wp-image-699" title="ke52" src="http://www.whypad.com/wp-content/uploads/ke52.jpg" alt="ke52" width="434" height="350" /></a><strong>Here is the step-by-step:</strong></p>
<ol>
<li>Go to T-code KE52 and call up your profit center</li>
<li>Go to the Indicators tab and put a check in the Lock indicator</li>
<li>Save
<ul>
<li>Note that this will save your changes in an Inactive Status. You may be thinking that is a good thing and that you&#8217;re done&#8230;I was.  But you&#8217;re not.  If you go to FB50 or 9KE0 and try to post to that profit center, it will let you post away all day long.  One more step.</li>
</ul>
</li>
<li>Click the Match stick button to Activate your new state: <a href="http://www.whypad.com/wp-content/uploads/activate_icon.jpg"><img class="alignnone size-full wp-image-700" title="activate_icon" src="http://www.whypad.com/wp-content/uploads/activate_icon.jpg" alt="activate_icon" width="22" height="24" /></a></li>
</ol>
<p>Do not mess with the Validity periods unless you&#8217;ve got a good reason to.  The real key here is setting the Lock indicator and making sure that is Active.  Think of it as Actively locking your profit center <img src='http://www.whypad.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  .</p>
<p>Cheers,</p>
<p>Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=696&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/sap-how-to-block-a-profit-center-from-posting/696/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP &#8211; F.50 Profit Loss Adjustment or Cash Discount Details</title>
		<link>http://www.whypad.com/posts/sap-f50-profit-loss-adjustment-or-cash-discount-details/691/</link>
		<comments>http://www.whypad.com/posts/sap-f50-profit-loss-adjustment-or-cash-discount-details/691/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 22:22:55 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[SAP]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=691</guid>
		<description><![CDATA[There are a few things, well maybe more than a few, that SAP asks you to just take on faith.  Running the Classic GL on ECC 6.0 or prior (4.6 c, etc), the Cash Discount calculation (also known as the Profit Loss Adjustments calculation, T-code: F.50) is one of them.

As a general ledger accountant and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whypad.com/wp-content/uploads/profit-and-loss-adjustment-692009-44654-pm-2.jpg"><img class="alignleft size-thumbnail wp-image-692" title="profit-and-loss-adjustment-692009-44654-pm-2" src="http://www.whypad.com/wp-content/uploads/profit-and-loss-adjustment-692009-44654-pm-2-150x150.jpg" alt="profit-and-loss-adjustment-692009-44654-pm-2" width="150" height="150" /></a>There are a few things, well maybe more than a few, that SAP asks you to just take on faith.  Running the Classic GL on ECC 6.0 or prior (4.6 c, etc), the Cash Discount calculation (also known as the Profit Loss Adjustments calculation, T-code: F.50) is one of them.</p>
<p><span id="more-691"></span></p>
<p>As a general ledger accountant and FICO ninja, you may have come to accept the fact that SAP knows what it&#8217;s doing with that calculation and you don&#8217;t really question it.  But for a field manager whose Cash Discount comes in unexpectedly high (for CD allowed) or low (for CD earned), the easy answer is that Accounting must be missing something, and nothing would make you feel better than to check their math.</p>
<p>So as the FICO guru you&#8217;re stuck with explaining how this calculation works? And figuring out how you can show the details?  Let&#8217;s take the second part of that first.</p>
<h2>Getting the Details for the P&amp;L Adjustment Calculation?</h2>
<p><a href="http://www.whypad.com/wp-content/uploads/profit-and-loss-adjustment-692009-41454-pm.jpg"><img class="alignleft size-full wp-image-693" title="profit-and-loss-adjustment-692009-41454-pm" src="http://www.whypad.com/wp-content/uploads/profit-and-loss-adjustment-692009-41454-pm.jpg" alt="profit-and-loss-adjustment-692009-41454-pm" width="480" height="350" /></a>I&#8217;m not sure if this works prior to ECC 6, but you can take a look if you&#8217;ve not made the ECC 6 leap.  Here&#8217;s a simple step-by-step to get SAP to generate a Log file of the original documents that created the P&amp;L adjustment.  In the case of an AR adjustment (cash discount allowed), that will be a billing document.  For Cash Discount earned, that&#8217;s an AP document.  Here&#8217;s what you need to do:</p>
<ol>
<li>In F.50, you&#8217;ll need to fill in the Company Code, year, and periods first (you will probably get an error if you click buttons without them filled)</li>
<li>Next, click the All Selections button (shift &#8211; F7) &#8211; this is shown in image to left.</li>
<li>Go to &#8216;Output Control&#8217; at bottom of selection and put a check in &#8216;Log at line item level&#8217;, and give it a heading (see the last image in the post for that)</li>
<li>After you fill out your normal selection criteria and execute, you should have a log file that is viewable in SM37</li>
<li>You can download the logfile to a text file and import into Access or your tool of choice.</li>
</ol>
<p><a href="http://www.whypad.com/wp-content/uploads/profit-and-loss-adjustment-692009-44654-pm-1.jpg"><img class="alignleft size-full wp-image-694" title="profit-and-loss-adjustment-692009-44654-pm-1" src="http://www.whypad.com/wp-content/uploads/profit-and-loss-adjustment-692009-44654-pm-1.jpg" alt="profit-and-loss-adjustment-692009-44654-pm-1" width="378" height="480" /></a>The value of this information is questionable, which is why SAP doesn&#8217;t just give it to you up front.  But if you&#8217;ve got an inquiring mind (or someone with one is bugging you for it), this data will let you get back to the original transactions to see exactly where these adjustments are coming from.  You&#8217;ll need to know something about the types of documents to know where you can view them, for instance, you can view the Billing Docs in VF04 for the CD Allowed lines.</p>
<h2>How does the Profit Loss Adjustment calculation work?</h2>
<p>So, the next question is how does this calculation work?  That depends on the type of transaction we&#8217;re dealing with.  Bear in mind that this is Class GL, not the New GL, that we&#8217;re talking about here.  My company is using Classic GL right now, so I don&#8217;t really know how this works in New GL&#8230;yet!</p>
<p>So, for a billing document, the AR and Cash discount originally are posted to your dummy profit center.  When you run F.50 to transfer the Cash Discount (F.5D for transferring the AR), the system looks at the original document and pulls the correct profit center from there, transferring the amounts from the Dummy Profit Center to the correct one.</p>
<p>On the AP side, Cash Discount may be using the GR/IR document for the profit center, but I&#8217;m not 100% sure.</p>
<h2>UPDATE: Note &#8211; Run F.50 Only Once per Period</h2>
<p>The Application Help in SAP warns that the program may only be run once per Period.  You can run it for separate company codes and probably accounts, but it should only be run once per combination.  If you do attempt to run it again, it will generate the following warning:</p>
<p><a href="http://www.whypad.com/wp-content/uploads/f.50-run-only-once.png"><img class="size-full wp-image-755 alignnone" title="f.50-run-only-once" src="http://www.whypad.com/wp-content/uploads/f.50-run-only-once.png" alt="" width="507" height="441" /></a></p>
<p>Note that you could hit enter and go on through the Warning message, and it would create the batch input again.  The problem is that you&#8217;d probably have duplicate postings if you ran the batch input again.  I don&#8217;t think it reverses previous entries&#8230;if anyone has confirmation, please let me know!</p>
<p>I needed to capture this info for future reference, but hopefully it&#8217;ll help someone else out as well!</p>
<p>Cheers,<br />
Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=691&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/sap-f50-profit-loss-adjustment-or-cash-discount-details/691/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>C# &#8211; SQL Server Foreign Key, Unique constraints</title>
		<link>http://www.whypad.com/posts/c-sql-server-foreign-key-unique-constraints/682/</link>
		<comments>http://www.whypad.com/posts/c-sql-server-foreign-key-unique-constraints/682/#comments</comments>
		<pubDate>Wed, 27 May 2009 21:40:24 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[ASP.NET/C#]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=682</guid>
		<description><![CDATA[I got tripped up today with a particularly nasty Join statement that worked perfectly form 90% of the queries, but was blowing up at times.  The error message was: 

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
I looked and looked at this SQL code:

SELECT Process.ProcessID, Process.Name, Process.Description, Process.ResultLogStatusID, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whypad.com/wp-content/uploads/unique_key_constraint.gif"><img class="alignleft size-thumbnail wp-image-684" title="unique_key_constraint" src="http://www.whypad.com/wp-content/uploads/unique_key_constraint-150x150.gif" alt="unique_key_constraint" width="150" height="150" /></a>I got tripped up today with a particularly nasty Join statement that worked perfectly form 90% of the queries, but was blowing up at times.  The error message was: </p>
<p><span id="more-682"></span></p>
<p>Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.</p>
<p>I looked and looked at this SQL code:</p>
<pre class="brush: sql;">
SELECT Process.ProcessID, Process.Name, Process.Description, Process.ResultLogStatusID, Process.StatusTimeStamp, ResultLogStatus.Name AS ProcResult, RequirementTestLink.RequirementID

FROM RequirementTestLink

LEFT JOIN Process ON Process.ProcessID = RequirementTestLink.ProcessID

LEFT JOIN ResultLogStatus ON Process.ResultLogStatusID = ResultLogStatus.ResultLogStatusID

WHERE (RequirementTestLink.RequirementID IN (&quot; + sReqs + &quot;))

ORDER BY RequirementTestLink.RequirementID, Process.ProcessID
</pre>
<p>It looked perfectly legit to me. I figured out that there would be multiple instances of Process.ProcessID in the RequirementTestLink table. But this shouldn&#8217;t have been a problem since it would just create multiple rows for the multiple instances.</p>
<h2>Relax or turn off constraints in your DataSet.</h2>
<p>The problem was that I was using a SQL Adapter to fill a DataTable. When I made the DataTable, it got junked up with Primary Key and Foreign Key constraints on the ProcessID field. The answer had been right there in the message (see image below).  They spelled it out in the first line:  &#8220;Relax or turn off constraints in your DataSet&#8221;. It took me 30 minutes to work it out on my own&#8230;if I&#8217;d just actually read those pop ups (but so often they are so cryptic I can&#8217;t comprehend them <img src='http://www.whypad.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  ).<br />
<a href="http://www.whypad.com/wp-content/uploads/fk-constraint.gif"></a><br />
<a href="http://www.whypad.com/wp-content/uploads/relax_constraints.gif"><img class="alignleft size-full wp-image-689" title="relax_constraints" src="http://www.whypad.com/wp-content/uploads/relax_constraints.gif" alt="relax_constraints" width="450" height="228" /></a></p>
<p><a href="http://www.whypad.com/wp-content/uploads/delete_key_button.gif"><img class="alignright size-full wp-image-688" title="delete_key_button" src="http://www.whypad.com/wp-content/uploads/delete_key_button.gif" alt="delete_key_button" width="180" height="236" /></a>So, to get rid of that Primary Key:</p>
<ol>
<li>Left click on the key icon (you can see it in the image at right beside ProcessID)</li>
<li>Right click on the same key icon and select &#8216;Delete key&#8217;. </li>
</ol>
<p><a href="http://www.whypad.com/wp-content/uploads/fk-constraint.gif"><img class="alignleft size-thumbnail wp-image-683" title="fk-constraint" src="http://www.whypad.com/wp-content/uploads/fk-constraint-150x150.gif" alt="fk-constraint" width="150" height="150" /></a>If that doesn&#8217;t do it for you, then zap the Foreign Keys as well.  You can see one coming in at the top right (left picture).  Click on the line and delete it.</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=682&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/c-sql-server-foreign-key-unique-constraints/682/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
