Jumat, 14 Desember 2012

ANSI C++ string class and the C standard library:

he full use of the C standard library is available for use by utilizing the ".c_str" function return of the string class.

01#include <strings.h>
02#include <string>
03#include <stdio.h>
04using namespace std;
05    
06int main()
07{
08   char *phrase1="phrase";
09   string phrase2("Second phrase");
10   char  phraseA[128];
11   char  *phraseB;
12    
13   strcpy(phraseA,phrase2.c_str());
14   phraseB = strstr(phrase2.c_str(),phrase1);
15 
16   printf("phraseA: %s\n",phraseA);
17   printf("phraseB: %s\n",phraseB);
18   printf("phrase2: %s\n",phrase2.c_str());
19}  
Compile and run:
[prompt]$ g++ test.cpp
[prompt]$ ./a.out
phraseA: Second phrase
phraseB: phrase
phrase2: Second phrase

Iterator types:

  • string::traits_type
  • string::value_type
  • string::size_type
  • string::difference_type
  • string::reference
  • string::const_reference
  • string::pointer
  • string::const_pointer
  • string::iterator
  • string::const_iterator
  • string::reverse_iterator
  • string::const_reverse_iterator
  • string::npos


ANSI C++ string class iterators:

terators provide the ability to access the individual characters in a string.
01#include <iostream>
02#include <string>
03using namespace std;
04    
05int main()
06{
07   string alphabetLC="abcdefghijklmnopqrstuvwxyz";
08 
09   string::const_iterator cii;
10   int ii;
11 
12   for(cii=alphabetLC.begin(); cii!=alphabetLC.end(); cii++)
13   {
14      cout << ii++ << " " << *cii << endl;
15   }
16}
This will print the integer position in the string followed by the letter for all characters in the alphabet.
0 a
1 b
2 c
3 d
4 e
5 f
6 g
7 h
...
..


STL C++ string functions:

Assuming declaration: string Var;
Function/Operation Description
Var = string2
Var.assign("string-to-assign")
Assignment of value to string. When assigning a C "char" data type, first check if NULL to avoid failure/crash.
i.e.: if( szVar ) sVar.assign( szVar );
where szVar is a C "char *" data type and sVar is of type "string".
Var.swap(string2)
swap(string1,string2)
Swap with value held in string2.
Function swap will exchange contents of two string class variables.
Var += string2
Var.append()
Var.push_back()
Append string/characters.
Var.insert() Insert characters
Var.erase()
Var = ""
Clear string variable. No arguments necessary.
+ Concatenate
==, !=, <, <=, >, >= Compare strings.
Var.compare(string)
Var.compare( size_t pos1, size_t len, string ) const;
Var.compare( size_t pos1, size_t len1, const string, size_t pos2, size_t len2 ) const;
Compare strings. Returns int:
  • 0: if equal.
  • -1: Not equal. 1st non matching character in Var is less in value based on ASCII table than in compare string.
  • +1: Not equal. 1st non matching character is greater in value based on ASCII table.
Where string is another STL string or null terminated C string.
Var.length() Return length of string. No arguments necessary. The methods length(), size() and capacity() all return the same value.
Var.size() Return length of string. No arguments necessary.
Var.capacity() Return length of string + 1. Red Hat 7.x. Red Hat 8.0+ returns the number of characters without the "+1". Number of characters that can be held without re-allocation.
No arguments necessary.
Var.max_size() Returns a very large number. No arguments necessary.
Var.empty() Returns 1 if an empty string.
Returns 0 if not empty.
<< Output stream
>>
getline()
Input stream
Var.c_str() Returns C string pointer. C char string is null terminated. Do not free memory using this pointer!
Var.data() Returns C string pointer. C char string is NOT null terminated. Do not free memory using this pointer!
Var[]
Var.at(integer)
Access individual characters. Return single character at specified position (integer).
Var.find(string)
Var.find(string, positionFirstChar)
Var.find(string, positionFirstChar, len)
Find first occurance of string or substring. Returns int position of first occurance in string. Where len is the length of the sequence to search for.
Returns string::npos if not found.
i.e. if(Var.find("abc") == string::npos) cout << "Not found" << endl;
Var.rfind() Find last occurance of string or substring.
Var.find_first_of(string, position)
Var.find_first_of( string, size_t position, size_t len )
Find strings and substrings.
Where string is another STL string or null terminated C string.
If position = 0, than start at beginning of string.
Var.find_last_of() Find strings and substrings.
Var.find_first_not_of()
Var.find_last_not_of()
Find strings and substrings.
Var.replace(pos1, len1, string)
Var.replace(itterator1, itterator2, const string)
Var.replace(pos1, len1, string, pos2, len2)
Replace section of string with new characters.
pos2 and len2 are given when using only a substring of string. Where string is another STL string or null terminated C string.
Var.substr(pos, len) Return substring of text given a start position in string object and length.
Var.begin()
Var.end()
Iterators
Var.rbegin()
Var.rend()
Reverse iterators
Note that in most cases the string functions have been overloaded to accept both string class arguments and C char variables.

Creating Quick Rollovers and Flash Buttons using Dreamweaver

A word of caution!

Some older browsers do not display Flash Text or Flash Buttons. If the audience you are writing for uses mainly older browsers or mobile browsers you might not want to include too many examples of Flash elements at first. Another good idea, would be to provide text links in addition to Flash links. Have fun, but don't go overboard.

Move your mouse pointer to the text below. The text turns purple and your mouse pointer turns to a hand.
The text is not a link, but it could easily be. This page describes how to create such rollovers using Dreamweaver.

Flash Text

The title of this web page ( Using Dreamweaver to Create Quick Rollovers ) was created using Flash Text. Although the text was typed, it behaves as if it is an image.
To create a Flash Text image go to the Insert menu. Choose Interactive Images then Flash Text .
Several options are available to you; text color, rollover color, size and style, font and link or target. The Flash Text image below will be used in this example.

