Hello all,
Once again I find myself failing at some really simple task in C++. Sometimes I wish I could de-learn all I know from OO in java, since my problems usually start by thinking like Java.
Anyways, I have a std::list<BaseObject*> that I want to sort. Let's say that BaseObject is:
class BaseObject {
protected:
int id;
public:
BaseObject(int i) : id(i) {};
virtual ~BaseObject() {};
};
I can sort the list of pointer to BaseObject with a comparator struct:
struct Comparator {
bool operator()(const BaseObject* o1, const BaseObject* o2) const {
return o1->id < o2->id;
}
};
And it would look like this:
std::list<BaseObject*> mylist;
mylist.push_back(new BaseObject(1));
mylist.push_back(new BaseObject(2));
// ...
mylist.sort(Comparator());
// intentionally omitted deletes and exception handling
Until here, everything is a-ok. However, I introduced some derived classes:
class Child : public BaseObject {
protected:
int var;
public:
Child(int id1, int n) : BaseObject(id1), var(n) {};
virtual ~Child() {};
};
class GrandChild : public Child {
public:
GrandChild(int id1, int n) : Child(id1,n) {};
virtual ~GrandChild() {};
};
So now I would like to sort following the following rules:
For any Child object c and BaseObject b, b<c
To compare BaseObject objects, use its ids, as before.
To compare Child objects, compare its vars. If they are equal, fallback to rule 2.
GrandChild objects should fallback to the Child behavior (rule 3).
I initially thought that I could probably do some casts in Comparator. However, this casts away constness. Then I thought that probably I could compare typeids, but then everything looked messy and it is not even correct.
How could I implement this sort, still using list<BaseObject*>::sort ?
Thank you
I am making a website in Adobe Dreamweaver with php. In the site there’s a 3 buttons for selecting payment method that will act as the continue button. What I want is when the user checks a radio buttons (I agree button), it will be add with that amount and display with previous amount.. there is three buttons which has the corresponding values(amount in pounds)..
plz check my website http://www.spsmobile.co.uk in this linkgo to mobile phone unlocking and after add the cart click make payment it will go to next page there is a delivery mail details.. for that delivery mail details only am asking..
here i mentioned code:
<input id="radio-1" type="radio" name="rmr" value="1">
<label for="radio-1">£3</label> <input id="radio-2" type="radio" name="rmr" value="2">
<label for="radio-2">£5.5</label>
<input id="radio-3" type="radio" name="rmr" value="4">
<label for="radio-3">£10</label>
<div class="total-text" style="font-size:36px">£10</div>
var total = parseInt($("div.total-text").text().substring(1), 10);
$("input[name='rmr']").bind('change', function() {
var amount = 0;
switch (this.value) {
case "1":
amount = 3;
break;
case "2":
amount = 5.5;
break;
case "4":
amount = 10;
break;
}
$("div.total-text").text("£" + (total + amount));
});
but there is no change , my previous amount did not add with that. while am clicking previous amount only displayed on browser.. i need when i cliks radio button the value should change correspondingly.. where i did that mistake...plz give me some idea and what should i do..is there any need for storing db..
thanks in adv
Hello,
what can i do, if a Mailserver accepts a connection but does not return any data? The default javax.mail implementation just hangs indefinitley. Event setting the smtp.timeout does not help - it still hangs. I even tried to set a custom SocketFactory to set the sotimeouts and solinger directly, but it still hangs. Somehow the socket does get kept alive? But how?
Thx for any ideas!
Ciao, Nils
For a US business does anything occur differently for employing a foreign consultant as a opposed to a standard 1099 consultant that is a legal resident? There would be no relocation of the consultant so I believe that would rule out any visa considerations (unless you need a workers visa to work as a consultant?).
Hi,
i have this page:
login: [email protected]
password: m
I want to have the string "Editar mi perfil" aligned on the right, so i have added:
text-align: right
but it doesn't work,
I have tried also:
float:right
It works but goes a bit upper than I want.
Any idea?
Regards
Javi
Say I'm using a form with a text-field.
<@s.form action="login"
<@s.textfield label="E-mail" name="email"/
<@s.submit value="send"/
How can I specify that the text-form should be generated by a custom template (text_login.ftl) rather than the standard text.ftl?
When we try to open an attachment file from the mail, the desktop browser asks to save / open the file. As like that I need to do in the android mobile browser. How it's possible to ask a question in the mobile browser at the time of open an attachment file (*.ics)? Can anyone help me to develop an application for this ???
Currently, i am working on sending/receiving mail project on Win7, i want to use Seolib.dll (COM) to handle for event sending/receiving mails but Win7 is not supported this one. So is there any solution for this issue?
In dojo, one cannot call a overidden superclass method outside of the same method in the derived class (for which there is this.inherited(), other than that one can call using class_name.function_name.apply). This feature is no longer there because of some refactoring and dojo guys are not going to put it back because they are not convinced about a good enough case for this. Please read this mail thread for details. Isn't there a good enough case for this functionality? Why or why not?
string inputText = "abc13500008888, *a1c13688886666abc mm13565685555**" ;
How to use C# Regular Expression to get the match number list?
The rule is that is a 11 continuous number and the first letter is 1.
The results should be:
13500008888
13688886666
13565685555
Hey guys!
I'm having trouble figuring out how to exclude /public/bin from this rewrite rule
RewriteCond %{REQUEST_URI} !firerift.php
RewriteRule ^(.*)$ firerift.php/$1 [L,QSA,NC]
Any help would be appreciated.
I am using Drupal and have sifr set on list items, and also a, a:hover are set via Drupal so that the links hover. I looked at the sifr3-rules.js file drupal's render module creates and it looks good. and in fact my other sifr items look fine... But the list item ones are goofing for some reason... There is extra space below the list,
so if i have a list item, and inside of that, I have a unordered list with more list items, the Flash Object made in the 1st li (which will cover the rest of the sublist items too), is too bid so you see space under the children until the next parent li comes up. (so looks like extra bottom padding on that portion of the list in IE8... in FF almost similar but each subitem has space at bottom... with javascript turned off, you see the list items look fine by themselves)....
Also if the parent list item is shorter than the sub list items text, the width for the flash object is set only as long as the first list item, and therefore cuts off the rest the sublist item's text.
Any idea how to resolve any of these?
Only unusual thing i see i am doing is setting forceSingleLine and preventWrap (which dont make a difference if taken off).
****Edit, I may just try to figure out how to get Drupal's menu-block module to output a around my hyperlinks in the list items... then i can target the div's with my rule (and the a,a:hover rules will apply), so each menu item gets its own sifr object instead of sifr3 trying to figure out how to do the lists and sublists.
Very useful to me is anyone knows a way to target a hyperlink (<a> tag) and also allow a:hover rules. I know how to do it with pretend another tag that includes hyperlinks, like if i had <h2><a>sometitle</a></h2>, i could have a rule for h2, but then use the a, a:hover rules in the sifr3-rules.js file to target that. so i would need a way to target the hyperlink in the list, but also apply a :hover to it (not sure if this can be done since its not underneith for example the h2 tag).
Does css "content" property break the rule of content and separation because css is for presentation not to generation content?
By the way What are other good uses of css "Content" property? i've seen this only in clear fix hack.
I'm creating a newsletter, and i want to have panels that change background-color on mouse over.
Seeing as the newsletter wont have a head, I am defining all styles inline. I'm pretty sure most popular mail clients will block JS. So I was wondering if I can define a hover effect in the style attribute. Or is there any other solution to achieve this effect?
Peace
I trying to make MySQL available by 2 ports: 3306 and 3339
I added rule to iptables:
iptables -t nat -A PREROUTING -i bond0 -p tcp --dport 3339 -j REDIRECT
--to-port 3306
and everythin is great for remote connections.
But if I'm trying to connect it locally, I'm getting an error:
mysql -u username -ppassword --port=3339 -h Host.Name
ERROR 2003 (HY000): Can't connect to MySQL server on 'Host.Name' (111)
Any ideas how can I edit iptables to get local access via 3339 port?
Hi !
Is it possible to remove user mail signature programmaticly?
When I using MFMailComposeViewController, I dont want to have the usersignature at the bottom of the mailpage.
Regards.
I haven't been able to found this on Google, so I thought maybe somene here knew if this was possible and if so, how to implement it =) thanks in advance for any answers!
What I am aiming for is overwriting this method so I can perform some actions before the sms/mail gets sent, then just allow it to perform its normal actions.
Is there a general convention about exposing members in Python classes? I know that this is a case of "it depends", but maybe there is a rule of thumb.
Private member:
class Node:
def __init__(self):
self.__childs = []
def add_childs(self, *args):
self.__childs += args
node = Node()
node.add_childs("one", "two")
Public member:
class Node2:
def __init__(self):
self.childs = []
node2 = Node2()
node2.childs += "one", "two"
How to change the views backgroundcolor in mailcomposer application in iphone?
I already used mail.view.backgroundColor=[UIColor orangeColor]; but it's not giving any result.
If any one know the answer please tell me.
How can I create the mod_rewrite rule so I can convert the following URLs:
From:
domain/something/param/action
ex:domain/cities/Chicago/view
to:
domain/something/action.php?param1=param
ex: domain/cities/view.php?city=Chicago
Changing to cities/view/Chicago cannot be an alternative.
Thanks in advance.
Hi folks,
I have name, phone number and E-mail infomation of a contact. I just want to insert the additional email and phone for the existing contact. My questions are
How to find the contact is already existing or not?
How to insert the values on the additional or secondary address option?
Thanks in Advance.