Wednesday, April 04, 2007

I uninstalled sqlite on my Linux box !!!

Well I somehow felt I could yum erase sqlite since I do not need it. Well I did not see the dependencies that would be removed too! The result:

yum, rpm, php, httpd, rpm-python and many related packages all Erased !!! OMG I said. :P


I am not very friendly with Linux as yet at this level. I knew I had screwed all hopes of getting that box in clean shape. I searched the net for "reinstll RPM", "install RPM" and similar. Got a link to How to reinstall rpm

In case you can not reach to it, it says something like:

I guess you could try :
- Copying the "rpm2cpio" binary from another machine
- Copying the rpm package locally
- Running something like :
cd /
rpm2cpio /path/to/rpm-4.*.rpm | cpio -dimv

Then you could clean up what you just did (in case it's a different version of rpm, mainly) :
rpm -e --justdb --nodeps rpm
rpm -Uvh /path/to/rpm-4.*.rpm

YMMV...
Matthias

That gave me some hope. I followed the instructions. Switched to root user, went to / and executed rpm2cpio with the downloaded rpm of RPM itself. RPM

Then got an error about librpm shared lib missing. So downloaded librpm. Now rpm works!!!

Now I just searched for the latest versions of rpms for getting yum up and running. This included sqlite, python-sqlite, rpm-python, yum-metadata-parser, urlgrabber, etc. And finally installed yum !!!

I mainly used rpm.pbone.net for searching rpms

Well thats it: I am almost saved :D

Thursday, March 08, 2007

My laptop: my local web server

Well two months back I bought my first laptop. A Compaq V3155AU with following configuration:
AMD Turion64 (single core) 2.0Ghz
Hyper Threading support
512MB DDR2 system memory (I upgraded that to 1GB)
nVidia 6150 graphics chip-set with shared memory
14.1" display
60GB SATA hard disk drive
DVD/CD R+RW
Bluetooth
Ethernet
Wireless Lan
At sub Rs. 40,000 (sub US$ 900) this was a great deal. I was using Fedora Core 6 (64bit edition) on it but was not using it much since I still love my desktop and do not have enough work to justify simultaneous usage of two computers. Recently my friend planned to join me on web development work and I thought this was a good time to use it regularly. So I had to first make sure the Wireless Lan worked since I Fedora had not done that automatically. I read:
"Compaq Presario V3000 with Ubuntu 6.06" and it helped a lot. Actually I got the Wireless Lan running in no time. It was very easy. If after a shutdown or restart you need to connect just use the usual commands (iwconfig, iwlist, dhclient to scan for network, connect, etc.).
I setup up my usual structure for web projects. PHP was already there, so was Apache. A few needed PHP modules were added (APC, MagickWand for ImageMagick) and I had a working local web server !!!
Things are really that easy if you are using the right software :) and there is always Google to help you when need it.

Wednesday, March 07, 2007

Problems with installing Yum on Fedora Core 4

"There is a problem importing one of the Python modules" : ever faced this error after installing an running yum. Well I faced that. And searched on Google for it. But in vain. Most results suggested the usual missing packages:
libxml2-python, python-sqlite, or python-elementtree
I tried installing all of them and no use. Then did lot of finding around and finally i tried to install other package managers. Finally I cam across a yum rpm package at rpmfind.net and while installing I got the dependency error for urlgrabber (http://linux.duke.edu/projects/urlgrabber/). Installed that and all was fine !!!

Wednesday, December 20, 2006

Upgrading forum with phpBB2 and restoring from database backup

Well I had to do some phpBB (phpBB2) issues for a client who runs hispanito.com. He had a forum which ran on probably phpBB2 version 2.0.7 and with MySQL 4.x. Now I had to bring those data to a different server with MySQL 5.x I tried a fresh install with latest phpBB2 version 2.0.21, but it failed as soon as I tried to bring in the old data. I tried an Upgrade too, but that failed too. Then I tried many other ways, none of which worked so at last I simply understood that table structures must have changed other than an very visible change in the number of tables ("session_keys" was a new table). Now I had to edit the tables that had changed almost by hand, so if you must have to do the same here are the tables which I changed: "users": two columns added: "user_login_tries" and "user_last_login_try" "sessions": one column added: "session_admin" "search_results": one column added: "search_time" You have to do the above changes after you make a normal install of new phpBB2 and then restore old database backup, which will change the table structures. Hope that helps.

Friday, October 20, 2006

Use ssh for http ftp and so on

My ISP has a little fault that I use to my advantage. The software that they use works kinda in the following way:
Before I login to their network all my external connections are blocked. I can not do http, ftp, ssh or anything else related to external network. This is usual isn't it.
Now I login to my ISP using my username and password and i am connected!!! I have http, ftp, ssh and anything else that I can expect normally. This again is all usual.
Now starts the unusual part: Lets assume I have my browser open and a normal download is going on in Firefox. Also assume I have ssh and sftp running. Now I log out of my network. Usually what you should expect is that all my connections stop. But here is where my ISP software is a good one for me. All connections on port 80 are blocked as soon as I logout; but no other connection ( on ports other than 80 ) that was open when I was logged in, is blocked. So ssh and sftp remain working. Similarly if i had torrent running it would continue to run. I never really made a test as to which ports are blocked and which are not, but at least I know many ports are not blocked. Now the even more shocking part. My connection comes with unlimited data transfer, but is very limited in speed : 64 kbps. What happens after I logout is that the connections that were running ( non port 80 ones ) take as much bandwidth as available on the network!!!
All I had to do was to somehow redirect all of my usual port 80 connections to some other port so that I could surf at a better speed or download the 2 Debian DVDs :) So I did some Google-ing for a solution. Somehow I thought that I could open an ssh to an external server I have and redirect all http, ftp through it. So this is what I got :
use this command> ssh -qTfnN2 -D 8080 user@server
This basically will connect to a server and open a local port 8080 so that now I could setup SOCKS proxy in Firefox through localhost:8080... and it works!!!
Also I can download stuff using Curl through the above proxy too:
use this command> curl http://url/to/file --socks5 localhost:8080
And that works too. Hope this helps you too :)

Thursday, October 19, 2006

Share our web hosting server

Recently me and some friends changed from our web hosts to a full dedicated server. We took a nice server from Layered Technologies (http://www.layeredtech.com/) and put in Xen in it. Now each of us are running their own OS on the Xen. We had thought of dividing the server 4-way, but we are only using 2 slots. So if anyone is interested in taking a piece do tell us. We are mostly available on IRC : Freenode : Lookout for the following nicks :
brainless, llyric. Thats the two of us.
Even if you want to take a dedicated server and share it you can contact us if you need any help.
The details of the server are:
Processor : AMD 64 Athlon 4000+
Memory : 2048MB RAM
Hard Drive Space : 500GB Hard Drive
Drive Controller : SATA
Operating System : Fedora Core 5
IP Addresses : 8 (5 Usable)
Bandwidth : 1500GB
Up-link Port Speed : 100Mbps Up-link
All resources are equally divided and shared among the slots except the bandwidth, which is available to all and any slot can use all available bandwidth. Terms are simple: We don't want any illegal content like file. Usage of resources should not be such that it causes a pain to maintain the server. You must have basic knowledge to maintain your own slot. You will be given access to the main server too in case you need to restart or re configure your slot etc. We just want trust able and self supporting folks who can take care of there own OS. You can have any legal content including adult content.
As you can understand this is a good server and we do not utilize even 5% of the server resources on average, so you can make good use of the machine.
Each slot is at around less than $40 and if you want you can have 2 slots together in one with double the resources of one slot allocated to you.

Friday, September 08, 2006

Apache 2.2 on Fedora Core 5

Me an some friends took a new server two days back. We threw in Xen and made four guests. I being in one of the guests which runs Fedora Core 5. I had to install Apache, which was pretty easy with yum. Just
yum install httpd
I started Apache using apachectl, and it seemed like all was OK, but I was not somehow able to view anything when I typed my server's IP in the browser from my home computer. Yet if I do a "telnet localhost 80" and "GET /" on the server itself ( I was logged in through SSH ), then I could view the HTML thrown at me by Apache. After Googling about it I found that port 80 (http) might be blocked by default. I found some help and dropped the following line to /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 ACCEPT
Wow... I could see the default Fedora welcome page now.

Now it was time to change my DocumentRoot to someplace else and also add Name based Virtual Hosts. When I changed my main DocumentRoot, Apache simply started throwing Forbidded errors. That was weird. It works with DocumentRoot set to /var/www/html but doesnt work when it is set to /srv/htdocs/
Now I did chmod 0755 -R /srv/htdocs, but it didnt help. I again assumed someone else was to be blamed. So a second round of Googling and I found this:
chcon -t httpd_sys_content_t -R /srv/htdocs/
That simply solved my problem again.
(Note: you might need to repeat the above command for you logs and cgi-bin folders, if they are not the default ones).
So it was an SELinux issue this time. Now most of my Apache 2.2 / Fedora Core 5 issues are fixed. Yay!!!

Thursday, July 06, 2006

Making a Hello World PHP extension with VC++ Toolkit 2003

I wanted to do some PHP Extension making and so started googling around for help. Most help is about using VC++ 6.0 or have project files for the full VC++ IDE. Since I have the Toolkit compiler I thought I would read the help available and do a compile from the Toolkit Command Prompt.
My basic need for PHP Extensions is that I want to make a Drupal (drupal.org) core extension. Just experimental stuff. So the C file is a simple Hello World type which just prints "Hello Drupal World"

the C code is:
/* include standard header */
/* you will need to include this in all of your php extension projects*/
#include "php.h"
/* All the functions that will be exported (available) must be declared */
ZEND_FUNCTION(drupal_world);

/* Just a basic int to be used as a counter*/

/* function list so that the Zend engine will know what’s here */
zend_function_entry drupalmod_functions[] = {
ZEND_FE(drupal_world, NULL)
{NULL, NULL, NULL}
};

/* module information */
zend_module_entry drupalmod_module_entry = {
STANDARD_MODULE_HEADER,
"Drupal",
drupalmod_functions,
NULL,
NULL,
NULL,
NULL,
NULL,
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
};

#if COMPILE_DL_DRUPAL_MOD
ZEND_GET_MODULE(drupalmod)
#endif

ZEND_FUNCTION(drupal_world) {
zend_printf("Hello Drupal World");
}


It was mostly taken from : http://www.zend.com/apidoc/zend.creating.php

To compile this I had to start experimenting with all available help instructions ( that relate to using the VC++ IDE and not a Command Prompt Toolkit ). Anyways the final command that worked is:

cl drupal.c /D "WIN32" /D "ZEND_DEBUG=0" /D "COMPILE_DL_DRUPAL_MOD" /D "ZTS=1" /D "ZEND_WIN32" /D "PHP_WIN32" /LD /EHsc /nologo /I"F:\coding\php-4.4.0\main" /I"F:\coding\php-4.4.0\Zend" /I"F:\coding\php-4.4.0\TSRM" /I"F:\coding\php-4.4.0\win32" /I"F:\coding\php-4.4.0" /I"F:\coding\php-4.4.0\regex" "C:\php\php4ts.lib"

As you can understand probably /D makes preprocessor defines.
My course is at F:\coding\php-4.4.0
My running PHP is at C:\php which is also same version (4.4)
drupal.c in the file I wrote for the extension and whose source is above.
I ran this from the VC++ 2003 Toolkit Command Prompt
My workind directory was F:\coding\php-4.4.0\ext\drupal where the file drupal.c exists. you dont have to keep the file there. You can place it anywhere and compile. Just remember to change the paths in the above command. Thats all
After successful compile you will find a drupal.lib file and drupal.dll file in the folder from where you are compiling. copy the dll and use it as usual (you can rename it to php_drupal.dll or use the compilers output options to name the output dll file)

Friday, May 26, 2006

banyanTree project

The banyanTree Project

Introduction:
The banyanTree project is intended to be the central resource to bring volunteers (interested professionals, students, programmers, language translators, etc. or even end users) and FOSS projects together. The idea is very natural : a common meeting place for people new to FOSS, so that they can get to their project of interest easily. The interested person are assumed to have some skill so that they are looking to help in a particualr fied, but doesnt know which project/org needs such skill at the moment. Some may know which org to join and have some needed skills, but may need some other related help. It is also intended to become the central "guide" for the newcomer. Think of banyanTree as your tour guide : getting you around the city and describing the needed details.

History:
Two years back when I was trying to get involved in a project related to Flash, I had to do a lot of roaming around. I found GPLFlash and many other projects, but it took time. The main reason for this is the fact that there isnt a single place where all interested organisations or projects come together and speak out their details regarding both development and usage of the software. I would like to term that as a "guide" to FOSS-world. I tried to think hard on implementing this, but for many reasons I could not. This year (2006), while I was applying for Google Summer of Code, I suddenly discovered a place to discuss my thoughts. Thus we now have banyanTree. The rest is what you see now.

What we are to do:
banyanTree is a combination of a website and other communition medium like IRC. A team of developers will have to build the site, and also maintain it. It is basically a community updates tracking system and a search engine which is specific for searching the depths of FOSS.
The updates tracking system : project maintainers, update their information regarding developers or volunteers required, project introduction and detail URLs, mentors available, sponsoring (if any), etc. The details will be kept in a central database, and also mirrored on the project's sites if needed. Any visitor has access to these details at any moment. The maintanance of the details is the most important part : keeping things up-to-date, notifying interested parties or individuals, keeping trac of related happenings in the industry which may benefit the volunteer/visitor. The key point is the distributed architecture allowing project maintainers, mentors to update information to central database.
The search engine : this allows extensive search of the information in the databases. It could also grow to become a FOSS specific search engine, which includes any FOSS related topic.

The name banyanTree:
The reason for the name come from a mixed feeling and can not be easily expressed in words, but I have tried to put it up in plain English here:
The banyan tree is a type of a large tree, with aerial roots which hang from the branches. The trees thus can spread very large areas. This type of tree is mostly found in Indian sub-continent. They grow together into a very wide tree. The banyan tree creates a very different feeling from that of any other tree I know of. It expresses the feelings of "spreading out" and "spreading deep". This is exactly what the project is intended to do. Also any tree in general provides shelter, and "Green is the color symbolizing earth, nature, and in a broader sense, life" : wikipedia.org.

Current status:
We are working on initial roadmap, and plans. Also we are trying to build a team of initial programmers, maintainers. All interested human beings are welcome to join IRC channel #banyantree on freenode.

Links:
banyanTree QA Rounds on IRC
Another IRC session on country specific issues

Saturday, May 13, 2006

Human Language Learning System

Its Exam time going on now... so cant think much :P But for few days two different ideas have been making rounds in my brain(ahh brainless has a brain o.O). The first one involves a different approach to UI of information kiosk type sites. I will discuss this one later with some examples.

But the second one seems more interesting to me. It comes from my direct need or wish to learn many global (human) languages other than English. I have never come across a community based language learning system, even though the community has been able to create and maintain such beautiful efforts like Wikipedia. I believe the reason is partly the absense of such a system. Here I will try to express my thoughts, which are just the surface of the system. I want more people to think so we have a real practical solution which can be easily implemented.

Learning human languages I hope is something liked by most people and it is important too. To learn a language easily we need some reference of the target (the language which we are going to learn) and some other language we already know. For example if I want to learn Spanish the easiest way would be for someone to start some simple verbal explanation or introduction to the language. This aided with visual examples like the written words of pictures of the object being described is very helpful. This case is very easy to do in real life or maybe over special direct audio/visual communication system. What could be a good solution is a right mixture of existing open protocols which enable text, audio, image and video transmission on internet and an application to present it all in the required manner. If all this seems a bit confusing then read the following example:

I want to learn Spanish. Assume that I find a person, say Jack who knows both English and Spanish and is willing to teach me. The general way is to introduce me to the alpahbet and to smaller words (with their respective English meanings). Starting with "A for Apple" thing is better when the picture of Apple is there (Apple maybe known to most people in the world, but there maybe other unknown things). The addition of voice in the background is needed.

Then we to some grammer stuff where it is about more explanation using voice and text. Next Jack could start showing be smaller paragraphs of text and read them out so that I can practice reading in my mind. This would help with the ability to underline the word (or words block) he is reading currently in a 10 line text. It will help me to keep track of the word he is currently speaking (as in some karaoke stuff I have seen).

This is the basing process. Now the following just brings out the important points in this system:
  • Text in target language and also support text in the known language is written by the author (a teacher for example). Text can be rendered to image, if there are issues with fonts. Jack simply types text in the application as a slide-by-slide basis (as in a presentation).
  • Thus a "Slide" becomes a basic block of the system. A slide can contain text, image, audio, video. The slide can be well described in terms of the items (text, image, etc.) it contains. Image, audio and video can be encoded using formats like png, vorbis, theora respectively or other better open formats that I dont know of. The slide itself is basically xml tags which describe what items it contains.
  • A number of slides make up a "Presentation". The presentation is an xml file. Simple :)
  • The items needed within the slides are simply "linked" by URL to the actual (image, audio, etc.) files.
  • The xml does contain the text though which is supposed to be displayed.
