Thursday, 3 October 2013

Checkbox disabled not returning result from stored checkbox array

Checkbox disabled not returning result from stored checkbox array

I am storing all checkboxes what my div has in to a variable, later i am
finding disabled from the stored variable, but i am not get proper result,
instead if I find separately I am getting proper result..
what why i am not find the disabled from my stored variable?
here is my code:
var checkedBoxes = $(".locale-container .panel ul
li").find("input:checkbox"),
disabledBoxes = checkedBoxes.find("input:checkbox:disabled");
// not getting
But "disabledBoxes" not getting result from checkBoxes.
In case if I do like this:
var checkedBoxes = $(".locale-container .panel ul
li").find("input:checkbox"),
disabledBoxes = $(".locale-container .panel ul
li").find("input:checkbox:disabled"); // it works
so how can i filter or get the appropriate checkboxes from stored variable?
Thanks in advance

Wednesday, 2 October 2013

How does compiler resolves virtual functions accessing non-virtual data members C++

How does compiler resolves virtual functions accessing non-virtual data
members C++

I was reading about the C++ Objects when I got this doubt. Suppose there
are two classes
class X
{
virtual int def() { };
}
class Y
{
virtual int abc() { };
}
class Z : public X,public Y
{
virutal int abc() { return a };
int a;
}
Now what I understand is both Y and Z have the reference to Z::abc() in
their virtual tables which helps to resolve the correct function to call.
Consider
Y *y = new Z;
Z *z = new Z;
y->abc() // I understand this is done by reaching the vptr of y by this =
this + sizeof (X)
and z->abc() // z has its own vptr reachable
My understanding is that in both the cases the "this" pointer is passed
and after finding out the correct abc() to call, how does the programm
reach the int value "a"?
How does the compiler calculate the address of " int a" correctly based on
type of the object passed?

Access to an array element with PHP

Access to an array element with PHP

To avoid multiple mysql SELECT queries I try to take the SELECT out of the
foreach-loop.
The query is
SELECT o.orders_id,
o.date_purchased,
o.orders_status,
ot.text AS order_total,
os.orders_status_name
FROM " . TABLE_ORDERS . " o
JOIN " . TABLE_ORDERS_TOTAL . " ot ON (o.orders_id = ot.orders_id AND
ot.class = 'ot_total')
JOIN " . TABLE_ORDERS_STATUS . " os ON (o.orders_status =
os.orders_status_id AND os.language_id = " .
(int)$_SESSION['languages_id'] . ")
WHERE o.customers_id = " . (int)$_SESSION['customer_id'] . "
ORDER BY orders_id DESC
As the result I get the array called $history_result['RESULT'] and it
looks like
Array
(
[0] => Array
(
[orders_id] => 309
[date_purchased] => 2013-10-02 15:49:54
[orders_status] => 1
[order_total] => 9,00 €
[orders_status_name] => Offen
)
[1] => Array
(
[orders_id] => 308
[date_purchased] => 2013-10-02 15:39:54
[orders_status] => 1
[order_total] => 9,00 €
[orders_status_name] => Offen
)
[2] => Array
(
[orders_id] => 307
[date_purchased] => 2013-10-02 15:33:48
[orders_status] => 1
[order_total] => 9,00 €
[orders_status_name] => Offen
)
)
In the following foreach-loop is the next MySql-Query
foreach ($history_result['RESULT'] as $history) {
$trackings = $db->result("-- 03 account_history_info.php
SELECT o.ortra_parcel_id,
c.carrier_tracking_link,
c.carrier_name
FROM " . TABLE_ORDERS_TRACKING . " o
JOIN " . TABLE_CARRIERS . " c ON o.ortra_id = c.carrier_id
WHERE ortra_order_id = " . $history['orders_id']
);
}
How can I access directly to the array element 'orders_id' so that I could
create an SQL statement like
$trackings = $db->result("-- 03 account_history_info.php
SELECT o.ortra_parcel_id,
c.carrier_tracking_link,
c.carrier_name
FROM " . TABLE_ORDERS_TRACKING . " o
JOIN " . TABLE_CARRIERS . " c ON o.ortra_id = c.carrier_id
WHERE ortra_order_id IN = " . implode(',', $fooArray)
);

vorbis and vorbisenc libraries not found

vorbis and vorbisenc libraries not found

I need to retrieve vorbis and vorbisenc libraries to compile a C program.
I tried to download vorbis lib sources in http://xiph.org/downloads/ but
each time, there are problems for compiling this lib. Do you know where I
can download these lib (.h and .so ) ?
I work on MacOSX. Thanks

Tuesday, 1 October 2013

Why dont all my textviews update with 1 button clicks? Requires multiple clicks

Why dont all my textviews update with 1 button clicks? Requires multiple
clicks

I have a simple tablelayout with many textview. When the button is pressed
only a few are updated, but what happens is that, you need to press the
button mutiple times for all the textviews to get updated. Why dont they
all change on the first/only click?
public class Calculator extends Activity {
String[] measurement;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.calculator);
setTitle("");
getActionBar().setIcon(R.drawable.logo);
final Spinner spinner = (Spinner) findViewById(R.id.spinner);
final Button button = (Button) findViewById(R.id.trapulate);
final EditText value_user_amount =
(EditText)findViewById(R.id.user_amount);
final EditText value_gram_yp =
(EditText)findViewById(R.id.value_gram_yp);
final TextView value_gram_amt =
(TextView)findViewById(R.id.value_gram_amt);
final TextView value_gram_sale =
(TextView)findViewById(R.id.value_gram_sale);
final TextView value_gram_profit =
(TextView)findViewById(R.id.value_gram_profit);
final TextView value_eighth_amt =
(TextView)findViewById(R.id.value_eighth_amt);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.measurements_array, R.layout.spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DecimalFormat numberFormat = new DecimalFormat("#.0");
String spinner_value = spinner.getSelectedItem().toString();
Double total_grams = 56.0;
Double total_price = 400.0;
String user_amount = value_user_amount.getText().toString();
Double user_amount_db = 20.0;
String user_price = value_user_amount.getText().toString();
Double user_price_num = 200.2;
String eighth_amt = value_eighth_amt.getText().toString();
Double eighth_amt_int = Double.parseDouble(eighth_amt);
String gram = value_gram_yp.getText().toString();
Double gram_int = Double.parseDouble(gram);
String gram_yp = value_gram_yp.getText().toString();
Double gram_yp_int = Double.parseDouble(gram_yp);
String gram_amt = value_gram_amt.getText().toString();
Double gram_amt_int = Double.parseDouble(gram_amt);
String gram_sale = value_gram_sale.getText().toString();
Double gram_sale_int = Double.parseDouble(gram_sale);
String gram_profit = value_gram_profit.getText().toString();
Double gram_profit_int = Double.parseDouble(gram_profit);
Double new_gram_amt = user_amount_db / 1;
Double new_gram_sale = gram_amt_int * gram_yp_int;
Double new_gram_profit = gram_sale_int - user_price_num;
if (spinner_value.equals("GRAMS"))
{
eighth_amt_int = user_amount_db / 3.5;
eighth_amt_int = Math.round(eighth_amt_int*1e2)/1e2;
value_eighth_amt.setText(Double.toString(eighth_amt_int));
value_gram_amt.setText(Double.toString(new_gram_amt));
value_gram_sale.setText(Double.toString(new_gram_sale));
value_gram_profit.setText(Double.toString(new_gram_profit));
}else
{
//Toast.makeText(getBaseContext(), "Not equal: "
+spinner_value,Toast.LENGTH_SHORT).show();
}
}
});
spinner.setOnItemSelectedListener(new OnItemSelectedListener()
{
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3)
{
int index = arg0.getSelectedItemPosition();
// storing string resources into Array
measurement =
getResources().getStringArray(R.array.measurements_array);
//Toast.makeText(getBaseContext(), "You have selected : "
+measurement[index],Toast.LENGTH_SHORT).show();
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
}
}

Why use typedef for iterators in template classes

Why use typedef for iterators in template classes

I read the following post: Why use typedef-typename in templates
I am reading up on some material which says you must have public typedef
for the following private nested class
template<typename T>
class list
{
private:
class my_private_it
{
public:
...
};
public:
typedef my_private_it iterator;
// should this be:
// typedef typename my_private_it iterator;
...
iterator begin(){return iterator(this)};
iterator end(){return iterator(NULL)};
};
Now from the aforementioned link, I understand, the typename is to help
the compiler deduce that it is infact working with types and not values
for certain dependent names. But why do people use the typedef? Is this
compiler requirement or standard requirement. Please note I understand the
typename part , but not the typedef part.

Where can I ask questions related to my my career options=?iso-8859-1?Q?=3F_=96_meta.stackoverflow.com?=

Where can I ask questions related to my my career options? –
meta.stackoverflow.com

Is there any branch of Stack Exchange where I can ask questions related to
my education and career?

what does uninstall-wubi.exe do?

what does uninstall-wubi.exe do?

What does uninstall-wubi.exe do? Does it uninstall just wubi or complete
Ubuntu? I installed Ubuntu 12.04 in Windows 7 and now have Windows 8 in
place of Windows 7 and I want a fresh copy of Ubuntu 12.04