Topics

Useful Linux commands

Useful Linux commands

Check Installing CentOS 6.2 on VMware post.

– getting full memory info

more /proc/meminfo

– display memory usage in MB

free -m

AnythingSlider for Worpress caption problem

The caption problem with AnythingSlider in WordPress is that it is already implemented in the plugin but not on the FX script or the CSS. All you need to do is adding this style to your post or page

.anythingBase li {
    position: relative;
}

.wp-caption-text{
    color:#fff;
    display: none;
    height: 70px;
    text-align: center; 
    background:#000;
    opacity:0.6;
    position: absolute;
    left: 0;
    top: 391px;
    width: 561px;
}
.activePage .wp-caption-text{
    display: block;
}

Installing CentOS 6.2 on VMware

This is a step by step tuturial for installing CentOS 6.2 64bit on VMware 7.0.1 build-227600 running on Windows 7

– downoad the iso DVD from CentOS.org ( need only CentOS-6.2-x86_64-bin-DVD1.iso for this installation )

http://isoredirect.centos.org/centos/6/isos/x86_64/

– Open VMware and follow the slide

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;
	}
    }