Weak points…. or are they?

Before we jump into the programming itself, let us learn some of the so-called weak points that you might be able to consider and improve on ( or even share) with others out there to make the platform a better one.
First is speed, the information that I might have come upon may be a bit outdated but it still shows a significant disadvantage when it comes to speed of processing as compared to other more stable platforms. The use of green threads is also subject to criticism by many making it very difficult or unstable in certain user-case scenarios. Unicode or multi-byte string support is not yet native and the use of global variables is the biggest pitfall so far known. This trait unfortunately allows global variables to be modified from anywhere and we mean anywhere. Ruby also lacks a well-defined specification with it being referred to as an implementation of C. Most of these issues have been thought of and are to be addressed in the coming release of the newest versions of the programming language.

Posted in Development, Internet, Programming Language | Tagged , , | Comments closed

Different Block Forms

Blocks or simply chunks of code as in the last example may be existing variables which changes after that same variable passes thought the block, giving it a new value. Blocks may also be used to return a needed value to the method as in the last example, the resulting value of the last expression the data was exposed to was returned back to the method as the pre-set value of the yield statement till the condition which was the set maximum value of the Fibonacci Series that was set to 1000. This is why the find method which is used for array class objects work. The method find is actually defined in the enumerable module thrown into the array class mix. The Next Post, shows a sample code using the find method.

Sample Code using find :

class Array
def find
for a in 0…size
value = himself[a]
return value in yield(value)
end
return nil
end
end
[1, 3, 5, 7, 9].find {|v| v*v >30}

The code has elements passed successively to the attached block which returns true if the method sends in a corresponding element. If none match, then nil is returned which is a very good example of how to best utilize iterators. The Array class is simply doing what it was designed to which is to access the contents of an array leaving the application to do what it is supposed to do which in this case is to find entries that satisfies a set criteria.

Posted in Development, Programming Basics | Tagged , | Comments closed

Blocks for Transactions Discussed (Part 2)

After it goes through the block, the file is closed taking with it the results of the block’s transactional process. This is something that should be done with all programming languages, to have the code have their own built-in file handling system which ensures that a file once opened is closed upon exit to avoid destroying the contents of that file. This shows the two forms the File.open method’s behavior can be called upon, that if it is called with a block it does what it has to and then automatically closes the file. Called on without the block and it returns the file object.

Posted in Development, Programming Basics | Tagged , | Comments closed

Blocks for Transactions Discussed (Part 1)

The sample code above shows the number of techniques that can be used to maximize the use of blocks for transactional control where the takeAndDosomething method is considered a class method and that it can be called independent or without influence of any single File Object. We used it to function in the same manner as the File.open method without consideration of any arguments. We called the File.open method, passed onto it the transaction or condition which was defined in the *args as a parameter. Shortening it all, the “openAndDosomething” transparently passes whatever conditions or parameters it gets towards the File.open method. Once the file ios open and the “openAndDosomething” calls on the yield statement passing the opened file to the block/chunk of code.

Posted in Development, Programming Basics, Programming Language | Tagged , | Comments closed

Integers and Iterators

There are a variety iterators that are useful with Ruby such as we’ve already seen in previous samples of code, such as n.times. Others are n.upto and n.downto for going up or down a series of integers and the step, which is more like the traditional loop statement. Their usage would be somewhat like:

3.times {print”X “}
1.upto(3) {[i] print i, ” ” }
99.downto(96) {[i] print i, ” ” }
50.step(70, 5) {[i] print i, ” ” }

Giving you the following results:
X X X 1 2 3 99 98 97 96 50 55 60 65 70

Posted in Development, Programming Basics | Tagged , | Comments closed

Ruby Data Types

We have looked into many of the data structures that are supported by ruby along with brief examples of their use and structures. Now we turn to the different data types the language supports which is vital in maximizing the potential of Ruby. Numbers are classified into integers and floating point numbers. The handling capabilities of Ruby when it comes to integers is dependent on the amount of memory you have installed on your computer. They are also classified into two object classes stored in either the Fixnum or Bignum classes. Ruby handles conversion to and from these two types automatically and stores them in binary form in their respective classes. Integers can also be used with optional lead signs that denote octal, hex, or binary.
Integer values can also be translated into their ASCII character set equivalents with the use of a ? before the variable. The term numeric literal that is denoted by an exponent or a decimal point is converted into a Float object in correspondence to the native language’s double data type. To obtain the absolute value of an integer you use the form aNumber.abs and not abs(aNumber) as with C and C++.

Posted in Development, Programming Basics | Tagged , , | Comments closed

Ruby on Rails Programming With Passion

2.JPGFor all the good reasons, Ruby on Rails is fast becoming popular with developers and Web applications deployers. Rails is a Web application structure based on a number of advance philosophies like Convention Over configuration and Don’t Repeat Yourself. On the other hand, the JRuby on Rails presents additional benefit by allowing them to influence the immovability and the consistency of the Java platform. In lieu with this, Sang Shin is offering an online course about Ruby and JRuby which will start on July 15, 2008. Those who will attend this course will not do a real-time webcasting but definitely upon completion of the course, they will acquire all the necessary knowledge they could use to be able to write realistically refined Rails application.

Posted in Development, General Info | Comments closed

The Ruby on Rails Package

1.JPGRails is a jam-packed pile skeleton for mounting web applications that are supported by a database. The developing should be in accordance with the Model-View-Control pattern. Rails is capable of providing a pure-Ruby development surrounding that include the domain model covering the database, the response based on the request sent to the controller and the Ajax in the view. To go online, you just have to add a database and a web server. Practically everyone is already on Rails, which include enterprise organizations, non-profits and even those organizations that are just starting are also inclined to using Rails. Since Rails is all about transportation and communication, it is perfectly compatible to any type of web application.

Posted in General Info | Comments closed

Ruby Loosing Steam to Java

javaThe complexities of Rails compared to other development platforms for your web applications is compared to be the main detractor of the overall status of Rails, unable to progress into a more preferred language. Rails on the code side can be compared to COBOL and C++ that used to be done with millions of lines of code til the advent of GUI-based development that allowed components to be embedded and laid out, the screen or page already laid-out and then is filled an customized by filling in the parameters and othe nuances that would make the application run. Read More »

Posted in Development, General Info | Comments closed

Engine Yard takes Over Old Ruby

engineyardOlder versions of Ruby and Ruby on rails have been wondering what would happen to them as newer and improved versions and flavors of the much loved yet less used open-source platform, and they got an answer form Engine Yard who has announced it will be taking over the responsibilities of maintaining the older release of the said platform. The company would take over bug-handling duties as well as the need for security issues that have to be addressed. they would also be keeping tabs on the speed of the Ruby interpreter and may even improve on it as needed to allow developed products to continue function in today’s PH ruled internet. More preferred by business oriented users and developers due to stronger security and other features, it has been left in the dust by the widely used PHP language. Read More »

Posted in Development, General Info, Programming Language | Comments closed