Monday, December 19, 2011

Titanium Table creation with click event


http://developer.appcelerator.com/question/122206/double-click-textfield-in-tableview-to-fire-click-event
win = Titanium.UI.createWindow({
    backgroundColor:'white',
    fullscreen:false
});
 
tableView = Titanium.UI.createTableView();
 
var dataArray = [];
for(var i=0; i<10; i++){
    var row = Titanium.UI.createTableViewRow();
 
    var label = Titanium.UI.createLabel({
        text:'THIS IS LABEL  ' + i,
        width:100,
        height:'auto'
    });
    var textBox = Titanium.UI.createTextField({
        right:5,
        width:30
    })
 
    row.add(label);
    row.add(textBox);
 
    dataArray.push(row);
}
 
var lastRow;
tableView.addEventListener('click', function(e){
    lastRow = e.row;
    if(lastRow){
        lastRow.backgroundColor='white';
    }
    e.row.backgroundColor='red';
})
 
 
tableView.setData(dataArray);
 
win.add(tableView);
win.open();

titanium Tableview Supported Links

http://developer.appcelerator.com/question/118419/how-to-get-rowdata-from-custom-tableviewrow

alert(e.row.children[0].text);


var thisRow = Ti.UI.createTableViewRow({
        className:"itemOptions",
        layout:"vertical",
        height:50,
        myProperty1:'somevalue',
        myProperty2:1234
        });

table.addEventListener('click', function(e) {
  alert(e.rowData.myProperty1);
});

http://developer.appcelerator.com/question/96441/passing-row-data-to-new-widow


Saturday, December 17, 2011

Titanium Appcelerator Web services method like AJAX

https://wiki.appcelerator.org/display/guides/HTTPClient+and+the+Request+Lifecycle


GET

var url = "https://www.appcelerator.com" ;
var xhr = Ti.Network.createHTTPClient({
    onload: function(e) {
        // this function is called when data is returned from the server and available for use
        // this.responseText holds the raw text return of the message (used for text/JSON)
        // this.responseXML holds any returned XML (including SOAP)
        // this.responseData holds any returned binary data
        Ti.API.debug(this.responseText);
        alert('success');
    },
    onerror: function(e) {
        // this function is called when an error occurs, including a timeout
        Ti.API.debug(e.error);
        alert('error');
    },
    timeout:5000  /* in milliseconds */
});
xhr.open("GET", url);
xhr.send();  // request is actually sent with this statement




POST


var xhr = Ti.Network.createHTTPClient();

xhr.onload = function(e) {
    //handle response, which at minimum will be an HTTP status code
};

xhr.open('POST','http://www.myblog.com/post.php' );
xhr.send({
    title:'My awesome blog',
    body:'Today I met Susy at the laundromat.  Best day EVAR\!'
});




Ready State Monitoring


var xhr = Ti.Network.createHTTPClient({
    onload: function(e) {
        // function called in readyState DONE (4)
        Ti.API.info('onload called, readyState = '+this.readyState);
    },
    onerror: function(e) {
        // function called in readyState DONE (4)
        Ti.API.info('onerror called, readyState = '+this.readyState);
    },
    ondatastream: function(e) {
        // function called as data is downloaded
        Ti.API.info('ondatastream called, readyState = '+this.readyState);
    },
    onsendstream: function(e) {
        // function called as data is uploaded
        Ti.API.info('onsendstream called, readyState = '+this.readyState);
    },
    onreadystatechange: function(e) {
        switch(this.readyState) {
            case 0:
                // after HTTPClient declared, prior to open()
                // though Ti won't actually report on this readyState
                Ti.API.info('case 0, readyState = '+this.readyState);
            break;
            case 1:
                // open() has been called, now is the time to set headers
                Ti.API.info('case 1, readyState = '+this.readyState);
            break;
            case 2:
                // headers received, xhr.status should be available now
                Ti.API.info('case 2, readyState = '+this.readyState);
            break;
            case 3:
                // data is being received, onsendstream/ondatastream being called now
                Ti.API.info('case 3, readyState = '+this.readyState);
            break;
            case 4:
                // done, onload or onerror should be called now
                Ti.API.info('case 4, readyState = '+this.readyState);
            break;
        }
    },
    timeout:5000  /* in milliseconds */
});
xhr.open("GET", 'http://training.appcelerator.com.s3.amazonaws.com/atp_doc.pdf');
xhr.send();  // request is actually sent with this statement



Titanium Appcelerator Remember me

http://developer.appcelerator.com/question/117952/remember-me--session-implementation


Ti.App.Properties.setString('login_name','kamal');
my_property_value = Ti.App.Properties.getString('login_name');

If it's never been set before it will naturally return undefined.
You can also set booleans, integers, lists and doubles. See : http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.App.Properties-module
hope this helps! ;)
As commented, hopefully your app is posting the login to the server securely. If you don't have https, there are some cunning ways to use MD5 to create a 'challenge and response' pair of hashes on login (etc.) which is pretty secure.




Friday, December 9, 2011

Drupal set different theme for admin only

Go to Administer > Site configuration > Administration theme.

Tuesday, December 6, 2011

Drupal 6 Installation Error Solved

Warning: ini_set() has been disabled for security reasons


Try some of these:
Open .htaccess file in your Drupal install. Near the top, put a '#' before 'Options +FollowSymLinks' (# Options +FollowSymLinks).
Create a text/notepad file called 'php.ini' and put inside it 'register_globals = 0'. Put this file straight in public_html (main/root directory)


http://drupal.org/node/842316

fopen and modifying header errors

when I was having problems I had simply renamed default.settings.php. So I went back and copied that file and renamed it so I had default.settings.php and settings.php and it worked

http://drupal.org/node/284063


Friday, December 2, 2011

Check Too many connection issues for MYSQL

-- This command will return you the value of max_connections variable
SHOW VARIABLES LIKE '%max_connections%';

-- This command will show you all processes and connections.
SHOW FULL PROCESSLIST;


http://www.microshell.com/database/mysql/mysql-too-many-connection-errors/

http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html

http://dev.mysql.com/doc/refman/5.5/en/show-processlist.html



Thursday, December 1, 2011

Fb Like Button

<div dir="ltr" style="text-align: left;" trbidi="on">

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1">
</script>

<div style="float: right; padding-right: 80px; padding-top: 125px; text-align: center; width: 100px;">
<div id="fb-root">
</div>
<fb:like font="" href="http://www.facebook.com/pages/Suba-Muhurtham-Matrimony/254980637898369" layout="button_count" send="false" show_faces="false" width="200"></fb:like></div>

</div>