Sunday, November 25, 2007

firefox doesn't play nice with tunnels

Created a tunnel over ssh from my remote machine to use the studio server's internal webserver, similar to tunneling TightVNC. Got a firefox error when trying to access the tunnel using http://localhost:6000 -
This address is restricted: This address uses a network port which is normally used for purposes other than Web browsing. Firefox has canceled the request for your protection.
Found the solution at http://www.purple.dropbear.id.au/node/139 by googling.
  • Go to about:config in your Firefox browser.
  • Right click somewhere, and choose "New => String"
  • In the setting Name box type "network.security.ports.banned.override"
  • In the Setting Value box, type "1-65535" or whatever port-range you want to allow.
  • Click OK

Tuesday, November 20, 2007

phplist removal from blacklist, that is, re-subscribe

http://docs.phplist.com/UserInfo gives the info on how to remove a user from phplist's blacklist - usually when someone unsubscribes and now wants to re-subscribe - Go to that user's history and click on the link there.

Sunday, November 18, 2007

more SQL and web programming Gyaan

Don't create tables or records with names like From - SQL keywords - though postgres allows it, the names will cause error grief in SQL queries.

When trying to write to a text file, the most likely cause of errors is permissions, if the file exists. Check permissions of the parent directory and its parent and so on....

Examples for doing file writing in asp from
http://www.eggheadcafe.com/articles/20030627b.asp
http://www.brainjar.com/asp/fileops/default2.asp
got by googling
scripting.filesystemobject

Tuesday, November 13, 2007

Many different topics

Hopefully the search feature on blogger will help me find this post when I need it, because I'm going to post about many different items.

1. New schedule page in public beta - have added a link from the old schedule page on radiosai.org.

2. Asked for a firewall rule change on fs3 to allow only our machines to get shell access.

3. Weird error on a csv import, was due to a newline in a Description.

4. Google customized search being used for H2H, old links to krishna being removed using TexRep find/replace in files tool.

5. Subscription pages which send emails to us instead of directly accessing phplist - to avoid exposure. Also writing to file...

6. Removed asp page dl.asp for saicast downloads, using static addition of the content-disposition header "attachment" instead: In IIS manager, right-clicking on Saicast video downloads, as given in http://support.microsoft.com/kb/260519
"To apply the header statically, right-click the document in the Internet Service Manager, and then select *Properties*. Select the *HTTP Headers* tab and enter the content-disposition header there."
In our case, added it to the entire site.

7. Adobe had nice video workshops for their products.
http://www.adobe.com/designcenter/video_workshop/
But around 500 kbps is needed to see them properly.

8. Have subscribed to Secunia Weekly summary of vulnerabilities.

9. Lots of updates on the "voluntary" side of web work, keeping me busy outside "office hours".

Friday, November 09, 2007

sql snippets

Gave a link to the new php program schedule page from the schedule page 2 days back, so it is in some sort of public beta. Found some bugs, one of which was due to languageid being NULL in our local db. Solution was to make languageid 1 the default value for that field, so that future record inserts will automatically have it set (tested) and also ran
update file_information set languageid=1 where languageid is NULL
Struggled a bit to get the syntax right, with languageid ='', languageid = NULL , NOT (languageid>0 and languageid<9) and so on, till I googled the correct syntax for NULL.

One more snippet of SQL Gyaan is that to insert, update etc for fields with type interval / timestamp , the syntax is
UPDATE "file_information" SET "duration" = interval '00:01:09' where file_id = 2020
and so on. One has to do a sort of typecasting using the keyword interval. One can even say interval '1 hour' and so on. From http://www.linuxjournal.com/article/9618

Friday, November 02, 2007

dir listing taking too long

One of our machines was taking a looong time for ls -l listing. Turned out a mounted smb share had i/o errors - reported by df -h. Umounted it, then all is well....

session_start() caveats in php coding

The new schedule page admin interface had a bug of having to login twice - and momentarily some error messages would appear.
session_start(): Cannot send session cookie - headers already sent 
Reason was the session_start() function being called in the body of the page. It should appear before any output is sent to the browser, as mentioned below:

http://in.php.net/session_start

http://www.koderguru.com/tutorials/phptutorials/headertuto1.php

silent speakers!

DJ did a great job checking mandir speakers on NR's instructions - found 8 not working! Loose contacts and an amp being disconnected.... Fixed now, I believe.

new schedule page

Still working on the new schedule page - still needs streamlined import feature - import from csv file, currently have to copy-paste, and also need to add lots of timezones. Bugfixes pending too - download flag checking, filename gets a space and needs ltrim....

trouble or work ticket systems for windows

