Search Results

Search found 11923 results on 477 pages for 'inner classes'.

Page 33/477 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • Cannot open a .tif with color using .Net Image or Bitmap classes

    - by Tom Regan
    I am attempting to open .tif files that have color in them (300 dpi, PixelFormat.Format24bppRgb) using the .Net Image and Bitmap classes. I always get an "invalid parameter" error when the tiffs have color (works fine for black and white tiffs). If anyone has source code on how to open a .tif with color in it I'd deeply appreciate it. Below is what I'm attempting to do; this also fails when calling Bitmap.FromStream: using (FileStream fs = File.OpenRead(fileName)) { using (Image img = Image.FromStream(fs)) {} }

    Read the article

  • pagerAnchorBuilder - trying to add classes

    - by Bert Murphy
    I'm using Cycle2 to build a carousel gallery and I've run into a little problem regarding styling the pager buttons. What I've gathered is that Cycle2 creates its own pager span tags for each slide which is a bummer becaus I've already styled my the sub-nav markup. This should be a minor issue as long as I can assign individual classes to the spans and change my css accordingly. However, I can't get this to work. TLDR: I was hoping that I could use pagerAnchorBuilder to create individual classes for each span. I can't. Help. The original markup (pre Cycle2) looks like the following: <div id ="sub-nav" class="sub-nav"> <ul> <li><a id="available" class="available" href="#"></a></li> <li><a id="reliable" class="reliable" href="#"></a></li> <li><a id="use" class="use" href="#"></a></li> <li><a id="reports" class="reports" href="#"></a></li> <li class="last"><a id="software" class="software" href="#"></a></li> </ul> </div> With Cycle2 it looks like this (note the addition of the span tags) <div id ="sub-nav" class="sub-nav"> <ul> <li><a id="available" class="available" href="#"></a></li> <li><a id="reliable" class="reliable" href="#"></a></li> <li><a id="use" class="use" href="#"></a></li> <li><a id="reports" class="reports" href="#"></a></li> <li class="last"><a id="software" class="software" href="#"></a></li> </ul> <span class="cycle-pager-active">•</span><span>•</span><span>•</span><span>•</span><span>•</span></nav> </div> Cycle2 $('#sliding-gallery ul').cycle({ fx: 'carousel', carouselVisible: 1, speed: 'fast', timeout: 10000, slides: '>li', next: '.next', prev: '.prev', pager: '.sub-nav', pagerAnchorBuilder: function(idx, slide) { return '.sub-nav span:eq(' + idx + ')'; } });

    Read the article

  • .Net 4.0, New methods in existing classes

    - by Yogesh
    Is there a blog or MSDN article, which lists all the new methods which are added in .Net 4.0 in existing classes? I could not find any. Two which I found on blogs till now: String.IsNullOrWhiteSpace Enum.HasFlag Are there more such methods added which anybody found? If yes, please share.

    Read the article

  • Python new-style classes and __subclasses__ function

    - by Fraser Graham
    Can somebody explain to me why this works (in Python 2.5) : class Foo(object): pass class Bar(Foo): pass print(Foo.__subclasses__()) but this doesn't : class Foo(): pass class Bar(Foo): pass print(Foo.__subclasses__()) The latter returns "AttributeError: class Foo has no attribute '__subclasses__'" but i'm not sure why. I know this is related to old-style vs. new-style classes but i'm not clear on why that would make this functionality unavailable.

    Read the article

  • Java: limit to nest classes?

    - by HH
    A very poor style to code but sometimes unavoidable. It is an extreme example. So is there some limit for nesting classes? are they equivalent? how do you deal with such situations? Create library? Code new FileObject().new Format().new Words().new Some().new Continue someThing; ((((new FileObject()).new Format()).new Words()).new Some()).new Continue someThing;

    Read the article

  • why does my C# client that uses Library A need to have a using statement for Library B (which A uses

    - by Greg
    Hi, I have: Main Program Class - uses Library A Library A - has partial classes which mix in methods from Library B Library B - mix in methods & interfaces So in Library B when I include a partial Node class which implements INode (defined in Library B) I suddenly get an error in my main class where it uses Node from Library A. The error tells me in the Main Class I have to have a using statement to Library B. Any ideas?

    Read the article

  • Java template classes using generator or similar?

    - by Hugh Perkins
    Is there some library or generator that I can use to generate multiple templated java classes from a single template? Obviously Java does have a generics implementation itself, but since it uses type-erasure, there are lots of situations where it is less than adequate. For example, if I want to make a self-growing array like this: class EasyArray { T[] backingarray; } (where T is a primitive type), then this isn't possible. This is true for anything which needs an array, for example high-performance templated matrix and vector classes. It should probably be possible to write a code generator which takes a templated class and generates multiple instantiations, for different types, eg for 'double' and 'float' and 'int' and 'String'. Is there something that already exists that does this? Edit: note that using an array of Object is not what I'm looking for, since it's no longer an array of primitives. An array of primitives is very fast, and uses only as much space a sizeof(primitive) * length-of-array. An array of object is an array of pointers/references, that points to Double objects, or similar, which could be scattered all over the place in memory, require garbage collection, allocation, and imply a double-indirection for access. Edit2: good god, voted down for asking for something that probably doesn't currently exist, but is technically possible and feasible? Does that mean that people looking for ways to improve things have already left the java community? Edit3: Here is code to show the difference in performance between primitive and boxed arrays: int N = 10*1000*1000; double[]primArray = new double[N]; for( int i = 0; i < N; i++ ) { primArray[i] = 123.0; } Object[] objArray = new Double[N]; for( int i = 0; i < N; i++ ) { objArray[i] = 123.0; } tic(); primArray = new double[N]; for( int i = 0; i < N; i++ ) { primArray[i] = 123.0; } toc(); tic(); objArray = new Double[N]; for( int i = 0; i < N; i++ ) { objArray[i] = 123.0; } toc(); Results: double[] array: 148 ms Double[] array: 4614 ms Not even close!

    Read the article

  • Are classes in Python in different files?

    - by Asaf
    Much like Java (or php), I'm use to seperating the classes to files. Is it the same deal in Python? plus, how should I name the file? Lowercase like classname.py or the same like ClassName.py? Do I need to do something special if I want to create an object from this class or does the fact that it's in the same "project" (netbeans) makes it ok to create an object from it?

    Read the article

  • Where to define exception classes, inside classes or on a higher level?

    - by rve
    Should exception classes be part of the class which may throw them or should they exist on a higher level? For example : class Test { public: class FooException: public ExceptionBase { }; void functionThrowingFooException(); }; or class FooException: public ExceptionBase { }; class Test { public: void functionThrowingFooException(); }; (functionThrowingFooException() is the only function to ever throw a FooException)

    Read the article

  • Internal classes with ADO.NET Entity Framework

    - by Regent
    I'm using Entity Framework for creation of my Data Access Layer and I want for all of my classes to be internal. I know it is possible to manually assign it manually in the designer for each class. But looks like it also requires to set internal modifier for each single property in every class! I have about 30+ entities and it will be a huge work to do. Do you know any ideas how to set a 'default access' for the entire model?

    Read the article

  • How to give properties to c++ classes (interfaces)

    - by caas
    Hello, I have built several classes (A, B, C...) which perform operations on the same BaseClass. Example: struct BaseClass { int method1(); int method2(); int method3(); } struct A { int methodA(BaseClass& bc) { return bc.method1(); } } struct B { int methodB(BaseClass& bc) { return bc.method2()+bc.method1(); } } struct C { int methodC(BaseClass& bc) { return bc.method3()+bc.method2(); } } But as you can see, each class A, B, C... only uses a subset of the available methods of the BaseClass and I'd like to split the BaseClass into several chunks such that it is clear what it used and what is not. For example a solution could be to use multiple inheritance: // A uses only method1() struct InterfaceA { virtual int method1() = 0; } struct A { int methodA(InterfaceA&); } // B uses method1() and method2() struct InterfaceB { virtual int method1() = 0; virtual int method2() = 0; } struct B { int methodB(InterfaceB&); } // C uses method2() and method3() struct InterfaceC { virtual int method2() = 0; virtual int method3() = 0; } struct C { int methodC(InterfaceC&); } The problem is that each time I add a new type of operation, I need to change the implementation of BaseClass. For example: // D uses method1() and method3() struct InterfaceD { virtual int method1() = 0; virtual int method3() = 0; } struct D { int methodD(InterfaceD&); } struct BaseClass : public A, B, C // here I need to add class D { ... } Do you know a clean way I can do this? Thanks for your help edit: I forgot to mention that it can also be done with templates. But I don't like this solution either because the required interface does not appear explicitly in the code. You have to try to compile the code to verify that all required methods are implemented correctly. Plus, it would require to instantiate different versions of the classes (one for each BaseClass type template parameter) and this is not always possible nor desired.

    Read the article

  • How initialize array of classes? (C++)

    - by Kra
    Hello, I have this class constructor: Pairs (int Pos, char *Pre, char *Post, bool Attach = true); How can I initialize array of Pairs classes? I tried: Pairs Holder[3] = { {Input.find("as"), "Pre", "Post"}, {Input.find("as"), "Pre", "Post"}, {Input.find("as"), "Pre", "Post"} }; Apparently it's not working, I also tried to use () brackets instead of {} but compiler keeps moaning all the time. Sorry if it is lame question, I googled quite hard but wasn't able to find answer :/ Thanks.

    Read the article

  • Overriding Built-in Classes (Python)

    - by Yipeng
    How can I view and override the full definition for built in classes? I have seen the library docs but am looking for something more. For e.g. is it possible to override the Array Class such that the base index starts from 1 instead of 0, or to override .sort() of list to a sorting algorithm of my own liking?

    Read the article

  • private classes inside namespaces

    - by blacklion
    Is there a way to restrict access to a class from outside a namespace? What I want is to have a class that is only accessible to other classes inside the same namespace without having to put the namespace in it's own assembly. Is there a reason this is not possible in C#?

    Read the article

  • PHP-OOP extending two classes?

    - by user1292810
    I am very beginner to OOP and now I am trying to write some PHP class to connect with FTP server. class ftpConnect { private $server; private $user; private $password; private $connection_id; private $connection_correct = false; public function __construct($server, $user = "anonymous", $password = "[email protected]") { $this->server = $server; $this->user = $user; $this->password = $password; $this->connection_id = ftp_connect($this->server); $this->connection_correct = ftp_login($this->connection_id, $this->user, $this->password); if ( (!$this->connection_id) || (!$this->connection_correct) ){ echo "Error! Couldn't connect to $this->server"; var_dump($this->connection_id); var_dump($this->connection_correct); return false; } else { echo "Successfully connected to $this->server, user: $this->user"; $this->connection_correct = true; return true; } } } I reckon that body of the class is insignificant at the moment. Main issue is that I have some problems with understanding OOP idea. I wanted to add sending emails every time, when the code is run. I have downloaded PHPMailer Class and extended my class with it: class ftpConnect extends PHPMailer {...} I have added some variables and methods and everything works as expected to that point. I thought: why not to add storing everything in database. Everytime user runs above code, proper information should be stored in database. I could edit my ftpConnect class and add database connecting to the constructor, and some other methods to updating tables. But database connecting and all that stuff could be used by other classes in the future, so it definitely should be implemented in seperate class. But my "main" ftpConnect class already extends one class and could not extend not a single one more. I have no idea how can I resolve this problem. Maybe my ftpConnect class is to complex and I should somehow divide it into couple smaller classes? Any help is much appreciated.

    Read the article

  • CSS single property classes

    - by user1490379
    As more presentational html properties get deprecated the natural response for me was to make single property CSS classes such as .text-align-left{text-align:left}. My question is, is this preferred versus inline styles? Stackoverflow actually uses quite a bit of inline styles. PS: I know this isn't really a coding question and it is likely to incite debate but stackoverflow is the largest stack exchange for code and this question does have some use for future individuals.

    Read the article

  • One-to-One relation classes

    - by SeyZ
    I want to have a class named ProjectDirectory and a class named MetaDirectory. Each project has a MetaDirectory which contains some meta data. Is it the good way to write the classes like this: class ProjectDirectory(object): def __init__(self, directory=None): self.directory = directory self.meta_directory = MetaDirectory(self) def __repr__(self): return self.directory class MetaDirectory(object): def __init__(self, project_directory=None): self.project_directory = project_directory self.directory = "%s/.meta/" % project_directory ProjectDirectory has a reference to MetaDirectory and MetaDirectory has a reference to ProjectDirectory. Is there an other solution or this solution is good ?

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >