Search Results

Search found 6 results on 1 pages for 'tempvar'.

Page 1/1 | 1 

  • 2 TADOQUERY master and Detail tablefilter insert

    - by ml
    How can i work with 2 Tadoquery and work like a Tadoquery (master) Tadotable(detail) !! var tempvar : Variant; begin Edit1.text:=Ano.value; Begin with Ano_planeamento do //Laço de consulta por codigo Begin Close; SQL.Clear; SQL.Add('SELECT * from planeamento_ano'); SQL.Add('Where ano LIKE ''%'+Edit1.text+'%'''); Open; end; end; tempvar := Ano_planeamento.fieldbyname('ano').value; planeamento.close; if tempvar <> null then begin planeamento.SQL.Clear; planeamento.SQL.add('SELECT * FROM planeamento'); planeamento.SQL.add(' WHERE ano = '); planeamento.SQL.add('''' + tempvar + ''''); // here i nead to filter by .... planeamento.open;

    Read the article

  • Camera rotation - First Person Camera using GLM

    - by tempvar
    I've just switched from deprecated opengl functions to using shaders and GLM math library and i'm having a few problems setting up my camera rotations (first person camera). I'll show what i've got setup so far. I'm setting up my ViewMatrix using the glm::lookAt function which takes an eye position, target and up vector // arbitrary pos and target values pos = glm::vec3(0.0f, 0.0f, 10.0f); target = glm::vec3(0.0f, 0.0f, 0.0f); up = glm::vec3(0.0f, 1.0f, 0.0f); m_view = glm::lookAt(pos, target, up); i'm using glm::perspective for my projection and the model matrix is just identity m_projection = glm::perspective(m_fov, m_aspectRatio, m_near, m_far); model = glm::mat4(1.0); I send the MVP matrix to my shader to multiply the vertex position glm::mat4 MVP = camera->getProjection() * camera->getView() * model; // in shader gl_Position = MVP * vec4(vertexPos, 1.0); My camera class has standard rotate and translate functions which call glm::rotate and glm::translate respectively void camera::rotate(float amount, glm::vec3 axis) { m_view = glm::rotate(m_view, amount, axis); } void camera::translate(glm::vec3 dir) { m_view = glm::translate(m_view, dir); } and i usually just use the mouse delta position as the amount for rotation Now normally in my previous opengl applications i'd just setup the yaw and pitch angles and have a sin and cos to change the direction vector using (gluLookAt) but i'd like to be able to do this using GLM and matrices. So at the moment i have my camera set 10 units away from the origin facing that direction. I can see my geometry fine, it renders perfectly. When i use my rotation function... camera->rotate(mouseDeltaX, glm::vec3(0, 1, 0)); What i want is for me to look to the right and left (like i would with manipulating the lookAt vector with gluLookAt) but what's happening is It just rotates the model i'm looking at around the origin, like im just doing a full circle around it. Because i've translated my view matrix, shouldn't i need to translate it to the centre, do the rotation then translate back away for it to be rotating around the origin? Also, i've tried using the rotate function around the x axis to get pitch working, but as soon as i rotate the model about 90 degrees, it starts to roll instead of pitch (gimbal lock?). Thanks for your help guys, and if i've not explained it well, basically i'm trying to get a first person camera working with matrix multiplication and rotating my view matrix is just rotating the model around the origin.

    Read the article

  • php : echo"", print(), printf()

    - by marc-andre menard
    Is there a better way to output data to html page with PHP ? if i like to make a div with some var in php i will write something like that print ('<div>'.$var.'</div>); or echo "'<div>'.$var.'</div>'"; what is the PROPER way to do that ? or a better way, fill a $tempvar and print it once? like that: $tempvar = '<div>'.$var.'</div>' print ($tempvar); in fact, in real life, the var will be fill with much more !

    Read the article

  • retrieving information from web service calls

    - by Monte Chan
    Hi all, I am trying to retrieve information from a web service call. The following is what I have so far. In my text view, it is showing Map {item=anyType{key=TestKey; value=2;}; item=anyType{key=TestField; value=adsfasd; };} When I ran that in the debugger, I can see the information above in the variable, tempvar. But the question is, how do I retrieve the information (i.e. the actual values of "key" and "value" in each of the array positions)? Yes, I know there is a lot going on in onCreate and I will fix it later. Thanks in advance, Monte My codes are as follows, import java.util.Vector; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.AndroidHttpTransport; public class ViewHitUpActivity extends Activity { private static final String SOAP_ACTION = "test_function"; private static final String METHOD_NAME = "test_function"; private static final String NAMESPACE = "http://www.monteandjanicechan.com/"; private static final String URL = "http://www.monteandjanicechan.com/ws/test_ws.cfc?wsdl"; // private Object resultRequestSOAP = null; private TextView tv; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); tv = (TextView)findViewById(R.id.people_view); //SoapObject request.addProperty("test_item", "1"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL); try { androidHttpTransport.call(SOAP_ACTION, envelope); /* resultRequestSOAP = envelope.getResponse(); Vector tempResult = (Vector) resultRequestSOAP("test_functionReturn"); */ SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn; Vector tempResult = (Vector) resultsRequestSOAP.getProperty("test_functionReturn"); int testsize = tempResult.size(); // SoapObject test = (SoapObject) tempResult.get(0); //String[] results = (String[]) resultRequestSOAP; Object tempvar = tempResult.elementAt(1); tv.setText(tempvar.toString()); } catch (Exception aE) { aE.printStackTrace (); tv.setText(aE.getClass().getName() + ": " + aE.getMessage()); } } }

    Read the article

  • Ethernet Communication Error

    - by SivaKumar
    Hi, I wrote a program to query the status of the Ethernet printer for that i created a TCP Stream Socket and i send the query command to the printer.In case of Error less condition it returns No error status but in error case its getting hang at recv command.Even i used Non blocking now the recv command returns nothing and error set as Resource temporarily unavailable. code: #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <errno.h> #include <stdlib.h> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <signal.h> #include <termios.h> #include <poll.h> #include <netinet/tcp.h> #include <stdarg.h> int main() { int ConnectSocket,ConnectSocket1,select_err,err,nRet,nBytesRead; struct timeval waitTime = {10,30}; fd_set socket_set; unsigned char * dataBuf = NULL; unsigned char tempVar, tempVar1, tempVar2, tempVar3; char reset[] = "\033E 2\r"; char print[] = "\033A 1\r"; char buf[1024]={0}; ConnectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); printf("The Socket ID is %d\n",ConnectSocket); if (ConnectSocket < 0) { perror("socket()"); return 0; } struct sockaddr_in clientService; clientService.sin_family = AF_INET; clientService.sin_addr.s_addr = inet_addr("192.168.0.129"); //Printer IP clientService.sin_port = htons( 9100); // Printer Port if ( connect( ConnectSocket, (struct sockaddr*) &clientService, sizeof(clientService) ) == -1) { perror("connect()"); close(ConnectSocket); return -1; } /* if((nRet = ioctl(ConnectSocket , FIONREAD, &nBytesRead) == -1)) { perror("ioctl()"); } perror("ioctl()"); */ FD_ZERO(&socket_set); FD_SET(ConnectSocket, &socket_set); do { errno=0; select_err = select(ConnectSocket+1, NULL, &socket_set, NULL, &waitTime); }while(errno==EINPROGRESS); if (-1 == select_err || 0 == select_err) { int optVal = 0; int optLen = sizeof(optVal); if(select_err == -1) { perror("select() write-side"); } else { //Timeout errno=0; err = getsockopt(ConnectSocket, SOL_SOCKET, SO_ERROR, (char*)&optVal, &optLen); printf("the return of the getsockopt is %d\n",err); printf("the opt val is %s\n",(char*)optVal); perror("getsockopt()"); if(err == -1) { perror("getsockopt() write-side"); } } printf("Select Failed during write - ConnectSocket: %d\n", ConnectSocket); //close(ConnectSocket); return -1; } err = send(ConnectSocket,print,sizeof(print)-1, 0); printf("\n No of Bytes Send is %d\n",err); if(err == -1 || err ==0) { perror("send()"); //close(ConnectSocket); return -1; } FD_ZERO(&socket_set); FD_SET(ConnectSocket, &socket_set); do { errno=0; select_err = select(ConnectSocket+1, NULL, &socket_set, NULL, &waitTime); }while(errno==EINPROGRESS); if (-1 == select_err || 0 == select_err) { printf("Select Failed during write - ConnectSocket: %d\n", ConnectSocket); return -1; } err = send(ConnectSocket,reset,sizeof(reset)-1, 0); printf("\n No of Bytes Send is %d\n",err); if(err == -1 || err ==0) { perror("send()"); //close(ConnectSocket); return -1; } FD_ZERO(&socket_set); FD_SET(ConnectSocket, &socket_set); printf("i am in reading \n"); select_err = select(ConnectSocket+1, &socket_set, NULL, NULL, &waitTime); printf("the retun of the read side select is %d \n",select_err); perror("select()"); if (-1 == select_err|| 0 == select_err) { printf("Read timeout; ConnectSocket: %d\n", ConnectSocket); close(ConnectSocket); perror("close()"); return -1; } printf("Before Recv\n"); nBytesRead = recv(ConnectSocket , buf, 1024, 0); printf("No of Bytes read is %d\n",nBytesRead); printf("%s\n",buf); if(nBytesRead == -1) { perror("recv()"); close(ConnectSocket); perror("clode()"); return -1; } close(ConnectSocket); return 1; }

    Read the article

1