Topics

Install curl 7.24 on CentOS 6.2

Install curl 7.24 on CentOS 6.2

– Make sure to check PHP-FPM post.

– install from source

yum remove curl curl-devel

wget http://curl.haxx.se/download/curl-7.24.0.tar.bz2
tar xfj curl-7.24.0.tar.bz2
cd curl-7.24.0
./configure --prefix=/usr
make
make install
#check version
curl -V

– To install with support

./configure --with-curl=/usr --with-curlwrappers

Configuring vsFTPd on CentOS with different port

Check Installing CentOS 6.2 on VMware post.

– make sure SELINUX is disabled and iptables is configured for FTP

– add ftp user

adduser ftpuser -g ftp -s /sbin/nologin -d /server
#set password
passwd ftpuser

– configuration, more info

disable root login

This will disable SSH login as root

sed -i '/^PermitRootLogin/s/yes/no/' /etc/ssh/sshd_config  && \
/etc/init.d/sshd restart

Server Load for android 2.1

Server load is open source widgets for android that retrieve your current server average load and display it on a widget on your android home screen, you can add more widgets for each server. The widget will update every 30 min to display your server’s current average load. Check the php example for extracting your servers’ current load.

Program test on Galaxy s2

Download
Source Code
GitHub

Get from Android Market

Firefox chrome function : Read/write file on disk

tested on Firefox 7.0.1

const Ci = Components.interfaces;  
const Cc = Components.classes;

function ReadWrite( data ){
    
        	try{
                            Components.utils.import("resource://gre/modules/NetUtil.jsm");
                            Components.utils.import("resource://gre/modules/FileUtils.jsm");

                            var file = FileUtils.getFile("ProfD", ["FileName.txt"]);
                            var ostream = FileUtils.openSafeFileOutputStream(file );
                            var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
                                                     createInstance(Ci.nsIScriptableUnicodeConverter);

                            if( data ){
                            
                                    if ( !file.exists() ){
                                            file.create( Ci.nsIFile.NORMAL_FILE_TYPE, 420);
                                    }
                                    converter.charset = "UTF-8";
                                    var istream = converter.convertToInputStream(data);
                                    NetUtil.asyncCopy(istream , ostream, function(status) {
                                                    if (!Components.isSuccessCode(status)) {
                                                            alert( "Error! :" + status );
                                                            return false;
                                                     }
                                    });
                                                                        
                           }else{
                                    var data = '';
                                    var fstream = Cc["@mozilla.org/network/file-input-stream;1"].
                                                  createInstance(Ci.nsIFileInputStream);
                                    var cstream = Cc["@mozilla.org/intl/converter-input-stream;1"].
                                                  createInstance(Ci.nsIConverterInputStream);
                                    fstream.init(file, -1, 0, 0);
                                    cstream.init(fstream, "UTF-8", 0, 0); // you can use another encoding here if you wish

                                    let (str = {}) {
                                          let read = 0;
                                          do { 
                                                read = cstream.readString(0xffffffff, str); // read as much as we can and put it in str.value
                                                data += str.value;
                                          } while (read != 0);
                                    }
                                    cstream.close(); // this closes fstream
                                    return data;

                               }

	}catch(e){
//                          alert( e);
                            return false;
	}
    }

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close