I was working on a program today and hit this strange bug. I had a UIButton with an action assigned. The action was something like:
-(void) someaction:(id) e
{
if ([e tag]==SOMETAG)
{
//dostuff
}
}
What confuses me is that when I first wrote it, the if line was
if (e.tag==SOMETAG)
XCode refused to compile it, saying
error: request for member 'tag' in 'e', which is of non-class type 'objc_object*'
but I thought the two were equivalent.
So under what circumstances are they not the same?
Help! As soon as enable script debugging I get this error. It breaks on the following block:
<table>
<tr>
<td style="width: 100px">
<asp:TextBox ID="txtRun" runat="server" OnTextChanged="txtRun_TextChanged"></asp:TextBox>
</td>
<td style="width: 100px">
<asp:Button ID="btnFilter" runat="server" Text="Show Elements" OnClick="btnFilter_Click" />
</td>
</tr>
</table>
The cursor jumps to the last tag. I am lost.
Thank you in advance.
I'm writing a code for a voting machine that will allow user to read in custom XML ballots and then vote on them, however in the current build I have in QtCreator, I don't see an easy way to edit buttons in my GUI directly. In the code snippet below, I assign an element to pull out the names and type of ballot being read in, but I need to append a label on the GUI as well as change buttons to the names of candidates read in. Any ideas on how to do this?
while(!n.isNull()){
QDomNode x = n.firstChildElement();
QDomElement e = n.toElement();
QMessageBox::information(0,
tr( "Loading Element" ),
tr( "Our element is %1" ).arg(e.tagName()) );
QDomElement p = x.firstChildElement();//p finds Races
QMessageBox::information(0,tr("Foo"),tr("p = %1").arg(p.text()));//finds Race and Ballot types
n = n.nextSibling();
}
}
Hi All,
I have 2 tables, user and userprofile. The userprofile table has a lot of fields similar to the user table. What I need to do is, on click of a button I need to copy all the fields of user table to userprofile table.
UserModel AttData = UserModel[0];
DataServices.Save((UserProfile)AttData.ProfileModel.Instance); UserModel[0] contains all the data in user table. I want to copy this data to AttData.ProfileModel.Instance. How can I do that?
"8,5,,1,4,7,,,,7,,1,9,3,6,,,8,6,3,9,,2,5,4,,,,,3,2,,,7,4,1,1,,4,,6,9,,5,,,,5,,,1,,6,3,,,6,5,,,,7,4,,1,7,6,,,,8,,5,,,7,1,,3,9,"
I'm doing a programming challenge where i need to parse this sequence into my sudoku script.
Need to get the above sequence into 8,5,0,1,4,7,0,0,0,7,0,1,9,3,6,0,0,8.........
I tried re but without success, help is appreciated, thanks.
The question stems from database tables comparison. Let's say we put left row in the instance Left and the right one into instance Right of the same type. And we'got many tables and respective types.
How to implement more or less generic routine resulting in a collection of diffs e.g.
propertyName , leftValue , rightValue for each such a pair of instances of the same type.
I am newer to PHP and MySQL and I am having trouble understanding join. I think, for me, the problem lies with actually understanding the logic of the query. What I am trying to do Is select all of the status updates from a table named "post", but only ones from users I am "following", and then display them In order by date. So, I have two databases which are set up like so:
posts
|post_id|user_id|post_body|date_upload|
| 1 | 4 | hey. | 01/2/2012 |
follows
|relation_id|user_id|followee_id|
| 1 | 4 | 2 |
Could someone please explain how I should syntactically and Logically set this up?
Thank you!
when using idle, I know you can reload a module if it's changed like this:
import foo
reload(foo)
if I only import part of a module, is there a way to reload it in a similar matter?
from foo import bar
I know this should be easier if I could only use optgroups. But I am trying to avoid hacking core of my CMS, so jQuery should come to rescue again, hopefully.
I have a select with options in a hierarchy sometimes, and I want to put attributes disabled to any of options containing text NOT starting with a dash.
I want to code like:
Set disabled attributes to selectors with options text NOT starting with a dash ("-").
<select id="options">
<option value="" selected="selected">- Please choose -</option>
<option value="1">Parent1</option>
<option value="2">-child1</option>
<option value="3">-child2</option>
<option value="4">-child3</option>
<option value="5">-child4</option>
<option value="6">Parent2</option>
<option value="7">-child5</option>
<option value="8">-child6</option>
<option value="9">-child7</option>
<option value="10">-child8</option>
</select>
The closest solution is here http://stackoverflow.com/questions/2012299/contain-start-by,
$.extend($.expr[':'], {
startsWith: function(elem,match) {
return (elem.textContent || elem.innerText || "").indexOf(match[3]) == 0;
}
});
But I can't seem to do it right this far.
Any help would be very much appreciated. Thank you very much.
#include "stdio.h"
#include "conio.h"
#include <iostream>
using namespace std;
int main (void)
{
char my_char[] = "happy birthday";
int i;
bool j=false;
char my_char_temp[1];
do
{
for (i=0;i<sizeof(my_char)-2;i++)
{
j=false;
if (my_char[i+1] < my_char[i])
{
my_char_temp[0]=my_char[i+1];
my_char[i+1] = my_char[i];
my_char[i] = my_char_temp[0];
j=true;
}
}
}while (j);
cout << my_char;
}
what am i doing wrong?
im just trying to sort the letters within the char
the output i get is completely wrong
Hi,
I have a text box where the value the result of a calculation carried out in jQuery. What I would like to do, using jQuery, is to display brackets around the number in the text box if the number is negative.
The number may be used again later so I would then have to remove the brackets so further calculations could be carried out.
Any ideas as to how I could implement this?
Thanks
Zaps
How do I use JQuery to get number from the drop down select?
<select aria-invalid="false" id="RatePercent" class="wpcf7-form-control wpcf7-select ratePercent" name="RatePercent">
<option value="">---</option>
<option value="Floating-6.5%">Floating-6.5%</option>
<option value="6 Months-5.65%">6 Months-5.65%</option>
<option value="1 Year-5.85%">1 Year-5.85%</option>
<option value="18 Months-5.99%">18 Months-5.99%</option>
<option value="2 Years-6.19%">2 Years-6.19%</option>
<option value="3 Years-6.85%">3 Years-6.85%</option>
<option value="4 Years-7.19%">4 Years-7.19%</option>
<option value="5 Years-7.40%">5 Years-7.40%</option>
</select>
If you choose 1 Year-5.85%, it returns '5.85', instead of '1 Year-5.85%'?
I have a class that has a vector of objects. What do I need to do to return one of this objects and change it outside the class, keeping the changings? Is it possible to do with regular pointers? Is there a standard procedure? (And yes, my background is in Java.)
Hello, I just want to write some few simple lines to a text file in C++, but I want them to be encoded in UTF-8. What is the easiest and simple way to do so?
Thanks
I think my code is too inefficient. I'm guessing it has something to do with using strings, though I'm unsure. Here is the code:
genome = FASTAdata[1]
genomeLength = len(genome);
# Hash table holding all the k-mers we will come across
kmers = dict()
# We go through all the possible k-mers by index
for outer in range (0, genomeLength-1):
for inner in range (outer+2, outer+22):
substring = genome[outer:inner]
if substring in kmers: # if we already have this substring on record, increase its value (count of num of appearances) by 1
kmers[substring] += 1
else:
kmers[substring] = 1 # otherwise record that it's here once
This is to search through all substrings of length at most 20. Now this code seems to take pretty forever and never terminate, so something has to be wrong here. Is using [:] on strings causing the huge overhead? And if so, what can I replace it with?
And for clarity the file in question is nearly 200mb, so pretty big.
From what I know about PHP, the following syntax is not legal:
if ($s == Yes)
It should instead be written as:
if ($s == 'Yes')
However, the first example is working just fine. Anyone know why?
Hi,
I have a method (C#)
public void MethodName(List<Order> Order, int ID)
I need to pass this to a main page, in which i know to pass integer value to ID, am not able to pass multiple items in a single list.
The List order should have two number entries, (ie. Order.number1 and Order.number2)
How should i pass a single list as a parameter to this method containing multiple entries of number1 and 2, so that i can loop thro' and find it.
Thanks.
I have an activity that when started needs access to two different ArrayLists. Both Lists are different Objects I have created myself.
Basically I need a way to pass these objects to the activity from an Intent. I can use addExtras() but this requires a Parceable compatible class. I could make my classes to be passed serializable but as I understand this slows down the program.
What are my options?
Can I pass an Enum?
As an an aside: is there a way to pass parameters to an Activity Constructor from an Intent?
Inside the callback of a $.getJSON call, I have the code outlined below. The first for block aggregates 'total' & assigns values to sov[i]. The map function calculates the percentage of total. I then instantiate a variable called sovData.
With the jQuery Flot graph, any objects that are empty aren't added to the pie chart, so this works for up to 7 different slices/datasets. What I'd like to do is only initialize the ones I need (e.g. sovData would have up to 'howMany - 1' (kws.length -1 ) objects inside of it, likely via something similar to dashboards[i] & sov[i]. How would I do this?
Code:
var sov = [], howMany = kws.length, total = 0, i = 0;
for ( i; i < howMany; i++) {
total += sov[ i ] = +parseInt(data.sov['sov' + ( i+1 ) ],10) || 0;
}
var dashboards = data.dashboards;
sov = $.map( sov, function(v) {
var s = Math.round( ( (v / total) * 10e3 ) / 100);
return s < 1 ? 1 : s;
});
var sovData = [{
label : dashboards[0],
data : sov[0]
},
{
label : dashboards[1],
data : sov[1]
},
{
label : dashboards[2],
data : sov[2]
},
{
label : dashboards[3],
data : sov[3]
},
{
label : dashboards[4],
data : sov[4]
},
{
label : dashboards[5],
data : sov[5]
},
{
label : dashboards[6],
data : sov[6]
}
]