Inneractive Ads cause a lot of App crashes (Windows Phone) - windows-phone-7

I use InnerActive as my default Ad provide for my Windows Phone apps. I being using it since June 2013 and on my end of year analysis I realized InnerActive ads are my main source of my app crashes. The worst part is, it's code don't I don't have any control over. I already placed a "try catch" around every operation that requests Inneractive Ads.
Does anyone have any idea how can I resolve this issue?
Where is the code I use to request the Ads:
private void LoadInnerActiveAds()
{
try
{
if (DeviceNetworkInformation.IsNetworkAvailable)
{
// Watch location
if (_allowAdLocationTracker)
{
IaLocationClass iaLocation = new IaLocationClass();
iaLocation.Done += new EventHandler<IaLocationEventArgs>(InnerActiveLocation_Done);
iaLocation.StartWatchLocation();
}
optionalParams = new Dictionary<InneractiveAd.IaOptionalParams, string>();
//optionalParams.Add(InneractiveAd.IaOptionalParams.Key_Gender, "m");
optionalParams.Add(InneractiveAd.IaOptionalParams.Key_Ad_Alignment, InneractiveAd.IaAdAlignment.CENTER.ToString());
optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdWidth, "480");
optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdHeight, "80");
}
//Show Add Banner. Remarks: pay attention to use Application Id from NAX
//naxAd.Childred.Count()==0 => just to add one banner control on a page. Without this, code would add as many banners as you navigate to page where banner is placed
if (optionalParams != null && AdsUIContainer.Children.Count == 0)
{
InneractiveAd iaBanner = new InneractiveAd(AdsAppId, InneractiveAd.IaAdType.IaAdType_Banner, 30, optionalParams);
iaBanner.AdFailed += new InneractiveAd.IaAdFailed(InneractiveAd_AdFailed);
Deployment.Current.Dispatcher.BeginInvoke(() => { UpdateUI(iaBanner); });
}
}
catch (Exception ex)
{
InneractiveAd_AdFailed(ex);
}
}
This stacktrace might help, but keep in mind this is code I don't control.
Frame    Image                Function                                                               Offset        
0        system_xml_ni        System.Xml.XmlTextReaderImpl.Throw                                     0x00000036    
1        system_xml_ni        System.Xml.XmlTextReaderImpl.ParseDocumentContent                      0x00000438    
2        system_xml_ni        System.Xml.XmlTextReaderImpl.Read                                      0x00000036    
3        system_xml_ni        System.Xml.XmlReader.ReadToFollowing                                   0x0000003c    
4        inneractive_ad_ni    Inneractive.Ad.InneractiveAdControl.ParseCPDXml                        0x0000007c    
5        inneractive_ad_ni    Inneractive.Ad.InneractiveAdControl.webClient_UploadStringCompleted    0x000000aa    
6        system_net_ni        System.Net.WebClient.OnUploadStringCompleted                           0x00000010    
7        system_net_ni        System.Net.WebClient.UploadStringOperationCompleted                    0x00000034
Solution:
Following Soonts suggestion, this is what I came up with:
In App.xaml.cs file locate "Application_UnhandledException" method and replace it with:
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (e.ExceptionObject.StackTrace.Contains("Inneractive.Ad.InneractiveAdControl"))
{
// Recover from the error
e.Handled = true;
return;
}
if (Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
Debugger.Break();
}
}
Please let me know if you find better alternatives.

First, contact InnerActive telling them to fix their software. It's their responsibility.
Meanwhile, if you know how to reproduce the problem, you can try following. Subscribe for all unhandled exceptions (start with Application.UnhandledException, also there're AppDomain.UnhandledException and TaskScheduler.UnobservedTaskException), in the handler search for “Inneractive.Ad.InneractiveAdControl” in the Exception.StackTrace, if found — ignore the exception, and optionally hide or reload the inneractive banner.

Related

Building ruby 2.7.0 fails with openssl

I'm trying to build ruby 2.7.0 from source but I get some errors with openssl/libressl after doing make:
compiling ossl_ocsp.c
ossl_ocsp.c:1096:38: error: incomplete definition of type 'struct ocsp_basic_response_st'
        sk_X509_num(x509s) && sk_X509_num(bs->certs)) {
                                          ~~^
/usr/include/openssl/safestack.h:1505:43: note: expanded from macro 'sk_X509_num'
#define sk_X509_num(st) SKM_sk_num(X509, (st))
                                          ^~
/usr/include/openssl/safestack.h:144:32: note: expanded from macro 'SKM_sk_num'
        sk_num(CHECKED_STACK_OF(type, st))
                                      ^~
/usr/include/openssl/safestack.h:72:21: note: expanded from macro 'CHECKED_STACK_OF'
    ((_STACK*) (1 ? p : (STACK_OF(type)*)0))
                    ^
/usr/include/openssl/ocsp.h:160:16: note: forward declaration of 'struct ocsp_basic_response_st'
typedef struct ocsp_basic_response_st OCSP_BASICRESP;
              ^
1 error generated.
*** Error 1 in ext/openssl (Makefile:313 'ossl_ocsp.o': # cc -I.
-I../../.ext/include/x86_64-openbsd7.1 -I../.././include
-I../.././ext/open...)
*** Error 2 in . (exts.mk:250 'ext/openssl/all': #cd ext/openssl
&& exec make  UPDATE_LIBRARIES=no EXTENCS=dmyenc.o
libdir=/home/computer/.rub...)
*** Error 2 in /home/computer/ruby27/ruby-2.7.0 (Makefile:984
'build-ext': #make -f exts.mk   
libdir="/home/computer/.rubies/2.7.0/lib" LIBRUBY_E...)
$ openssl version
LibreSSL 3.5.2
If you have any idea thank you :)

