Task.WaitAll, how to find the tasks causing AggregateException
Let's say that I got the following code:
var tasks = BuildTaskList();
try
{
Task.WaitAll(tasks.ToArray());
}
catch (AggregateException exception)
{
}
How do I know which task threw which of the exceptions in
exception.InnerExceptions?
Monday, 19 August 2013
Sunday, 18 August 2013
Firebase query can return null sibling when there really is another sibling
Firebase query can return null sibling when there really is another sibling
When a limit is applied to a query, the first found element in the query
will have a null previous sibling. Even though it really does have a
sibling, it just hasn't been fetched in the query.
FQuery* messageListQuery = [m_firebaseRef queryLimitedToNumberOfChildren:2];
[messageListQuery observeEventType:FEventTypeChildAdded
andPreviousSiblingNameWithBlock:^(FDataSnapshot *snapshot, NSString
*prevNodeName) {
NSString *nodeName = snapshot.name;
NSDictionary *msgData = snapshot.value;
NSString *where = (prevNodeName == nil) ? @"at the beginning" :
[NSString stringWithFormat:@"after %@", prevNodeName];
NSLog(@"%@ says %@ %@", nodeName, msgData[@"text"], where);
}];
I have 3 messages at the given FirebaseRef. However, it shows that the
Test 2 message has no previous sibling:
-J1JTkEzsdxHGMBEk5eD says Test 2 at the beginning
-J1JW0vpWBZema9QKUcB says Test 3 after -J1JTkEzsdxHGMBEk5eD
When showing all the messages it can be clearly seen Test 2 as a previous
sibling:
-J1JTWoAw5IiUpzkOV4l says Test at the beginning
-J1JTkEzsdxHGMBEk5eD says Test 2 after -J1JTWoAw5IiUpzkOV4l
-J1JW0vpWBZema9QKUcB says Test 3 after -J1JTkEzsdxHGMBEk5eD
I'm not sure if this is a bug or is as designed by Firebase. It seems a
little misleading as one would want to know if there are more nodes by
looking at the prevNodeName parameter.
When a limit is applied to a query, the first found element in the query
will have a null previous sibling. Even though it really does have a
sibling, it just hasn't been fetched in the query.
FQuery* messageListQuery = [m_firebaseRef queryLimitedToNumberOfChildren:2];
[messageListQuery observeEventType:FEventTypeChildAdded
andPreviousSiblingNameWithBlock:^(FDataSnapshot *snapshot, NSString
*prevNodeName) {
NSString *nodeName = snapshot.name;
NSDictionary *msgData = snapshot.value;
NSString *where = (prevNodeName == nil) ? @"at the beginning" :
[NSString stringWithFormat:@"after %@", prevNodeName];
NSLog(@"%@ says %@ %@", nodeName, msgData[@"text"], where);
}];
I have 3 messages at the given FirebaseRef. However, it shows that the
Test 2 message has no previous sibling:
-J1JTkEzsdxHGMBEk5eD says Test 2 at the beginning
-J1JW0vpWBZema9QKUcB says Test 3 after -J1JTkEzsdxHGMBEk5eD
When showing all the messages it can be clearly seen Test 2 as a previous
sibling:
-J1JTWoAw5IiUpzkOV4l says Test at the beginning
-J1JTkEzsdxHGMBEk5eD says Test 2 after -J1JTWoAw5IiUpzkOV4l
-J1JW0vpWBZema9QKUcB says Test 3 after -J1JTkEzsdxHGMBEk5eD
I'm not sure if this is a bug or is as designed by Firebase. It seems a
little misleading as one would want to know if there are more nodes by
looking at the prevNodeName parameter.
Seeing Typeclass definition in ghci for a specific type
Seeing Typeclass definition in ghci for a specific type
Is there a way to see Typeclass definition in ghci for a specific type?
For example, Maybe is defined like this:
instance Functor Maybe where
fmap f (Just x) = Just (f x)
fmap f Nothing = Nothing
Can I see this in ghci ?
Is there a way to see Typeclass definition in ghci for a specific type?
For example, Maybe is defined like this:
instance Functor Maybe where
fmap f (Just x) = Just (f x)
fmap f Nothing = Nothing
Can I see this in ghci ?
How to draw from exponential distribution in Ruby?
How to draw from exponential distribution in Ruby?
In Ruby, I need to draw from an exponential distribution with mean m.
Please show me how to do it quickly and efficiently. Eg. let's have:
m = 4.2
def exponential_distribution
rand( m * 2 )
end
But of course, this code is wrong, and also, it only returns whole number
results. I'm already tired today, please hint me towards a good solution.
In Ruby, I need to draw from an exponential distribution with mean m.
Please show me how to do it quickly and efficiently. Eg. let's have:
m = 4.2
def exponential_distribution
rand( m * 2 )
end
But of course, this code is wrong, and also, it only returns whole number
results. I'm already tired today, please hint me towards a good solution.
Obfuscating personal information
Obfuscating personal information
I have a question relating to how many fields of personal information need
to be obfuscated from records in a database, specifically: If the Name
fields (First, Last and Middle), Email, SSN, Address and Phone number are
all obfuscated, do the data of birth also need to be obfuscated? The DoB
is required for troubleshooting purposes, so is needed. As long as the
other fields are removed, through obfuscation, the DoB would not be
traceable to an individual, is the case for being able to leave it alone.
Any help is greatly appreciated in pointing why this logic does not hold
up.
Thanks,
Dave
I have a question relating to how many fields of personal information need
to be obfuscated from records in a database, specifically: If the Name
fields (First, Last and Middle), Email, SSN, Address and Phone number are
all obfuscated, do the data of birth also need to be obfuscated? The DoB
is required for troubleshooting purposes, so is needed. As long as the
other fields are removed, through obfuscation, the DoB would not be
traceable to an individual, is the case for being able to leave it alone.
Any help is greatly appreciated in pointing why this logic does not hold
up.
Thanks,
Dave
How can i access the first element with myabilities class?
How can i access the first element with myabilities class?
How can i access the first element with myabilities class in code given
below?
<div class="span6">
<h3 class="srvc-title">Responsive Design</h3>
<p class="srvc-detail">Crafting great experiences to suit the
capabilities of every browser.</p>
<p class="myabilities">The number of web-accessible devices is truly
a wonder of our information age. It's also a daunting canvas for
design.</p>
<p class="myabilities">Mobile phones, tablets, desktops — it's hard
to even categorise these days. I specialise in embracing the Web's
ubiquity. It's my job to design for all experiences.</p>
<p class="myabilities">Great design can't be achieved in isolation.
In fact, it's two development practices that are the secret; feature
detection and progressive enhancement. That means a multi-tiered
design to match the capabilities of any browser.</p>
<p class="myabilities">Complicated for us but for users — it just
works.</p>
</div>
How can i access the first element with myabilities class in code given
below?
<div class="span6">
<h3 class="srvc-title">Responsive Design</h3>
<p class="srvc-detail">Crafting great experiences to suit the
capabilities of every browser.</p>
<p class="myabilities">The number of web-accessible devices is truly
a wonder of our information age. It's also a daunting canvas for
design.</p>
<p class="myabilities">Mobile phones, tablets, desktops — it's hard
to even categorise these days. I specialise in embracing the Web's
ubiquity. It's my job to design for all experiences.</p>
<p class="myabilities">Great design can't be achieved in isolation.
In fact, it's two development practices that are the secret; feature
detection and progressive enhancement. That means a multi-tiered
design to match the capabilities of any browser.</p>
<p class="myabilities">Complicated for us but for users — it just
works.</p>
</div>
Error related to updating quantity in table
Error related to updating quantity in table
Hi Experts,
I need your help to resolve this issue in my script as I am trying to
update a quantity of the product in products table based on getting
information via post from the first page. everything seems ok but the
quantity is not getting updated in the table. table already had some
quantity for this product.
Page 1:
$selectP="select prodid, prodname, prodtype from products where prodtype
= 'BP'";
$result=mysql_query($selectP) or die (mysql_error());
echo "<form method=POST action=quantupdate.php>";
echo "<center><table border=1 cellpadding=5>";
echo "<tr><td>Select a Product to Update Quantity in Stock </td>";
echo "<td>";
echo "<select size=\"1\" name=\"product_selection\"
id=\"product_selection\">";
echo "<option value=\"0\">- Product -</options>";
while($row = mysql_fetch_array($result)) {
echo "<option value='".$row['prodid']."'>".$row['prodname']."</option>";
}
echo "</select>";
echo "<tr><td>Select Quantity </td>";
echo "<td>";
echo "<select size=\"1\" name=\"pq\" id=\"pq\">";
echo "<option value=\"0\">Select Qty</options>";
echo "<option value=\"5\">5</options>";
echo "<option value=\"10\">10</options>";
echo "<option value=\"20\">20</options>";
echo "<option value=\"30\">30</options>";
echo "</select>";
echo "<tr><td><input type=submit name=submit id=submit value='Update
Now'></td>";
echo "<td><input type=reset value='Clear Form'></td></tr>";
echo "</table></center>";
echo "</form>" ;
Page 2:
$bprod=$_POST['product_selection'];
$quantity=$_POST['pq'];
if(isset($_REQUEST['product_selection'])) {
$bprod=$_POST['product_selection'];
} else {
echo "Not Working???";//do something about it
}
$updatequantity="UPDATE products
SET prodquantity = ".$quantity." WHERE prodname = ".$bprod;
$exeupdatequantity=mysql_query($updatequantity);
everything seems ok, no error message but table is not getting updated
with the new quantity.
Pls help. Many thanks in advance.
Hi Experts,
I need your help to resolve this issue in my script as I am trying to
update a quantity of the product in products table based on getting
information via post from the first page. everything seems ok but the
quantity is not getting updated in the table. table already had some
quantity for this product.
Page 1:
$selectP="select prodid, prodname, prodtype from products where prodtype
= 'BP'";
$result=mysql_query($selectP) or die (mysql_error());
echo "<form method=POST action=quantupdate.php>";
echo "<center><table border=1 cellpadding=5>";
echo "<tr><td>Select a Product to Update Quantity in Stock </td>";
echo "<td>";
echo "<select size=\"1\" name=\"product_selection\"
id=\"product_selection\">";
echo "<option value=\"0\">- Product -</options>";
while($row = mysql_fetch_array($result)) {
echo "<option value='".$row['prodid']."'>".$row['prodname']."</option>";
}
echo "</select>";
echo "<tr><td>Select Quantity </td>";
echo "<td>";
echo "<select size=\"1\" name=\"pq\" id=\"pq\">";
echo "<option value=\"0\">Select Qty</options>";
echo "<option value=\"5\">5</options>";
echo "<option value=\"10\">10</options>";
echo "<option value=\"20\">20</options>";
echo "<option value=\"30\">30</options>";
echo "</select>";
echo "<tr><td><input type=submit name=submit id=submit value='Update
Now'></td>";
echo "<td><input type=reset value='Clear Form'></td></tr>";
echo "</table></center>";
echo "</form>" ;
Page 2:
$bprod=$_POST['product_selection'];
$quantity=$_POST['pq'];
if(isset($_REQUEST['product_selection'])) {
$bprod=$_POST['product_selection'];
} else {
echo "Not Working???";//do something about it
}
$updatequantity="UPDATE products
SET prodquantity = ".$quantity." WHERE prodname = ".$bprod;
$exeupdatequantity=mysql_query($updatequantity);
everything seems ok, no error message but table is not getting updated
with the new quantity.
Pls help. Many thanks in advance.
Subscribe to:
Posts (Atom)