Evgenii Legotckoi
Evgenii LegotckoiJune 27, 2016, 2:43 a.m.

RubyUser Guide #15 - Ruby - access control

access control, Ruby, ruby lesson, ruby уроки, user guide, контроль доступа, руководство пользователя

Earlier, we said that ruby has no functions, only methods. However there is more than one kind of method. In this chapter we introduce access controls .

Consider what happens when we define a method in the "top level", not …

Read
Evgenii Legotckoi
Evgenii LegotckoiJune 27, 2016, 2:41 a.m.

RubyUser Guide #14 - Ruby - Redefinition of methods

Ruby, ruby lesson, ruby уроки, user guide, переопределение методов, руководство пользователя

In a subclass, we can change the behavior of the instances by redefining superclass methods.

ruby> class Human
    |   def identify
    |     print "I'm a person.\n"
    |   end
    |   def train_toll(age)
    |     if age < 12
    |       print "Reduced fare.\n"; …
Read
Evgenii Legotckoi
Evgenii LegotckoiJune 27, 2016, 2:38 a.m.

RubyUser Guide #13 - Ruby - Inheritance

Inheritance, Ruby, ruby lesson, ruby уроки, user guide, наследование, руководство пользователя

Our classification of objects in everyday life is naturally hierarchical. We know that all cats are mammals , and all mammals are animals . Smaller classes inherit characteristics from the larger classes to which they belong. If all mammals breathe, …

Read
Evgenii Legotckoi
Evgenii LegotckoiJune 26, 2016, 2:36 a.m.

RubyUser Guide #12 - Ruby - classes

class, Ruby, ruby lesson, ruby уроки, user guide, класс, руководство пользователя

The real world is filled by objects, and we can classify them. For example, a very small child is likely to say "bow-wow" when seeing a dog, regardless of the breed; we naturally see the world in terms of these …

Read
Evgenii Legotckoi
Evgenii LegotckoiJune 26, 2016, 2:34 a.m.

RubyUser Guide #11 - Ruby - methods

methods, Ruby, ruby lesson, ruby уроки, user guide, методы, руководство пользователя

What is a method? In OO programming, we don't think of operating on data directly from outside an object; rather, objects have some understanding of how to operate on themselves (when asked nicely to do so). You might say we …

Read
Evgenii Legotckoi
Evgenii LegotckoiJune 26, 2016, 2:24 a.m.

RubyUser Guide #10 - Ruby - Object-oriented thinking

Ruby, ruby lesson, ruby уроки, user guide, ооп, руководство пользователя

Object oriented is a catchy phrase. To call anything object oriented can make you sound pretty smart. Ruby claims to be an object oriented scripting language; but what exactly does "object oriented" mean?

There have been a variety of answers …

Read
Evgenii Legotckoi
Evgenii LegotckoiJune 25, 2016, 2:22 a.m.

RubyUser Guide #09 - Ruby - iterators

interators, Ruby, ruby lesson, ruby уроки, user guide, итераторы, руководство пользователя

Iterators are not an original concept with ruby. They are in common use in object-oriented languages. They are also used in Lisp, though there they are not called iterators. However the concepet of iterator is an unfamiliar one for many …

Read
Evgenii Legotckoi
Evgenii LegotckoiJune 25, 2016, 2:07 a.m.

RubyUser Guide #08 - Ruby - control structures

case, for, Ruby, ruby lesson, ruby уроки, user guide, while, руководство пользователя

This chapter explores more of ruby's control structures.

case

We use the case statement to test a sequence of conditions. This is superficially similar to switch in C and Java but is considerably more powerful, as we shall see.

ruby> …
Read
Evgenii Legotckoi
Evgenii LegotckoiJune 23, 2016, 2:01 a.m.

RubyUser Guide #07 - Ruby - Back to the simple examples

руководство пользователя, ruby lesson, Ruby, ruby уроки, user guide, regular expressions, string

Now let's take apart the code of some of our previous example programs.

The following appeared in the simple examples chapter.

def fact(n)
  if n == 0
    1
  else
    n * fact(n-1)
  end
end
print fact(ARGV[0].to_i), "\n"

Because this is …

Read
Evgenii Legotckoi
Evgenii LegotckoiJune 21, 2016, 1:54 a.m.

