Amazon Elastic Block Storage (EBS)
We can use Amazon EBS just like as the CD/DVD/Pen Drives on our PC/Laptops Servers for backup or data transfer…
EBS can attach to an EC2 instance, we can use EBS to save work files in it.. for it we have to mount it in the instance after backup we can unmount it, and detach it.
We can use the volume afterward by mounting it in another instance but different instances at the same time can not use same EBS volume.
Starting an Instance
# ec2-describe-images -o self -o amazon | grep machine
# ec2-add-keypair gsg-keypair (save this keypair for connecting instance via SSH)
# chmod 600 id_rsa-gsg-keypair ; ls -l id_rsa-gsg-keypair
# ec2-run-instances ami-235fba4a -k gsg-keypair
# ec2-describe-instances i-ae0bf0c7
Authorize ports to connect remotely…
# ec2-authorize default -p 22
# ec2-authorize default -p 80
Connect to instance
# ssh -i id_rsa-gsg-keypair root@ec2-67-202-51-223.compute-1.amazonaws.com
Create the Volume
# ec2-create-volume –size 1 -z us-east-1c
Create this volume in same availability zone
# ec2-describe-volumes vol-4771e479
Attaching the Volume
# ec2-attach-volume vol-4771e479 -i i-ae0bf0c7 -d /dev/sda
Formatting the Volume
# ssh -i id_rsa-gsg-keypair root@ec2-67-202-51-223.compute-1.amazonaws.com
# ls /dev
# yes | mkfs -t ext3 /dev/sda
Mounting the Volume
# mkdir /mnt/phpsolutions-data
# mount /dev/sdh /mnt/phpsolutions-data
Put a file on the volume
# vi /mnt/phpsolutions-data/phpsolutions.txt (put content here)
Unmounting the Volume
# cd ~
# umount /mnt/phpsolutions-data
Detach the Volume
# ec2-detach-volume vol-4771e479 -i i-ae0bf0c7 -d /dev/sda
As we attach this volume to other instance we will get our phpsolutions-data folder to new instance…
phpsolutions will post some new articles on “Amazon Web Services” 😉 subscribe to phpsolutions feeds
Crontab Command Line
1. dump the content of the existing crontab to a file
# crontab > /tmp/dump
2. echo “your lines” >> to the corntab file
# echo ” 00 1 * * * /monitor_file_system 2>/dev/null” >> /tmp/dump
3. import the new crontab
# crontab /tmp/dump
other option….
# crontab -e
It will open a editor, add job here like
00 1 * * * /monitor_file_system 2>/dev/null
Set cronjob from other server:
# crontab -e
0 0 * * * curl http://www.domain.com/phpsolutions.php
here phpsolutions.php file is located on different server…
and save this crontab files…. now cronjob successfully installed 🙂
x264 is a free software library for encoding video streams into the H.264/MPEG-4 AVC format. It is released under the terms of the GNU General Public License.
x264 itself provides a command line interface as well as a library-level interface.
x264 is used to encode video files in mp4, m4v, h.264 (HD) output format.
Install x264 ------------ * Download the latest snapshot(tarball) here: # wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20090113-2245.tar.bz2 * Extract tarball # bzip2 -cd x264-snapshot-20090113-2245.tar.bz2 | tar xvf - # cd x264-snapshot-20090113-2245 * Build and install # ./configure # make # make install
Some problems with mplayer & x264
Install/compile mplayer with x264 support
-x264encopts is not an MEncoder option Checking for x264 ... no (in libavcodec: no) (./configure)
# svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
# cd /usr/local/src/mplayer
# svn update
# ./configure
After configure make sure you got
Checking for x264 ... yes (in libavcodec: yes)
# make && make install
Try latest version of video tools ffmpeg, mplayer, mencoder, flvtool2, mediainfo 🙂
Find correct path where you installed these components try …..
# locate command
“make sure you are using /usr/bin/mencode and NOT /usr/lib/bin/mencode”
🙂
This is the problem caused due to PHP safe_mode restrictions to execute linux commands.
If safe mode is on we can not run linux commands by exec() PHP function.
Try safe mode Off when you want to execute linux tools with PHP….
Disable dangerous function from executing to exec().. that will cause application non functional 🙁
# php mencoder.php
sh: /mencoder: No such file or directory # cat mencoder.php <?php exec("mencoder -ovc help"); ?>
# mencoder -ovc help
I was searching for filtering Bad Words from my site……
I have visited so many links on google but…. 🙁
Here is my simple logic for filtering Bad Words from site or any search engine
First you have to make a txt file “badwords.txt” or you can search from google
Google Keyword: badwords + filetype:txt
Copy “badwords.txt” to your site and use below code for removing these words from site…..
<?php
// here file_get_contents() used for getting $badwords as a string
$badwords = strtolower(file_get_contents(“badwords.txt”));
// here $q is string used for checking against badwords
$pos = strpos($badwords, strtolower($q));
if ($pos !== false)
{
if(strstr($badwords, strtolower($q)) || strchr($badwords, strtolower($q)))
die(‘Website has blocked unwanted contents…. please try for legal keywords!’);
}
?>
Enjoy with phpsolutions.co.in 🙂
* Multi language
* Content Management
~ WYSIWYG editor integrated into the shop admin to allow easy entering of HTML and uploading of images
~ Add text to your category pages – great for SEO and providing information
~ Content Management System – no more FTP and working with PHP files – amend text for information pages (homepage, delivery, about us etc) from the shop admin
~ Enable / Disable categories (and all contained products) at the click of one button
~ Take control of your product display and choose the sort order for each product
~ Select which products appear on your homepage with “showcase”
~ NEW! Reports for orders, sales, tax, products in HTML and CSV (Excel) format
~ NEW! Attribute Manager with Ajax & bulk management
* Marketing tools
~ Affiliate Scheme integrated into your shop, allowing you to offer commission on successful referrals
~ Discount Coupons & Gift Vouchers integrated into shop
~ Downloadable PDF Catalogue: create a PDF catalogue from your shop’s database
~ Professional Mail List Manager with HTML templates, subscribe/unsubscribe links and option to set up multiple mailing list. Customers can subscribe to the mail list with their name & email address (without the need to set up an account). Double opt in option (verify email).
~ NEW! Multiple product images (up to 4) with lightbox effect
~ NEW! Cross Sell module with Ajax & category bulk application
* Search-engine friendly
~ Ultimate SEO URLs: built in search-engine friendly URLs for best spider results
~ Dynamic Metatags: automatically create metatags from the product description
~ Site Map / All Products: two additional pages featuring your shop’s products
* Online payment facilities
~ Multi-currency support
~ VAT support
~ Pay Pal IPN, Nochex, Pay by cheque, Pay by bank transfer are included
~ Other payment modules are available on request (see add-on section)
* Delivery options
~ Charge shipping as flat rate, per item, per weight or per order total
~ Or base your Delivery charges on weight or price and the delivery country, inc. an “email for quote” message for defined countries
~ UK Royal Mail shipping module for 1st & 2nd Class Standard / Recorded, Special Delivery, Standard Parcels, Surface Mail, Parcel Force 48
😉
The User Agent Profile (UAProf) is used for capturing capability and preference information for wireless devices. This information can be used to detect various types of HTTP headers and other properties for visitor’s mobile device.
Apache provide some useful HTTP X Header information for WAP… which detect user-agent and other hardware/software information.
Source:
http://en.wikipedia.org/wiki/UAProf
http://code.google.com/p/mobiledevicedetector/
http://mobiforge.com/developing/blog/useful-x-headers
http://wapreview.com/?id=149
http://mobiforge.com/developing/story/device-detection-cloud-deviceatlas-personal
http://mobiforge.mobi/developing/story/mobile-sites-with-joomla-cms?dm_switcher=true
http://www.idelfuschini.it/it/apache-mobile-filter-v2x.html
http://www.dpinyc.com/literature/resources/code-bank/php-lightweight-device-detection/
http://logme.mobi/query/index.php
Pixlr is a free online photo editor. Fix, adjust and filter your images. Manage your images in your browser!
Get creative images with the free online photo editor and fix with the image express (crop, resize, rotate, flip etc)! Jump in and get going within 2 seconds!
Source:
http://www.pixlr.com/editor/
http://www.pixlr.com/express/
TCPDF supports TrueTypeUnicode (UTF-8 Unicode), OpenTypeUnicode, TrueType, OpenType, Type1, CID-0 and Core (standard) fonts.
You will find font creation utility at fonts/utils of TCPDF… copy desired font to fonts/utils/phpsolutions.ttf
* For TrueTypeUnicode
# cd /var/www/html/tcpdf/fonts/utils
# ttf2ufm -a -F phpsolutions.ttf
# php -q makefont.php phpsolutions.ttf phpsolutions.ufm
* For embedded fonts to tcpdf PDF file.. copy the resulting phpsolutions.php, phpsolutions.z and phpsolutions.ctg.z to fonts folder
Uses:
<?php
……..
$pdf->SetFont(‘phpsolutions’,’I’,8);
……….
?>
TAR – Tape Archive (application/x-tar)
A common archive format used on Unix-like systems. Generally used in conjunction with compressors such as gzip, bzip2, compress or xz to create .tar.gz, .tar.bz2, .tar.Z or tar.xz files.
# tar -cvvf foo.tar foo/ –exclude=”/home/phpsolutions”
# tar -cvzpP –file=/home/backup.tar.gz –exclude={/dev/*,/proc/*,/sys/*,/tmp/*} /
tar work with directory “/” except for /dev, /proc, /sys, /tmp 🙂