About This Journal
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
A href = “#” with javascript event onclick issue on IE
pepesmith
I have this kind of link on my code :
< a href = '#' onclick='javascript:window.open("http://somelocation.net/")'>somelocation </a>
The problem with this is that whenever this is clicked in a MS IE browser, both the original link and the new window is executed.
I was expecting that only the new window will be displayed and refresh. To solve this, i’ve changed my code to :
<href = '#' onclick='javascript:window.open("http://somelocation.net/");return false;' >
somelocation <a>
That solves the issue.
Posted in Miscellaneous |
2 Comments »
Perl: Appending array in a hash element
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
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
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)
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 »