Archive for the ‘~Tips~’ Category
Top BookMarking Sites
Save your important links online with top bookmarking sites……
1 | twitter
2 | digg.com
3 | Yahoo! Buzz
4 | tweetmeme.com
5 | StumbleUpon.com
6 | reddit.com
7 | Technorati.com
8 | del.icio.us
9 | kaboodle.com
10 | mixx.com
11 | Propeller.com
12 | newsvine.com
13 | Fark.com
14 | Slashdot.org
15 | twine.com
16 | clipmarks.com
17 | dzone.com
18 | faves.com
19 | blinklist.com
20 | diigo.com
Wildcard DNS – subdomain profile
A wildcard DNS record is a record in a DNS zone that will match requests for non-existent domain names. A wildcard DNS record is specified by “*” as the left most label of a domain name, e.g. *.example.com.
DNS zone Entry
| example.com. 86400 | IN | SOA | example.com. hostmaster.example.com. |
| IN | NS | ns1.example.com. | |
| IN | NS | ns2.example.com. | |
| IN | MX | 10 mail.example.com. | |
| IN | A | 192.168.1.1 | |
| A | 192.168.1.1 | ||
| ns1 | A | 192.168.1.1 | |
| ns2 | A | 10.0.0.2 | |
| *.example.com. | A | 192.168.1.1 |
.htaccess file:
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.example\.com
RewriteRule ^$ profile.php?uid=%1
</IfModule>
Now if you want sandeepverma.example.com it will redirect to profile.php with uid=sandeepverma
Find Apache Document Root
solution: Find Apache Document Root
# grep -i 'DocumentRoot' httpd.conf
# find / -name httpd.conf
or
# locate httpd.conf
(if file here /etc/httpd/conf/httpd.conf)
# grep -i 'DocumentRoot' /etc/httpd/conf/httpd.conf
solution: ffmpeg, libogg, libvorbis, freetype, gcc, faad2, faac
These are the basic tools/libs for video encoding:
sudo yum -y install \
SDL* glew glew-devel libmad-devel tre tre-devel \
libogg libogg-devel libvorbis libvorbis-devel \
boost boost-devel bzip2-devel bzip2-libs fribidi* \
lzo lzo-devel mysql-libs mysql-devel jasper jasper-devel \
faac faac-devel enca enca-devel hal hal-devel hal-libs \
cmake gperf nasm libXmu-devel fontconfig-devel \
freetype-devel libXinerama-devel pcre-devel gcc-c++ \
sqlite-devel curl-devel libsamplerate-devel libcdio-devel \
pulseaudio-libs-devel avahi-devel ffmpeg-devel libmad-devel \
a52dec-devel libdca faad2-devel libmpeg2-devel libass-devel \
libvorbis-devel libogg-devel libmpcdec-devel flac-devel \
wavpack-devel python-devel subversion
Install Fonts in Fedora
- Log in as root or use su at command line
$ su - Go to the font storage directory:
# cd /usr/share/fonts - Create a subdirectory for the Arial fonts:
# mkdir arial - Copy the Arial fonts into this directory from font sites or windows FONTS folder.
- Make the font files accessible systemwide:
# chmod 0775 -R arial - Run fc-cache to cache the arial fonts on system:
# fc-cache arial
http://www.myvirtualdisplay.com/2009/06/28/installing-fonts-in-fedora/
Install the Alternative PHP Cache (APC)
The Alternative PHP Cache (APC) is a free, open, and robust framework for caching and optimizing PHP intermediate code.
yum install php-pear
yum install php-devel httpd-devel
yum groupinstall ‘Development Tools’
yum groupinstall ‘Development Libraries’
pecl install apc
http://si2.php.net/manual/en/install.pecl.php
Regular Expressions (REX)
‘|<title>([^<]*?)</title>|is’
‘#<body[^>]*>(.*)</body>#siU’
‘#(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$#i’
‘#\.swf$#i’
‘/xcf|odg|gif|jpg|png|bmp/i’
‘/{([A-Za-z\-_]+)}/’
‘/<a[^>]+href=”([^"]*)”[^>]*>([^<]*)<\/a>/ui’
‘/; (120×160|240×280|240×320|320×320)\)/’
‘/opera/i’
‘/<category>(.+?)<\/category>/is’
“#href=\”(.*?)\”#s”
‘|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i’
“/youtube\.com\/watch/i”
“/username=\”([^\"]+)\”/i”
‘/^[a-zA-Z0-9]+$/’
“‘<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"']?\d+;[\s]+URL[\s]*=[\s]*([^\"\']*?)[\"\']?>’i”
“‘<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))’Usi”
‘/(\b)GLOBALS|_REQUEST|_SERVER|_ENV|_COOKIE|_GET|_POST|_FILES|_SESSION(\b)/i’
‘/<input type\=”hidden” name\=”([^"]+)”.*?value\=”([^"]*)”[^>]*>/si’
‘#[?&](p|page_id|attachment_id)=(\d+)#’
‘/<!–more(.*?)?–>/’
XML – SVG
Why XML?
*XML is a standardized format
* Can be read and written by most languages
* XML is human-readable (if written well)
* XML is flexible
* Can be altered with style sheets
* Transformations between different types of XML
* e.g. HTML table to chart
* Supports records, lists, and trees
* Plain text; platform independent
Why XML … Not
* Verbose and redundant
* Can be difficult to read
* Inefficient to parse, store, and transmit
* Parsers must deal with arbitrary levels of nesting and errors
* No concept of data types
* Hierarchical not relational
SVG: Scalable Vector Graphics
#A vector-based graphics format in XML
#Graphics consist of lines, shapes, colors (not pixels)
#Can be viewed by most modern browsers
#XML format, like HTML
#Can use JavaScript for animation / interactivity
#CSS for style
SVG Example
SVG example <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red"/> <circle cx="200" cy="50" r="40" stroke="black" stroke-width="2" fill="green"/> <circle cx="300" cy="50" r="40" stroke="black" stroke-width="2" fill="yellow"/> </svg>
PHP vs. Java/JSP
Java is…
* Strictly object oriented
* Strongly typed
* More clearly structured
* More complex
* JSP requires special server (Tomcat)
PHP is…
*Procedural (like C), with some objects
* Weakly typed, generally more flexible
* Generally faster to develop in
* Available on most web servers
* Easier to make messy code
* No namespaces
* Vague function definitions
Leave a Comment
Leave a Comment
Leave a Comment
