Search Results

Search found 63799 results on 2552 pages for 'case class'.

Page 17/2552 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • PHP making input from web form case insensitive?

    - by Haskella
    So I have some code here that takes user input from a standard web form: $searchsport = $_POST['sport']; $sportarray = array( "Football" => "Fb01", "Cricket" => "ck32", "Tennis" => "Tn43", ); if(isset($sportarray[$searchsport])){ header("Location: ".$sportarray[$searchsport].".html"); die; } How would I go about modifying this (I think the word is parsing?) to make it case *in*sensitive? For example, I type in "fOoTbAlL" and php will direct me to Fb01.html normally.

    Read the article

  • CASE + IF MysQL query

    - by terence6
    Problem is as follows. I have a product that can be in one of three categories (defined by category_id). Each category table has category_id field related to category_id in product table. So I have 3 cases. I'm checking If my product.category_id is in table one. If yes, I take some values. If not I check in tables that are left. What can I write In the ELSE section? Can anyone correct my query ? CASE WHEN IF EXISTS(SELECT * FROM table1 WHERE category_id='category_id') THEN SELECT type_id FROM table1 WHERE category_id='category_id'; WHEN IF EXISTS(SELECT * FROM table2 WHERE category_id='category_id') THEN SELECT value_id FROM table2 WHERE category_id='category_id'; WHEN IF EXISTS(SELECT * FROM table3 WHERE category_id='category_id') THEN SELECT group_id FROM table3 WHERE category_id='category_id'; ELSE "dont know what here"; END;

    Read the article

  • Help with MySQL and CASE WHEN with a range of values

    - by kickdaddy
    I have an accounts table and a records table where accounts have multiple records. I would like to break down the account totals by "count of records" range. i.e. show the breakdown of Count of Records | Count 0-25 | 100 25 - 50 | 122 50 - 100 | 300 etc. I am using the following query, but I can't get it to group by "grp" which is what I want, any help on the best way to modify query? Thanks! SELECT count(*) as ct, CASE WHEN COUNT(*) < 25 THEN '1-25' WHEN COUNT(*) >= 25 < 50 THEN '25-50' WHEN COUNT(*) >= 50 < 100 THEN '50-100' WHEN COUNT(*) >= 100 < 250 THEN '100-250' WHEN COUNT(*) >= 250 < 500 THEN '250-500' WHEN COUNT(*) >= 500 < 1000 THEN '500-1000' ELSE '1000+' END AS grp FROM records r,accounts a WHERE r.account_id=a.id ORDER BY ct

    Read the article

  • case insensitive highlighting in php

    - by fusion
    i'm using this function to highlight the results from mysql query: function highlightWords($string, $word) { $string = str_replace($word, "<span class='highlight'>".$word."</span>", $string); /*** return the highlighted string ***/ return $string; } .... $cQuote = highlightWords(htmlspecialchars($row['cQuotes']), $search_result); the problem is, if i type in 'good', it will only show my search results with a lower-case 'g'ood and not 'Good'. how do i rectify this?

    Read the article

  • How does a template class inherit another template class?

    - by hkBattousai
    I have a "SquareMatrix" template class which inherits "Matrix" template class, like below: SquareMatrix.h: #ifndef SQUAREMATRIX_H #define SQUAREMATRIX_H #include "Matrix.h" template <class T> class SquareMatrix : public Matrix<T> { public: T GetDeterminant(); }; template <class T> // line 49 T SquareMatrix<T>::GetDeterminant() { T t = 0; // Error: Identifier "T" is undefined // line 52 return t; // Error: Expected a declaration // line 53 } // Error: Expected a declaration // line 54 #endif I commented out all other lines, the files contents are exactly as above. I receive these error messages: LINE 49: IntelliSense: expected a declaration LINE 52: IntelliSense: expected a declaration LINE 53: IntelliSense: expected a declaration LINE 54: error C2039: 'GetDeterminant' : is not a member of 'SquareMatrix' LINE 54: IntelliSense: expected a declaration So, what is the correct way of inheriting a template class? And what is wrong with this code? The "Matrix" class: template <class T> class Matrix { public: Matrix(uint64_t unNumRows = 0, uint64_t unNumCols = 0); void GetDimensions(uint64_t & unNumRows, uint64_t & unNumCols) const; std::pair<uint64_t, uint64_t> GetDimensions() const; void SetDimensions(uint64_t unNumRows, uint64_t unNumCols); void SetDimensions(std::pair<uint64_t, uint64_t> Dimensions); uint64_t GetRowSize(); uint64_t GetColSize(); void SetElement(T dbElement, uint64_t unRow, uint64_t unCol); T & GetElement(uint64_t unRow, uint64_t unCol); //Matrix operator=(const Matrix & rhs); // Compiler generate this automatically Matrix operator+(const Matrix & rhs) const; Matrix operator-(const Matrix & rhs) const; Matrix operator*(const Matrix & rhs) const; Matrix & operator+=(const Matrix & rhs); Matrix & operator-=(const Matrix & rhs); Matrix & operator*=(const Matrix & rhs); T& operator()(uint64_t unRow, uint64_t unCol); const T& operator()(uint64_t unRow, uint64_t unCol) const; static Matrix Transpose (const Matrix & matrix); static Matrix Multiply (const Matrix & LeftMatrix, const Matrix & RightMatrix); static Matrix Add (const Matrix & LeftMatrix, const Matrix & RightMatrix); static Matrix Subtract (const Matrix & LeftMatrix, const Matrix & RightMatrix); static Matrix Negate (const Matrix & matrix); // TO DO: static bool IsNull(const Matrix & matrix); static bool IsSquare(const Matrix & matrix); static bool IsFullRowRank(const Matrix & matrix); static bool IsFullColRank(const Matrix & matrix); // TO DO: static uint64_t GetRowRank(const Matrix & matrix); static uint64_t GetColRank(const Matrix & matrix); protected: std::vector<T> TheMatrix; uint64_t m_unRowSize; uint64_t m_unColSize; bool DoesElementExist(uint64_t unRow, uint64_t unCol); };

    Read the article

  • Single Table Per Class Hierarchy with an abstract superclass using Hibernate Annotations

    - by Andy Hull
    I have a simple class hierarchy, similar to the following: @Entity @Table(name="animal") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="animal_type", discriminatorType=DiscriminatorType.STRING) public abstract class Animal { } @Entity @DiscriminatorValue("cat") public class Cat extends Animal { } @Entity @DiscriminatorValue("dog") public class Dog extends Animal { } When I query "from Animal" I get this exception: "org.hibernate.InstantiationException: Cannot instantiate abstract class or interface: Animal" If I make Animal concrete, and add a dummy discriminator... such as @DiscriminatorValue("animal")... my query returns my cats and dogs as instances of Animals. I remember this being trivial with HBM based mappings but I think I'm missing something when using annotations. Can anyone help? Thanks!

    Read the article

  • Collect all extension methods to generic class in another generic class

    - by Hun1Ahpu
    I'd like to create a lot of extension methods for some generic class, e.g. for public class SimpleLinkedList<T> where T:IComparable And I've started creating methods like this: public static class LinkedListExtensions { public static T[] ToArray<T>(this SimpleLinkedList<T> simpleLinkedList) where T:IComparable { //// code } } But when I tried to make LinkedListExtensions class generic like this: public static class LinkedListExtensions<T> where T:IComparable { public static T[] ToArray(this SimpleLinkedList<T> simpleLinkedList) { ////code } } I get "Extension methods can only be declared in non-generic, non-nested static class". And I'm trying to guess where this restriction came from and have no ideas.

    Read the article

  • PHP and Classes: access to parent's public property within the parent class

    - by takpar
    Hi, here is what my code looks like i have two forms: class Form_1 extends Form_Abstract { public $iId = 1; } class Form_2 extends Form_1 { public $iId = 2; } i expect the code behave like this: $oForm = new Form_2; echo $oForm->getId(); // it returns '2' echo $oForm->getParentId(); // i expect it returns '1' here is my Form_Abstract class: class Form_Abstract { public $iId = 0; public function getId() { return $this->iId; } /** this method will be called from a child instance */ public function getParentId() { return parent::$iId; } } but it throws a Fatal Error: Fatal error: Cannot access parent:: when current class scope has no parent please help me with the method getParentId()

    Read the article

  • Return pointer to nested inner class from generic outer class

    - by helixed
    I'm new to C++, so bear with me. I have a generic class called A. A has a nested class called B. A contains a method called getB(), which is supposed to return a new instance of B. However, I can't get my code to compile. Here's what it looks like:#include A.h template <class E> class A { public: class B { public: int data; }; B * getB(); }; A.cpp #include "A.h" template <class E> A<E>::B * A::getB() { return new B(); } When I try to compile this, I get the following error: error: expected constructor, destructor, or type conversion before '*' token Does anybody know what I'm doing wrong? Thanks, helixed

    Read the article

  • C# Class Library wont register for COM

    - by Jordan S
    Hello All, I am trying to gain access to a .NET class library in Microsoft Excel. To do this I know that the .NET class library must be registered with COM. So I tried going to my Assembly Info and Setting COM Visible to true. Then on the build tab I set Register for COM Interop for true also. I checked the AssemblyInfo.cs file and it does contain [assembly: ComVisible(true)]. But for some reason when I try to add a reference to the Class Lib in Excel the namespace does not show up in the list. I made a quick test Class library with nothing in it and did the same thing (set COM Vis = true , and Register For COM Interop = true) and that one does show up on the list of available references. I can't figure out what the difference is between the two classes. I am not sure if my class is actually being registered for COM interop or not. Does anyone know what I can do to fix this???

    Read the article

  • How can I use Moose with Test::Class?

    - by rassie
    I'm currently refactoring a test suite built up by a colleague and would like to use Test::Class[::Most] while doing so. As I started I figured out I could really use a couple of Moose roles to decouple code a little bit. However, it seems it's not quite possible -- I'm getting error messages like this one: Prototype mismatch: sub My::Test::Class::Base::blessed: none vs ($) at /usr/lib/perl5/vendor_perl/5.8.8/Sub/Exporter.pm line 896 So the question is: can I use Moose together with Test::Class and if so, how? PS: The code goes like this: package My::Test::Class::Base; use Moose; use Test::Class::Most; with 'My::Cool::Role'; has attr => ( ... );

    Read the article

  • how do I select a div with class "A" but NOT with class "B"?

    - by MedicineMan
    I have some divs: <div class="A">"Target"</div> <div class="A B">"NotMyTarget"</div> <div class="A C">"NotMyTarget"</div> <div class="A D">"NotMyTarget"</div> <div class="A E">"NotMyTarget"</div> Is there a CSS selector that will get me the div containing Target but not the divs containing NotMyTarget? Solution must work on IE7, IE8, Safari, Chrome, and Firefox Edit: So far Nick is the closest. It's clumsy and I don't like the solution, but at least it works: .A { style that all divs will take } div.B { style that will override style .A }

    Read the article

  • How can I use Moose with Test::Class?

    - by rassie
    I'm currently refactoring a test suite built up by a colleague and would like to use Test::Class[::Most] while doing so. As I started I figured out I could really use a couple of Moose roles to decouple code a little bit. However, it seems it's not quite possible -- I'm getting error messages like this one: Prototype mismatch: sub My::Test::Class::Base::blessed: none vs ($) at /usr/lib/perl5/vendor_perl/5.8.8/Sub/Exporter.pm line 896 So the question is: can I use Moose together with Test::Class and if so, how? PS: The code goes like this: package My::Test::Class::Base; use Moose; use Test::Class::Most; with 'My::Cool::Role'; has attr => ( ... );

    Read the article

  • Help with a pseudo-class, first-child

    - by zac
    I am working on a CMS platform with limited access to the template files and want to try and control some of the layout with pseudo class but no luck yet. Can anyone see what is wrong with this structure and why my pseudo class is being ignored? <div id="main"> <div class="someRandomDiv"></div> <div class="block"> stuff </div> <div class="block"> more stuff </div> </div> and i am trying something like this #main .block {border: 1px solid blue} #main .block:first-child {border: 1px solid red} so with this example I would think the stuff block would have a red border and more stuff would have a blue but it is all just blue. Thanks for any help with this.

    Read the article

  • Generate Info (wrapper) Class from stored procedure

    - by Adem
    Hello everybody I am in a crucial project and I am trying to speed up the development phase by using codesmith for generating the business class DAL and info class for the tables of my project. There are about 50 tables with relationships parent child many to many and for retrieving data I have to code several inner joins in stored procedures. I have to combine fields from many tables and this makes working with the info class difficult. Is there anyway to generate info class from stored procedures or to be more exact is there a way to parse the result set of the stored procedure and to generate the info class with properties for every column in that result set. Please if anyone can give me some advice and tell me how to achieve this. Best Regards

    Read the article

  • Call the cast operator of template base class within the derived class

    - by yoni
    I have a template class, called Cell, here the definition: template <class T> class OneCell { ..... } I have a cast operator from Cell to T, here virtual operator const T() const { ..... } Now i have derived class, called DCell, here template <class T> class DCell : public Cell<T> { ..... } I need to override the Cell's cast operator (insert a little if), but after I need to call the Cell's cast operator. In other methods it's should be something like virtual operator const T() const { if (...) { return Cell<T>::operator const T; } else throw ... } but i got a compiler error error: argument of type 'const int (Cell::)()const' does not match 'const int' What can I do? Thank you, and sorry about my poor English.

    Read the article

  • replace a bunch of show/hide with switch/case in javascript

    - by Adam
    Page has menu items that would replace a 'div id=foo_(current menu item)' with 'div id=foo_(selected menu item)' in 'div class=foo' Here's what I've got, and try to keep your breakfast down... $('#t1').click(function() { $('#attorney').show(); $('#insurance,#financial,#estate,#trust,#death').hide(); }); $('#t2').click(function() { $('#insurance').show(); $('#attorney,#financial,#estate,#trust,#death').hide(); }); $('#t3').click(function() { $('#financial').show(); $('#attorney,#insurance,#estate,#trust,#death').hide(); }); $('#t4').click(function() { $('#estate').show(); $('#attorney,#insurance,#financial,#trust,#death').hide(); }); $('#t5').click(function() { $('#trust').show(); $('#attorney,#insurance,#financial,#estate,#death').hide(); }); $('#t6').click(function() { $('#death').show(); $('#attorney,#insurance,#financial,#estate,#trust').hide(); });

    Read the article

  • Inheritance: when implementing an interface which define a base class property why cant the class im

    - by Deepak
    Lets create some interfaces public interface ITimeEventHandler { string Open(); } public interface IJobTimeEventHandler: ITimeEventHandler { string DeleteJob(); } public interface IActivityTimeEventHandler: ITimeEventHandler { string DeleteActivity(); } public interface ITimeEvent { ITimeEventHandler Handler; } Another Interface public interface IJobTimeEvent :ITimeEvent { int JobID; } Create a class public class JobTimeEvent : IJobTimeEvent { public int JobID = 0; public IJobTimeEventHandler Handler = null; } My question is .. when implementing an interface which define a base class property why cant the class implementing interface return a derived class type object ?? For ex in class JobTimeEvent, IJobtimeEvent needs a property of type ITimeEventHandler but why IJobTimeEventHandler type is not allowed which derived from ITimeEventHandler

    Read the article

  • Making an SVG DOM JavaScript class

    - by CryptoQuick
    I'm unsatisfied with other JavaScript libraries and frameworks like jQuery, MooTools, and Raphael, because of their inability to support SVG grouping. You'd think it'd be a very simple thing for them to implement. Anyway, I'm trying to make a JavaScript class (using John Resig's class.js script) like this: var El = Class.extend({ el: null, svgNS: "http://www.w3.org/2000/svg", init: function (type) { this.el = document.createElementNS(this.svgNS, type); }, set: function (name, attr) { this.el.setAttributeNS(null, name, attr); }, get: function (el, name) { var attr = this.el.getAttributeNS(null, name); return attr; }, add: function (targEl) { targEl.el.appendChild(this.el); }, remove: function (targEl) { targEl.el.removeChild(this.el); }, setEl: function (docId) { this.el = document.getElementById(docId); } }); I can add elements to the DOM using these statements outside of the class, but storing the element inside the class becomes problematic. Anyone have any creative ideas?

    Read the article

  • Serelization of a class and its sub-class....

    - by Amit
    There is a main class having 2 subClasses(each represent separate entity) and all classes needs to be serialized.. how should I proceed ? My requirement is when I serelize MainClass, I should get the xml for each sub class and main class as well. Thanks in advance... and if my approach is incorrect... correct that as well.. Ex given below... class MainClass { SubClass1 objSubclass1 = null; SubClass2 objSubclass2 = null; public MainClass() { objSubclass1 = new SubClass1(); objSubclass2 = new SubClass2(); } [XmlElement("SubClass1")] public SubClass1 SubClass1 {get {return objSubclass1;} } [XmlElement("SubClass2")] public SubClass2 SubClass2 {get {return objSubclass2;} } } Class SubClass1 { Some properties here... } Class SubClass2 { Some properties here... }

    Read the article

  • replace a buch of show/hide with switch/case in javascript

    - by Adam
    Page has menu items that would replace a 'div id=foo_(current menu item)' with 'div id=foo_(selected menu item)' in 'div class=foo' Here's what I've got, and try to keep your breakfast down... $('#t1').click(function() { $('#attorney').show(); $('#insurance,#financial,#estate,#trust,#death').hide(); }); $('#t2').click(function() { $('#insurance').show(); $('#attorney,#financial,#estate,#trust,#death').hide(); }); $('#t3').click(function() { $('#financial').show(); $('#attorney,#insurance,#estate,#trust,#death').hide(); }); $('#t4').click(function() { $('#estate').show(); $('#attorney,#insurance,#financial,#trust,#death').hide(); }); $('#t5').click(function() { $('#trust').show(); $('#attorney,#insurance,#financial,#estate,#death').hide(); }); $('#t6').click(function() { $('#death').show(); $('#attorney,#insurance,#financial,#estate,#trust').hide(); });

    Read the article

  • Help calling class from a class above.

    - by wtzolt
    Hello, How to call from class oneThread: back to class fun:? As in, address a class written below. Is it possible? class oneThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.start() def run(self): print "1" time.sleep(1) print "2" time.sleep(1) print "3" self.wTree.get_widget("entryResult").set_text("Done with One.") # How to call from here back to class fun, which of course is below...? class fun: wTree = None def __init__( self ): self.wTree = gtk.glade.XML( "main.glade" ) self.wTree.signal_autoconnect( {"on_buttonOne" : self.one} ) gtk.main() def one(self, widget): oneThread(); gtk.gdk.threads_init() do=fun()

    Read the article

  • External class-calling

    - by anonymous
    Hi guys i have a bit of a problem with a few classes, and i would be very grateful if someone can help me out. So i have: Already compiled executable (for whom i don't have the source) A class in that program that i want to call The program doesn't have export for the class, and that's my problem i don't have definition for this class, so is there a way to get a callback to this class? Example: In the compiled executable: foo::bar (example) { printf(example); } My app: CALLBACK(foo::bar, "this text must be passed as argument") Or in other words i want to call a class in other executable (without having its source) and pass arguments to its function.

    Read the article

  • Ruby class instance variables and inheritance

    - by rlandster
    I have a Ruby class called LibraryItem. I want to associate with every instance of this class an array of attributes. This array is long and looks something like ['title', 'authors', 'location', ...] Note that these attributes are not really supposed to be methods, just a list of attributes that a LibraryItem has. Next, I want to make a subclass of LibraryItem called LibraryBook that has an array of attributes that includes all the attributes of LibraryItem but will also include many more. Eventually I will want several subclasses of LibraryItem each with their own version of the array @attributes but each adding on to LibraryItem's @attributes (e.g., LibraryBook, LibraryDVD, LibraryMap, etc.). So, here is my attempt: class LibraryItem < Object class << self; attr_accessor :attributes; end @attributes = ['title', 'authors', 'location',] end class LibraryBook < LibraryItem @attributes.push('ISBN', 'pages'] end This does not work. I get the error undefined method `push' for nil:NilClass

    Read the article

  • Java: Set<E> collection, where items are identified by its class

    - by mschayna
    I need Set collection, where its items will be identified by items class. Something like ReferenceIdentityMap from Appache Collections, but on class scope i.e. two different instances of same class must be identified as same in this collection. You know, it is a violation of equals()/hashCode() identity principle but in occasional use it makes sense. I have done this in simple class backing with Map<Class<? extends E>, E>, but due to simplicity it doesn't implement Set<E>. There may be a more elegant solution, decorator of any Set<E> would be great. Is there any implementation of such collection there (Apache/Google/something/... Collections)?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >