<?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>ScratchYourself.com</title>
	<atom:link href="http://scratchyourself.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://scratchyourself.com</link>
	<description>web development, from scratch</description>
	<lastBuildDate>Wed, 03 Apr 2013 03:33:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Solution: How to keep your PHP sessions open as long as possible</title>
		<link>http://scratchyourself.com/how-to-keep-php-sessions-open-as-long-as-possible/</link>
		<comments>http://scratchyourself.com/how-to-keep-php-sessions-open-as-long-as-possible/#comments</comments>
		<pubDate>Tue, 02 Apr 2013 02:29:23 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP and MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Troubleshooting Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=554</guid>
		<description><![CDATA[Keeping PHP Sessions open, or any sessions open regardless of what language you use, can be a pain. One of the most commonly asked questions is &#8220;How do I keep my sessions open for 30 days or more?&#8221;. This is written from the perspective of PHP, but of course Cookies themselves can be manipulated from [...]]]></description>
				<content:encoded><![CDATA[<p>Keeping PHP Sessions open, or any sessions open regardless of what language you use, can be a pain. One of the most commonly asked questions is &#8220;How do I keep my sessions open for 30 days or more?&#8221;.</p>
<p>This is written from the perspective of PHP, but of course Cookies themselves can be manipulated from whatever server-side language you use to code your web application.</p>
<p>So if your users only stay logged in for a few hours, maybe a a couple of days at the most, and you want them to stay logged in much longer, continue reading.</p>
<p>The main reason this method works is because it doesn&#8217;t rely on PHP to keep the session, and sessions on the server tend to get cleared out, which is probably the most common reason for users having to login again. Rather than rely on PHP garbage collection to work properly, you take control of a secondary session that you store yourself. When the primary login check fails (depends on your application), you check the secondary session against your own records, and if you find a match, you can auto-login the user, returning control to the PHP session itself. You can choose to be seamless about the whole process, or you can present your user with one of those unnecessary messages saying &#8220;Please wait while we find your account&#8230;&#8221;.<span id="more-554"></span></p>
<p>We will tell you how, but it comes with a warning: Sessions, and more specifically Session Cookies are a big source security of security leaks. Mismanaging your sessions and your user&#8217;s cookies could result in a security threat to your system and to your users&#8217; data. You may want to take extra security precautions to secure your sessions, including but not limited to:</p>
<ol>
<li>Tie your session ID to other information, such as the user&#8217;s IP address and/or browser ID string.</li>
<li>Give your users an option of how long to stay logged in. This way, if you also tie the session ID to the IP address, when they log back in after their IP changes, they can choose to only stay logged in, such as if they are at a public insecure location. (Their cookie could still be vulnerable while it is active though).</li>
<li>Setup your system to detect session manipulation. Of course this is more easily said than done. As an example, you could record IP&#8217;s that don&#8217;t correspond to a session. That way, if your sessions are tied to your IP, and a user&#8217;s session is accessed from a different IP multiple times, it may be possible to tell if that 2nd IP is an intruder. Not even close to &#8220;full proof&#8221;, but it&#8217;s one measure you can take. You can disable that IP, but if the user is using a series of proxies, that won&#8217;t help much. If may want to take the extreme measure of shutting your system down completely, or shutting that particular user out indefinitely until a later time.</li>
</ol>
<h2>Common Cause:</h2>
<p>Garbage Collection. While that may not be the whole problem, that describes what&#8217;s usually going on. Basically, the Session has been lost (whether it expired, or was deleted, etc). The PHP session on the server side has been deleted, so the user&#8217;s session cookie (PHPSESSID) doesn&#8217;t correspond to a server-side session any more. In some cases, this may be the result of a user losing their cookies, which can happen for numerous reasons.</p>
<p>If your users Cookies get deleted, then you can&#8217;t really keep them logged in anyway, so there isn&#8217;t a good way to fix that without re-inventing cookies or something like that, so we won&#8217;t talk about that here.</p>
<p>However if the problem is server-side, then we have a possible solution for you.</p>
<h2>Solution: Extra Cookies</h2>
<p>Basically, you set another cookie of your own design, and record that in your database for a lookup when the main PHP session fails.</p>
<p>PHP opens it&#8217;s sessions automatically (unless it&#8217;s configured not to). This means it&#8217;s gives the user a cookie with a Session ID, and on the server that session is stored somewhere.</p>
<p>PHP has various garbage collection and cookie lifetime configurations.</p>
<p>Unfortunately, most people run their applications on shared servers, VPS servers, or dedicated servers that are configured to clean out cookies a lot. It may be a PHP configuration thing, maybe there is some custom software the server host has installed, maybe an old server that hasn&#8217;t been updating in a long time, or a combination of the above.</p>
<p>Also unfortunate is that it can be difficult to properly configure PHP and any other server-side software that may be controlling or deleting your sessions. You can mess around with php.ini or .htaccess and try to get the configuration right, but not only is that very difficult to test, it tends to be unreliable, because permissions to change settings on various servers is very dependent on their exact configuration and software versions.</p>
<p>Rather than rely on the server configuration, wouldn&#8217;t your sleep better knowing that your software will run correctly anyway, without having to wonder if it&#8217;s still working. Wouldn&#8217;t it be easier if you can rely on your own PHP code to do the job, knowing that it will work even if your site is moved to a different server? Sure, that&#8217;s why we just recommend running a 2nd mini-session.</p>
<p>So you have to generate an extra cookie, with a custom Session ID, and associate it with a user in your database. When the PHP garbage collection removes the main PHP session, or for whatever other reason the server-side session is lost, and the PHP session cookie becomes useless, hopefully your extra cookie is intact. If your application will first check the session to see if your user is logged in. When that fails, you need to insert code that checks your custom session and finds that user in your database.</p>
<p><strong>So it basically goes like this:</strong></p>
<ol>
<li>Generate Session: Give user a new unique cookie with new unique session ID. Store the session ID and corresponding User ID on the server side.</li>
<li>Check that a user is logged in on every page load</li>
<li>When user login check fails, lookup the session you created in your database, and automatically login the user.</li>
</ol>
<p>It might sound funny, because you are basically replicating the way the PHP session works and duplicating that process, but this really does help a lot and keeps users logged in for quite a while, as long as their cookies remain intact that is.</p>
<p><strong>Example:</strong></p>
<p>Here is an example of what the code might look like, but you&#8217;ll have to make some adjustments for security and what not:</p>
<p>1) Generate Session: Upon login, do this:</p>
<p><code>$newSessionId = md5($userId . time());<br />
setcookie('mydomain-sess', $newSessionId);<br />
mysql_query("INSERT INTO my_sessions SET sessionId = '".mysql_real_escape_string($newSessionId)."', userId = '".mysql_real_escape_string($userId)."'");<br />
</code></p>
<p>2) Login Check</p>
<p>Your system should do a login check on every page, which varies between systems</p>
<p>3) Lookup Session &#038; Auto-Login</p>
<pre><code>if (!$userIsLoggedIn) { //how you check this depends on your system
$sessionId = $_COOKIE['mydomain-sess'];
$qh = mysql_query("SELECT userId FROM my_sessions WHERE sessionId = '" . mysql_real_escape_string($sessionId) . "' ");
$row = mysql_fetch_assoc($qh);
$userId = $row['userId'];
  if ($userId) {
    //auto-login the user here
  }
}</code></pre>
<p><strong>IP Restriction:</strong></p>
<p>If you want to tie the user&#8217;s IP into the session, you might just record the REMOTE_ADDR in the database, and check it in step 3:</p>
<p>1) Generate Session</p>
<p><code>$newSessionId = md5($userId . time());<br />
setcookie('mydomain-sess', $newSessionId);<br />
mysql_query("INSERT INTO my_sessions SET sessionId = '".mysql_real_escape_string($newSessionId)."', userId = '".mysql_real_escape_string($userId)."', userIp = '".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."'");<br />
</code></p>
<p>3) Lookup Session &#038; Auto-Login</p>
<pre><code>if (!$userIsLoggedIn) { //how you check this depends on your system
$sessionId = $_COOKIE['mydomain-sess'];
$qh = mysql_query("SELECT userId FROM my_sessions WHERE sessionId = '" . mysql_real_escape_string($sessionId) . "' AND userIp = '".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."'");
$row = mysql_fetch_assoc($qh);
$userId = $row['userId'];
  if ($userId) {
    //auto-login the user here
  }
}</code></pre>
<p>But there are a variety of ways to integrate IP checking, so that&#8217;s just one example.</p>
<p><strong>To give you a bit more detail:</strong></p>
<p>1) Generate a custom Session ID, with a secure MD5 string stored in it. For example: Cookie &#8220;mydomain-sess&#8221; with value &#8220;d41d8cd98f00b204e9800998ecf8427e&#8221;. Give this cookie an expiration that corresponds to how long you want to keep the user logged in.</p>
<p>Save the MD5 string server-side somewhere, and associate that with a User ID. It&#8217;s most easily done via a database, but as it&#8217;s sever side, the storage method is up to you. In the database, you might have a table with 2 columns: &#8220;sessionId&#8221; and &#8220;userId&#8221;. Your secondary check does a lookup on the value of cookie &#8220;mydomain-sess&#8221;, and if it finds that user ID, then you would login the user automatically.</p>
<p>On subsequent page loads, that cookie will be sent to the server on every page load.</p>
<p>2) Every page load of your application should check if a user is logged in, usually just done checking if a Session user ID variable is set. This is the normal way to do it, and should already be happening, as a result of your server-side application.</p>
<p>3) When that check fails, that&#8217;s when you run your secondary check. You can look up the cookie in the DB and see if it matches a user. From there, you can just auto-login the user, however that must happen depending on server side software/PHP framework, and the PHP session will be re-created and re-used on subsequent page loads.</p>
<p>Also, you probably shouldn&#8217;t store a whole copy of your session with that session ID, not only would that be cumbersome, but storing multiple copies that can become different could result in problems along the way. I recommend just logging in the user automatically, thereby re-creating the PHP session.</p>
<p>When your auto-login occurs, you can throw up some fancy-pants unnecessary message like &#8220;Please wait while we access your user account&#8230;&#8221; with a fancy little rotating GIF or something while javascript waits 5 seconds to reload the page, or you can just load up the session immediately and allow your application to run normally, making it completely transparent to the user than anything was going on, it will just seem like they never logged out.</p>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/how-to-keep-php-sessions-open-as-long-as-possible/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Website Owner Tips: Protect Your Domain, your GoDaddy Account and your Business</title>
		<link>http://scratchyourself.com/website-tips-protect-your-domain-godaddy-account-and-business/</link>
		<comments>http://scratchyourself.com/website-tips-protect-your-domain-godaddy-account-and-business/#comments</comments>
		<pubDate>Fri, 29 Mar 2013 21:09:35 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Domains]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[goaddy]]></category>
		<category><![CDATA[registrar]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=553</guid>
		<description><![CDATA[Your registrar &#8211; most likely GoDaddy &#8211; is where your purchased your Domain Name. It&#8217;s very important to keep your GoDaddy account secure, because if an unauthorized user gains access to your account, they can transfer your domain to a different owner, and it can be exceedingly difficult to regain control of your domain, so [...]]]></description>
				<content:encoded><![CDATA[<p>Your registrar &#8211; most likely GoDaddy &#8211; is where your purchased your Domain Name. It&#8217;s very important to keep your GoDaddy account secure, because if an unauthorized user gains access to your account, they can transfer your domain to a different owner, and it can be exceedingly difficult to regain control of your domain, so here are some tips to keep your domain and your business safe:<span id="more-553"></span></p>
<ol>
<li>Create a Good Password: Choose a ridiculously long password, at least 20 random characters, including numbers and special symbols.</li>
<li>Protect Your Password
<ol>
<li>Never let anyone have your GoDaddy password</li>
<li>Don&#8217;t store your password on your computer &#8211; it can get stolen by hackers, viruses, or simply by unauthorized users, and it can get lost easily among all of your files or by a hard drive/system crash</li>
<li>Keep it written down on paper, ONLY on paper, somewhere safe &#8211; even inside of a safe!</li>
</ol>
</li>
<li>Change your password every 6 months. Old passwords are more likely to get stolen.</li>
<li>Keep your PIN number with your password. GoDaddy and some other registrars allow you to create a 4-digit PIN number for support. Keep it with your password, you&#8217;ll need it.</li>
<li>Do not login to GoDaddy from public locations, such as coffee shops and other free WiFi hotspots. Information transmitted over WiFi is easily captured, especially if there is no WiFi password, but it can even be stolen if there is a WiFi password. In fact, it&#8217;s best to avoid WiFi altogether, and to only login from a hard-wired connection. This tip goes for any secure information or passwords.</li>
<li>Save Your Nameservers: If you have lots of domains in your account, or even if you only have a few domains, take a snapshot of your Nameservers periodically. Knowing the correct nameservers in case they get changed can save you a lot of hassle of having to track them down after an incident. Resetting nameservers has been known to happen by using the feature in GoDaddy that allows you to modify many domains at once.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/website-tips-protect-your-domain-godaddy-account-and-business/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: AJAX File Uploads made easy</title>
		<link>http://scratchyourself.com/jquery-ajax-file-uploads-made-easy/</link>
		<comments>http://scratchyourself.com/jquery-ajax-file-uploads-made-easy/#comments</comments>
		<pubDate>Tue, 05 Mar 2013 07:57:36 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[JavaScript and AJAX]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Troubleshooting Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=513</guid>
		<description><![CDATA[jQuery is an incredible Javascript library. It allows programmers, as well as other web developers with less programming experience, to develop high-end Javascript and AJAX features on their websites. Many situations require or benefit from software written from scratch, but other situations do not. For most Javascript functionality, writing your code from scratch isn&#8217;t worth [...]]]></description>
				<content:encoded><![CDATA[<p>jQuery is an incredible Javascript library. It allows programmers, as well as other web developers with less programming experience, to develop high-end Javascript and AJAX features on their websites. Many situations require or benefit from software written <a target="_blank" title="scratch2.com, Softare and Tools From Scratch" href="http://www.scratch2.com" target="_blank">from scratch</a>, but other situations do not. For most Javascript functionality, writing your code from scratch isn&#8217;t worth it or necessary, and that&#8217;s where jQuery comes in. jQuery isn&#8217;t necessarily easy. The more customization you want, the more specific your requirements, the longer it will take you to get it right. But even if you have the time and experience, jQuery doesn&#8217;t do everything for you.</p>
<p>Many people are curious about how to perform a full AJAX file upload using jQuery. Some users have noted that HTML 5 supports AJAX file uploads, however most websites aren&#8217;t written in fully support HTML 5. Other users have also shown exactly how to do this using methods such as hidden iframes, and a Javascript <b>XMLHttpRequest()</b> object.<br />
<span id="more-513"></span><br />
The fact of the matter is, this is another place where you rarely need to write any code from scratch. We highly recommend using a jQuery Plugin for AJAX File Uploads, and there are many jQuery Plugins just for that purpose.<br />
We recommend the &#8220;jQuery Form Plugin&#8221;, at <a target="_blank" title="jQuery Form Plugin" href="http://malsup.com/jquery/form/" target="_blank">http://malsup.com/jquery/form/</a>. It lets you submit any form via AJAX, so it much more useful than just for AJAX file uploads, and it supports a callback function for a progress bar. It&#8217;s very easy to use, and if you already have your form created, you can integrate this plugin very easily:</p>
<pre><code>$(document).ready(function() {
  // bind 'myForm' and provide a simple callback function
  $('#myForm').ajaxForm(function() {
    alert("Thank you for your comment!");
  });
});
</code></pre>
<p>We found the ajaxSubmit() method even more useful, since we could trigger the form submission at will. The options available to this function match many of the options in the standard jQuery ajax() method, and overall this plugin made life very easy.</p>
<p>If you have other requirements, such as multiple file upload, try searching Google. There are so many jQuery AJAX File Upload plugins that it&#8217;s not even worth covering them all here.</p>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/jquery-ajax-file-uploads-made-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 8 apps running in the background, using memory and CPU when they are not supposed to?</title>
		<link>http://scratchyourself.com/windows-8-apps-running-in-the-background-using-memory-and-cpu-when-they-are-not-supposed-to/</link>
		<comments>http://scratchyourself.com/windows-8-apps-running-in-the-background-using-memory-and-cpu-when-they-are-not-supposed-to/#comments</comments>
		<pubDate>Thu, 28 Feb 2013 14:35:18 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[Graphics and Video]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Personal Computer]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Troubleshooting Tips]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[shame]]></category>
		<category><![CDATA[windows 8]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=504</guid>
		<description><![CDATA[Microsoft has touted their new Metro Apps as a key feature of Windows 8. Metro Apps have a bit of a mixed reputation. On one hand, they provide some much overdue features to the Windows line. On the other hand, they don&#8217;t really live up to the hype, and in many instances they are useful [...]]]></description>
				<content:encoded><![CDATA[<p>Microsoft has touted their new Metro Apps as a key feature of Windows 8. Metro Apps have a bit of a mixed reputation. On one hand, they provide some much overdue features to the Windows line. On the other hand, they don&#8217;t really live up to the hype, and in many instances they are useful <a title="Windows 8 Metro Apps: Compensating for other problems" href="http://scratchyourself.com/windows-8-metro-apps-compensating-for-other-problems/">only because of other software shortcomings</a>.</p>
<p>But Microsoft has given one claim to Windows 8 Metro Apps that, until today, I found to be true.<span id="more-504"></span></p>
<p>Windows 8 Apps are supposed to be light on your system when not in use. When they are in the background they are supposed to use no resources, or almost no resources. However, I was watching a movie yesterday in the Windows 8 Video app, and although the movie was paused, and the app was not even in focus, it was in the background, I noticed in the Task Manager it was taking up over 100MB of memory. That was shocking to me, because I know that 100MB of wasted memory can be a drag on my battery life. It might not bother you for your desktop computer (unless you are concerned about green PC&#8217;s and low overall energy usage) but in this case, I found it to be an abomination, a true shame.</p>
<p>Overall I&#8217;ve had a pretty good experience with Windows 8 apps (aside from the lack of official apps, the lack of useful apps, and the lack of settings within apps), but perhaps I just have low expectations after waiting so many years for a version of Windows that can compete with the modern world.</p>
<p>Part of using Windows 8 on a laptop that is often running on battery is keeping a close eye on the Task Manager, and being sure to close unnecessary programs, and restart browsers when there is an apparent &#8220;memory suck.&#8221; Very unfortunate, especially since I&#8217;ve always been such a Windows lover.</p>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/windows-8-apps-running-in-the-background-using-memory-and-cpu-when-they-are-not-supposed-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 8 Metro Apps: Compensating for other problems</title>
		<link>http://scratchyourself.com/windows-8-metro-apps-compensating-for-other-problems/</link>
		<comments>http://scratchyourself.com/windows-8-metro-apps-compensating-for-other-problems/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 20:39:17 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Personal Computer]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Troubleshooting Tips]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[shame]]></category>
		<category><![CDATA[windows 8]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=505</guid>
		<description><![CDATA[Windows 8 apps can be very useful, but their reputation and usefulness is mixed. After a few months of using Windows 8, I find that one of the main reasons Windows 8 Apps are useful is because of shortcomings in other software. For example, we want to use Windows 8 apps to play streaming music [...]]]></description>
				<content:encoded><![CDATA[<p>Windows 8 apps can be very useful, but their reputation and usefulness is mixed.</p>
<p>After a few months of using Windows 8, I find that one of the main reasons Windows 8 Apps are useful is because of shortcomings in other software.</p>
<p>For example, we want to use Windows 8 apps to play streaming music like Pandora, or to look at Facebook. But those are pretty lame reasons to develop and use a whole new App platform. I mean, those are already available in a format called &#8220;the web&#8221; and accessible using something called a &#8220;web browser.&#8221; So why do we prefer the apps over the web versions? In these cases, the Apps trump the web-based version simply because of computer resources. Having a browser open just for Pandora can drain battery and hurt performance, and the same applies for many other programs and web services.<span id="more-505"></span></p>
<p>Personally, I use a separate browser for Pandora, because Flash can be draining to my computers resources, and to my browser&#8217;s performance, I like to keep it separate. It lets me browse the web faster using my primary browser, while listening to music in a separate browser. Sometimes I even use a 3rd browser. But all this is a true failure of software: A failure of web browsers to manage their resources effectively, a failure of web browsers to manage their extensions efficiently, and a HUGE failure of Adobe to manage Flash, which quite honestly uses a ridiculous amount of resources, has obvious memory leaks, and can slow a computer down and hinder it&#8217;s battery life to a point that Adobe should be ashamed of. But we can&#8217;t only blame Adobe for this, we should blame the web browsers that allow this kind of brutal garbage to be integrated into their software. The end-user has very little influence to get Adobe to fix Flash, but Mozilla, Apple, Microsoft and Google all have web browsers that are being hindered by Flash, and they have done little to address the problem. Most of their efforts center around allowing Flash to run in separate instances of the browser, which basically just allows Flash to crash, and to hog up resources.</p>
<p>Other than that, Windows 8 apps have very little usefulness, especially considering the lack of official apps for services like Facebook. I love that Microsoft has taken a new direction with Windows 8, but they have given very little purpose to it, and very little reason to use it.</p>
<p>Shame on you Adobe!</p>
<p>And shame on you Mozilla, Microsoft, Apple and Google for not pushing to get this fixed!</p>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/windows-8-metro-apps-compensating-for-other-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Tips for Beginners</title>
		<link>http://scratchyourself.com/jquery-tips-for-beginners/</link>
		<comments>http://scratchyourself.com/jquery-tips-for-beginners/#comments</comments>
		<pubDate>Mon, 11 Feb 2013 08:30:45 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[JavaScript and AJAX]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=498</guid>
		<description><![CDATA[jQuery is an incredible Javascript framework, but it can also be a bear to learn, and a bear to write even for an experienced user. Writing Javascript and AJAX code from scratch can be extremely time consuming, and it&#8217;s important to keep inn mind that Javascript only accounts for 1/5th of your web application, maybe [...]]]></description>
				<content:encoded><![CDATA[<p>jQuery is an incredible Javascript framework, but it can also be a bear to learn, and a bear to write even for an experienced user.</p>
<p>Writing Javascript and AJAX code from scratch can be extremely time consuming, and it&#8217;s important to keep inn mind that Javascript only accounts for 1/5th of your web application, maybe less, and wasting too much time on your Javascript should be avoided. In addition to Javascript, you&#8217;ve got CSS and HTML to write, as well as your server side language and DB language (ie. PHP and MySQL). That&#8217;s 5 language to manage, 5 languages to incorporate, and that&#8217;s without even considering mobile apps.</p>
<p>On top of that, you&#8217;ve got 4 major browsers to test your code in (IE, Firefox, Chrome, Safari), and it all becomes a bit of a blur when you&#8217;ve been working on a project for some time.<span id="more-498"></span></p>
<p>jQuery aims to improve web application quality, as well as make it easier to write Javascript by providing a powerful, cross-browser framework to work with.</p>
<p>Unfortunately, jQuery can still be very tricky, and in many ways it becomes a 6th language in your application.</p>
<p>That&#8217;s what it&#8217;s important to keep some things in mind:</p>
<ol>
<li><strong>Selectors</strong>: jQuery selectors (ie. the .. in &#8220;$(&#8230;)&#8221; ) are often the source of problems, and getting the correct selector can be key to fixing your problems. Often it&#8217;s the difference between specifying a list vs list item that is the cause of your jQuery pains</li>
<li><strong>Find Examples</strong>: Unfortunately, the jQuery documentation is very &#8211; well &#8211; &#8220;documentation based.&#8221; In other words, it&#8217;s designed around describing the features of jQuery, without actually showing you examples, and the lack of examples within the jQuery documentation can cause massive headaches.</li>
<li><strong>jQuery UI</strong>: Not really a part of the core jQuery, it&#8217;s critical to almost everything you&#8217;ll do in jQuery, so look it up, learn it, adapt to it.</li>
<li><strong>Time</strong>: Writing Javascript takes time, even if you&#8217;re good at it. Devote the time and chances are that you&#8217;ll learn and achieve what you desire.</li>
</ol>
<p>Hopefully those tips will help beginners, just don&#8217;t forget that putting in the time is necessary no matter what.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/jquery-tips-for-beginners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery .load() complete callback function doesn&#8217;t work properly</title>
		<link>http://scratchyourself.com/jquery-load-complete-callback-function-doesnt-work-properly/</link>
		<comments>http://scratchyourself.com/jquery-load-complete-callback-function-doesnt-work-properly/#comments</comments>
		<pubDate>Fri, 08 Feb 2013 21:13:13 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[JavaScript and AJAX]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Troubleshooting Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=495</guid>
		<description><![CDATA[jQuery&#8217;s .load() method supports an optional callback function called when the request is complete. However, you might find that the complete callback function doesn&#8217;t work properly. The jQuery .load() documentation shows 2 optional arguments to the .load() method. The first optional argument is &#8220;data&#8221;, which is described as &#8220;A plain object or string that is [...]]]></description>
				<content:encoded><![CDATA[<p>jQuery&#8217;s .load() method supports an optional callback function called when the request is complete. However, you might find that the complete callback function doesn&#8217;t work properly.</p>
<p>The <a target="_blank" title="jQuery .load() documentation" href="http://api.jquery.com/load/" target="_blank">jQuery .load() documentation</a> shows 2 optional arguments to the .load() method.</p>
<p>The first optional argument is &#8220;data&#8221;, which is described as &#8220;A plain object or string that is sent to the server with the request.&#8221;</p>
<p>The second optional argument is &#8220;complete&#8221;, which is described as &#8220;A callback function that is executed when the request completes.&#8221;.</p>
<p>The examples on that page present some confusion, by showing this example:</p>
<p style="padding-left: 30px;"><code><br />
$('#result').load('ajax/test.html', function() {<br />
alert('Load was performed.');<br />
});<br />
</code></p>
<p>The problem with that example is that the &#8220;complete&#8221; callback function is shown as the 2nd argument, not the 3rd.<span id="more-495"></span></p>
<p>Many users seem to have it working fine using the complete callback as the 2nd optional argument to .load(), however we had consistent problems with it, and so have some other users. The problem is that the function gets called before the .load() completes, essentially calling it before it is even sent, and then sending the result of the callback function as the &#8220;data&#8221; argument.</p>
<p>However, we found a quick fix: By placing &#8220;null&#8221; as the optional 2nd argument, the complete callback function then begins to work properly.</p>
<p style="padding-left: 30px;"><code><br />
$('#result').load('ajax/test.html', null, function() {<br />
alert('Load was performed.');<br />
});<br />
</code></p>
<p>The specific problem we had was that we were trying to center the layer after it loaded. Trying to center it using the complete callback function didn&#8217;t work when used as the 2nd argument to .load(), it would center a blank layer, but using &#8220;null&#8221; as the 2nd argument, and moving the complete callback to the 3rd argument fixed the problem, allowing the layer to be properly centered.</p>
<p>The really strange thing is that many users get it working just fine using the first example. Depending on what people are doing with the complete callback function, it might make sense that it seems to work even though it&#8217;s calling the callback too early in some situations, and seems to not work properly in other situations.</p>
<p>We don&#8217;t know if this is a shortcoming of the jQuery documentation, a jQuery bug, or a misunderstanding on our part of the proper usage of .load(), but what we do know is that using &#8220;null&#8221; as the 2nd argument seems to fix the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/jquery-load-complete-callback-function-doesnt-work-properly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: XML Errors in Firefox when using load() and other functions</title>
		<link>http://scratchyourself.com/jquery-xml-errors-in-firefox-when-using-load/</link>
		<comments>http://scratchyourself.com/jquery-xml-errors-in-firefox-when-using-load/#comments</comments>
		<pubDate>Wed, 23 Jan 2013 22:31:25 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[JavaScript and AJAX]]></category>
		<category><![CDATA[PHP and MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=491</guid>
		<description><![CDATA[If you are using jQuery, and you&#8217;ve noticed some errors appearing in Firefox, it might be a very simple fix. The errors resemble the following: &#8220;not well-formed&#8221; (maybe referring to a specific piece of returned HTML) &#8220;mismatched tag. expected &#60;/input&#62;&#8221; (or &#8220;expected &#60;/option&#62;&#8221;, &#8220;expected &#60;/td&#62;&#8221;, &#8220;expected &#60;/br&#62;&#8221; etc) Chances are you are using jQuery&#8217;s load() [...]]]></description>
				<content:encoded><![CDATA[<p>If you are using jQuery, and you&#8217;ve noticed some errors appearing in Firefox, it might be a very simple fix.</p>
<p>The errors resemble the following:</p>
<ul>
<li>&#8220;not well-formed&#8221; (maybe referring to a specific piece of returned HTML)</li>
<li>&#8220;mismatched tag. expected &lt;/input&gt;&#8221; (or &#8220;expected &lt;/option&gt;&#8221;, &#8220;expected &lt;/td&gt;&#8221;, &#8220;expected &lt;/br&gt;&#8221; etc)</li>
</ul>
<p>Chances are you are using jQuery&#8217;s load() or get() or ajax() functions and sending a response back to jQuery via PHP or another server-side langauge.<span id="more-491"></span></p>
<p>The problem is that jQuery doesn&#8217;t know what response type is coming back. If you return a plain html file (ie. filename.html) then the web server automatically adds Content-Type response headers. However if you are using PHP, the Content-Type is not automatically generated.</p>
<p>To fix the problem, add this to your PHP:</p>
<p style="padding-left: 30px;">header(&#8220;Content-type: text/html&#8221;);</p>
<p>Or use whatever Content Type applies to your response.</p>
<p>And remember, we&#8217;re talking about the <span style="text-decoration: underline;"><em><strong>response header</strong></em></span> (response coming back <span style="text-decoration: underline;"><em><strong>from</strong> </em></span>the server) &#8211; not the <span style="text-decoration: underline;"><em><strong>request header</strong></em></span> (request sent <span style="text-decoration: underline;"><em><strong>to</strong> </em></span>the server).</p>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/jquery-xml-errors-in-firefox-when-using-load/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: show hidden layer not working using show() or fadeIn() functions</title>
		<link>http://scratchyourself.com/jquery-show-hidden-layer-not-working/</link>
		<comments>http://scratchyourself.com/jquery-show-hidden-layer-not-working/#comments</comments>
		<pubDate>Thu, 17 Jan 2013 20:51:08 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[JavaScript and AJAX]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[layer]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=486</guid>
		<description><![CDATA[Q: Using jQuery, I cannot get a hidden layer to show or hide using the $(&#8220;#layerID&#8221;).show() or #(&#8220;#layerID&#8221;).fadeIn() functions. A: Although there could be several reasons for this, one common problem is that you have set your DIV&#8217;s style attribute to specifically hide the layer using &#8220;visibility:hidden;&#8221; and &#8220;display:none;&#8221;. In many Javascript implementations, in order [...]]]></description>
				<content:encoded><![CDATA[<p>Q: Using jQuery, I cannot get a hidden layer to show or hide using the $(&#8220;#layerID&#8221;).show() or #(&#8220;#layerID&#8221;).fadeIn() functions.</p>
<p>A: Although there could be several reasons for this, one common problem is that you have set your DIV&#8217;s style attribute to specifically hide the layer using &#8220;visibility:hidden;&#8221; and &#8220;display:none;&#8221;. In many Javascript implementations, in order to change that value, both of these attributes must be set explicitly in the &#8220;style&#8221; attribute. For example:</p>
<ul>
<li>&lt;div id=&#8221;layerID&#8221; style=&#8221;visibility:hidden;display:none;&#8221;&gt;text&lt;/div&gt;</li>
</ul>
<p>Traditionally, you would use javascript to modify the style attribute in order to show the layer.</p>
<p>However jQuery is slightly different. If you explicitly set the style attribute to &#8220;visibility:hidden;display:none;&#8221; then jQuery will not be able to show the layer. The solution is to remove the visibility attribute from your style tag, so only the &#8220;display:none;&#8221; attribute is left. For example:</p>
<ul>
<li>&lt;div id=&#8221;layerID&#8221; style=&#8221;display:none;&#8221;&gt;text&lt;/div&gt;</li>
</ul>
<p>An alternative would be to use jQuery to hide the layer upon page load. For example, here is your DIV:<span id="more-486"></span></p>
<ul>
<li>&lt;div id=&#8221;layerID&#8221;&gt;text&lt;/div&gt;</li>
</ul>
<p>And here is your jQuery which hides the layer once the page is loaded:</p>
<ul>
<li>$(document).ready(function(){<br />
$(&#8216;#layerID&#8217;).hide();<br />
}</li>
</ul>
<p>You might be trying to show or hide a progress bar or waiting message while you are waiting for the AJAX response to come back, or you might just be trying to show and hide layers for other reasons. Either way, we hope this tips helps!</p>
<p>We also recommend checking out <a target="_blank" title="AJAX Free Loading GIF Generator" href="http://www.ajaxload.info/" target="_blank">Free AJAX Loading GIF Generator</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/jquery-show-hidden-layer-not-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 8: Where are my Desktop Icons?</title>
		<link>http://scratchyourself.com/windows-8-where-are-my-desktop-icons/</link>
		<comments>http://scratchyourself.com/windows-8-where-are-my-desktop-icons/#comments</comments>
		<pubDate>Mon, 14 Jan 2013 04:31:06 +0000</pubDate>
		<dc:creator>php-love</dc:creator>
				<category><![CDATA[Personal Computer]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[windows 8]]></category>

		<guid isPermaLink="false">http://scratchyourself.com/?p=481</guid>
		<description><![CDATA[Have you been wondering where your Desktop icons are on Windows 8? Curious why Windows 8 desktop doesn&#8217;t show your files and folders? Microsoft made some major changes with Windows 8, but it also made a lot of very small changes. By default, Windows  does not show any icons on your desktop. This can be [...]]]></description>
				<content:encoded><![CDATA[<p>Have you been wondering where your Desktop icons are on Windows 8?</p>
<p>Curious why Windows 8 desktop doesn&#8217;t show your files and folders?</p>
<p>Microsoft made some major changes with Windows 8, but it also made a lot of very small changes. By default, Windows  does not show any icons on your desktop. This can be very confusing, especially when you browse to the Desktop through the File Explorer and can see your icons just fine.</p>
<p>There are 2 different places for Desktop Icon settings in Windows 8</p>
<ol>
<li>All Desktop Icons: Right Click on the Desktop and go to &#8220;View&#8221; &gt; and then click &#8220;Show desktop icons&#8221;. This will show any file and folder icons and other special icons that are located on your desktop.</li>
<li>Special System Icons: Right Click on the Desktop and go to &#8220;Personalize&#8221; and then click &#8220;Change desktop icons&#8221;. This will allow you to enable or disable icons for special system folders such as My Computer, Recycle Bin, and User&#8217;s Documents. You also need to enable &#8220;Show desktop icons&#8221; per #1 above in order to see these icons on the Desktop.</li>
</ol>
<p>Keep in mind that the Desktop will be much cleaner by leaving the above options set to default. Also keep in mind that in order to show system icons on the Desktop, you need to enable &#8220;Show desktop icons&#8221; per step 1 above.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://scratchyourself.com/windows-8-where-are-my-desktop-icons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
