<div id="example-value"> or <div id="example_value">?
This site and Twitter use the first style. Facebook and Vimeo - the second.
Which one do you use and why?
This may be a subjective question leading to deletion but I would really like some feedback.
Recently, I moved to another very large enterprise project where I work as a C++ developer. I was aghast to find most classes in the project are anywhere from 8K to 50K lines long with methods that are 1K to 8K lines long. It's mostly business logic dealing with DB tables and data management, full of conditional statements to handle the use cases.
Are classes this large common in large enterprise systems? I realize without looking at the code it's hard to make a determination, but have you ever worked on a system with classes this large?
I'm making a game where each Actor is represented by a GameObjectController. Game Objects that can partake in combat implement ICombatant. How can I specify that arguments to a combat function must inherit from GameObjectController and implement ICombatant? Or does this indicate that my code is structured poorly?
public void ComputeAttackUpdate(ICombatant attacker, AttackType attackType, ICombatant victim)
In the above code, I want attacker and victim to inherit from GameObjectController and implement ICombatant. Is this syntactically possible?
I'm trying to enable a button but the button that I would enable in this function changes. I have an array of the buttons but when I use the .enabled on the array index I want it says that this doesn't work for IDs.
I have used this array to set the text of each button before using:
[[ButtonArray objectAtIndex: Index] setTitle:(@"blahblahblah") forState: UIControlStateNormal];
is there any way to use a similar function call to enable and disable?
I was wondering if there was a way to make controller methods in rails available only for specific HTTP methods (GET, POST, etc.).
I guess I can create a filter to do that but it seems to me that it is something that is available out-of-the-box in rails.
Is it?
I have a bunch of PHP files with classes, in them (although I can't be 100% sure that they won't have code outside of classes in them too), and I need to parse these files to get information about the classes, such as the names of the classes, the methods, the properties, whether they are private/public/static, etc. I looked at PHP's reflection classes and this is very close to what I want but the reflection doesn't seem to use external files and it appears to need to define the classes first. I need to make sure that none of the code is executed and I will be editing the files so I can't guarantee that they will even be error-free.
Any suggestions?
Thanks.
hi guys i was wondering if there is a way to hover a few elements with the same class name which is placed side by side and actions would be trigger upon leaving the area of the elements. For example :
<div class="hoverme"></div>
<div class="hoverme"></div>
<div class="hoverme"></div>
<div class="hoverme"></div>
<div class="hoverme"></div>
the javascript of "unhover" below should only be called when they leave the whole area of "hoverme" class.
$('.hoverme').live('mouseover mouseout', function(event) {
if (event.type == 'mouseover') {
if(!$("#stage1 td").hasClass("hover"))
{
$("#stage1 td").addClass("hover",200)
}
}
else {
//$("#stage1 td").removeClass("hover",200)
}
});
Is there a way for this action??
Or if i need to do that, than i should just use shared_ptr?
I know i have many questions regarding smart pointer - i still don't quite understand when to use which smart pointer.
I'm just getting my head around java (and OOP for that matter), the only thing I am familiar with is MySQL. I need to keep the DB connection open throughout the duration of the application, as well as a server socket.
I'm not even sure if they both need separate classes, but here's what I have so far:
http://pastebin.com/qzMFFTrY
(it wouldn't all go in a code tag)
The variable I need is con for line 86.
I'm reading the gcc manual at the moment, especially the part about warning/error flags. After reading the part about the -Wextra flag, I wonder if it is useful at all. It seems that it complains about things which seem to be rather subjective or a matter of taste. I'm not that experienced with gcc, I only use it from time to time for some small projects at university, so to all experienced C/C++ (or for whatever language you use gcc), what's the deal with -Wextra?
I currently have an array of around 8 - 10 numbers that changes on a periodic basis.
So around every 5 - 10 seconds the numbers get updated.
I need to get the top 3 numbers in the array every 10 seconds.
This is all done on a mobile device.
At the minute I iterate through the array 3 times and each time I take out the three highest numbers and place them in three previously declared variables.
My question is what should I look to do to increase speed and efficiency in this instance?
I need to write AVL-tree with generic type in C. The best way I know is to use [ void* ] and to write some functions for creating, copying, assignment and destruction. Please, tell me some better way.
I have the following code, which just print the key/value pairs in a dict (the pairs are sorted by keys):
for word, count in sorted(count_words(filename).items()):
print word, count
However, calling iteritems() instead of items() produces the same output
for word, count in sorted(count_words(filename).iteritems()):
print word, count
Now, which one should I choose in this situation? I consulted the Python tutorial but it doesn't really answer my question.
I have a column of states, and, depending on the query, I want to order by results by a particular state, then by id (Asc or Desc, depending). For instance, I might want to show all rows with state "HI", sorted by ID desc, and then all the other rows, sorted by id desc.
I was hoping I could do this in one query, rather than getting all my favored state results, and then getting the rest. Can I?
I just finished this tutorial:
http://codeigniter.com/wiki/Internationalization_and_the_Template_Parser_Class/
but now I want some links to change english to spanish
I know how to change it by modifying the controller example.php:
# Load language
$this->lang->load('example', 'english');
But I can't figure out how to do that in the view file example.php
What's the simplest and best way of doing this?
I'm currently working on an emulation server for a flash-client based game, which has a "pets system", and I was wondering if there was a simpler way of going about checking the level of specified pets.
Current code:
public int Level
{
get
{
if (Expirience 100) // Level 2
{
if (Expirience 200) // Level 3
{
if (Expirience 400) // Level 4 - Unsure of Goal
{
if (Expirience 600) // Level 5 - Unsure of Goal
{
if (Expirience 1000) // Level 6
{
if (Expirience 1300) // Level 7
{
if (Expirience 1800) // Level 8
{
if (Expirience 2400) // Level 9
{
if (Expirience 3200) // Level 10
{
if (Expirience 4300) // Level 11
{
if (Expirience 7200) // Level 12 - Unsure of Goal
{
if (Expirience 8500) // Level 13 - Unsure of Goal
{
if (Expirience 10100) // Level 14
{
if (Expirience 13300) // Level 15
{
if (Expirience 17500) // Level 16
{
if (Expirience 23000) // Level 17
{
return 17; // Bored
}
return 16;
}
return 15;
}
return 14;
}
return 13;
}
return 12;
}
return 11;
}
return 10;
}
return 9;
}
return 8;
}
return 7;
}
return 6;
}
return 5;
}
return 4;
}
return 3;
}
return 2;
}
return 1;
}
}
Yes, I'm aware I've misspelt Experience, I had made the mistake in a previous function and hadn't gotten around to updating everything... :P
What is wrong in the following code:
Point2D.h
template <class T>
class Point2D
{
private:
T x;
T y;
...
};
PointsList.h
template <class T>
class Point2D;
template <class T>
struct TPointsList
{
typedef std::vector <Point2D <T> > Type;
};
template <class T>
class PointsList
{
private:
TPointsList <T>::Type points; //Compiler error
...
};
I would like to create new user type TPointsList without direct type specification...
Please help me, i'm having a hard time with it. here is how should my program be. In first frame, there is a textfield1 where a user input text and when he press a button, a new frame will be display with a textfield2 that displays the inputted text from the textfield1
Hey guys,
I'm learning myself to go from function based PHP coding to OOP. And this is the situation:
ClassA holds many basic tool methods (functions). it's __construct makes a DB connection.
ClassB holds specific methods based on a certain activity (extract widgets). ClassB extends ClassA because it uses some of the basic tools in there e.g. a database call.
In a php file I create a $a_class = new ClassA object (thus a new DB connection).
Now I need a method in ClassB. I do $b_class = new ClassB; and call a method, which uses a method from it's parent:: ClassA.
In this example, i'm having ClassA 'used' twice. Onces as object, and onces via a parent:: call, so ClassA creates another DB connection (or not?).
So what is the best setup for this basic classes parent, child (extend) situation? I only want to make one connection of course?
I don't like to forward the object to ClassB like this $b_class = new ClassB($a_object); or is that the best way?
Thanks for thinking with me, and helping :d
Hey,
many builtin classes in Java implement Iterable, however String does not. It makes sense to iterate over chars in the String, just as one can iterate over items in regular array. Is there a reason behind it?