Ruby Introduction
This introduction is not recommended to be read by you, you're derived from economics, law, politics, agriculture, forestry, design, civil engineering, public relations, religion, psychology, medicine, let alone literary, and others of his friends . It is recommended to be read by the children FASILKOM and his friends. This is because the content contained on this introduction very many shows FASILKOM terms once, and could understand only in, and can be described, by those who has an associate with the monitor for at least 1 semester fervently.
The meaning of Ruby in his dictionary Microsoft ® Encarta:
1. Gemstone red: a red precious stone that is a form of corundum. Use: jewelry, manufacture of watches, precision instruments.
2. deep red: Purplish glowing a deep red color like that of a ruby
So Ruby literally, etymologically, or whatever, means a red precious stones, precious jewels, shining rays.
So the importance of what I describe here about Ruby? precious stones like sales? (up important not important)
Ruby is a programming language that is quite popular in Japan today. Are also people who make gitu loh Japan. Yukihiro Matsumoto, a.k.a. "Matz''(It's time for Asian people to conquer the world!). Ruby is a scripting language (like shell scripts, perl, python), but also a real programming language and Object Oriented once powerful and elegant syntax for writing highly. (im not pretend to compare them). (Btw do the same this precious red stone hell?)
Ruby is a short history began when a maniac Matz OOP language to suit looking for a scripting-based OOP reply, but he did not find it, there's just perl and python, that was exactly not a true OOP. And then he decided to create a new language (I swear masya4JJI can not create a new language) wrote more powerful than perl and more OOP than python. (halahhh.. python snakes, and then type perl precious or animal?)
the first to be friends with Ruby installation must be done first. For Windows users, you can download a One-Click Ruby Installer here
easy, live download, then double clik, so . To check whether udah bener to install with or not, just type this command at a command prompt: ruby-v
If using Linux, there is usually've packages of Linux distribution they will be, ie: to use the live ubuntu apt-get command, refer again to each reporsitory linux linux distribution, and for Mac OSX've at include.
So what happens when you fail to install? or your Internet connection to download blocked? or you do not have a computer and just play in internet shop? or you do not have the money to buy his CD in shop? or read it you find hard? hahaahaa ..
Try this one had ever http://tryruby.hobix.com of your site they will be able to immediately try deh Ruby, a short tutorial as well, "Ruby in your Browser"
Writing a variable in Ruby as PHP does not have defined Hereinafter typenya but recognized that depending on the input given. Just a simple ..
Tipe2 basis of variables in Ruby are: Numbers, Strings, Arrays, Hashes, Symbosl, Ranges and Regular Expressions
Numbers and Strings
Ok, let's play with Ruby, the Interactive Ruby. Open a command prompt and type: IRB
C:\Documents and Settings\galihadika>irb
irb(main):001:0> a = 10
=> 10
irb(main):002:0> b = 20
=> 20
irb(main):003:0> a+b
=> 30
irb(main):004:0>
irb(main):004:0> string = “Bermain - main dengan Ruby”
=> “Bermain - main dengan Ruby”
irb(main):005:0> string.length
=> 26
irb(main):006:0> string.reverse
=> “ybuR nagned niam - niamreB”
irb(main):007:0> string.index(”B”)
=> 0
Ruby is a true OOP language isn’t it ?
When a variable in a value then assign these variables to be in accordance with Inputan type. And tessebut variable is an object. You can call its method, like the example above string.length, string.index
Arrays dan Hashes
Still on the IRB (Interactive Ruby)
Writing an array of Ruby just simple like this:
irb(main):008:0> arraynih = [1,”aja-aja ada”, “yahuu”, “gugel”, 10]
=> [1, “aja-aja ada”, “yahuu”, “gugel”, 10]
irb(main):009:0> arraynih[1]
=> “aja-aja ada”
irb(main):010:0> arraynih.length
=> 5
To create an empty new Array :
irb(main):011:0> empty = []
=> []
irb(main):012:0> empty1 = Array.new
=> []
And again Array is an object, anda dapat memanggil method sperti length, sort, dll, baca doc nya Ruby.
Nil not Null !
irb(main):013:0> arraynih[3] = nil
=> nil
To create an index of the array value is empty, use nill not null! wat is it? nil is actually an object too. Ruby and recognize it, so there will not declare error "null pointer error" (tired clay java continued) hehehhehe
irb(main):014:0> string = %w{ satu dua tiga empat lima }
=> [”satu”, “dua”, “tiga”, “empat”, “lima”]
irb(main):015:0> string[3]
=> “empat”
irb(main):016:0> string[2]
=> “tiga”
Dizziness was missing from your brain, I believe that u usually have to write double quote and comma for each of the string element of your array. In Ruby just use% w, and the problem was not attached to pat on the head, very elegant is not it?
For the hash, consisting of key and value,
irb(main):027:0> hashSaya = {
irb(main):028:1* ’satu’ => ’satu’,
irb(main):029:1* ‘dua’ => ‘dua’,
irb(main):030:1* 3 => ‘tiga’,
irb(main):031:1* 4 => ‘empat’}
=> {”satu”=>”satu”, “dua”=>”dua”, 3=>”tiga”, 4=>”empat”}
irb(main):032:0> hashSaya[’satu’]
=> “satu”
irb(main):033:0> hashSaya[3]
=> “tiga”
Did you have cured a headache?
Symbol
Symbol is a representation of a string. To be honest I was still confused about the function and the fundamental differences of this symbol, but this symbol is usually used as the key of a hash.
Writing is as follows:
:symbol1
:symbol2
Implementation of the hash:
irb(main):034:0> hash2 = {:satu => 1, :dua=> 2}
=> {:dua=>2, :satu=>1}
irb(main):035:0> hash2[:satu]
=> 1
Just the same hash result as usual. This might be cool to be writing more and more organized .. so know this was a sign ":" (colon) means the key of the hash .
Ranges
In the Indonesian sense is a distance from something to something else.
Immediately, for example:
rb(main):036:0> rangesnih = 1..10
=> 1..10
irb(main):037:0> rangesnih.max
=> 10
irb(main):038:0> rangesnih.min
=> 1
Above example has a value ranges from 1 to 10, again these ranges is also an object (everything is an object). Call the method max and it returns the max value of the ranges
Can also be used for iteration:
irb(main):039:0> rangesnih.each do |i|
irb(main):040:1* puts i
irb(main):041:1> end
1
2
3
4
5
6
7
8
9
10
=> 1..10
Or, if you want to convert ranges into array :
irb(main):047:0> arr = rangesnih.to_a
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
irb(main):048:0> arr[1]
=> 2
irb(main):049:0> arr1 = (’abc’..’abf’).to_a
=> [”abc”, “abd”, “abe”, “abf”]
irb(main):050:0> arr1[3]
=> “abf”
Regular Expression
Used to perform a set pattern matching with a particular string.
Writing can be done by:
irb(main):051:0> a = Regexp.new(’^\s*[a-z]’)
=> /^\s*[a-z]/
irb(main):052:0> b = /^\s*[a-z]/
=> /^\s*[a-z]/
irb(main):053:0> c = %r{^s*[a-z]}
=> /^s*[a-z]/
So there r three ways to initialize Regular Expression
1. Regexexp.new(‘pattern’)
2. /pattern/
3. %r{pattern}
Pattern matching :
irb(main):054:0> a = “test doang”
=> “test doang”
irb(main):055:0> a =~ /o/
=> 6
irb(main):056:0> a !~ /o/
=> false
Operator "= ~" is used to compare the pattern with the string if it is true, if true then the return position in the string.
While the operator "~" states are not equal to the pattern, the example above produce false because the "o" is the string.
Struktur Kontrol
Selection
If condition
Action
Elseif condition1
Action1
Else
ActionElese
end
This period also requested described!! (too much ..)
case [target]
when [comparison1]
action1
when [comparison2]
action2
[ else
body ]
end
[target] is the target variable selection
[comparison] is the value given for comparison with the target variable if true then run.
[else] is used as the default action if no reply from the comparison true
Perulangan
Use for:
for [varname] in [collection] do
action
end
[varname] is a variable name that will be used as the value of each collection
[collection] is a set of values that will iterate until the completion of the for
Example:
irb(main):065:0> a = 1..10
=> 1..10
irb(main):066:0> for i in a do
irb(main):067:1* puts i
irb(main):068:1> end
1
2
3
4
5
6
7
8
9
10
=> 1..10
Using the while-until:
while expression do
action
end
until expression do
action
end
differences of the two models above is repeated, while doing looping for expression is true, whereas looping until done during the expression value false.
In the iteration if there is usually a break and continue, then there is a break in Ruby and next, the same function.
Ramadhan and fasting
Ramadan and Fasting
| Every year in the month of Ramadan, all Muslims fast from first light until sundown, abstaining from food, drink, and sexual relations. Those who are sick, elderly, or on a journey, and women who are pregnant or nursing are permitted to break the fast and make up an equal number of days later in the year. If they are physically unable to do this, they must feed a needy person for every day missed. Children begin to fast (and to observe the prayer) from puberty, although many start earlier. Although the fast is most beneficial to the health, it is regarded principally as a method of self purification. By cutting oneself off from worldly comforts, even for a short time, a fasting person gains true sympathy with those who go hungry as well as growth in one's spiritual life. |
| Setting the Intention |
| When Ramadan begins, any person who intends to fast must openly or silently express to Allah the following: When it is time to break the fast at sunset, the Muslim should say: |
| Fasting at a Glance |
| 1.5 billion Muslims of the world celebrate their holiest month of Ramadan every year. Ramadan is the 9th month in the lunar year. During this month, healthy Muslim adults observe Fasting during the daylight hours. Muslim Fasting is a total abstention from eating, drinking, and sexual relations from dawn to dusk for 29 or 30 days of the month of Ramadan. Also, avoiding immoral behavior and anger and showing compassion is part of the requirements of the fasting. The purpose of fasting is manifold. Allah (the God Almighty) mentioned in the Holy Book of the Muslims, Quran, that the fasting is prescribed for the believers as it was prescribed for the people before them, so that they may acquire self control and God-consciousness. Therefore, the purpose of the fasting is to develop God-consciousness, self-control, improvement of health by reducing or eliminating impurities from the body, and to become aware of the plight of the poor, hungry, and the sick. Ramadan is a month of spiritual consciousness and high sense of social responsibility. The fulfillment of one's obligations during the month is rewarded by 70 times. Fasting is one of the 5 pillars of Islam including Announcement of Faith, Salaat (praying 5 times a day), Zakaat (the right of the poor on the wealth of the financially able), Fasting during the month of Ramadan, and Hajj (once a life time pilgrimage to Kaaba). It is an obligation on every adult and healthy Muslim to fast during the month of Ramadan. The month of Ramadan is also the month in which the Holy Quran was sent down from 7th level of heaven to the 1st level, from where it was revealed to Prophet Muhammad (peace be upon him) in piecemeal basis over a period of 23 years. It is a very joyous occasion for the Muslims of the world. Muslims fast during the day and pray and read Quran during the part of the night. There is a special night called the Night of Power, which is mentioned in the Quran, as a night of mercy and light and worshiping during this night is better than 1,000 months. During this night Quran was sent to the 1st level of heaven. Allah (the God Almighty) send down special angels during this night to pray for the mercy of Allah (the God Almighty) and salvation for the believers. Unlike common calendar, which is Solar based, Islamic calendar is Lunar based. It does not mean that Muslims worship moon. It is simply another way to count days of the month and the year. Like all Islamic months, Ramadan, the 9th lunar month, begins after sighting Crescent, and not the birth of the new moon. All healthy Muslim adult including homemakers, school-going kids around the age of 13, factory workers, businessmen and others among them will be fasting. Muslim get up very early to take their sahoor, a pre-dawn meal before starting their fast. At the completion of month of Fasting, Muslims all over the world celebrate their holiday of Eidul-Fitr. It is a true thanksgiving for a Muslim believer for having the opportunity to obey Allah (the God Almighty) by observing Fasting. It is celebrated on the 1st day of 10th lunar month, Shawwaal. The holiday begins with Muslims putting on their best preferably new clothes and going to the Eid congregation. Eid congregations are very large gathering of Muslim men, women and children across the world. Afterwards, people greet each other with hugs and handshakes. The children receive gifts. After the congregation, Muslims visit each other at their homes and hold lunches or dinners for family and friends. |
Juice Fasting For Weight Loss and Juice Fasting For Stubborn Fat!
How much weight will I lose on a juice fast? ??????
The main benefit offered by a juice fast, to those who wish to lose weight, is the speed of the weight loss. Initially, weight loss can be as high as three-to-four pounds per day, but as the fast continues, the average loss will be one pound-per-day.
To see a person drop 30-to-40 pounds in a 30-day juice fast is to see a person totally transform his life. Self-esteem is given a boost and for the first time in their life, discipline becomes a lifestyle. The fast becomes a catalyst for a total life overhaul. People start dressing better, showing more confidence, becoming more organized, more dedicated in relationships and more at peace.
Juice fasting for weight loss and stubborn fat!!!!!!
Trying to stay on a diet can turn a simple journey to the supermarket into an epic challenge of self-discipline. How can you ignore all the florescent-lit aisles of junk food offering every temptation known to the tongue when you are hungry depressed and feeling deprived? It becomes a war of desires where your willingness to surrender is quickly rewarded.
In a culture that esteems fashion-model thinness as perfect beauty, fat is the ugly disease that must be cured. This creates an obsession with weight-loss that increases the difficulty in losing weight. It is like trying not to think of a white horse. The more you try not to think of it the more it comes back into your thoughts.
Obsession, slow metabolism and high-calorie food are a deadly combination for weight gain. The worst offenders of weight gain are starches, fats, and refined sugars. Since the biggest part of our diet is starch in the form of breakfast cereal, cookies, cakes, pies, chips and bread, it has the greatest impact on weight gain. Starches are worse than sugar. For a short amount of time, the blood sugar will peak allowing the body to store the excess sugar as body fat. Starch is different in that it is a slow release of sugar, which is perfect for long-distance runners, however, if you are inactive, the slow-releasing sugars will be turned into body fat. Excess calories equate to excess fat.
For many, juice fasting is a last ditch effort to lose stubborn fat that has resisted every attempt at weight reduction. Diets may have given you a short-lived victory, only to suffer defeat by one indulgence that escalates into a feeding frenzy resulting in being heavier than before the diet.
How juice fasting affects addiction to food!!!!!!!
My war with food addiction lasted 10 long years. I had been healed from years of drug abuse, but my battle with addictive behavior was not over. I desperately wanted control over what I ate, not for weight loss, as I was thin, due to a very fast metabolism; but binge eating made me feel like garbage.
Cookies, cakes, ice cream and chocolate were the enemies I loved. At the saturation point, where I could not stand myself anymore, I would fast and my body would recover from the damage of the abuse, but it only deepened the power of my addiction.
After 20 days of juice fasting, I would go on a feeding frenzy destroying all the benefits of the fast. My resting stomach was stuffed with the most volatile mixtures of food. Sometimes it took weeks to recover. After years of blowing fasts, the realization came that fasting was increasing my compulsiveness.
Fasting had become a drug. I longed for the freedom of the fast, that amazing feeling of being in total control. Victory tasted sweet but it never lasted. Over and over I plunged into the pit of hell, blowing the fast and enduring painful feelings of being a failure, guilt and feeling out of control.
GaLiH wrote a tips on how to overcome overeating
My book, Eating in Freedom, was written after years of my continual battles with compulsive eating in a desperate attempt to get free. I discovered principles for keeping my thought life pure and reassuring. With each chapter, I learned, and by the end of the book, for the first time in my life, I was free from food addiction.
Not only did it work for me but thousands of others. No fancy secret knowledge, just methods to change how you think, for when you change how you think, you change how you eat. Once you get your diet and thinking to this point, it becomes a lifestyle; then you will naturally want the foods that are good for you.
How the juice fasting diet affects metabolism
The fear is that while juice fasting, the metabolism will slow down and afterward there will be more weight gained than before the fast. Initially, any calorie reduction will cause a lowering in the BMR or base metabolic rate. Cleansing will bring health that will increase metabolic performance and energy output. In other words, you will eat less and feel more energetic.
The greatest impact you can have on increasing your resting metabolism is exercise. After a workout, you can be sitting on the couch reading while burning calories, as the muscles are grabbing glucose from the blood to replace glycogen supplies. The key to weight loss is fewer calories and more exercise. A diet high in raw food provides fewer, low-density calories, and higher-fiber, more-filling foods.
How the juice fasting diet affects digestion !!!!!!!!!!!!!!!!!!!
After a juice fast, the body is more efficient. Digestion is better due to a cleaner colon. The colon walls have been cleansed of impacted feces, allowing improved absorption of nutrients. The good news is that greater efficiency equals enhanced energy. Healthy people burn more calories. They also eat less because they are more active and feel better about themselves. They don't need food as a security blanket.
tHaNk fOr uR aTteNtIoN.....