<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Programming Tips For Versatile Coders</title>
	
	<link>http://www.codercaste.com</link>
	<description>Programming Tips For Versatile Coders</description>
	<lastBuildDate>Mon, 06 May 2013 04:06: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>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Codercastecom" /><feedburner:info uri="codercastecom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>Codercastecom</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>5 Reasons to Prefer Objective C for developing iPhone/iOS Apps</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/_525Uxa_-2c/</link>
		<comments>http://www.codercaste.com/2013/05/5-reasons-to-prefer-objective-c-for-developing-iphoneios-apps/#comments</comments>
		<pubDate>Mon, 06 May 2013 04:05:45 +0000</pubDate>
		<dc:creator>Spyros</dc:creator>
				<category><![CDATA[General Programming]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[ios programming]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[objective c]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2212</guid>
		<description><![CDATA[The popularity of iPhone has generated a substantial increase in the demand for iPhone Apps from millions of individuals and business users all over the world. Apple’s online store features literally thousands of applications designed to work with iPhone/iPad; however, the market for iPhone Apps is expected to witness further growth in the coming years. [...]]]></description>
				<content:encoded><![CDATA[<p>The popularity of iPhone has generated a substantial increase in the demand for iPhone Apps from millions of individuals and business users all over the world. Apple’s online store features literally thousands of applications designed to work with iPhone/iPad; however, the market for iPhone Apps is expected to witness further growth in the coming years. Apart from using Apple’s own store, many users are also jail breaking their devices to ensure that they have access to a wider selection of products including third party vendor apps not featured in Apple’s online store. The rising demand for iPhone/iOS apps has led many software development companies to develop apps using languages such as objective C, Java, Python and Ruby. Though every language has its own strengths and unique procedures, objective C has emerged as the definitive leader in the field, I will discuss some of the key reasons why this happened even though thorough knowledge of Apple’s official SDK is mandatory in all cases.</p>
<p><i>Objective C is related to C</i></p>
<p>The old saying goes “the more the things change, the more they remain the same” and the fascination of developers with objective C is no different. Objective C is a derivative of the long series of C languages such as C++ and C#; therefore old-time programmers have often found it easier to pick it up. In case of new programmers, most of them learn C or one of its derivatives as part of their training so they too find it easier to interpret the syntax and flow of this relatively new language. Similarly, a person who knows objective C will also find it easier to pick up the nuances of other C-based languages.</p>
<p><i>Easier to Find Tutorials and Get Support</i></p>
<p>As a vast majority of iPhone/iOS developers use this specific version of C, often it is much easier to track down specific tutorials and receive support from forums. Moreover, apps development tutorials posted online by Apple also contain examples using objective C so it might just be easier to understand and learn this language. Lastly, as a majority of currently available iPhone/iOS apps are developed using this language, it’s often easier to find and reuse codes for new applications if you are so inclined. <i> </i></p>
<p><i>A Superior Intuitive and Object-Oriented Approach</i></p>
<p>This language features an intuitive and object-oriented approach to developing iPhone/iOS applications, which, is far superior compared to similar experiences while using Ruby or Python. Most developers prefer not to use Java because of the common complaints of boiler-plate codes and slow operation on mobile devices. Also Java according to most developers is more suitable for native apps, which are less popular among present-day users. Such intuitive controls ensure swifter development of new apps according to changing market requirements.     <i>        </i></p>
<p><i>Availability of Compatible Libraries and Development Tools</i></p>
<p>As Apple whole heartedly supports the use of objective C, the company provides a compatible development tool named Xcode. Though many developers have had concerns using Apple’s preferred combination, it is in no way the end of the road. One of the more preferred libraries for development is actually “Cocoa Touch Frameworks”, which can be used to develop cutting-edge applications for the iPhone/iOS platforms. The main problem with this combination is the continued requirement of learning new tricks for efficiently using your available frameworks. Though there is a large body of online support documents for both Xcode and Cocoa Touch Frameworks, most developers face fewer problems using the Cocoa Touch-Objective C combination, while developing mobile applications for the iOS platform.</p>
<p><i>Superior Flexibility and Memory Management</i></p>
<p>In most cases, developers shift to using this version of C from some other programming language such as C++, C# or Java. A vast majority of them agree that this language offers superior flexibility for developing new applications. An additional advantage is the superior memory management process of using the objective C-Cocoa Touch Framework. Memory management of newly developed apps is often a stumbling block during development and using this combination significantly reduces such problems.</p>
<p>This was a guest post by Abhishek. Abhishek is currently working with eXtendCode, a <a href="http://www.extendcode.com/">Software Development Company</a> in India, which provides software solutions such as Java Application Development, Open Source Application Development, Data Base Solutions, <a href="http://www.extendcode.com/Services/mobile-application-development.aspx">Mobile Application Development</a> and Quality Assurance Services etc.</p>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/_525Uxa_-2c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/05/5-reasons-to-prefer-objective-c-for-developing-iphoneios-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/05/5-reasons-to-prefer-objective-c-for-developing-iphoneios-apps/</feedburner:origLink></item>
		<item>
		<title>Important WordPress Tips from WordPress Pros</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/s5tjjvmlGM4/</link>
		<comments>http://www.codercaste.com/2013/04/important-wordpress-tips-from-wordpress-pros/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 03:30:55 +0000</pubDate>
		<dc:creator>Spyros</dc:creator>
				<category><![CDATA[Wordpress Programming]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Site Design Company]]></category>
		<category><![CDATA[WordPress Tips]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2206</guid>
		<description><![CDATA[WordPress is undoubtedly one of the most popular publishing platforms in the internet world today.  From developing new custom plugins to converting existing page designs, WordPress provides a range of options for web design Vancouver developers, both newbies and professionals. Take a look below at some useful WordPress tips covering a range of areas like [...]]]></description>
				<content:encoded><![CDATA[<p>WordPress is undoubtedly one of the most popular publishing platforms in the internet world today.  From developing new custom plugins to converting existing page designs, WordPress provides a range of options for <b>web design Vancouver developers</b>, both newbies and professionals. Take a look below at some useful WordPress tips covering a range of areas like development, business advice and even getting involved with the community.</p>
<p><b>WordPress Tips for Developers</b></p>
<p>Increase the overall website experience by making use of WordPress’ core, with its built-in-functionality and APIs. You can also make use of the two WordPress <a href="http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters">Hooks</a>, namely actions and filters to alter how the site behaves without modifying any of the core files. It is equally important to protect your website against hackers by adhering to a strict data validation process and avoid writing any insecure plugins and themes. The basic principle is to develop an interphase that will provide a better experience for users.</p>
<p>Other great ways to leverage WordPress by developers include using custom post types, sharing solutions with the community and providing support for users.</p>
<p><b>Tips on Website Management</b></p>
<p>Two important aspects of WordPress web design management include enhancing your website security and using good backup practices. Staying vigilant about WordPress security should be the foremost responsibility for any site owner to ward off any unwarranted attacks by intruders and hackers.</p>
<p>Start by maintaining strong passwords that includes a combination of characters, numbers, symbols and cases. Also, steer clear of any commonly used password combinations like 1234. Other important security practices involve limiting admin access and clearing off any outdated software or installations that are not in use.</p>
<p>Having good backup practices are as important as maintaining strong website security. Some recommended backup services include <a href="http://vaultpress.com/">VaultPress</a> and <a href="http://ithemes.com/purchase/backupbuddy/">BackupBuddy</a>.</p>
<p><b>Business Advice</b></p>
<p>Unlike common notions, effective collaboration is critical to WordPress business success. “Nobody’s really going to steal your ideas,” says <a href="http://www.wysija.com/">Kim Gjerstad</a> who points out that collaborating with the right people can help scale new business heights. At the same time, <a href="https://page.ly/?utm_expid=18213886-13&amp;utm_referrer=http%3A%2F%2Fwp.smashingmagazine.com%2F2013%2F03%2F20%2Fpractical-tips-top-wordpress-pros%2F">Josh Strebel</a> advices developers to choose their partners for collaboration carefully. Another important strategy for WordPress business development is tapping the growing mobile segment of the market including tablet and smartphone users with a mobile-friendly layout, responsive themes and applications.</p>
<p>There is also a need to create consistency and value for customers by reducing your support load. Web entrepreneur <a href="http://www.fredericktownes.com/">Frederick Townes</a> suggest that this can be achieved by adopting certain practices like using the right tools, creating reliable codes, localizing and nurturing advocates who can, in turn, help you figure how to get new advocates. There is also a need to educate your clients on adopting the right practices and tools to avoid black-hat SEO and link scams.</p>
<p><b>Community Involvement</b></p>
<p>Getting involved with the community and contributing back is vital for all <b>WordPress Developers</b> to hone their skills. An ideal way to start is by getting actively involved with <a href="http://core.trac.wordpress.org/">Trac</a> and report if something doesn’t work. The different feedbacks to your report will, in fact, help in the quicker progress of the software. It is also equally important to remain up-to-date with new WordPress happenings by getting together with other members of the community, subscribing to WordPress blog sites and following core development chat logs.</p>
<p>Besides all this, staying up to date with what’s the latest on WordPress plugins is also a great way to keep up with what’s happening. You never know when a new plugin will appear that surpasses all of its competitors.</p>
<p><em>This was a guest post by Stella Richard. Owner of a prime <a href="http://www.ivoryshorewebsite.com/web-design-development/">web development company </a> that she founded with her best friend, Stella ever gets time to do much. Beyond that writing and exploring a treasure trove of creative possibilities on digital usability, innovation and aesthetic <a href="http://www.ivoryshorewebsite.com/">web design Vancouver</a>. She still manages to squeeze in an hour of pilates or zumba on weekdays and loves every bit of it!</em></p>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/s5tjjvmlGM4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/04/important-wordpress-tips-from-wordpress-pros/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/04/important-wordpress-tips-from-wordpress-pros/</feedburner:origLink></item>
		<item>
		<title>Understanding the Differences Between C &amp; C++</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/Z5zQ8JagDyA/</link>
		<comments>http://www.codercaste.com/2013/04/understanding-the-differences-between-c-c/#comments</comments>
		<pubDate>Fri, 05 Apr 2013 21:12:27 +0000</pubDate>
		<dc:creator>Spyros</dc:creator>
				<category><![CDATA[C/C++ Programming]]></category>
		<category><![CDATA[c and c++ differenes]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2198</guid>
		<description><![CDATA[Both C and C++ are computer programming languages. As it has been derived from C, C++ can be considered as a superset of C.  It runs most of the C code and includes the concept &#8220;Object Oriented&#8220;.  Though some of the programming rules that are applicable in both C and C++, they generate dissimilar results. [...]]]></description>
				<content:encoded><![CDATA[<p>Both C and C++ are computer programming languages. As it has been derived from C, C++ can be considered as a superset of C.  It runs most of the C code and includes the concept &#8220;<i>Object Oriented</i>&#8220;.  Though some of the programming rules that are applicable in both C and C++, they generate dissimilar results.</p>
<p>&nbsp;</p>
<p>The major differences between C and C++ are as follows:</p>
<p><b> </b></p>
<ul>
<li>While C is a procedural programming language it gives importance to the data and the process of the program and C++ being is a procedural and an object oriented (multi-paradigm) program focuses only on the records and not on the procedure.  The object oriented program characteristics makes it possible to code huge programs with ease.</li>
<li>Since C is not an object oriented program, certain features like data hiding are not present and hence the data is not protected. C++, however, has the data hiding facility and hence the data is protected.</li>
<li>As the language of C is hard to interpret and is not easy to be used, it is considered to be a low-level language. C++ has both low-level (focuses on hardware of the device) and high-level languages (focuses on the program) and hence is considered to be a middle-level language.</li>
<li>Binding is a process by which the data and variables of a computer program are transformed into a codes.  C makes use of Early Binding or Static binding which is a top to down approach and is created step by step with detailed processing of each step. C++ utilizes Late Binding or dynamic binding which is a bottom to up method and in this method the basic building blocks are created first and then they are connected together to form a bigger format.</li>
<li>C++ follows Functions form the basic constituents of a C program and objects are the basic constituents of C++.</li>
<li>C does not permit an operator to use more than one variable in a single program as it does not have function overloading. However C++ can support function overloading, due to polymorphism, a characteristic of object oriented programming.</li>
<li>Name collisions cannot be evaded in C as it does not have the NAMESPACE feature. C++ makes use of NAMESPACE to circumvent name collisions.</li>
<li>The syntaxes, data types and header files are different in C and C++. &lt;stdio.h&gt; is the main header file for C while for C++ it is &lt;iostream.h&gt;.  Also C employs scanf &amp; printf as the input and output functions respectively and makes use of cin&gt;&gt; and cout&lt;&lt; as its input and output functions respectively.</li>
<li>Reference variables (This permits 2 changeable names to point to the same memory site) cannot be used in C programming. C++ allows the use of reference variables.</li>
<li>It is a smaller language as it has only 32 Keywords. The number of Keywords in C++ is 52.</li>
<li>Functions cannot be used inside structures in C while it can be used in C++.</li>
<li>Inheritance, which is a procedure due to which items of one program gets the properties of another program, is present in C++ and not in C.</li>
</ul>
<p>&nbsp;</p>
<p>Thus, if one wants to just browse through programming it will be better to use C++ as it has a powerful library.  However, if learning programming is the objective, then one should go for C.</p>
<p><em>This guest post has been brought to you by Robin Mckenzie of <a href="http://www.cableinmyarea.net/">www.cableinmyarea.net</a>, a site that offers savings and current information on consumers&#8217; broadband internet and cable.</em></p>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/Z5zQ8JagDyA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/04/understanding-the-differences-between-c-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/04/understanding-the-differences-between-c-c/</feedburner:origLink></item>
		<item>
		<title>Memory for Random Generation Scripts</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/zvWQXIw4bd4/</link>
		<comments>http://www.codercaste.com/2013/04/memory-for-random-generation-scripts/#comments</comments>
		<pubDate>Mon, 01 Apr 2013 19:58:15 +0000</pubDate>
		<dc:creator>Hunter</dc:creator>
				<category><![CDATA[General Tips & Tricks]]></category>
		<category><![CDATA[Python Programming]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[random generation]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2155</guid>
		<description><![CDATA[Python scripts can be used to create many things &#8211; shoes and ships and sealing wax, cabbages and kings &#8211; and to do many things &#8211; to make the sea boiling hot, and give pigs some wings. You will perhaps want to randomly generate math problems, if you are a teacher, tutor, or designer of [...]]]></description>
				<content:encoded><![CDATA[<p>Python scripts can be used to create many things &#8211; shoes and ships and sealing wax, cabbages and kings &#8211; and to do many things &#8211; to make the sea boiling hot, and give pigs some wings. You will perhaps want to randomly generate math problems, if you are a teacher, tutor, or designer of a Math Blaster game; you will perhaps want to randomly generate story ideas, if you are bored &#8211; ideas like Cowboy mummies battle psychic tigers in a post-apocalyptic Martian wasteland, only to find love in the most unexpected places, being of the form character(s) 1 verb character(s) 2 in setting, twist/theme and randomly selecting from a list of each type; you will perhaps want to encrypt a lot of files but each with a unique key. And you may, as the fancy strikes you, run a random [insert anything here] generator on Tuesday, and not run it again until Friday. But on Friday, you do not wish to recreate anything you randomly generated on Tuesday. How can you be sure that time after time of running a random generation script you do not double-generate? The answer, my friend, is much more accessible than whatever is blowing in the wind, because the answer is simply: memory.txt.</p>
<p>Say you have a random generation script that outputs math problems. You&#8217;re planning out the section on systems of equations for your algebra class, and over the course of this section you plan on giving out 5 worksheets. So you use your script to generate the 100 problems for these worksheets, ensuring uniqueness by storing every randomly generated problem in a variable and checking newly generated problems against this variable. But then you realize that the students would benefit from 2 more worksheets, so you go to generate those, but &#8211; the uniqueness of those 40 new problems are ensured only within those 40, but not between those 40 and the first 100. So you go back to your script and write this:</p>
<pre class="brush: python; title: ; notranslate">
f = open('filepath/filepath/filepath/memory.txt','a+')
memory = f.read()
</pre>
<p>This opens memory.txt or, if memory.txt does not exist, creates it. Then, the contents are fed into the variable named memory.</p>
<p>Every time a new problem is generated, it is checked against memory:</p>
<pre class="brush: python; title: ; notranslate">
if problem != memory:
    memory += problem
    f.write(problem)
</pre>
<p>This is assuming that problem is a string. If it isn&#8217;t, you&#8217;ll want to run problem through a function that converts the data it contains into a string. Writing every new and uniquely generated problem &#8211; or whatever it is you&#8217;re generating &#8211; to the file ensures that when you run the script again, and the variable named memory is fed the data in the file, then when you check problems generated from the script the second or fourth or hundredth time you run it, you are checking it against every single problem ever generated by the script. This way, everything generated is new, unique.</p>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/zvWQXIw4bd4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/04/memory-for-random-generation-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/04/memory-for-random-generation-scripts/</feedburner:origLink></item>
		<item>
		<title>The Pros and Cons of Using Ruby on Rails</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/qToZY57Hlsk/</link>
		<comments>http://www.codercaste.com/2013/03/the-pros-and-cons-of-using-ruby-on-rails/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 00:04:00 +0000</pubDate>
		<dc:creator>Spyros</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[rails ruby]]></category>
		<category><![CDATA[ror advantages]]></category>
		<category><![CDATA[ruby on rails advantages]]></category>
		<category><![CDATA[ruby on rails disadvantages]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2181</guid>
		<description><![CDATA[What exactly is Ruby on Rails? Ruby on Rails often referred to as RoR or Rails is commonly defined as an open source full-stack web application for use with Ruby, a general purpose programming language. As a full-stack framework, Rails empowers web developers to create applications and web pages, which query the database or display [...]]]></description>
				<content:encoded><![CDATA[<p><b>What exactly is Ruby on Rails?</b></p>
<p>Ruby on Rails often referred to as RoR or Rails is commonly defined as an open source full-stack web application for use with Ruby, a general purpose programming language. As a full-stack framework, Rails empowers web developers to create applications and web pages, which query the database or display information obtained from the web server. The application also features a routing system, which operates independently from the web server. Some of the principles and development patters which are featured in Rails include MVC (Model-View-Controller), don’t repeat yourself, convention over configuration and active record pattern. Ruby on Rails is a relatively new application even though Ruby predates Rails by almost a decade. There are many misconceptions and prejudices related to its use among developers. By discussing the advantages and disadvantages of Rails, I hope to help emerging developers decide if Rails suits their development requirements.</p>
<p><b>The Advantages of Using Ruby on Rails</b></p>
<p>The primary advantage of Rails is its simple and clean syntax/scripting, which is very close to natural language. Due to this it preferred by the beginners and on the long term, the coding for any application or page is easier to maintain. As it a part of an open source project, Rails is available for free and advanced users can easily modify or improvise the code as per their requirement. Thousands of free gems and plug-ins are available, which provide additional functionality/customization to the final webpage/application.</p>
<p>Another advantage of RoR is its flexibility, which allows developers to explore multiple programming paradigms, a feature which is lacking in Java, PHP etc. This flexibility plays a crucial role in decreasing the overall configuration and coding requirements needed for developing a new page or applications. This usually translates to substantial time savings for the developer, company and client. Moreover, codes generated using Rails are easily reused and ported for use in other projects.</p>
<p>Additional advantages are directly linked to its core principles such as don’t repeat yourself and convention before configuration. Don’t repeat yourself principle ensures that every bit of code is free of ambiguity, which eases many long-term maintenance issues, which may arise with an object-oriented language such as Ruby. By minimizing boiler-plate code Rails ensures that application/webpage codes are easier to understand/find as and when necessary. By placing precedence on convention as compared to configuration, Rails ensures that the developer gains access to preset configurations, which generates time savings during development.</p>
<p>A less commonly known advantage of using RoR is its inbuilt security features, which allow application/web pages developed on rails to be unaffected by SQL injection attacks. Moreover, Rails is also capable of preventing Cross site scripting attacks, which often appear as a vulnerability of Java and PHP-based applications. These are only a few of the advantages that RoR provides to developers and users the actual list of advantages is much longer.</p>
<p><b>Limitations of Using Ruby on Rails</b></p>
<p>According to many programmers, the primary limitation of Rails is the use of Ruby, which being a relatively new object oriented language, is unable to support many legacy systems. Moreover, the libraries available for Ruby is comparatively limited, which also affects the overall usability of Rails for many applications/web pages. As Rails was developed relatively recently as well, support problems tend to arise, if something goes wrong. Many also deem it unsuitable for use in the development of business-critical applications as there is currently no backup system if the application crashes.</p>
<p>Additional problems arising from Rails are related to scalability specially in case of existing applications developed using the web application. Ruby is also comparatively more resource hungry in comparison to Java and PHP, hence, while scaling up, additional resources are required to ensure smooth operations. Moreover, there is a lack of experienced RoR programmers in the market, which is perceived as a risk by the software companies. The unavailability of extensive documentation for RoR also has an additional fall-out in the form of undocumented behavior of applications created using Rails.</p>
<p>Finally, there is a currently a lack in the availability of usable IDEs for Ruby along with the absence of a market-ready common application server, which has held back widespread use of Ruby by software development firms and programmers all over the world. These are the main limitations of RoR, which have come to light over the years and though the list is definitely not exhaustive, it is expected to help software programmers decide whether to use Ruby or stick to traditional languages such as Java for developing their web pages/applications.</p>
<p>This was a guest post by Abhishek. Abhishek is currently working with eXtendCode, a <a href="http://www.extendcode.com/">Software Development Company in India</a>, which provides software solutions such as <a href="http://www.extendcode.com/Services/java-application-development.aspx">Java Application Development</a>, Open Source Application Development, Data Base Solutions, Mobile Application Development and Quality Assurance Services etc.</p>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/qToZY57Hlsk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/03/the-pros-and-cons-of-using-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/03/the-pros-and-cons-of-using-ruby-on-rails/</feedburner:origLink></item>
		<item>
		<title>Python Script for Markov Chains</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/4IzQdkfkVJE/</link>
		<comments>http://www.codercaste.com/2013/03/python-script-for-markov-chains/#comments</comments>
		<pubDate>Sun, 10 Mar 2013 20:04:02 +0000</pubDate>
		<dc:creator>Hunter</dc:creator>
				<category><![CDATA[Python Programming]]></category>
		<category><![CDATA[markov]]></category>
		<category><![CDATA[markov chain]]></category>
		<category><![CDATA[mathematical programming]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[python math]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2151</guid>
		<description><![CDATA[Consider the following problem in order to understand why we would need to create a Python Script for Markov Chains: A certain attire-fickle girl changes her outfit every hour. Her opinion for what outfit she should wear is always dependant only upon the outfit she is currently wearing. When she is wearing a blue-based outfit, [...]]]></description>
				<content:encoded><![CDATA[<p>Consider the following problem in order to understand why we would need to create a Python Script for Markov Chains:<br />
A certain attire-fickle girl changes her outfit every hour. Her opinion for what outfit she should wear is always dependant only upon the outfit she is currently wearing. When she is wearing a blue-based outfit, she has a 30% likelihood of remaining in a blue-based outfit, 20% likelihood of changing into a green outfit, and a 50% likelihood of changing into a red outfit. When she is in a green outfit, she has a 10% chance of changing into a blue outfit, a 10% chance of not changing, and an 80% chance of changing into a red outfit. When in a red outfit, she has a 40% chance of changing into a blue outfit, a 30% chance of changing into a green outfit, and a 30% chance of not changing. If she is currently wearing a green outfit, what is the likelihood, in five hours, of her wearing each color outfit?</p>
<p>Perhaps in life more practical examples will find you, but for our purposes here, how can the answer be found?</p>
<p>The answer is: Markov chains. This is a mathematical tool that considers a current state, the likelihood of changing to another state given the current state, and gives the likelihood of being in each state after a certain number of discrete steps. Python is wonderful language to use to create mathematical tools, so let&#8217;s consider how to craft a python script that can create and handle Markov chains.</p>
<pre class="brush: python; title: ; notranslate">
## This script uses the numpy moduel
import numpy as np

## The names of the states
s_name = []

## Gets how many states in the Markov chain
hold = 1
while hold == 1:
    try:
        states = int(raw_input('How many states? '))
        hold = 0
    except:
        print 'Dude, seriously.  This needs to be a number.'

## Gets the names of the states
for i in range(1, states+1):
    s_name.append(raw_input('What is the name of state '+str(i)+'? '))

## Creates an array of 'states' dimensions
P = np.zeros(shape=(states,states))

## Fills P with probabilities for each state
i = 1
while i &amp;lt; states+1:
    sumtoone = 0
    print ''
    j = 1
    while j &amp;lt; states+1:
        try:
            P[i-1][j-1] = float(raw_input('When in state '+s_name[i-1]+', what is the probability of the next state being '+s_name[j-1]+'? '))
            sumtoone += P[i-1][j-1]
            hold = 0
            j += 1
        except:
            print 'error'
    if sumtoone != 1:
        print 'The sum of the probabilities you entered for next state when in state '+s_name[i-1]+' does not sum to 1.'
    else:
        i += 1
print''
print P
print ''
print 'What is the current state?'
for i in range(0,states):
    print 'State 1: '+str(s_name[i])
hold = 1
## Gets the current state
while hold == 1:
    try:
        c_x = int(raw_input('Current state: '))
        if (c_x &amp;gt; 0) &amp;amp; (c_x &amp;lt;= states):
            hold = 0
        else:
            print 'Not a valid state.'
    except:
        print 'error'

## Creates a 1-dimensional array representing the current state
x = np.zeros(shape=(1,states))
x[0][c_x-1] = 1

print ''
hold = 1
## Gets how many states into the future the user wants to look
while hold == 1:
    try:
        n = int(raw_input('Look how many steps into the future?  '))
        hold = 0
    except:
        print 'error'

## Creates a copy of P
## If I simply said P_mult = P, then when I edited P_mult
## P would be edited as well, and we need P to remain what it is
P_mult = np.zeros(shape=(states,states))
for i in range(0,states):
    for j in range(0,states):
        element = P[i][j]
        P_mult[i][j] = element

## Uses the numpy.dot function to matrix multiply P by itself n times
i = 1
while i &amp;lt; n:
    P_mult = np.dot(P,P_mult)
    i += 1

## Matrix multiplies x by P^n
f_x = np.dot(x,P_mult)
print ''
print 'The probability distribution after '+str(n)+' steps is'
print f_x
</pre>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/4IzQdkfkVJE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/03/python-script-for-markov-chains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/03/python-script-for-markov-chains/</feedburner:origLink></item>
		<item>
		<title>Pros &amp; Cons of PHP Programming</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/e09odOIGCVk/</link>
		<comments>http://www.codercaste.com/2013/03/pros-cons-of-php-programming/#comments</comments>
		<pubDate>Sat, 09 Mar 2013 17:44:22 +0000</pubDate>
		<dc:creator>Spyros</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[creative php]]></category>
		<category><![CDATA[database php]]></category>
		<category><![CDATA[php advantages]]></category>
		<category><![CDATA[php coding]]></category>
		<category><![CDATA[php disadvantages]]></category>
		<category><![CDATA[php pros]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2159</guid>
		<description><![CDATA[Commonly known as PHP, Hypertext Preprocessor is a programming language that is open source and easy to implement. Despite some differing views on the subject, it is a very simple programming tool that web developers can use to their advantage in creating functional and highly interactive websites. Today we are going to examine some of [...]]]></description>
				<content:encoded><![CDATA[<p>Commonly known as PHP, Hypertext Preprocessor is a programming language that is open source and easy to implement. Despite some differing views on the subject, it is a very simple programming tool that web developers can use to their advantage in creating functional and highly interactive websites. Today we are going to examine some of the advantages and disadvantages of php programming.</p>
<p><b>What makes PHP a popular programming tool?</b></p>
<p>PHP is widely used by web designers to create websites that have some aesthetic value and are very functional too. It has many advantages, like:</p>
<ul>
<li>Encourages creativity – Being a simple coding language it gives developers the freedom and flexibility to innovate and implement different objects into the code. The website can have greater user-interaction. For example, it makes major tasks like adding to cart, form filling, online purchasing smoother and quicker because of its simpler design.</li>
<li>Copyright – Being an open source language, programmers and developers do not have to deal with legal issues and copyright infringement. Also, developers have no restrictions in improving any bits of the coding language itself. They have the freedom to contribute their own knowledge to improve its coding tools.</li>
<li>Content based – A website created with HTML is static, which means the components are not changing constantly. Any change has to be reprogrammed and embedded into the code. Factors like changing date and time, information filled in by users, etc. keep changing with every subsequent login. PHP allows dynamic programming so that these factors can be embedded into the code.</li>
<li>Browser compatibility – Since websites created with PHP load on the server, the sites will load equally well on all the different browsers and operating systems. Runtime errors are almost non-existent. Loading time of the pages on different browsers will not prove to be a problem either. The sheer simplicity of the coding structure makes it very easy to implement complicated functions that will work efficiently with a few command lines.</li>
<li>Database compatibility – It works really well with MySQL, making data input a smooth and simple matter. Any changes to the code can be very easily incorporated without affecting the database structure.</li>
</ul>
<p><b>Limitations of web solutions with PHP programming</b></p>
<p>Because the coding language is so simple, when ultra dynamic elements are required on a website, it may require an alternative coding language. Also, if the website development project is very big and has too many elements it will require developers with a lot of experience. To put it in a nutshell, big tasks have to be executed with simple tools and will require a pro to handle them.</p>
<p>Also, it is not very effective where the website requires Virtual Basic capabilities. Using PHP in such a situation would complicate the issue and require highly skilled programmers with long-standing experience to make it work. When the website requires animation and Flash based effects, PHP is definitely not a sensible choice for web designing. The capabilities of the coding language are limited in this field as compared to other more advanced programming source codes.</p>
<p>To sum up one can safely say that when you want a basic but attractive website that focuses more in functionality than dynamic display, PHP Programming will do perfectly and cost less.<br />
This guest post has been brought to you by Robin Mckenzie of Buycenturylink, a site that offers savings and current information on consumers&#8217; broadband internet and cable. <a href="http://www.buycenturylink.com/">Click here</a> to experience top-speed internet, excellent value, and award-winning security.</p>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/e09odOIGCVk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/03/pros-cons-of-php-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/03/pros-cons-of-php-programming/</feedburner:origLink></item>
		<item>
		<title>5 Best Java Applications for your Cell Phone</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/gtmGzS7uyEw/</link>
		<comments>http://www.codercaste.com/2013/02/5-best-java-applications-for-your-cell-phone/#comments</comments>
		<pubDate>Tue, 26 Feb 2013 23:54:23 +0000</pubDate>
		<dc:creator>Spyros</dc:creator>
				<category><![CDATA[Funny / Interesting]]></category>
		<category><![CDATA[cell phone applications in java]]></category>
		<category><![CDATA[java application development]]></category>
		<category><![CDATA[java applications]]></category>
		<category><![CDATA[java google maps]]></category>
		<category><![CDATA[java mobile]]></category>
		<category><![CDATA[java opera mini]]></category>
		<category><![CDATA[java windsets]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2124</guid>
		<description><![CDATA[Not all of us want to invest in a slick new iPhone or a snazzy Android device that will burn a hole in your pocket. It’s not just about the money either, my reason to not opt for these devices is simple – I drop my keys and cell all the time and I just [...]]]></description>
				<content:encoded><![CDATA[<p>Not all of us want to invest in a slick new iPhone or a snazzy Android device that will burn a hole in your pocket. It’s not just about the money either, my reason to not opt for these devices is simple – I drop my keys and cell all the time and I just don’t want to check how the new iPhone reacts after a four feet fall on concrete. What I like most about my old Java-powered Nokia is its sturdy built and proven ability to withstand shocks of various kinds. There is of course a tradeoff, I cannot play Angry Birds or reach my friends free through WhatsApp, so I don’t even try. But that definitely does not mean that you Java phone is just a medium sized paper weight that you can use to make phone calls. Recent progress in Java Application Development has led to the emergence of certain apps, which can extend the scope of your old phone. Some of these are discussed here:</p>
<p><b>Google Maps</b></p>
<p>Google revolutionized the use of internet in more ways than I can even try to discuss, but Google Maps is definitely my favorite. This Java-powered application can help you navigate the most intricate of urban mazes without breaking into a sweat. The UI of this particular app is specially suited for use with Java mobile phones, which usually feature a small or medium sized screen. Moreover it’s easy to use and the UI is definitely responsive even in case of phones that typically feature a smaller processor. Another Google Java App that deserves mention is the Gmail Mobile app, which allows you fast and easy access to your Gmail account sadly it does not do much else.  <b></b></p>
<p><b>Opera Mini</b></p>
<p>Back in the day, I used to be a die-hard supporter of the Opera browser for desktops. Sadly, the new desktop browser leaves a lot to be desired, but thankfully, the Opera Mini story has a different plot altogether. This Java application for mobile phones provides fast and easy access to the Internet and is perfectly suited for use over slow 2G networks. Though it lacks flash support, that is actually a benefit because pages load faster and it allows you to surf the web even in phones with smaller screens. Personal recommendation – try it once and you will never again want to use your phone’s in-built browser ever again.</p>
<p><b>Widsets</b></p>
<p>Even if you old Java-powered cell cannot give you the entertainment of the iPhone or Android device, you do have a few low-intensity substitutes. One of these is the Nokia-owned Widsets. This java app allows you to choose and utilize multiple apps for your cell phone and provide simpler forms of entertainment usually through text, RSS and pictures. Widsets does not support a touch-based interface, however, it does support keypad/keyboard based entries.</p>
<p><b>Reporo</b></p>
<p>As I have mentioned earlier, Java phones do not support WhatsApp, which can be quite disheartening, however, it does support old-school Instant Messaging (IM). Reporo is one of the many apps that allow you simultaneous access to multiple IM chat clients such as Gtalk, MSN, AOL etc. The new version of Reporo even has an online shopping option but that function works in only a few countries. Still it allows you to stay connected with people half-way across the world without burning a hole in your pocket.</p>
<p><b>EQO</b></p>
<p>For those who live and breathe Skype, this is a boon. That’s right you can actually connect to Skype using your old Java phone if you gave the EQO app. There is however a tradeoff, you need to keep your PC running and connected to the phone as EQO connects to the web through your PC and not the mobile internet. Agreed that it can be tricky, but dude, seriously, free calls online through your old phone, how cool is that?</p>
<p>I am sure that you have come across some of these applications and probably use one or more of them regularly, but still a reminder is sometimes helpful. So before you trade up your old Java phone, ask yourself, if you have checked out all it can do. Also, in case you think that I have missed any Java App which you feel I should have included, please leave a comment and we’ll take it from there.</p>
<p>This was a guest post by Abhishek. Abhishek is currently working with eXtendCode, an <a href="http://www.extendcode.com/">Software Development Company</a> in India, which provides software solutions such as <a href="http://www.extendcode.com/Services/java-application-development.aspx">Java Application Development</a>, Open Source Application Development, Data Base Solutions, Mobile Apps Development and Quality Assurance Services etc.</p>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/gtmGzS7uyEw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/02/5-best-java-applications-for-your-cell-phone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/02/5-best-java-applications-for-your-cell-phone/</feedburner:origLink></item>
		<item>
		<title>Graphing Linear Inequalities with Python</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/kX0aKXtKsn0/</link>
		<comments>http://www.codercaste.com/2013/02/graphing-linear-inequalities-with-python/#comments</comments>
		<pubDate>Tue, 26 Feb 2013 02:37:37 +0000</pubDate>
		<dc:creator>Hunter</dc:creator>
				<category><![CDATA[Python Programming]]></category>
		<category><![CDATA[algebra]]></category>
		<category><![CDATA[graphing]]></category>
		<category><![CDATA[linear inequations]]></category>
		<category><![CDATA[matplotlib.pyplot]]></category>
		<category><![CDATA[pyplot]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2085</guid>
		<description><![CDATA[Here is a practical example of the matplotlib.pyplot module in use. This code generates a list of linear inequalities, prints them in numbered groups (such as if you were to be creating worksheets for students), and then displays the graphs of each inequality in order. The code makes use of pyplot&#8217;s simple syntax and versatility [...]]]></description>
				<content:encoded><![CDATA[<p>Here is a practical example of the matplotlib.pyplot module in use. This code generates a list of linear inequalities, prints them in numbered groups (such as if you were to be creating worksheets for students), and then displays the graphs of each inequality in order. The code makes use of pyplot&#8217;s simple syntax and versatility to create it&#8217;s own shading.</p>
<pre class="brush: python; title: ; notranslate">
import matplotlib.pyplot as plt
import random

## List containing all the equations already used
test = []

## Sets the size of the graph, also adds lines on the axes and
## a grid.  There is a grid function build in to matplotlib.pyplot,
## but it isn't very flexable.  With this, you can make the grid
## solid lines or dashed, or of any thickness or interval.
def buildplane():

    xy = [-11,11,-11,11]
    plt.axis(xy)
    xy_axes = plt.plot([-11,11],[0,0],[0,0],[-11,11])

    for yline in range(-11,12):
        plt.plot([-11,11],[yline,yline],'k',lw=0.5)
    for xline in range(-11,12):
        plt.plot([xline,xline],[-11,11],'k',lw=0.5)

    plt.setp(xy_axes,color='black',lw=2)
    plt.text(10.5,0.5,'x')
    plt.text(0.5,10.5,'y')

## Returns a random number from -high to high, or a fraction
def randomnumber(high):
    gogogo = 0
    while gogogo != 1:
        temp = random.randrange(2,5)
        if temp != 3:
            gogogo = 1
    frac = random.randrange(1,temp)/temp
    if random.random() &lt; .4:
        frac *= -1
    if random.random() &lt;= 0.1:
        num = frac
    else:
        num = random.randrange(1,high)
        if random.random() &lt;= 0.075:
            num += frac
        if random.random() &lt; .4:
            num *= -1
    return num

## Returns two points - and since any line can be defined by two points,
## this really returns the data for a new equation
def point():
    a_0 = float(random.randrange(-10,10))
    a_1 = float(random.randrange(-10,10))
    a_2 = float(random.randrange(-10,10))
    a_3 = float(random.randrange(-10,10))
    return [[a_0,a_1],[a_2,a_3]]

## Given two points, returns the slope and y-intercept of the line
## defined by those points - or returns 'undefined' if the slope
## is undefined
def m_b_form(point_1,point_2):
    if point_1[0]-point_2[0] != 0:
        m = ( point_1[1] - point_2[1] ) / ( point_1[0] - point_2[0] )
        b = ( point_1[0] * point_2[1] - point_2[0] * point_1[1] ) / ( point_1[0] - point_2[0] )
        return [m,b]
    else:
        return 'undefined'

## Returns 1 if the equation is both unique and has 'nice' and easy numbers.
## Returns 0 otherwise
def goodandunique(line):
    good = 0
    unique = 0
    m = line[0]
    b = line[1]
    if (m!=0)&amp;(m&lt;8)&amp;(m&gt;-8)&amp;((m%1==0)|(m*2%1==0)|(m*4%1==0)|(m*5%1==0))&amp;(b&lt;8)&amp;(b&gt;-8)&amp;((b%1==0)|(b*2%1==0)):
        good = 1
    if line not in test:
        test.append(line)
        unique = 1
    if (good == 1) &amp; (unique == 1):
        return 1
    else:
        return 0

## Plots a line passed in the form [m,b]
def plotline(line):
    m = line[0]
    b = line[1]
    plt.plot([-11,11],[m*-11+b,m*11+b],'k')

## Returns a string containing a readable expression of the inequality
## passed to it
def y_string(line,inequal):
    if inequal == 1:
        ymxb = 'y &gt;= '
    elif inequal == 2:
        ymxb = 'y &gt; '
    elif inequal == 3:
        ymxb = 'y &lt;= '
    else:
        ymxb = 'y &lt; '
    if line[0] == 1:
        ymxb += 'x'
    elif line[0] == -1:
        ymxb += '-x'
    else:
        ymxb += str(line[0])+'x'
    if line[1] != 0:
        if line[1] &lt; 0:
            ymxb += ' - '+str(line[1])[1:]
        else:
            ymxb += ' + '+str(line[1])
    return ymxb

## Graphs an inequality
def graphinequal(line,inequal):
    m = line[0]
    b = line[1]
    ## If the inequality is &gt;= or &gt;
    if (inequal == 1) | (inequal == 2):
        ## If the inequality is &gt;=
        if inequal == 1:
            ## Plot the line as a solid line
            plt.plot([-11,11],[m*-11+b,m*11+b],'k')
        ## If the inequality is &gt;
        if inequal == 2:
            ## Plot the line as a dotted line
            plt.plot([-11,11],[m*-11+b,m*11+b],'k--')
        ## If the slope is negative
        if m &gt; 0:
            y = 11
            ## Starting at the top of graph, graph thin lines from the left
            ## edge of the graph to the x-position of the line given
            ## our current y position
            while y &gt;= -11:
                x = (y-b)/m
                plt.plot([-11,x],[y,y],'k',lw=0.25)
                y -= 0.25
            x = 11
            ## Starting at the right of the graph, graph thin lines
            ## from the top of the graph down to the y-position of
            ## the line given our current x position
            while x &gt;= -11:
                y = m*x+b
                plt.plot([x,x],[y,11],'k',lw=0.25)
                x -= 0.25
        ## If the slope is positive, do the same as for if
        ## the slope were negative, except drawing the thin lines
        ## on the other side of the line
        if m &lt; 0:
            y = 11
            while y &gt;= -11:
                x = (y-b)/m
                plt.plot([x,11],[y,y],'k',lw=0.25)
                y -= 0.25
            x = 11
            while x &gt;= -11:
                y = m*x+b
                plt.plot([x,x],[y,11],'k',lw=0.25)
                x -= 0.25

    ## If the inequality is &lt;= or &lt;
    if (inequal == 3) | (inequal == 4):
        if inequal == 3:
            plt.plot([-11,11],[m*-11+b,m*11+b],'k')
        if inequal == 4:
            plt.plot([-11,11],[m*-11+b,m*11+b],'k--')
        if m &lt; 0:
            y = 11
            while y &gt;= -11:
                x = (y-b)/m
                plt.plot([-11,x],[y,y],'k',lw=0.25)
                y -= 0.25
            x = 11
            while x &gt;= -11:
                y = m*x+b
                plt.plot([x,x],[-11,y],'k',lw=0.25)
                x -= 0.25
        if m &gt; 0:
            y = 11
            while y &gt;= -11:
                x = (y-b)/m
                plt.plot([x,11],[y,y],'k',lw=0.25)
                y -= 0.25
            x = 11
            while x &gt;= -11:
                y = m*x+b
                plt.plot([x,x],[-11,y],'k',lw=0.25)
                x -= 0.25

## The number of worksheets you wish to create
ws = 5

## List of all the points used during the running of this program
points_final = []
## List of all the lines used during the running of this program
lines_final = []
## List of readable y=mx+b forms of the equations
ymxb_final = []
## List of integers, 1 to 4, representing which inequality
## (&gt;, &lt;, &lt;=, &gt;=) has been used
inequal_final = []

## Creates the equations
for k in range(0,ws):

    for i in range(0,13):
        hold = 1
        ## Repeates until the line created is a unique line
        ## and has 'nice' and easy numbers
        while hold == 1:
            ## Creates two points, stores them as points
            points = point()
            ## Redescribes the line represented by points
            ## in the form of the slope and y-intercept
            line = m_b_form(points[0],points[1])
            ## If the line has a defined slope
            if line != 'undefined':
                ## If the line is unique and has 'nice' and easy numbers
                if goodandunique(line) == 1:
                    hold = 0
                    points_final.append(points)
                    lines_final.append(line)
                    inequal_final.append(random.randrange(1,5))
                    ymxb_final.append(y_string(line,inequal_final[len(inequal_final)-1]))

## Prints the equations
for k in range(0,ws):

    print ''
    print 'Run #'+str(k+1)
    print 'Ex: '+ymxb_final[k*13]
    for i in range(1,13):
        print str(i)+': '+ymxb_final[i+k*13]

## Displays the graphs, one at a time
for k in range(0,ws):

    for i in range(0,13):
        buildplane()
        graphinequal(lines_final[i+k*13],inequal_final[i+k*13])
        plt.show()</pre>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/kX0aKXtKsn0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/02/graphing-linear-inequalities-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/02/graphing-linear-inequalities-with-python/</feedburner:origLink></item>
		<item>
		<title>Read, Set, Go! How to Create a GO Board Game in Python</title>
		<link>http://feedproxy.google.com/~r/Codercastecom/~3/u2MQUIvBox0/</link>
		<comments>http://www.codercaste.com/2013/02/read-set-go-how-to-create-a-go-board-game-in-python/#comments</comments>
		<pubDate>Fri, 22 Feb 2013 05:49:19 +0000</pubDate>
		<dc:creator>Hunter</dc:creator>
				<category><![CDATA[Python Programming]]></category>
		<category><![CDATA[board game go in python]]></category>
		<category><![CDATA[board go artificial intelligence]]></category>
		<category><![CDATA[create a go game in python]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.codercaste.com/?p=2081</guid>
		<description><![CDATA[The board game of Go is so expressly Japanese &#8211; elegant, yet simple, yet layered with depths of genius for those who meditate upon it. The rules are simple, and well documented here. Here is an example of a python program that will allow two human players to play against one another on one computer, [...]]]></description>
				<content:encoded><![CDATA[<p>The board game of Go is so expressly Japanese &#8211; elegant, yet simple, yet layered with depths of genius for those who meditate upon it. The rules are simple, and well documented <a href="http://en.wikipedia.org/wiki/Rules_of_Go">here</a>.</p>
<p>Here is an example of a python program that will allow two human players to play against one another on one computer, providing an ascii display. In future posts we will be exploring how basic user-raw_input-dependent programs like this one can be improved through GUI programming and over-the-net communication &#8211; turning this one-computer ascii program into a graphical game you can play with your friend in Japan &#8211; or, if you&#8217;re already in Japan, with your friend in Jamaica (or, if you&#8217;re already in Jamaica, somewhere that is not Jamaica). I have explained the code in the comments.</p>
<p>In a recent post, I provided an example of AI that learns how to play tic-tac-toe, even until it becomes unbeatable. It may be worthwhile to consider how the approach shown there can be applied here.</p>
<pre class="brush: python; title: ; notranslate">
## The number of spots per side of the board
## This code allows for an nxn board
boardsize = 5
## Value determining whether the player wants to quit or not
gameon = 1
## Lists of groups that have been removed from the board via capture,
## held in these varaibles in case, when all captures have been
## completed, the board resembles a previous game state and
## the move is invalid.  In that case, the groups are restored
## from these varaibles.
restore_o = []
restore_x = []

## Generates blank game states
def initalize():
    gs = []
    for i in range(0,boardsize):
        gs.append([])
        for j in range(0,boardsize):
            gs[i].append('-')
    return gs

## Provides an ascii display of the Go board
def printboard(gs):
    global boardsize
    for row in gs:
        rowprint = ''
        for element in row:
            rowprint += element
            rowprint += ' '
        print(rowprint)

## Returns a list of the board positions surrounding the
## passed group.
def gperm(group):
    permimeter = []
    global boardsize
    hit = 0
    loss = 0
    ## Adds permimeter spots below
    ## Works by looking from top to bottom, left to right,
    ## at each posisition on the board.  When a posistion
    ## is hit that is in the given group, I set hit = 1.
    ## Then, at the next position that is not in that group,
    ## or if the end of the column is reached, I set loss = 1.
    ## That point is the first point below a point in that group,
    ## so it is part of the permieter of that group.
    i = 0
    j = 0
    while i &lt; boardsize:
        j = 0
        hit = 0
        while j &lt; boardsize:
            if [i,j] in group:
                hit = 1
            elif (hit == 1) &amp; ([i,j] not in group):
                loss = 1
            if (hit == 1) &amp; (loss == 1):
                permimeter.append([i,j])
                hit = 0
                loss = 0
            j += 1
        i += 1
    ## Adds permimeter spots to the right
    i = 0
    j = 0
    while i &lt; boardsize:
        j = 0
        hit = 0
        while j &lt; boardsize:
            if [j,i] in group:
                hit = 1
            elif (hit == 1) &amp; ([j,i] not in group):
                loss = 1
            if (hit == 1) &amp; (loss == 1):
                permimeter.append([j,i])
                hit = 0
                loss = 0
            j += 1
        i += 1
    ## Adds permimeter spots above
    i = 0
    j = boardsize-1
    while i &lt; boardsize:
        j = boardsize-1
        hit = 0
        while j &gt;= 0:
            if [i,j] in group:
                hit = 1
            elif (hit == 1) &amp; ([i,j] not in group):
                loss = 1
            if (hit == 1) &amp; (loss == 1):
                permimeter.append([i,j])
                hit = 0
                loss = 0
            j -= 1
        i += 1
    ## Adds permimeter spots to the left
    i = 0
    j = boardsize-1
    while i &lt; boardsize:
        j = boardsize-1
        hit = 0
        while j &gt;= 0:
            if [j,i] in group:
                hit = 1
            elif (hit == 1) &amp; ([j,i] not in group):
                loss = 1
            if (hit == 1) &amp; (loss == 1):
                permimeter.append([j,i])
                hit = 0
                loss = 0
            j -= 1
        i += 1
    return permimeter

## Returns a string that describes the game state
def readable(gs):
    readthis = ''
    readthis += '&lt;&lt;'
    for row in gs:
        for element in row:
            readthis += element
    readthis += '&gt;&gt;'
    return readthis

## Counts the territory captured by each player
def count():
    global gsc
    global non_groups
    global o_points
    global x_points
    global boardsize

    ## Creates a list of groups (non_groups) of empty positions.
    for i in range(0,boardsize):
        for j in range(0,boardsize):
            if gsc[j][i] == '-':
                new = 1
                for group in non_groups:
                    if [i,j] in gperm(group):
                        group.append([i,j])
                        new = 0
                if new == 1:
                    non_groups.append([[i,j]])
    concat('-')

    o_points = 0
    x_points = 0

    ## Gives a point to the each player for every pebble they have
    ## on the board.
    for group in o_groups:
        o_points += len(group)
    for group in x_groups:
        x_points += len(group)

    ## The permimeter of these empty positions is here considered,
    ## and if every position in the permimeter of a non_group is
    ## one player or the other, that player gains a number of points
    ## equal to the length of that group (the number of positions
    ## that their pieces enclose).
    for group in non_groups:
        no = 0
        for element in gperm(group):
            if gsc[element[1]][element[0]] != 'o':
                no = 1
        if no == 0:
            o_points += len(group)

    for group in non_groups:
        no = 0
        for element in gperm(group):
            if gsc[element[1]][element[0]] != 'x':
                no = 1
        if no == 0:
            x_points += len(group)

## Checks for capture, and removes the captured pieces from the board
def capture(xoro):
    global o_groups
    global x_groups
    global gsf
    global restore_o
    global restore_x
    global edited
    if xoro == 'o':
        groups = x_groups
        otherplayer = 'o'
    else:
        groups = o_groups
        otherplayer = 'x'

    ## Checks to see, for each group of a particular player,
    ## whether any of the board positions in the
    ## perimeter around that group are held by the other player.
    ## If any position is not held by the other player,
    ## the group is not captured, and is safe.  Otherwise,
    ## the group is removed.  But we haven't tested this yet
    ## to see if this would return the board to a previous
    ## state, so we save the removed groups with the restore lists.
    for group in groups:
        safe = 0
        for element in gperm(group):
            if gsf[element[1]][element[0]] != otherplayer:
                safe = 1
        if safe != 1:
            edited = 1
            if xoro == 'o':
                restore_x.append(group)
            else:
                restore_o.append(group)
            groups.remove(group)

    # Sets gsf given the new captures
    gsf = initalize()
    for group in o_groups:
        for point in group:
            gsf[point[1]][point[0]] = 'o'
    for group in x_groups:
        for point in group:
            gsf[point[1]][point[0]] = 'x'

## Checks to see if the new game state, created by the most recent
## move, returns the board to a previous state.  If not, then
## gsc is set as this new state, and gsp is set as what gsc was, and
## the new game state is stored in gscache.  The function returns 1
## if the move is valid, 0 otherwise.
def goodmove():
    global gscache
    global gsc
    global gsp
    global gsf
    if readable(gsf) not in gscache:
        gsp = []
        gsc = []
        for element in gsf:
            gsp.append(element)
            gsc.append(element)
        gscache += readable(gsf)
        return 1
    else:
        return 0

## Checks if any groups contain the same point;
## if so, joins them into one group
def concat(xoro):
    global o_groups
    global x_groups
    global non_groups
    if xoro == 'o':
        groups = o_groups
    elif xoro == 'x':
        groups = x_groups
    else:
        groups = non_groups
    i = 0
    ## currentgroups and previousgroups are used to compare the number
    ## of groups before this nest of whiles to the number after.  If
    ## The number is the same, then nothing needed to be concatinated,
    ## and we can move on.  If the number is different, two groups
    ## were concatinated, and we need to run through this nest again
    ## to see if any other groups need to be joined together.
    currentgroups = len(groups)
    previousgroups = currentgroups + 1
    ## Checks if the positions contained in any group are to be
    ## found in any other group.  If so, all elements of the second are
    ## added to the first, and the first is deleted.
    while previousgroups != currentgroups:
        while i &lt; len(groups)-1:
            reset = 0
            j = i + 1
            while j &lt; len(groups):
                k = 0
                while k &lt; len(groups[i]):
                    if groups[i][k] in groups[j]:
                        for element in groups[j]:
                            if element not in groups[i]:
                                groups[i].append(element)
                        groups.remove(groups[j])
                        reset = 1
                    if reset == 1:
                        break
                    k += 1
                j += 1
            if reset == 1:
                i = -1
            i += 1
        previousgroups = currentgroups
        currentgroups = len(groups)

## Adds point xy to a group if xy is in the
## perimeter of an existing group, or creates
## new group if xy is not a part of any existing group.
def addpoint(xy,xoro):
    global o_groups
    global x_groups
    if xoro == 'o':
        groups = o_groups
    else:
        groups = x_groups
    new = 1
    for group in groups:
        if xy in gperm(group):
            group.append(xy)
            new = 0
    if new == 1:
        groups.append([xy])

## Lets the player select a move.
def selectmove(xoro):
    global boardsize
    global gsf
    hold = 1
    while hold == 1:

        minihold = 1
        while minihold == 1:
            pp = raw_input('Place or pass (l/a)? ')
            if pp == 'a':
                return 'pass'
            elif pp == 'l':
                minihold = 0
                ## This try...except ensures that the user
                ## raw_inputs only numbers
                error = 0
                try:
                    x = int(raw_input('x: '))
                except ValueError:
                    error = 1
                try:
                    y = int(raw_input('y: '))
                except ValueError:
                    error = 1
                if error == 1:
                    minihold = 1
                    print('invalid')
            else:
                print('invalid')
        ## Ensures that the raw_input is on the board
        if (x &gt; boardsize) | (x &lt; 0) | (y &gt; boardsize) | (y &lt; 0):
            print('invalid')
        elif gsc[y][x] != '-':
            print('invalid')
        else:
            hold = 0
    ## Places the piece on the 'future' board, the board
    ## used to test if a move is valid
    if xoro == 'o':
        gsf[y][x] = 'o'
    else:
        gsf[y][x] = 'x'

    return [x,y]

## The 'turn,' in which a player makes a move,
## the captures caused by that piece are made,
## the validity of the move is checked, and
## the endgame status is checked.
def turn():
    global xoro
    global notxoro
    global player1_pass
    global player2_pass
    global gameover
    hold = 1
    while hold == 1:
        print()
        print('place for '+xoro)
        ## By calling selectmove(), the player
        ## is given the option of whether to place
        ## a piece or to pass, and where to place
        ## that piece.
        xy = selectmove(xoro)
        if xy == 'pass':
            if xoro == 'o':
                player1_pass = 1
            else:
                player2_pass = 1
            hold = 0
        ## If the player doesn't pass...
        else:
            player1_pass = 0
            player2_pass = 0
            ## The new piece is added to its group,
            ## or a new group is created for it.
            addpoint(xy,xoro)
            ## Groups that have been connected by
            ## the this placement are joined together
            concat(xoro)
            minihold = 1
            ## Edited is a value used to check
            ## whether any capture is made.  capture()
            ## is called as many times as until no pieces
            ## are capture (until edited does not change
            ## to 1)
            edited = 0
            while minihold == 1:
                restore_o = []
                restore_x = []
                capture(xoro)
                capture(notxoro)
                if edited == 0:
                    minihold = 0
                    edited = 0
                else:
                    edited = 0
            ## Checks to see if the move, given all the
            ## captures it causes, would return the board
            ## to a previous game state.
            if goodmove() == 1:
                hold = 0
            ## If the move is invalid, the captured groups need
            ## to be returned to the board, so we use
            ## the groups stored in the restore lists to
            ## restore the o_ and x_groups lists.
            else:
                print('invalid move - that returns to board to a previous state')
                for group in restore_o:
                    o_groups.append(group)
                for group in restore_x:
                    x_groups.append(group)
    if (player1_pass == 1) &amp; (player2_pass == 1):
        gameover = 1

## Called to start a game
def main():
    ## Either 'o' or 'x', determines who's turn it is
    global xoro
    ## The opposite of xoro, determines who's turn it is not
    global notxoro
    ## Game State Current, the current layout of the board
    ## This value is two-dimensional list, the higher dimension being
    ## lists representing the rows and the lower dimension being
    ## strings representing individual positions on the board.
    ## These strings are either '-', 'o', or 'x'
    global gsc
    ## 0 or 1, determins whether the current game is ongoing or ended
    global gameover
    ## Game State Future, same setup as gsc, used for testing the
    ## waters of a new move, to see if that move is valid, before
    ## gsc is edited to reflect that move
    global gsf
    ## Two-dimensional lists, the higher dimension being groups, the
    ## lower dimension being lists of board positions in a particular
    ## group
    global o_groups
    global x_groups
    ## Groups of empty positions
    global non_groups
    ## String containing all the game states encountered in a particular
    ## game, used to check validity of moves
    global gscache
    ## 0 or 1, for whether the player has passed their turn or not
    global player1_pass
    global player2_pass
    ## Integer value reflecting the score of a player
    global o_points
    global x_points

    ## Creates a blank game state - a blank board
    gsc = initalize()
    gsf = initalize()
    ## Sets initial values
    o_groups = []
    x_groups = []
    non_groups = []
    gscache = ''
    player1_pass = 0
    player2_pass = 0
    gameover = 0
    o_points = 0
    x_points = 0

    ## Gives players turns until the end of the game
    ## (that is, until both players pass, one after
    ## the other)
    while gameover != 1:

        ## Set it as o-player's turn
        xoro = 'o'
        notxoro = 'x'
        print()
        printboard(gsc)

        turn()
        if gameover == 1:
            break

        ## Sets it as x-player's turn
        xoro = 'x'
        notxoro = 'o'
        print()
        printboard(gsc)

        turn()

    ## Counts the score of both players
    count()
    print()
    print('final board:')
    print()
    printboard(gsc)
    print()
    print('o points: ',str(o_points))
    print('x points: ',str(x_points))
    ## Determines the winner
    if o_points &gt; x_points:
        print('o wins')
    elif x_points &gt; o_points:
        print('x wins')
    else:
        print('tie')

## Finally something that is not a function!
## This while loop will start new games for as
## long as the user choses to.
while gameon == 1:
    main()
    hold = 1
    while hold == 1:
        yn = raw_input('play again (y/n)? ')
        if yn == 'n':
            gameon = 0
            hold = 0
        elif yn == 'y':
            hold = 0
        else:
            print('invalid')
</pre>
<img src="http://feeds.feedburner.com/~r/Codercastecom/~4/u2MQUIvBox0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codercaste.com/2013/02/read-set-go-how-to-create-a-go-board-game-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codercaste.com/2013/02/read-set-go-how-to-create-a-go-board-game-in-python/</feedburner:origLink></item>
	</channel>
</rss>
