Search Results

Search found 10 results on 1 pages for 'seaworthy'.

Page 1/1 | 1 

  • eXML-PARSER output contains unwanted hash references

    - by seaworthy
    So I wrote a parser routine to take one xml file and reparse into another one. This code I later modified to split a large xml file into many small xml files. I am having a problem with an output. Parsing works fine the only thing output also includes unwanted strings like HASH(0x19f9b58), I am not sure why and need set of friendly eyes. use Encode; use XML::Parser; my $parser = XML::Parser->new( Handlers => {Start => \&handle_elem_start, End => \&handle_elem_end,Char => \&handle_char_data,}); my $record; my $file = shift @ARGV; if( $file ) {$parser->parsefile( $file );} exit; sub handle_elem_start { my( $expat, $name, %atts ) = @_; if ($name eq 'articles'){$file="_data.xml";unlink($file);} $record .= "<"; $record .= "$name"; foreach my $key (keys %atts){$record .= " $key=\"$atts{$key}\"";} $record .= ">"; } sub handle_char_data { my( $expat, $text ) = @_; $text = decode_utf8( $text ); $record .= "$text"; } sub handle_elem_end { my( $expat, $name ) = @_; $record .= "</$name>"; if( $name eq 'article' ) { open (MYFILE, '>>'.$file); print MYFILE $record; close (MYFILE); print $record; $record = {}; } return unless( $name eq 'article' ); } Sample output: ... </article>HASH(0x19f9b40) <article doi="10.1103/PhysRevSeriesI.9.304"> <journal short="Phys. Rev. (Series I)" jcode="PRI">Physical Review (Series I)</journal> <volume>9</volume> <issue printdate="1899-11-00">5</issue> <fpage>304</fpage> <lpage>309</lpage> <seqno>1</seqno> <price></price><tocsec>Articles</tocsec> <arttype type="article"></arttype><doi>10.1103/PhysRevSeriesI.9.304</doi> <title>An Investigation of the Magnetic Qualities of Building Brick</title> <authgrp> <author><givenname>O.</givenname><middlename>A.</middlename><surname>Gage</surname></author> <author><givenname>H.</givenname><middlename>E.</middlename><surname>Lawrence</surname></author> </authgrp> <cpyrt> <cpyrtdate date="1899"></cpyrtdate><cpyrtholder>The American Physical Society</cpyrtholder> </cpyrt> </article>HASH(0x19f9b58) ... HASH strings are not wanted, please advise.

    Read the article

  • Why when I render a scene with a revolving camera objects that you'd expect to appear behind others

    - by seaworthy
    Hello, I am rendering a scene in which I have two spheres. I am revolving a camera around one of them. What happens is counter-intuitive. When the camera goes around the sphere the other gets in front of it when you'd expect it to be behind. So it appears as though the spheres aren't revolving around each other and the one the should go around is always upfront. Please help. Here is the code that renders the scene: glLoadIdentity(); [self positionCamera]; glutSolidSphere(2, 12,12); glPushMatrix(); glTranslatef(5, 0, 0); glutSolidSphere(0.5, 12,12); glPopMatrix(); glFlush(); This block is part of a class that gets called on using. [NSTimer scheduledTimerWithTimeInterval:DEFAULT_ANIMATION_INTERVAL target:self selector:@selector(drawRect) userInfo:nil repeats:YES]; And -(void)positionCamera{} Contains math do camera revolution and gluLookAt()

    Read the article

  • Can a function return an object? Objective-C and NSMutableArray

    - by seaworthy
    I have an NSMutableArray. It's members eventually become members of an array instance in a class. I want to put the instantiantion of NSMutable into a function and to return an array object. If I can do this, I can make some of my code easier to read. Is this possible? Here is what I am trying to figure out. //Definition: > function Objects (float a, float b) { > NSMutableArray *array = [[NSMutableArray alloc] init]; > [array addObject:[NSNumber numberWithFloat:a]]; > [array addObject:[NSNumber numberWithFloat:b]]; > //[release array]; ???????? return array; > } //Declaration: Math *operator = [[Math alloc] init]; [operator findSum:Objects(20.0,30.0)]; My code compiles if I instantiate NSMutableArray right before I send the message to the receiver. I know I can have an array argument along with the method. What I have problem seeing is how to use a function and to replace the argument with a function call. Any help is appreciated. I am interested in the concept not in suggestions to replace the findSum method.

    Read the article

  • Problem displaying Vertex Buffer Object (OpenGL and Obj-C)

    - by seaworthy
    Hey, I am having a problem displaying or loading a buffer with an array of vertices. I know that array works fine because I am able to render it using a loop and a glVertex command. I can't figure out what's wrong. Your insight is highly appreciated. GLuint vboId; glGenBuffers( 1, &vboId ); glBindBuffer( GL_ARRAY_BUFFER, vboId); glBufferData( GL_ARRAY_BUFFER, count*sizeof( GLfloat ),array,GL_STATIC_DRAW_ARB ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); printf("%d\n",count); glEnableClientState( GL_VERTEX_ARRAY ); glBindBuffer( GL_ARRAY_BUFFER, vboId ); glVertexPointer( 3, GL_FLOAT, 0, 0 ); glDisableClientState( GL_VERTEX_ARRAY ); printf("vboId: [%hd]",vboId); glDeleteBuffers(1, &vboId); Help?

    Read the article

  • NSArray multiply each argument

    - by seaworthy
    Is the there a way to multiply each NSNumber contained in the array by 10? Here is what I have so far: NSMutableArray *vertex = [NSMutableArray arrayWithCapacity:3]; [vertex addObject:[NSNumber numberWithFloat:1.0]]; [vertex addObject:[NSNumber numberWithFloat:2.0]]; [vertex addObject:[NSNumber numberWithFloat:3.0]]; [vertex makeObjectsPerformSelector:@selector(doSomethingToObject:)]; I am not sure what selector to use to do this, please help!

    Read the article

  • What's an easy way to set up object communication in Obj-C?

    - by seaworthy
    I am trying to send a slider value from a controller object to a method of a model object. The later is implemented in the separate file and I have appropriate headers. I think the problem is that I am not sure how to instantiate the receiver in order to produce a working method for the controller. Here is the controller's method. -(IBAction)setValue:(id)slider {[Model setValue:[slider floatValue]];} @implementation Model -(void)setValue:(float)n{ printf("%f",n); } @end What I get is 'Model' may not respond to '+setValue' warning and no output in my console. Any insight is appreciated.

    Read the article

  • PHP Timezone problem

    - by seaworthy
    I am in Albuquerque, NM. I am trying to update some stamps every time I put an entry into a database. Here is what I use. date_default_timezone_set("US/Mountain"); $stamp =mktime(); //$stamp = gmmktime(); $time = date("H:i:s",$stamp);$date = date("Y-m-d",$stamp); My local time is 12:15 PM but what I get is 18:15PM instead. If you can see what's going wrong please let me know.

    Read the article

  • How to determine magnitude of trigonometric function? C++

    - by seaworthy
    > if (((test>=0) && (test<=90)) || ((test>270) && (test<=360))){n_y=1;} > else {n_y=-1;} I need the magnitude of trigonometric function in order to determine the sign of the trigonometric function for an angle falling into a particular quadrant. My plan is to replace the code above with something equivalent. Here is what I want to do in pseudo-code. n_y = cos(test) / (magnitude of cos (test)); This will give me same thing. Abs() only takes integers. Any help is appreciated.

    Read the article

  • How to I initialize a class with an interface button clicked? [Objective - C]

    - by seaworthy
    I am having a problem with figuring out how to initialize a class with button clicked. The code is listed below the line I have a problem with has "HELP NEEDED HERE" comment above it. // // Controller.m // #import "Controller.h" @implementation Controller - (id)init { self = [super init]; if(self){ numberTotal = 0; //HELP NEEDED HERE [self btnScore_Clicked:(id)sender]; } return self;} - (IBAction) btnScore_Clicked:(id)sender { numberTotal += 1; NSLog(@"Number Total: %d",numberTotal); } - (void)dealloc { [super dealloc]; } @end // // Controller.h // #import <UIKit/UIKit.h> @interface Controller : UIViewController { NSInteger numberTotal; } - (IBAction) btnScore_Clicked:(id)sender; @end Thanks!

    Read the article

  • How to remove certain lists from a list of lists using python?

    - by seaworthy
    I can not figure out why my code does not filter out lists from a predefined list. I am trying to remove specific list using the following code. data = [[1,1,1],[1,1,2],[1,2,1],[1,2,2],[2,1,1],[2,1,2],[2,2,1],[2,2,2]] data = [x for x in data if x[0] != 1 and x[1] != 1] print data My result: data = [[2, 2, 1], [2, 2, 2]] Expected result: data = [[1,2,1],[1,2,2],[2,1,1],[2,1,2],[2,2,1],[2,2,2]]

    Read the article

1