Search Results

Search found 1499 results on 60 pages for 'extending the clipboard'.

Page 13/60 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Extending Object in Javasript

    - by smsteel
    I'm trying to extend Object functionality this way: Object.prototype.get_type = function() { if(this.constructor) { var r = /\W*function\s+([\w\$]+)\(/; var match = r.exec(this.constructor.toString()); return match ? match[1].toLowerCase() : undefined; } else { return typeof this; } } It's great, but there is a problem: var foo = { 'bar' : 'eggs' }; for(var key in foo) { alert(key); } There'll be 3 passages of cycle. Is there any way to avoid this?

    Read the article

  • Extending an entity

    - by Kim L
    I have class named AbstractUser, which is annotated with @MappedSuperclass. Then I have a class named User (@Entity) which extends AbstractUser. Both of these exist in a package named foo.bar.framework. When I use these two classes, everything works just fine. But now I've imported a jar containing these files to another project. I'd like to reuse the User class and expand it with a few additional fields. I thought that @Entity public class User extends foo.bar.framework.User would do the trick, but I found out that this implementation of the User only inherits the fields from AbstractUser, but nothing from foo.bar.framework.User. The question is, how can I get my second User class to inherit all the fields from the first User entity class? Both User class implementation have different table names defined with @Table(name = "name").

    Read the article

  • Trouble extending event log messages

    - by Matt H
    Hi. I'm trying to add some extended error codes to the event log but I get the following error. The description for Event ID ( 109 ) in Source ( PumpServer ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: The event log file is corrupt.. The message file looks like this and I added the one on the end:- <---snip---> MessageId= SymbolicName=EVMSG_BADREQUEST Language=English The service received an unsupported request. . MessageId= SymbolicName=EVMSG_DEBUG Language=English %1 . MessageId= SymbolicName=EVMSG_STOPPED Language=English The service was stopped. . MessageId= SymbolicName=EVMSG_INVALIDLICENCE Language=English The service does not have a valid licence. Initialization failed. . It compiles fine. The mc program is running over this file and producing a header file of the same name with my new message id showing. // // MessageId: EVMSG_INVALIDLICENCE // // MessageText: // // The service does not have a valid licence. Initialization failed. // #define EVMSG_INVALIDLICENCE 0x0000006DL Any ideas why it's not finding my message? All the others work.

    Read the article

  • Extending the IndexController with a BaseController in Zend

    - by BillA
    I'm trying to extend my controllers with a global base controller as such: class BaseController extends Zend_Controller_Action { // common controller actions public function listAction() { // do stuff } } class IndexController extends BaseController { // index controller specific actions } class LoginController extends BaseController { // login controller specific actions } But I get this error: PHP Fatal error: Class 'BaseController' not found in /var/www/Zend/project/application/controllers/IndexController.php on line 3 Any ideas on how to get Zend to "see" this controller?

    Read the article

  • Using ControllerClassNameHandlerMapping with @Controller and extending AbstractController

    - by whiskerz
    Hey there, actually I thought I was trying something really simple. ControllerClassNameHandlerMapping sounded great to produce a small spring webapp using a very lean configuration. Just annotate the Controller with @Controller, have it extend AbstractController and the configuration shouldn't need more than this <context:component-scan base-package="test.mypackage.controller" /> <bean id="urlMapping" class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" /> to resolve my requests and map them to my controllers. I've mapped the servlet to "*.spring", and calling <approot>/hello.spring All I ever get is an error stating that no mapping was found. If however I extend the MultiActionController, and do something like <approot>/hello/hello.spring it works. Which somehow irritates me, as I would have thought that if that is working, why didn't my first try? Does anyone have any idea? The two controllers I used looked like this @Controller public class HelloController extends AbstractController { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView modelAndView = new ModelAndView("hello"); modelAndView.addObject("message", "Hello World!"); return modelAndView; } } and @Controller public class HelloController extends MultiActionController { public ModelAndView hello(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView modelAndView = new ModelAndView("hello"); modelAndView.addObject("message", "Hello World!"); return modelAndView; } }

    Read the article

  • Extending both T and SomeInterface<T> in Java

    - by Graeme Moss
    I want to create a class that takes two parameters. One should be typed simply as T. The other should be typed as something that extends both T and SomeInterface. When I attempt this with public class SomeClass<T, S extends SomeInterface<T> & T> then Java complains with "The type T is not an interface; it cannot be specified as a bounded parameter" and if instead I attempt to create an interface for S with public interface TandSomeInterface<T> extends SomeInterface<T>, T then Java complains with "Cannot refer to the type parameter T as a supertype" Is there any way to do this in Java? I think you can do it in C++...?

    Read the article

  • Extending Enums, Overkill?

    - by CkH
    I have an object that needs to be serialized to an EDI format. For this example we'll say it's a car. A car might not be the best example b/c options change over time, but for the real object the Enums will never change. I have many Enums like the following with custom attributes applied. public enum RoofStyle { [DisplayText("Glass Top")] [StringValue("GTR")] Glass, [DisplayText("Convertible Soft Top")] [StringValue("CST")] ConvertibleSoft, [DisplayText("Hard Top")] [StringValue("HT ")] HardTop, [DisplayText("Targa Top")] [StringValue("TT ")] Targa, } The Attributes are accessed via Extension methods: public static string GetStringValue(this Enum value) { // Get the type Type type = value.GetType(); // Get fieldinfo for this type FieldInfo fieldInfo = type.GetField(value.ToString()); // Get the stringvalue attributes StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes( typeof(StringValueAttribute), false) as StringValueAttribute[]; // Return the first if there was a match. return attribs.Length > 0 ? attribs[0].StringValue : null; } public static string GetDisplayText(this Enum value) { // Get the type Type type = value.GetType(); // Get fieldinfo for this type FieldInfo fieldInfo = type.GetField(value.ToString()); // Get the DisplayText attributes DisplayTextAttribute[] attribs = fieldInfo.GetCustomAttributes( typeof(DisplayTextAttribute), false) as DisplayTextAttribute[]; // Return the first if there was a match. return attribs.Length > 0 ? attribs[0].DisplayText : value.ToString(); } There is a custom EDI serializer that serializes based on the StringValue attributes like so: StringBuilder sb = new StringBuilder(); sb.Append(car.RoofStyle.GetStringValue()); sb.Append(car.TireSize.GetStringValue()); sb.Append(car.Model.GetStringValue()); ... There is another method that can get Enum Value from StringValue for Deserialization: car.RoofStyle = Enums.GetCode<RoofStyle>(EDIString.Substring(4, 3)) Defined as: public static class Enums { public static T GetCode<T>(string value) { foreach (object o in System.Enum.GetValues(typeof(T))) { if (((Enum)o).GetStringValue() == value.ToUpper()) return (T)o; } throw new ArgumentException("No code exists for type " + typeof(T).ToString() + " corresponding to value of " + value); } } And Finally, for the UI, the GetDisplayText() is used to show the user friendly text. What do you think? Overkill? Is there a better way? or Goldie Locks (just right)? Just want to get feedback before I intergrate it into my personal framework permanently. Thanks.

    Read the article

  • Redirecting to a Facelet is not working when extending FaceletViewHandler

    - by Abel Morelos
    I'm overriding the handleRenderResponse method defined in com.sun.facelets.FaceletViewHandler: protected void handleRenderException(FacesContext context, Exception ex) I'm overriding this method so I can redirect the user to a custom error page (which contain the desired look and feel and other stuff). This is the way I'm trying to String errorPage = "/error.xhtml"; String contextPath = context.getExternalContext().getRequestContextPath(); String errorPagePath = contextPath+errorPage; context.getExternalContext().redirect(errorPagePath); The previous code is what I'm using to perform the redirect to this custom error page. Anyway, when I perform the redirect I'm prompted with a download dialog (this is with Internet Explorer, in Firefox the page does not display properly or as I would expect). I tried changing "/error.xhtml" to "/error.jsf" but in that case I get a 404 error. Somehow I think that the XHTML file is not being handled to the Facelets ViewHandler after the redirect, if I open the downloaded xhtml file I can see that the EL expressions were not resolved and the the ui tags were not handled. I don't have problems with other pages in my application, only when doing the redirect programatically. Important data from my web.xml: facelets.VIEW_MAPPINGS is set to *.xhtml javax.faces.DEFAULT_SUFFIX is set to .xhtml servlet-mapping for the "Faces Servlet" is ".jsf" and "/faces/"

    Read the article

  • Best practices for extending third party databases?

    - by Eric Watkins
    I have a situation where our developers extended a Third party database (MS SQL) by adding tables, views, stored procedures, and functions. Recently when the vender issued updates to the database they dropped all of our custom objects. The question now is what are some best practices that will allow us to extend the third party database but keep our objects safe from future updates? My first thought is to create a separate database but then I’m stuck with fully qualifying all the references back to the original database which may cause issues promoting database changes from test to production.

    Read the article

  • extending urlize in django

    - by hymloth
    the urlize function from django.utils.html converts urls to clickable links. My problem is that I want to append a target="_blank" into the "< href..", so that I open this link in a new tab. Is there any way that I can extend the urlize function to receive an extra argument? or should I make a custom filter using regexes to do this stuff? Is this efficient?

    Read the article

  • Java: extending Object class

    - by Fabio F.
    Hello, I'm writing (well, completing) an "extension" of Java which will help role programming. I translate my code to Java code with javacc. My compilers add to every declared class some code. Here's an example to be clearer: MyClass extends String implements ObjectWithRoles { //implements... is added /*Added by me */ public setRole(...){...} public ... /*Ends of stuff added*/ ...//myClass stuff } It adds Implements.. and the necessary methods to EVERY SINGLE CLASS you declare. Quite rough, isnt'it? It will be better if I write my methods in one class and all class extends that.. but.. if class already extends another class (just like the example)? I don't want to create a sort of wrapper that manage roles because i don't want that the programmer has to know much more than Java, few new reserved words and their use. My idea was to extends java.lang.Object.. but you can't. (right?) Other ideas? I'm new here, but I follow this site so thank you for reading and all the answers you give! (I apologize for english, I'm italian)

    Read the article

  • Extending rst container to output extra div attributes

    - by Manwe
    I'm starting to use pelican with reStructuredText rst page format. I have custom javascript (jQuery) things that I'd like to control with div attributes like data-default-tpl="basename" with nested content. What to extend and what. I've looked at Directives and nodes, but I just can't wrap my head around how to do it. .. rstdiv:: class1 class2 :name: namessid :extra: thisIsMyextra .. rstdiv:: nested class3 :name: nestedid :extra: data-default-tpl="basename" some text .. container:: This is normal rst container :name: contid text From rst to html with pelican. <div id="nameisid" class="class1 class2" thisIsMyextra> <div id="nestedid" class="nested class3" data-default-tpl="basename"> some text </div> </div> <div id="contid" class="container This is normal rst container"> text </div>

    Read the article

  • Problem with extending JPanel

    - by Halo
    I have an abstract entity: public abstract class Entity extends JPanel implements FocusListener And I have a TextEntity: public class TextEntity extends Entity Inside TextEntity's constructor I want to put a JTextArea that will cover the panel: textArea = new JTextArea(); textArea.setSize(getWidth(),getHeight()); add(textArea); But getWidth() and getHeight() returns 0. Is it a problem with the inheritance or the constructor?

    Read the article

  • Is extending a base class with non-virtual destructor dangerous in C++

    - by Akusete
    Take the following code class A { }; class B : public A { }; class C : public A { int x; }; int main (int argc, char** argv) { A* b = new B(); A* c = new C(); //in both cases, only ~A() is called, not ~B() or ~C() delete b; //is this ok? delete c; //does this line leak memory? return 0; } when calling delete on a class with a non-virtual destructor with member functions (like class C), can the memory allocator tell what the proper size of the object is? If not, is memory leaked? Secondly, if the class has no member functions, and no explicit destructor behaviour (like class B), is everything ok? I ask this because I wanted to create a class to extend std::string, (which I know is not recommended, but for the sake of the discussion just bear with it), and overload the +=,+ operator. -Weffc++ gives me a warning because std::string has a non virtual destructor, but does it matter if the sub-class has no members and does not need to do anything in its destructor? -- FYI the += overload was to do proper file path formatting, so the path class could be used like class path : public std::string { //... overload, +=, + //... add last_path_component, remove_path_component, ext, etc... }; path foo = "/some/file/path"; foo = foo + "filename.txt"; //and so on... I just wanted to make sure someone doing this path* foo = new path(); std::string* bar = foo; delete bar; would not cause any problems with memory allocation

    Read the article

  • Extending existing Class in Symfony

    - by Dar Hamid
    I am new to symfony. I have created a registration form using the code: $user = new Register(); $form = $this->createForm(new RegisterType(), $user); In the RegisterType class i have 5 fields (for example).I store the values in database when the user registers with the system. Now I display the EDIT page using following code: $user = $em->getRepository('MysiteUserBundle:Register')->find($id); $form = $this->createForm(new RegisterType(), $user); The problem with the EDIT code however is that it displays me all of the fields mentioned in RegisterType class.Is it possible to display only some fields. If yes how can this be achieved. Any help will be appreciated

    Read the article

  • Weird syntax for extending jQuery

    - by cantabilesoftware
    I recently saw this code on another post ( http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area ) new function($) { $.fn.setCursorPosition = function(pos) { // function body omitted, not relevant to question } } (jQuery); After too long trying to understand what it was doing I finally figured out that it's just creating a new function with a parameter $ and then invoking it with jQuery as the parameter value. So actually, it's just doing this: jQuery.fn.setCursorPosition = function(pos) { // function body omitted, not relevant to question } What's the reason for the original, more confusing version?

    Read the article

  • Extending the .NET type system so the compiler enforces semantic meaning of primitive values in cert

    - by Drew Noakes
    I'm working with geometry a bit at the moment and am converting a lot between degrees and radians. Unfortunately, both of these are represented by double, so there's compile time warning/error if I try to pass a value in degrees where radians are expected. I believe F# has a compile-time solution for this (called units of measure.) I'd like to do something similar in C#. As another example, imagine a SQL library that accepts various query parameters as strings. It'd be good to have a way of enforcing that only clean strings were allowed to be passed in at runtime, and the only way to get a clean string was to pass through some SQL injection attack preventing logic. The obvious solution is to wrap the double/string/whatever in a new type to give it the type information the compiler needs. I'm curious if anyone has an alternative solution. If you do think wrapping is the only/best way, then please go into some of the downsides of the pattern (and any upsides I haven't mentioned too.) I'm especially concerned about the performance of abstracted primitive numeric types on my calculations at runtime.

    Read the article

  • Eclipse RCP : make a standalone plugin extending an existing standalone one

    - by akira2x3x
    I have extended via extension point (add menus and functionnalities) an already existing plugin which has it's own product definition file and it's own class Application implements IApplication. I want to create a Product Configuration(customize splash screen,etc...). Does my plugin need an Application class? I want my plugin to be independant, Standalone with a launcher. Not a fragment. Do I have to inherit already existing plugin Application? Thanks for the tips and tricks.

    Read the article

  • PHP weirdness extending IMagick class

    - by Jamie Carl
    This is a really weird one. I have some code that is happily working on version 2.1.1RC1 of the php5-imagick module. It's basically just a class I wrote that extends the Imagick class and manages images stored in a database. Since upgrading to version 3.0.0RC1 (thankfully only on my dev box) things have gone to hell. It seems that object members are writeable but are NOT readable. Take the following sample code: class db_image extends IMagick { private $data; function __construct( $id = null ){ parent::__construct(); $this->data = 'some plain text'; echo $this->data; } This will output absolutely NOTHING. My debugger indicates that the contents of $this-data are the correct string value, but I am unable to read the value back out of the member variable. Seriously. WTF? Does anyone know what is causing this or has seen it before? I don't even know how to replicate this behaviour in my own classes.

    Read the article

  • PHP: Extending static member arrays

    - by tstenner
    I'm having the following scenario: class A { public static $arr=array(1,2); } class B extends A { public static $arr=array(3,4); } Is there any way to combine these 2 arrays so B::$arr is 1,2,3,4? I don't need to alter these arrays, but I can't declare them als const, as PHP doesn't allow const arrays.http://stackoverflow.com/questions/ask The PHP manual states, that I can only assign strings and constants, so parent::$arr + array(1,2) won't work, but I think it should be possible to do this.

    Read the article

  • Rails engines extending functionality

    - by sinsiliux
    So I have an engine which defines some models and controllers. I want to be able to extend functionality of some models/controllers in my application (eg. adding methods) without loosing the original model/controller functionality from engine. Everywhere I read that you simply need to define controller with the same name in your application and Rails will automatically merge them, however it doesn't work for me and controller in engine is simply ignored (I don't think it's even loaded).

    Read the article

  • Design pattern for extending Android's activities?

    - by Carl
    While programming on Android, I end up writing a parent activity which is extended by several others. A bit like ListActivity. My parent activity extends Activity. if I intend to use a Map or a List, I can't use my parent activity as superclass - the child activity can only extend one activity obviously. As such I end up writing my parent activities with the same logic for Activity, ListActivity, MapActivity and so forth. What am I looking for is some sort of trait functionality/design pattern which would help in this case. Any suggestions?

    Read the article

  • Extending AdapterView

    - by Ander Webbs
    Hi, i'm trying to make (for learning purposes) my own implementation of a simple AdapterView where items comes from an basic Adapter (ImageAdapter from sdk samples). Actual code is like this: public class MyAdapterView extends AdapterView<ImageAdapter> implements AdapterView.OnItemClickListener{ private ImageAdapter mAdapter; public MyAdapterView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initThings(); } private void initThings(){ setOnItemClickListener(this); } @Override public ImageAdapter getAdapter() { // TODO Auto-generated method stub return mAdapter; } @Override public void setAdapter(ImageAdapter adapter) { // TODO Auto-generated method stub mAdapter=adapter; requestLayout(); } View obtainView(int position) { View child = mAdapter.getView(position, null, this); return child; } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); for(int i=0;i<mAdapter.getCount();i++){ View child = obtainView(i); child.layout(10, 70*i, 70, 70); addViewInLayout(child, i, null, true); } this.invalidate(); } @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Log.d("MYEXAMPLES","Clicked an item!"); } } This isn't a coding masterpiece, it just displays a pseudo-listview with pictures. I know i could've used ListView, GridView, Spinner, etc. but i'm relative new to android and i'm trying to figure out some things on it. Well, the question here is: Why is my onItemClick not firing? Using the same ImageAdapter with a GridView, everything works ok, but when i use with above class, i get nothing. Inside AdapterView.java there is code for those click, longclick, etc events... so why can't i just fire them? Maybe i'm misunderstanding basic things on how AdapterView works? Should I extend other base classes instead? And why? Hoping to find more experienced guidance on here, thanks in advance.

    Read the article

  • Extending Visual Studio with a Custom Designer

    - by Mick
    How do I create a custom Visual Studio 2008 UI designer for a C# file? For example, when you double click on a DataSet in the Solution Explorer, a UI screen appears that allows you to edit the DataSet, even though it is defined in XML/code (which you can right click and "View Code"). Usually this code is separated from user code in some way, either by region ("Windows Forms Designer Generated Code"), by codegen (".g.cs" for WPF XAML files), or some other means like partial classes.

    Read the article

  • Extending Zend_Auth_Adapter_DbTable for Extra Checks

    - by Urda
    My google fu is weak today, but I cannot find a good article to do so. I would like to extend the Zend Adapter to check n extra columns on my database table. What is the best way to fully extend the adapter, so I can use it in the future without needing to dig through documentation again.

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >