Monday, December 27, 2010

XCode, A valid provisioning profile for this executable was not found. When you try to Build and Run Ipad/Iphone App to devices

I just create one HelloIpad application in Xcode. and connect my IPAD to the PC and run the auto provisioning step to add one Device to the team provision profile managed by Xcode. all works good. When I try to build and run on the IPAD, Get the following strange error.

A valid provisioning profile for this executable was not found.

A

Then I checked the Device Console Log [ Device->console tab]

Mon Dec 27 09:38:47 DVDs-iPad installd[361] <Error>: 2ff66000 verify_signer_identity: Could not copy validate signature: -402620395
Mon Dec 27 09:38:47 DVDs-iPad installd[361] <Error>: 2ff66000 preflight_application_install: Could not verify executable at /var/tmp/install_staging.LpTPGN/HelloIPAD.app
Mon Dec 27 09:38:47 DVDs-iPad installd[361] <Error>: 2ff66000 install_application: Could not preflight application install
Mon Dec 27 09:38:47 DVDs-iPad mobile_installation_proxy[364] <Error>: handle_install: Installation failed
Mon Dec 27 09:38:47 DVDs-iPad installd[361] <Error>: 2ff66000 handle_install: API failed
Mon Dec 27 09:38:47 DVDs-iPad installd[361] <Error>: 2ff66000 send_message: failed to send mach message of 71 bytes: 10000003
Mon Dec 27 09:38:47 DVDs-iPad installd[361] <Error>: 2ff66000 send_error: Could not send error response to client


the profile is for sure correct [ Means the profile contains the device UUID, Also you can tell from the device itself, Setting->general->profiles]
image

When you check the .app contents, the embeddedprofile is there too. that’s the same one you downloaded from dev protal.

So there are must be something wrong with the profile, what’s those potential dependency?

the answer is Certificate/Keys. I use a wrong keys/certificate to sign the application. ( that means the Cert to sigh the profile is different with the key in your keychain.)

So make sure 
>>>

the cert to create Profile is the same with your keychain. you can tell from their expiration date. otherwise, you get this annoying error.

Or just jailbreak you device, then you can install any app without have to follow the signature enforcement policy.

Tuesday, December 21, 2010

XCode, error: There is no SDK with the name or path 'iphoneos4.2'

When I try to compile one project , get the No SDK error. 
  image
Here, I don't have to use the latest SDK 4.2, Just click Project->Edit Project settings, Build tab,Chose the version I want to use.
image

Thursday, December 16, 2010

eclipse OUTOfMemoryError

Eclipse is one Great and Free JAVA IDE, the only problem is that it keep crashing compared with other commercial IDE. 
Since eclipse is one standard java applicaton, so out of memory problem could be caused by wrong settings. Here is one error I get recently

image

Click details, to get more information.

image

PermGen Space, PermGen is one special Heap area to keep classes , metadata, etc.
Run JvisualVM, Click and open the eclipse JVM.

image

Here the max space for Perm is 64M, we used 63.998M now. that’s the perm space problem.

How to fix that, just like other XX jvm parameters, put a more big size limitation for perm to the eclipse.ini which is located in the eclipse folder.

-XX:PermSize=64M
-XX:MaxPermSize=128M

profile the jvm again, the space get more quota now.

image

Wednesday, December 8, 2010

How to purge Squid /varnish stale/outdated pages programmatically

>>>For SQUID, you need to enable the Purge Request for IP and Send a Request to the Squid server using the PURGE http method.

squid.conf, enable Purge request from a given devices.

acl localnetwork 10.10.8.1/255.255.255.255.0
http_access allow PURGE localnetwork


you can use squidclient utility
squidclient -m Purge http://squidserver:2128/foo.html

Here is one C# code snippet.

string url = http://squidserver:3128/fooo.html;
//Squid IP: Port 
WebRequest req = HttpWebRequest.Create(url);
req.Method = "PURGE";
try
            {
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
if (resp.StatusCode == HttpStatusCode.OK)
                {
Console.WriteLine("PURGE Sucessful");
                }
else
                {
Console.WriteLine("PURGE Failed");
                }
            }
catch (WebException ex)
            {
Console.WriteLine("PURGE Failed" + ex.Message);
            }

>>> Varnish , two ways.
option 1, send the purge directive from the admin console. (when you start the varnishd, add one –T for the admin port, i,e 7777)  varnishd –a 0.0.0.0:8888 –T 0.0.0.0:7777 –f  youvcl.vcl

then telnet to the 7777 admin port, enter “purge req.url ~ foo.html” , this will put a switch mark for all url matching the expression foo.htm

also, this process can be implemented in the C# code.

string url = "fooo.html"; //URL regular expression
TcpClient t = new TcpClient();
t.Connect("varnishserver", 7777); //varnish admin port
NetworkStream ns = t.GetStream();
StreamReader sr = new StreamReader(ns);
System.Threading.ManualResetEvent mre = new ManualResetEvent(false);
new Thread(
                (object obj) =>
                {
while (true)
                    {
if (ns.DataAvailable)
                        {
Console.WriteLine(sr.ReadLine());
                        }
if (mre.WaitOne(TimeSpan.FromSeconds(3)) == true)
                        {
break;
                        }
                    }
                }
                ).Start();
StreamWriter sw = new StreamWriter(ns);
sw.Write("purge req.url ~ " + url + sw.NewLine);
sw.Flush();
ns.Flush();
mre.Set();

Option 2, put a logic in the recv VCL, intercept the PURGE method and call the purge method.

sub vcl_recv {
        if (req.request == "PURGE") {
                if (!client.ip ~ purge) {
                        error 405 "Not allowed.";
                }
                purge("req.url == " req.url );
                error 200 "Purged.";
        }
}


the code is the same like the squid options.

troubleshooting the driver disconnecting while associating, dot11 status code 0

One Day, My laptop can’t connect to any WIFI at company, but it works at home. the symptom is that the wifi keep connecting  but never be successful. Check the event log, get some error like

the driver disconnecting while associating, dot11 status code 0 

then I update the driver to the latest version, that’s a Intel nic, so installed the manual diagnostics toolkit as well. and run a basic test.  it failed on the association phase.

image

When I run “netsh wlan show all”, I could see all the AP and their SSid. so basic communication is fine.
then I realized that the AP just blocked my MAC.  reset the AP or change the MAC address of the NIC is the workout.

Can Macbook support 8G RAM, yes! at least for snow leopard

During the holiday shopping season, I couldn't resist the RAM deal  of getting one 2*4G DDR3 set for 90 bucks. then replace the original 2*2G set and power on, the Mac just works without any problem for a week now.

so the spec on apple.com is incorrect, it says it could support Max 4G ram. here is the spec in http://www.apple.com/macbook/specs.html

“2GB (two 1GB SO-DIMMs) of 1066MHz DDR3 SDRAM; two SO-DIMM slots support up to 4GB”

My hardware spec, the late-2008 version. And I wrote a simple java to reserve more RAM over 4G, it works

image

the spec,

Model Name:    MacBook
  Model Identifier:    MacBook5,1
  Processor Name:    Intel Core 2 Duo
  Processor Speed:    2.4 GHz
  Number Of Processors:    1
  Total Number Of Cores:    2
  L2 Cache:    3 MB
  Memory:    8 GB
  Bus Speed:    1.07 GHz
  Boot ROM Version:    MB51.007D.B03

 
Locations of visitors to this page