Funny comments in source codes ;)


//When I wrote this, only God and I understood what I was doing
//Now, God only knows 



_margin: 40px; /* hack for IE browser (assuming that IE is a browser) */




( 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 )

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 )

[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 )

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

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 )

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 )

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 )

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));
}

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