http://otrs.org/ - Open source ticketing system - Perl-based, has Windows installer

http://www.netvigilance.com/winrt - - Perl-based, has Windows installer

Google results for NA who had asked for MT office. Passed on the info to V, since he's the one who has to install any sw for MT.

Friday, October 26, 2007

Media convertor problems?

On Oct 11 I had some connectivity problems, thought there was some router problem, but finally suspected local (PC) router and media convertor. Once again, on Oct 23, I had one more episode of connection problem. Tried restarting my router (Millenium) computer. Still problem persisted. Then toggled the WorkStation/Hub switch of the media convertor. Then it started working. So, probably media-convertor / network card issue. Right now it is working and I can live with it....

Thursday, October 25, 2007

internal http sharing problem

Our internal http large file share had been unmounted after a reboot due to a power problem, but after remounting it, was not able to access it from the same machine. Forgot that I've not added localhost to the access controls! So, changed the relevant lines in httpd.conf:

AllowOverride None
Options +Indexes
Order deny,allow
Deny from all
Allow from 127.0.0.1 x.y.z.w a.b.c.d p.q.0.0/255.255.0.0
#allow from .your_domain.com

Migrating to Google Apps

Spent the whole morning yesterday creating accounts, adding forwarding rules etc so that the users will not feel anything in the migration. The Dashboard was very slow yesterday, probably because of Murphy's Law! This morning, corrected our SPF records so that the new accounts also can send mail without spf softfail - needed to remove the mx records of gmail, which were anyway not required, since mail sent from gmail is anyway signed properly. So, now the SPF records have ip4: parts and the include: part as given in Google's Helpcenter.

For migrating other domains, will think about the options presented by Scott Hanselman, especially the part about transferring old mails via pop and the gXfer tool to one-click transfer all mails.

Monday, October 22, 2007

small bug in PhpMailer timezone code

As posted to phpmailer general mailing list:

In class.phpmailer.php 's function RFCDate(), there is a bug in the timezone code which returns +0580 for Indian Standard Time instead of +0530.

The line
$tz = ($tz/3600)*100 + ($tz%3600)/60;

should be replaced with

$tz = (($tz - ($tz%3600) )/3600)*100 + ($tz%3600)/60;

Found this bug in our phplist mails....

Edit: More info - http://in.php.net/operators.arithmetic has a comment which describes the integer division required:
nicolas_rainardNOSPAM at yahoo dot fr
10-Jul-2007 09:10
Here is another very simple and extremely fast integer division function, but it works only if the arguments are integers and nothing else. So use it only if you are sure of what you are doing.

function int_int_divide($x, $y) {
return ($x - ($x % $y)) / $y;
}

phplist process bounces

Phplist process bounces stopped working a few days back. Reason probably was an interrupted run of the processbounces script. Tried deleting bounces with the Reset Bounces link in View Bounces section. Didn't work. Then purged the mbox file by rm and touch, fetched some more bounces, now it works.

Sunday, October 14, 2007

PhpSpy trojan and more

One of our machines was found to have the PhpSpy trojan, using which a cracker had put a link to mozzila.net.cn on a webpage. The fake mozilla site is now down - note the spelling -
mozzila
... And we're removed the offending php-based pages from view.

Wednesday, October 10, 2007

dns corrections

Found that the local Cyberoam dns server was repeatedly failing for radiosai.org domain. Checking out the Domain report at dnsstuff.com, found that it had a problem of having a stealth nameserver. Logged into Plesk and changed the ns dns records to w5 and w6, that seems to have fixed the problem. Also added SPF TXT record using the wizard at openspf.org.

phppgadmin issue - blank fields

An issue with phppgadmin cropped up during the db work. If any field which is marked as a key of any type (even unique key) is NULL, clicking Edit next to a record opens the Edit form with all the fields blank - not filled in like in other cases. Does not happen for NULL fields when the fields are not marked as keys. It relates to the way the query is made in phppgadmin....

sql queries for find-replace

Running some sql queries on our pgsql db like
UPDATE "file_id" SET "download_filename" = '-' 
WHERE "filename" ~~ 'SV_MS%'
AND "filename" not like '%MSANTAN%'

UPDATE "file_id" SET "download_filename" =
REPLACE(download_filename,'_RAVI_', '_')
WHERE "filename" ~~ 'MBV%RAVI%'
and filename not like '%ARAVIND%'
and filename not like '%KULA%'
and so on. It took two mornings to finish.

Saturday, October 06, 2007

extra-curricular activities

Aiming to use Dataone for "Loka Samasta Sukhino Bhavantu", doing a bit of cleanup for some other sites on a purely voluntary basis, avoiding the limelight....