<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tech Site &amp; Blog</title>
	<atom:link href="http://techsiteblog.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://techsiteblog.com</link>
	<description></description>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<item>
		<title>ext2 and ext3 on Windows</title>
		<link>http://techsiteblog.com/ext2-and-ext3-on-windows/</link>
		<comments>http://techsiteblog.com/ext2-and-ext3-on-windows/#comments</comments>
		<pubDate>Thu, 11 Mar 10 18:55:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[windows]]></category><category><![CDATA[file system]]></category><category><![CDATA[ext2]]></category><category><![CDATA[ext3]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/ext2-and-ext3-on-windows/</guid>
		<description><![CDATA[If you are using dual boot with Windows and Linux you've probably faced with a problem of accessing ext3 partitions from Windows OS.

Most of the Linux distributions come with NTFS-3G driver, which allow reading &amp; writing to NTFS partiton. Sadly, Windows doesn't offer such filesystem driver fo [...]]]></description>
			<content:encoded><![CDATA[If you are using dual boot with Windows and Linux you've probably faced with a problem of accessing ext3 partitions from Windows OS.<br />
<br />
Most of the Linux distributions come with NTFS-3G driver, which allow reading &amp; writing to NTFS partiton. Sadly, Windows doesn't offer such filesystem driver for file systems other than FAT16/32 and NTFS.<br />
<br />
However, you can use the 3rd party driver such as Ext2 IFS, which allows OS Windows to access such partitions from any program including Windows Explorer.<br />
<br />
<strong>Ext2 IFS</strong><br />
Ext2 IFS is a freeware program that provides Windows NT4.0/2000/XP/2003/Vista/2008 with full access to ext2/ext3 partitions.<br />
<br />
Info: <a href="http://www.fs-driver.org/" target="_blank">http://www.fs-driver.org/</a><br />
Download: <a href="http://www.fs-driver.org/download.html" target="_blank">http://www.fs-driver.org/download.html</a><br />
<br />
I've no problems with accessing partitions with inode size of 128 bytes. However, this program does not support partitions with bigger inode size, which can be a problem in some cases.<br />
<br />
<br />
<strong>Ext2Fsd</strong><br />
If you have a partition with inode size of 256 bytes, you can use this file system driver, which supports Windows NT/2K/XP/VISTA, X86/AMD64.<br />
<br />
Info: <a href="http://www.ext2fsd.com/" target="_blank">http://www.ext2fsd.com/</a><br />
Download: <a href="http://sourceforge.net/projects/ext2fsd/files/" target="_blank">http://sourceforge.net/projects/ext2fsd/files/</a><br />
<br />
Just a word of caution: It is not a good idea to have multiple file system drivers (for the same file system) installed at the same time. Try one and if you have a problem with it, delete it, restart operating system and install another one.<br />
<br />
Web sites of both drivers claim that they are not supported by Windows 7. In my case everything worked well on Windows 7 32 bit and 64 bit.]]></content:encoded>
		<slash:comments>0</slash:comments>
	</item>
		<item>
		<title>MS SQL Add User</title>
		<link>http://techsiteblog.com/ms-sql-add-user/</link>
		<comments>http://techsiteblog.com/ms-sql-add-user/#comments</comments>
		<pubDate>Sun, 21 Feb 10 16:55:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[ms sql]]></category><category><![CDATA[microsoft]]></category><category><![CDATA[sql]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/ms-sql-add-user/</guid>
		<description><![CDATA[

1. Connect to MS SQL server using MS SQL Management Studio.

2. Click on the \&quot;New query\&quot; button in the toolbar on left.

3. Create a database
Type following query and execute it:

Example:


3. Create login

Example:


4. Create user
use DATABASE_NAME
create user USE [...]]]></description>
			<content:encoded><![CDATA[<strong>The simplest way to add user to MySQL and grant privileges for specific database.</strong><br />
<br />
1. Connect to MS SQL server using MS SQL Management Studio.<br />
<br />
2. Click on the "New query" button in the toolbar on left.<br />
<br />
3. Create a database<br />
Type following query and execute it:<br />
<blockquote>create database DATABASE_NAME</blockquote><br />
Example:<br />
<blockquote>create database MyCMS</blockquote><br />
<br />
3. Create login<br />
<blockquote>create login LOGINNAME with password='PASSWORD'</blockquote><br />
Example:<br />
<blockquote>create login MyCMSUser with password='abc123'</blockquote><br />
<br />
4. Create user<br />
<blockquote>use DATABASE_NAME<br />
create user USERNAME for login LOGINNAME</blockquote><br />
Example:<br />
<blockquote>use MyCMS<br />
create user MyCMSUser for login MyCMSUser</blockquote><br />
<br />
5. Grant control of the database to the created user<br />
<blockquote>use DATABASE_NAME<br />
grant control to USERNAME</blockquote><br />
Example:<br />
<blockquote>use MyCMS<br />
grant control to MyCMSUser</blockquote><br />
<br />
Executing example queries would create user MyCMSUser with password abcd123 with all privileges on database MyCMS.<br />
<br />
Queries have to be executed from the first to the last.<br />
<br />
If you want to find out how to create a user with MySQL read following post: <a href="http://techsiteblog.com/mysql-add-user/" target="_blank">MySQL Add User</a>]]></content:encoded>
		<slash:comments>0</slash:comments>
	</item>
		<item>
		<title>ffmpeg and x264</title>
		<link>http://techsiteblog.com/ffmpeg-and-x264/</link>
		<comments>http://techsiteblog.com/ffmpeg-and-x264/#comments</comments>
		<pubDate>Sun, 06 Dec 09 17:39:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Debian]]></category><category><![CDATA[Linux]]></category><category><![CDATA[ffmpeg]]></category><category><![CDATA[x264]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/ffmpeg-and-x264/</guid>
		<description><![CDATA[How to install ffmpeg with x264 codec support on Debian Lenny (5.0)?

 By using x264 codec rather than a FLV video format you will gain on video and audio quality.

1. We need to remove any previous ffmpeg installations.

2. Add additional repository to /etc/apt/sources.list

Open file with  [...]]]></description>
			<content:encoded><![CDATA[How to install ffmpeg with x264 codec support on Debian Lenny (5.0)?<br />
<br />
<strong>Why is this useful?</strong> By using x264 codec rather than a FLV video format you will gain on video and audio quality.<br />
<br />
1. We need to remove any previous ffmpeg installations.<br />
<br />
2. Add additional repository to /etc/apt/sources.list<br />
<br />
Open file with nano editor:<br />
<blockquote>nano /etc/apt/sources.list</blockquote><br />
and add following line on the end of the file:<br />
<blockquote>deb http://www.debian-multimedia.org stable main</blockquote><br />
3. Install needed libraries:<br />
<br />
apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libx11-dev libxfixes-dev libxvidcore4-dev zlib1g-dev libogg-dev<br />
<br />
4. Install x264<br />
<blockquote>git clone git://git.videolan.org/x264.git<br />
cd x264<br />
./configure<br />
make<br />
sudo checkinstall --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`" --backup=no --default</blockquote><br />
5. Install libtheora<br />
<blockquote>wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz<br />
tar xzvf libtheora-1.1.1.tar.gz<br />
cd libtheora-1.1.1<br />
./configure<br />
make<br />
sudo checkinstall --pkgname=libtheora --pkgversion "1.1.1" --backup=no --default</blockquote><br />
6. Install ffmpeg<br />
<blockquote>svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg<br />
cd ffmpeg<br />
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-x11grab<br />
make<br />
sudo checkinstall --pkgname=ffmpeg --pkgversion "4:0.5+svn`date +%Y%m%d`" --backup=no --default</blockquote><br />
7. Install qt-faststart<br />
<br />
Normal mp4 file needs to be fully downloaded before it can be played by Flash Player. qt-faststart fixes this.<br />
<br />
Type following command from ffmpeg source directory:<br />
<blockquote>make tools/qt-faststart</blockquote><br />
Example:<br />
<blockquote>ffmpeg -i input.mov -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 output.mp4<br />
./tools/qt-faststart output.mp4 output2.mp4</blockquote><br />
Now you can play output2.mp4 by any Flash player. LongTail's freeware <a href="http://www.longtailvideo.com/" target="_blank">JW Player</a> is quite good, has many options and can play both mp4 and flv.<br />
<br />
Now you can use ffmpeg to compress videos with x264 codec. <a href="http://techsiteblog.com/convert-video-to-flv-with-php/" target="_blank">Read more about converting video with PHP</a><br />
<br />
Warning: Latest ffmpeg version has some problems with FLV format and it's impossible to convert video to .flv with it! If you need flv support try installing older version of ffmpeg (if you install it by apt-get install ffmpeg you will be able to convert to FLV but there is no x264 support).<br />
<br />
Source: <a href="http://ubuntuforums.org/showthread.php?t=786095" target="_blank">http://ubuntuforums.org/showthread.php?t=786095</a>]]></content:encoded>
		<slash:comments>2</slash:comments>
	</item>
		<item>
		<title>Use MySQL database in your C++ projects</title>
		<link>http://techsiteblog.com/use-mysql-database-in-your-c-projects/</link>
		<comments>http://techsiteblog.com/use-mysql-database-in-your-c-projects/#comments</comments>
		<pubDate>Sat, 28 Nov 09 21:01:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux]]></category><category><![CDATA[MySQL]]></category><category><![CDATA[C++]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/use-mysql-database-in-your-c-projects/</guid>
		<description><![CDATA[How to use MySQL DB in your C++ projects. This tutorial is written for Debian Lenny/Ubuntu 9.10. With a few minor changes, it should work on other distributions also.

What will you need?

- gcc &lt;-- c++ compiler

- MySQL server 5.0 installed

- MySQL C API

To install above programs run [...]]]></description>
			<content:encoded><![CDATA[How to use MySQL DB in your C++ projects. This tutorial is written for Debian Lenny/Ubuntu 9.10. With a few minor changes, it should work on other distributions also.<br />
<br />
What will you need?<br />
<br />
- gcc &lt;-- c++ compiler<br />
<br />
- MySQL server 5.0 installed<br />
<br />
- MySQL C API<br />
<br />
To install above programs run this command as root:<br />
<blockquote>apt-get install build-essential mysql-server mysql-client libsoci-mysql-gcc</blockquote><br />
When you have everything installed you need to create database and add user (<a href="http://techsiteblog.com/mysql-add-user/" target="_blank">MySQL Add User</a>).<br />
<br />
Now you will need to add a new table. The easiest approach is to use <a href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a>.<br />
<br />
Simple program to test MySQL C API (copy it and save as filename.cpp):<br />
<blockquote>#include &lt;iostream&gt;<br />
#include &lt;mysql.h&gt;<br />
<br />
using namespace std;<br />
<br />
//MySQL variables<br />
MYSQL *connection, mysql;<br />
MYSQL_RES *result;<br />
MYSQL_ROW row;<br />
int query_state;<br />
<br />
int main() {<br />
//Connects to MySQL DB<br />
mysql_init(&amp;mysql);<br />
<br />
connection = mysql_real_connect(&amp;mysql, "localhost", "username", "password", "database", 0, 0, 0);<br />
<br />
//Checks if there was a problem with connection<br />
if(connection == NULL) {<br />
cout &lt;&lt;mysql_error(&amp;mysql);<br />
return 1;<br />
}<br />
<br />
//Execute query<br />
query_state = mysql_query(connection, "SELECT * FROM table");<br />
<br />
if(query_state != 0) {<br />
cout &lt;&lt; mysql_error(connection);<br />
}<br />
<br />
//Loads query data<br />
result = mysql_use_result(connection);<br />
<br />
//Writes data to stdio from first column on all rows in table<br />
while((row = mysql_fetch_row(result)) != NULL) {<br />
cout &lt;&lt; row[0] &lt;&lt; endl;<br />
}<br />
<br />
mysql_free_result(result);<br />
mysql_close(connection);<br />
}</blockquote><br />
You can compile it with following command:<br />
<blockquote>g++ filename.cpp -L/usr/include/mysql -lmysqlclient -I/usr/include/mysql</blockquote><br />
If there was no error displayed then your program compiled successfully. You can run by typing:<br />
<blockquote>./a.out</blockquote><br />
And now you made your first C++ program that gets data from MySQL DB. You can do a lot more than just that.<br />
<br />
You will probably need to read <a href="http://dev.mysql.com/doc/refman/5.0/en/c.html" target="_blank">MySQL C API Manual</a> to learn others commands.<br />
<br />
Next time I will write about preparing Apple Xcode and Microsoft Visual Studio for using MySQL C API.]]></content:encoded>
		<slash:comments>1</slash:comments>
	</item>
		<item>
		<title>How to remove Linux from a Mac?</title>
		<link>http://techsiteblog.com/how-to-remove-linux-from-a-mac/</link>
		<comments>http://techsiteblog.com/how-to-remove-linux-from-a-mac/#comments</comments>
		<pubDate>Fri, 30 Oct 09 16:18:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MAC]]></category>
		<category><![CDATA[Linux]]></category><category><![CDATA[partition]]></category><category><![CDATA[gparted]]></category><category><![CDATA[os x]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/how-to-remove-linux-from-a-mac/</guid>
		<description><![CDATA[I don't really see why would you do that, but here is a how to about removing Linux from a Mac.

Linux creates few partitions (usually / and swap, it's also a common practice to have /home partition). Everything would be easy if only Mac OS's built-in Disk Utility would support deleting Linux part [...]]]></description>
			<content:encoded><![CDATA[I don't really see why would you do that, but here is a how to about removing Linux from a Mac.<br />
<br />
Linux creates few partitions (usually / and swap, it's also a common practice to have /home partition). Everything would be easy if only Mac OS's built-in Disk Utility would support deleting Linux partitions. But sadly that's not the case (even on Snow Leopard).<br />
<br />
Here you have two options how to delete partition. <strong>First</strong> option is to use <strong>Windows Vista/7 Install DVD</strong>.<br />
<br />
1. Put DVD in Super Drive and boot from a DVD (hold alt key on bootup).<br />
<br />
2. Select regional settings and fresh install.<br />
<br />
3. At the partition editor select every Linux partition and delete it. Windows installation actually deletes partitions immediately as opposite to Linux's practice where this is done on the end of the installation wizard.<br />
<br />
4. Turn off Mac and remove DVD.<br />
<br />
<strong>Second</strong>, more known approach is to use <strong>GParted Live CD</strong> which can be downloaded at http://gparted.sourceforge.net/livecd.php. You can also "burn" it on USB key.<br />
<br />
1. Put DVD in Super Drive and boot from a DVD (hold alt key on boot up).<br />
<br />
2. Go trough the text-based wizard (probably you won't need to do anything than just pressing Enter).<br />
<br />
2. Select partitions you want to remove (be careful not to delete OS X's partitions) and click on Remove (it may take a few seconds).<br />
<br />
4. Turn off Mac and remove DVD.<br />
<br />
Now that you deleted partitions you can resize your OS X's partition with <strong>Disk Utility</strong> (/Applications/Utilities/Disk Utility.app).<br />
<br />
Click on your HD and select Partition tab.<br />
<p align="center"><a href="http://techsiteblog.com/media/techsiteblog/uploads/1.png" target="_blank"><img src="http://techsiteblog.com/media/techsiteblog/uploads/1-300x263.png" /></a><br />
<br />
Resize the partition by dragging its left corner to the end of volume. Click Apply.</p><br />
In the pop-up click Partition to complete the task (I'm not responsible for any problems that may occur during this step).<br />
<p align="center"><a href="http://techsiteblog.com/media/techsiteblog/uploads/2.png" target="_blank"><img src="http://techsiteblog.com/media/techsiteblog/uploads/2-300x143.png" /></a><br />
<br />
And after successful partitioning you will end up with only one OS X's partition (actually there is another one, but it's hidden from Disk Utility).</p><br />
<p align="center"><a href="http://techsiteblog.com/media/techsiteblog/uploads/3.png" target="_blank"><img src="http://techsiteblog.com/media/techsiteblog/uploads/3-300x263.png" /></a></p>]]></content:encoded>
		<slash:comments>0</slash:comments>
	</item>
		<item>
		<title>mod_python and MySQLdb</title>
		<link>http://techsiteblog.com/mod_python-and-mysqldb/</link>
		<comments>http://techsiteblog.com/mod_python-and-mysqldb/#comments</comments>
		<pubDate>Fri, 23 Oct 09 14:01:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Debian]]></category><category><![CDATA[Debian Lenny]]></category><category><![CDATA[MySQL]]></category><category><![CDATA[python]]></category><category><![CDATA[mysqldb]]></category><category><![CDATA[mod_python]]></category><category><![CDATA[daemon]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/mod_python-and-mysqldb/</guid>
		<description><![CDATA[

MySQL is one of greatest databases for web sites, and for applications and it\'s probably most used with PHP. Python is a good language for a lot of things. In my case, I needed some daemons, to do certain tasks. Firstly, I tried with PHP, but it is language for web pages, and it don\'t perform  [...]]]></description>
			<content:encoded><![CDATA[<strong>How to install mod_python and MySQLdb in Debian Lenny?</strong><br />
<br />
MySQL is one of greatest databases for web sites, and for applications and it's probably most used with PHP. Python is a good language for a lot of things. In my case, I needed some daemons, to do certain tasks. Firstly, I tried with PHP, but it is language for web pages, and it don't perform well as a daemon. So then I have to choose which language to use. C++ is powerful but very complex and there are other languages, that could fit me better for this project. I don't have a lot of idea about Perl and so I tried programming Python.<br />
<br />
I faced two problems in last two days:<br />
<br />
1. I had problems with installing MySQLdb<br />
<br />
2. How to make and publish a simple website in Python?<br />
<br />
<strong>MySQLdb</strong><br />
<br />
I got a few errors while trying to install MySQLdb by using <em>python file.py install</em>. As far as I searched the Internet, there are some workarounds but neither of them worked for me. And then it hit me. Doesn't Debian comes with apt, a great package tool?<br />
<br />
Installing this plug-in is very easy with apt. You just need to run following command:<br />
<blockquote>apt-get install python-mysqldb</blockquote><br />
And now you can use MySQL from Python.<br />
<br />
Example:<br />
<blockquote>#! /usr/bin/python<br />
<br />
import MySQLdb<br />
import sys  #for exit<br />
<br />
try:<br />
   	conn = MySQLdb.connect(host="localhost", user="root", passwd="", db = "database", charset = "utf8", use_unicode = True)<br />
except MySQLdb.Error, e:<br />
   	print "Error %d: %s" % (e.args[0], e.args[1])<br />
	sys.exit(1)       <br />
<br />
cursor = conn.cursor()<br />
cursor.execute("SET NAMES utf8;SET CHARACTER SET utf8;SET character_set_connection=utf8;")<br />
cursor.close()<br />
<br />
cursor = conn.cursor()<br />
<br />
while(1):<br />
	cursor.execute("SELECT * FROM table")<br />
	if cursor.rowcount &gt; 0:<br />
		rows = cursor.fetchall()<br />
		for row in rows:<br />
			if row == None:<br />
				break<br />
			print "Data: %s %s" % (row[0], row[1])</blockquote><br />
This is an example for UTF-8 charset encoding. I still don't know why I needed to close cursor after executing <em>SET NAMES utf8, </em>but this code should work without a problem.<br />
After my daemon feetched all needed data, I need to display it through web browser. PHP came to my mind, but if one thing is in Python, why not make other thing to? So for that I needed mod_python.<br />
<br />
<strong>How to install mod_python and use it?</strong><br />
<br />
It can be installed by typing following command:<br />
<blockquote>apt-get install libapache2-mod-python</blockquote><br />
You need to put following code in .htaccess or your Apache's configuration file to use Python:<br />
<blockquote>AddHandler mod_python .py<br />
PythonHandler mod_python.publisher</blockquote><br />
Now just write Python code, save it as something.py and put it in your website's root.]]></content:encoded>
		<slash:comments>0</slash:comments>
	</item>
		<item>
		<title>How to speed up loading of your website</title>
		<link>http://techsiteblog.com/how-to-speed-up-loading-of-your-website/</link>
		<comments>http://techsiteblog.com/how-to-speed-up-loading-of-your-website/#comments</comments>
		<pubDate>Thu, 15 Oct 09 15:04:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[php]]></category><category><![CDATA[Apache]]></category><category><![CDATA[cache]]></category><category><![CDATA[etag]]></category><category><![CDATA[compression]]></category><category><![CDATA[htaccess]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/how-to-speed-up-loading-of-your-website/</guid>
		<description><![CDATA[Is your website slow? Do you even realize that it could load faster?

Every webmaster tries to make web sites faster, so people will get better user experience. But there are few tricks that not everyone is aware of.


- cache static content (pictures, javascripts, css files)
- remove ETag fro [...]]]></description>
			<content:encoded><![CDATA[Is your website slow? Do you even realize that it could load faster?<br />
<br />
Every webmaster tries to make web sites faster, so people will get better user experience. But there are few tricks that not everyone is aware of.<br />
<br />
<strong>How to improve loading speed?</strong><br />
- cache static content (pictures, javascripts, css files)<br />
- remove ETag from pictures<br />
- compress content<br />
<br />
First thing is to <strong>cache static content</strong> so that it can be loaded from visitor's computer and not from server on every visit. Caching will also decrease bandwidth. It's good to set expire tag for at least a year.<br />
<br />
Every picture sent by a server include <strong>ETag</strong> by which browser can check if a picture from a server match picture from browser's cache. This is not needed on static content, which will never change (for example, uploaded pictures).<br />
<br />
And don't forget about <strong>compressing content</strong>. Loading will be faster because a browser needs to download a compressed file which is smaller and it will save a little bit of bandwidth. Compression is good for static and also dynamic content (.htm/.html/.css/.js/.php).<strong></strong><br />
<br />
<strong>Example .htaccess file:</strong><br />
<blockquote>Header unset ETag<br />
FileETag None<br />
<br />
&lt;FilesMatch "^.*\\.(ico|flv|jpg|jpeg|png|gif|js|css)$"&gt;<br />
Header unset Last-Modified<br />
Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT"<br />
Header set Cache-Control "public, no-transform"<br />
&lt;/FilesMatch&gt;<br />
<br />
&lt;FilesMatch "\\.(js|css)$"&gt;<br />
SetOutputFilter DEFLATE<br />
&lt;/FilesMatch&gt;</blockquote><br />
You need to put this file in a root directory of your website. Be careful, file doesn't have any name, only extension "htaccess". If you're using nice/SEO URLs then there is a good chance of you having this file already in a root directory. Only thing you need to do is to open existing file and copy this example code on the bottom of the file. It will only work with Apache HTTPD Server (most popular http server).<br />
<br />
<strong>Compressing dynamic PHP file</strong><br />
<br />
To compress PHP file you need to add following code on the top of the file:<br />
&lt;?php<br />
ob_start("ob_gzhandler");<br />
?&gt;<br />
<br />
Or a bit safer method, that will turn off GZIP compression if visitor's web browser doesn't support it:<br />
&lt;?php<br />
if(!ob_start("ob_gzhandler")) ob_start();<br />
?&gt;<br />
<br />
You can check <strong>site's performance</strong> with YSlow add-on for Firefox's developer plugin named Firebug.<br />
Download: <a href="http://developer.yahoo.com/yslow/" target="_blank">http://developer.yahoo.com/yslow/</a>]]></content:encoded>
		<slash:comments>1</slash:comments>
	</item>
		<item>
		<title>Convert video to FLV with PHP</title>
		<link>http://techsiteblog.com/convert-video-to-flv-with-php/</link>
		<comments>http://techsiteblog.com/convert-video-to-flv-with-php/#comments</comments>
		<pubDate>Wed, 07 Oct 09 00:01:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/convert-video-to-flv-with-php/</guid>
		<description><![CDATA[

This is a simple approach to converting videos to .flv with PHP. For example, users are allowed to upload videos, and then you can play it by Flash Player.



Probably you already have PHP installed, so let\'s continue with FFmpeg. Following commands works only in Debian/Ubuntu distribution. [...]]]></description>
			<content:encoded><![CDATA[<strong>How to convert video to .flv with php so that it can be played by Flash Player?</strong><br />
<br />
This is a simple approach to converting videos to .flv with PHP. For example, users are allowed to upload videos, and then you can play it by Flash Player.<br />
<br />
<strong>Installing FFmpeg</strong><br />
<br />
Probably you already have PHP installed, so let's continue with FFmpeg. Following commands works only in Debian/Ubuntu distribution.<br />
<br />
To install FFmpeg you simply need to type:<br />
<blockquote>apt-get install ffmpeg</blockquote><br />
FFmpeg is a library for converting video and capturing screenshots from video.<br />
<br />
Now you need some sort of a plug in to allow PHP to access ffmpeg. So we need ffmpeg-php, which can be installed by following command:<br />
<blockquote>apt-get install ffmpeg-php</blockquote><br />
Now you should be able to use it.<br />
<br />
<strong>Example PHP script:</strong><br />
<blockquote>&lt;?php<br />
if($_FILES['file']) {<br />
if (!$_FILES["file"]["error"] &gt; 0) {<br />
move_uploaded_file($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);<br />
<br />
$movie = new ffmpeg_movie($_FILES["file"]["name"]);<br />
<br />
$srcWidth = $movie-&gt;getFrameWidth(); //Movie width<br />
$srcHeight = $movie-&gt;getFrameHeight(); //Movie height<br />
$srcFPS = $movie-&gt;getFrameRate(); //Movie frame rate<br />
$srcAB = intval($movie-&gt;getAudioBitRate()/1000); //Audio bit rate<br />
$srcAR = $movie-&gt;getAudioSampleRate(); //Audio sample rate<br />
<br />
exec("/usr/bin/ffmpeg -i ".$_FILES["file"]["name"])." -ar 22050 -ab 32 -f flv -s ".$srcWidth."*".$srcHeight." new_movie.flv");<br />
//Convert a movie from original type to FLV<br />
<br />
exec("/usr/bin/ffmpeg -i new_movie.flv -an -ss 00:00:05 -an -r 1 -vframes 1 -y new_movie%d.jpg ");<br />
//Make screenshot of a movie at 5th second<br />
}<br />
}<br />
?&gt;<br />
&lt;form action="upload.php" method="post" enctype="multipart/form-data"&gt;<br />
File: &lt;input type="file" name="file" /&gt; &lt;input type="submit" value="Upload" /&gt;<br />
&lt;/form&gt;</blockquote><br />
This script saves an uploaded file, converts it to FLV and makes a screenshot of the movie at 5th second.]]></content:encoded>
		<slash:comments>5</slash:comments>
	</item>
		<item>
		<title>VPN or how to access US sites abroad</title>
		<link>http://techsiteblog.com/vpn-or-how-to-access-us-sites-abroad/</link>
		<comments>http://techsiteblog.com/vpn-or-how-to-access-us-sites-abroad/#comments</comments>
		<pubDate>Sat, 03 Oct 09 05:58:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[MAC]]></category><category><![CDATA[VPN]]></category><category><![CDATA[HappyVPN]]></category><category><![CDATA[VPS.Net]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/vpn-or-how-to-access-us-sites-abroad/</guid>
		<description><![CDATA[If you live outside US you cannot watch Hulu/CBS/etc. videos on demand because you need US IP. The other reason to use VPN is a secure connection to VPN provider. So your ISP doesn't know what are you browsing until you are connected to VPN.

There is some free and some payable services. Payable u [...]]]></description>
			<content:encoded><![CDATA[If you live outside US you cannot watch Hulu/CBS/etc. videos on demand because you need US IP. The other reason to use VPN is a secure connection to VPN provider. So your ISP doesn't know what are you browsing until you are connected to VPN.<br />
<br />
There is some free and some payable services. Payable usually have no problems with speed and blocked IPs.<br />
<br />
<strong>1. AnchorFree Hotspot Shield</strong><br />
<br />
It is a great service and it's free too. Downsides are that their IPs are blocked from VoD (video on demand) web sites and connection is not the fastest. Another downside is that you need to install their program in order to get service to work.<br />
<br />
<strong>2. Payable service HappyVPN</strong><br />
<br />
I decided to try a payable service and I heard a lot good about HappyVPN, so I decided to give it a try.<br />
<br />
It's 14.99$ per month and you will get unlimited access. Nice offer. So I payed for the first month and watched a few of episodes of various TV shows. Sometimes I got disconnected but I weren't worry about it too much. And after a week or a liitle bit more I am not able to even connect to this service.<br />
<br />
So I decided to cancel my subcription to them.<br />
<br />
You can try if you want. They offer payment by credit card or PayPal.<br />
<br />
<strong>3. The best option is it's own server or VPS (Virtual Private Server)</strong><br />
<br />
They are from 20$ per month and you will really get unlimited access. There is only one downside, they have limited bandwidth.<br />
<br />
So I bought one node from VPS.Net and try it out. You can pay with PayPal (I prefer this method, however they do not offer automatic payment through PayPal, like GoDaddy does) or credit card.<br />
<br />
<strong>How to buy a node and create VPS at VPS.net</strong><br />
<br />
1. Go to http://vps.net/, select one node (or more if you need more bandwidth or multiple VPS for some reason) and click Buy Now!<br />
<br />
2. Now you need to type your information and select your payment type. Then pay for it.<br />
<br />
3. Go to your account and select Create new VPS.<br />
<br />
4. Type VPS label and host name. For host name you can use your domain or sub domain. You don't actually need a domain.<br />
<p align="center"><a href="http://techsiteblog.com/media/techsiteblog/uploads/vps.png" target="_blank"><img src="http://techsiteblog.com/media/techsiteblog/uploads/vps-300x88.png" /></a></p><br />
<br />
5. Then select your cloud. UK to get access to UK sites (like BBC iPlayer) or US cloud to get access to US web sites (like CBS or FOX).<br />
<br />
6. Select Debian 5.0 (Lenny) x64 and in the bottom box select VPN image. Then click Create.<br />
<br />
7. You will be redirected to a page with your VPS's information. Wait a minute or two and then hit refresh.<br />
<br />
8. Your VPS should be ready now. Use SSH program from Terminal (Mac/Linux) or Putty for Windows.<br />
<br />
9. Connect to IP of your VPS and login as root with default password written on VPS's information page.<br />
<br />
10. Type following command to edit username/password to access VPN server:<br />
<blockquote>nano /etc/ppp/chap-secrets</blockquote><br />
11.  Go to the end of file and type something like:<br />
<blockquote>username pptpd password *</blockquote><br />
(change username and password with your desired username/password)<br />
<br />
12. Save file and exit (Ctrl + C and then type "Y" (without quotes))<br />
<br />
13. Type following command to reboot pptpd service in order to make VPN work:<br />
<blockquote>/etc/init.d/pptpd restart</blockquote><br />
That's it for server side.<br />
<br />
<strong>How to connect to the VPN network with Mac</strong><br />
<br />
Now that you bought VPN access or created VPS with VPN service you need to prepare your Mac to send all your Internet connections trought your VPN.<br />
<br />
1. Go to System Preferences.<br />
<p align="center"><a href="http://techsiteblog.com/media/techsiteblog/uploads/sys.png" target="_blank"><img src="http://techsiteblog.com/media/techsiteblog/uploads/sys-300x256.png" /></a></p><br />
<br />
2. Go to Network and press on "+" button in the bottom left corner. Then change interface to VPN, select PPTP as VPN Type and enter your desired VPN Service Name.<br />
<p align="center"><a href="http://techsiteblog.com/media/techsiteblog/uploads/vpn.png" target="_blank"><img src="http://techsiteblog.com/media/techsiteblog/uploads/vpn-300x146.png" /></a></p><br />
<br />
3. Now type your IP address and username:<br />
<p align="center"><a href="http://techsiteblog.com/media/techsiteblog/uploads/vpn2.png" target="_blank"><img src="http://techsiteblog.com/media/techsiteblog/uploads/vpn2-300x264.png" /></a></p><br />
<br />
4. Click on Advanced and set up like in following picture:<br />
<p align="center"><a href="http://techsiteblog.com/media/techsiteblog/uploads/settings.png" target="_blank"><img src="http://techsiteblog.com/media/techsiteblog/uploads/settings-300x234.png" /></a></p><br />
<br />
5. Click Ok and then Apply. Now you need to type your password and hope everything is allright.<br />
<br />
Everything should work now. You can check by going to http://www.ip-adress.com/ and if IP on site match your VPS's IP then you're good.<br />
<br />
I'll write more about connecting to VPN on Windows in next blog post.]]></content:encoded>
		<slash:comments>1</slash:comments>
	</item>
		<item>
		<title>Essential security tips for servers</title>
		<link>http://techsiteblog.com/essential-security-tips-for-servers/</link>
		<comments>http://techsiteblog.com/essential-security-tips-for-servers/#comments</comments>
		<pubDate>Tue, 29 Sep 09 17:29:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[server]]></category><category><![CDATA[SSH]]></category><category><![CDATA[security]]></category><category><![CDATA[VPS]]></category><category><![CDATA[iptables]]></category>
		<guid isPermaLink="true">http://techsiteblog.com/essential-security-tips-for-servers/</guid>
		<description><![CDATA[

1. First thing you need to do is to change your root password. Connect to server with SSH and type:

Then type in your new password, press enter, and retype it again.

2. It\'s not safe to allow root user to login throught SSH. So you need to create a new user:

Then set the password for t [...]]]></description>
			<content:encoded><![CDATA[<strong>In this tutorial you will find out some of the necessary steps to secure you VPS or dedicated server.</strong><br />
<br />
1. First thing you need to do is to change your root password. Connect to server with SSH and type:<br />
<blockquote>passwd</blockquote><br />
Then type in your new password, press enter, and retype it again.<br />
<br />
2. It's not safe to allow root user to login throught SSH. So you need to create a new user:<br />
<blockquote>useradd user_name</blockquote><br />
Then set the password for this user with:<br />
<blockquote>passwd user_name</blockquote><br />
3. Now let's go to SSH settings.<br />
<br />
Open file by typing:<br />
<blockquote>nano /etc/ssh/sshd_config</blockquote><br />
And find/change following:<br />
<blockquote>PermitRootLogin no<br />
X11Forwarding no<br />
AllowUsers user_name<br />
Port 10000</blockquote><br />
It's important to change your SSH port to higher number (for example 10000).<br />
<br />
4. Configure iptables:<br />
<blockquote>iptables-save &gt; /etc/iptables.rules<br />
nano /etc/iptables.rules</blockquote><br />
Example rules:<br />
<blockquote>*filter<br />
:INPUT ACCEPT [0:0]<br />
:FORWARD ACCEPT [0:0]<br />
:OUTPUT ACCEPT [0:0]<br />
-A INPUT -i lo -j ACCEPT<br />
-A INPUT -d 127.0.0.0/8 -i ! lo -j DROP<br />
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT<br />
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT<br />
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT<br />
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10000 -j ACCEPT #Change this port to SSH server's port<br />
-A INPUT -p icmp -m icmp --icmp-type 8 -j DROP<br />
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7<br />
-A INPUT -j REJECT --reject-with icmp-port-unreachable<br />
-A FORWARD -j REJECT --reject-with icmp-port-unreachable<br />
-A OUTPUT -j ACCEPT<br />
COMMIT</blockquote><br />
Be careful to change your SSH port to the one you set in sshd_config, otherwise you wouldn't be able to log in to SSH server.<br />
<br />
Import rules to iptables:<br />
<blockquote>iptables-restore &lt; /etc/iptables.rules</blockquote><br />
5. Set new iptables rules to reset during reboots:<br />
<blockquote>sudo nano /etc/network/interfaces</blockquote><br />
<blockquote>...<br />
auto lo<br />
iface lo inet loopback<br />
pre-up iptables-restore &lt; /etc/iptables.rules<br />
...</blockquote><br />
6. And now reload SSH server:<br />
<blockquote>sudo /etc/init.d/ssh reload</blockquote><br />
These are only essential steps to secure you server. Your server should now be a little bit more secure, but there is no such thing as 100% security.]]></content:encoded>
		<slash:comments>0</slash:comments>
	</item>
		</channel>
</rss>