I am not going into the details of tags for xml file etc. But I will give an example of what Jack and I should find once such a system exists.

First lets see how Jack does his work:
  • An application exists which allows Jack to create new slide and add text to each slide.
  • On the first slide he types the Spanish equivalent of "A" and records his voice for the alpahbet. Also he may record a reference audio "Pronounced as in ..." or something else which helps in the learning process. In this slide the text is too simple and doesnt need an underline.
  • Images can be linked in each slide as they are linked in html. Ofcourse he may create his own image or link image from a public server.
  • Jack continues to process until he completes the full alphabet and that is thinks is enough for the presentation "Introduction to Spanish". Nice work Jack.
The presentation file along with the image or audio can be either be in separate files available through HTTP or similar, or in a single compressed file. The presentation xml file must have a certain name. The item files (image, audio, etc) if present in the compressed file are fetched from that file itself with the option to checkout the online URL for updated content. It is not compulsory that all the item files remain in the compressed file, in which case the URL is used to simply fetch them.

Now one fine morning I want to learn Spanish (atleast try ...). I simply search the well known spanish-pedia or something and get hold of Jacks "Introduction to Spanish". I download the full compressed file or simply click on the presentation xml. A browser plugin downloads the required items and I start learning... hurray... I know the Spanish alphabet.

Jack starts working on his second part of the series. He types few short paraghaphs which make good use of the alphabet. Here he adds underlines to text. He could do that in the following way:
  • Type out the full paragraph of a slide.
  • After typing is done select a word or few words (maybe a sentence) and do a "ctrl+U" or something similar. Also with the selected text: speak and record the words/sentence as they should be pronounced.
  • The application keeps track of the time sequence for each underlined segment and its audio. This can simply be expressed in the xml itself as timestamps.
In a similar fashion Jack completes the presentation and as earlier I use it to learn more Spanish.

Thats all for now... keep thinking. Discuss and comment your thoughts. Cheers!