Ir para conteúdo
Fórum Script Brasil

shaq

Membros
  • Total de itens

    8
  • Registro em

  • Última visita

Sobre shaq

shaq's Achievements

0

Reputação

  1. Hi, here is the problem /* Order Function Returned Table * Need to minimaly change a function(GetBigTableData), so that it returns the same results but ordered. PS: Working in SQL Server 2005 */ /* Assuming that: BigTable, @ReturnTable e @AuxTable have the same schema */ create function GetBigTableData (@All bit=0) returns @ReturnTable table(col int) as begin declare @AuxTable Table(col int) /*-----UNCHANGABLE CODE--------------------------------------*/ insert into @AuxTable select * from BigTable where BigTable.col < 5 if @All=1 begin insert into @AuxTable select * from BigTable where BigTable.col >= 5 end /*----------------------------------------------------------*/ insert into @ReturnTable select * from @AuxTable order by @AuxTable.col --Error: Must declare the scalar variable "@AuxTable". --order by @ReturnTable.col --Error: Must declare the scalar variable "@ReturnTable". return end go Any Solutions? Many Thanks, Rui Miranda
  2. shaq

    Optimização SP

    Boas, estou com uma duvida referente a Store Procedures de SQL Server. Imaginando que existe procedimento ao qual só tenho acesso o cabeçalho: procFoo (par1 int,par2 int); Numa aplicação eu tenho uma tabela sobre a qual vou executar este procediemnto por todos os tuplo. Pretendia optimizar criando um novo procedimento com o seguinte corpo: create type tbType as table(col1 int,col2 int) create newProc( @tbPar tbType ) as --O que fazer aqui!?(sem usar cursor ou while) go
  3. Debug update, comentei a parte do Java Server que estava a lançar a UnkownHostException(era somente usado para mostrar na consola de servidor qual o HostName/IP da maquina residente) agora estou com a seguinte excepção quando instancio um objecto ServerSocket(3333): INFO: cgi: runCGI (stderr):java.net.SocketException: Unrecognized Windows Sockets error: 126: create 13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr): at java.net.ServerSocket.createImpl(Unknown Source) 13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr): at java.net.ServerSocket.getImpl(Unknown Source) 13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr): at java.net.ServerSocket.bind(Unknown Source) 13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr): at java.net.ServerSocket.<init>(Unknown Source) 13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr): at java.net.ServerSocket.<init>(Unknown Source) 13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr): at server.Server.main(Server.java:42) Pesquisei TODA A WEB, e não vi nenhuma referencia para a excepção 126, sinto-me um pouco abençoado mas sobretudo frustrado, alguma ideia?
  4. shaq

    AJAX

    Solution: Karl Oakes • This sounds like IE's caching problem with GET AJAX requests.. There are a few methods to resolve this, which can be performed either server-side or client-side. To resolve this client-side, just send a random querystring param along with the URL, i.e. var url = "handleAJAX.jsp?flagMsg="+str+"&random="+Math.random(); in your js.
  5. Olá a todos, Estou com um problema a implementar um CGI para inciar remotamente o meu servidor JAVA (já compactado em jar e testado e funcional quando corro o jar no ambiente windows). Agora queria fazer um CGI no Tomcat6.0 WebServer via Eclipse, usando um Dynamic Web Project com a seguinte estrutura(resumida): WebProject: >WebContent: >index.jsp (Where i have the links to the cgi's/bat's) >WEB-INF: >cgi: >ServerRemoteStart.bat >helloworld.bat Eu já configurei o Tomcat para correr CGI, tanto que consigo correr o helloworld.bat via pagina web. O ServerRemoteStart.bat é o seguinte: "C:\Program Files\Java\jre6\bin\java.exe" -jar "D:\My Dropbox\isel\1011sv\SCDist\Trabs-G01D\T01\QAGame\Executaveis\Server QAGame\jar\ServerApp.jar" E funciona na perfeição se eu fizer copy/paste dele e executar no CMD, mas via WEB atraves do link que aponta para o bat, tenho o seguinte erro: INFO: cgi: runCGI (stderr):java.net.UnknownHostException: *********: ********* 11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr): at java.net.InetAddress.getLocalHost(Unknown Source) 11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr): at server.Server.getIPownAdd(Server.java:84) 11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr): at server.Server.main(Server.java:33) 11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr):#Server port: 3333, alredy in use! 11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log INFO: cgi: runCGI (stderr):#Close Server App, or it will self-destroy in 10 seconds... ********* = HostName As ultimas 3 linhas são o meu handle da IOException, já verifique através do Netstat e não tenho absolutamente nada a correr no port 3333 PS: de preferencia gostaria de mexer no codigo java do servidor o menos possivel, ate mesmo nada, visto este funcionar na perfeicao quando arranco o jar, ou chamo um bat para arrranar o jar Isto tem alguma coisa que ver com as portas do ambiente do tomcat? Porque como é a primeira vezes que o uso não tenho bem noção do que se está a passar :S Thanks in advance, Rui Miranda
  6. shaq

    AJAX

    Boas, resolveu a situação anterior, obrigado :) funcHeaders.js: /*AJAX STUFF*//************************************************/ var xmlHttp; function HandleReply() { if(xmlHttp.readyState == 4 && xmlHttp.status == 200) { thisJSPhandle(xmlHttp.responseText); } } function sendRequest(str) { xmlHttp = null; xmlHttp = GetXmlHttpObject(); var url = "handleAJAX.jsp?flagMsg="+str; xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange=HandleReply; xmlHttp.send(null); } function GetXmlHttpObject() { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} // Internet Explorer try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} // Internet Explorer try { return new XMLHttpRequest(); } catch(e) {} // Firefox, Opera 8.0+, Safari alert("XMLHttpRequest not supported"); return null; } /**************************************************************/ list.jsp(header): &lt;script src = "funcHeaders.js" language="JavaScript"></script> &lt;script type="text/javascript"> window.onload = function(){setInterval('sendRequest("GameList")',3000);}; function thisJSPhandle(response){ response = trim(response); if(response == "true"){ window.location.href = "handleList.jsp"; }else{ setInterval('sendRequest("GameList")',3000); } } function validaInput(){ var room=document.forms["list"]["room"].value; if(validaStr(room)){ return true; }else{ alert("Invalid User Room Name!Insert Again"); return false; } } </script> Já tenho o auto-refresh a funcionar a 100pct para Mozilla,Chrome, etc. Mas para IE não funciona bem (o meu resquest AJAX à jsp que verifica se é necessário refresh retorna sempre true, mesmo quando a msg não está disponivel). Obrigado desde de já, cumps, Rui Miranda
  7. Bom dia, Estou a tentar implementar "auto-refresshing" numa pagina(lista de jogos, de site de quiz online)com o seguinte código: funcHeaders.js: /*AJAX STUFF*//************************************************/ var xmlHttp; function HandleReply() { if(xmlHttp.readyState == 4) { alert("xmlHttp.responseText: "+xmlHttp.responseText); thisJSPhandle(xmlHttp.responseText); } } function sendRequest(str) { alert("sending ajax request, str: "+str); xmlHttp = GetXmlHttpObject(); var url = "handleAJAX.jsp?flagMsg="+str; xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange=HandleReply; xmlHttp.send(null); } function GetXmlHttpObject() { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} // Internet Explorer try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} // Internet Explorer try { return new XMLHttpRequest(); } catch(e) {} // Firefox, Opera 8.0+, Safari alert("XMLHttpRequest not supported"); return null; } /**************************************************************/ list.jsp(header): &lt;script src = "funcHeaders.js" language="JavaScript"></script> &lt;script type="text/javascript"> window.onload = function() {setInterval(sendRequest("GameList"),1000);}; function thisJSPhandle(response){ alert("thisJSPhandle,response: "+response); if(response==true){ window.location = "handleList.jsp"; } } function validaInput(){ var room=document.forms["list"]["room"].value; if(validaStr(room)){ return true; }else{ alert("Invalid User Room Name!Insert Again"); return false; } } </script> Mas acontece que a função sendRequest("GameList") só é chamada quando a pagina é carregada, e não de 1 em 1 segundos como era pretendido. O que estou a fazer de errado? Obrigado desde de já, cumps, Rui Miranda
  8. shaq

    Remove Palavra

    Boas precisava de um método que pega-se num apontador para uma string (char* str) e noutro apontador de uma palavra numa em string (char* word), eu venho pedir aqui ajuda e porque não percebo de C, e isto é para uma cadeira em que suposto já sabermos C mas eu ainda so vou na cadeira de java, penso que em java usando as strings directamente este seria o codigo: public class RemoverPalavra { public static int removeWord(String str, String word){ if(str.contains(word)){ str=str.replaceAll(word,""); return 1; } return 0; } public static void main(String[] args){ String str="Frase de teste"; String word="Frase"; System.out.println(str); removeWord(str,word); System.out.println(str); } }
×
×
  • Criar Novo...