Search Results

Search found 1965 results on 79 pages for 'robert ve'.

Page 39/79 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • PHP Global variable in class is reset

    - by Robert
    I have a web form that manipulates records in a MySQL database. I have a method for displaying an edit interface for both creating new records and editing them if ($_POST['new_page']) { print "<h2>Create new page</h2>\n"; $isNew=1; $this->EditForm(); } else if($_POST['edit']){ print "<h2>Edit page</h2>\n"; $isNew=0; $this->EditForm(); } I am trying to use the global variable $isNew to determine where a record is to be added or updated. However, whenever my SaveChanges() function is run, $isNew is always 0. $isNew is declared immediately after the class declaration, outside all of the functions. class Editor{ public $isNew;

    Read the article

  • How do I pass Url Parameters on a POST?

    - by Robert Harvey
    I have a controller method with the following signature: [AcceptVerbs(HttpVerbs.Post)] public ActionResult UpdateValues(int id, MyViewModel[] array) { } The id is normally picked up as part of the Url on other GET controller methods (I have a working route that does this) I am successfully passing the array1 from the form in my view to the controller method, but how do I also put the id onto my Url so that when the user clicks the Submit button, the controller method will pick up the ID?

    Read the article

  • How do I check if a scalar has a compiled regex in it with Perl?

    - by Robert P
    Let's say I have a subroutine/method that a user can call to test some data that (as an example) might look like this: sub test_output { my ($self, $test) = @_; my $output = $self->long_process_to_get_data(); if ($output =~ /\Q$test/) { $self->assert_something(); } else { $self->do_something_else(); } } Normally, $test is a string, which we're looking for anywhere in the output. This was an interface put together to make calling it very easy. However, we've found that sometimes, a straight string is problematic - for example, a large, possibly varying number of spaces...a pattern, if you will. Thus, I'd like to let them pass in a regex as an option. I could just do: $output =~ $test if I could assume that it's always a regex, but ah, but the backwards compatibility! If they pass in a string, it still needs to test it like a raw string. So in that case, I'll need to test to see if $test is a regex. Is there any good facility for detecting whether or not a scalar has a compiled regex in it?

    Read the article

  • Determining where in the code an error came from - iPhone

    - by Robert Eisinger
    I'm used to Java programming where an error is thrown and it tells you at what line the error was thrown from which file. But with Objective-C in XCode, I can't ever tell where the error comes from. How can I figure out where the error came from? Here is an example of a crash error: 2011-01-04 10:36:31.645 TestGA[69958:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array' *** Call stack at first throw: ( 0 CoreFoundation 0x01121be9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x012765c2 objc_exception_throw + 47 2 CoreFoundation 0x011176e5 -[__NSArrayM objectAtIndex:] + 261 3 TestGA 0x000548d8 -[S7GraphView drawRect:] + 5763 4 UIKit 0x003e16eb -[UIView(CALayerDelegate) drawLayer:inContext:] + 426 5 QuartzCore 0x00ec89e9 -[CALayer drawInContext:] + 143 6 QuartzCore 0x00ec85ef _ZL16backing_callbackP9CGContextPv + 85 7 QuartzCore 0x00ec7dea CABackingStoreUpdate + 2246 8 QuartzCore 0x00ec7134 -[CALayer _display] + 1085 9 QuartzCore 0x00ec6be4 CALayerDisplayIfNeeded + 231 10 QuartzCore 0x00eb938b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 325 11 QuartzCore 0x00eb90d0 _ZN2CA11Transaction6commitEv + 292 12 QuartzCore 0x00ee97d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99 13 CoreFoundation 0x01102fbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27 14 CoreFoundation 0x010980e7 __CFRunLoopDoObservers + 295 15 CoreFoundation 0x01060bd7 __CFRunLoopRun + 1575 16 CoreFoundation 0x01060240 CFRunLoopRunSpecific + 208 17 CoreFoundation 0x01060161 CFRunLoopRunInMode + 97 18 GraphicsServices 0x01932268 GSEventRunModal + 217 19 GraphicsServices 0x0193232d GSEventRun + 115 20 UIKit 0x003b842e UIApplicationMain + 1160 21 TestGA 0x00001cd8 main + 102 22 TestGA 0x00001c69 start + 53 23 ??? 0x00000001 0x0 + 1 So from looking at this, where is the error coming from and from which class is it coming from?

    Read the article

  • OO Design: use Properties or Overloaded methods?

    - by Robert Frank
    Question about OO design. Suppose I have a base object vehicle. And two descendants: truck and automobile. Further, suppose the base object has a base method: FixFlatTire(); abstract; When the truck and automobile override the base object's, they require different information from the caller. Am I better off overloading FixFlatTire like this in the two descendant objects: Procedure Truck.FixFlatTire( OfficePhoneNumber: String; NumberOfAxles: Integer): Override; Overload; Procedure Automobile.FixFlatTire( WifesPhoneNumber: String; AAAMembershipID: String): Override; Overload; Or introducing new properties in each of the descendants and then setting them before calling FixFlatTire, like this: Truck.OfficePhoneNumber := '555-555-1212'; Truck.NumberOfAxles := 18; Truck.FixFlatTire(); Automobile.WifesPhoneNumber := '555-555-2323'; Automobile.AAAMembershipID := 'ABC'; Automobile.FixFlatTire();

    Read the article

  • Name for a "naive" timekeeping system?

    - by Robert L
    I am thinking of a "naive" timekeeping system of the sort I believe would be likely to be implemented by non-specialists. A day is exactly 24 hours. An hour is exactly 60 minutes. A minute is exactly 60 seconds. No exceptions (i.e. no Daylight Saving or leap seconds). A leap year occurs exactly once every four years: if the year modulo 4 equals 0, it is a leap year. The month lengths are the normal 31 days for January, 28 or 29 days for February, etc., that you would expect to find on a wall calendar. Days of the week, if they are used, are what you would get by taking your contemporary (late 1900's / early 2000's) wall calendar and, using the above rules for leap years and month lengths, extrapolating in both directions: if the calendar goes far back enough, February 29, 1900 exists and is a Wednesday; and if the calendar goes far forward enough, February 29, 2100 exists and is a Monday. What name, if any, is used to describe precisely this system?

    Read the article

  • ASP ListView: How do I access the data that is databound to the rows?

    - by Robert
    I want to access the data that was databound to my list view when handling list view events such as: protected void List_ItemDataBound(object sender, ListViewItemEventArgs e) or protected void List_ItemCommand(object sender, ListViewCommandEventArgs e) Inside the events, I can not access the data via somthing like Eval("ID") Currently we are using a very hacky solution: string id = e.Item.FindControl("lblID").Text; Where lblID is a hidden control that is populated with data in the aspx file using: <asp:Label ID="lblID" runat="server" Text='<%# Eval("ID") %>' /> My eyes bleed when I look at this, Is there a better way?

    Read the article

  • Netbeans or Eclipse for C++?

    - by Robert Gould
    I'm currently working on a pet project and need to do C++ development on Windows, Mac, Linux, and Solaris, and I've narrowed it down to Netbeans and Eclipse, so I was wonderig which is more solid as a C++ editor. I just need solid editing, good autocompletion for templated code ad external libraries, and project file management, the build tools are external, so thats irrelevant here, for my comparison. Thus which is a better choice? Note: I know I should be using emacs or vim, but the issue is, my theory at least, that I'm left handed, so I use my right side (design,creativity) of the brain more than the left side (logic, memory), so I just simply cannot use emacs or vim, my brain simply isn't compatible, I tried them many times too, even used emacs for a few months but it drove me crazy... Thanks

    Read the article

  • Creating TCP network errors for unit testing

    - by Robert S. Barnes
    I'd like to create various network errors during testing. I'm using the Berkely sockets API directly in C++ on Linux. I'm running a mock server in another thread from within Boost.Test which listens on localhost. For instance, I'd like to create a timeout during connect. So far I've tried not calling accept in my mock server and setting the backlog to 1, then making multiple connections, but all seem to successfully connect. I would think that if there wasn't room in the backlog queue I would at least get a connection refused error if not a timeout. I'd like to do this all programatically if possible, but I'd consider using something external like IPchains to intentionally drop certain packets to certain ports during testing, but I'd need to automate creating and removing rules so I could do it from within my Boost.Test unit tests. I suppose I could mock the various system calls involved, but I'd rather go through a real TCP stack if possible. Ideas?

    Read the article

  • Marionette js itemview not defined: then on browser refresh it is defined and all works well - race condition?

    - by Robert
    Yeah it's just the initial browser load or two after a cache clear. Subsequent refreshes clear the problem up. I'm thinking the item views just aren't fully constructed in time to be used in the collection views on the first load. But then they are on a refresh? Don't know. There must be something about the code sequence or loading or the load time itself. Not sure. I'm loading via require.js. Have two collections - users and messages. Each renders in its own list view. Each works, just not the first time or two the browser loads. The first time you load after clearing browser cache the console reports, for instance: "Uncaught ReferenceError: MessageItemView is not defined" A simple browser refresh clears it up. Same goes for the user collection. It's collection view says it doesn't know anything about its item view. But a simple browser refresh and all is well. My views (item and collection) are in separate files. Is that the problem? For instance, here is my message collection view in its own file: messagelistview.js var MessageListView = Marionette.CollectionView.extend({ itemView: MessageItemView, el: $("#messages") }); And the message item view is in a separate file: messageview.js var MessageItemView = Marionette.ItemView.extend({ tagName: "div", template: Handlebars.compile( '<div>{{fromUserName}}:</div>' + '<div>{{message}}</div>' + ) }); Then in my main module file, which references each of those files, the collection view is constructed and displayed: main.js //Define a model MessageModel = Backbone.Model.extend(); //Make an instance of MessageItemView - code in separate file, messagelistview.js MessageView = new MessageItemView(); //Define a message collection var MessageCollection = Backbone.Collection.extend({ model: MessageModel }); //Make an instance of MessageCollection var collMessages = new MessageCollection(); //Make an instance of a MessageListView - code in separate file, messagelistview.js var messageListView = new MessageListView({ collection: collMessages }); App.messageListRegion.show(messageListView); Do I just have things sequenced wrong? I'm thinking it's some kind of race condition only because over 3G to an iPad the item views are always undefined. They never seem to get constructed in time. PC on a hard wired connection does see success after a browser refresh or two.

    Read the article

  • How to use a TFileStream to read 2D matrices into dynamic array?

    - by Robert Frank
    I need to read a large (2000x2000) matrix of binary data from a file into a dynamic array with Delphi 2010. I don't know the dimensions until run-time. I've never read raw data like this, and don't know IEEE so I'm posting this to see if I'm on track. I plan to use a TFileStream to read one row at a time. I need to be able to read as many of these formats as possible: 16-bit two's complement binary integer 32-bit two's complement binary integer 64-bit two's complement binary integer IEEE single precision floating-point For 32-bit two's complement, I'm thinking something like the code below. Changing to Int64 and Int16 should be straight forward. How can I read the IEEE? Am I on the right track? Any suggestions on this code, or how to elegantly extend it for all 4 data types above? Since my post-processing will be the same after reading this data, I guess I'll have to copy the matrix into a common format when done. I have no problem just having four procedures (one for each data type) like the one below, but perhaps there's an elegant way to use RTTI or buffers and then move()'s so that the same code works for all 4 datatypes? Thanks! type TRowData = array of Int32; procedure ReadMatrix; var Matrix: array of TRowData; NumberOfRows: Cardinal; NumberOfCols: Cardinal; CurRow: Integer; begin NumberOfRows := 20; // not known until run time NumberOfCols := 100; // not known until run time SetLength(Matrix, NumberOfRows); for CurRow := 0 to NumberOfRows do begin SetLength(Matrix[CurRow], NumberOfCols); FileStream.ReadBuffer(Matrix[CurRow], NumberOfCols * SizeOf(Int32)) ); end; end;

    Read the article

  • Passing an array as a function parameter in JavaScript

    - by Robert
    Hi all, i'd like to call a function using an array as a parameters: var x = [ 'p0', 'p1', 'p2' ]; call_me ( x[0], x[1], x[2] ); // i don't like it function call_me (param0, param1, param2 ) { // ... } Is there a better way of passing the contents of x into call_me()? Ps. I can't change the signature of call_me(), nor the way x is defined. Thanks in advance

    Read the article

  • Preventing fixed footer from overlapping content

    - by Robert Morgan
    I've fixed my footer DIV to the bottom of the viewport as follows: #Footer { position: fixed; bottom: 0; } This works well if there isn't much content on the page. However, if the content fills the full height of the page (i.e. the vertical scroll bar is visible) the footer overlaps the content, which I don't wont. How can I get the footer to stick to the bottom of the viewport, but never overlap the content?

    Read the article

  • Enterprise Library Validation Block - Should validation be placed on class or interface?

    - by Robert MacLean
    I am not sure where the best place to put validation (using the Enterprise Library Validation Block) is? Should it be on the class or on the interface? Things that may effect it Validation rules would not be changed in classes which inherit from the interface. Validation rules would not be changed in classes which inherit from the class. Inheritance will occur from the class in most cases - I suspect some fringe cases to inherit from the interface (but I would try and avoid it). The interface main use is for DI which will be done with the Unity block.

    Read the article

  • Write-Only Reference in C++?

    - by Robert Mason
    Is there a way to code a write-only reference to an object? For example, suppose there was a mutex class: template <class T> class mutex { protected: T _data; public: mutex(); void lock(); //locks the mutex void unlock(); //unlocks the mutex T& data(); //returns a reference to the data, or throws an exception if lock is unowned }; Is there a way to guarantee that one couldn't do this: mutex<type> foo; T& ref; foo.lock(); ref = foo.data(); foo.unlock(); //I have a unguarded reference to foo now On the other hand, is it even worth it? I know that some people assume that programmers won't deliberately clobber the system, but then, why do we have private variables in the first place, eh? It'd be nice to just say it's "Undefined Behavior", but that just seems a little bit too insecure.

    Read the article

  • Localizing a plist with grouped data

    - by Robert Altman
    Is there a way to localize a plist that contain hierarchical or grouped data? For instance, if the plist contains: Book 1 (dictionary) Key (string) Name (string) Description (localizable string) Book 2 (dictionary) Key (string) Name (string) Description (localizable string) (etcetera...) For the sake of the example, the Key and Name should not be translated (and preferably should not be duplicated in multiple localized property lists). Is there a mechanism for providing localizations for the localizable Description field without localizing the entire property list? The only other strategy that came to my mind is to store a lookup key in the description field and than use that to retrieve the localized text via NSLocalizedString(...) Thanks.

    Read the article

  • Mutable objects and hashCode

    - by robert
    Have the following class: public class Member { private int x; private long y; private double d; public Member(int x, long y, double d) { this.x = x; this.y = y; this.d = d; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + x; result = (int) (prime * result + y); result = (int) (prime * result + Double.doubleToLongBits(d)); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Member) { Member other = (Member) obj; return other.x == x && other.y == y && Double.compare(d, other.d) == 0; } return false; } public static void main(String[] args) { Set<Member> test = new HashSet<Member>(); Member b = new Member(1, 2, 3); test.add(b); System.out.println(b.hashCode()); b.x = 0; System.out.println(b.hashCode()); Member first = test.iterator().next(); System.out.println(test.contains(first)); System.out.println(b.equals(first)); System.out.println(test.add(first)); } } It produces the following results: 30814 29853 false true true Because the hashCode depends of the state of the object it can no longer by retrieved properly, so the check for containment fails. The HashSet in no longer working properly. A solution would be to make Member immutable, but is that the only solution? Should all classes added to HashSets be immutable? Is there any other way to handle the situation? Regards.

    Read the article

  • a question related to Google Translate

    - by Robert
    Hi all, it works perfectly fine if I paste the following URL directly into my IE address bar: http://translate.google.cn/translate?hl=zh-CN&sl=zh-CN&tl=en&u=http%3A%2F%2Fnews.baidu.com%2Fns%3Fword%3D%25B0%25C2%25B0%25CD%25C2%25ED it will translate some Chinese news pages into English ones. but if I call this address in a Java program like: Process q=Runtime.getRuntime().exec("cmd /c start http://translate.google.cn/translate?hl=zh-CN&sl=zh-CN&tl=en&u=http%3A%2F%2Fnews.baidu.com%2Fns%3Fword%3D%25B0%25C2%25B0%25CD%25C2%25ED"); It will only return to the Google translate main page. Wonder what went wrong there. and it would be great if you help me how to realize this(opening the Google translated result page simplying by supplying the URL,in a Java program). Many thanks.

    Read the article

  • XSD validation error human readable

    - by Robert
    Hi, I want to be able to validate a XML against a XSD and generate user readable errors, for example, including XSD documentation tag. I just wanted to know if C# provides this in a easy, elegant and non-painful way, otherwise I'll parse down the error and find the node within XSD.

    Read the article

  • Issuing multiple requests using HTTP/1.1 Pipelining

    - by Robert S. Barnes
    When using HTTP/1.1 Pipelining what does the standard say about issuing multiple requests without waiting for each request to complete? What do servers do in practice? I ask because I once tried writing a client which would issue a batch of GET requests for multiple files and remember getting errors. I wasn't sure if it was due to me incorrectly issuing the GET's or needing to wait for each individual request to finish before issuing the next GET.

    Read the article

  • MySQL : Insert Exactly Same Data Multiple Rows Without PHP Loop

    - by Robert Hanson
    I need to insert same data to my MySQL table without having PHP loop. The reason why I'm doing this is that because I have a column with Auto_Increment feature and that column associates with other table. So, I just need to insert some exactly same data and it's multiple rows (dynamic) but by using single INSERT syntax below : INSERT INTO outbox_multipart (TextDecoded) VALUES ('$SMSMessage') how to have this single INSERT syntax, but produce n number of rows?

    Read the article

  • [MATH]Project an axis to a plane

    - by Robert
    how do i project the X axis to a plane if the plane is defined by three points? see pic here: http://129.25.16.135:2080/v6.5/books/usb/graphics/iconventions-local-surfaces.png The default local 1-direction is the projection of the global x-axis onto the surface. If the global x-axis is within 0.1° of being normal to the surface, the local 1-direction is the projection of the global z-axis onto the surface. let's suppose that these points are: t1 = [-0.362879991531372, 0.357021987438202, -0.373737007379532] t2 = [-0.383525013923645, 0.371621012687683, -0.383549988269806] t3 = [-0.383534014225006, 0.34629300236702, -0.38544899225235] is the vector [0.78280971952246, -0.0307519963686645, 0.411184845614438] correct answer in this case? i've calculated the angle between the surf and x (1,0,0) is ~28°. and can you give the entire procedure for the calculation, because i'm just puzzled.

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >