user-avatar
Today is Saturday
November 23, 2024

Category: tech

October 29, 2009

The White Screen of Death (Completely Blank Page) in drupal

by viggy — Categories: drupal, tech, web — Tags: , , , , Leave a comment

Occasionally a site user or developer will navigate to a page and suddenly the page content disappears, and is completely blank. No content. No errors. Nothing. This often, but not always, happens after updating a module, theme, or Drupal core. This is what is referred to by most members of the Drupal community as the White Screen of Death or WSOD. There are several reasons why this might occur, and therefore several possible solutions to the issue.

For how to solve this problem, look here.

October 29, 2009

How to enable error reporting in drupal

by viggy — Categories: drupal, tech, web — Tags: , , , 2 Comments

Courtsey: http://drupal.org/node/158043
Enable Error Reporting

Although it may be turned off on commercial hosts and production sites (for good reason, so that users do not see the errors), these errors are one of your best tools for troubleshooting. To enable error reporting, temporarily edit your index.php file (normally located in your root directory) directly after the first opening PHP tag (do not edit the actual file info!) to add the following:

<?php

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

// $Id: index.php,v 1.94 2007/12/26...

You will now be able to see any errors that are occurring directly on the screen. Memory problems may still not be displayed, but it’s the first step in a process of elimination.

If you are using a multi-site setup and only want errors to appear for one site, then check the name of the host first as in:

October 26, 2009

Significance of Lost+found directory in Linux filesystem

by viggy — Categories: linux, tech, ubuntu — Tags: , , , Leave a comment

Courtsey: http://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/lostfound.html
As was explained earlier during the overview of the FSSTND, Linux should always go through a proper shutdown. Sometimes your system might crash or a power failure might take the machine down. Either way, at the next boot, a lengthy filesystem check (the speed of this check is dependent on the type of filesystem that you actually use. ie. ext3 is faster than ext2 because it is a journalled filesystem) using fsck will be done. Fsck will go through the system and try to recover any corrupt files that it finds. The result of this recovery operation will be placed in this directory. The files recovered are not likely to be complete or make much sense but there always is a chance that something worthwhile is recovered. Each partition has its own lost+found directory. If you find files in there, try to move them back to their original location. If you find something like a broken symbolic link to ‘file’, you have to reinstall the file/s from the corresponding RPM, since your file system got damaged so badly that the files were mutilated beyond recognition. Below is an example of a /lost+found directory. As you can see, the vast majority of files contained here are in actual fact sockets. As for the rest of the other files they were found to be damaged system files and personal files. These files were not able to be recovered.

total 368
-rw-r–r– 1 root root 110891 Oct 5 14:14 #388200
-rw-r–r– 1 root root 215 Oct 5 14:14 #388201
-rw-r–r– 1 root root 110303 Oct 6 23:09 #388813
-rw-r–r– 1 root root 141 Oct 6 23:09 #388814
-rw-r–r– 1 root root 110604 Oct 6 23:09 #388815a
-rw-r–r– 1 root root 194 Oct 6 23:09 #388816
srwxr-xr-x 1 root root 0 Oct 6 13:00 #51430
srwxr-xr-x 1 root root 0 Oct 6 00:23 #51433
-rw——- 1 root root 63 Oct 6 00:23 #51434
srwxr-xr-x 1 root root 0 Oct 6 13:00 #51436
srwxrwxrwx 1 root root 0 Oct 6 00:23 #51437
srwx—— 1 root root 0 Oct 6 00:23 #51438
-rw——- 1 root root 63 Oct 6 13:00 #51439
srwxrwxrwx 1 root root 0 Oct 6 13:00 #51440
srwx—— 1 root root 0 Oct 6 13:00 #51442
-rw——- 1 root root 63 Oct 6 23:09 #51443
srwx—— 1 root root 0 Oct 6 10:40 #51445
srwxrwxrwx 1 root root 0 Oct 6 23:09 #51446
srwx—— 1 root root 0 Oct 6 23:09 #51448

