Thursday, April 21, 2011

Best way to figure out why didReceiveMemoryWarning is always getting called on a UIViewController

I have a UIViewController and I'm noticing that I've done something to where the didReceiveMemoryWarning method is getting called every time I run it on an actual device.

I've run the project with Run > Run With Performance Tool > Object Allocations (and Leaks also). There are no leaks but I have no idea how to read or understand the "Object Allocations" data that is displayed.

So ...

How do I read this information and what is/are the best ways to figure out (and resolve) why this is happening?

Thanks

EDIT: I should mention that I also have a number of 3rd party libraries/code that I've included in my project (e.g. Three20, MGTwitterEngine, FTUtils, extThree20JSON and Twitter+OAuth). Could this be causing this??? Or at least contributing to the problem?

EDIT #2: Don't know if this helps but I notice that this is happening either everytime that I present a UIImagePickerController modally -OR- after a take a picture using it.

* UPDATE *

Ran it again with the Object Alloc tool for several minutes and I don't see anymore than 4.75MB being allocated at any given moment. The app was running on a device and typically with 2.5 MB allocated on average.

Does this seem problematic to anyone??? Seems like its in an acceptable range insofar as I understand thing.

From stackoverflow

.net example of using client certificates in web service call?

I'd like to use client certificates to verify the identity of administrative callers to my web service. Then I can issue certificates only to the people I want to call my web service and be pretty sure noone else can call it. This is in a very controlled scenario where only one or two people will get the client certificate, so distribution isn't a hard problem.

This article provides a good example of how to call a web service using a client certificate.

But how can I check details of the client certificate from within my web service? This old article talks about configuring IIS to do it, but I'd like to do it programmatically within my app. I think?

thanks for any suggestions!

From stackoverflow
  • The incoming Request has a ClientCertificates collection that you can interrogate -- you can check the various fields in the cert or check the actual raw byte data (perhaps against a datastore or other source) if you want to completely validate it.

    Note, if you issue the certs from your own private CA, you will need to install the CA's cert on your webserver into a store that is visible to all users, otherwise IIS won't request those certs from the user (due to the nature of how the server/client interaction works.)

  • MSDN knowledge base article:

    http://support.microsoft.com/kb/901183

Move your Working Copy

I tried to find out how to move my working copy. I know SVN move can be used to move files and folders inside your working copy but what about the working copy itself? I want to move it because I created a branch in a folder location that's different from my branch and had updated therefore all my .NET project references. So when I go to merge back to the mainline trunk I get a bunch of tree conflicts.

From stackoverflow
  • The actual working copy directory may be moved at will using your client operating system commands (i.e. Windows Explorer if you're using tortoisSVN). The working copy contains all the meta-data needed to remain consistent with the original repository from which you checked out the local working copy.

Android xml pages

where to add the new GUI xml pages in android project, say I have a welcome screen in res>layout>main.xml layout and when user clicks "next" button, it has to load up a new page with username and password GUI. any help will be appreciated

From stackoverflow
  • in your same layout folder

    res>layout>login_screen.xml
    
    : okay , thank you very much...

JNDI - how it works

If I understand correctly the default JNDI service runs on my local AS, right? So if I create an EJB and in jboss.xml (running JBoss) I name it "sth" than it is registered in my AS. Correct?

In big projects EJBs might be distributed through many servers - on one server EJBs doing sth and on another sth else. When calling JNDI loopup() I search only one server, right? So it means that I need to know where the EJB is registered... Is it true?

From stackoverflow
  • When you cluster your app you will usually configure the cluster so that you have one shared JNDI. In JBoss you do this using HA-JNDI (High Availability - JNDI) or equivalent. This is a centralized service with fail-over. In principle you could imagine having a replicated service for better throughput, but to my knowledge that is not available in JBoss.

    In short, you will have only one namespace, so you don't need to know where it is registered.

SWT applet: swt-win32-3650.dll already loaded in another classloader

I have multiple pages with java applet written with SWT. The problem is, applet loads only on first page, to load it on another page i need restart browser, otherwise i get following error:

Exception in thread "Thread-27" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
    no swt-win32-3650 in java.library.path
    no swt-win32 in java.library.path
    Native Library C:\Documents and Settings\xxx\Local Settings\Temp\swtlib-32\swt-win32-3650.dll already loaded in another classloader
    C:\Documents and Settings\xxx\Local Settings\Temp\swtlib-32\swt-win32.dll: %1 is not a valid Win32 application

at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)

I wonder, how can I unload swt dlls when browser page with applet is closed?

From stackoverflow
  • Applet class:

        @Override
        public void stop() {
            // do this to unload swt dlls
            System.exit(0);
        }
    
    Gili : This won't help if you load the same applet twice or other applications that use SWT simultaneously.
    kilonet : it actually a bad solution - has many side effects (for example it shutdowns all other loaded applets). But still something

NIO Connector in Tomcat

Hi,

I'm trying to enable NIO Connector in Tomcat 6.0 by configuring server.xml file, but I'm getting Firefox can't establish a connection to the server at localhost:8081. in the browser whenever I type localhost:8081.

This is how I've configured NIO connector in Tomcat 6.0. May I know what's the problem?

<Connector connectionTimeout="20000" port="8081" protocol="org.apache.
coyote.http11.Http11NioProtocol" redirectPort="8443"/>
From stackoverflow
  • I've tried your tag on my server.

    Your Connector tag has one unnecessary space between apache. and coyote Remove it or try with the one below.

    <Connector connectionTimeout="20000" port="8081" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>
    

    It should start up.