Ok, so everyone knows that capitalised identifiers are seen to be ‘constant’ in Ruby.
However, it is possible to assign a new value to constants, so the following works
class A
def self.hi; "hi"; end
end
class B
def self.hi; "ho"; end
end
A.hi # => "hi"
B.hi # => "ho"
A = B
# warning: already initialized constant A
# => B
A.hi # =...
Is it possible to make my custom item class so that I can put it straight into a listviewitem?
What I mean is a listview and I want to be able to do Listview.items(0) = Item
Or is this not possible?
...
hi
What is the win-based application developing with C# equivalence of startup module we had in vb6.0? a static class ? or what?
...
Hey,
So i need to design something like that :
I have a spreadsheet which can contain numerous sheets (maybe of different kinds).
each sheet has let's say 1A-9Z cells.
in each cell i can have one the above :
String,
Number,
Formula - which means the cell gets an operation like +,-,/,* etc... and cells numbers,
and in the cell i have ...
I have an attribute in my car class called VehicleType.
Using an enum, I could list the different types of cars that exist and not allow any other type to be hard written in.
Problem is, if I have to GET the attribute from somewhere else, I will GET a numberical value, and not the string literal I saved.
What should I use here?
class...
I have a class which get all the bytes from a file, then it splits up the bytes into three parts (a header, index and body) these 3 parts get passed along to 3 classes (called header, body and index) respectively. When the bytes in the three classes gets modified how can I pass these changes back up to the first class (the one that got ...
Hi all, I'm coding a small class that maximizes a given function F and returns the coordinates. For example in maximizing the 1-dimensional fitness function below I currently have:
using System;
public static class Program
{
public static double F(double x)
{
// for example
return Math.Exp(0.4 * Math.Pow(x - 0.4...
This method shows a new window in my application:
public void ShowNewCustomerView() {
if (NewCustomer == null) NewCustomer = new NewCustomerView(this);
NewCustomer.setVisible(true);
}
The class NewCustomerView has this method:
public void ClearFields() {
txtAddress.setText("");
txtCity.setText("");
txtCompanyName....
I have defined two classes below.
public class junk {
private BigInteger a = BigIngeger.valueOf(1), b=BigInteger.valueOf(2), c;
public void DoSomething(){
c = a.add(b);
}
// ... other stuff here
}
public class junkChild extends junk{
private BigDecimal a = BigDecimal.valueOf(1), b=BigDecimal.valueOf(2), c;...
I would like to check if a class type is even instantiable before attempting to instantiate it via the new keyword in javascript.
For example
var geocoder = new GClientGeocoder();
will fail if the GClientGeocoder class is not available in the namespace.
What's the javascript idiomatic way to do this?
...
I have been learning and using PHP for several months now and I am at the stage where I can build almost anything, given the right plans and enough info.
What I'm asking is although I can do just about anything, is it worth learning how to use classes for PHP and using them in place of 'normal' (can't think of the word) code?
From what...
So I've spent some time thinking about this and been all over google looking for a 'solution' (the solution is most likely a matter of preference, but I'm unsure about this). Below is the problem I have, but the problem can be applied to a lot of situations regarding composition.
I have a class, Colour, containing the members of red, gr...
I am working on my first C# program and have run into a brick wall. I want to be able to set and get variables throughout diferent forms in the same application.
I created a class caleld "data" which contains the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Application1
{
...
How would you determine the classes (non Sun JDK classes) loaded / unused by a Java application?
Background:
I have an legacy Java webstart application that has gone through a lot of code changes and now has a lot of classes, most of which are not used. I would like to reduce the download size of the application by only deploying class...
I noticed that in Django models, there is a class Meta which makes some additional definitions about the model.
My question is, why is this done as an old-style class? (i.e. not subclassing object?) Is there a reason for this or is this just a custom? Could I do it as a new-style class in my projects?
...
What can be done with metaclasses that can't be in any other way?
Alex Martelli told that there are tasks that can't be achieved without metaclasses here http://stackoverflow.com/questions/1779372/python-metaclasses-vs-class-decorators
I'd like to know which are?
...
I'm working with xcode and I have classes associated with other projects that I want to be included in new projects. I realize that the #import will do the job technically (although what should i do if it's out of the project root folder). But what do I do if I want to include the class "properly" --basically so i can double click and ed...
This is in C++.
So, I'm starting from scratch writing a game engine for fun and learning from the ground up. One of the ideas I want to implement is to have game object state (a struct) be double-buffered. For instance, I can have subsystems updating the new game object data while a render thread is rendering from the old data by guar...
How do I remove a class from an element? I see in the documentation there's an $().swapClass(), but I don't see a $().removeClass().
...
class One
{
private function thisfn()
{}
}
class Two
{
private function thisfn()
{}
}
is this legit? btw does it matter if it's a private/public function inside a class?
And also, can I create a new function named thisfn() outside of any class (and make it public)? like:
function thisfn()
{}
...