Search Results

Search found 50973 results on 2039 pages for 'class names'.

Page 26/2039 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Grails: JSONP callback without id and class in JSON file

    - by Klaas
    Hi, I am working on a REST based interface where people get a json file. The client needs to access the file from another Domain. I use jsonp which works so far. My problem is the rendering in Grails. At the moment I use the 'as JSON' to marshalling the object: render "${params.jsoncallback}(${user as JSON})" The Json file getting to the client inclused all attributes, incluing the id and class, which I do not want to have in there. In case it is not jsonp, I do it this way, which works great: render(contentType:'text/json'){ userName user.userName userImage user.userImage : : } So how do I get the id and class attributes out of the json when rendering "user as JSON"? Any idea? best regards, Klaas

    Read the article

  • Returning in a static class constructor

    - by Martijn Courteaux
    Hello, This isn't valid code: public class MyClass { private static boolean yesNo = false; static { if (yesNo) { System.out.println("Yes"); return; // The return statement is the problem } System.exit(0); } } This is a stupid example, but in a static class constructor we can't return;. Why? Are there good reasons for this? Does someone know something more about this? So the reason why I should do return is to end constructing there. Thanks

    Read the article

  • ERD-CLASS design

    - by Mahesh
    Hello guyz,i am new to daatbase and class diagram.I just get scenarios from internet and try to develop ERD and Class Diagram for them.But the following scenario has caused me some problems, and i am not sure about my design. "Whenever an employee fills leave application form, the leave application should be appeared for approval to his/her team leader. Team Leader has the option to change the date of requested leave and to approve or reject the leave. Employee also has the option to change date of previously unapproved leaves or to cancel any of unapproved leave. In case of team leader, he can approve his own leaves. Management should be able to create categories of leaves like (Casual, Sick, Planned work, etc) and should be able to adjust the days allocated to each type of leave". I have identified these as entities for ERD 1) Employee(I think i dont need to make entity for Technical lead,since he is an employee) 2) LeaveHistory 3) LeaveCategory Plz correct me if the system need more classes or entities

    Read the article

  • Error in writting a class.

    - by Richard
    I am running through a tutorial online at http://www.sthurlow.com/python/lesson08/ and I believe I understand how classes work in python, at least to some degree but when I run this code: class Shape: def init(self,x,y): self.x = x self.y = y description = "This shape has not been described yet" author = "Nobody has claimed to make this shape yet" def area(self): return self.x * self.y def perimeter(self): return 2 * self.x + 2 * self.y def describe(self,text): self.description = text def authorName(self,text): self.author = text def scaleSize(self,scale): self.x = self.x * scale self.y = self.y * scale I get this error: Traceback (most recent call last): File "Y:/python/Shape.py", line 1, in -toplevel- class Shape: File "Y:/python/Shape.py", line 17, in Shape self.y = self.y * scale NameError: name 'self' is not defined Any Help would be great Thanks Richard

    Read the article

  • Java anonymous class efficiency implications

    - by Po
    Is there any difference in efficiency (e.g. execution time, code size, etc.) between these two ways of doing things? Below are contrived examples that create objects and do nothing, but my actual scenarios may be creating new Threads, Listeners, etc. Assume the following pieces of code happen in a loop so that it might make a difference. Using anonymous objects: void doSomething() { for (/* Assume some loop */) { final Object obj1, obj2; // some free variables IWorker anonymousWorker = new IWorker() { doWork() { // do things that refer to obj1 and obj2 } }; } } Defining a class first: void doSomething() { for (/* Assume some loop */) { Object obj1, obj2; IWorker worker = new Worker(obj1, obj2); } } static class Worker implements IWorker { private Object obj1, obj2; public CustomObject(Object obj1, Object obj2) {/* blah blah */} @Override public void doWork() {} }; Thank you :)

    Read the article

  • Add class to .hover functionality on a specific class name - jQuery

    - by marcamillion
    So, throughout my entire document, I would like for every single time the user hovers over an element with a specific class name, I would like a class to be added. My CSS looks like this: .hotspot:hover, .hotspothover { border: 4px solid #fff; box-shadow: 0px 0px 20px #000; -webkit-box-shadow: 0px 0px 20px #000; -moz-box-shadow: 0px 0px 20px #000; z-index: 1; } Class name: "hotspot". I tried this, but it doesn't seem to work: $("#hotspot.hover #hotspothover").addClass("bubble bottom"); Thanks.

    Read the article

  • Window Wrapper Class C++ (G++)

    - by Ell
    Hi all, I am attempting to learn about creating windows in c++, I have looked at an article about creating a wrapper class but I don't really understand it. So far I know that you can't have a class method WndProc (I dont know why) but honestly, that is all. Can somebody give an explanation, also explaining the reinterpret_cast? Here is the article. LRESULT CALLBACK Window::MsgRouter(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { Window *wnd = 0; if(message == WM_NCCREATE) { // retrieve Window instance from window creation data and associate wnd = reinterpret_cast<Window *>((LPCREATESTRUCT)lparam)->lpCreateParams; ::SetWindowLong(hwnd, GWL_USERDATA, reinterpret_cast<long>(wnd)); // save window handle wnd->SetHWND(hwnd); } else // retrieve associated Window instance wnd = reinterpret_cast<Window *>(::GetWindowLong(hwnd, GWL_USERDATA)); // call the windows message handler wnd->WndProc(message, wparam, lparam); } Thanks in advance, ell.

    Read the article

  • Relevance of 'public' constructor in abstract class.

    - by Amby
    Is there any relevance of a 'public' constructor in an abstract class? I can not think of any possible way to use it, in that case shouldn't it be treated as error by compiler (C#, not sure if other languages allow that). Sample Code: internal abstract class Vehicle { public Vehicle() { } } The C# compiler allows this code to compile, while there is no way i can call this contructor from the outside world. It can be called from derived classes only. So shouldn't it allow 'protected' and 'private' modifiers only. Please comment.

    Read the article

  • Interoperability when returning derived class by base class in WCF

    - by mt_serg
    I have some simple code: [DataContract] [KnownType(typeof(SpecialEvent))] public class Event { //data } [DataContract] public class SpecialEvent : Event { //data } [ServiceContract] public interface IService { [OperationContract] List<Event> GetEvents(); } [ServiceBehavior] public class Service : IService { public List<Event> GetEvents() { List<Event> events = new List<Event>(); events.Add(new Event()); events.Add(new SpecialEvent()); return events; } } I know that it works fine in case wcf to wcf. but what about interoperability? is it generate standart wsdl and any client can use the service or no?

    Read the article

  • Calling a function within a class

    - by JM4
    I am having trouble calling a specific function within a class. The call is made: case "Mod10": if (!validateCreditCard($fields[$field_name])) $errors[] = $error_message; break; and the class code is: class CreditCardValidationSolution { var $CCVSNumber = ''; var $CCVSNumberLeft = ''; var $CCVSNumberRight = ''; var $CCVSType = ''; var $CCVSError = ''; function validateCreditCard($Number) { $this->CCVSNumber = ''; $this->CCVSNumberLeft = ''; $this->CCVSNumberRight = ''; $this->CCVSType = ''; $this->CCVSError = ''; // Catch malformed input. if (empty($Number) || !is_string($Number)) { $this->CCVSError = $CCVSErrNumberString; return FALSE; } // Ensure number doesn't overrun. $Number = substr($Number, 0, 20); // Remove non-numeric characters. $this->CCVSNumber = preg_replace('/[^0-9]/', '', $Number); // Set up variables. $this->CCVSNumberLeft = substr($this->CCVSNumber, 0, 4); $this->CCVSNumberRight = substr($this->CCVSNumber, -4); $NumberLength = strlen($this->CCVSNumber); $DoChecksum = 'Y'; // Mod10 checksum process... if ($DoChecksum == 'Y') { $Checksum = 0; // Add even digits in even length strings or odd digits in odd length strings. for ($Location = 1 - ($NumberLength % 2); $Location < $NumberLength; $Location += 2) { $Checksum += substr($this->CCVSNumber, $Location, 1); } // Analyze odd digits in even length strings or even digits in odd length strings. for ($Location = ($NumberLength % 2); $Location < $NumberLength; $Location += 2) { $Digit = substr($this->CCVSNumber, $Location, 1) * 2; if ($Digit < 10) { $Checksum += $Digit; } else { $Checksum += $Digit - 9; } } // Checksums not divisible by 10 are bad. if ($Checksum % 10 != 0) { $this->CCVSError = $CCVSErrChecksum; return FALSE; } } return TRUE; } } When I run the application - I get the following message: Fatal error: Call to undefined function validateCreditCard() in C:\xampp\htdocs\validation.php on line 339 any ideas?

    Read the article

  • function and class to show image not working in php

    - by Gully
    i am trying to get get the following working nothing is happen when i use the function i am trying to get it to display images class ItemRes { //items DB var $img=""; } function ShowItemImage($index,$res_a){ if(sizeof($res_a) > $index){ if($res_a[$index] != NULL) { $cimg = $res_a[$index]->img; return "<img src='$cimg' width='70' height='70' style='cursor:pointer'></img>"; } }else{ return "<center class='whitetxt'><strong>Empty</strong></center>"; } } $res_array = array(); $idx=0; $result21 = mysql_query("SELECT * FROM photos WHERE eid='$eid' ORDER BY id DESC") or die (mysql_error()); while ($row21 = mysql_fetch_array($result21)) { $img_path = $row21['path']; $obj = new ItemRes(); $obj->img = $img_path; $res_array[$idx] = $obj; $idx++; } ShowItemImage(0,$res_array) ShowItemImage(1,$res_array)

    Read the article

  • Relvance of 'public' contructor in abstract class.

    - by Amby
    Is there any relevance of a 'public' constructor in an abstract class? I can not think of any possible way to use it, in that case shouldn't it be treated as error by compiler (C#, not sure if other languages allow that). Sample Code: internal abstract class Vehicle { public Vehicle() { } } The C# compiler allows this code to compile, while there is no way i can call this contructor from the outside world. It can be called from derived classes only. So shouldn't it allow 'protected' and 'private' modifiers only. Please comment.

    Read the article

  • Basic class returns onject reference instead of Array

    - by php-b-grader
    I have very basic class: class Customer { protected $id; protected $customer; public function __construct($customer_id) { $this->id = $customer_id; return $this->set_customer(); } protected function set_customer() { $query = mysql_query("SELECT * FROM customer WHERE id = '$this->id'"); $this->customer = mysql_fetch_row($query); return $this->customer; } } $customer = new Customer($order->customer->id); print_r($customer); This is not doing what I want it to but I understand why... $customer returns a reference to the Customer Object... But what I want is the MySQL row array from the mysql_fetch_row() call... What am I missing?

    Read the article

  • Need help with developing a class for my JUnit test

    - by alpdog14
    I have this JUnit test that I need help developing a Interface and Class for, here is the test: Box b1 = new DefaultBox( "abc" ); Box b2 = new DefaultBox( "def" ); Box b3 = new DefaultBox( "" ); assertEquals("abc", b1.contents()); assertEquals("[abc]", b1.toString()); assertTrue(b1.equals(b1)); assertFalse(b1.equals(b2)); assertFalse(b1.equals(null)); assertEquals("cba", b1.flip().contents()); assertEquals("", b3.flip().contents()); can anyone help me in developing a Default box class and a box interface to make these test pass? Any help would be most appreciated.

    Read the article

  • Assigning a variable of a struct that contains an instance of a class to another variable

    - by xport
    In my understanding, assigning a variable of a struct to another variable of the same type will make a copy. But this rule seems broken as shown on the following figure. Could you explain why this happened? using System; namespace ReferenceInValue { class Inner { public int data; public Inner(int data) { this.data = data; } } struct Outer { public Inner inner; public Outer(int data) { this.inner = new Inner(data); } } class Program { static void Main(string[] args) { Outer p1 = new Outer(1); Outer p2 = p1; Console.WriteLine("p1:{0}, p2:{1}", p1.inner.data, p2.inner.data); p1.inner.data = 2; Console.WriteLine("p1:{0}, p2:{1}", p1.inner.data, p2.inner.data); p2.inner.data = 3; Console.WriteLine("p1:{0}, p2:{1}", p1.inner.data, p2.inner.data); Console.ReadKey(); } } }

    Read the article

  • Python grab class in class definition.

    - by epochwolf
    I don't even know how to explain this, so here is the code I'm trying. class Test: type = self.__name__ #self doesn't work, how do I get a reference to Test? class Test2(Test): pass #Test2.type should return "Test2" The reason I'm even trying this is I'm working on creating a base class for an orm I'm using. I want to avoid defining the table name for every model I have. Also knowing what the limits of python is will help me avoid wasting time trying impossible things.

    Read the article

  • Improve this snippet from a prototype class

    - by seengee
    This is a snippet from a prototype class i am putting together. The scoping workaround feels a little hacky to me, can it be improved or done differently? var myClass = Class.create({ initialize: function() { $('formid').getElements().each(function(el){ $(el).observe("blur", function(){ this.validateEl(el); }.bind(this,el)); },this); }, validateEl: function(el){ // validate $(el) in here... } }); Also, it seems to me that i could be doing something like this for the event observers: $('formid').getElements().invoke("observe","blur" ... Not sure how i would pass the element references in though?

    Read the article

  • Purpose of Instance Methods vs. Class Methods in Objective-C

    - by qegal
    I have checked out all these questions... Difference Class and Instance Methods Difference between class methods and instance methods? Objective-C: Class vs Instance Methods? ...and all they explain is how instance methods are used on instances of a class and class methods are used with the class name, when a message is sent to a class object. This is helpful, but I'm curious to know why one would use a class method vs. an instance method. I'm fairly new to iOS application development, and usually use class methods, and I feel like I'm doing something wrong. Thanks in advanced!

    Read the article

  • How can I reuse a base class function in a derived class

    - by Armen Ablak
    Let's say we have these four classes: BinaryTree, SplayTree (which is a sub-class of BinaryTree), BinaryNode and SplayNode (which is a sub-class of BinaryNode). In class BinaryTree I have 2 Find functions, like this bool Find(const T &) const; virtual Node<T> * Find(const T &, Node<T> *) const; and in SplayTree I would like to reuse the second one, because it works in the same way (for example) as in SplayTree, the only thing different is the return type, which is SplayNode. I thought it might be enough if I use this line in SplayTree.cpp using BinaryTree::Find; but it isn't. So, how can I do this?

    Read the article

  • How to initialize one class from a library?

    - by daemonsvk
    Hi, I have a few classes in the class library (separate assembly). I referenced it to my project and I want to initialize one specific class from that library. I know only its name. All of the classes implements one interface. And here comes the problem. My code so far: using MyLibrary; ... IMyInterface dll = Activator.CreateInstance("MyLibrary", "MyLibrary.NameOfClass") as IMyInterface; But dll is always null. Any ideas? Thanks

    Read the article

  • Class Library Project VS App_Code - Pros / Cons?

    - by rockinthesixstring
    I currently use the App_Code folder for all of my classes, and for me (for now) it seems to be working just fine. I have however been considering making the switch over to a Class Library Project inside my Solution instead of the App_Code folder. Can anyone tell me the pros and cons of doing this? One thought I had was with regards to testing my web app. If I use a Class Library, do I have to compile it every time I want to tweak/test? Obviously in the App_Code folder I don't have to since all of the Classes compile at runtime.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >