Search Results

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

Page 1/1 | 1 

  • Reading Serial Data From C (OSX /dev/tty)

    - by Jud Stephenson
    I am trying to read data from a bluetooth barcode scanner (KDC300) using C. Here is the code I have so far, and the program successfully establishes a bluetooth connection to the scanner, but when a barcode is scanned, no input is displayed on the screen (Eventually more will be done with the data, but we have to get it working first, right). Here is the program: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <termios.h> #include <sys/ioctl.h> int main (int argc, const char * argv[]) { // define vars int STOP = 0; //char buf[255]; if(argv[1]) { int fd = open("/dev/tty.KDC1", O_RDONLY); if(fd == -1) { printf("%s", strcat("Unable to open /dev/tty.", argv[1])); } int res; while(STOP == 0) { while((res = read(fd,buf,255)) == 0); { if(res > 0) { buf[res]=0; printf("%s:%d\n", buf, res); if(buf[sizeof(buf)]=='\n') break; } } } } return 0; } If anyone has any ideas, I am at a loss on this so far. If it is any help, I can run screen /dev/tty.KDC1 and any barcodes scanned on the scanner appear in the terminal, I just can't do anything with the data. Jud

    Read the article

  • Find the source of malware?

    - by Jud Stephenson
    I have a server that was running an older version of lighttpd (1.4.19 on a freebsd 6.2-RELEASE (yea, old) machine) and google alerted me that it had found malware embedded on one of my server's pages. It just so happened to be our index page. I promptly removed the malware and started looking at server logs for how it got there. With no trace in any of the logs of the files being edited, I noticed that the index page's owner had been changed to www, which is the lighttpd user. I then concluded that some sort of veunerability must have existed for that software version and promptly upgraded to 1.4.26. Now the malware is back. I have started some pretty verbose server logging with ftp, lighttpd, and all login attempts to try and see how this script is getting in. Are their any suggestions as to other approaches to take?

    Read the article

  • iPad UIViewController loads as portrait when device is in landscape

    - by jud
    I have an application with 3 view controllers. They are all have shouldAutoRotateToInterfaceOrientation returning YES. The first two, my main menu and my submenu both autorotate just fine. The third viewcontroller, which programatically loads a UIImageView from a jpg file in the program's bundle, will only display in portrait. In the viewcontroller containing the image, i have this: NSString *imageName = [NSString stringWithFormat:@"%@-00%d.jpg",setPrefix,imageNumber]; UIImageView *pictureView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]]; pictureView.frame = CGRectMake(0, 0, 1024, 768); [self.view addSubview:pictureView]; and again, I have shouldAutoRotateToInterfaceOrientation returning YES for all orientations. My image shows up, but is sideways, and the 0,0,1024,768 values I used to make my rectangle start from the top right corner going down, instead of starting at the top left and going across (holding in landscape). Am I missing a parameter I need to set in order to ensure the imageview shows up in landscape instead of portrait?

    Read the article

  • Loop through hex variable in C

    - by Jud Stephenson
    I have the following code in a project that write's the ascii representation of packet to a unix tty: int written = 0; int start_of_data = 3; //write data to fifo while (length) { if ((written = write(fifo_fd, &packet[start_of_data], length)) == -1) { printf("Error writing to FIFO\n"); } else { length -= written; } } I just want to take the data that would have been written to the socket and put it in a variable. to debug, I have just been trying to printf the first letter/digit. I have tried numerous ways to get it to print out, but I keep getting hex forms (I think). The expected output is: 13176 and the hex value is: 31 33 31 37 36 0D 0A (if that is even hex) Obviously my C skills are not the sharpest tools in the shed. Any help would be appreciated.

    Read the article

  • Looping through values in NSDictionary throws fault

    - by jud
    I have a plist file that I am loading into an NSDictionary *setDictionary that contains a set of fields, pictureDesc1, pictureDesc2, etc. Once the NSDictionary is loaded, I can retrieve a value using [setDictionary objectForKey:@"pictureDesc1"]; But I cannot do a loop like this: for (int i=1; i<=numberOfPictures; i++) { NSString *keyName = [NSString stringWithFormat:@"pictureDesc%d",i]; NSString *description = [NSString stringWithFormat:@"%@", [setDictionary objectForKey:keyName]]; } Is there a different way to dynamically call keys from within an NSDictionary?

    Read the article

1