Wednesday, August 14, 2013

Exemplo de CGI-BIN:

Tarefa 1 - repetir o exemplo de multiplicação do tutorial:

http://www.cs.tut.fi/~jkorpela/forms/cgic.html

Tarefa 2 - Fazer um programa com cgi-bin para receber um formulario com dados, armazenar em disco e exibir uma mensagem de envio para o usuário.


Monday, August 12, 2013

Bem vinda turma 2013!

Bem vindo turma 2013!

Neste curso serão apresentados técnicas e linguagens para programação voltada à internet - client side e server side.  Serão abordadas as linguagens: HTML, PHP e Java.

Peço que cada aluno seja um following deste blog e crie seu próprio blog no www.blogger.com. Por aqui vocês irão fazer o post de seus trabalhos.

Monday, July 30, 2012

Bem vindo turma 2012!

Neste curso serão apresentados técnicas e linguagens para programação voltada à internet - client side e server side.  Serão abordadas as linguagens: HTML, PHP e Java.

O curso terá avaliação por meio de duas provas, um projeto final de curso e exercícios. A média final será a 65% das médias das provas (MP) + 30% do projeto (MPj) + 5% média dos exercícios (ME).
Regra importante NF = 0.65 * MP + 0.3 * MPj + 0.05 * ME , desde que MP > 5 , MPj > 5 e ME > 5. Se MP<5 ou MPj<5 ou ME < 5 então NF = min(MP,MPj,ME)

Peço que cada aluno seja um following deste blog e crie seu próprio blog no www.blogger.com. Por aqui vocês irão fazer o post de seus trabalhos.



Wednesday, August 10, 2011

cgi-bin tutorial

http://www.cs.tut.fi/~jkorpela/forms/cgic.html

Tuesday, November 30, 2010

Notas da primeira prova

Aluno1 - 3,0
Aluno2 - 4,5
Aluno3 - 10,0
Aluno4 - 10,0
Aluno5 - 0,5

para quem não lembra o número de sua prova, me enviei um e-mail

Tuesday, November 16, 2010

enviando parâmetro do HTML para a Applet

void setup() {
size(100, 100);

// Read the value "51" from the following text embedded in an HTML page:
// <applet code="param_example" archive="param_example.jar" width=100 height=100>
// <param name="back" VALUE="51">
// </applet>
String bgcolorStr = param("back");

int bgcolor = int(bgcolorStr);
//int bgcolor = 51;
background(bgcolor);
}

Message Dialog

import javax.swing.JOptionPane;

String firstNumber;

firstNumber = JOptionPane.showInputDialog( "Enter first integer" );
JOptionPane.showMessageDialog(null, "The sum is " + firstNumber, "Results",JOptionPane.PLAIN_MESSAGE );

Interface AWT no processing

import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class exemplo_awt extends PApplet implements ActionListener{

float r, ang;
// tipos do AWT
Button okButton;
Button wrongButton;
TextField nameField;


public void setup()
{
size(400, 400); // define o tamnho da tela
background(255); // define a cor de fundo como branco
r = min(width,height) / 2 * 0.9f;
ang = 0;
//
setLayout(new FlowLayout());
okButton = new Button("Action!");
wrongButton = new Button("Don't click!");
nameField = new TextField("Type here Something",35);
//
add(okButton);
add(wrongButton);
add(nameField);
//
// Attach actions to the components
okButton.addActionListener(this);
wrongButton.addActionListener(this);
}

public void draw()
{
background(255);
star(r, 5, 3, ang);
ang += 0.01f;
}

public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == okButton){
nameField.setText("OK button!");
repaint();
}

if (evt.getSource() == wrongButton){
nameField.setText("Wrong button!");
repaint();
}
}

public void star(float raio, float lado, float divisor, float angulo)
{
float next, k, i,inc,y0,x0,y1,x1,pi=3.141596f;
float pi2 = 2*pi;
inc = pi2/lado;
k = divisor;
next = inc * k;
for(i=angulo;i<=pi2+angulo;i+=inc)
{
x0 = sin(i)*raio;
y0 = -cos(i)*raio;
x1 = sin(i+next)*raio;
y1 = -cos(i+next)*raio;
line(width/2+round(x0),height/2+round(y0),width/2+round(x1),height/2+round(y1));
}
}


}

Monday, September 13, 2010

detectar Navegador

http://techpatterns.com/downloads/php_browser_detection.php

Monday, August 30, 2010

Exercício contador/log

Desenvolver um contador de visitas com log.

Ele deve exibir na página o número de visitas.
O contador deve gerar um log para o administrador. Deverá gravar a hora da visita, o sistema operacional e o browser do visitante.
Estes dados devem ser armazenados em um arquivo separado que não é informado ao internauta.

Tuesday, August 24, 2010

Exercício loteria com funções

Usando o exercício da loteria,
refazer o exercício com funções.

Desenvolver uma função para o sorteio, que deve retornar um valor (1, 2 ou 3) para as colunas 1, X ou 2
Desenvolver uma função para desenhar as linhas da loteria
Desenvolver uma função loteria, onde é especificado o número de linhas e as cores de fundo

Usar arquivos em html separados, para o cabecalho e o radapé da página, que deverão ser inseridos na página via include.

