80048820 error in MSN on Vista

June 9th, 2009

Wow, this one really sucks, and I’ve spent ages trying to fix it - from changing MTU, re-registering DLL, reinstall MSN etc etc.

Anyway you will see some posts that hint that changing or correcting your PC’s time fixes the issues - well in my case I unchecked the “adjust for daylight savings” box in the time settings dialog and BAMM - now MSN is working ( though my PC time is off by an hour ) … way to go Microsoft …

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Google] [StumbleUpon]

Windows

Khaaaaan ….

April 12th, 2009

Khan

Keeps me on the straight and narrow during work ( need to get Shatner on the other wall )

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Google] [StumbleUpon]

Uncategorized

Filesize fight

March 3rd, 2009

Convert Java Float into C/C++ Float

February 12th, 2009

If you have a float stored using writeFloat use the following to read it back into C

float aFloat;
unsigned char *pBytes;
pBytes = (unsigned char * )&aFloat;
pBytes[3] = _buffer[_offset++];
pBytes[2] = _buffer[_offset++];
pBytes[1] = _buffer[_offset++];
pBytes[0] = _buffer[_offset++];
return aFloat;

Assume that _buffer is your byte array or pointer to an unsigned char *, and that _offset is the offset in your data.

To read an integer value:

int i = ((_buffer[_offset]<<24)|(_buffer[_offset+1]<<16)|(_buffer[_offset+2]<<8)|(_buffer[_offset+3]));
_offset+=4;
return i;

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Google] [StumbleUpon]

Uncategorized, XCode / C

Serve JAD files OTA with PHP

November 3rd, 2008

Some handy code to dynamtically serve JAD files for OTA installation. The below script sets the appropriate headers types, also tidies up the JAD file removing stray characters which can cause issues and setting the correct file paths internally.

Place the PH script in a root directory as serveJAD.php. Place your JAR and JAD files in a subdirectory /J2ME

Call the script by serveJAD.php?format=J2ME&file={jad minus extension} or you can use the Apache rewrite below and call as /J2ME/file.jad

ie

serveJAD.php?format=J2ME&file=game

or with Apache rewrite

/J2ME/game.jad

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?
	$format   = $_GET["format"];
	$file     = $_GET["file"].".jad";
    header("Cache-Control: no-cache, must-revalidate,no-transform" );
    header("Pragma: no-cache" );
	header("Content-type: text/vnd.sun.j2me.app-descriptor");
	header("Content-Disposition: attachment; filename=".$file.";");
	$jad = file_get_contents("./".$format."/".$file);
	$lines = explode("\n",$jad);
	$final = "";
	foreach($lines as $line){
		$line = trim($line);
		if(strlen($line)>0){
			$keypair = explode(": ",$line);
			if($keypair[0]=='MIDlet-Jar-URL' || stristr($keypair[0],"RIM-COD-URL")){
				$url = trim($keypair[1]);
				if(!stristr($url,"http:")){
					$keypair[1] = "http://".$_SERVER["HTTP_HOST"]."/$format/".$url;
				}
			}else if($keypair[0]=='MIDlet-Jar-Size'){
				$keypair[1] =  filesize("./".$format."/".$_GET["file"].".jar");
			}
 
			$line = join(": ",$keypair);
			$l = trim($line);
			if(!empty($final))$final.="\n";
			$final.=$l;
		}
	}
	print($final);
?>


RewriteEngine On
RewriteRule /J2ME/(.*)\.jad /serveJAD.php?format=J2ME&file=$1

You can also use this to build automatic index pages, using this as dir.php?format=J2ME

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
	$format   = $_GET["format"];
	$scanthis = "./".$format;
 	$scanlisting = scandir($scanthis);
    $dirlisting = array();
    foreach($scanlisting as $key => $value){
		if(stristr($value,"jad")){
			$name = explode(".",$value);
			$dirlisting[$name[0]] = $name[0];
		}
	}
	ksort($dirlisting);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="apps.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Application listing</title>
</head>
<body>
<p>
<?php foreach($dirlisting as $name){
?>
<a href="/<?php print($format);?>/<?php print($name);?>.jad"><?php print($name);?></a><br />
<?php
}
?></p>
</body>
</html>
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Google] [StumbleUpon]

J2ME, PHP, Uncategorized