The window below shows that the text was written in Abadi MT Condensed 20 point. The text color selected was black (#000000) with purple (#CC00FF) as the rollover color. The text is a link to Internet4Classrooms home page. If you follow the link, use the back button to come back to this page.
The first few times you do this you might overlook naming the image. A default name will be used with the extension .swf if you do overlook this.
One way to see the results of your work is to save the page and view it in a browser. However, Dreamweaver allows a quicker way to view the results. Select the text you inserted onto your page and look at the properties window. Select the Play button on the bottom right of the Properties window and move your cursor over the Flash Text to observe the color change. When you are finished click the same button, which now says Stop . Flash Buttons Sample buttons available in Dreamweaver

None of these buttons act as links. However, that is only because link information was not entered.

Dreamweaver allows you to quickly create rollover buttons in much the same way that you created Flash Text above. The Insert Flash Button window below, looks quite similar to the Flash Text window at the top of this page.
The button immediately below this text is the one that you may have used to come to this page on Rollover effects in Dreamweaver.
The next step is for you to create your own rollovers with Dreamweaver.
A word of caution! Some older browsers do not display Flash Text or Flash Buttons. If the audience you are writing for uses mainly older browsers you might not want to include too many examples of Flash elements at first. Another good idea, would be to provide text links in addition to Flash links. Have fun, but don't go overboard.

Go To Previous Tutorial: Dreamweaver Links

Go To Next Tutorial: Easy JavaScript with Dreamweaver

Writing Hyperlinks in Dreamweaver

Hyperlinks can be written to allow a viewer of your page to move to some other location.
Images or text can be used to include the hyperlink information.
Several types of locations will be discussed below:
A web page not on the server you are using (an external page) - Your first step is to visit the page you want to make a hyperlink to. Click into the URL in the Address or Location block. The URL should highlight. If it does not, click and drag to highlight the entire URL. Copy the URL. Never try to type in a URL, even one as simple as http://www.cnn.con (did you catch it, all it takes is one keystroke error and your hyperlink will not work). Go back to the page you are working on in Dreamweaver and select the object (text or image) which you will use for the hyperlink. With the text or image selected, paste the URL into the Link portion of the properties window, as in the example below:
A specific location on an external page - A page of Earth Science Internet links has an index at the top of the page. That index is a set of hyperlinks which point to invisible anchors. Suppose you were preparing a lesson and wanted to send your students to the part of the page that has weather links. Don't send them to the top of the page and trust that they will click on the right part of the index. Select the link yourself. Notice that the URL now has something added after the file name. That is the hyperlink to the invisible anchor. For example:
http://www.internet4classrooms.com/earthspace.htm
becomes
http://www.internet4classrooms.com/earthspace.htm#weather
When you find a URL with a link to an anchor, copy the entire URL and follow the same procedure outlined above.
A web page located in your own directory of pages - To make this hyperlink you do not need the entire URL, only the file name. From the example above, that would be earthspace.htm. Do not type this hyperlink in the Link portion of the properties window. If you leave off the extension, or include the wrong extension (.html when it should have been .htm, for example) the link will not work. Dreamweaver has a simple method for writing this kind of hyperlink. Select the object (text or image) which you will use for the hyperlink. With the text or image selected, click on the small folder to the right of the Link portion of the properties window.
When you click on the folder, you will be presented with a select file window. Select the file that you wish to make a hyperlink to.
A specific location on the web page you are working on - An invisible object in Netscape Composer is called a target. Personally, I think that is a better name than Dreamweaver's term, anchor. The same sort of thing in MS Word is called a bookmark. They all do the same thing, they provide a location for a hyperlink to point to. As an example, I inserted invisible anchors before each of the bold type lines describing the type of hyperlink. Then I made hyperlinks of each of the four bulleted items at the top of the page.
Step 1- Insert the invisible named anchor. Place your cursor where you want the anchor to be. From the Insert menu select Invisible Tags then select Named Anchor.
Step 2 - Name the anchor. Although the anchor is invisible, the name becomes part of the URL. Put some thought into a naming system for anchors on a page. Since this may become a part of the URL, remember to use no spaces.
Step 3 - Write the link to your anchor. Select the object (text or image) which you will use for the hyperlink. With the text or image selected, type # and the anchor name. Don't put spaces anywhere in the link name, especially not after the number sign (#). Select this link if you want to see what the URL pointing to an anchor looks like.
Using an image as a hyperlink - Look at the bottom of this page. The word WebGuide is an image, and it is a link to the WebGuide template. One important consideration is seen in the image below.
If you don't make the image border zero, there will be a box around the image, indicating that it is a link. If you like the way that looks, leave the border at 1 or 2.
A blank Email message ready to go to yourself - If you maintain a web site you will want to make it easy for someone to get in touch with you. Notice that below this section I have invited readers who have questions to send Email. Place your cursor on the purple word Email and you will see how this is done. To make a mail link, highlight the words, or picture, that you want to serve as a link and in the link portion of the Properties window enter:
mailto:you@youraddress.whatever
That is: mailto: followed by your exact email address. There must be no spaces. You can type your email address and then highlight it and enter the mailto link but that is usually a waste of space. If you disagree, send me Email.
This procedure also works in the body of an Email message. If you wish the recipient to reply to some other address than the one in the Reply to: field, write the link the just as you would in the link section of the Properties window
A new window, leaving the original browser window open - To leave the original page open and allow a link to open a second browser window, select _blank in the Target block of the Properties window. If you have Dreamweaver open, look at the Properties window. The Target block should be gray. It does not become available until you make an entry into the Link block. Compare the picture of a Properties window above to your own Properties window.
Changing the color of hyperlinks - There are two possible answers to this; changing the color of all links on a page, or changing the color of a specific link.
  1. To specify the link color for all links on a page go to the Modify menu and select Page Properties. There you will find the option to select text color for a page, link color, visited link color, and active link color. Visited link color takes effect when someone viewing your page returns to the page after visiting a link. Active link color is applied as someone clicks on the link to go to another page and when they return to the page but before they select another link.
  2. To change the color of one link is another matter. The link you followed to get to this part of our page has thirteen different colors. Please be sure that you notice the last word in that link string. That is the real key to changing link color. Do not change the color of text before writing the link. Write the link as you normally would, letting the default link color apply. Beginning with the first letter of the words in your hyperlink, highlight all but the last letter. Go to the text color box and change the color of the highlighted text. The link should look something like this; this is the link. [Caution, this is not a link it just looks like one.] If you include the last letter Dreamweaver will not change the link color when your page is viewed on the web. Next, click into the changed color portion of the link, just before the last letter and add that letter. It will be the same color as the rest of the changed hyperlink. It will look like this - this is the linkk. Now, how do you get rid of that final letter, which is the default color? That's right, use your Delete key. This drove me crazy until I learned that trick about the final letter.

Using Tables on Your Web Page

able Basics

- To review table basics, Return to Tutorial on Dreamweaver Basics .

Color Background in a Cell

- With a table selected, the Properties window can be expanded to the view you see below. Cell properties are changed in the bottom of the window. To the right of Header is Bg followed by a gray box with a down arrow. Click anywhere in that box for a color palette. Dreamweaver displays the hex code for that color. One step further to the right is a Brdr box. Dreamweaver will place a colored border around the inside of the table cell.
Those who view your page with Netscape will not see the border, Internet Explorer viewers will see it. As an example look at the table below the title of this page. IE viewers will see a purple border.

Invisible Tables

- Giving a table a border of 0 (zero), will make the lines around cells invisible. However, the table retains its basic structure, allowing you to organize text on a web page. The table below is two rows deep and three columns wide.
Organize blocks of text in a table with an invisible border. You can not use the tab to move over in web page development software. However, invisible borders can give the illusion of having used tabs
Hi Hi Hi

Changing Span

- Table cells are not constrained to be the same height or width. A single cell can spread down to cover several rows, or spread across to cover several columns. This spreading is known as Spanning. Cells may also be split. To change span or split right click in a cell. (Yes, Mac users, you too can right click. Control + click) The following pop up box is displayed:
This cell spans down to cover three rows This cell spans right to cover two rows
Hi
Hi Hi Hi Hi Hi Hi Hi Hi
The cell to the right was split into two cells Hi
Hi

Image as Background

- A single background image may be used for the entire table, or each cell may contain separate images. However, you must be very careful about using images behind text. Keep in mind the reason you wrote the web page. Don't do things that will make your message difficult to read. The Properties window is used to place a background image in the table or cell. Notice in the Properties window below that the upper background box contains the image information. Browse for an image by clicking on the folder icon.

Dreamweaver: The Basics of Web Development

Web Design Rules of Thumb for Schools, Classes, etc.

There are several important things that need to be done before you write one word on a web page.

  1. Familiarize yourself with any rules established for the server to which you plan to upload files.
  2. Decide who your audience is. If you have several pages, you may find that each page has a slightly different audience. Keep those people in mind as you write the page. The reason for a web page is to communicate information.
  3. Plan the general structure of your site. As you do that, remember to make your site easy to navigate. Any page on your site should have a link to allow viewers to return to your home page easily.
  4. Put some thought into the images you plan to use:
    • Avoid posed shots. Yes, that includes administrators as well as students. The principal is the chief instructional leader. Consider using images which show your principal interacting with groups of students in their classrooms. Do you really want the headaches that come with a posed group of students?
    • Feature what is important about your school. Is it the sign out front, the building itself, or could it be something else entirely different? If you want my answer send me email. In the meantime, if you absolutely must have a picture of that sign, take the picture when a group of students is involved in some group project with the sign in the background.
    • Keep the image size small. Too many images, or large images will make your web site open slowly.

Using Dreamweaver to Accomplish Basic Web Page Development


Page Properties | Text Considerations | Using Tables | Using the Properties Window

Page Properties

To make changes to an entire page select Page Properties from the Modify menu. There are several things you might consider.
  • Title - This is not the same as file name. Make a clear statement as to the nature of the page in the title. This is displayed in the title bar of your browser. The title is also used as the name of the Favorite or Bookmark listing.
  • Background image - Do not feel obligated to use a background image just because you can. Some excellent web pages have been ruined by the use of an image which makes it difficult for the viewer. For example, look at a page of classroom management tips .
  • Background Color - If you select no color, the default color is white. In the image below, #FFFFFF is the hexadecimal code for white. You don't have to know the code. By clicking on the down arrow in the bottom right corner of the box, you may select any color. A light color may make the page appealing. A very bright or dark background color may make your page appalling.
  • Text color - If you do not select a color, the default text color is black. Avoid using text that is the same color as a link. This causes confusion.
  • Links - If you do not select a color, the default text color is blue. If you plan to use a different color for links, be consistent. If your page background color is very dark, select a link color that will be easily visible



Text Considerations

As a Claris Home page user, I always recommended that no font should be selected on a web page. My principal point was that if a web page author selects a font that is not on as viewer's computer, the default font would be used. However, I am rethinking that position because of the way that Dreamweaver is set up. Sets of fonts are provided which are found on most computers, and which look good when used together.

Using Tables

Tables provide an easy method of organizing information on a web page. To place a table on your page Table from the Insert menu.
  • Cell Padding - The number of pixels of space that surrounds the content of a table cell
  • Cell Spacing - The width of the lines that draw the table
  • Width - The width of the cell may be specified in percent or pixels. Percent is relative to the size of the browser window being used to view your web page. On the other hand, if you specify pixels, and the number of pixels is greater than a screen width, the person viewing your page will be forced to scroll horizontally.
  • Border - A border of 4 or 5 makes the border look like a picture frame. A border of 0 makes your table invisible.

You may wish to edit the table, making changes beyond what is offered in the basic Insert Table dialog box. To do so, select the table, or a cell in the table, and click on the down arrow in the bottom right corner of the Properties window. That window expands to offer you the choice of coloring the background or border of a cell, or to change the span of a cell.


Using the Properties Window

When Dreamweaver is first opened, a confusing array of windows is presented. Most of those windows are not needed as you develop your page. Go to the Window menu and deselect all of the windows except Properties. You will use the properties window extensively as you write your web page. With this window you may change font type, size and style. You may select or deselect bulleted or numbered lists. Highlighted text can be converted into a hyperlink by putting the linking information into the Link window.

Introduction to Dreamweaver

Important First Considerations:

If you are new to Dreamweaver it is important to understand the use of the term site. Dreamweaver makes reference to two sites:
  1. Remote Site - This is the folder or directory which contains all of your web pages and other files on the web server. It is the place to which you upload. If you school does not yet have a web page the folder or directory will be empty. However, as soon as you are given a username and password by the site webmaster, you have a remote site - your empty folder or directory.
  2. Local Folder - This is the folder or directory which contains all of your web pages and other files on your computer. Dreamweaver also refers to this folder as a site.

Plan your Local Site:

  1. Your first step in using Dreamweaver to build your site is to create a directory or folder. Plan to store all documents related to your site in the same directory; images, web pages, and any other documents that will be posted on your remote site.
  2. Before going any further, create a directory or folder on the computer you will be using most often to update your web site. Create a sub-directory for your images. Now you are ready to " define your site ."

Define Site

- From the Site menu select Define Sites ... then select New.

Defining your Local Site

- You enter information in three boxes.
  1. Site Name - I selected the same name as the directory I had established. That is not required.
  2. Local Root Folder - Click once on the folder icon and navigate to locate the directory you created.
  3. HTTP Address - This is the web address of your index page, or your home page.


Define Remote Site

- Several choices must be made here.
  1. When this dialog box opens only one choice is available. Change Access from None to FTP
  2. Enter the name of the server to which you will be uploading.
    • If you are a MCS webmaster, the new domain works also. www.mcsk12.net
  3. If you are a Memphis City Schools webmaster, leave the host directory blank.
  4. For MCS webmasters, Login is your username.
  5. You know what to put in the password section. However, consider carefully the Save box. If you are the only person who will be using the computer, Save is a safe option.


Local Site

- Select OK, and Dreamweaver will examine the directory where your local site is located to build a list of files. The only files displayed in this window will be those on your computer. If you wish to see the files on your server select the Connects to remote host button.

Getting Connected

- When you select the remote host button, two plugs connect, the green light comes on and Dreamweaver downloads a list of all files in your remote directory. If you have a large number of files and an older computer, be patient. This may take a minute or two.

Downloading a File to Edit

- Find the file you want to edit in the Remote Site window on the left. Click on that file one time to select it and click one time on the Get Files button (the down arrow).

Dependent Files

- Former users of Claris Home page. will like this feature. Home page. did not give the option to bring along all images, and other files, connected to the web page, only the text. Select Yes to download text and images, select No if you only wish to download the text HTML document.

Uploading Changes

- After making changes to the file you downloaded, save the file to your local site. From the Site window select the name of the file you want to upload by clicking on it one time in the Local Folder window on the right. Select the Put File(s) button to send your changed document to the server.

Dependent Files

- If you only changed text on your document, select No in the Dependent Files dialog box. Upload will be much faster.

Go To Next Tutorial: Dreamweaver Basics

Untuk menentukan Lulus Tidak nya

Berikut ini merupakan contoh program C++ yang menggunakan pernyataan IF. Soalnya adalah sebagai berikut :

Dengan menggunakan pernyataan IF, buatlah program untuk menentukan apakah seorang mahasiswa “Lulus” atau “Tidak Lulus” berdasarkan Nilai Teori dan Nilai Praktek yang diinputkan oleh user. Syarat mahasiswa akan Lulus jika nilai rata-rata minimal 60 dan Nilai Praktek minimal 55.
Misal Nilai Teori = 100, Nilai Praktek = 50 maka hasilnya = Tidak Lulus. Misalnya Nilai Teori = 40, Nilai Praktek = 90 maka hasilnya Lulus.
Melihat soal diatas, berarti kita mengetahui bahwa inputnya ada dua yaitu Nilai Teori dan Nilai Praktek. Mahasiswa akan berdasarkan dua hal yaitu nilai rata-rata dan nilai teori. Jadi sebelumnya kita harus mencari nilai rata-rata terlebih dahulu yaitu dengan menjumlahkan nilai teori dan praktek lalu dibagi dua. Program C++ selengkapnya untuk menjawab pertanyaan diatas adalah sebagai berikut :

01#include <iostream.h>
02#include <conio.h>
03 
04void main()
05     {
06     clrscr();
07     float teori, praktek, rata2;
08     cout<<"Masukkan nilai Teori : ";
09     cin>>teori;
10     cout<<"Masukkan nilai Praktek : ";
11     cin>>praktek;
12     rata2 = (teori + praktek) / 2;
13     if(rata2 >= 60 && praktek >= 55)
14     {
15          cout<<"Lulus";
16     }
17     else
18     {
19          cout<<"Tidak Lulus";
20     }
21     getch();
22}
Penjelasan Program :
Pertama-tama kita membuat 3 buah variabel yaitu teori, praktek dan rata2, ketiganya kita buat dengan tipe float yaitu tipe data yang dapat menyimpan nilai pecahan. Hal ini untuk antisipasi jika nanti hasil pembagian menghasilkan nilai pecahan. Selanjutnya program akan meminta inputan dari user untuk teori dan praktek.
Langkah selanjutnya program akan menghitung nilai rata2 yaitu jumlah teori dan praktek dibagi dua. Lalu dengan menggunakan pernyataan IF, program akan melakukan pengujian apakah nilai rata2 minimal 60 dan praktek minimal 55. Ingat disini bagian pengujian pada IF menggunakan operator DAN, jadi kedua ungkapan harus bernilai TRUE.
Jika hasilnya benar, maka akan ditampilkan “Lulus” danBerikut ini merupakan contoh program C++ yang menggunakan pernyataan IF. Soalnya adalah sebagai berikut :
Dengan menggunakan pernyataan IF, buatlah program untuk menentukan apakah seorang mahasiswa “Lulus” atau “Tidak Lulus” berdasarkan Nilai Teori dan Nilai Praktek yang diinputkan oleh user. Syarat mahasiswa akan Lulus jika nilai rata-rata minimal 60 dan Nilai Praktek minimal 55.
Misal Nilai Teori = 100, Nilai Praktek = 50 maka hasilnya = Tidak Lulus. Misalnya Nilai Teori = 40, Nilai Praktek = 90 maka hasilnya Lulus.
Melihat soal diatas, berarti kita mengetahui bahwa inputnya ada dua yaitu Nilai Teori dan Nilai Praktek. Mahasiswa akan berdasarkan dua hal yaitu nilai rata-rata dan nilai teori. Jadi sebelumnya kita harus mencari nilai rata-rata terlebih dahulu yaitu dengan menjumlahkan nilai teori dan praktek lalu dibagi dua. Program C++ selengkapnya untuk menjawab pertanyaan diatas adalah sebagai berikut :

01#include <iostream.h>
02#include <conio.h>
03 
04void main()
05     {
06     clrscr();
07     float teori, praktek, rata2;
08     cout<<"Masukkan nilai Teori : ";
09     cin>>teori;
10     cout<<"Masukkan nilai Praktek : ";
11     cin>>praktek;
12     rata2 = (teori + praktek) / 2;
13     if(rata2 >= 60 && praktek >= 55)
14     {
15          cout<<"Lulus";
16     }
17     else
18     {
19          cout<<"Tidak Lulus";
20     }
21     getch();
22}
Penjelasan Program :
Pertama-tama kita membuat 3 buah variabel yaitu teori, praktek dan rata2, ketiganya kita buat dengan tipe float yaitu tipe data yang dapat menyimpan nilai pecahan. Hal ini untuk antisipasi jika nanti hasil pembagian menghasilkan nilai pecahan. Selanjutnya program akan meminta inputan dari user untuk teori dan praktek.
Langkah selanjutnya program akan menghitung nilai rata2 yaitu jumlah teori dan praktek dibagi dua. Lalu dengan menggunakan pernyataan IF, program akan melakukan pengujian apakah nilai rata2 minimal 60 dan praktek minimal 55. Ingat disini bagian pengujian pada IF menggunakan operator DAN, jadi kedua ungkapan harus bernilai TRUE.
Jika hasilnya benar, maka akan ditampilkan “Lulus” dan

RAY OF LIGHT, Asli dan Palsu

Untuk mendapatkan ROL asli, sangat tergantung sama keberuntungan. Syaratnya matahari harus bersinar dengan cerah, dan kabut juga harus tebal. Saya pernah gagal untuk mendapatkan ROL, walaupun embun tebal, namun matahari ketutup sama awan.. dasar nasib..Jadi untuk mendapatkan ROL yang bagus, tidak cukup datang satu kali saja ke satu tempat, biasanya berkali-kali, atau yang paling gampang, lewat aja tiap hari , pasti suatu saat nemu yang paling bagus. Waktu motret biasanya saya lakukan sejak pukul 7.30 s/d maksimal 8.30 pagi, kadang masih bisa bagus walaupun sudah jam sembilanan. Saya selalu mengambil dalam format RAW, biar masih punya banyak celah untuk pengaturan selanjutnya, kalo udah jago setting di kamera mungkin langsung jpg aja kali yah..he.he. Foto yang saya jadikan contoh saya ambil dengan exposure 1/160 second dan Aperture 5.6, dengan exposure compensation saya turunin -2/3. ISO 100, FL 27mm. (Camera: 400D, Lensa Tamron 18-250). Sudut pengambilan juga sangat menentukan berhasil tidaknya mendapatkan ROL. Saya biasanya agak sedikit “menantang” matahari, biar dapatnya lebih seru.
Ini ada beberapa contoh print screen RAW Image, dengan perbedaan exposure:

Gambar 0-a.

Gambar 0-b.

Gambar 0-c.

Gambar 0-d.

Berikut ini contoh RAW image yang akan saya proses selanjutnya.

Gambar 1

Gambar 2

Kemudian dengan RAW Image Task 3.1 bawaan Canon, saya atur Digital Exposure Compensation diangka +0.4 dan White Balance di 6000K.

Gambar 3

Kemudian WB Shift Sumbu B-A di A1 dan sumbu G-M di G2. Hal ini saya lakukan dengan tujuan untuk menemukan tone yang saya inginkan. Kembali ke selera rekan-rekan kalu untuk pilihannya, tergantung selera masing-masing. Langkah berikutnya, saya Save ke dalam format JPG, agar diolah bisa diolah lanjutan di PSCS3. Sebagai tambahan info saja (buat yang belum tahu), PSCS3 bisa untuk melakukan proses RAW ini, kadang-kadang juga saya pergunakan, tapi untuk kesempatan ini tidak saya pakai.

Gambar 4

Gambar 5, Detail Setingannya.

Berikutnya, File JPG tersebut saya buka PSCS3.
Copy background image untuk di Filter Highpass dari Filter>Other>High Pass dengan nilai sekitar 1.6pxl. Kemudian Blend Mode di set Overlay, yang dimaksudkan untuk melakukan Sharpen saja. Selain cara ini bisa dilakukan dengan Filter Sharpen, silakan dipilih. Langkah terakhir, saya atur Brightness/Contras dengan brightness di +6 dan Contras tetap 0. Selanjutnya, karena biasanya pengen diupload, saya resize dengan sisi ukuran terbesar ke 900 pxl, dan kemudian biasanya saya merubah “canvas size” ke 900x900pxl, terus kasih background Hitam. Untuk ROL aseli hanya sampai di sini saja, dan fotonya bisa dilihat di sini


Kalo masih berminat, juga masih bisa dilakukan burn and dodge ditempat yang diinginkan.
Kesimpulan dari olahan di atas, sebenarnya yang dilakukan hanya pengaturan White Balance, Save ke JPG, dan sedikit atur Brightness/Contras saja. Tidak ada olahan yang luar biasa yang dilakukan.

B. ROL Palsu (Tambahan)
Bagi yang masih belum puas dengan ROL aselinya, masih bisa ditambahin dengan ROL Palsu kalo mau (bukan aseli dari saya caranya).
Sebagai catatan, ROL tambahan ini akan muncul jika ada backlicght. Karena gambar ini pada dasarnya sudah memiliki backlight, jadi bisa langsung diaplikasikan. Jika tidak ada, “terpaksa” harus dibuat backlight dengan overlay layer baru dengan warna tertentu (misal Kuning), kemudian Opocity diturunkan, Masalah yang timbul, kita harus melakukan Musking terhadap POI, dan ini pastinya memerlukan waktu.
Langkah Pertama adalah membuat layer baru, kemudian select kotak kecil saja, dan Fill 50% gray. Tambahkan noise dari Filter>noise>add noise, dengan settingan: Amount 400%, Distribution: Gaussian, Monochromatic di centang.

Gambar 6

Kemudian digedein Kotak kecil tersebut di resize secukupnya.

Gambar 7

Langkah berikutnya, Pilih Filter>Blur>Motion Blur.
Lakukan minimal 2 kali atau sesuai selera dan kebutuhan.

Gambar 8

Kemudian Pilih menu Edit>Transform>Distort, dan atur aja sesuai dengan arah datangnya cahaya.

Gambar 9

Kemudian langkah terakhir, pilih blend modenya di softlight. Dan jangan lupa untuk melakukan blur dengan filter blur (Filter>blur>Gaussianblur) agar ROL nya “agak” alami. Untuk menguatkan ROL nya, bisa dengan menaikkan kontrasnya melalui Menu “Level” atau “Curve”. Untuk finishing, bisa dilakukan Musking di Bagian Rumput bawah saja (lihat layer 1 copy, di Gambar 10.)

Gambar 10.

Hasil akhirnya bisa dilihat di Gambar 11

Gambar 11. Perbandingan RAW preview, Pengaturan WB &B/C (Original ROL), Dengan tambahan Artificial ROL
Semoga masih ada manfaatnya.

Tool-tool photoshop

Menu

1. File
Berkaitan dengan file seperti menyimpan, membuka, export, import, dan cetak.
2. Edit
Menu editing secara umum seperti cut, copy, paste, transform image, serta untuk mengatur preferences Adobe Photoshop.
3. Image
Berisi editing image untuk mengatur warna, hue/saturation, brightness/contrast, ukuran.
4. Layer
Berkaitan dengan manajemen layer pada image, seperti menambah layer, menghapus, menambah efek pada layer, serta masking.
5. Select
Berkaitan dengan selection image.
6. Filter
Berhubungan dengan pada Photoshop yang dapat digunakan untuk memberi Efek tertentu pada image.
7. View
Digunakan untuk pengaturan view seperti zooming image, menampilkan skala, dan sebagainya.
8. Window
Digunakan untuk mengatur / menampilkan window
9. Help
Untuk menampilkan help dan tutorial Adobe Photoshop.
2. Tool Option Bar

Hampir semua tool pada Toolbox memiliki options, yang ditampilkan pada Tool Option bar. Options tersebut digunakan untuk mengatur nilai parameter atau
option dari tool yang sedang aktif/dipilih. Sebagai contoh :

Setelah nilai parameter pada tool option bar diubah-ubah , (kita dapat mengembalikannya lagi menjadi nilai default (nilai semula). Yaitu dengan memilih icon tool yang ada di sebelah kiri, kemudian klik tombol . Pada context menu yang muncul, pilih Reset Tool untuk mengembalikan nilai default dari tool yang sedang dipilih. Apabila ingin mengembalikan nilai default semua tools, pilih Reset All Tools.

Sumber : Sigit Eko

Tool-tool photoshop

Tinggalkan Komentar

A. SELECTION TOOL
  • A.1. Marquee Tool
    Saat kita klik Marquee Tool kita bisa melihat ada 4 jenis marquee tool
    1. Rectangular Marquee (Shortcut keyboard: M, atau Shift + M)
    Digunakan untuk membuat area selection berbentuk segi empat pada image.
    2. Elliptical Marquee (Shortcut keyboard: M, atau Shift + M)
    Digunakan untuk membuat area selection berbentuk elips atau lingkaran pada image.
    3. Single Row Marquee
    Digunakan untuk membuat area selection satu baris pada image (ukuran tinggi selection adalah 1 pixel)
    4. Single Column Marquee
    Digunakan untuk membuat area selection satu kolom pada image (ukuran lebar selection adalah 1 pixel).
  • A.2. Move Tool
    Shortcut keyboard: V
    Digunakan untuk menggeser/memindah selection, layers, dan guides.
  • A.3. Lasoo Tool
    (Shortcut keyboard: L, atau Shift + L untuk mengubah jenis Lasoo) Terdiri dari 3 jenis yaitu:
    1. Lasoo
    Digunakan untuk membuat area selection dengan bentuk bebas
    2. Polygonal Lasoo
    Digunakan untuk membuat area selection berbentuk polygon
    3. Magnetic Lasoo
    Digunakan untuk membuat area selection dengan cara menempelkan
    tepi selection pada area tertentu pada image.
  • A.4. Magic Wand Tool
    Shortcut keyboard: W
    Digunakan untuk membuat area selection yang memiliki warna serupa.Perbedaan toleransi warna dapat diatur pada tool option bar.
B. CROP & SLICE TOOL
  • B.1. Crop Tool
    Shortcut keyboard: C
    Digunakan untuk memangkas image (memotong dan membuang area tertentu dari image)
    B.2. Slice Tool
    (Shortcut keyboard: K, atau Shift + K untuk mengubah slice)
    Terdiri dari 2 jenis yaitu:
    1. Slice Tool
    Digunakan untuk membuat potongan-potongan dari suatu image
    2. Slice Select Tool
    Digunakan untuk memilih potongan pada suatu image
C. RETOUCHING TOOL
  • C.1. Patch/Healing Brush Tool
    (Shortcut keyboard: J, atau Shift + J mengubah tool)
    1. Patch Tool
    Digunakan untuk mengecat/melukis pada area tertentu image dengan pola (pattern) atau sample tertentu. Cocok untuk memberbaiki image yang rusak.
    2. Healing Brush Tool
    Digunakan untuk mengecat/melukis image dengan pola atau sample tertentu. Cocok untuk memperbaiki image yang agak rusak.
  • C.2. Stamp Tool
    (Shortcut keyboard: S, atau Shift + S untuk mengubah tool) terdiri dari 2 jenis yaitu:
    1. Clone Stamp Tool
    Digunakan untuk melukis image dengan sample image tertentu
    2. Pattern Stamp Tool
    Digunakan untuk melukis image dengan menggunakan pola tertentu
  • C.3. Eraser Tool
    (Shortcut keyboard: E, atau Shift + E untuk mengubah jenis eraser)
    Terdiri dari 3 jenis yaitu:
    1. Eraser
    Digunakan untuk menghapus pixel image dan mengembalikannya ke state tertentu.
    2. Background Eraser
    Digunakan untuk menghapus area tertentu image menjadi transparan.
    3. Magic Eraser
    Digunakan untuk menghapus area tertentu image yang memiliki warna yang serupa menjadi transparan dengan satu kali klik.
  • C.4. Sharpen, Blur, Smudge Tool
    (Shortcut keyboard: R, atau Shift + R)
    1. Sharpen Tool
    Digunakan untuk menajamkan area tertentu pada image.
    2. Blur Tool
    Digunakan untuk menghaluskan/mengaburkan area tertentu pada image.
    3. Smudge Tool
    Digunakan untuk menggosok/mencoreng area tertentu pada image
  • C.5. Dodge, Burn, Sponge Tool
    (Shortcut keyboard: O, atau Shift + O)
    1. Dodge Tool
    Digunakan untuk menerangkan warna di area tertentu pada image
    2. Burn Tool
    Digunakan untuk menggelapkan warna di area tertentu pada image
    3. Sponge Tool
    Digunakan untuk mengubah saturation di area tertentu pada image.
D. PAINTING TOOL
  • D.1. Brush Tool
    (Shortcut keyboard: B, atau Shift + B untuk mengubah tool) Terdiri dari 2 jenis yaitu:
    1. Brush Tool
    Digunakan untuk melukis image dengan goresan kuas
    2. Pencil Tool
    Digunakan untuk melukis image dengan goresan pencil
  • D.2. History Brush Tool
    (Shortcut keyboard: Y, atau Shift + Y untuk mengubah jenis)
    Terdiri dari 2 jenis yaitu:
    1. History Brush Tool
    Digunakan untuk melukis image menggunakan snapshot atau state history dari Image
    2. Art History Tool
    Digunakan untuk melukis image menggunakan snapshot atau state
    history dari image, dengan model artistik tertentu.
  • D.3. Gradient, Paint Bucket Tool
    (Shortcut keyboard: G, atau Shift + G)
    1. Gradient Tool
    Digunakan untuk mengecat area yang dipilih (selected area) dengan
    perpaduan banyak warna.
    2. Paint Bucket Tool
    Digunakan untuk mengecat area yang dipilih dengan warna foreground
    atau pola tertentu.
E. DRAWING AND TYPE TOOL
  1. E.1. Selection Tool
    (Shortcut keyboard: A, atau Shift + A untuk mengubah jenis) Terdiri dari 2 jenis yaitu:
    1. Path Selection Tool
    Digunakan untuk melakukan selection path
    2. Direct Selection Tool
    Digunakan untuk mengubah anchor dan direction point dari path.
    E.2. Type Tool
    (Shortcut keyboard: T, atau Shift + T untuk mengubah jenis) Terdiri dari 4 jenis yaitu:
    1. Horizontal Type Tool
    Digunakan untuk membuat tulisan secara horizontal
    2. Vertical Type Tool
    Digunakan untuk membuat tulisan secara vertikal
    3. Horizontal Type Mask Tool
    Digunakan untuk membuat selection berbentuk tulisan secara horizontal
    4. Vertical Type Mask Tool
    Digunakan untuk membuat selection berbentuk tulisan secara vertikal
  2. E.3. Pen Tool
    1. Pen Tool
    (Shortcut keyboard: P, atau Shift + P)
    Digunakan untuk membuat path dengan lengkung-lengkung yang halus
    2. Freeform Pen Tool
    (Shortcut keyboard: P, atau Shift + P)
    Digunakan untuk membuat path berbentuk bebas (sesuka kita )
    3. Add Anchor Point Tool
    Digunakan untuk menambah anchor point atau titik editor pada path
    4. Delete Anchor Point Tool
    Digunakan untuk menghapus anchor point tertentu pada path
5. Convert Point Tool
Digunakan untuk mengubah anchor dan direction point tertentu pada path
  • E.4. Shape Tool
    (Shortcut keyboard: U, atau Shift + U untuk mengubah jenis)
    1. Rectangle Tool
    Digunakan untuk menggambar bentuk segi empat
    2. Rounded Rectangle Tool
    Digunakan untuk menggambar segi empat melengkung
    3. Ellipse Tool
    Digunakan untuk menggambar ellipse
    4. Polygon Tool
    Digunakan untuk menggambar polygon
    5. Line Tool
    Digunakan untuk menggambar garis lurus
    6. Custom Shape Tool
    Digunakan untuk menggambar bentuk tertentu dari daftar bentuk yang ada
F. ANNOTATION, MEASURING & NAVIGATION TOOL
  • F.1. Notes Tool
    (Shortcut keyboard: N, atau Shift + N untuk mengubah jenis)
    1. Notes Tool
    Digunakan untuk membuat catatan pada image seperti copyright.
    2. Audio AnnotationTool
    Digunakan untuk membuat suara/audio pada image
  • F.2. Eyedropper, Measure Tool
    (Shortcut keyboard: I, atau Shift + I)
    1. Eyedropper Tool
    Digunakan untuk mengambil sample warna pada image untuk warna
    foreground
    2. Color Sampler Tool
    Digunakan untuk mengambil berbagai sample warna pada image
    3. Measure Tool
    Digunakan untuk mengukur jarak atau sudut pada image
  • F.3. Hand Tool
    Shortcut keyboard: H
    Digunakan untuk menggeser/memindah bidang pandang image di dalam window view area.
  • F.4. Zoom Tool
    Shortcut keyboard: Z
    Digunakan untuk memperbesar atau memperkecil tampilan image.
  • F.5. Background and foreground color
    Supaya default tekan tombol D maka warna foreground dan background menjadi putih dan hitam. Untuk menukar warna background dan foreground tekan tombol X.
  • F.6. Normal and Quickmask Mode
    Normal Mode : Semua fungsi seperti brush akan berjalan seperti biasanya. Quickmask Mode : fungsi brush bisa dipakai untuk seleksi cuman jika setelah proses quickmask maka yang diseleksi malah dibagian luar nya.
  • F.7. Screen Mode
    Untuk melihat tampilan area kerja windows.

Tool-tool lain yang penting di Adobe Photoshop

Tinggalkan Komentar
Masih ada beberapa tool yang mungkin berguna 
1. FILL
Edit > fill
Berfungsi untuk memberi warna di dalam area seleksi atau warna keseluruhan kalau tidak ada seleksi. Warna bisa diatur didalam windows option nya.
2. STROKE
Edit > stroke
Berfungsi untuk mewarnai garis di area seleksi. Ketebalan dan warna bisa diatur di dalam window option nya.
3. TRANSFORM
Edit > Transform
Tool ini untuk mentransformasi gambar di dalam layer tertentu.
Scale : untuk merubah besar kecilnya suatu gambar
Rotate : untuk memutar gambar
Skew, distorsi, perspektif, warp : untuk merubah bentuk gambar sesuai keinginan kita.
Rotate 180 : untuk memutar gambar sebesar 180 derajat.
Rotate 90 CW : untuk memutar gambar sebesar 90 derajat searah jarum jam
Rotate 90 CCW : untuk memutar gambar sebesar 90 derajat berlawanan arah jarum jam.
Flip horizontal : untuk memirror gambar kearah Horizontal
Flip Vertikal : untuk memirror gambar kearah Vertikal.
4. MODE
Image > Mode
Untuk merubah system pewarnaan, diantaranya :
- RGB : Red, Green, Blue
- CMYK : Cyan Magenta Yellow Black
- Grayscale : untuk warna Hitam Putih.
5. ADJUSTMENT
Image > adjustment
Untuk menentukan terang gelapnya gambar ( Brightness/Contrast. Dan bisa pula untuk menentukan warna ( Hue/Saturation )
6. IMAGE SIZE
Image > image size
Untuk merubah besar kecilnya suatu gambar. Bedanya dengan di tool transform adalah seluruh image berubah nilai besar kecilnya.
7. CANVAS SIZE
Image > canvas size
Untuk merubah besar kecilnya background. Dan ini akan membuat gambar di layer menjadi terpotong.
8. ROTATE CANVAS
Image > Rotate Canvas
Untuk memutar background beserta gambar yang ada didalam area gambar.
9. INVERSE
Select > inverse
Untuk menyeleksi yang bukan area seleksi sebelumnya. Tool ini berfungsi hanya jika ada image atau layer yang terseleksi.
10. FEATHER
Select > feather
Untuk memperhalus atau membuat blur suatu gambar yang sudah terseleksi. Ini biasanya digunakan pada saat pemisahan suatu objek gambar dengan background nya.
11. EFFECT
Tool untuk membuat effect ini ada semua di dalam toolbar filter.
12. RULER
View > ruler
Untuk menampilkan ukuran di area gambar. Ukuran bisa disetting dengan cara klik kanan di ruler area gambar maka akan muncul satuan ukuran yang akan digunakan. Seperti pixel, cm , inches, dll.
Kalau kita drag ruler ke dalam area gambar maka akan muncul suatu garis bantu berwarna biru terang. Dan garis bantu ini tidak akan tercetak kalau kita print.
13. SNAP
View > snap
Untuk menempatkan gambar dengan pas sesuai dengan keinginan kita. Kalau kita drag suatu objek gambar dan kita sudah mengaktifkan tool snap ini maka kita tidak perlu susah-susah untuk menempatkan gambar. Kita bisa menempatkan gambar pas ditengah, di pinggir atau pada garis bantu.
14. MENAMPILAKAN TOOL
Untuk menampilan tool kita cukup dengan mengklik toolbar windows maka akan muncul tool yang akan kita pakai. Seperti layer, color, history, brush dll.
Kalau ada yang masih kurang dan mau tanya tool yang belom dimengerti silahkan tanya aja langsung melalui komentar.. Insya Allah akan saya jelasin.

Mengubah Background photo dengan Extract

utorial photoshop kali ini tentang bagaimana cara memisahkan Ojek Objek dengan background nya.. sebenernya ada banyak cara sih.. tutorial sebelum-sebelum nya juga udah pernah dibahas kok.. Tapi kali ini saya coba pake cara EXTRACT…
Langsung aja deh yaa ..
Buka photo yang mau diedit..

Sekarang kita langsung pisahin objek sama background nya… Klik FILTER > EXTRACT
di jendela extract ada menu-menu juga :

Highlighter tool : untuk menandai (masking)  batas antara background dan objek yang mau dipisahin.
Brush tool : untuk menandai (masking)  area yang mau dipisahin
Eraser Tool : menghapus masking jika ada kesalahan
Eyedropper tool : untuk menentukan warna sesuai dengan sample nya..
Clean Up tool : hanya muncul kalau hasil masking di preview ini gunanya untuk merapikan hasil masking dengan menghapus
Edge TouchUp TOol : Hanya muncul kalau hasil masking sudah dipreview , gunanya untuk merapikan hasil masing dengan cara menambah.
Zoom tool : Untuk memperbesar atau memperkecil gambar ( klik untuk memperbesar, ALT+ klik untuk memperkecil)
Hand tool : untuk menggerakan jendela gambar
Sekarang klik Highlighter tool , drag di perbatasan antara background dan objek ..

Bisa di zoom gambarnya untuk objek yang perlu detail pengerjaan nya.. Untuk membersar kecilkan brush cukup menekan tombol [ atau ]
[ : untuk mengecilkan brush
] : untuk membersarkan brush
Seleksi Semua nya sampai detail-detailnya seperti rambut ..

Kalo sudah beres semua, Klik brush tool, lalu klik di area yang akan diambil objeknya..

Klik Tombol Preview untuk melihat hasilnya … biasanya sih pasti ada yang kurang.. misalnya masih blom rapi, ada bagian yang mau kita ambil tapi kepotong.. dan lain-lain..
Gimana cara beresinnya ?
GUnakan clean up tool dan edge touch up tool
Bersihkan dengan clean up tool kalo masih kurang rapi, dan kalo ada bagian yang kehapus, gunakan touch up tool.. penggunaan nya tinggal drag & drop aja kok..

Hasilnya kira-kira nanti begini ..

Sekarang buka gambar Background yang lain, saya pake gambar situasi Broadway..

Drag Foto yang tadi diedit ke gambar background yang lain

Atur sedemikian rupa .. lalu cari pencahayaan dan pewarnaan supaya serasi dengan background. Bisa juga menggunakan Hue/saturation untuk penyesuaian.. bisa dicari-cari kok.. itu sangat menyenangkan hehehe..

Kita beri efek lagi..
Klik Add new fill and adjustment layer > Channel Mixer

Atur Channel mixer nya :

Bisa ditambahin dengan new fill and adjustment yang lain… silahkan bermain-main aja..
yang paling penting cara cropping nya harus bener..

Hasilnya :

Selamat Mencoba !