<?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>Neverending Nexua</title>
	<atom:link href="http://blog.nexua.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nexua.org</link>
	<description>Programmer with a bad sleep schedule.</description>
	<lastBuildDate>Tue, 21 Feb 2012 21:48:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fixing &quot;Open With&quot; on Windows 7</title>
		<link>http://blog.nexua.org/fixing-open-with-on-windows-7/</link>
		<comments>http://blog.nexua.org/fixing-open-with-on-windows-7/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 07:24:57 +0000</pubDate>
		<dc:creator>Nijikokun</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.nexua.org/?p=709</guid>
		<description><![CDATA[TweetSo I've had this issue happen twice, and this time it really irked me. You go to change a filetype to open with a specific program, browse for it, and when you find it you think it will show up on this list but it doesn't. Why? Well... Windows stores every application you add to [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton709" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fblog.nexua.org%2Ffixing-open-with-on-windows-7%2F&amp;via=Nijikokun&amp;text=Fixing%20%22Open%20With%22%20on%20Windows%207&amp;related=&amp;lang=en&amp;count=none&amp;counturl=http%3A%2F%2Fblog.nexua.org%2Ffixing-open-with-on-windows-7%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://blog.nexua.org/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>So I've had this issue happen twice, and this time it really irked me. You go to change a filetype to open with a specific program, browse for it, and when you find it you think it will show up on this list but it doesn't. Why? Well... Windows stores every application you add to the "open with" window in the Registry. That in itself is a good thing, however there is a downside. Windows will not update the programs location if you were to delete or move it. Sounds dumb, well yes, it is; However, you can fix it!</p>
<p>Open up regedit<sup><a href="#note-1">1</a></sup>:</p>
<pre lang="bash">Start > regedit</pre>
<p>Navigate to:</p>
<pre lang="bash">Computer -> HKEY_CLASSES_ROOT -> Applications</pre>
<p>Find the program you have been trying to set as the default, the location will probably be different than where it currently is. Now you can change it to it's correct location and quickly get back to having control over Windows.</p>
<p>Enjoy (:</p>
<p><small><br />
<b>Notes</b></p>
<div id="note-1">1. This application contains data sensitive to windows working correctly, if you are unsure of what you are doing other than what is told do not edit or remove anything.</div>
<p></small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nexua.org/fixing-open-with-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix cancelled / un-finished downloads</title>
		<link>http://blog.nexua.org/fix-cancelled-un-finished-downloads/</link>
		<comments>http://blog.nexua.org/fix-cancelled-un-finished-downloads/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 00:15:04 +0000</pubDate>
		<dc:creator>Nijikokun</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.nexua.org/?p=643</guid>
		<description><![CDATA[TweetEver had a download on Firefox or Chrome cancel due to crash or some other random issue? Well, it's an easy fix. Navigate to the folder the file was downloaded in. Find the file that didn't finish and remove the un-finished extension, if any exist, until it matches the URL of the file you were [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton643" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fblog.nexua.org%2Ffix-cancelled-un-finished-downloads%2F&amp;via=Nijikokun&amp;text=Fix%20cancelled%20%2F%20un-finished%20downloads&amp;related=&amp;lang=en&amp;count=none&amp;counturl=http%3A%2F%2Fblog.nexua.org%2Ffix-cancelled-un-finished-downloads%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://blog.nexua.org/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Ever had a download on Firefox or Chrome cancel due to crash or some other random issue?</p>
<p>Well, it's an <strong>easy</strong> fix.</p>
<p>Navigate to the folder the file was downloaded in. Find the file that didn't finish and remove the un-finished extension, if any exist, until it matches the <code>URL</code> of the file you were downloading. <strong>Chrome</strong> is <code>crdownload</code>, <strong>Firefox</strong> is <code>part</code>.</p>
<p>Now open Terminal<sup><a href="#note-1">1</a></sup> or Command Prompt<sup><a href="#note-2">2</a></sup> in that folder.</p>
<p><strong>Navigation through Terminal or Command Prompt</strong><br />
<small>This applies if you are not using the open * here</small></p>
<p>*Unix:</p>
<pre lang="bash">$ cd ~/Downloads</pre>
<p>Windows:</p>
<pre lang="bat">> cd "c:/full/path/to/Downloads"</pre>
<p>&nbsp;<br />
<strong>Continuing the Download</strong><br />
Now to continue the download we are going to use wget<sup><a href="#note-3">3</a></sup>, type this into Terminal or Command Prompt:</p>
<pre lang="bash">$ wget --continue URL_HERE</pre>
<p><small><br />
<b>Notes</b></p>
<div id="note-1">1. To open Terminal in OSX/*Unix either use <code>cd</code> in term, or download a 3rd-party application / script to add the context to right-click menu.</div>
<div id="note-2">2. To open Command Prompt in Windows in a certain path, right-click the folder while <em>holding down</em> shift, find the <code>open command here</code> option, or <code>start / windows icon</code> &gt; <code>run</code> &gt; type: <code>cmd</code> &gt; <em>press enter</em> &gt; follow <strong>Navigation Through Command Prompt</strong> section.</div>
<div id="note-3">3. You can find wget for Windows here: <a href="http://users.ugent.be/~bpuype/wget/">http://users.ugent.be/~bpuype/wget/</a></div>
<p></small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nexua.org/fix-cancelled-un-finished-downloads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Coding Conventions</title>
		<link>http://blog.nexua.org/php-coding-conventions/</link>
		<comments>http://blog.nexua.org/php-coding-conventions/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 03:20:05 +0000</pubDate>
		<dc:creator>Nijikokun</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.nexua.org/?p=629</guid>
		<description><![CDATA[TweetConventions in coding are like opinions. Everyone has one; Preferences. That's all they are, however these are what I've found to be the most legible and easiest to utilize, not to mention you don't have to drastically change them when you learn a new language. When you code something open source... people are going to [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton629" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fblog.nexua.org%2Fphp-coding-conventions%2F&amp;via=Nijikokun&amp;text=PHP%20Coding%20Conventions&amp;related=&amp;lang=en&amp;count=none&amp;counturl=http%3A%2F%2Fblog.nexua.org%2Fphp-coding-conventions%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://blog.nexua.org/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Conventions in coding are like opinions. Everyone has one; Preferences. That's all they are, however these are what I've found to be the most legible and easiest to utilize, not to mention you don't have to drastically change them when you learn a new language. When you code something open source... people <em>are</em> going to look at it, so make it look good or at least navigational.</p>
<p>Here are a few quick surefire ways to make your code readable.</p>
<h3>1. Don't put your brackets on separate lines.</h3>
<pre lang="php">&lt;?php
if($annoyed)
{
    $brackets_on_seperate_line = true;
}</pre>
<p>This causes a whole slew of inconsistencies in libraries, and projects. One person does it, another doesn't, you are constant battling. So when should you put a brace on a new line? In PHP, this really doesn't matter, but it utilizes important whitespace and shows that you indent incorrectly and to cure the issue you use braces as your guideline, which is wrong. Most IDE's will show you what block you are currently in, underlining the braces or boldening them.</p>
<p>So in my eyes, same line is the best approach as when you get into other languages you will notice, almost all of them require braces on the same line, especially scripting languages. I think this is something all PHP developers do in the beginning because you are constantly learning and trying to find your... <em>style</em>; It's not just about your style, it's about how other people will receive it as well as when it comes time to learn a new language, you will try to use your style, and it will not work out as planned and you have to learn a new one.</p>
<h3>2. Only use underscores in certain cases.</h3>
<pre lang="php">&lt;?php
$variables_should_not_have_them = true;
define('GLOBALS_SHOULD', true);

class Also {
    const CAN_HAZ = true;
}</pre>
<p>Underscores should only be kept to things like global variables, enumerated lists, constants, and cookies / sessions. Why? Because, in variables not only do they take up space stretching out the time it takes to repeatedly type a variable, or even function for that matter. It's not illegal to mix and match your case as long as you have a strict guideline like the one below:</p>
<ol>
<li>Globals, Constants, and Sessions / Cookies use <code>underscore_casing</code></li>
<li>Functions, Variables, and local variables use <code>camelCase</code></li>
<li>Classes, Modules, and Namespaces use <code>UpperCamelCase</code></li>
</ol>
<p>It not only saves you time, it prevents things like the disorderly PHP function list from happening in your library.</p>
<h3>3. Wrapping long lines, The Smart Way.</h3>
<pre lang="php">&lt;?php
$variable = new LongClassName('Some Variable', new AnotherLongClassName('why'), array('it','is','fun'));</pre>
<p>Having long lines sometimes can't be avoided, however stuff like that can. First, think about your class naming structure... is it simplified and readable? If it is, then look at the line, can you break it down?</p>
<p>If you can, go ahead and break it down, separate lines for variables and if statements won't hurt you, in-fact they can increase readability.</p>
<pre lang="php">&lt;?php
$variable = new LongCN(
    'Some Variable',
    new AnotherLCN('why'),
    array('it', 'is', 'fun')
);</pre>
<h3>4. Utilize Brackets Effectively.</h3>
<pre lang="php">&lt;?php
if($annoyed) {
    $terribleSyntax = 50/50;
}</pre>
<p>You don't always need the brackets when doing single line <code>if-else</code> or <code>for-if-else</code> or <code>for</code> / <code>if</code> statements. It can increase readability and boost coding time by letting you type less. That is the goal here, faster code time means more time to focus on something else, even if you don't have that issue, certainly can't hurt to increase it.</p>
<p>There are some cases where you will need them on single lines but here are a few examples of when you can use it:</p>
<pre lang="php">&lt;?php
// Simplified
if(!$annoyed)
    $terribleSyntax = false;

// if-else no-brackets -- I try to avoid this
if($terribleSyntax)
    $annoyed = true;
else
    $annoyed = false;

// Continued Above -- and instead if possible use conditionals
$annoyed = ($terribleSyntax) ? true : false;

// If with else bracket block
if($terribleSyntax)
    $annoyed = true;
else {
    $annoyed = false;
    $happy = true;
}</pre>
<p>The foreach works the same way essentially. If you have more than one line on the block, you need brackets.</p>
<p>Hopefully these help you out and your teammates if you are that guy they hate when it comes to coding with you ;P Let's hope not!</p>
<p><b>Updated</b> To lessen the <em>condescending</em> tone because sarcasm doesn't convey well in text.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nexua.org/php-coding-conventions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Simple Javascript Classes</title>
		<link>http://blog.nexua.org/simple-javascript-classes/</link>
		<comments>http://blog.nexua.org/simple-javascript-classes/#comments</comments>
		<pubDate>Sat, 07 Jan 2012 01:55:26 +0000</pubDate>
		<dc:creator>Nijikokun</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.nexua.org/?p=619</guid>
		<description><![CDATA[TweetUsually creating JavaScript OOP calls for you to modify __proto__ or add tons of obscure methods to create simple parent / child objects. After reading tons of methods that other people use, and came up with my own method. A single function. Class(): var Class = function (properties) { function clone (source, target) { Object.getOwnPropertyNames(source).forEach(function(prop) [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton619" class="tw_button" style="float:right;margin-left:10px;"><a href="http://twitter.com/share?url=http%3A%2F%2Fblog.nexua.org%2Fsimple-javascript-classes%2F&amp;via=Nijikokun&amp;text=Simple%20Javascript%20Classes&amp;related=&amp;lang=en&amp;count=none&amp;counturl=http%3A%2F%2Fblog.nexua.org%2Fsimple-javascript-classes%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://blog.nexua.org/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Usually creating JavaScript OOP calls for you to modify <code>__proto__</code> or add tons of obscure methods to create simple parent / child objects. After reading tons of methods that other people use, and came up with my own method.</p>
<p>A <strong>single</strong> function. <code>Class()</code>:</p>
<pre lang="js">var Class = function (properties) {
  function clone (source, target) {
    Object.getOwnPropertyNames(source).forEach(function(prop) {
      Object.defineProperty(
        target, prop, Object.getOwnPropertyDescriptor(source, prop)
      );
    });

    return target;
  };

  this.inject = function (properties) {
    clone(properties, this);
  };

  this.extend = function (properties) {
    var parent = this.prototype || Class;
    var proto = Object.create(parent);

    clone(properties, proto);

    var body = proto.Constructor;
    if (!(body instanceof Function))
      throw new Error("Constructor missing in a class!");

    body.prototype = proto;
    body.parent = parent;
    body.extend = this.extend;
    body.inject = this.inject;

    return body;
  };

  return this.extend(properties);
};</pre>
<p>That's it, that will allow you to create classes using simple objects, there is only one required function and that is the <code>Constructor</code> or initialization function. By using this you can easily manipulate objects, extend and inject without ever looking at prototype again.</p>
<p>Here is an example of an Entity (Parent) and a Monster (Child):</p>
<pre lang="js">Entity = Class({
  attacks: 0,

  Constructor: function(name, health) {
    this.name = name;
    this.health = health || 0;
  },

  isAlive: function() {
    return this.health > 0;
  },

  setHealth: function(value) {
    this.health = value < 0 ? 0 : value;
  }
});

Monster = Entity.extend({
  attack: function(what) {
    var dmg = (Math.random() * 110) + 1 | 0, leftovers = what.health-dmg;

    if(leftovers < 0)
      what.setHealth(0);
    else
      what.setHealth(leftovers); 

    this.attacks++;
    console.log(this.name + " attacks " + what.name + " for " + dmg + " dmg.");
  }
});</pre>
<p>See it on <a href="http://jsfiddle.net/mnf43/1/">jsfiddle</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nexua.org/simple-javascript-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