RubyUser Guide #06 - Ruby - arrays

arrays, Ruby, ruby lesson, ruby уроки, user guide, массивы, руководство пользователя

You can create an array by listing some items within square brackets ([]) and separating them with commas. Ruby's arrays can accomodate diverse object types.

ruby> ary = [1, 2, "3"]
   [1, 2, "3"]

Arrays can be concatenated or repeated …

Read
Evgenii Legotckoi
Evgenii LegotckoiJune 21, 2016, 1:52 a.m.

RubyUser Guide #05 - Ruby - Regular expressions

user guide, регулярные выражения, ruby lesson, Ruby, ruby уроки, руководство пользователя, regular expressions

Let's put together a more interesting program. This time we test whether a string fits a description, encoded into a concise pattern .

There are some characters and character combinations that have special meaning in these patterns, including:

[] - …

Read
Evgenii Legotckoi
Evgenii LegotckoiJune 18, 2016, 1:49 a.m.

RubyUser Guide #04 - Ruby - Strings

Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя

Ruby deals with strings as well as numerical data. A string may be double-quoted ("...") or single-quoted ('...').

ruby> "abc"
   "abc"
ruby> 'abc'
   "abc"

Double- and single-quoting have different effects in some cases. A double-quoted string allows character escapes by …

Read
e
  • ehot
  • April 1, 2024, 12:29 a.m.

C++ - Тест 003. Условия и циклы

  • Result:78points,
  • Rating points2
B

C++ - Test 002. Constants

  • Result:16points,
  • Rating points-10
B

C++ - Test 001. The first program and data types

  • Result:46points,
  • Rating points-6
Last comments
k
kmssrFeb. 9, 2024, 5:43 a.m.
Qt Linux - Lesson 001. Autorun Qt application under Linux как сделать автозапуск для флэтпака, который не даёт создавать файлы в ~/.config - вот это вопрос ))
Qt WinAPI - Lesson 007. Working with ICMP Ping in Qt Без строки #include <QRegularExpressionValidator> в заголовочном файле не работает валидатор.
EVA
EVADec. 25, 2023, 9:30 p.m.
Boost - static linking in CMake project under Windows Ошибка LNK1104 часто возникает, когда компоновщик не может найти или открыть файл библиотеки. В вашем случае, это файл libboost_locale-vc142-mt-gd-x64-1_74.lib из библиотеки Boost для C+…
J
JonnyJoDec. 25, 2023, 7:38 p.m.
Boost - static linking in CMake project under Windows Сделал всё по-как у вас, но выдаёт ошибку [build] LINK : fatal error LNK1104: не удается открыть файл "libboost_locale-vc142-mt-gd-x64-1_74.lib" Хоть убей, не могу понять в чём дел…
G
GvozdikDec. 19, 2023, 8:01 a.m.
Qt/C++ - Lesson 056. Connecting the Boost library in Qt for MinGW and MSVC compilers Для решения твой проблемы добавь в файл .pro строчку "LIBS += -lws2_32" она решит проблему , лично мне помогло.
Now discuss on the forum
a
a_vlasovApril 14, 2024, 4:41 p.m.
Мобильное приложение на C++Qt и бэкенд к нему на Django Rest Framework Евгений, добрый день! Такой вопрос. Верно ли следующее утверждение: Любое Android-приложение, написанное на Java/Kotlin чисто теоретически (пусть и с большими трудностями) можно написать и на C+…
Павел Дорофеев
Павел ДорофеевApril 14, 2024, 12:35 p.m.
QTableWidget с 2 заголовками Вот тут есть кастомный QTableView с многорядностью проект поддерживается, обращайтесь
f
fastrexApril 4, 2024, 2:47 p.m.
Вернуть старое поведение QComboBox, не менять индекс при resetModel Добрый день! У нас много проектов в которых используется QComboBox, в версии 5.5.1, когда модель испускает сигнал resetModel, currentIndex не менялся. В версии 5.15 при resetModel происходит try…
AC
Alexandru CodreanuJan. 19, 2024, 10:57 p.m.
QML Обнулить значения SpinBox Доброго времени суток, не могу разобраться с обнулением значение SpinBox находящего в делегате. import QtQuickimport QtQuick.ControlsWindow { width: 640 height: 480 visible: tr…

Follow us in social networks