Friday, December 4, 2009

notas da prova 2

Bruno - aluno1 - 1,7
Camila - aluno2 - 7,0
Carlos Augusto - aluno3 - 6,0
Jose Ricardo - aluno4 - 4,5
Juliana - aluno5 - 5,0
Krissia - aluno6 - 3,75
Luisa - aluno7 - 5,0
Marcelo - aluno8 - 2,0
Mario - aluno9 - 0
Vinicius - aluno10 - 3,0
Elder - aluno11 - 1,5

Wednesday, November 25, 2009

parametros no processing

void setup() {
size(100, 100);

// Read the value "51" from the following text embedded in an HTML page:
// <applet code="param_example" archive="param_example.jar" width=100 height=100>
// <param name="back" VALUE="51">
// </applet>
String bgcolorStr = param("back");
int bgcolor = int(bgcolorStr);
background(bgcolor);
}

parametros de html para applet

Here is the code for the Java Program :
import java.applet.*;
import java.awt.*;

public class appletParameter extends Applet {
private String strDefault = "Hello! Java Applet.";
public void paint(Graphics g) {
String strParameter = this.getParameter("Message");
if (strParameter == null)
strParameter = strDefault;
g.drawString(strParameter, 50, 25);
}
}

Here is the code for the html program :
<HTML>
<HEAD>
<TITLE>Passing Parameter in Java Applet</TITLE>
</HEAD>
<BODY>
This is the applet:<P>
<APPLET code="appletParameter.class" width="800" height="100">
<PARAM name="message" value="Welcome in Passing parameter in java applet example.">
</APPLET>
</BODY>
</HTML>

There is the advantage that if need to change the output then you will have to change only the value of the param tag in html file not in java code.

Friday, November 20, 2009

Notas da primeira prova

5881890 - 7,0
6511182 - 8,5
3141959 - 8,5
6511216 - 0
6511202 - 0
6416664 - 5,5
5881886 - 5,75
5633753 - 8,0
6418897 - 8,0
6418862 - 1,0
6511108 - 8,5
6418900 - 0
6418622 - 9,0

Thursday, November 19, 2009

interface AWT evento

package processing1;

import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import processing.core.PApplet;



public class estrela2 extends PApplet implements ActionListener{

float r, ang;
// tipos do AWT
Button okButton;
Button wrongButton;
TextField nameField;


public void setup()
{
size(400, 400); // define o tamnho da tela
background(255); // define a cor de fundo como branco
r = min(width,height) / 2 * 0.9f;
ang = 0;
//
setLayout(new FlowLayout());
okButton = new Button("Action!");
wrongButton = new Button("Don't click!");
nameField = new TextField("Type here Something",35);
//
add(okButton);
add(wrongButton);
add(nameField);
//
// Attach actions to the components
okButton.addActionListener(this);
wrongButton.addActionListener(this);
}

public void draw()
{
background(255);
star(r, 5, 3, ang);
ang += 0.01f;
}

public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == okButton){
nameField.setText("OK button!");
repaint();
}

if (evt.getSource() == wrongButton){
nameField.setText("Wrong button!");
repaint();
}
}

inteface AWT para Applet

package processing1;

import java.awt.*;
import processing.core.PApplet;



public class estrela1 extends PApplet {

float r, ang;
// A Button to click
Button okButton;
// A textField to get text input
TextField nameField;
// A group of radio buttons
// necessary to only allow one radio button to be selected at the same time.
CheckboxGroup radioGroup;
// The radio buttons to be selected
Checkbox radio1;
Checkbox radio2;
// An independant selection box
Checkbox option;

public void setup()
{
size(400, 400); // define o tamnho da tela
background(255); // define a cor de fundo como branco
r = min(width,height) / 2 * 0.9f;
ang = 0;
//
// Tell the applet not to use a layout manager.
setLayout(null);
// initialze the button and give it a text.
okButton = new Button("A button");
// text and length of the field
nameField = new TextField("A TextField",100);
// initialize the radio buttons group
radioGroup = new CheckboxGroup();
// first radio button. Gives the label text, tells to which
// group it belongs and sets the default state (unselected)
radio1 = new Checkbox("Radio1", radioGroup,false);
// same but selected
radio2 = new Checkbox("Radio2", radioGroup,true);
// Label and state of the checkbox
option = new Checkbox("Option",false);

// now we will specify the positions of the GUI components.
// this is done by specifying the x and y coordinate and
//the width and height.
okButton.setBounds(20,20,100,30);
nameField.setBounds(20,70,100,40);
radio1.setBounds(20,120,100,30);
radio2.setBounds(140,120,100,30);
option.setBounds(20,170,100,30);

// now that all is set we can add these components to the applet
add(okButton);
add(nameField);
add(radio1);
add(radio2);
add(option);
//
}

Saturday, September 19, 2009

exercício formulários

Montar uma fomulários complexo
que tenha radiobutton, checkbox e várias entradas de texto.
organizar as variávies dos formulários por vetores

a) verificar se os campos foram selecionados

b) verificar os estados do radiobutton e do checkbox

o código fonte para os formulários está em http://mandelbrot.ifsc.usp.br/form.zip