Search Results

Search found 4763 results on 191 pages for 'adams john'.

Page 133/191 | < Previous Page | 129 130 131 132 133 134 135 136 137 138 139 140  | Next Page >

  • Ruby hash value truthiness and symbols

    - by John Topley
    Could somebody please explain why the variable named foo remains true in the code below, even though it's set to false when the method is called? And why the symbol version behaves as expected? def test(options = {}) foo = options[:foo] || true bar = options[:bar] || :true puts "foo is #{foo}, bar is #{bar}" end >> test(:foo => false, :bar => :false) foo is true, bar is false I've only tried this using Ruby 1.8.7.

    Read the article

  • MySQL - Limit a left join to the first date-time that occurs?

    - by John M
    Simplified table structure (the tables can't be merged at this time): TableA: dts_received (datetime) dts_completed (datetime) task_a (varchar) TableB: dts_started (datetime) task_b (varchar) What I would like to do is determine how long a task took to complete. The join parameter would be something like ON task_a = task_b AND dts_completed < dts_started The issue is that there may be multiple date-times that occur after the dts_completed. How do I create a join that only returns the first tableB-datetime that occurs after the tableA-datetime?

    Read the article

  • Converting OpenGL coordinates to lower UIView (and UIImagePickerController)

    - by John Qualis
    I am new to OpenGL on the iPhone. I am developing an iPhone app similar to a barcode reader but with an extra OpenGL layer. The bottommost layer is UIImagePickerController, then I use UIView on top and draw a rectangle at certain coordinates on the iPhone screen. So far everything is OK. Then I am trying to draw an OpenGL 3-D model in that rectangle. I am able to load a 3-D model in the iPhone based on this code here - http://iphonedevelopment.blogspot.com/2008/12/start-of-wavefront-obj-file-loader.html I am not able to transform the coordinates of the rectangle into OpenGL coordinates. Appreciate any help. Do I need to use a matrix to translate the currentPosition of the 3-D model so it is drawn within myRect? The code is given below. -(void)setupView:(GLView*)view { const GLfloat zNear = 0.01, zFar = 1000.0, fieldOfView = 45.0; GLfloat size; glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); size = zNear * tanf(DEGREES_TO_RADIANS(fieldOfView) / 2.0); CGRect rect = view.bounds; glFrustumf(-size, size, -size / (rect.size.width / rect.size.height), size / (rect.size.width / rect.size.height), zNear, zFar); glViewport(0, 0, rect.size.width, rect.size.height); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); NSString *path = [[NSBundle mainBundle] pathForResource:@"plane" ofType:@"obj"]; OpenGLWaveFrontObject *theObject = [[OpenGLWaveFrontObject alloc] initWithPath:path]; Vertex3D position; position.z = -8.0; position.y = 3.0; position.x = 2.0; theObject.currentPosition = position; self.plane = theObject; [theObject release]; } - (void)drawView:(GLView*)view; { static GLfloat rotation = 0.0; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glColor4f(0.0, 0.5, 1.0, 1.0); // the coordinates of the rectangle are // myRect.x, myRect.y, myRect.width, myRect.height // Do I need to use a matrix to translate the currentPosition of the // 3-D model so it is drawn within myRect? //glOrthof(-160.0f, 160.0f, -240.0f, 240.0f, -1.0f, 1.0f); [plane drawSelf]; }

    Read the article

  • Trying to understand crash log output

    - by John Smith
    I'm trying to understand debug output from a crash log. I have the following line from the crashlog: 22 FG 0x00022b94 0x1000 + 138132 I understand how to use atos on 0x00022b94 to get the source code location. What I would like to know is why the crash log helpfully splits that number into 0x1000 + 138132? I have googled and the googles failed me.

    Read the article

  • Why does Ruby 1.9.2 remove "." from LOAD_PATH, and what's the alternative?

    - by John Feminella
    The latest changesets to Ruby 1.9.2 no longer make the current directory . part of your LOAD_PATH. I have a non-trivial number of Rakefiles that assume that . is part of the LOAD_PATH, so this broke them. Was there a particular justification for doing this? As for a fix, adding $: << "." everywhere works, but seems incredibly hacky and I don't want to do that. What's the preferred way to make my Rakefiles 1.9.2+ compatible?

    Read the article

  • How to test obtaining a list of files within a directory using RSpec?

    - by John Topley
    I'm pretty new to the world of RSpec. I'm writing a RubyGem that deals with a list of files within a specified directory and any sub-directories. Specifically, it will use Find.find and append the files to an Array for later output. I'd like to write a spec to test this behaviour but don't really know where to start in terms of faking a directory of files and stubbing Find.find etc. This is what little I have so far: it "should return a list of files within the specified directory" do end Any help much appreciated!

    Read the article

  • Comma separated values in a database field

    - by John Doe
    I have a products table. Each row in that table corresponds to a single product and it's identified by a unique Id. Now each product can have multiple "codes" associated with that product. For example: Id | Code ---------------------- 0001 | IN,ON,ME,OH 0002 | ON,VI,AC,ZO 0003 | QA,PS,OO,ME What I'm trying to do is create a stored procedure so that I can pass in a codes like "ON,ME" and have it return every product that contains the "ON" or "ME" code. Since the codes are comma separated, I don't know how I can split those and search them. Is this possible using only TSQL? Edit: It's a mission critical table. I don't have the authority to change it.

    Read the article

  • tortoisesvn - Error REPORT request failed on ../../../!svn/vcc/default

    - by John
    Users attempting to check out files from a particular Subversion 1.4.x repository with Apache 2.2 on Windows 2003 have suddenly begun getting an error message in their log windows upon checkout with TortoiseSVN 1.4: Error REPORT request failed on '/[path_to_repo]/!svn/vcc/default' Error REPORT of '/[path_to_repo]/!svn/vcc/default': 200 OK (http://[server_name]) This started following an hd crash on the server and subsequent restore of about 10 subversion repositories. Only one repository is having this problem after an attempted working directory reconciliation. The repo owner reconcile their working directory with the repository by modifying/deleting the hidden .svn directories (though this was not advised). I can't find anything on the Internets that represents my situation. The restored server is exactly as the original and no other repositories on this server are throwing errors. Any ideas on 1) what this error is and 2) how to fix it?

    Read the article

  • 2 dimensional arrays passed to a function in c++

    - by John Marcus
    I'm working on doing calculations in a two dimensional array but keep getting a nasty error. i call the function by : if(checkArray(array)) and try to pass it in like this: bool checkArray(double array[][10]) //or double *array[][10] to no avail the error is error: cannot convert ‘double ()[(((unsigned int)(((int)n) + -0x00000000000000001)) + 1)]’ to ‘double’ for argument ‘1’ to ‘bool checkArray(double*)’ code snippet //array declaration int n = 10; double array[n][n]; //function call to pass in array while(f != 25) { cout<<endl; cout<<endl; if(checkArray(array)) //this is the line of the error { cout<<"EXIT EXIT EXIT"<<endl; } f++; } //function declaration bool checkArray(double *array)//, double newArray[][10]) { double length = sizeof(array); for(int i = 0; i < length; i++) for(int j = 0; j < length;j++) { double temp = array[i][j]; } }

    Read the article

  • How to check if TypeIdenitifier(T) is an Object?

    - by John
    I'm creating a generic list class that has a member of type Array(Array of ). The problem is the class descruction,because the class is supposed to be used for types from byte to types inheriting TObject. Specifically: destructor Destroy; var elem:T; begin /*if(T is Tobject) then //Check if T inherits TObject {Compiler error!} for elem in FData do TObject(elem).Free;*/ // do not know how to do it SetLength(FItems,0); //FItems : Array of T inherited Destroy; end; How do I check if T is TObject so I can free every member if the typeidenitifier is a class,for example?

    Read the article

  • Does a Distributed Version Control System really have no centralised repository?

    - by John
    It might seem a silly question, but how do you get a working drectory set up without a server to check out from? And how does a business keep a safe backed up copy of the repo? I assume then there must be a central repo... but then how exactly is it 'distributed'? I always thought of a server-client (SVN) Vs peer-2-peer (GIT) distinction, but I don't believe that can be correct unless tools like GIT are dependent on torrent-style technology?

    Read the article

  • R: How to separate character output in a loop?

    - by John
    I'm blanking on the best way to paste a list of strings together to go into an SQL statement... I'm having trouble with the separator bar | printing at the beginning when I don't want it to: foo = "blah" paste_all_together = NULL for (n in 1:4) { paste_together = paste(foo ,sep = "") paste_all_together = paste(paste_all_together, paste_together, sep = "|") } > paste_all_together [1] "|blah|blah|blah|blah" I just want it to print out "blah|blah|blah|blah". Do I need a nested loop, or is there a better itterator in R for doing this? Or perhaps a better way to input SQL statements?

    Read the article

  • django overwrite form clean method

    - by John
    Hi, When overwriting a form clean method how do you know if its failed validation on any of the fields? e.g. in the form below if I overwrite the clean method how do I know if the form has failed validation on any of the fields? class PersonForm(forms.Form): title = Forms.CharField(max_length=100) first_name = Forms.CharField(max_length=100) surname = Forms.CharField(max_length=100) password = Forms.CharField(max_length=100) def clean(self, value): cleaned_data = self.cleaned_data IF THE FORM HAS FAILED VALIDATION: self.data['password'] = 'abc' raise forms.ValidationError("You have failed validation!") ELSE: return cleaned_data Thanks

    Read the article

  • T-SQL Question : Query to XML

    - by Juvil John Soriano
    anyone can show me how to generate from this data ------------------------DATA-------------------------- Key ParentKey 5 NULL 25 5 33 25 26 5 27 5 34 27 28 5 29 5 to this XML result? ---------------------RESULTS-------------------------- <record key="5" parentkey = ""> <record key="25" parentkey = "5"> <record key="33" parentkey = "25"></record> </record> </record> <record key="25" parentkey = "5"> <record key="26" parentkey = "5"> <record key="27" parentkey = "5"> <record key="34" parentkey = "27"></record> </record> </record> <record key="28" parentkey = "5"> <record key="29" parentkey = "5"> </record>

    Read the article

  • Generating HTML Programmatically in C#, Targeting Printed Reports

    - by John Passaniti
    I've taken over a C# (2.0) code base that has the ability to print information. The code to do this is insanely tedious. Elements are drawn onto each page, with magic constants representing positioning. I imagine the programmer sitting with a ruler, designing each page by measuring and typing in the positions. And yes, one could certainly come up with some nice abstractions to make this approach rational. But I am looking at a different method. The idea is that I'll replace the current code that prints with code that generates static HTML pages, saves them to a file, and then launches the web browser on that file. The most obvious benefit is that I don't have to deal with formatting-- I can let the web browser do that for me with tags and CSS. So what I am looking for is a very lightweight set of classes that I can use to help generate HTML. I don't need anything as heavyweight as HTMLTextWriter. What I'm looking for is something to avoid fragments like this: String.Format("<tr><td>{0}</td><td>{1}</td></tr>", foo, bar); And instead take have this kind of feel: ... table(). tr(). td(foo). td(bar) Or something like that. I've seen lightweight classes like that for other languages but can't find the equivalent (or better) for C#. I can certainly write it myself, but I'm a firm believer in not reinventing wheels. Know anything like this? Know anything better than this?

    Read the article

  • How can I view the all inherited url-resolution rules affecting a given directory?

    - by john.designop.us
    I work on two sites hosted on the same server, using the same CMS configurations and identical .htaccess files in their respective document roots. One site is letting me use the CMS's clean-url mode, and the other isn't. Site #2 functions fine in ?=messy-url mode, but when I turn clean urls on in the admin panel, and request a rewritten URL, I get a 404 error served before the CMS sees the request. I've contacted the server administrator, but he isn't inclined to provide support and the site owners are beholden to this hosting provider. I have shell access to the Linux-based server, and I can verify that mod_php and mod_rewrite are active, but I don't know what more I can do to troubleshoot this issue. Is there any way to identify directives upstream that may be differentiating the way http requests are handled by the two sites? Thanks!

    Read the article

  • Avoiding sub-type selection in view code

    - by John Donoghue
    Hi, I have some code where the model contains some classes like (vb.net pseudocode, but could be any OO language): Enum AttributeType Boolean Date String End Enum MustInherit Class Attibute Must Override Function Type As AttributeType End Class Class BooleanAttribute: Attribute Function Type As AttributeType Return AttributeType.Boolean End Function End Class And the view contains some code like: Select Case AttributeType Case Boolean //Display checkbox control Case Date //Display date picker control Case String //Display textbox control End Select I don't really like the code in the view, for the hopefully obvious reasons (what happens when I get a new attribute type etc). My question is, how should I replace it? I could easily add a method to the concrete classes, but that pollutes the model with UI stuff so that's a horrible idea. I could move the select into a factory, but that seems to be just hiding the problem. Can anybody advise a better approach?

    Read the article

  • Kohana 3 - How do I make the Default Route pass arguments to the Controller's Action?

    - by John Himmelman
    My controller action requires a parameter, but I can't get KO3's router to pass this parameter in the Default route. This sort of thing works with other routes. Here is an example to clarify... In bootstrap.php... Route::set('default', '(<controller>(/<action>(/<the_required_param>)))') ->defaults(array( 'controller' => 'DefaultController', 'action' => 'index', 'the_required_param' => 'some_default_value', )); In controller file... class DefaultController extends Controller { public function index($the_required_param) { echo 'value: ' . $the_required_param; } }

    Read the article

  • Why does my git push hang after successfully pushing?

    - by John
    On a newly set up ssh git repo, whenever I push, I get normal output like this: ? git push Counting objects: 15, done. Delta compression using up to 4 threads. Compressing objects: 100% (9/9), done. Writing objects: 100% (9/9), 989 bytes, done. Total 9 (delta 7), reused 0 (delta 0) It happens very quickly, and the changes are immediately available on the server repo. But the output hangs there for about a minute, and then finishes with: To [email protected]:baz.git c8c391c..1de5e80 branch_name -> branch_name If I control-c before it finishes, everything seems to continue to be normal and healthy, locally and remotely. What is it doing while hanging? Is something configured incorrectly on the server side?

    Read the article

< Previous Page | 129 130 131 132 133 134 135 136 137 138 139 140  | Next Page >