Kadjo

SoftDev Journal

About This Journal

24 June 2007 by Jojo Makiling

Technical concerns tend to find a solution as long as there are good people working on them. And Linux has the very best. - Linus Torvalds

Perl: Appending array in a hash element

December 31st, 2008 by pepesmith

My code :
push($parentmenu{$parentkey}{childlist},[$childmenu{$childid}{name},$childmenu{$childid}{link}]);

Gives me this error.

Type of arg 1 to push must be array (not hash element) at ./test.cgi line 34, near “])”
Execution of ./test.cgi aborted due to compilation errors.

And it was just resolved by adding the @ and enclose it with {} - see the code below. I need an explanation though, but I’ll have to find the explanation later, for the meantime the solution just worked for my task.

push(@{$parentmenu{$parentkey}{childlist}},[$childmenu{$childid}{name},$childmenu{$childid}{link}]);

Posted in Miscellaneous | No Comments »

Search and Replace text in all files in a folder and its subfolders

November 25th, 2008 by pepesmith

Tip for those who are lazy enough to use vi and do :%/origstring/newstring/g on each files.

To replace all string occurence:

find /your/home/dir -name "*.txt" | xargs perl -pi -e 's/origstring/newstring/g'

To replace the first occurance:

find /your/home/dir -name "*.txt" | xargs perl -pi -e 's/origstring/newstring/'

To replace all files in a folder:

for arg in `ls -C1`; do perl -pi -e 's/origstring/newstring/g'; done;

Posted in Miscellaneous | No Comments »

Get the Distro version of your Linux

April 2nd, 2008 by pepesmith

To determine the version of a linux OS, a command cat will be helpfull enough.

Here is the command:


#cat /proc/version
Linux version 2.6.18-4-amd64 (Debian 2.6.18.dfsg.1-12) (waldi@debian.org)
(gcc version 4.1.2 20061115 (prerelease)
(Debian 4.1.1-21)) #1 SMP Mon Mar 26 11:36:53 CEST 2007

Posted in Miscellaneous | No Comments »

Debian XSP problem (service temporary unavailable)

March 22nd, 2008 by pepesmith


Service Temporarily Unavailable
The server is temporarily unable to service
your request due to maintenance downtime or capacity problems.
Please try again later.
——————————————————————————–

This is the error i’ve encounted on my server when I try to enable the XSP2 capability of my debian box. By the way XSP (and XSP2) is a webserver written in C# that hosts ASP.NET’s System for Linux and other UNIX operating systems.

To fix this issue, the line of /etc/mono-server2/mono-server2-hosts.conf which contains:

MonoServerPath /usr/lib/mono/2.0/mod-mono-server2.exe

must be changed to:

MonoServerPath default /usr/lib/mono/2.0/mod-mono-server2.exe

Posted in Miscellaneous | No Comments »

Xen Guest (domu) systems time reset

March 22nd, 2008 by pepesmith

Lately, I’ve noticed that the date and time of my xen guest is not accurate. I’ve decided to reset it using the date command.

This is the wrong date

debianguest:/home/pepesmith# date
Tue Feb 19 11:23:01 PHT 2008

To change it, i issued (the date should be 22 March 2008 11:28):

debianguest:/home/pepesmith# date “032211282008″
Sat Mar 22 11:28:00 PHT 2008

I really expects that the date command issued will take effect. So to confirm that the date really was changed I issued again a date command.


debianguest:/home/pepesmith# date
Tue Feb 19 11:24:01 PHT 2008

And to my surprise the time is still not changing!

I suspect that something is wrong with the setting thus I go to the Dom0, the host server. I observed that the time being used by the guest is similar to host systems clock. So I decided to changed the host systems time. I’ve checked again the systems time of the guest. This time I’ve realised that the guest time is very dependent on the host. A guest systems time may be changed but then after few minutes (seconds), it will use the host systems time.

Googling for some answers, I’ve stumbled across the answer from a mailing list.[1] It is saying that a command :
echo 1 > /proc/sys/xen/independent_wallclock
should be issued. And when I issued the command and observed the guest for a few minutes, the system clock stays the same as I expect it to be.

The only problem is that when a user reboots the guest, the value 1 of the file /proc/sys/xen/independent_wallclock returns to 0.
But i think the problem will be solved by a creating a startup script that updates that particular file.

[1] http://lists.xensource.com/archives/html/xen-users/2005-05/msg00169.html

Posted in Miscellaneous | No Comments »

« Previous Entries