Categories
Linux Personal

Fedora 15 “Love Lock” and My Experience

Fedora 15, codename “Love Lock” features Gnome3 as the default desktop environment. The UI is stunningly beautiful but the navigation requires some getting used to. Biggest surprise – no minimize button, Gnome3 devs focused on the use of workspace rather than minimizing. However I found out that we can still minimize by right clicking on the window of the application. But without playing much with the GUI, I jumped into setting up my work environment. Installing LAMP was a bit different given my past experience in Ubuntu.

Then started the service :

Changed ownership of the /var/www directory:

Then I fired up nautilus, browsed /var/www and deleted all the files. Created a index.php with phpinfo(). And then tried to restart the server:

It failed because the server document root was wrong in the httpd.conf. When installing apache on Fedora, the server document root is /var/www/html which I deleted while cleaning up /var/www. So I installed nano:

And then edited the /etc/httpd/conf/httpd.conf file with nano to fix the issues. Then again restarted the server and it worked 🙂

Besides, I learned this command:

It checks the httpd.conf for syntax errors.

I created a test user and then tried to delete the user. The GUI had issues with that. Then found this command to do that:

I downloaded Skype and installed. It’s working fine. So far the experience is good. I am learning lots of commands and I’m loving it 🙂

Categories
Python

Compiling Python Apps to Exe on Windows

Python is shipped by default in Linux and Mac. So deploying a python app is quite easy on these platforms. But it remains a pain in you-know-where when you try to distribute your app among Windows users. Windows people are usually habituated to getting exes. So, with a little effort and a very useful tool, we serve them what they desire.

There’s this PyInstaller utility which converts python scripts into exes. You can create a directory installation (one single executable and other necessary files in a directory) or just a plain exe everything embedded into it. If UPX is available on your system, you can take advantage of that too. So, how do we achieve this?

# First get Python from http://python.org [Probably you already have it]

# Get Pywin32 package. You must match the version of PyWin32 corresponding to your Python version. I am using Python 2.5, so in my case, I must use the pywin32 package which has been built for Python 2.5.

# Get PyInstaller from http://www.pyinstaller.org/

# Extract the pyinstaller content and add to path. You have to right click on My Computer, Go to Properties. Go to Advanced System Settings > Environment Variables. Modify the “PATH” variable and add the location of the extracted pyinstaller directory. Now we’re ready!

# When we first time use PyInstaller, we must generate the configuration by typing this command:

It will generate a configuration file in the pyinstaller root directory.

# Now to compile a python script, use this command:

You can find full documentation under the “docs” folder of the pyinstaller directory. Please note the different options to pass to the Makespec.py file to change the behaviour of the executable. For example: I do like this

The -F parameter makes it a single executable with everything embedded inside. The -w parameter makes it a windowed app so no console is displayed. I need it specially when compiling a GUI app written in PyQT 🙂

So thats it, quite simple! Have fun 🙂

Categories
PHP Work

PhpTube: A PHP Class to get download links from Youtube Watch URLs

THE API HAS BEEN BROKEN FOR A LONG TIME, AND I DON’T WANT TO FIX IT SINCE THERE ARE BETTER ALTERNATIVES LIKE “youtube-dl”.

Let me get to it straight: I wrote a php class that takes a youtube watch url (the typical url to watch a video, the url has a “watch” GET parameter in it) and returns the download links for different available formats of the video. Please note that these links will be valid for the requesting IP address. That is you can not download the videos from other IP addresses except the only one IP adress that actually originated the download request. So if you put it on your server and send these links to your users, they’ll certainly not be able to download from these links since their IP addresses will be different from your server IP address. In that case, you should first download it to your server and then link to those downloaded videos.

You can download the source codes from my github repo: https://github.com/masnun/phptube 🙂

An example:

Output: