My favorite great online radiostations are Groovetech and NPR. Both satisfy my needs as an end user and are great examples of streaming sites that go the distance to make a lot of unique content available in an easy to navigate, high quality format.
(more…)
Great online radiostations
Integers in Terms of Grouping Operators
Using Recursive Prime Factorization and Prime Indexes to Represent Integers in Terms of Grouping Operators
The idea of this program is to represent any integer purely in terms of grouping operators “(” and “)”. These 2 symbols will give a binary representation of the integers. Since the grouping operators will be balanced, we are guaranteed that the density of (‘s and )’s will be equal. Also, since the ) that matches the first ( indicates the end of a number, arbitrary length integers can be strung together without any special “record separator” indicator.
(more…)
Creating and examining macro in Excel VBA
We’re going to create a very simple macro that will help introduce the language to you. Follow these steps:
- Create a new blank workbook in Excel.
- Turn on the Macro Recorder (Tools, Macros, Record New Macro). Make sure that you record the macro in ThisWorkbook. Name the macro ValueInCell.
- Using the mouse select cell F5. In this cell type the word “Hello” and press Enter.
- Stop the macro recorder.
Now take a look at the VBA code behind this macro. Open the Visual Basic Editor, make sure the project explorer is visible (Ctrl-R will show it), locate your project, expand the Modules folder and double-click Module1.
From the first tutorial you should recognise the structure of what you can see. The first 4 lines of the procedure are comments (which you will recognise as starting with an apostrophe and being green). The first line of actual code is this:
Range(“F5″).Select
This instruction tells VBA to select the cell F5. The next line is slightly more cryptic.
ActiveCell.FormulaR1C1 = “Hello”
ActiveCell refers to exactly that – the active cell i.e. the one that is currently selected. FormulaR1C1 can be used to assign a formula or a value to a cell. For example, this code would also work:
ActiveCell.FormulaR1C1 = “=SUM(R1C10:R10C10)”
If you’re not familiar with the R1C1 style of referencing cells then this may seem confusing (suffice to say that it will put the formula SUM($J$1:$J$10) into the active cell). You can also specify a constant e.g. “Hello” as we have done in our macro.
The final line of is similar to the first:
Range(“F6″).Select
Can you guess what it does? That’s right, it selects cell F6!
The usual syntax of VBA is to write the name of the object that we’re working with e.g. Range(“A1″) followed by a full-stop/period and then the name of the attribute we want to change or the command we want to carry out. If we’re changing the value of an attribute then we use an = sign followed by the new value e.g.
ActiveCell.FormulaR1C1 = “Hello”
If we want to carry out a command then we specify the object we’re working with followed by the name of the command that we want to carry out e.g.
Range(“F5″).Select
OK, you can close the workbook now. Don’t bother saving it, unless you really want to.
What is Object Orientated Programming?
At this point I’m going to introduce the concept of an object orientated programming. Although that term may sound confusing it is actually a very simple concept…
Imagine a car – it could be your own trusty Holden Barina/Vauxhall Corsa or it could be something less exotic, such as a Porsche 911 or a Maserati Spyder. A car has certain attributes, such as number of seats, colour, number of gears, engine size, whether it has a turbo or not and so on. It can also do things such as start, go forwards, go backwards and stop.
Now I want you to think about your computer. Like your car it also has attributes, such as memory size, hard disk size, processor speed and colour. It can also do things such as boot up, run a program, close a program and shut down.
A car and a computer are objects – you can see and feel them and you can experience these objects “doing things”. The premise of object orientated programming (or OOP for short) is that the programming environment consists of objects – they may not have a physical existence (except for within your computer) but they are treated as though they do. In Excel there are many different objects (hundreds). Some of the more common ones are Range, Worksheet and Workbook.
- Objects have attributes. In object orientated programming (again, OOP for short) attributes are known as properties.
- Objects can do things. In OOP the command to make an object do something is called a method.
- Objects can react to something. In OOP reactions are known as events.
As mentioned above, you change or set the value of a property by specifying the object followed by a full-stop, then the name of the property, an equals sign (=) and then the value you want to assign i.e.
Object.Property = NewValue
Note! In general, when assigning a text value to a property, you enclose the text in speech marks e.g.
ActiveCell.Value = “Hello. This cell contains text!”
However, when assigning a numeric value to a property you do not generally need to use speech marks:
ActiveCell.Value = 100
Anyway, when you want to carry out an object’s method you type the object name followed by a full-stop and then the method name e.g.
Object.DoSomething
Introduction to object-orientated programming in C ++
Introduction to object-orientated programming in C ++
Programming language, including C ++, has a distinctive syntax and semantics of the principles of programming. Not without significance is the fact that the C ++ language – designed for AT & T by Bjarne Stroustrup, in the assumption had to be consistent with the language C. Language C ++ is object-oriented version of C, being a hybrid that allows the programming both structural and object.
Programming in C ++, you use the ASCII character set, which is defined in the standard ANSI3.4-1968. It is an American variant of the international 7-bit code, ISO 646-1983. This collection consists of upper and lower case alphabet, numbers 0 through 9, punctuation marks and other special symbols. ASCII table can be found at: http://en.wikipedia.org/wiki/ASCII
You should start programming in C ++ by installing and configuring the compiler. Currently, we have to choose from a variety of development environments, and therefore I’ll mention only the most common: Bloodshed Dev-C ++, Borland C ++ Builder equipped with RAD tool (Rapid Application Development), Microsoft Visual C ++.
Object-orientated languages explanation
Object-oriented languages are those that allow you to use the opportunities offered by object-oriented programming. We will discuss them as an example of object-oriented features of C ++, which include abstractions, data encapsulation, inheritance, and polymorphism. In C ++ you can successfully use the abstraction at the stage of creating objects. In C, you can create structures that allow you to connect various types of data, the evolution of such an approach resulted in the establishment of classes. Class not only can combine different types of data, and in this abstract way serve to reflect the actual objects. Classes can also contain methods that make it able to accurately represent objects.
Methods are otherwise hidden features in the classes. If you would like to describe in the programming language spacecraft as an object, then using the object-oriented approach, we focus on the description of the essential characteristics and its representation, and so it will be such as its color, speed, payload. Methods are functions that allow the movement of the spacecraft, its landing, refueling. Having classes with internal methods, we can create additional objects based on them – ships that will behave according to how they are designed by the class. Objects do not necessarily have to represent real entities such as vehicle, vessel, they can be a phenomenon or activity.
In C ++ is also used data encapsulation, that hides certain elements of the object against interference from outside. In other words, computer programs have a clearly designated access to certain elements of the object, and strategic elements are hidden – protected (private). Language C + + makes it possible to use inheritance, or create classes based on existing classes. Thanks to the fact that the classes may have the same features or methods, inheritance allows you to build new items with finished, predesigned.
Language C ++ also allows the use of polymorphism, properties of the object, which gives him the opportunity to interpret the operation. Calling an operation, the object is able to interpret it and execute accordingly.
