Wednesday, March 18, 2020
Yousuf Karsh, photographer essays
Yousuf Karsh, photographer essays Youseph Karsh was a world-renowned photographer, famous for his photographs of dignitaries and political figures. Karsh was born in Turkish Armenia in 1908. At the age of 14 he and his family fled to Syria to avoid the genocide being committed in Armenia. At 16 years of age his family sent him to Canada to live with his Uncle who was a portrait photographer. When he was 20 his uncle sent him to Boston to study photography with John Garo, who was considered one of the top ten portrait photographers in America. What was to have been a six-month apprenticeship lasted three years. Karsh was exposed to famous people from the world of music and theatre and he decided that when he branched out on his own he would only photograph those men and women who leave their mark on the world. In 1932 Karsh moved back to Canada and opened his photography studio in Ottawa, there he caught the eye of Canadas Prime Minister, Mackenzie King. King set him up to photograph political figures. In 1941 King arranged for Karsh to photograph Winston Churchill, who was visiting Canada, Churchill had not been notified he was having his portrait made until he was being ushered into the room. Grumbling, he lit a cigar and told Karsh he had exactly two minutes to take his picture. Karsh, knowing he did not have adequate time to get a good photograph, calmly walked over to Churchill, plucked the cigar from his mouth, and saying, forgive me sir, released the shutter. Afterward Churchill told Karsh You can even make a roaring lion stand still to be photographed. Karsh sold this photograph to Life magazine for $100. It has become the most reproduced portrait in American history. Karshs goal when photographing someone was to expose the essential element which has made them great, explaining, All I know is that within every man and woman a secret is hidden, and as a photographer it is my task ...
Monday, March 2, 2020
How to Use Loops in Ruby Programming
How to Use Loops in Ruby Programming Computer programs often have to perform actions a number of times, not just once. For example, a program that prints all of your new email will need to print each email from a list, not just a single email. To do this, constructs called loops are used. A loop will repeat the statements inside it a number of times until some condition is met. While Loops The first type of these loops is a while loop. While loops will execute all of the statements contained within them as long as the conditional statement remains true. In this example, the loop continually increases the value of the variable i by one. As long as the conditional statement i 10 is true, the loop will continue executing the statement i 1 which adds one to the variable. #!/usr/bin/env rubyi 0while i 10i 1endputs i Until Loops Until loops are almost identical to while loops except that they will loop as long as the conditional statement is false. The while loop will loop while the condition is true, the until loop will loop until the condition is true. This example is the functional equivalent of the while loop example, except using an until loop, until i 10 . The variable is incremented by one until its value equals ten. #!/usr/bin/env rubyi 0until i 10i 1endputs i Loops the "Ruby Way" Though the more traditional while and until loops are used in Ruby programs, closure-based loops are more common. It isnt even necessary to understand what closures are or how they work in order to use these loops; in fact, theyre viewed as normal loops despite being very different under the hood. The Times Loop The times loop can be used on any variable containing a number or used on a number itself. In the following example, the first loop is run 3 times and the second loop is run however many times is input by the user. If you input 12, it would run 12 times. Youll notice that the times loop uses the dot syntax (3.times do) rather than the keyword syntax used by the while and until loop. This has to do with how the times loop works under the hood but its used in the same way a while or until loop is used. #!/usr/bin/env ruby3.times doputs This will be printed 3 timesendprint Enter a number: num gets.chomp.to_inum.times doputs Ruby is great!end The Each Loop The each loop is perhaps the most useful of all the loops. Each loop will take a list of variables and run a block of statements for each of them. Since almost all computing tasks use lists of variables and have to do something with each of them in the list, the each loop is by far the most common loop in Ruby code. One thing to note here is the argument to the loops block of statements. The value of the current variable the loop is looking at is assigned to the variable name in pipe characters, which is |n| in the example. The first time the loop runs, the n variable will be equal to Fred, the second time the loop runs it will be equal to Bob and so on. #!/usr/bin/env ruby# A list of namesnames [ Fred, Bob, Jim ]names.each do|n|puts Hello #{n}end
Subscribe to:
Posts (Atom)