0

Couldn't open outlook Windows

My boss asked me, why his outlook couldn't be started and keep giving the error message "Couldn't open outlook Windows". Luckily I found the solution on google.
  1. Just open the start menu dan type outlook /resetnavpane on the run command text box.
  2. If you could'nt find the run command text box, just simply press the Windows button and R button simultaneously.
Now he can start the outlook dan running faster than ever.
1

Lighttpd PHP File Upload - Error 413 request entity is too large

I'm having problem with PHP File upload running on lighttpd web server deployed on my VortexSX86. Lighttpd keep giving me the 413 error message ( 413 request entity is tool large)

Open /etc/lighttd/lighttpd.conf change the following parameters :
server.max-request-size=100000000     # or whatever you want max file size to be
server.upload-dirs=( "/mnt" ) # location to place the uploaded file
# probably should be the same as php.ini
server.network-backend="write" # this one was the key one for me

if the value of "write" doesn't work, try "writev".

server.network-backend="write" or server.network-backend="writev"
Make sure the upload directory is exist and writable.
Done.
0

GWT Property Grid Readonly

In my case I want to set the property grid to read only mode.
How I can do that?

  1. Readonly. Can't copy.

    Just add the editor event listener of the property panel, and on doBeforeEdit, set to always return false;
    LTCInfoGrid.addEditorGridListener(new EditorGridListenerAdapter(){
    @Override
    public boolean doBeforeEdit(GridPanel grid, Record record, String field, Object value, int rowIndex, int colIndex) {
    return super.doBeforeEdit(grid, record, field, value, rowIndex, colIndex);
    }
    )};

  2. Read only. Can copy & modified but reset the changes.

    Add the listener to editor listener, on doValidateEdit, set to always return false

    LTCInfoGrid.addEditorGridListener(new EditorGridListenerAdapter(){

    @Override
    public boolean doValidateEdit(GridPanel grid, Record record, String field, Object value, Object originalValue, int rowIndex, int colIndex) {
    return false;
    }
    });
0

SSH login without password

Source : http://linuxproblem.org/art_9.html
Note : Aku dah try. Jalan.

Your aim

You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script.

How to do it

First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:

a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A

Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):

a@A:~> ssh b@B mkdir -p .ssh

b@B's password:

Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time:

a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password:

From now on you can log into B as b from A as a without password:

a@A:~> ssh b@B hostname
B
A note from one of our readers: Depending on your version of SSH you might also have to do the following changes:

* Put the public key in .ssh/authorized_keys2
* Change the permissions of .ssh to 700
* Change the permissions of .ssh/authorized_keys2 to 640
0

Web Auto Update (Linux + PHP)

In my project, the controller will be place at the remote site (like sabah & sawarak) and having sluggish internet connection. I need the controller to automatic update the firmware during the transfer.

How to do it?
  1. download the update script.

    wget http://192.168.0.8/ipvision-client/tools/autoupdate.php?id=IPV0001 -O autoupdate.sh

  2. Change the script file permission to allow execute.
    /bin/chmod 777 autoupdate.sh

  3. Execute the script

    bin/sh /tmp/autoupdate.sh

  4. update the status, so this operation not reoccur.

    wget http://192.168.0.8/ipvision-client/tools/autoupdate.php?id=IPV0001&action=done

  5. put the script on cron job.

0

Fileupload firmware update (linux + php)

I would like to perform the firmware update over file upload in my current project.
In my case I'm using Linux + PHP running on my vortex86SX controller.

How to do it ??

  1. Just pack all the updated files together and create a installation script (shell script) called installupdate.sh.
  2. Since shell script created is created on Windows, Linux is having problem to execute the script since it don't understand the additional trail ("\r") for new line. I use this command to remove the "\r" character.

    /bin/cat /tmp/installupdate/installupdate.sh | /bin/tr -d "\r" > /tmp/installupdate
  3. change permission of installation script to enable execute.
  4. run the installation script
  5. remove all the temporary files
Full code :
function installupdate(){
$uploadfile = '/tmp/installupdate.zip';
//phpinfo();
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $uploadfile)) {
$cmd='/bin/mkdir /tmp/installupdate
/bin/unzip -o /tmp/installupdate.zip -d /tmp/installupdate
cd /tmp/installupdate/
/bin/cat /tmp/installupdate/installupdate.sh | /bin/tr -d "\r" > /tmp/installupdate/installupdate.sh
/bin/chmod 777 /tmp/installupdate/installupdate.sh
/bin/sh /tmp/installupdate/installupdate.sh
/bin/rm /tmp/installupdate.zip
/bin/rm /tmp/installupdate -r
'
;
echo "File is valid, and was successfully uploaded.\n";
system("$cmd");
} else {
echo "Possible file upload attack!\n";
}
}
0

GWT-Ext & PHP , Glassfish & Apache

Berikut cara macam mana nak guna GWT-Ext dalam Galssfish dan data dalam Apache-PHP.

1. Install Quercus. Ni carik post aku sebelum ni.
2. Create gateway script dalam glassfish (php-Quercus). Nama fail sebaiknya sama dengan nama fail dalam apache (php).

Fail scriptnya adalah seperti di bawah. Support untuk GET, POST & SESSION.


// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://localhost/adapt-gwt/index.php");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_VERBOSE, true);

curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);

// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>
 
Copyright © peyotest