<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zainal Mustofa on Medium]]></title>
        <description><![CDATA[Stories by Zainal Mustofa on Medium]]></description>
        <link>https://medium.com/@zainalmustofa?source=rss-195a2dd5cfb2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*73Kpxkj2XMTYeXG4LwBqlQ.jpeg</url>
            <title>Stories by Zainal Mustofa on Medium</title>
            <link>https://medium.com/@zainalmustofa?source=rss-195a2dd5cfb2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 20:16:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zainalmustofa/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Rails routes]]></title>
            <link>https://medium.com/@zainalmustofa/rails-routes-8a2ac68b81c6?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a2ac68b81c6</guid>
            <category><![CDATA[rails-routing]]></category>
            <category><![CDATA[route]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Fri, 05 Jul 2019 13:41:07 GMT</pubDate>
            <atom:updated>2019-07-05T13:41:07.290Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CEOXvKpH3p0oGxT_" /><figcaption>Photo by <a href="https://unsplash.com/@foxfox?utm_source=medium&amp;utm_medium=referral">Natalia Y</a></figcaption></figure><h3>How route in MVC work?</h3><p>Route is part of the <a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">controller</a>, the main gate requests entry. Route defines the URL pattern and handler information. All the configured routes of an application stored in Route and will be used by Routing engine to determine appropriate handler class or file for an incoming request.</p><p>The following figure illustrates the Routing process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*Ax4-GGDJ_vN04OzTa8K7Gw.png" /><figcaption><a href="https://www.tutorialsteacher.com/Content/images/mvc/routing-process.png">https://www.tutorialsteacher.com/Content/images/mvc/routing-process.png</a></figcaption></figure><h3>How routes rails work?</h3><p>Before we know routes at rails , better we know how controller handle the routes at rails. As i told you before routes it part C in <a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">MVC</a>, after the router has determined which controller to use for a request, the controller have a responsibility for making understand from the request, and will and producing the appropriate output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*q-nIkB0xzuIb9hBRiNbscA.png" /><figcaption><a href="https://www.freecodecamp.org/news/understanding-the-basics-of-ruby-on-rails-http-mvc-and-routes-359b8d809c7a/">https://www.freecodecamp.org/news/understanding-the-basics-of-ruby-on-rails-http-mvc-and-routes-359b8d809c7a/</a></figcaption></figure><p>At Ruby On Rails controller we use <a href="https://api.rubyonrails.org/classes/ActionController/Base.html">ActionController</a>, Action Controllers are the core of a web request in Rails. Action Controllers are made at least one action that are executed on request and then either it renders a template or redirects to another action. An action is defined as a public method on the controller which will automatically be made accessible to the web-server through Rails Routes. By default, only the ApplicationController in a Rails application inherits from ActionController::Base. All other controllers inherit from ApplicationController. This gives you one class to configure things such as request forgery protection and filtering of sensitive request parameters.</p><pre><strong>class PostsController &lt; ApplicationController</strong><br>  <strong>def</strong> <strong>index</strong><br>    @posts = Post.all<br>  <strong>end</strong></pre><pre>  <strong>def</strong> <strong>create</strong><br>    @post = Post.create params[:post]<br>    redirect_to posts_path<br>  <strong>end</strong></pre><pre>  <strong>def</strong> <strong>show</strong><br>    @post = Post.find params[:post]<br>  <strong>end</strong><br><strong>end</strong></pre><p>By default, actions will render a template in the app/views directory, after executing code in action, the action will find file by same name of the controller and action. For exampple, show action of the PostsController will render the template app/views/posts/show.html.erb by default after find record by params[:post] and store to instance variable @post</p><p>Unlike show, the create action will not render a template. After performing its main purpose (creating a new post), it initiates a redirect instead. This redirect works by returning an external 302 Moved HTTP response that takes the user to the index action.</p><h3>Various types of routes</h3><p>At this time, i will try to explain types of routes, not all types will explain here, only that I often use here, because rails have many types routes, here you go:</p><ol><li><strong>resources</strong></li></ol><p>Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. Instead of declaring separate routes for your index, show, new, edit, create, updateand destroy actions, a resourceful route declares them in a single line of code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9576e260557156bd683034d8a921c0f4/href">https://medium.com/media/9576e260557156bd683034d8a921c0f4/href</a></iframe><p>when you type rake routes you can see all actions index, show, new, edit, create, updateand destroy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-dZJl-8yRofUzg3D8p_9Cw.png" /></figure><p>2. <strong>resource</strong> <br><strong>resource </strong>is like<strong> resources </strong>but have little different, Sometimes, you have a resource that clients always look up without referencing an ID. For example, you would like /profile to always show the profile of the currently logged in user. In this case, you can use a singular resource to map /profile (rather than /profile/:id) to the show action:Sometimes, you have a resource that clients always look up without referencing an ID. For example, you would like /profile to always show the profile of the currently logged in user. In this case, you can use a singular resource to map /profile (rather than /profile/:id) to the show action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ChslhCxo4CfyiFUOFnBPmA.png" /></figure><p>3.<strong> Namespaces</strong></p><p>We can organize groups of controllers under a namespace with a keyword “namespace” during routing. Most commonly, you might group a number of API controllers under an Api:: namespace. You would place these controllers under the app/controllers/api directory, and you can group them together in your router:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cff6f3357515ad69c8382dd955d79edc/href">https://medium.com/media/cff6f3357515ad69c8382dd955d79edc/href</a></iframe><p>To get to the articles on your browser you have to prefix it with api , that is</p><pre>/api/articles</pre><p>4. <strong>Member and collection</strong></p><p>You are not limited to the seven routes that RESTful routing creates by default. If you like, you may add additional routes that apply to the collection or individual members of the collection. Member and collection can be placed inside or outside the block</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9cea90f124dd6488dafda7c36b2d66b3/href">https://medium.com/media/9cea90f124dd6488dafda7c36b2d66b3/href</a></iframe><p>This will recognize /photos/1/preview with GET, and route to the preview action of PhotosController, with the resource id value passed in params[:id]</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7d5efb93619035df418cc083f54510f/href">https://medium.com/media/e7d5efb93619035df418cc083f54510f/href</a></iframe><p>This will enable Rails to recognize paths such as /photos/search with GET, and route to the search action of PhotosController. It will also create the search_photos_url and search_photos_path route helpers.</p><h3>Conclusion</h3><p>By default rails by default used RESTful design, as a rails developer RESTful design is powerful and easy to used, for use RESTful at rails, just by using resources keyword followed by the controller name in the the routes.rb , <br>I hope this helped make rails routes syntax a bit clearer.</p><blockquote><strong>references:<br></strong><a href="https://guides.rubyonrails.org/routing.html">https://guides.rubyonrails.org/routing.html</a><br><a href="https://www.sitepoint.com/an-in-depth-look-at-basic-rails-routing/">https://www.sitepoint.com/an-in-depth-look-at-basic-rails-routing/</a><br><a href="https://www.freecodecamp.org/news/understanding-the-basics-of-ruby-on-rails-http-mvc-and-routes-359b8d809c7a/">https://www.freecodecamp.org/news/understanding-the-basics-of-ruby-on-rails-http-mvc-and-routes-359b8d809c7a/</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a2ac68b81c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Grape API Routing]]></title>
            <link>https://medium.com/@zainalmustofa/grape-api-routing-39c8acc03f37?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/39c8acc03f37</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[grapes]]></category>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Fri, 05 Jul 2019 13:39:35 GMT</pubDate>
            <atom:updated>2019-07-05T13:39:35.254Z</atom:updated>
            <content:encoded><![CDATA[<p>Create API using Grape is new for me, usually i create API with <a href="https://github.com/rails/jbuilder">jbuilder</a> or <a href="https://edgeguides.rubyonrails.org/api_app.html">Rails API Skeleton</a>. Before we start, i’m so sorry if my grammar and my explanation is bad. Because it’s my first explanation, and usually i create API with <a href="https://github.com/rails/jbuilder">jbuilder</a>, but i will try to the best to explain how to compare routing rails with Grape API.</p><h4>What is Grape</h4><p>Grape is a REST-like API framework for Ruby. It’s designed to run on Rack or complement existing web application frameworks such as Rails and Sinatra by providing a simple DSL to easily develop RESTful APIs. It has built-in support for common conventions, including multiple formats, subdomain/prefix restriction, content negotiation, versioning and<a href="https://github.com/ruby-grape/grape#what-is-grape"> much more.</a></p><h4>Routing Grape API</h4><p>Routing Grape API have some different with Rails application, this is the difference:</p><ul><li>Grape API is different engine and run on <a href="http://rack.github.io/">Rack</a></li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5e31c0c094b6df75e9a8845f50a4164/href">https://medium.com/media/b5e31c0c094b6df75e9a8845f50a4164/href</a></iframe><p>Grape API need include mount at routes.rb if you want run at ruby on rails application.</p><ul><li>Routing is written in the module file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2lW2wK45tRlEwoWnw2rmUg.png" /><figcaption>routing grape api</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*TzlMjovKS8W6excvW99bEg.png" /><figcaption>rails app route</figcaption></figure><p>if you take a look code above, you can see a some different how implement rails routes and route grape work, grape need defined a route on same module file, on grape api i’m define a routes at this file app/api/v1/user.rb if run a server and go to this URL <a href="http://localhost:3000/api/v1/users">http://localhost:3000/api/v1/users</a> this will have a result like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CREP1pwfEsZQ-d-vXGXmaw.png" /></figure><p>well, grape routing working like rails app, same concept use MVC. I mean when request come, it will go to routes rails first, and Rack will check if the url have prefix “api” and will process to grape API engine, Grape API will find a base URL and will mount the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yq7X4er9lhmh9Dnx2qMdag.png" /></figure><p>Implementation routing at grape API same like implement route at sinatra freamwork, all route is define at same module and if path (“/”) is true, the routes will give output that has been specified.</p><p><a href="https://github.com/sinatra/sinatra/blob/master/examples/simple.rb">sinatra/sinatra</a></p><ul><li>has the same properties as routes on rails</li></ul><p>In Grape API we also can use resource , namespace</p><h3>How compare rails and grape route?</h3><p>You can compare rails and grape route with this way:</p><ul><li>rails framework routing use routes.rb, and will process to controllers, and will processing the request</li><li>grape API routing use mount at routes.rb, when request come, the request will go to routes rails app, and forwarded to grape api module, and after processing at module finish the request will have a some output.</li></ul><h3>Conclusion</h3><p>Grape endpoints (classes inheriting from Grape::API) are basically equivalent to Rails controllers. As such, they can contain many unrelated methods (index/show/delete/create). And in my opinion Grape is very suitable for microservice method.</p><blockquote><strong>references</strong>:<br><a href="https://www.thegreatcodeadventure.com/making-a-rails-api-with-grap/">https://www.thegreatcodeadventure.com/making-a-rails-api-with-grap/</a><br><a href="https://github.com/ruby-grape/grape#routes">https://github.com/ruby-grape/grape#routes</a><br><a href="http://tamaloa.github.io/2016/12/05/using-grape-to-add-an-api-to-a-brownfield-rails-project">http://tamaloa.github.io/2016/12/05/using-grape-to-add-an-api-to-a-brownfield-rails-project</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39c8acc03f37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meteor started]]></title>
            <link>https://medium.com/@zainalmustofa/meteor-started-a72db90505e?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a72db90505e</guid>
            <category><![CDATA[meteor]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Wed, 04 Nov 2015 07:14:14 GMT</pubDate>
            <atom:updated>2015-11-04T07:14:34.263Z</atom:updated>
            <content:encoded><![CDATA[<p>For Developer Ruby On Rails i think we must learn meteor, why? I have interest article on <a href="http://blog.differential.com/meteor-killin-rails/">here</a> (Meteor Kill in Rails), just as a precaution if it could possibly :D</p><p>Oke now We must install meteor :</p><p>A. For OS X or Linux</p><pre>curl <a href="https://install.meteor.com/">https://install.meteor.com/</a> | sh</pre><p>B. For Windows</p><pre><a href="https://install.meteor.com/windows">https://install.meteor.com/windows</a></pre><h4>Creating first app</h4><p>In this Totorial we will create a simple app to manage a todo list</p><pre>meteor create simple-todos</pre><p>This will create a new folder called `simple-todos` with all of the files a Meteor app needs:</p><pre>simple-todos.js      <em># a JavaScript file loaded on both client and server</em> simple-todos.html <em># an HTML file that defines view templates</em> simple-todos.css   <em># a CSS file to define your app’s styles</em> <br>.meteor            <em># internal Meteor files</em></pre><p>Don’t forget run <strong>meteor </strong>on terminal and go to <a href="http://localhost:3000/"><em>http://localhost:3000</em></a></p><p>Replace on <em>simple-todos.html</em></p><pre>&lt;head&gt;</pre><pre>&lt;title&gt;Todo List&lt;/title&gt;</pre><pre>&lt;/head&gt;</pre><pre>&lt;body&gt;</pre><pre>&lt;div class=&quot;container&quot;&gt;</pre><pre>&lt;header&gt;</pre><pre>&lt;h1&gt;Todo List&lt;/h1&gt;</pre><pre>&lt;/header&gt;</pre><pre>&lt;ul&gt;</pre><pre>{{#each tasks}}</pre><pre>{{&gt; task}}</pre><pre>{{/each}}</pre><pre>&lt;/ul&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;/body&gt;</pre><pre>&lt;template name=&quot;task&quot;&gt;</pre><pre>&lt;li&gt;{{text}}&lt;/li&gt;</pre><pre>&lt;/template&gt;</pre><p>Replace on <em>simple-todos.js</em></p><pre><strong>if</strong> (Meteor.isClient) {</pre><pre><em>// This code only runs on the client</em></pre><pre>Template.body.helpers({</pre><pre>tasks: [</pre><pre>{ text: &quot;This is task one&quot; },</pre><pre>{ text: &quot;This is task two&quot; },</pre><pre>{ text: &quot;This is task three&quot; }</pre><pre>]</pre><pre>});</pre><pre>}</pre><p>Open a browser and go to <a href="http://localhost:3000/">http://localhost:3000</a> the view will be look like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/162/1*jxq9zncgvJkm62HLdbLnwQ.png" /><figcaption>Todo List</figcaption></figure><h4>conclusion</h4><p>Meteor parses all of the HTML files in your app folder and identifies three top-level tags: &lt;<strong>head</strong>&gt;, &lt;<strong>body</strong>&gt;, and &lt;<strong>template</strong>&gt;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*kSY_sfNk__YTNQBQMlpjWw.png" /><figcaption>head</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*4yVwhYgjGiuOXKiRbw_vcA.png" /><figcaption>body</figcaption></figure><p>Everything inside any &lt;<strong>head</strong>&gt; tags is added to the head section of the HTML sent to the client.</p><p>And everything inside &lt;<strong>body</strong>&gt; tags is added to the body section, just like in a regular HTML file.</p><p>If you see on &lt;ul&gt; <em>tags meteor </em>use<em> </em>spacebars compiler<em>. </em>Spacebars uses statements surrounded by double curly braces such as <em>{{#</em><strong><em>each</em></strong><em>}}</em> and <em>{{#</em><strong><em>if</em></strong><em>}}</em> to let you add logic and data to your views. You can pass data into templates from your JavaScript code by defining <em>helpers</em>. In the code above, we defined a helper called <em>tasks</em> on <em>Template.body</em> that returns an array. Inside the body tag of the HTML, we can use <em>{{#</em><strong><em>each tasks</em></strong><em>}}</em> to iterate over the array and insert a task template for each value. Inside the #<strong><em>each</em></strong> block, we can display the <strong><em>text</em></strong> property of each array item using <em>{{</em><strong><em>text</em></strong><em>}}</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/1*u920BRrnQlZebOA_LFkrYA.png" /><figcaption>template</figcaption></figure><p>Everything inside &lt;<strong>template</strong>&gt; tags is compiled into Meteor <em>templates</em>, which can be included inside HTML with {{&gt; <strong><em>templateName</em></strong>}} or referenced in your JavaScript with <strong><em>Template.templateName </em></strong><em>.</em></p><p>You can following tutorial on <a href="https://www.meteor.com/tutorials/blaze/creating-an-app">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a72db90505e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic OF JavaScript extended]]></title>
            <link>https://medium.com/@zainalmustofa/basic-of-javascript-extended-1f344c98cb28?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f344c98cb28</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Tue, 03 Nov 2015 08:41:07 GMT</pubDate>
            <atom:updated>2015-11-03T08:41:07.513Z</atom:updated>
            <content:encoded><![CDATA[<p>Now I will explain about <strong>Loop</strong> on JavaScript, on programming we need loop because if we no use them we very tired, why?<br>yeaahh if you want to check or you want to repeat something you must create many code. But on programming we can use technic Loop..</p><p><em>Example</em></p><blockquote>var num = 10;</blockquote><blockquote>while (num &gt; 0) { console.log(num); num — ;<br>}</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*QVQtY-iy_2M9_Pcu7KW9PA.png" /><figcaption>result print on logs 1..10</figcaption></figure><h4><strong>More about loop</strong></h4><blockquote>Noted: While loop only runs code as long as it’s boolean expression is true</blockquote><pre>while(*some expression is true*){</pre><pre>    *do this code!*<br>}</pre><p>Example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*InBH8NcK8qvu3qhL8adF4w.png" /><figcaption>Let’s make a loop that prints the numbers 1–5 in ascending order.</figcaption></figure><p>Understanding LOOPS</p><p><em>Since we know variables can be changed, let’s make one that will count our number:</em></p><pre>var number = 1;</pre><p><em>initially, we set the number to 1 for the first number</em></p><p><em>We want to execute the following code for every running number:</em></p><pre>console.log(number)</pre><p><em>Then, we need a way to make our number counter increase on every repetition:</em></p><pre>number++;</pre><p><em>Increment number will move forward to the next number.</em></p><h3>FOR-LOOP</h3><pre>for ( *start with this(<strong>A</strong>)*; *loop if this expression is true(<strong>B</strong>)*; *do this after each loop(<strong>C</strong>)*) {</pre><pre>   *in each loop, do this code!* <br>}</pre><p>explanation :</p><ol><li>We typically use this spot for initializaion</li><li>This is just like the condition that the while-loop checks before looping</li><li>This is usually the ++ or — — (min and min)statement that controls the loop.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vt83i7Hnmo5O7URCOc_N5Q.png" /><figcaption>Visualizing the flow of our for-loop</figcaption></figure><p>source : <a href="http://odeschool.com/">codeschool</a></p><p>while (num &gt; 0) { console.log(num); num — ;<br>}</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f344c98cb28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic OF JavaScript]]></title>
            <link>https://medium.com/@zainalmustofa/basic-of-javascript-e832a4bdbebf?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e832a4bdbebf</guid>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Tue, 03 Nov 2015 06:09:11 GMT</pubDate>
            <atom:updated>2015-11-03T06:09:11.619Z</atom:updated>
            <content:encoded><![CDATA[<p>One think before we learn of JavaScript we must know about our weapons, yes weapons because it is like we were at war :D</p><p>We need :</p><ol><li>Web Browser, like Google Chrome, Mozilla Firefox, Safari, Opera and anymore</li><li>Or you can use with online editor, i recommend <a href="http://jsfiddle.net/">jsfiddle</a></li></ol><h3>Part 1 Variable</h3><p>Variables are used to store data.<br>Here is the syntax for declaring a variable:</p><pre>var nameVariable = &quot;nameVariable&quot;;</pre><h3>Part 2 <strong>Data Type</strong></h3><p>JavaScript have many data type, such as:</p><ol><li>String</li><li>Number</li><li>Boolean</li><li>Array</li><li>Object</li><li>Function</li><li>Undefined</li><li>Null</li></ol><h3>String</h3><p>String is the data type used to represent words or sentences.</p><p>E.g</p><pre>var name = &quot;Zainal Mustofa&quot;;</pre><h3>Number</h3><p>Number is the type of data used to represent numbers, either integer, real, exponential and others.</p><p>E.g</p><pre>var age = 22;<br>var weight = 50.12;</pre><h3>Boolean</h3><p>Boolean is the type of data used to say yes or no, true or false.</p><p>E.g</p><pre>var started = TRUE;<br>var rollback = FALSE;</pre><h3>Function</h3><p>DRY ( D<em>on’t Repeat Your self </em>)Function is cut pieces of code instructions that can be invoked repeatedly.</p><p>E.g</p><pre>var thisOdd = function(value){<br>        return value % 2 == 0;<br>    };</pre><h3>Array</h3><p>An array is a data type such as a container to hold one or more data. Arrays can accommodate all types of data contained in javascript.</p><p>E.g</p><pre>var days = [&quot;Moday&quot;,&quot;Tuesday&quot;,&quot;Sapturday&quot;,&quot;Moday&quot;];<br>var value = [5,7,8,2.4,4.5,10];<br>var mix = [<br>        &quot;gfyty$^%&quot;,<br>        12.3,<br>        NULL,<br>        TRUE,<br>        FALSE,<br>        [&quot;a&quot;,&quot;b&quot;,&quot;C&quot;]<br>    ];</pre><h3>Object</h3><p>Object almost similar to Array. The difference is, each data element that is accommodated in it has a name or a “key”.</p><p>E.g</p><pre>var person = {<br>    name : &quot;zainal&quot;,<br>    age : 17,<br>    &quot;weight&quot; : 60.4,<br>    &quot;status&quot; : TRUE,<br>    &quot;child&quot;: NULL<br>  };</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e832a4bdbebf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Naming Convervasion Rails]]></title>
            <link>https://medium.com/@zainalmustofa/naming-convervasion-rails-fbc6d48d8396?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbc6d48d8396</guid>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Mon, 22 Dec 2014 06:28:54 GMT</pubDate>
            <atom:updated>2014-12-22T06:28:54.229Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Model Naming Convention</em></p><p>Table: orders<br>Class: Order<br>File: /app/models/order.rb<br>Primary Key: id<br>Foreign Key: customer_id<br>Link Tables: items_orders</p><p><em>Controller Naming Convention</em></p><p>Class: OrdersController<br>File: /app/controllers/orders_controller.rb<br>Layout: /app/layouts/orders.html.erb</p><p><em>View Naming Convention</em></p><p>Helper: /app/helpers/orders_helper.rb<br>Helper Module: OrdersHelper<br>Views: /app/views/orders/… (list.html.erb for example)</p><p><em>Tests Naming Convention</em></p><p>Unit: /test/unit/order_test.rb<br>Functional: /test/functional/orders_controller_test.rb<br>Fixtures: /test/fixtures/orders.yml</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbc6d48d8396" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ruby basic]]></title>
            <link>https://medium.com/@zainalmustofa/ruby-basic-47611d71d8c4?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/47611d71d8c4</guid>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Thu, 11 Dec 2014 07:31:44 GMT</pubDate>
            <atom:updated>2014-12-11T07:31:44.263Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>The variable naming ruby class and method</strong></h4><blockquote>Local Variable: name fish_and_chips x_axis thx1138 _x _26<br>Instance Variable: @name @point_1 @X @_ @plan9<br>Class Variable: @@total @@symtab @@N @@x_pos @@SINGLE<br>Global Variable: $debug $CUSTOMER $_ $plan9 $Global<br>Class Name: String ActiveRecord MyClass<br>Constant Name:FEET_PER_MILE DEBUG</blockquote><h4>Array and Hash</h4><p>Array and Hash are order with indexed collections, accessing using key in array with integer for key, and hash provide more flexibility for key.</p><blockquote>create array</blockquote><blockquote>a = [1,2,3,4] =&gt;# [1,2,3,4]</blockquote><blockquote>b = [‘a’,’b’,’c’]=&gt;#[‘a’,’b’,’c’]</blockquote><blockquote>ary = Array.new <strong>#=&gt; []</strong><br>Array.new(3) <strong>#=&gt; [nil, nil, nil]</strong><br>Array.new(3, true) <strong>#=&gt; [true, true, true]</strong></blockquote><blockquote>Sometimes creating arrays of words can be a pain, what with all the quotes and commas. we can use %w for shortcut in ruby, that:</blockquote><blockquote>a = [ ‘ant’, ‘bee’, ‘cat’, ‘dog’, ‘elk’ ]<br>a[0] # =&gt; “ant”<br>a[3] # =&gt; “dog”</blockquote><blockquote># this is the same:<br>a = <strong>%w</strong>{ ant bee cat dog elk }<br>a[0] # =&gt; “ant”<br>a[3] # =&gt; “dog”</blockquote><blockquote><strong>Hash </strong>A <a href="http://www.ruby-doc.org/core-2.1.5/Hash.html">Hash</a> is a dictionary-like collection of unique keys and their values. Also called associative arrays, they are similar to Arrays, but where an <a href="http://www.ruby-doc.org/core-2.1.5/Array.html">Array</a> uses integers as its index, a <a href="http://www.ruby-doc.org/core-2.1.5/Hash.html">Hash</a> allows you to use any object type.</blockquote><blockquote>make a hash:</blockquote><blockquote>inst_section = {<br>‘cello’ =&gt; ‘string’,<br>‘clarinet’ =&gt; ‘woodwind’,<br>‘drum’ =&gt; ‘percussion’,<br>‘oboe’ =&gt; ‘woodwind’,<br>‘trumpet’ =&gt; ‘brass’,<br>‘violin’ =&gt; ‘string’<br>}</blockquote><blockquote>inst_section = {<br>:cello =&gt; ‘string’,<br>:clarinet =&gt; ‘woodwind’,<br>:drum =&gt; ‘percussion’,<br>:oboe =&gt; ‘woodwind’,<br>:trumpet =&gt; ‘brass’,<br>:violin =&gt; ‘string’<br>}</blockquote><blockquote>inst_section = {<br>cello: ‘string’,<br>clarinet: ‘woodwind’,<br>drum: ‘percussion’,<br>oboe: ‘woodwind’,<br>trumpet: ‘brass’,<br>violin: ‘string’<br>}</blockquote><h4>Class, Objects, and Variables</h4><blockquote>Classes in Object Oriented basic structure in which there is a method in the class attributes and methods of the base class objects</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*a3XXEFEHJZ3ae8t9KgNS4Q.png" /></figure><p>inherited (subclass)</p><p>Callback invoked whenever a subclass of the current class is created.</p><pre>class Foo<br> def self.inherited(subclass)<br> puts &quot;New subclass: #{subclass}&quot;<br> end<br>end<br><br>class Bar &lt; Foo<br>end<br><br>class Baz &lt; Bar<br>end</pre><p>result:</p><pre>New subclass: Bar<br>New subclass: Baz</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47611d71d8c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install PHP and MySQL at Ubuntu 14.04]]></title>
            <link>https://medium.com/@zainalmustofa/install-php-and-mysql-at-ubuntu-14-04-5811323585b5?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5811323585b5</guid>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Mon, 20 Oct 2014 04:45:13 GMT</pubDate>
            <atom:updated>2014-10-20T04:45:13.663Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*4-OUIxOkzGOGJJji8gA7yg.jpeg" /></figure><p>Tulisan ini hanya sebagai catatan saya saja, karena masih awam dan mengalami kebingungan saat migrasi dari pengguna windows ke ubuntu ☹. memang sangat membingunkan pada awalnya, tetapi dengan semakin majunya jaman, apapun yang kita cari bisa kita temukan di google.</p><p>saya mengikuti alur kerja dari <a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04">digitalocean</a>,</p><p>a. Install Apache</p><pre>sudo apt-get update<br>sudo apt-get install apache2</pre><p>kamu akan melihat tampilan default dari apache2 dengan alamat <a href="http://localhost/">localhost</a></p><p>b. Install MySQL</p><blockquote>sudo apt-get install mysql-server php5-mysql</blockquote><p>pastikan anda masuk dalam mode “root”</p><pre>sudo mysql_install_db</pre><pre>sudo mysql_secure_installation</pre><p>c. Install PHP</p><pre>sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt</pre><p>masuk ke dif.conf</p><pre>sudo nano /etc/apache2/mods-enabled/dir.conf</pre><p>lalu akan ada code seperti ini</p><pre>&lt;IfModule mod_dir.c&gt;<br> DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm<br>&lt;/IfModule&gt;</pre><p>rubah menjadi</p><pre>&lt;IfModule mod_dir.c&gt;<br> DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm<br>&lt;/IfModule&gt;</pre><p>save dengan cara “CTRL+X” lalu “Y” lalu setelah itu tinggal restart saja apchenya dengan cara</p><blockquote>sudo service apache2 restart</blockquote><p>sekarang bisa di buka <a href="http://localhost/">localhost</a> nya dan …. anda telah berhasil untuk menginstall apche2 di ubuntu kalian</p><p>d. Test Web server</p><p>untuk membuktikan apakah webserver berjalan dengan baik atau tidak cukup dengan meng <em>copy </em>dan<em> paste </em>kan phpinfo()saja via nano ubuntu.</p><pre>sudo nano /var/www/html/info.php</pre><pre>Copy code di bawah ini</pre><pre>&lt;?php<br>phpinfo();<br>?&gt;</pre><p>lalu buka <a href="http://localhost/info.php">localhost</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5811323585b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Ruby]]></title>
            <link>https://medium.com/@zainalmustofa/learning-ruby-142b9b26f816?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/142b9b26f816</guid>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Sun, 19 Oct 2014 13:20:17 GMT</pubDate>
            <atom:updated>2014-10-19T13:20:17.935Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/50/1*nAoHm913AdfnKb2VaCPRUw.png" /></figure><p>test</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=142b9b26f816" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[spirit]]></title>
            <link>https://medium.com/@zainalmustofa/spirit-59248cc3ce8f?source=rss-195a2dd5cfb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/59248cc3ce8f</guid>
            <dc:creator><![CDATA[Zainal Mustofa]]></dc:creator>
            <pubDate>Wed, 30 Oct 2013 06:52:10 GMT</pubDate>
            <atom:updated>2013-10-30T06:52:10.094Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*iAHDHXCs6KUz-S1PFQPaiA.gif" /></figure><h4>indonesia</h4><p>Trying new things will be more wonderful if at the start by the motivation and spirit of the passionate</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59248cc3ce8f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>