<?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>Top Web Guy .com</title>
	<atom:link href="http://topwebguy.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://topwebguy.com</link>
	<description>Now You Have a Webmaster</description>
	<lastBuildDate>Sat, 29 Jan 2011 02:48:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Turn Off Inflections (Singular Plural) in CakePHP</title>
		<link>http://topwebguy.com/turn-off-inflections-singular-plural-in-cakephp/</link>
		<comments>http://topwebguy.com/turn-off-inflections-singular-plural-in-cakephp/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 02:48:27 +0000</pubDate>
		<dc:creator>TopWebGuy</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://topwebguy.com/?p=36</guid>
		<description><![CDATA[I am going to be very honest, guys. When I started learning CakePHP it was a great amazement to me that they decided to impose plural for names of data model entities. By most popular data modeling methodologies names of entities (tables) in a database should be singular. Data for users should be in a [...]]]></description>
			<content:encoded><![CDATA[<p>I am going to be very honest, guys. When I started learning CakePHP it was a great amazement to me that they decided to impose plural for names of data model entities. By most popular data modeling methodologies names of entities (tables) in a database should be singular. Data for users should be in a table called user, date for products should be in table product etc., etc.</p>
<p>OK, second surprise was that some components in the CakePHP framework related to a database table are suggested (to a new user of CakePHP will appear imposed)  to be in singular, like the component closest to the data schema &#8211; the model (the .php model file) and the model object/class defined in it. When we get to views we go to plural again.</p>
<p>I am sure there was some reasoning behind that and some desire for allowing when these names of components are used in regular English for them to sort of sound cool.</p>
<p>The CakePHP framework core uses dedicated logic to handle translation between singular and plural and for cases where the language (including everyday English) does not allow simple plural formation by adding an &#8216;s&#8217;, the framework has provided a configuration file to set special translations &#8211; inflections.php.</p>
<p>Here is my criticisms with the plural / singular thing in CakePHP.</p>
<p>- popular and accepted data modeling methodologies suggest entities to be named in singular;</p>
<p>- naming some components in plural and some in singular creates a lot of confusion especially for beginners (beginners not necessarily in software development but in CakePHP); isn&#8217;t one of the ideas behind frameworks and RAD a shorter learning curve?</p>
<p>- the need to configure special inflections is against the convention vs. configuration principle; CakePHP out of the box comes with inflections configured for mouse/mice, status/statuses, deer, sheep, etc.; a convention would have been to let all components be named in singular (or plural for that matter, but consistently) and allow developers use <em>configuration</em> (plurals in some cases) only of they want to;</p>
<p>- fragility &#8211; most CakePHP developers learn about the absolute necessity to configure inflections after they stumble on this underwater rock in a real bug;</p>
<p>My ultimate solution:</p>
<p>- turn off plural/singular madness completely off by editing this line in inflections.php</p>
<p>$uninflectedPlural = array();</p>
<p>to</p>
<p>$uninflectedPlural = array(&#8216;.*&#8217;);</p>
<p>Yep, treat all words (used in data model entities (tables), models, views, controllers) as Un-inflected Plurals / Singular. And actually use singular forms of such words / nouns.</p>
<p>In addition to bringing some sanity to your coding experience with CakePHP you will remove some overhead from making the framework figure out the irregular plurals / singular on every call.</p>
<p>Let us know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://topwebguy.com/turn-off-inflections-singular-plural-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook adds a Flag button &#8211; further demonstrating corporate stipidity</title>
		<link>http://topwebguy.com/facebook-flag-button/</link>
		<comments>http://topwebguy.com/facebook-flag-button/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 14:48:12 +0000</pubDate>
		<dc:creator>TopWebGuy</dc:creator>
				<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://topwebguy.com/?p=32</guid>
		<description><![CDATA[Facebook in the line of further demonstrating how a small fast growing company turns in to a total bone heads run corporation adds a flag button accessible to people who are not even allowed to comment on your posts without describing anywhere what it is for. There are multiple discussions on the internet forums what [...]]]></description>
			<content:encoded><![CDATA[<p>Facebook in the line of further demonstrating how a small fast growing company turns in to a total bone heads run corporation adds a flag button accessible to people who are not even allowed to comment on your posts without describing anywhere what it is for.</p>
<p>There are multiple discussions on the internet forums what the function of the button might be. It is known that Facebook users who are not normally for example allowed to comment on your Facebook photos can randomly click that undocumented button.</p>
]]></content:encoded>
			<wfw:commentRss>http://topwebguy.com/facebook-flag-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Consistent microtime() Function in PHP</title>
		<link>http://topwebguy.com/a-consistent-microtime-function-in-php/</link>
		<comments>http://topwebguy.com/a-consistent-microtime-function-in-php/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 06:40:14 +0000</pubDate>
		<dc:creator>TopWebGuy</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://topwebguy.com/?p=29</guid>
		<description><![CDATA[OK. By definition, in PHP,  microtime() should return either micorseconds time and seconds  (Unix Epoch in seconds) in this format: 0.999999999 99999999999 example: 0.478258723 1271831244 or, if true argument specified ( microtime(true) ), the Unix Epoch time combined with the microseconds as one float number. Like this: 1271831244.478258723 The second one is useful for things [...]]]></description>
			<content:encoded><![CDATA[<p>OK. By definition, in PHP,  microtime() should return either micorseconds time and seconds  (Unix Epoch in seconds) in this format:<br />
0.999999999 99999999999<br />
example: 0.478258723 1271831244<br />
or, if true argument specified ( microtime(true) ), the Unix Epoch time combined with the microseconds as one float number. Like this:<br />
1271831244.478258723</p>
<p>The second one is useful for things like timing and performance profiling (subtract two measured instances of the microtime to see time lapse between them).</p>
<p>One problem is that the version of the function with specifed true parameter only works under version 5 and on of PHP.</p>
<p>Here is one way to write portable code that will always give you absolute time regardles of the PHP  version:</p>
<pre>function truemicrotime(){
    $x= microtime(true);
    $x = trim($x);
    if (strlen(strstr($x," "))) {
        $a = split(" ",$x); $x = $a[1] + $a[0];
    };
    return $x;
} </pre>
<p>You can use as:</p>
<pre>$time_a = truemicrotime();
// some processing, may be sql call
$time_b = truemicrotime();
$time_it_took = $time_b - $time_a;</pre>
]]></content:encoded>
			<wfw:commentRss>http://topwebguy.com/a-consistent-microtime-function-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FIRST and LAST with GROUP BY in MySQL &#8211; A Working Solution</title>
		<link>http://topwebguy.com/first-and-last-in-mysql-a-working-solution/</link>
		<comments>http://topwebguy.com/first-and-last-in-mysql-a-working-solution/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 07:14:50 +0000</pubDate>
		<dc:creator>TopWebGuy</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://topwebguy.com/?p=16</guid>
		<description><![CDATA[Ok, so it was my turn to learn that in MySQL there is no implementation of the FIRST and LAST aggregation functions. I looked up several places on the internet where people talk about this solution but I cols not find a good direct solution. There was one recommendation to use a SELECT and a [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so it was my turn to learn that in MySQL there is no implementation of the FIRST and LAST aggregation functions.</p>
<p>I looked up several places on the internet where people talk about this solution but I cols not find a good direct solution.</p>
<p>There was one recommendation to use a SELECT and a LIMIT 1 wit the proper ORDER BY but I did not see an example.</p>
<p>So when I found a solution for myself I decided to publish it here.</p>
<p>Please comment on issues, concerns, ideas.</p>
<p>Basically I was trying to draw a result list to populate a new table from an existing one. I needed aggregated info, grouped by the field (column) ‘word’, where I wanted the first and last update time-stamp of records with the same value of ‘word’ and the first and last ‘ip_address’ that was tracked for the first and last update. I had the ‘updated’ time-stamp of the record and the ‘ip_address’ in the original table and I wanted a result list, one row per ‘word’, the count of records for that word, first and last update and the ip_address for the first and last update. The first and last time-stamps were easy because I could just say MIN and MAX for them since the values is scalar in the ‘updated’ field, but for the first and last ip_address I had to look for the ip_address values in the first and last record per group ordered by ‘updated’</p>
<p>In other SQL implementations one would have done this and it would have worked:</p>
<pre>SELECT word, COUNT(word), MIN(updated), MAX(updated), FIRST(updated), LAST(updated)
FROM article GROUP BY word.</pre>
<p>In some languages you had to specify ORDER BY in the FIRST and LAST parenthesis like this:</p>
<pre>SELECT word, COUNT(word), MIN(updated), MAX(updated),  
FIRST(updated ORDER BY updated), LAST(updated ORDER BY updated)
FROM article GROUP BY word.</pre>
<p>In some you just have to rely on the proper index used possibly by using the WITH INDEX technique.</p>
<p>Here is what I did in MySQL to get what I wanted:</p>
<pre>SELECT
word , COUNT(word) ,  MIN(updated) , MAX(updated) , </pre>
<pre>(SELECT a.ip_addr FROM article a
WHERE a.word = article.word
ORDER BY a.updated  LIMIT 1) AS first_ip
,
(SELECT a.ip_addr FROM article a
WHERE a.word = article.word
ORDER BY a.updated DESC LIMIT 1) AS last_ip</pre>
<pre>FROM notfound </pre>
<pre>GROUP BY word;</pre>
<p>It worked perfectly and I do not think there is any performance issues. The query over 200,000 records including the update / insert of a new table (of 20,000 aggregated records) took less than a 100<sup>th</sup> of the second.</p>
<p>The sub-queries used in the query use indexes on ‘updated’.</p>
]]></content:encoded>
			<wfw:commentRss>http://topwebguy.com/first-and-last-in-mysql-a-working-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Working Solution To: &#8220;Dreamweaver cannot use the prefix you entered to display live data. Please double check &#8230;&#8221;</title>
		<link>http://topwebguy.com/a-working-solution-to-dreamweaver-cannot-use-the-prefix-you-entered-to-display-live-data-please-double-check/</link>
		<comments>http://topwebguy.com/a-working-solution-to-dreamweaver-cannot-use-the-prefix-you-entered-to-display-live-data-please-double-check/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 00:05:37 +0000</pubDate>
		<dc:creator>TopWebGuy</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[dreamweaver]]></category>
		<category><![CDATA[dynamic application]]></category>
		<category><![CDATA[dynamic website]]></category>
		<category><![CDATA[test server]]></category>

		<guid isPermaLink="false">http://topwebguy.com/?p=14</guid>
		<description><![CDATA[There are a lot fo postings on the internent forums about a problem people experience with trying to create a new website in Dreamweaver to work with a dynamic serverside technology like PHP/MySQL or ASP.NET or ColdFusion. When you get to a point to specify the URL of your website, which should be in the [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot fo postings on the internent forums about a problem people experience with trying to create a new website in Dreamweaver to work with a dynamic serverside technology like PHP/MySQL or ASP.NET or ColdFusion.</p>
<p>When you get to a point to specify the URL of your website, which should be in the form: http://mydomain/mywebiste/, if you happen to be wirking with a brand new website (that by the way may be perfectly well setup) you may get the followig error from Dreamweaver:</p>
<p>&#8220;Dreamweaver cannot use the prefix you entered to display live data. Please double-check your site configuration or click on Help for more information on how to correct this problem. (HTTP Error: 12029)&#8221;.</p>
<p>Dreamweaver calls the URL you were trying to specify a prefix becuase it intends to correcly use in front of every web page that you are going to have on your website, or in the most complex case &#8211; a subdirectory and then page name.</p>
<p>The problem will be experienced especially wiht brand new websites. Again the websites might have been configured perfectly and they may local (on your workstation, PC, Mac) or remote websites.</p>
<h2>A working solution:</h2>
<p>I was looking for a solution for this problem that I experienced myself.</p>
<p>The text from the error Dreamweaver throws is allover the internet with no practical solution. The most I have found is – “well Dreamweaver needs to be configured” and stuff like that. I played quite a bit with this since I wanted to resolve it. I have webmaster and web development experience now 12 years but never worked with DW. I always used non WYSIWYG editors and I thought I will try the widely admired Dreamweaver. So I wanted to start on the right foot and figure out the problem.</p>
<p>This is what I did.</p>
<p>I was starting a new website on which I had perfectly well installed PHP and MySQL as with the dozens ones I installed before and I even wrote a few short scripts involving both PHP and MySQL to test the HTTP / PHP / MySQL / Apache stack is working fine.</p>
<p>This did not help Dreamweaver identify that there is a working website installed.</p>
<p>Then, though this was the site I wanted to connect with I tried direct DW to one of my existing sites &#8211; and that worked &#8211; it identified them. &#8220;OK, so what is the difference?&#8221;, I thought.<br />
Well, one difference I could think of was that all other sides had a default page already set up &#8211; one that will return a valid HTML page to the browser if I typed just the website address (http://mydomain.com/mywebsite/ )<br />
even if I do not enter a page name. Of course in most cases on your web server that is set to be index.php, index.html or default.php etc. I mostly use index.php.</p>
<p>So I created as simple index.php &#8211; made sure it shows up on a browser and the tried to put the website address (without the page name, as initially instructed by DW) and everything worked.<br />
So when you are at that stage of setting up a new site on DW, in addition to setting the website (which you probably did perfectly already) go ahead and add a default page (if PHP server technology a index.php) and test it responds to the website address. This should let the DW go through that stage perfectly.</p>
<p>Obviously Dreamweaver has no way to identify a healthy response from the website unless there is a page that returns valid HTML when the website address (without a pages name) is requested.</p>
<p>I guess if you are using a different technology &#8211; .NET or Cold Fusion you will need a default page like that in the respective technology or simply in html.</p>
<p>Happy webmastering!</p>
<p>TopWebGuy.com</p>
]]></content:encoded>
			<wfw:commentRss>http://topwebguy.com/a-working-solution-to-dreamweaver-cannot-use-the-prefix-you-entered-to-display-live-data-please-double-check/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TopWebGuy.com Offer Webmaster Services, Web Desing, eCommerce Solutions</title>
		<link>http://topwebguy.com/topwebguy-com-offer-webmaster-services-web-desing-ecommerce-solutions/</link>
		<comments>http://topwebguy.com/topwebguy-com-offer-webmaster-services-web-desing-ecommerce-solutions/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 08:44:11 +0000</pubDate>
		<dc:creator>TopWebGuy</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://topwebguy.com/?p=7</guid>
		<description><![CDATA[TopWebGuy.com Offer webmaster services, web desing, eCommerce solutions, back-end integration, complete IT consulting.]]></description>
			<content:encoded><![CDATA[<p>TopWebGuy.com Offer webmaster services, web desing, eCommerce solutions, back-end integration, complete IT consulting.</p>
]]></content:encoded>
			<wfw:commentRss>http://topwebguy.com/topwebguy-com-offer-webmaster-services-web-desing-ecommerce-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