Netty channelRead is not getting invoked while waiting response from Oracle DB server over SSL

In my project, a Java client program tries to connect an Oracle DB server over SSL with Netty.
the client simply sends the connection string to DB server and waits the response (TCPS packets).
my code snippets are given below:
....
SSLContext sslContext = SSLContextFactory.getSslClient();
SSLEngine engine = sslContext.createSSLEngine();
engine.setEnabledProtocols(new String[]{"TLSv1"});
engine.setUseClientMode(true);
socketChannel.pipeline().addFirst("ssl",new SslHandler(engine));
....
In my handler class that extends ChannelInboundHandlerAdapter, I see that ssl handshake and peer authentication is completed successfully.
In addition to this,
ctx.channel().read();
line has been reached in the following method:
#Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        ctx.read();
        if (message != null) {
            ctx.writeAndFlush(Unpooled.copiedBuffer((byte[]) message)).addListener((ChannelFutureListener) (channelFuture) -> {
                if (channelFuture.isSuccess()) {
                    ctx.channel().read();
                } else {
                    channelFuture.cause().printStackTrace();
                    channelFuture.channel().close();
                }
            });
            message = null;
        }
    }
however, channelRead method is never called and DB server doesn't send any data.
I will be happy if You have any suggestions.
thanks in advance.

How do i calculate the average cpi?

Im kinda stuck on some work. To find the the cpi i would need to multiply the percentage of instructions with the clock cycle but what is shown is avg stall cycles. I don't really understand how to approach this problem. Any help would be appreciated.
A computer with a 5 stage pipeline is measured and has the following characteristics
Instruction Type  % of instructions.   Avg. stall cycles/instructions
Branches             .3                               .7
Loads & Stores     .2                               .2

ALU ops              .4                               0

Other               .1                               .2
a) what is the average CPI for the computer?

b) What is the speedup for this machine?
In your last comment, you have the correct weighted average of stall cycles per instruction. But you need the total cycles per instruction presumably.
As for speedup, it's unclear what your baseline is.

infinite scrolling using jQuery

The script is working fine, but when the content ends, the page never reaches to the end. I need to make it stop infinite scrolling when the loaded content is end.
Another question, i dont want to load all the divs right away, i need to load it every five in five, how can i do that?
js:
if($(window).scrollTop() == $(document).height() - $(window).height())
    {
        $('div#loadmoreajaxloader').show();
        $.ajax({
        url: "loadmore.php",
        success: function(html)
        {
            if(html)
            {
                $("#postswrapper").append(html);
                $('div#loadmoreajaxloader').hide();
            }else
            {
                $('div#loadmoreajaxloader').html('<center>No more posts to show.</center>');
            }
        }
        });
    }
html:
<div id="postswrapper">
<div class="item">content</div>
...
<div id="loadmoreajaxloader" style="display:none;"><center><img src="bigLoader.gif" /></center></div>
</div>
and the loadmore.php contains many <div class="item">content</div>
Ok I'm making 2 assumptions here first that you're calling the code you provided using the scroll listener. Second you might want to call the same code later.
To stop it you need to create a flag so it stop making the calls (or unbind the scroll if you dont want to use the same later), to paginate your results you need to create a variable that count the page you're actually showing but also you need to modify the code processing the ajax request so it uses the page data we're sending.
flag = true; //Flag to identify if the code should request more results
page = 1; //Current page
$(document).scroll(function(){
if(flag && ($(window).scrollTop() == $(document).height() - $(window).height()))
{
$('div#loadmoreajaxloader').show();
$.ajax({
url: "loadmore.php",
data: {page:page}
success: function(html)
{
if(html)
{
$("#postswrapper").append(html);
$('div#loadmoreajaxloader').hide();
page++;
}else
{
flag = false;
$('div#loadmoreajaxloader').html('<center>No more posts to show.</center>');
}
}
});
}
});

Can i Use the value of a variable from within a ruby script inside ssh.exec()

If i have a # {} , like #{results}, in the snippet below:
results = Array.new
f = open("/Users/kahmed/messages", "r")                                 
f.each_line do |line| 
results << "#{$.} #{line}" if line =~ /NFE/                                     
puts #{results}
end
How can i use it in the following ssh.exec command
Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|                              
ssh.exec(#{results})
Something like:
Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|
results.each{|line| ssh.exec( line)}
end

Resources