October 22, 2009

This blog is from Gscribble.

by viggy — Categories: linux, tech, ubuntu — Tags: Leave a comment

The initial version of gscribble looks great. Looking forward many more features added to it. I hope someday I will also contribute to it greatly.

October 19, 2009

Shifted from #twitter to #identi.ca

by viggy — Categories: Misc, tech — Tags: , , , Leave a comment

I was trying to add a twibbon on my gravatar to support 5 years of Mozilla and I got the following error from the server. It made me realize that twibbon and twitter must be running on windows server. Hence thought of shifting immediately to identi.ca. The error is following. Hope it will be useful to crack into the server. ;).
[ArgumentException: You must specify a token]
Twibbon.Services.TwitterService.GetUserByToken(OAuthToken access, Int32 attempt, String ipAddress) in D:DevelopmentTwibbontrunkTwibbon.ServicesTwitterTwitterService.cs:870
Twibbon.Services.TwitterService.GetUserByToken(OAuthToken access, Int32 attempt, String ipAddress) in D:DevelopmentTwibbontrunkTwibbon.ServicesTwitterTwitterService.cs:868
Twibbon.Web.Controllers.AuthenticateController.Index(String returnUrl) in D:DevelopmentTwibbontrunkTwibbon.WebControllersAuthenticateController.cs:49
lambda_method(ExecutionScope , ControllerBase , Object[] ) +85
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24
System.Web.Mvc.c__DisplayClassa.b__7() +52
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +254
System.Web.Mvc.c__DisplayClassc.b__9() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +192
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +399
System.Web.Mvc.Controller.ExecuteCore() +126
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +27
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +151
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

October 18, 2009

bash script to telnet

by viggy — Categories: programming, shell, tech — Tags: , Leave a comment

It is sad that I have found this solution after so many days. It is more sad that I never tried to look for this solution earlier. I must have found it atleast 3 months ago. Anyways now that I have found it, let me tell you what exactly I want to do and how the simple script helps me do it.

I have been playing with qmail and qpsmtpd from last 3-4 months. Now to test my set-up, I used to telnet to the port and then used to enter different telnet commands and used to watch the logs simultaneously to get errors.
Now everytime I used to enter the commands manually and that too I couldnt just go to history and execute it as telnet does not support storing commands in history.
Anyway finally today I got fed up of it and I thought let me see if there is a solution so that I dont have to enter commands manually. I didnt expect a solution. But when I searched for it, I found that it was so easy to do it. You just need to execute the following command.
./smtp.sh | telnet

and the contents of smtp.sh is given below:
#!/bin/sh
host=127.0.0.1
port=25
echo open $host $port
sleep 10
echo helo deeproot.co.in
sleep 10
echo mail from:test2@domain
sleep 10
echo rcpt to:test3@domain
sleep 50
echo data
sleep 10
echo checking
echo .
sleep 10
echo quit
#end

You can customize the script to anything that will make your life easier with telnet. I found this solution here, http://www.linuxforums.org/forum/linux-programming-scripting/92466-telnet-script.html

September 9, 2009

using routes.rb to change the default home page in redmine

by viggy — Categories: Misc, tech — Tags: , 2 Comments

