Java + Httpd + Tomcat + Sakai installation (step-by-step)

Please change paths according to your failsystem layout ;)

JAVA INSTALLATION:
— 1.
# cp jdk-1_5_0_22-linux-amd64.bin /srv
# cd /srv
# sh jdk-1_5_0_22-linux-amd64.bin
# ln -s jdk1.5.0_22 jdk

# updatedb;locate javac |grep bin
/srv/jdk1.5.0_22/bin/javac



( Continue )

How to Tunnel Remote Desktop Through SSH on a Windows Computer

What you need



Setting up PuTTY


  1. Start PuTTY (double-click on putty.exe). You will see a window similar to this one:
    "

  2. Next, enable compression. Select SSH protocol level 2 as the default in the SSH subcategory for better security:"


( Read more )

Opera 10.51 — The fastest browser on Earth

According to the last Peacekeeper bulletin new version of Opera Web Browser has reached an awesome record in their browser benchmark.
New score it is a result of polishing their new Java Script engine called «Carakan».

Full comparison table of different browser's scores:
http://service.futuremark.com/peacekeeper/results.action?key=3BYq

Opera's test record on Peacekeeper

Congratulations to Opera Desktop Team, that succeed to boost their browser for a such huge leap!
Don't wait and download a new world fastest browser right now.

Disable users list in login screen of Ubuntu 9.10

Run the following command in terminal:


sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type Boolean --set /apps/gdm/simple-greeter/disable_user_list True

Simple example how-to extend JavaScript built-in methods

Let say you want to replace all spaces in string by dashes,
of course you can implement distinct function that does it:



 function ReplaceByDashes(string){
    return string.replace(/\s/g,'-');
 }

 // run it
 var string = "Hello my beautiful world!";
 string=ReplaceByDashes(string);
 alert(string); 



However, we can add our custom method to string object that already built-in in JavaScript:



  if(typeof String.prototype.rbd==='undefined'){ // we have to check if someone hasn't added it already
     String.prototype.rbd = function(){
        return this.replace(/\s/g,'-');
     }
  }

 // run it

 var string = "Hello my beautiful world!";
 string=string.rbd();
 alert(string); 



Some useful example, capitalize first letter of string



String.prototype.ucFirst = function () {
  return (this.substr(0,1).toUpperCase() + this.substr(1,this.length));
}

Confluence+Tomcat+HTTPD(handling HTTPS traffic, with Tomcat backstage) - The easiest way to install Confluence with Tomcat and Httpd!

Confluence is the best Enterprise wiki IMHO.
So that's how you can install and run it -
--------------------------------------------

JAVA INSTALLATION:
------------------
1.

# cp jdk-6u18-linux-x64.bin /srv/
# cd /srv
# sh jdk-6u18-linux-x64.bin
# ln -s jdk1.6.0_18 jdk

# updatedb;locate javac |grep bin
/srv/jdk1.6.0_18/bin/javac
2.
Here /srv/jdk is the actual JAVA_HOME for your machine. Note this as you will need it to run the future commands.

alternatives --install /usr/bin/java java /srv/jdk1.6.0_18/bin/java 100
alternatives --install /usr/bin/jar jar /srv/jdk1.6.0_18/bin/jar 100
alternatives --install /usr/bin/javac javac /srv/jdk1.6.0_18/bin/bin/javac 100


( Read more )

SQL - Update Select (Update a Table Based on Values in another Table)

A simple and quick snippet of SQL to update table values based on the values stored in another table — in other words, UPDATE SELECT. This code has only been tested in MySQL, similar code may be used in MSSQL or other database engines which I will try and add later.

UPDATE SELECT using JOIN Model:


UPDATE Dest
SET    Dest.Address1 = Src.Address1,
       Dest.Address2 = Src.Address2
FROM   SourceTableName Src
JOIN   DestinationTableName Dest ON Dest.PersonID = Src.PersonID



UPDATE SELECT using WHERE Model:


UPDATE DestinationTableName Dest, SourceTableName Src
SET    Dest.Address1 = Src.Address1,
       Dest.Address2 = Src.Address2
WHERE  Dest.PersonID = Src.PersonID

From web to PDF

Some of you who use eBook gadgets may be interested to meet service who let you generate a real PDF-file from any web page with one click only.

So, to receive PDF-version of your web-site all what you need is go to pdfmyurl.com, type URL and click «OK».
  • +1
  • January 20, 2010, 11:24am
  • touki
  • 1

Allow your web site for specific IP addresses using .htaccess

Hello All,
Here is small note, how to allow specific IP addresses to be accessed to your website by using .htaccess,
you may need it while maintenance website.
By assuming your hoster allows using .htaccess
all of you need it is create file named .htaccess
copy paste the code bellow (note some servers want the file be utf-8 encoded otherwise you will get 500 error)
replacing to your actual IPs.


        RewriteEngine on
	RewriteCond %{REMOTE_HOST} !^192\.168\.  #any ip from 192.168.0.0 to 192.168.255.255
	RewriteCond %{REMOTE_HOST} !^192\.190\.1\.86 #just some IP that will be allowed too
	RewriteCond %{REQUEST_URI} /.*$ 
	RewriteCond %{REQUEST_URI} !/maintenance\.html$ #users that aren't allowed will see this page
	RewriteCond %{REQUEST_URI} !(css|png|jpg)$ # if maintenance.html consists images, you have to allow them either.
	RewriteRule .* maintenance.html [R=301,L]


Also you can block users by IP, by changing a little the rules above.

Change grub2 font-size

I searched and searched for the answer to the following question: «How do I change the font size in grub2?» It seems that no one on the entire Internet knew!

Well, I did a lot of digging into the grub2 documentation and the scripts bundled with Ubuntu and I finally have the answer!

1. Pick a font you want to use for your menu. I recommend a nice easy-to-read monospace font such as DejaVu Sans Mono (it's in the example below).
2. Convert the font to grub2's format using the grub-mkfont command, taking the extra step of setting the font size:

sudo grub-mkfont --output=/boot/grub/DejaVuSansMono.pf2 \
--size=24 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf

3. GRUB_FONT=/boot/grub/DejaVuSansMono.pf2
GRUB_FONT=/boot/grub/DejaVuSansMono.pf2

4.

sudo update-grub



FYI: I believe the "--size=" indicates point size but I'm not entirely sure (the documentation doesn't say). If it is based on the point scale I don't believe it is taking dpi into account since I tried "--size=72" on a 120dpi display and letters were only about half an inch tall (72 points is precisely one inch).

By riskable

How to align window's control buttons in Ubuntu 10.4 to left


gconftool-2 --set "/apps/metacity/general/button_layout" --type string "menu:minimize,maximize,close"

Wrong keyboard mapping in GNOME when working with VNC/XRDP

To fix the subj issue
add the following lines:


export XKL_XMODMAP_DISABLE=1
gconftool-2 -t bool --set /apps/gnome_settings_daemon/plugins/keyboard/active false


at the top of /etc/X11/Xsession

If you need any help with RDP on Linux, let me know

P.S Tested on Ubuntu 9.10

CSS hacks

/***** Selector Hacks ******/
 
/* IE6 and below */
* html #uno { color: red }
 
/* IE7 */
*:first-child+html #dos { color: red }
 
/* IE7, FF, Saf, Opera */
html>body #tres { color: red }
 
/* IE8, FF, Saf, Opera (Everything but IE 6,7) */
html>/**/body #cuatro { color: red }
 
/* Opera 9.27 and below, safari 2 */
html:first-child #cinco { color: red }
 


( Read more )

Guest machine for Virtualbox with preinstalled Django, Pylons and Ruby On Rails

This weekend I have devoted my time for playing with the new and famous frameworks Django, Pylons, and Ruby On Rails.
Almost 80% of the weekend I spent on installing them, if you don't wanna spend time by installing these frameworks and want start playing with them immediately, you are welcome to use my already configured virtual machine for Virtualbox.

First of all you will need Virtualbox, then download image of my virtual machine:
Server 1
Server 2

Extract the archive and import the virtual appliance to Virtualbox
Importing Guest Machine



