Archive for November, 2008

MySQL Stored Procedure: Hello World

Thursday, November 27th, 2008

If you always wanted to see Hello World in a MySQL stored procedure now is the time.

[code]
DROP PROCEDURE IF EXISTS sp_hello_world;
CREATE PROCEDURE sp_hello_world() SELECT 'Hello World';
[/code]

For some strange reason Wordpress removes my formatting after the image above.

Why software try to be smart ? :D

Javascript Troubleshooting: Cannot set the value in the html value with JavaScript

Tuesday, November 25th, 2008

Have you ever experienced a situation like this changing/updating a value of a simple hidden field and it doesn't get passed to the script ?

Everything looks simple because it is simple :)

[code]

 
[/code]

When you focus only on one small portion of the code it makes perfect sense and it works.

There is always a BUT :)

I would like to quote a very good friend of mine Julian Lishev (http://proscriptum.com/) who once said "Everything is/should be so logical and it cannot be any other way. "

I continued to dig deeper and realized that there was another element with the same ID in another form which was breaking my plan.

Take Care,

Slavi

How to change the maximum file upload size in PHP by editing php.ini

Friday, November 7th, 2008

By default php's maximum allowed file upload size 2MB.
In the php.ini file it is added as "2M".

In order to increase the default php's upload limit here are the needed changes.

Edit your php.ini file:

; Maximum allowed size for uploaded files.
upload_max_filesize = 50M

; Maximum size of POST data that PHP will accept.
post_max_size = 50M

Also it makes sense to increase the maximum execution time of the script because it'll need some time to upload a huge file.
I would recommend to add either of these lines into each script separately that is supposed to run a longer time.

set_time_limit(900); // 15 mins
or
ini_set(max_execution_time, 900); // 15 mins

Last, you may need to restart your web server.

Related

  • http://www.activecollab.com/forums/post/5476/
  • http://www.captain.at/howto-php-upload-max-size.php
  • http://davidwalsh.name/increase-php-file-upload-limit-using-php-ini
  • http://ca.php.net/set_time_limit
  • http://www.w3schools.com/PHP/php_file_upload.asp

How to install new or replace an existing certificate in Plesk or Obtaining and Installing SSL Certificates from Other Certification Authorities in Plesk

Wednesday, November 5th, 2008

Here is a quick an SSL certificate howto.

Feel free to share improvements :)

0. Go to Select domain Domains > domain.com  > Certificates > Add New Certificate
1. Generate CSR
2. Send it to Certificate Authority
3. When the certificate is ready => Upload the key OR paste it in the box (I assumed that you've followed the same path that you've used to generate the certificate request -> Step 0)
4. Go to Domains > domain.com > Setup
5. Select the certificate from the drop-down box after "Certificate"
6. Click OK

------ This is from the help section of Plesk -----
Obtaining and Installing SSL Certificates from Other Certification Authorities

To secure a site with an SSL certificate from other certificate authorities:

1. Click the Domains shortcut in the navigation pane.
2. Click the required domain name in the list.
3. Click Certificates in the Services group. A list of SSL certificates that you have in your repository will be displayed.
4. Click Add New Certificate.
5. Specify the certificate properties:
* Certificate name. This will help you identify this certificate in the repository.
* Encryption level. Choose the encryption level of your SSL certificate. We recommend that you choose a value more than 1024 bit.
* Specify your location and organization name. The values you enter should not exceed the length of 64 symbols.
* Specify the domain name for which you wish to purchase an SSL certificate. This should be a fully qualified domain name. Example: www.your-domain.com.
* Enter the domain administrator's e-mail address.
6. Make sure that all the provided information is correct and accurate, as it will be used to generate your private key.
7. Click Request. Your private key and certificate signing request will be generated and stored in the repository.
8. In the list of certificates, click the name of the certificate you need. A page showing the certificate properties opens.
9. Locate the CSR section on the page, and copy the text that starts with the line -----BEGIN CERTIFICATE REQUEST----- and ends with the line -----END CERTIFICATE REQUEST----- to the clipboard.
10. Visit the Web site of the certification authority from which you want to purchase an SSL certificate, and follow the links on their site to start a certificate ordering procedure. When you are prompted to specify CSR text, paste the data from the clipboard into the online form and click Continue. The certification authority will create an SSL certificate in accordance with the information you supplied.
11. When you receive your SSL certificate, save it on your local machine or network.
12. Return to the SSL Certificates repository (Domains > domain name > Certificates).
13. Click Browse in the middle of the page and navigate to the location of the saved certificate. Select it, and then click Send File. This will upload and install the certificate against the corresponding private key.
14. Return to the domain's administration screen (Domains > domain name) and click Setup in the Hosting group.
15. Select the SSL certificate that you wish to install from the Certificate drop-down box.

If there is no Certificate drop-down box on the screen, this means that you are on a shared hosting account; therefore, you need to upgrade your hosting package and purchase a dedicated IP address from your provider.
16. Select the SSL support check box and click OK.

How to mount a shared folder read/write permissions

Saturday, November 1st, 2008

Once I need to mount a Windows share on my Ubuntu Server.

By default the folder was mounted as readonly but I fixed that by supplying dmask=777,fmask

Here is the command I used.

[code]

mount -t smbfs -o username=guest,password=,dmask=777,fmask=777 //192.168.0.10/myshare /mnt/existing_folder/

[/code]

If you have any ideas or if I can add something and/or improve this article do leave a comment.

Thanks.

Slavi