Archive for May 2008
internet explorer expected identifier, string or number
huh, IE is one of those curses which came down to earth from the hell.
anyway if you face such problem you should check the following stuffs -
1. this guy described about the first problem
2. here is what i have faced and resolved,
i had a javascript code like this -
var element = new Element(“a”, {class: “keyboard_option_link”, href: “javascript: void(0)”});
so IE minds, because i have used “class” the fix i have used -
var element = new Element(“a”, {“class”: “keyboard_option_link”, href: “javascript: void(0)”});
this things now working fine,
best wishes,
nginx on debian box
i had a tough time to configure nginx on my debian production environment.
the recent stable release from nginx is 0.6.x but on debian repository it was 0.4.x, so i had to build it from the source and install it.
since i had an old 0.4.x instance of nginx, installation wasn’t as smooth as i was expecting. here i would try to show how i have resolved those broken issues and made my way to run nginx to reverse proxy my backend mongrel instances.
i took several attemtps to remove the existing 0.4.x instance of nginx but i failed.
i used “aptitude remove nginx” i ended with the following error -
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
nginx
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives.
After unpacking 582kB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database … 78227 files and directories currently installed.)
Removing nginx …
Stopping nginx: nginx.
Stopping nginx: invoke-rc.d: initscript nginx, action “stop” failed.
dpkg: error processing nginx (–remove):
subprocess pre-removal script returned error exit status 1
Starting nginx: nginx.
Errors were encountered while processing:
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
though this is not my real error code but it has similarity, i took it from the following url -
http://sudhanshuraheja.com/2007/09/remove-nginx-from-ubuntu-fiesty-fawn.html
this blog author had some suggestion, but that wasn’t working for me, so i tried in different way -
i executed “sudo apt-get build-dep nginx” i found this tips from one of the blog comments
the comment author explained in this way -
“this should install everything required to build the package (compiler, headers/libs, packaging tools). Usually on a fresh install I do this to get everything required to build zope.Then issue “apt-get source nginx” (you need deb-src sources in /etc/apt/sources.list). This will download nginx sources (original tarball, diff, and uncompressed sources with patches applied). Just cd in source dir, make your modifications and use “dpkg-buildpackage -rfakeroot -b” (this requires fakeroot package). In parent directory you should get new deb files ready to install, with start/stops scripts and your patches. Just take care of package update that will surely remove your nginx version.”
if you want service script to initiate nginx on startup follow the link -
http://blog.labratz.net/articles/2006/10/03/rails-deployment-apache-lighttpd-nginx-mongrel-cluster
best wishes,
ruby dynamic factory method implementation
i was looking for some way out to implement factory method on ruby code. where i have a VersionControl::ServiceFactory which will take different implementation as factory method. ie. VersionControl::ServiceFactory::subversion, VersionControl::ServiceFactory::git and so on.
though all these “subversion, git, perforce” methods are not predefined, these will be added while new implemention is added. my skeleton (abstract) implementation was in VersionControl::Service, so whatever implemention (svn, git, perforce, other) comes ahead it will implement method from VersionControl::Service method. since ruby doesn’t support class abstraction so this was the only way i got in head.
so my skeleton implemention was consist of the following code in summary -
module VersionControl
# log entry class for data object
class LogEntry; end
# local repository information
class Information; end
# abstract service class.
# define service which will be exposed for a
# normal version controlling service.
class Service
# retrieve recent logs from the current directory
# required parameters - *base project path* and other options.
def logs(p_path, p_options = {}); raise "not implemented method" end
# generate diff from mentioned revision number
# or current revision number
# required parameters - *base project path* and other options.
def diff(p_path, p_options = {}); raise "not implemented method" end
# find repository information
def info(p_path, p_options = {}); raise "not implemented method" end
# check out content from version control server
def checkout(p_source, p_path, p_options = {}); raise "not implemented method" end
end
# factory class for supporting different version control implementation
class ServiceFactory; end
end
and the implementation is written in this way -
class ServiceFactory class < < self # add subversion factory method implementation @@subversion_instance = SubversionService.new def subversion return @@subversion_instance end end end
so every implementation also push it’s factory method to “VersionControl::ServiceFactory” class. so this way i have implemented dynamic factory method on ruby.
GITIdea intelliJ idea plugin for GIT
i just started using GIT, i say i love it.
since i have been using IntellIJ idea for a long while, in GIT world i felt like alone though i was using idea but not getting any idea how to live without some IDE’s version control support.
i want to compare my changes before i commit, i want to see more user friendly diff merging tool which idea is providing with other version control support.
so i found GITIDEA over here http://github.com/Fudge/gitidea/tree/master, after cloning and building this project.
i found it wasn’t working. so looking into code i found, it is executing “git” command. since my “git” executable is not under /usr/s|bin, i had to create a new symblink to make it work.
now it is working great, i can see where i have changed just by looking at the code (which bhaves like the usual svn support).
thanks fudge