After installing Redmine on the server, I wanted the default home page when to be shown as the home page of my project and not the complete redmine directory. After searching for a while, I found that it can be dome by doing necessary changes in routes.rb file in the config directory. Then I asked it in #redmine channel on freenode server in IRC. And I found the solution there thanks to “relaxdiego”.
I have copied the chat here so that I dont miss anything that was pointed out by him(Also I am too lazy to write it all again).
iggy_prabhu> hi friends
viggy_prabhu> I have installed redmine and added one of my projects
viggy_prabhu> now i want that whenever i open the redmine domain, it directly opens the home page of the project and not the home page
viggy_prabhu> Can I do this by route.rb file or should I use rewrite mod in apache to do this
viggy_prabhu> ?
relaxdiego> viggy_prabhu: try modifying the map.home entry in routes.rb
viggy_prabhu> relaxdiego, any good HOWTO before I start modifying it?
* jas4711_ has quit (“Ex-Chat”)
relaxdiego> none that I know of
relaxdiego> map.home ”, :controller => ‘projects’, :project_id => (your project’s id)
relaxdiego> try that
relaxdiego> and for Rails routing: http://api.rubyonrails.org/classes/ActionController/Routing.html
viggy_prabhu> relaxdiego, i have done the necessary changes
viggy_prabhu> should I restart my apache?
relaxdiego> yep
viggy_prabhu> i did it and got the changes
viggy_prabhu> but i want projects/show/myproject to appear instead of the list of projects
viggy_prabhu> (at present I have only one project)
viggy_prabhu> relaxdiego, hope you got my doubt?
relaxdiego> what’s your project’s id?
relaxdiego> map.home ”, :controller => ‘projects’, :action => ‘show’, :project_id => (your project’s id)
* kibaho1 (n=pelamm@gw.tietoteema.fi) has joined #redmine
viggy_prabhu> relaxdiego, “The page you were trying to access doesn’t exist or has been removed” i am getting this error now
viggy_prabhu> map.home ”, :controller => ‘projects’, :action => ‘show’, :project_id => ‘myproject’
relaxdiego> sorry, i think i got it wrong
relaxdiego> this works for me –> map.home ”, :controller => ‘projects’, :action => ‘show’, :id => (project id)
viggy_prabhu> relaxdiego, finally it is working
viggy_prabhu> relaxdiego, thanks a lot for your time :)
relaxdiego> np :)

July 21, 2009

How to search a perl function’s man page

by viggy — Categories: perl — Tags: , , Leave a comment

If you know the name of the function and you want to see the man page for that function, then you can use the following command.

perldoc -f “function name” //without quotes

for example,

perldoc -f our
perldoc -f sysopen

July 21, 2009

Perl-error “.pm did not return a true value at”

by viggy — Categories: perl — Tags: , , Leave a comment

This is one of the errors that I got when I started using perl modules.
It was because I had not put “1;” at the end of my perl module. So I did not get the error after I put “1;” at the end of the perl module.

why is the “1;” necessary at the end of perl modules?

Typically, a module contains a bunch of subroutine definitions.  A
module may also contain code which is not part of a subroutine. This
code is executed at the time the module is loaded, so it can be used
to initialize the module. For example, the module might open
adatatbase connection or initialize some time at the time it is
loaded.


Such code might be successful, or it might fail. Perl allows the
module to indicate the result by returning a true or false value back
to its caller. If the value is false, Perl aborts the compilation
with an error message.

Unfortunately, the default return value is *false*, so a module which
just defines a bunch of subroutines, and which has no initialization
code, accidentally returns a false value back to the caller, and Perl
aborts. So we insert "1;" at the end to suppress this misbehavior.

http://dev.perl.org/rfc/269.pod
http://dev.perl.org/rfc/269.html

discusses this in some more detail.

For documentation, see perldiag:

%s did not return a true value
(F) A required (or used) file must return a true value
to indicate that it compiled correctly and ran its
initialization code correctly. It's traditional to
end such a file with a "1;", though any true value
would do. See the require entry in the perlfunc man-
page.

and the relevant part of 'perlfunc':

The file must return true as the last statement
to indicate successful execution of any initialization code, so
it's customary to end such a file with "1;" unless you're sure
it'll return true otherwise. But it's better just to put the
"1;", in case you add more statements.

Courtsey: http://lists.netisland.net/archives/phlpm/phlpm-2001/msg00426.html

June 22, 2009

how to extract different types of compressed files.

by viggy — Categories: linux, tech, ubuntu — Tags: , Leave a comment

This is a quick guide for different commands to decompress different types of files. Most of them can just be obtained from readin man page of tar command.

  • .tar.gz – command$: tar xvfz file.