Search Results

Search found 24043 results on 962 pages for 'private methods'.

Page 61/962 | < Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >

  • Best methods to make urls friendly?

    - by Geuis
    We're working on revising the url structure for some of our movie content, but we aren't quite sure on the best way to handle odd characters. For example, '303/302' '8 1/2 Women' 'Dude, Where's My Car?' '9-1/2 Weeks' So far, we're thinking: /movies/303-302 /movies/8-1-2-women /movies/dude-wheres-my-car /movies/9-1-2-weeks Is this the best solution? Is there anything we're forgetting?

    Read the article

  • magento payment methods - enable for admin only

    - by Fiona
    Hi there, I need to enable the Cheque / Money Order payment method to enable our clients call centre team to create orders in the admin. However we do not want customers buying online through the website to use this payment method. Does anybody know how I might be able to do this? Regards, Fiona

    Read the article

  • Ruby Module Inclusion in Methods

    - by Federico Builes
    In class Foo I'd like to include method Bar under certain conditions: module Bar def some_method "orly" end end class Foo def initialize(some_condition) if !some_condition "bar" else class << self; include Bar; end end end end Is there any cleaner (and clearer) way to achieve the include in the method without having to do it inside the singleton class?

    Read the article

  • Custom setter methods in Core-Data

    - by andrewebling
    I need to write a custom setter method for a field (we'll call it foo) in my subclass of NSManagedObject. foo is defined in the data model and Xcode has autogenerated @property and @dynamic fields in the .h and .m files respectively. If I write my setter like this: - (void)setFoo: (NSObject *)inFoo { [super setFoo: inFoo]; [self updateStuff]; } then I get a compiler warning on the call to super. Alternatively, if I do this: - (void)setFoo: (NSObject *)inFoo { [super setValue: inFoo forKey: inFoo]; [self updateStuff]; } then I end up in an infinite loop. So what's the correct approach to write a custom setter for a subclass of NSManagedObject?

    Read the article

  • Argument constraints in RhinoMock methods

    - by Khash
    I am mocking a repository that should have 1 entity in it for the test scenario. The repository has to return this entity based on a known id and return nothing when other ids are passed in. I have tried doing something like this: _myRepository.Expect(item => item.Find(knownId)).Return(knownEntity); _myRepository.Expect(item => item.Find(Arg<Guid>.Is.Anything)).Return(null); It seems however the second line is overriding the first and the repository always returns null. I don't want to mock all the different possible IDs asked (they could go up to hundreds) when the test scenario is only concerned with the value of one Id.

    Read the article

  • C++ - Access array (in main) from methods outside main

    - by John Smith
    I have an array in my main class that holds objects that I need to print out for a menu listing. The array is declared and initialized in main. I need to, however, access the same array in a sub-menu function. If I copy the code (for loop that prints out the values) to the sub-menu, nothing is printed (presumably because it can't access the original array and has made a new, blank one). Is there any way (without making the array a global variable) that I can access the array in this sub-menu? Both the main and the sub-menu function are in the same file and the sub-menu is called from main. Maybe to put it more simply, can I use scope resolution to bring me up one 'level' in scope?

    Read the article

  • Java Webservice with generic methods

    - by danby
    Hi, I was wondering if it is possible to make a generic webservice method in java like this: @WebMethod public <T extends Foo> void testGeneric(T data){ However when I try to consume this with a Java client I get an error stating: [ERROR] Schema descriptor {http://####/}testGeneric in message part "parameters" is not defined and could not be bound to Java. I know it is possible to make a method that takes a parameter such as List and this generates correctly using JAX-WS. I don't mind if there is a solution that means I am tied to using only a particular technology. Thanks, Dan.

    Read the article

  • Calling arrays from other methods in a different class

    - by Jake H
    Hello, I need help dealing with an array in my java program. in my first class, "test", I set 4 variables and then send them to my other class (test2). arr[i] = new test2(id, fname, lname, case); at that point, variables are set and then I want to return those variables. So in the test2 class, I have a method that strictly returns one of those variables public int getId(){ return id; } I understand this is a little stupid, but professor gets what professor wants I guess. What I want to do now is in my main method in "test" I want to retrieve that variable and sort the array based on that int. Unfortunately, I have to create my own sort function, but I think this would work for what I want to do. for(j = 0; j < arr.length; j++){ int indexMin =j; for(i = j; i < arr.length;i++){ if(arr[i] < arr[indexMin]){ indexMin = i; } } int tmp = arr[j]; arr[j] = arr[indexMin]; arr[indexMin] = tmp; } I appreciate any help anyone could provide. Thank you

    Read the article

  • Sbyte[] vs byte[][] using methods

    - by blgnklc
    It is written byte[][] getImagesForFields(java.lang.String[] fieldnames) Gets an array of images for the given fields. On the other hand, as long as I use the method in the web application project built on asp.net 2.o using c#; the provided web method declared above, returns sbyte; Have a look my code below; formClearanceService.openSession(imageServiceUser); formClearanceService.prepareInstance(formId); byte[][] fieldImagesList = formClearanceService.getImagesForFields(fieldNames); formClearanceService.closeSession(); thus I get the following error: Cannot implicitly convert type 'sbyte[]' to 'byte[][]' So now, 1- should I ask the web service provider what is going on? or 2- any other way that can use the sbyte as I was suppose to use byte[][] like following using: byte[] ssss = fieldImagesList [0]..

    Read the article

  • Ruby - Passing Blocks To Methods

    - by Chris Bunch
    I'm trying to do Ruby password input with the Highline gem and since I have the user input the password twice, I'd like to eliminate the duplication on the blocks I'm passing in. For example, a simple version of what I'm doing right now is: new_pass = ask("Enter your new password: ") { |prompt| prompt.echo = false } verify_pass = ask("Enter again to verify: ") { |prompt| prompt.echo = false } And what I'd like to change it to is something like this: foo = Proc.new { |prompt| prompt.echo = false } new_pass = ask("Enter your new password: ") foo verify_pass = ask("Enter again to verify: ") foo Which unfortunately doesn't work. What's the correct way to do this?

    Read the article

  • Ruby Regexp methods?

    - by fjs6
    Is there a gem/example_code that allows to work with regexps? I am not looking for what a regexp can do, but what can be done to a Regexp object. For example: r = Regexp.new(...) r.min_length => the minimum length of a matching string r = Regexp.new("car(less)?") r.min_length => 3 for the string "car" Thanks!

    Read the article

  • How to implement callback methods inside classes (PHP)

    - by sombe
    I need to use a class callback method on an array inside another method (the callback function belongs to the class). class Database { public function escape_string_for_db($string){ return mysql_real_escape_string($string); } public function escape_all_array($array){ return array_filter($array,"$this->escape_string_for_db"); } } Is this the right way to go about that? (I mean, in terms of the second parameter passed to array_filter)

    Read the article

  • Invoking different methods on threads

    - by Kraken
    I have a main process main. It creates 10 threads (say) and then what i want to do is the following: while(required){ Thread t= new Thread(new ClassImplementingRunnable()); t.start(); counter++; } Now i have the list of these threads, and for each thread i want to do a set of process, same for all, hence i put that implementation in the run method of ClassImplementingRunnable. Now after the threads have done their execution, i wan to wait for all of them to stop, and then evoke them again, but this time i want to do them serially not in parallel. for this I join each thread, to wait for them to finish execution but after that i am not sure how to evoke them again and run that piece of code serially. Can i do something like for(each thread){ t.reevoke(); //how can i do that. t.doThis(); // Also where does `dothis()` go, given that my ClassImplementingRunnable is an inner class. } Also, i want to use the same thread, i.e. i want the to continue from where they left off, but in a serial manner. I am not sure how to go about the last piece of pseudo code. Kindly help. Working with with java.

    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

  • Virtual methods as Comp function to sort

    - by wilsongoncalo.mp
    Hello everyone! I'm new to C++ and i'm trying to use std::sort function to sort a vector of Solutions. The code is something like this (solution list is a *vector): void SolutionSet::sort(Comparator &comparator) { std::sort(solutionsList_->begin(), solutionsList_->end(), &comparator::compare); } The comparator param is a Comparator´s child class instance , and the compare method is virtual at Comparator class and implemented by all Comparator's child classes. And i want to use that function as a comparator function at std:sort(). Is this possible? If it is, can someone tell me how? Because with the previous code, it doesn't work. If i've not made myself clear, please just ask! Thank you guys!

    Read the article

  • Reusing of a PreparedStatement between methods?

    - by MRalwasser
    We all know that we should rather reuse a JDBC PreparedStatement than creating a new instance within a loop. But how to deal with PreparedStatement reuse between different method invocations? Does the reuse-"rule" still count? Should I really consider using a field for the PreparedStatement or should I close and re-create the prepared statement in every invocation? (Of course an instance of such a class would be bound to a Connection which might be a disadvantage) I am aware that the ideal answer might be "it depends". But I am looking for a best practice for less experienced developers that they will do the right choice in most of the cases.

    Read the article

  • index seems to be out of sync for jquery .keydown and .click methods

    - by Growler
    I'd like to navigate images using both keyboard and mouse (clicking left and right arrow images). I'm using Jquery to do this, but the shared imgIndex seems to be off from the .keydown function and the .click function... Whenever .keydown function -- or ++ the imgIndex, isn't that changed index also used in the click function? So shouldn't they always be on the same index? keydown function: <script type="text/javascript"> var imgArray = [<?php echo implode(',', getImages($site)) ?>]; $(document).ready(function() { var img = document.getElementById("showimg"); img.src = imgArray[<?php echo $imgid ?>]; var imgIndex = <?php echo $imgid ?>; alert(imgIndex); $(document).keydown(function (e) { var key = e.which; var rightarrow = 39; var leftarrow = 37; var random = 82; if (key == rightarrow) { imgIndex++; if (imgIndex > imgArray.length-1) { imgIndex = 0; } img.src = imgArray[imgIndex]; } if (key == leftarrow) { if (imgIndex == 0) { imgIndex = imgArray.length; } img.src = imgArray[--imgIndex]; } }); click function: Connected to left and right clickable images $("#next").click(function() { imgIndex++; if (imgIndex > imgArray.length-1) { imgIndex = 0; } img.src = imgArray[imgIndex]; }); $("#prev").click(function() { if (imgIndex == 0) { imgIndex = imgArray.length; } img.src = imgArray[--imgIndex]; }); }); Just so you have some visibility into the getImages php function: <?php function getImages($siteParam) { include 'dbconnect.php'; if ($siteParam == 'artwork') { $table = "artwork"; } else { $table = "comics"; } $catResult = $mysqli->query("SELECT id, title, path, thumb, views, catidFK FROM $table"); $img = array(); while($row = $catResult->fetch_assoc()) { $img[] = "'" . $row['path'] . "'"; } return $img; } ?> Much appreciated! Snapshot of where the script is on "view image.php"

    Read the article

  • How are ambigous methods resolved in java ?

    - by Jijoy
    Hi, I have a question. package org.study.algos; public class Study { public static void main(String[] args) { A a = new A(); a.m1(null); } } class A { public void m1(String s) { System.out.println("String"); System.out.println(s); } public void m1(Object obj) { System.out.println("Object"); System.out.println(obj); } } Here, the output is String null Why does the JVM resolve the method to one with a String argument? Thanks in advance J

    Read the article

  • How can I make this code more generic

    - by Greg
    Hi How could I make this code more generic in the sense that the Dictionary key could be a different type, depending on what the user of the library wanted to implement? For example someone might what to use the extension methods/interfaces in a case where there "unique key" so to speak for Node is actually an "int" not a "string" for example. public interface ITopology { Dictionary<string, INode> Nodes { get; set; } } public static class TopologyExtns { public static void AddNode(this ITopology topIf, INode node) { topIf.Nodes.Add(node.Name, node); } public static INode FindNode(this ITopology topIf, string searchStr) { return topIf.Nodes[searchStr]; } } public class TopologyImp : ITopology { public Dictionary<string, INode> Nodes { get; set; } public TopologyImp() { Nodes = new Dictionary<string, INode>(); } }

    Read the article

  • Work with AJAX response with DOM methods

    - by Stomped
    I'm retrieving an entire HTML document via AJAX - and that works fine. But I need to extract certain parts of that document and do things with them. Using a framework (jquery, mootools, etc) is not an option. The only solution I can think of is to grab the body of the HTML document with a regex (yes, I know, terrible) ie. <body>(.*)</body> put that into the current page's DOM in a hidden element, and work with it from there. Is there an easier/better way? Update I've done some testing, and inserting an entire HTML document into a created element behaves a bit differently across browsers I've tested. For example: FF3.5: keeps the contents of the HEAD and BODY tags IE7 / Safari4: Only includes what's between ... Opera 10.10: Keeps HEAD and everything inside it, Keeps contents of BODY The behavior of IE7 and Safari are ideal, but different browsers are doing this differently. Since I'm loading a predetermined HTML document I think I'm going to use the regEx to grab what I want and insert it into a DOM element - unless someone has other suggestions.

    Read the article

< Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >