Blogs

Vari SDK per Smart Device

Per lo sviluppo di software per cellulari smartphone

Symbian Series 60 SDK da forum.nokia.com

Symbian UIQ SDK da developer.sonyericsson.com

Maemo SDK da maemo.org (Nokia N770, N800 tablet pc)

J2ME da java.sun.com

BlackBerry MDS Studio from RIM (BlackBerry)

DevRocket da Montavista

OpenMoko da OpenMoko (inoltre mokomakefile project, sdk per linux)

Google Android da code.google.com/android/

BlackBerry JDE (RIM Java Development Environment)

XMLHttpRequest, document element DOM parsing

uso di XMLHttpRequest, funziona solo se la url è nello stesso sito. checklogin.php restituisce <KO/> se il login è fallito <OK>XXX</OK> con XXX l'id utente quando il login è andato a buon fine
var loginOK = false;

var httpRequest;

function validateLogin()
{
 var login = document.getElementById("NomeForm");
 var logintxt = login.value;
 var password = document.getElementById("PasswdForm");
 var passwordtxt = password.value;
 var url = "/forum/checklogin.php?username="
 + logintxt + "&password=" + passwordtxt;

 if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    httpRequest = new XMLHttpRequest();
    if (httpRequest.overrideMimeType) {
       httpRequest.overrideMimeType('text/xml');
    }
 }
 else if (window.ActiveXObject) { // IE
    try {
       httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
       try {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
       }
       catch (e) {}
    }
 }

 if (!httpRequest) {
    alert('Giving up :( Cannot create an XMLHTTP instance');
    return false;
 }
 httpRequest.onreadystatechange = loadLogin;
 httpRequest.open('GET', url, true);
 httpRequest.send(null);
}

function loadLogin()
{
  if (httpRequest.readyState == 4) {
      if (httpRequest.status == 200) {
         response = httpRequest.responseText;
	 if (response == "") {
	   alert ('login/password errate.');
	 } else {
	   var responseXML = httpRequest.responseXML.documentElement;
	   user_id = responseXML.firstChild.nodeValue;
	   LinkSitoForm = document.getElementById('LinkSitoForm');
	   LinkSitoForm.setAttribute('value', 'http://forum.cellularmagazine.it/profile.php?mode=viewprofile&u=' + user_id);
	   NomeForm = document.getElementById('NomeForm');
	   PasswdForm = document.getElementById('PasswdForm');
	   PasswdForm.setAttribute('enabled','no');
	   var whchis = document.getElementById("trcheckpasswd");
	   whchis.innerHTML = "OK"
	 }
      } else {
         alert('There was a problem with the request.');
      }
   }
   else {
   }

}

Symbian DBMS .. cosa e' supportato?

Sto impazzendo con Symbian DBMS e le features SQL supportate ... cosa è supportato, cosa no? Per mia esperienza, ora:

SELECT C1 FROM T1 WHERE C2=0

Not supported: C2 must be in the set of column selected

SELECT C1, C2 FROM T1 WHERE C1=C2

Not supported: C1 = C2 clause is not accepted (!!!)

.... what kind of story are you telling me?

Supported Symbian SQL Subset .. and no, no update for Symbian OS 9.1 .

Simulare eventi dell'interfaccia

void CMyAppView::SignalImageStored()
{
       TKeyEvent aKeyEvent;
       TEventCode aType;
       aKeyEvent.iCode = EKeyMenu;
       aKeyEvent.iScanCode = EStdKeyMenu;
       aType = EEventKey;
       iCoeEnv->SimulateKeyEventL(aKeyEvent, aType);
}

iCoeEnv è un membro di CAknView , questo è utile per aprire il menu automaticamente, ad esempio dopo un ritardo di tempo

... e questo genera solo l'evento menu, e non l'altra eventuale azione associata al tasto quando il menu è visibile, così impostando un timer ed un active object in ascolto che chiama SignalImageStored non può causare l'evento select. Ci possono essere alcuni problemi se la vista in questione non è visibile .. bisognerebbe testare lo stato di activated di this view.

Parsing http header con la classe TLex

esempio di uso di TLex:
TLex8 lbuf=TLex8(aBuf);

check:
if (crF)
{
  if (lbuf.Peek()==Klf)
  {
    TUint hdridx=iHeadEnd + 1 + lbuf.Offset();
    if (iLastHdrIdx +1 == hdridx)
      iHdrClosed = ETrue;
    iLastHdrIdx = hdridx;
    iIdxs->Append(iLastHdrIdx);
    iHdrNr++;
  }
  lbuf.Inc();
  crF=EFalse;
}
while (lbuf.Offset() lbuf.Inc();

if (lbuf.Peek()==Kcr) crF=ETrue;
if (lbuf.Offset()==aSize)
  goto parsed;
goto check;
parsed:

Prende un intero http response buffer e parsa le linee di header http. iLastIdrIdx è trovato cercando la sequenza \r\n\r\n in aBuf. Questo codice parsa l'header e mette in iIdxs array gli indici degli header. LIT8(Kcr,"\r"); LIT8(Klf,"\n");

Syndicate content