( Read more )

[cfwheels] Apache with Tomcat and url rewriting

Hell YES. This ^&(%^989&^%*(% Tomcat is now working for me like a bleeding
pig. Hell YES!!! 12 hours of making this shit working. I am dying :F

I haven't found anywhere instruction so I put this in here

Assumption data:

— site folder is f:/usr/htdocs/cfpages/site
— site folder is accessible by the Apache
— our site is localFirstCFWheels
— no mod_jk no mod URLFilter or how this shit is called
— pure apache rewrite rules
— Apache Tomcat 6.0.26 Server
— Apache 2.2.13 (and later)
— Railo 3.1.2.001
— Apache Tomcat is configured to listen on 8100 port



( Read more )

Create a task in Windows XP/7 Task Scheduler using batch file

In my current job we needed to automatize some processes by using Windows Task Scheduler; I wrote a batch file, which you may find useful,
especially when you don't have direct/remote access to user's desktop.

The main problem of implementation this task was Windows Vista/7 with its UAC, I had to use powershell to get Admin privileges by popping a window prompt to user directly to accept rather than have the user type the password manually upon the request.


( Read more )

Chrome of your dream

Each of us has your-own favorite browser, that we're using in our regular life. But sometimes we just need a good solution for a portable browser that we can run from our USB flash-drive (aka disk-on-key). Today I'll tell how to make a portable build of Chrome.

1. We need to download the last available build (chrome-win32.zip) of Chromium. You can find it here:
build.chromium.org/buildbot/snapshots/chromium-rel-xp/?C=M;O=D

2. Create a new folder «Chrome»

3. Unzip chrome-win32.zip to this folder. The path to chrome.exe must be something like «..\Chrome\chrome-win32»

As I told above, we want to build a portable build of browser that could work from USB-drive at any PC. Because Windows doesn't support relative path in shortcuts (LNK-files) we have to create a separate cmd-file with startup options as command line parameters.



( Read more )
  • +1
  • June 27, 2010, 10:59am
  • touki
  • 1

Top 50 Programming Quotes of All Time


50. «Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning.»
— Rick Cook

49. «Lisp isn't a language, it's a building material.»
— Alan Kay.

48. «Walking on water and developing software from a specification are easy if both are frozen.»
— Edward V Berard

47. «They don't make bugs like Bunny anymore.»
— Olav Mjelde.

46. «A programming language is low level when its programs require attention to the irrelevant.»
— Alan J. Perlis.

45. «A C program is like a fast dance on a newly waxed dance floor by people carrying razors.»
— Waldi Ravens.

44. «I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.»
— Bjarne Stroustrup

43. “Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter.”
— Eric S. Raymond

42. “Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.”
— Mosher’s Law of Software Engineering

41. “I think Microsoft named .Net so it wouldn’t show up in a Unix directory listing.”
— Oktal


( Read more )

Removing dangling commits and those reachable from the reflogs

If you see something like that:
$ git fsck --lost-found
dangling commit 9dbd85d427b32773aee016efc7912f9d1c39aac4
dangling commit 604948146be1bdc2181962543cca039c18cc06b4


You might want to get rid of those dangling commits, in order to accomplish it, do following:
git reflog expire --expire=now --all #Dangerous command, it will be very difficult to recover stuff later on, if you execute it
git gc --prune=now

Have you ever wondered how does look the computation of Fibonnaci number in assembly?

Have you ever wondered how does look the computation of Fibonnaci number in assembly?

For sake of curiosity I chose Pep/8 Assembler and Simulator which could be found on http://code.google.com

The original C uncached version looks as following:


#include <iostream>
using namespace std;
int fib (int n)
{
    if (n == 0)
    {
        return 0; 
    }
    else if (n == 1)
    {
        return 1;
    }
    else
    {
       return fib (n - 1) + fib (n - 2);
    }
}
int main ()
{
    int num;
    cout << "Which Fibonacci number? ";
    cin >> num;
    cout << "The number is " << fib (num) << endl; 
    return 0;
}


The Pep/8 implementation:


( Read more )