Ir ao conteúdo
  • Cadastre-se

Luuuizmb

Membro Pleno
  • Posts

    44
  • Cadastrado em

  • Última visita

posts postados por Luuuizmb

  1. Olá,

     

    Eu tenho o seguinte problema:

    Estão dispostos os números de 0 a 7 em círculo na ordem crescente e em sentido horário.

    O programa recebe 4 números e eu devo comparar se o "espaço" entre esses pares de números é o mesmo.

     

    Ex: 7 - 2 e 6 - 1 (perceba que de 7 até 2 são 3 espaços ~ 7 * 0 * 1 * 2 e de 6 até 1 são também 3 espaços ~ 6 * 7 * 0 * 1

    * representa os espaços

     

    Alguém tem alguma ideia de como posso implementar isso? Só posso utilizar desvios condicionais, laços e vetores de uma dimensão.

    Att.

    • Curtir 1
  2. Olá,

     

    Eu tenho um programa em C que lê os valores de uma progressão qualquer até o número 4.000.000.000.

    O programa compila e executa perfeito no dev quando eu uso a declaração de variáveis no tipo: long long int.

     

    Porém ao executar no linux, aparece que "long long int" não está definido para C90.

    E o programa tem que rodar no linux para que esteja certo.

     

    Alguém tem alguma sugestão para corrigir?

  3. Suponhamos o seguinte exemplo:

    #include <stdio.h>
    
    int main(){
    	
    	int b1,b2,b3;
    	char z1,z2,z3;
    	
    	scanf("%d %d %d", &b1,&b2,&b3);
    	if(b1 == 1){
    		z1 = 'A';
    	}
    	if(b2 == 2){
    		z2 = 'B';
    	} else {
    		z2 = 0;
    	}
    	if(b3 == 3){
    		z3 = 'C';
    	}
    	
    	printf("%c%c%c", z1,z2,z3);
    	return 0;
    	
    }

    Se a entrada for 1 1 3 (por exemplo) a saída será A C (com esse espaço entre as letras). Eu gostaria de saber como remover esse espaço sem usar funções, laços de repetição ou coisa do tipo, somente o básico. Sei que o exemplo é tosco, mas é só para exemplificar o que eu desejo.

    • Curtir 1
  4. Olá pessoal,

     

    Sou iniciante no arduíno, e logo num teste simples com LED não deu nada certo.
    Informações:
    Arduino UNO
    Resistores de 330 ohms
    Led da placa acende normal
    Led "ON" também aceso normalmente
    Tanto a placa como o a porta estão definidas no menu "Ferramentas" da IDE

     

    Observem por exemplo esse projeto simples:
    https://arduinobymyself.blogspot.com.br/2012/02/primeiro-teste-com-o-led-blink.html

     

    Fiz conforme explicado, mas o led não acende. Na verdade o que acontece depois que compilo o código, é que o LED laranja da própria placa do arduíno fica piscando, e não o LED vermelho que está na protoboard.

     

    O que está acontecendo de errado?

  5. Olá,

     

    Comprei recentemente um headset da leadership 1747 (USB). Ao tentar conectar no computador nada aconteceu! Fui na aba "som" do computador e estava escrito que o fone de ouvido não estava conectado. Ao tentar ligar o som, tocava somente nas caixas de som normais. Tentativas:

    1º - Ligar nas entradas USB frontal e dianteiras

    2º - Desconectar as caixas de som e deixar somente o fone

    3º - Tentar atualizar o driver de som do meu computador (realtek - o sistema diz que já está atualizado).

    4º - Tentar achar algum drive para esse dispositivo (não encontrei)

    5º - O objeto veio sem nenhum CD de instalação

     

    Nada disso resultou! Possuo o WINDOWS 7.

    Preciso muito de ajuda. Obrigado.

  6. Olá,

    Eu peguei esse código para listar os arquivos de um diretório e criar um link ṕara cada um - e ao clicar fazer o download do arquivo.
    Ele até lista com o link, mas não faz o download e dá erro. Alguém pode me ajudar?

    <?php //ListaDir.php$dir = (empty($_GET['dir'])) ? "/home/u434142337/public_html/Arquivos/" : $_GET['dir'];$listDir = scandir($dir, 1);$total = count($listDir);//Verificando total do arrayfor($i = 0; $i < $total; $i++){//Percorre todo o arrayif(is_dir($listDir[$i])){//Verifica se é arquivo ou diretório$listing .= "<a href=\"ListaDir.php?dir=" . $listDir[$i] . "\">" . $listDir[$i] . "</a><br />";} else {$listing .= "<a href=\"http://www." . $dir . $listDir[$i] . "\" target=\"_blank\">Download(" . $listDir[$i] . ")</a>";}}echo $listing;//Imprimindo o resultado?>
  7. Olá,

     

    O que quero fazer é bem simples. Um local onde as pessoas façam o upload de seus arquivos e estes arquivos irem para uma pasta que eu criei especialmente para no servidor. Eu tentei fazer e aqui está:

    http://demolay2015.pe.hu/Enviar.html

     

    Só que ao tentar enviar alguma coisa dá o seguinte erro:

     

    Warning: move_uploaded_file(..public_html/Arquivos/brasao.png): failed to open stream: No such file or directory in /home/u434142337/public_html/recebe.php on line 15

    Warning: move_uploaded_file(): Unable to move '/tmp/phpSeohHA' to '..public_html/Arquivos/brasao.png' in /home/u434142337/public_html/recebe.php on line 15

     

    Abaixo estão os códigos das páginas enviar.html e recebe.php! O local onde será salvo os arquivos é uma pasta do site chamada "Arquivos".

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Enviar</title></head><form method="post" action="recebe.php" enctype="multipart/form-data"><fieldset>	<label for="doc">Seu documento:</label>	<input type="file" name="arquivo" id="documento" />	<input type="submit" value="Salvar" /></fieldset></form><body></body></html>
    <?php	// O nome original do arquivo no computador do usuário	$arqName = $_FILES['arquivo']['name'];	// O tipo mime do arquivo. Um exemplo pode ser "image/gif"	$arqType = $_FILES['arquivo']['type'];	// O tamanho, em bytes, do arquivo	$arqSize = $_FILES['arquivo']['size'];	// O nome temporário do arquivo, como foi guardado no servidor	$arqTemp = $_FILES['arquivo']['tmp_name'];	// O código de erro associado a este upload de arquivo	$arqError = $_FILES['arquivo']['error'];	if ($arqError == 0) {		$pasta = '..public_html/Arquivos/';		$upload = move_uploaded_file($arqTemp, $pasta . $arqName);	}?>
  8. Olá,

     

    No meu site tem um campo para cada pessoa fazer o "upload" de sua imagem de perfil. O problema é que eu não quero salvar essas imagens no meu servidor (pois ele tem pouco espaço). Eu queria uma maneira da pessoa fazer o upload e essa imagem ficar salva em outro lugar. Ou por exemplo colocar o código de um site de hospedagem de imagem que ao fazer o upload ele me retorna a URL.

     

    Podem me ajudar?

  9. Olá,

     

    Tenho uma página em php que estou modificando com um template encontrado na internet:

    <?php session_start();include("Conexao/conexao.php");include("A_valida.php");isset($_SESSION['rank']) ? $a = $_SESSION['rank'] : $a = null;isset($_SESSION['nome']) ? $b = $_SESSION['nome'] : $b = null;isset($_SESSION['codigo']) ? $c = $_SESSION['codigo'] : $c = null;?><!DOCTYPE html><html lang="en"><head>    <title>Tesouraria</title>    <meta charset="utf-8">    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <link rel="shortcut icon" href="images/icons/favicon.ico">    <link rel="apple-touch-icon" href="images/icons/favicon.png">    <link rel="apple-touch-icon" sizes="72x72" href="images/icons/favicon-72x72.png">    <link rel="apple-touch-icon" sizes="114x114" href="images/icons/favicon-114x114.png">    <!--Loading bootstrap css-->    <link type="text/css" rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,300,700">    <link type="text/css" rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700,300">    <link type="text/css" rel="stylesheet" href="styles/jquery-ui-1.10.4.custom.min.css">    <link type="text/css" rel="stylesheet" href="styles/font-awesome.min.css">    <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">    <link type="text/css" rel="stylesheet" href="styles/animate.css">    <link type="text/css" rel="stylesheet" href="styles/all.css">    <link type="text/css" rel="stylesheet" href="styles/main.css">    <link type="text/css" rel="stylesheet" href="styles/style-responsive.css">    <link type="text/css" rel="stylesheet" href="styles/zabuto_calendar.min.css">    <link type="text/css" rel="stylesheet" href="styles/pace.css">    <link type="text/css" rel="stylesheet" href="styles/jquery.news-ticker.css">   	<script src='jquery.js'></script>	<script src='jquery.maskedinput.js'></script>     <script>		function exclui_tesouraria(id){			if(confirm('Deseja realmente excluir?')){				window.location='exclui_tesouraria.php?cod='+id;			}		}          </script></head><body>    <div>        <!--BEGIN BACK TO TOP-->        <a id="totop" href="#"><i class="fa fa-angle-up"></i></a>        <!--END BACK TO TOP-->        <!--BEGIN TOPBAR-->        <div id="header-topbar-option-demo" class="page-header-topbar">            <nav id="topbar" role="navigation" style="margin-bottom: 0;" data-step="3" class="navbar navbar-default navbar-static-top">            <div class="navbar-header">                <button type="button" data-toggle="collapse" data-target=".sidebar-collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>                <a id="logo" href="index.html" class="navbar-brand"><span class="fa fa-rocket"></span><span class="logo-text">GAC</span><span style="display: none" class="logo-text-icon">µ</span></a></div>            <div class="topbar-main"><a id="menu-toggle" href="#" class="hidden-xs"><i class="fa fa-bars"></i></a>                <ul class="nav navbar navbar-top-links navbar-right mbn">                        </li>                    <li class="dropdown topbar-user"><a data-hover="dropdown" href="#" class="dropdown-toggle"><img src="images/avatar/48.jpg" alt="" class="img-responsive img-circle"/> <span class="hidden-xs"><?php echo $_SESSION['nome']; ?></span> <span class="caret"></span></a>                        <ul class="dropdown-menu dropdown-user pull-right">                            <li><a href="#"><i class="fa fa-user"></i>My Profile</a></li>                            <li><a href="#"><i class="fa fa-calendar"></i>My Calendar</a></li>                            <li><a href="#"><i class="fa fa-envelope"></i>My Inbox<span class="badge badge-danger">3</span></a></li>                            <li><a href="#"><i class="fa fa-tasks"></i>My Tasks<span class="badge badge-success">7</span></a></li>                            <li class="divider"></li>                            <li><a href="#"><i class="fa fa-lock"></i>Lock Screen</a></li>                            <li><a href="Login.html"><i class="fa fa-key"></i>Log Out</a></li>                        </ul>                    </li>               </ul>            </div>        </nav>            <!--BEGIN MODAL CONFIG PORTLET-->            <div id="modal-config" class="modal fade">                <div class="modal-dialog">                    <div class="modal-content">                        <div class="modal-header">                            <button type="button" data-dismiss="modal" aria-hidden="true" class="close">                                ×</button>                            <h4 class="modal-title">                                Modal title</h4>                        </div>                        <div class="modal-body">                            <p>                                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifend et nisl eget                                porta. Curabitur elementum sem molestie nisl varius, eget tempus odio molestie.                                Nunc vehicula sem arcu, eu pulvinar neque cursus ac. Aliquam ultricies lobortis                                magna et aliquam. Vestibulum egestas eu urna sed ultricies. Nullam pulvinar dolor                                vitae quam dictum condimentum. Integer a sodales elit, eu pulvinar leo. Nunc nec                                aliquam nisi, a mollis neque. Ut vel felis quis tellus hendrerit placerat. Vivamus                                vel nisl non magna feugiat dignissim sed ut nibh. Nulla elementum, est a pretium                                hendrerit, arcu risus luctus augue, mattis aliquet orci ligula eget massa. Sed ut                                ultricies felis.</p>                        </div>                        <div class="modal-footer">                            <button type="button" data-dismiss="modal" class="btn btn-default">                                Close</button>                            <button type="button" class="btn btn-primary">                                Save changes</button>                        </div>                    </div>                </div>            </div>            <!--END MODAL CONFIG PORTLET-->        </div>        <!--END TOPBAR-->        <div id="wrapper">            <!--BEGIN SIDEBAR MENU-->            <nav id="sidebar" role="navigation" data-step="2" data-intro="Template has <b>many navigation styles</b>"                data-position="right" class="navbar-default navbar-static-side">            <div class="sidebar-collapse menu-scroll">                <ul id="side-menu" class="nav">                                         <div class="clearfix"></div>                    <li><a href="dashboard.html"><i class="fa fa-tachometer fa-fw">                        <div class="icon-bg bg-orange"></div>                    </i><span class="menu-title">Dashboard</span></a></li>                    <li><a href="Layout.html"><i class="fa fa-desktop fa-fw">                        <div class="icon-bg bg-pink"></div>                    </i><span class="menu-title">Layouts</span></a>                                           </li>                    <li><a href="UIElements.html"><i class="fa fa-send-o fa-fw">                        <div class="icon-bg bg-green"></div>                    </i><span class="menu-title">UI Elements</span></a>                                           </li>                    <li class="active"><a href="Demolays.php"><i class="fa fa-edit fa-fw">                        <div class="icon-bg bg-violet"></div>                    </i><span class="menu-title">DeMolays</span></a>                                          </li>                    <li><a href="Tables.html"><i class="fa fa-th-list fa-fw">                        <div class="icon-bg bg-blue"></div>                    </i><span class="menu-title">Tables</span></a>                                              </li>                    <li><a href="DataGrid.html"><i class="fa fa-database fa-fw">                        <div class="icon-bg bg-red"></div>                    </i><span class="menu-title">Data Grids</span></a>                                          </li>                    <li><a href="Pages.html"><i class="fa fa-file-o fa-fw">                        <div class="icon-bg bg-yellow"></div>                    </i><span class="menu-title">Pages</span></a>                                           </li>                    <li><a href="Extras.html"><i class="fa fa-gift fa-fw">                        <div class="icon-bg bg-grey"></div>                    </i><span class="menu-title">Extras</span></a>                                          </li>                    <li><a href="Dropdown.html"><i class="fa fa-sitemap fa-fw">                        <div class="icon-bg bg-dark"></div>                    </i><span class="menu-title">Multi-Level Dropdown</span></a>                                          </li>                    <li><a href="Email.html"><i class="fa fa-envelope-o">                        <div class="icon-bg bg-primary"></div>                    </i><span class="menu-title">Email</span></a>                                          </li>                                        </li>                    <li><a href="Animation.html"><i class="fa fa-slack fa-fw">                        <div class="icon-bg bg-green"></div>                    </i><span class="menu-title">Animations</span></a></li>                </ul>            </div>        </nav>            <div id="page-wrapper">                <!--BEGIN TITLE & BREADCRUMB PAGE-->                <div id="title-breadcrumb-option-demo" class="page-title-breadcrumb">                    <div class="page-header pull-left">                        <div class="page-title">                            Tesouraria</div>                    </div>                    <ol class="breadcrumb page-breadcrumb pull-right">                        <li><i class="fa fa-home"></i> <a href="dashboard.html">Início</a>  <i                            class="fa fa-angle-right"></i>  </li>                        <li class="hidden"><a href="#">Tesouraria</a>  <i class="fa fa-angle-right"></i>  </li>                        <li class="active">Tesouraria</li>                    </ol>                    <div class="clearfix">                    </div>                </div>                <!--END TITLE & BREADCRUMB PAGE-->                <!--BEGIN CONTENT-->                <div class="page-content">                    <div id="tab-general">                        <div class="row mbl">                            <div class="col-lg-12">                                <div class="col-md-12">                                    <div id="area-chart-spline" style="width: 100%; height: 300px; display: none;">                                    </div>                                </div>                            </div>                            <div class="col-lg-12">                                <div class="row">                                    <div class="col-lg-12">                                        <div class="panel panel-green">                                            <div class="panel-heading">                                                Cadastro</div>                                            <div class="panel-body pan">																								<!-- COMEÇA A EDITAR OS FORMS AQUI -->												<?php if($a == 1 || $a == 4) { ?>												<?php													if(!isset($_POST['submit-form'])){												?>                                                <form enctype='multipart/form-data' method ="post">													<br/>										                                                      <div class="form-body pal">                                                    <div class="row">                                                        <div class="col-md-6">																	<div class="form-group">                                                        <select class="form-control" name='nome'>                                                      <option>Selecione um demolay... </option>														<?php														$sql = "SELECT * FROM demolays ORDER BY nome_dml";														$res = mysql_query($sql);														while($d = mysql_fetch_object($res)){															echo "<option value='".$d->nome_dml."'>".$d->nome_dml."</option>";														}														?>                                                        </select>                                                 </div>                                                                                                  <div class="form-group">                                                                <label for="inputName" class="control-label">                                                                    Dívida</label>                                                                <div class="input-icon right">                                                                    <i class="fa fa-shopping-cart"></i>                                                                    <input id="divida" name="divida" type="text" placeholder="" class="form-control" /></div>                                                            </div>                                                     	                                                 </div>                                                                                                        <!-- OUTRO LADO -->                                                                                                            <div class="col-md-6">                                                                                                                   </div>                                                                                                    <div class="form-actions text-right pal">                                                    <center><button type="submit" name="submit-form" class="btn btn-primary">                                                        Cadastrar</button></center>                                                </div>                                                												<script>											   $(document).ready(function(){											   $("#divida").mask("R$ XX,XX");											   })												</script>											</form>																																		<!-- COMEÇA O PHP DOS FORMS AQUI -->																									 <?php }else{	(isset($_POST ['nome'])) ? $nome=$_POST['nome']:$nome=null;	(isset($_POST ['divida'])) ? $divida=$_POST['divida']:$divida=null;	$sql = "INSERT INTO tesouraria (nom_tes, div_tes) VALUES	('$nome', '$divida')";	if(mysql_query($sql)){		echo "<script>alert('Divida cadastrada com sucesso !');window.location='tesouraria.php'</script>";	}else{ 		echo "<script>alert('Erro !');window.location='tesouraria.php'</script>";	}}?><?php } ?>												<!-- TERMINA DE EDITAR OS FORMS AQUI -->                                            </div>                                        </div>                            </div>                        </div>                    </div>                </div>                                <div class="panel panel-green"><div class="panel-heading">Lista</div><div class="panel-body"><table class="table table-hover table-condensed"><thead>	<th width='30%'>Nome</th>	<th width='30%'>Dívida</th>	<?php if($a == 1 || $a == 4) { ?>	<th width='30%'>Alterar</th>	<th width='30%'>Excluir</th>	<?php } ?></thead><tbody><?php if($a == 1 || $a == 4) { ?><?php$sql_produtos = "SELECT * FROM tesouraria ORDER BY nom_tes";$rs = mysql_query($sql_produtos);while($dados = mysql_fetch_object($rs)){?>	<tr>		<td><?=$dados->nom_tes?></td>		<td><?=$dados->div_tes?></td>				<td><a href='altera_tesouraria.php?cod=<?=$dados->cod_tes;?>'><span class="label label-sm label-warning">Alterar</span></a></td>		<td><a href='#' onclick='exclui_tesouraria(<?=$dados->cod_tes;?>)'><span class="label label-sm label-danger">Excluir</span></a></td>    </tr><?php} ?><?php } else {?><?php$sql_produtos = "SELECT * FROM demolays WHERE cod_dml = '$c'";$rs = mysql_query($sql_produtos);while($dados = mysql_fetch_object($rs)){?>	<tr>		<td><?=$dados->nom_tes?></td>		<td><?=$dados->div_tes?></td>    </tr><?php } }?></tbody></table></div></div>                                        <!--END CONTENT-->                <!--BEGIN FOOTER-->                <div id="footer">                    <div class="copyright">                        <a href="http://themifycloud.com">2014 © KAdmin Responsive Multi-Purpose Template</a></div>                </div>                <!--END FOOTER-->            </div>            <!--END PAGE WRAPPER-->        </div>    </div>    <script src="script/jquery-1.10.2.min.js"></script>    <script src="script/jquery-migrate-1.2.1.min.js"></script>    <script src="script/jquery-ui.js"></script>    <script src="script/bootstrap.min.js"></script>    <script src="script/bootstrap-hover-dropdown.js"></script>    <script src="script/html5shiv.js"></script>    <script src="script/respond.min.js"></script>    <script src="script/jquery.metisMenu.js"></script>    <script src="script/jquery.slimscroll.js"></script>    <script src="script/jquery.cookie.js"></script>    <script src="script/icheck.min.js"></script>    <script src="script/custom.min.js"></script>    <script src="script/jquery.news-ticker.js"></script>    <script src="script/jquery.menu.js"></script>    <script src="script/pace.min.js"></script>    <script src="script/holder.js"></script>    <script src="script/responsive-tabs.js"></script>    <script src="script/jquery.flot.js"></script>    <script src="script/jquery.flot.categories.js"></script>    <script src="script/jquery.flot.pie.js"></script>    <script src="script/jquery.flot.tooltip.js"></script>    <script src="script/jquery.flot.resize.js"></script>    <script src="script/jquery.flot.fillbetween.js"></script>    <script src="script/jquery.flot.stack.js"></script>    <script src="script/jquery.flot.spline.js"></script>    <script src="script/zabuto_calendar.min.js"></script>    <script src="script/index.js"></script>    <!--LOADING SCRIPTS FOR CHARTS-->    <script src="script/highcharts.js"></script>    <script src="script/data.js"></script>    <script src="script/drilldown.js"></script>    <script src="script/exporting.js"></script>    <script src="script/highcharts-more.js"></script>    <script src="script/charts-highchart-pie.js"></script>    <script src="script/charts-highchart-more.js"></script>    <!--CORE JAVASCRIPT-->    <script src="script/main.js"></script>    <script>        (function (i, s, o, g, r, a, m) {            i['GoogleAnalyticsObject'] = r;            i[r] = i[r] || function () {                (i[r].q = i[r].q || []).push(arguments)            }, i[r].l = 1 * new Date();            a = s.createElement(o),            m = s.getElementsByTagName(o)[0];            a.async = 1;            a.src = g;            m.parentNode.insertBefore(a, m)        })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');        ga('create', 'UA-145464-12', 'auto');        ga('send', 'pageview');</script></body></html>

    Procurem pelo campo "dívida". Logo abaixo dele estou tentando colocar sobre o mesmo uma "máscara" de entrada. Chamo os arquivos jquery e jquery.maskedinput normalmente e eles estão no mesmo diretório da página. Porém ao visualizar a página a máscara não é aplicada. Como resolver?

  10. Pode me dar um esboço? Ou me ajudar na construção? Estou perdido.

     

    Veja:

    <form method="post" action="recebe.php" enctype="multipart/form-data"><fieldset>	<label for="doc">Seu documento:</label>	<input type="file" name="arquivo" id="documento" />	<input type="submit" value="Salvar" /></fieldset></form>

    E este é meu recebe.php:

    <?php	// O nome original do arquivo no computador do usuário	$arqName = $_FILES['arquivo']['name'];	// O tipo mime do arquivo. Um exemplo pode ser "image/gif"	$arqType = $_FILES['arquivo']['type'];	// O tamanho, em bytes, do arquivo	$arqSize = $_FILES['arquivo']['size'];	// O nome temporário do arquivo, como foi guardado no servidor	$arqTemp = $_FILES['arquivo']['tmp_name'];	// O código de erro associado a este upload de arquivo	$arqError = $_FILES['arquivo']['error'];	if ($arqError == 0) {		$pasta = '../documentos/';		$upload = move_uploaded_file($arqTemp, $pasta . $arqName);	}?>

    Fiz certo?

  11. Olá,

     

    O que eu preciso é o seguinte. Eu tenho um sistema em PHP. Gostaria de criar uma página HTML em que a pessoa possa enviar um arquivo do seu computador para o servidor online em que está hospedado o sistema. Depois que ela enviar, esse mesmo arquivo aparecer nessa mesma página e ao clicar em cima dele possa se fazer o download do mesmo. Entenderam?

     

    Aguardo!

  12. O problema é que não entendo nada. Observe este código:

    /* http://keith-wood.name/countdown.html   Countdown for jQuery v1.5.4.   Written by Keith Wood (kbwood{at}iinet.com.au) January 2008.   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.   Please attribute the author if you use it. *//* Display a countdown timer.   Attach it with options like:   $('div selector').countdown(       {until: new Date(2009, 1 - 1, 1, 0, 0, 0), onExpiry: happyNewYear}); */(function($) { // Hide scope, no $ conflict/* Countdown manager. */function Countdown() {    this.regional = []; // Available regional settings, indexed by language code    this.regional[''] = { // Default regional settings        // The display texts for the counters        labels: ['Years', 'Months', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds'],        // The display texts for the counters if only one        labels1: ['Year', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second'],        compactLabels: ['y', 'm', 'w', 'd'], // The compact texts for the counters        timeSeparator: ':', // Separator for time periods        isRTL: false // True for right-to-left languages, false for left-to-right    };    this._defaults = {        until: new Date(2015, 2 - 1, 10), // new Date(year, mth - 1, day, hr, min, sec) - date/time to count down to            // or numeric for seconds offset, or string for unit offset(s):            // 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds        since: null, // new Date(year, mth - 1, day, hr, min, sec) - date/time to count up from            // or numeric for seconds offset, or string for unit offset(s):            // 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds        timezone: null, // The timezone (hours or minutes from GMT) for the target times,            // or null for client local        serverSync: null, // A function to retrieve the current server time for synchronisation        format: 'dHMS', // Format for display - upper case for always, lower case only if non-zero,            // 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds        layout: '', // Build your own layout for the countdown        compact: false, // True to display in a compact format, false for an expanded one        description: '', // The description displayed for the countdown        expiryUrl: '', // A URL to load upon expiry, replacing the current page        expiryText: '', // Text to display upon expiry, replacing the countdown        alwaysExpire: false, // True to trigger onExpiry even if never counted down        onExpiry: null, // Callback when the countdown expires -            // receives no parameters and 'this' is the containing division        onTick: null // Callback when the countdown is updated -            // receives int[7] being the breakdown by period (based on format)            // and 'this' is the containing division    };    $.extend(this._defaults, this.regional['']);}var PROP_NAME = 'countdown';var Y = 0; // Yearsvar O = 1; // Monthsvar W = 2; // Weeksvar D = 3; // Daysvar H = 4; // Hoursvar M = 5; // Minutesvar S = 6; // Seconds$.extend(Countdown.prototype, {    /* Class name added to elements to indicate already configured with countdown. */    markerClassName: 'hasCountdown',        /* Shared timer for all countdowns. */    _timer: setInterval(function() { $.countdown._updateTargets(); }, 980),    /* List of currently active countdown targets. */    _timerTargets: [],        /* Override the default settings for all instances of the countdown widget.       @param  options  (object) the new settings to use as defaults */    setDefaults: function(options) {        this._resetExtraLabels(this._defaults, options);        extendRemove(this._defaults, options || {});    },    /* Convert a date/time to UTC.       @param  tz     (number) the hour or minute offset from GMT, e.g. +9, -360       @param  year   (Date) the date/time in that timezone or                      (number) the year in that timezone       @param  month  (number, optional) the month (0 - 11) (omit if year is a Date)       @param  day    (number, optional) the day (omit if year is a Date)       @param  hours  (number, optional) the hour (omit if year is a Date)       @param  mins   (number, optional) the minute (omit if year is a Date)       @param  secs   (number, optional) the second (omit if year is a Date)       @param  ms     (number, optional) the millisecond (omit if year is a Date)       @return  (Date) the equivalent UTC date/time */    UTCDate: function(tz, year, month, day, hours, mins, secs, ms) {        if (typeof year == 'object' && year.constructor == Date) {            ms = year.getMilliseconds();            secs = year.getSeconds();            mins = year.getMinutes();            hours = year.getHours();            day = year.getDate();            month = year.getMonth();            year = year.getFullYear();        }        var d = new Date();        d.setUTCFullYear(year);        d.setUTCDate(1);        d.setUTCMonth(month || 0);        d.setUTCDate(day || 1);        d.setUTCHours(hours || 0);        d.setUTCMinutes((mins || 0) - (Math.abs(tz) < 30 ? tz * 60 : tz));        d.setUTCSeconds(secs || 0);        d.setUTCMilliseconds(ms || 0);        return d;    },    /* Attach the countdown widget to a div.       @param  target   (element) the containing division       @param  options  (object) the initial settings for the countdown */    _attachCountdown: function(target, options) {        var $target = $(target);        if ($target.hasClass(this.markerClassName)) {            return;        }        $target.addClass(this.markerClassName);        var inst = {options: $.extend({}, options),            _periods: [0, 0, 0, 0, 0, 0, 0]};        $.data(target, PROP_NAME, inst);        this._changeCountdown(target);    },    /* Add a target to the list of active ones.       @param  target  (element) the countdown target */    _addTarget: function(target) {        if (!this._hasTarget(target)) {            this._timerTargets.push(target);        }    },    /* See if a target is in the list of active ones.       @param  target  (element) the countdown target       @return  (boolean) true if present, false if not */    _hasTarget: function(target) {        return ($.inArray(target, this._timerTargets) > -1);    },    /* Remove a target from the list of active ones.       @param  target  (element) the countdown target */    _removeTarget: function(target) {        this._timerTargets = $.map(this._timerTargets,            function(value) { return (value == target ? null : value); }); // delete entry    },    /* Update each active timer target. */    _updateTargets: function() {        for (var i = 0; i < this._timerTargets.length; i++) {            this._updateCountdown(this._timerTargets[i]);        }    },    /* Redisplay the countdown with an updated display.       @param  target  (jQuery) the containing division       @param  inst    (object) the current settings for this instance */    _updateCountdown: function(target, inst) {        var $target = $(target);        inst = inst || $.data(target, PROP_NAME);        if (!inst) {            return;        }        $target.html(this._generateHTML(inst));        $target[(this._get(inst, 'isRTL') ? 'add' : 'remove') + 'Class']('countdown_rtl');        var onTick = this._get(inst, 'onTick');        if (onTick) {            onTick.apply(target, [inst._hold != 'lap' ? inst._periods :                this._calculatePeriods(inst, inst._show, new Date())]);        }        var expired = inst._hold != 'pause' &&            (inst._since ? inst._now.getTime() <= inst._since.getTime() :            inst._now.getTime() >= inst._until.getTime());        if (expired && !inst._expiring) {            inst._expiring = true;            if (this._hasTarget(target) || this._get(inst, 'alwaysExpire')) {                this._removeTarget(target);                var onExpiry = this._get(inst, 'onExpiry');                if (onExpiry) {                    onExpiry.apply(target, []);                }                var expiryText = this._get(inst, 'expiryText');                if (expiryText) {                    var layout = this._get(inst, 'layout');                    inst.options.layout = expiryText;                    this._updateCountdown(target, inst);                    inst.options.layout = layout;                }                var expiryUrl = this._get(inst, 'expiryUrl');                if (expiryUrl) {                    window.location = expiryUrl;                }            }            inst._expiring = false;        }        else if (inst._hold == 'pause') {            this._removeTarget(target);        }        $.data(target, PROP_NAME, inst);    },    /* Reconfigure the settings for a countdown div.       @param  target   (element) the containing division       @param  options  (object) the new settings for the countdown or                        (string) an individual property name       @param  value    (any) the individual property value                        (omit if options is an object) */    _changeCountdown: function(target, options, value) {        options = options || {};        if (typeof options == 'string') {            var name = options;            options = {};            options[name] = value;        }        var inst = $.data(target, PROP_NAME);        if (inst) {            this._resetExtraLabels(inst.options, options);            extendRemove(inst.options, options);            this._adjustSettings(target, inst);            $.data(target, PROP_NAME, inst);            var now = new Date();            if ((inst._since && inst._since < now) ||                    (inst._until && inst._until > now)) {                this._addTarget(target);            }            this._updateCountdown(target, inst);        }    },    /* Reset any extra labelsn and compactLabelsn entries if changing labels.       @param  base     (object) the options to be updated       @param  options  (object) the new option values */    _resetExtraLabels: function(base, options) {        var changingLabels = false;        for (var n in options) {            if (n.match(/[Ll]abels/)) {                changingLabels = true;                break;            }        }        if (changingLabels) {            for (var n in base) { // Remove custom numbered labels                if (n.match(/[Ll]abels[0-9]/)) {                    base[n] = null;                }            }        }    },        /* Calculate interal settings for an instance.       @param  target  (element) the containing division       @param  inst    (object) the current settings for this instance */    _adjustSettings: function(target, inst) {        var serverSync = this._get(inst, 'serverSync');        serverSync = (serverSync ? serverSync.apply(target, []) : null);        var now = new Date();        var timezone = this._get(inst, 'timezone');        timezone = (timezone == null ? -now.getTimezoneOffset() : timezone);        inst._since = this._get(inst, 'since');        if (inst._since) {            inst._since = this.UTCDate(timezone, this._determineTime(inst._since, null));            if (inst._since && serverSync) {                inst._since.setMilliseconds(inst._since.getMilliseconds() +                    now.getTime() - serverSync.getTime());            }        }        inst._until = this.UTCDate(timezone, this._determineTime(this._get(inst, 'until'), now));        if (serverSync) {            inst._until.setMilliseconds(inst._until.getMilliseconds() +                now.getTime() - serverSync.getTime());        }        inst._show = this._determineShow(inst);    },    /* Remove the countdown widget from a div.       @param  target  (element) the containing division */    _destroyCountdown: function(target) {        var $target = $(target);        if (!$target.hasClass(this.markerClassName)) {            return;        }        this._removeTarget(target);        $target.removeClass(this.markerClassName).empty();        $.removeData(target, PROP_NAME);    },    /* Pause a countdown widget at the current time.       Stop it running but remember and display the current time.       @param  target  (element) the containing division */    _pauseCountdown: function(target) {        this._hold(target, 'pause');    },    /* Pause a countdown widget at the current time.       Stop the display but keep the countdown running.       @param  target  (element) the containing division */    _lapCountdown: function(target) {        this._hold(target, 'lap');    },    /* Resume a paused countdown widget.       @param  target  (element) the containing division */    _resumeCountdown: function(target) {        this._hold(target, null);    },    /* Pause or resume a countdown widget.       @param  target  (element) the containing division       @param  hold    (string) the new hold setting */    _hold: function(target, hold) {        var inst = $.data(target, PROP_NAME);        if (inst) {            if (inst._hold == 'pause' && !hold) {                inst._periods = inst._savePeriods;                var sign = (inst._since ? '-' : '+');                inst[inst._since ? '_since' : '_until'] =                    this._determineTime(sign + inst._periods[0] + 'y' +                        sign + inst._periods[1] + 'o' + sign + inst._periods[2] + 'w' +                        sign + inst._periods[3] + 'd' + sign + inst._periods[4] + 'h' +                        sign + inst._periods[5] + 'm' + sign + inst._periods[6] + 's');                this._addTarget(target);            }            inst._hold = hold;            inst._savePeriods = (hold == 'pause' ? inst._periods : null);            $.data(target, PROP_NAME, inst);            this._updateCountdown(target, inst);        }    },    /* Return the current time periods.       @param  target  (element) the containing division       @return  (number[7]) the current periods for the countdown */    _getTimesCountdown: function(target) {        var inst = $.data(target, PROP_NAME);        return (!inst ? null : (!inst._hold ? inst._periods :            this._calculatePeriods(inst, inst._show, new Date())));    },    /* Get a setting value, defaulting if necessary.       @param  inst  (object) the current settings for this instance       @param  name  (string) the name of the required setting       @return  (any) the setting's value or a default if not overridden */    _get: function(inst, name) {        return (inst.options[name] != null ?            inst.options[name] : $.countdown._defaults[name]);    },    /* A time may be specified as an exact value or a relative one.       @param  setting      (string or number or Date) - the date/time value                            as a relative or absolute value       @param  defaultTime  (Date) the date/time to use if no other is supplied       @return  (Date) the corresponding date/time */    _determineTime: function(setting, defaultTime) {        var offsetNumeric = function(offset) { // e.g. +300, -2            var time = new Date();            time.setTime(time.getTime() + offset * 1000);            return time;        };        var offsetString = function(offset) { // e.g. '+2d', '-4w', '+3h +30m'            offset = offset.toLowerCase();            var time = new Date();            var year = time.getFullYear();            var month = time.getMonth();            var day = time.getDate();            var hour = time.getHours();            var minute = time.getMinutes();            var second = time.getSeconds();            var pattern = /([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g;            var matches = pattern.exec(offset);            while (matches) {                switch (matches[2] || 's') {                    case 's': second += parseInt(matches[1], 10); break;                    case 'm': minute += parseInt(matches[1], 10); break;                    case 'h': hour += parseInt(matches[1], 10); break;                    case 'd': day += parseInt(matches[1], 10); break;                    case 'w': day += parseInt(matches[1], 10) * 7; break;                    case 'o':                        month += parseInt(matches[1], 10);                        day = Math.min(day, $.countdown._getDaysInMonth(year, month));                        break;                    case 'y':                        year += parseInt(matches[1], 10);                        day = Math.min(day, $.countdown._getDaysInMonth(year, month));                        break;                }                matches = pattern.exec(offset);            }            return new Date(year, month, day, hour, minute, second, 0);        };        var time = (setting == null ? defaultTime :            (typeof setting == 'string' ? offsetString(setting) :            (typeof setting == 'number' ? offsetNumeric(setting) : setting)));        if (time) time.setMilliseconds(0);        return time;    },    /* Determine the number of days in a month.       @param  year   (number) the year       @param  month  (number) the month       @return  (number) the days in that month */    _getDaysInMonth: function(year, month) {        return 32 - new Date(year, month, 32).getDate();    },    /* Generate the HTML to display the countdown widget.       @param  inst  (object) the current settings for this instance       @return  (string) the new HTML for the countdown display */    _generateHTML: function(inst) {        // Determine what to show        inst._periods = periods = (inst._hold ? inst._periods :            this._calculatePeriods(inst, inst._show, new Date()));        // Show all 'asNeeded' after first non-zero value        var shownNonZero = false;        var showCount = 0;        for (var period = 0; period < inst._show.length; period++) {            shownNonZero |= (inst._show[period] == '?' && periods[period] > 0);            inst._show[period] = (inst._show[period] == '?' && !shownNonZero ? null : inst._show[period]);            showCount += (inst._show[period] ? 1 : 0);        }        var compact = this._get(inst, 'compact');        var layout = this._get(inst, 'layout');        var labels = (compact ? this._get(inst, 'compactLabels') : this._get(inst, 'labels'));        var timeSeparator = this._get(inst, 'timeSeparator');        var description = this._get(inst, 'description') || '';        var showCompact = function(period) {            var labelsNum = $.countdown._get(inst, 'compactLabels' + periods[period]);            return (inst._show[period] ? periods[period] +                (labelsNum ? labelsNum[period] : labels[period]) + ' ' : '');        };        var showFull = function(period) {            var labelsNum = $.countdown._get(inst, 'labels' + periods[period]);            return (inst._show[period] ?                '<span class="countdown_section"><span class="countdown_amount">' +                periods[period] + '</span><br/>' +                (labelsNum ? labelsNum[period] : labels[period]) + '</span>' : '');        };        return (layout ? this._buildLayout(inst, layout, compact) :            ((compact ? // Compact version            '<span class="countdown_row countdown_amount' +            (inst._hold ? ' countdown_holding' : '') + '">' +            showCompact(Y) + showCompact(O) + showCompact(W) + showCompact(D) +            (inst._show[H] ? this._minDigits(periods[H], 2) : '') +            (inst._show[M] ? (inst._show[H] ? timeSeparator : '') +            this._minDigits(periods[M], 2) : '') +            (inst._show[S] ? (inst._show[H] || inst._show[M] ? timeSeparator : '') +            this._minDigits(periods[S], 2) : '') :            // Full version            '<span class="countdown_row countdown_show' + showCount +            (inst._hold ? ' countdown_holding' : '') + '">' +            showFull(Y) + showFull(O) + showFull(W) + showFull(D) +            showFull(H) + showFull(M) + showFull(S)) + '</span>' +            (description ? '<span class="countdown_row countdown_descr">' + description + '</span>' : '')));    },    /* Construct a custom layout.       @param  inst     (object) the current settings for this instance       @param  layout   (string) the customised layout       @param  compact  (boolean) true if using compact labels       @return  (string) the custom HTML */    _buildLayout: function(inst, layout, compact) {        var labels = this._get(inst, (compact ? 'compactLabels' : 'labels'));        var labelFor = function(index) {            return ($.countdown._get(inst,                (compact ? 'compactLabels' : 'labels') + inst._periods[index]) ||                labels)[index];        };        var digit = function(value, position) {            return Math.floor(value / position) % 10;        };        var subs = {desc: this._get(inst, 'description'), sep: this._get(inst, 'timeSeparator'),            yl: labelFor(Y), yn: inst._periods[Y], ynn: this._minDigits(inst._periods[Y], 2),            ynnn: this._minDigits(inst._periods[Y], 3), y1: digit(inst._periods[Y], 1),            y10: digit(inst._periods[Y], 10), y100: digit(inst._periods[Y], 100),            ol: labelFor(O), on: inst._periods[O], onn: this._minDigits(inst._periods[O], 2),            onnn: this._minDigits(inst._periods[O], 3), o1: digit(inst._periods[O], 1),            o10: digit(inst._periods[O], 10), o100: digit(inst._periods[O], 100),            wl: labelFor(W), wn: inst._periods[W], wnn: this._minDigits(inst._periods[W], 2),            wnnn: this._minDigits(inst._periods[W], 3), w1: digit(inst._periods[W], 1),            w10: digit(inst._periods[W], 10), w100: digit(inst._periods[W], 100),            dl: labelFor(D), dn: inst._periods[D], dnn: this._minDigits(inst._periods[D], 2),            dnnn: this._minDigits(inst._periods[D], 3), d1: digit(inst._periods[D], 1),            d10: digit(inst._periods[D], 10), d100: digit(inst._periods[D], 100),            hl: labelFor(H), hn: inst._periods[H], hnn: this._minDigits(inst._periods[H], 2),            hnnn: this._minDigits(inst._periods[H], 3), h1: digit(inst._periods[H], 1),            h10: digit(inst._periods[H], 10), h100: digit(inst._periods[H], 100),            ml: labelFor(M), mn: inst._periods[M], mnn: this._minDigits(inst._periods[M], 2),            mnnn: this._minDigits(inst._periods[M], 3), m1: digit(inst._periods[M], 1),            m10: digit(inst._periods[M], 10), m100: digit(inst._periods[M], 100),            sl: labelFor(S), sn: inst._periods[S], snn: this._minDigits(inst._periods[S], 2),            snnn: this._minDigits(inst._periods[S], 3), s1: digit(inst._periods[S], 1),            s10: digit(inst._periods[S], 10), s100: digit(inst._periods[S], 100)};        var html = layout;        // Replace period containers: {p<}...{p>}        for (var i = 0; i < 7; i++) {            var period = 'yowdhms'.charAt(i);            var re = new RegExp('\\{' + period + '<\\}(.*)\\{' + period + '>\\}', 'g');            html = html.replace(re, (inst._show[i] ? '$1' : ''));        }        // Replace period values: {pn}        $.each(subs, function(n, v) {            var re = new RegExp('\\{' + n + '\\}', 'g');            html = html.replace(re, v);        });        return html;    },    /* Ensure a numeric value has at least n digits for display.       @param  value  (number) the value to display       @param  len    (number) the minimum length       @return  (string) the display text */    _minDigits: function(value, len) {        value = '0000000000' + value;        return value.substr(value.length - len);    },    /* Translate the format into flags for each period.       @param  inst  (object) the current settings for this instance       @return  (string[7]) flags indicating which periods are requested (?) or                required (!) by year, month, week, day, hour, minute, second */    _determineShow: function(inst) {        var format = this._get(inst, 'format');        var show = [];        show[Y] = (format.match('y') ? '?' : (format.match('Y') ? '!' : null));        show[O] = (format.match('o') ? '?' : (format.match('O') ? '!' : null));        show[W] = (format.match('w') ? '?' : (format.match('W') ? '!' : null));        show[D] = (format.match('d') ? '?' : (format.match('D') ? '!' : null));        show[H] = (format.match('h') ? '?' : (format.match('H') ? '!' : null));        show[M] = (format.match('m') ? '?' : (format.match('M') ? '!' : null));        show[S] = (format.match('s') ? '?' : (format.match('S') ? '!' : null));        return show;    },        /* Calculate the requested periods between now and the target time.       @param  inst  (object) the current settings for this instance       @param  show  (string[7]) flags indicating which periods are requested/required       @param  now   (Date) the current date and time       @return  (number[7]) the current time periods (always positive)                by year, month, week, day, hour, minute, second */    _calculatePeriods: function(inst, show, now) {        // Find endpoints        inst._now = now;        inst._now.setMilliseconds(0);        var until = new Date(inst._now.getTime());        if (inst._since && now.getTime() < inst._since.getTime()) {            inst._now = now = until;        }        else if (inst._since) {            now = inst._since;        }        else {            until.setTime(inst._until.getTime());            if (now.getTime() > inst._until.getTime()) {                inst._now = now = until;            }        }        // Calculate differences by period        var periods = [0, 0, 0, 0, 0, 0, 0];        if (show[Y] || show[O]) {            // Treat end of months as the same            var lastNow = $.countdown._getDaysInMonth(now.getFullYear(), now.getMonth());            var lastUntil = $.countdown._getDaysInMonth(until.getFullYear(), until.getMonth());            var sameDay = (until.getDate() == now.getDate() ||                (until.getDate() >= Math.min(lastNow, lastUntil) &&                now.getDate() >= Math.min(lastNow, lastUntil)));            var getSecs = function(date) {                return (date.getHours() * 60 + date.getMinutes()) * 60 + date.getSeconds();            };            var months = Math.max(0,                (until.getFullYear() - now.getFullYear()) * 12 + until.getMonth() - now.getMonth() +                ((until.getDate() < now.getDate() && !sameDay) ||                (sameDay && getSecs(until) < getSecs(now)) ? -1 : 0));            periods[Y] = (show[Y] ? Math.floor(months / 12) : 0);            periods[O] = (show[O] ? months - periods[Y] * 12 : 0);            // Adjust for months difference and end of month if necessary            var adjustDate = function(date, offset, last) {                var wasLastDay = (date.getDate() == last);                var lastDay = $.countdown._getDaysInMonth(date.getFullYear() + offset * periods[Y],                    date.getMonth() + offset * periods[O]);                if (date.getDate() > lastDay) {                    date.setDate(lastDay);                }                date.setFullYear(date.getFullYear() + offset * periods[Y]);                date.setMonth(date.getMonth() + offset * periods[O]);                if (wasLastDay) {                    date.setDate(lastDay);                }                return date;            };            if (inst._since) {                until = adjustDate(until, -1, lastUntil);            }            else {                now = adjustDate(new Date(now.getTime()), +1, lastNow);            }        }        var diff = Math.floor((until.getTime() - now.getTime()) / 1000);        var extractPeriod = function(period, numSecs) {            periods[period] = (show[period] ? Math.floor(diff / numSecs) : 0);            diff -= periods[period] * numSecs;        };        extractPeriod(W, 604800);        extractPeriod(D, 86400);        extractPeriod(H, 3600);        extractPeriod(M, 60);        extractPeriod(S, 1);        return periods;    }});/* jQuery extend now ignores nulls!   @param  target  (object) the object to update   @param  props   (object) the new settings   @return  (object) the updated object */function extendRemove(target, props) {    $.extend(target, props);    for (var name in props) {        if (props[name] == null) {            target[name] = null;        }    }    return target;}/* Process the countdown functionality for a jQuery selection.   @param  command  (string) the command to run (optional, default 'attach')   @param  options  (object) the new settings to use for these countdown instances   @return  (jQuery) for chaining further calls */$.fn.countdown = function(options) {    var otherArgs = Array.prototype.slice.call(arguments, 1);    if (options == 'getTimes') {        return $.countdown['_' + options + 'Countdown'].            apply($.countdown, [this[0]].concat(otherArgs));    }    return this.each(function() {        if (typeof options == 'string') {            $.countdown['_' + options + 'Countdown'].apply($.countdown, [this].concat(otherArgs));        }        else {            $.countdown._attachCountdown(this, options);        }    });};/* Initialise the countdown functionality. */$.countdown = new Countdown(); // singleton instance})(jQuery);

    Tentei colocar o new date mas fica 0 0 0 0 na página.

  13. Olá,

     

    Eu tenho este código de contagem regressiva JS:

    (function($) {    $.fn.countdown = function(options, callback) {        //custom 'this' selector        thisEl = $(this);        //array of custom settings        var settings = {            'date': null,            'format': null        };        //append the settings array to options        if(options) {            $.extend(settings, options);        }        //main countdown function        function countdown_proc() {            eventDate = Date.parse(settings['date']) / 1000;            currentDate = Math.floor($.now() / 1000);            if(eventDate <= currentDate) {                callback.call(this);                clearInterval(interval);            }            seconds = eventDate - currentDate;            days = Math.floor(seconds / (60 * 60 * 24)); //calculate the number of days            seconds -= days * 60 * 60 * 24; //update the seconds variable with no. of days removed            hours = Math.floor(seconds / (60 * 60));            seconds -= hours * 60 * 60; //update the seconds variable with no. of hours removed            minutes = Math.floor(seconds / 60);            seconds -= minutes * 60; //update the seconds variable with no. of minutes removed            //conditional Ss            if (days == 1) { thisEl.find(".timeRefDays").text("day"); } else { thisEl.find(".timeRefDays").text("days"); }            if (hours == 1) { thisEl.find(".timeRefHours").text("hour"); } else { thisEl.find(".timeRefHours").text("hours"); }            if (minutes == 1) { thisEl.find(".timeRefMinutes").text("minute"); } else { thisEl.find(".timeRefMinutes").text("minutes"); }            if (seconds == 1) { thisEl.find(".timeRefSeconds").text("second"); } else { thisEl.find(".timeRefSeconds").text("seconds"); }            //logic for the two_digits ON setting            if(settings['format'] == "on") {                days = (String(days).length >= 2) ? days : "0" + days;                hours = (String(hours).length >= 2) ? hours : "0" + hours;                minutes = (String(minutes).length >= 2) ? minutes : "0" + minutes;                seconds = (String(seconds).length >= 2) ? seconds : "0" + seconds;            }            //update the countdown's html values.            if(!isNaN(eventDate)) {                thisEl.find(".days").text(days);                thisEl.find(".hours").text(hours);                thisEl.find(".minutes").text(minutes);                thisEl.find(".seconds").text(seconds);            } else {                alert("Invalid date. Here's an example: 12 Tuesday 2012 17:30:00");                clearInterval(interval);            }        }        //run the function        countdown_proc();        //loop the function        interval = setInterval(countdown_proc, 1000);    }}) (jQuery); 

     

    O problema é que não sei onde altero para a minha data desejada. Quero que comece a contar até chegar no dia 25 de FEV de 2015.

    Podem me ajudar? Obrigado.

  14. Olá,

     

    Achei esse código do jogo da cobrinha em JavaScript:

    // as variáveis de "saída"var canvas;var context;// as variáveis do jogovar state = 0; // estado do jogovar TILESIZE; // tamanho dos "tiles", apenas para desenhar na telavar pieces; // a cobravar apple; // a maçãvar keyUp, keyRight, keyDown, keyLeft; // teclas pressionadas ou soltasvar UP, DOWN, LEFT, RIGHT; // direção da cobravar velX, velY; // velocidade nos eixosvar collision; // indica colisão da cabeça com alguma parte da cobravar mapWidth, mapHeight; // dimensão do "mapa"// as imagensvar imgApple;var imgPiece;var imgHead;function loadImage ( imgUrl ){    var img = new Image();    img.src = imgUrl;    return img;}function Piece ( x, y, dir ){    this.id = -1;    this.x = x || 0;    this.y = y || 0;    this.dir = dir || 0;}Piece.prototype ={    setPos: function (x, y)    {        this.x = x;        this.y = y;    },    randomPos: function (  )    {        var repeat;        var newPos = {x:0, y:0};        do        {            repeat = false;            newPos.x = Math.floor(Math.random() * mapWidth);            newPos.y = Math.floor(Math.random() * mapHeight);            for (var i = 0; i < pieces.length; i++)                if (pieces[i].id == this.id || (pieces[i].x == newPos.x && pieces[i].y == newPos.y))                    repeat = true;        } while (repeat);        this.x = newPos.x;        this.y = newPos.y;    },    draw: function ( img )    {        context.drawImage(img, this.x * TILESIZE, this.y * TILESIZE);    }}function keyboardDown ( event ){    var ev = event || window.event;    switch (ev.keyCode)    {        case 37: // seta esquerda            keyLeft = true;            break;        case 38: // seta para cima            keyUp = true;            break;        case 39: // seta direita            keyRight = true;            break;        case 40: // seta para baixo            keyDown = true;            break;        case 80: // tecla p = pause game            velX = velY = 0;            break;        default:            break;    }}function keyboardUp ( event ){    var ev = event || window.event;    switch (ev.keyCode)    {        case 37: // seta esquerda            keyLeft = false;            break;        case 38: // seta para cima            keyUp = false;            break;        case 39: // seta direita            keyRight = false;            break;        case 40: // seta para baixo            keyDown = false;            break;        default:            break;    }}function gameInit (  ){    TILESIZE = 32;    mapWidth = 20;    mapHeight = 15;    canvas = document.getElementById("canvas");    context = canvas.getContext("2d");    canvas.width = mapWidth * TILESIZE;    canvas.height = mapHeight * TILESIZE;    imgPiece = loadImage("piece.png");    imgApple = loadImage("apple.png");    imgHead = loadImage("head.png");    pieces = new Array(new Piece(), new Piece(), new Piece());    apple = new Piece();    apple.id = -10;    velX = velY = 0;    collision = false;    // direções a seguir    UP = 0;    RIGHT = 1;    DOWN = 2;    LEFT = 3;    // inicializando a parte A - a cabeça    pieces[2].id = 2;    pieces[2].x = 3;    pieces[2].y = 3;    pieces[2].dir = RIGHT;    // inicializando a parte B    pieces[1].id = 1;    pieces[1].x = 2;    pieces[1].y = 3;    pieces[1].dir = RIGHT;    // inicializando a parte C - o rabo    pieces[0].id = 0;    pieces[0].x = 1;    pieces[0].y = 3;    pieces[0].dir = RIGHT;    // escolhe as coordenadas da maçã    apple.randomPos();    // por fim seta o estado para 1    state = 1;        // atualiza o tamnho atual na pagina html    document.getElementById("currSize").innerHTML = pieces.length;    // atualiza o tamanho anterior na pagina html    document.getElementById("lastSize").innerHTML = 0;}function gameReset (  ){    // atualiza o tamanho anterior na pagina html    document.getElementById("lastSize").innerHTML = pieces.length;    // retira o excesso de elementos deixa só 3 pra reiniciar    while (pieces.length > 3)        pieces.pop();    velX = velY = 0;    collision = false;    // reinicializando as peças    // inicializando a parte A - a cabeça    pieces[2].id = 2;    pieces[2].x = 3;    pieces[2].y = 3;    pieces[2].dir = RIGHT;    // inicializando a parte B    pieces[1].id = 1;    pieces[1].x = 2;    pieces[1].y = 3;    pieces[1].dir = RIGHT;    // inicializando a parte C - o rabo    pieces[0].id = 0;    pieces[0].x = 1;    pieces[0].y = 3;    pieces[0].dir = RIGHT;    apple.randomPos();    // atualiza o tamnho atual na pagina html    document.getElementById("currSize").innerHTML = pieces.length;}function gameLoop (  ){    if (keyLeft)    {        if (pieces[pieces.length - 1].dir != RIGHT)        {            velX = -1;            velY = 0;            pieces[pieces.length - 1].dir = LEFT;        }    }    else if (keyUp)    {        if (pieces[pieces.length - 1].dir != DOWN)        {            velX = 0;            velY = -1;            pieces[pieces.length - 1].dir = UP;        }    }    else if (keyRight)    {        if (pieces[pieces.length - 1].dir != LEFT)        {            velX = 1;            velY = 0;            pieces[pieces.length - 1].dir = RIGHT;        }    }    else if (keyDown)    {        if (pieces[pieces.length - 1].dir != UP)        {            velX = 0;            velY = 1;            pieces[pieces.length - 1].dir = DOWN;        }    }    // atualiza as posições das pieces se estiver movendo    if (velX != 0 || velY != 0)    {        for (var i=0; i < pieces.length - 1; i++)        {            pieces[i].x = pieces[i + 1].x;            pieces[i].y = pieces[i + 1].y;            pieces[i].dir = pieces[i + 1].dir;        }    }    if (pieces[pieces.length - 1].x == apple.x && pieces[pieces.length - 1].y == apple.y)    {        pieces.push(new Piece());        pieces[pieces.length - 1].x = apple.x;        pieces[pieces.length - 1].y = apple.y;        pieces[pieces.length - 1].dir = pieces[pieces.length - 2].dir;        pieces[pieces.length - 1].id = pieces.length - 1;        apple.randomPos();                // atualiza o tamanho atual na pagina html        document.getElementById("currSize").innerHTML = pieces.length;    }    // agora move a cabeça    pieces[pieces.length - 1].x += velX;    pieces[pieces.length - 1].y += velY;    // depois de mover a cabeça limita o movimento no canvas    // Para o eixo X    if (pieces[pieces.length - 1].x >= mapWidth)    {        pieces[pieces.length - 1].x = 0;    }    else if (pieces[pieces.length - 1].x < 0)    {        pieces[pieces.length - 1].x = mapWidth - 1;    }        // Para o eixo Y    if (pieces[pieces.length - 1].y >= mapHeight)    {        pieces[pieces.length - 1].y = 0;    }    else if (pieces[pieces.length - 1].y < 0)    {        pieces[pieces.length - 1].y = mapHeight - 1;    }    // se colidiu com alguma parte da cobra    if (collision)    {        gameReset();    }    // verifica se colidiu com alguma parte da cobra    for (var i=0; i < pieces.length - 2 && !collision; i++)        if (pieces[pieces.length - 1].x == pieces[i].x && pieces[pieces.length - 1].y == pieces[i].y)            collision = true;    context.fillStyle = "#FFFFFF";    context.fillRect(0,0,canvas.width,canvas.height);        // desenha o corpo da cobra (sem a cabeça)    for (var i=0; i < pieces.length - 1; i++)        pieces[i].draw(imgPiece);    // desenha a maçã    apple.draw(imgApple);    // desenha a cabeça    pieces[pieces.length - 1].draw(imgHead);}function gameMain (  ){    switch (state)    {        case 0:            gameInit();            break;        case 1:            gameLoop();            break;        default:            state = 0;            break;    }} 

     

    Ele está perfeito! Só gostaria de que ao sair da página e voltar novamente, e jogar novamente, acumulasse os pontos.

     

    Até mais!

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

Ebook grátis: Aprenda a ler resistores e capacitores!

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!